:root{
    --ink:#342a24;--muted:#81756c;--brown:#5b3927;--brown-dark:#3e281d;
    --cream:#f5efe6;--paper:#fffdf9;--line:#e5d8c8;--gold:#b48a43;
    --green:#587354;--amber:#9b6b27;--danger:#9a4d3e;
    --shadow:0 16px 42px rgba(62,42,29,.08);
}
*{box-sizing:border-box}
html{background:var(--cream);color:var(--ink)}
body{margin:0;min-height:100vh;font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;background:radial-gradient(circle at 8% 0%,rgba(180,138,67,.10),transparent 30rem),linear-gradient(180deg,#f8f4ed 0%,#f4eee5 100%)}
button,input{font:inherit}
a{color:inherit}
code{font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:.9em}
.eyebrow{margin:0 0 8px;color:var(--gold);font-size:.74rem;font-weight:800;letter-spacing:.15em;text-transform:uppercase}
h1,h2{margin-top:0;font-family:Georgia,"Times New Roman",serif;font-weight:500;color:var(--brown-dark)}
h1{font-size:clamp(2.2rem,5vw,3.5rem);line-height:1;margin-bottom:13px}
h2{font-size:1.55rem;margin-bottom:10px}
.topbar{min-height:76px;display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:20px;padding:12px max(24px,calc((100vw - 1180px)/2));border-bottom:1px solid rgba(121,96,74,.14);background:rgba(255,253,249,.88);backdrop-filter:blur(12px)}
.brand,.section-title{display:flex;align-items:center;gap:13px;text-decoration:none}
.brand{justify-self:start}
.section-title{justify-self:center}
.brand-cat{display:grid;place-items:center;width:45px;height:45px;border-radius:12px;background:#efe5d8;font-size:1.45rem}
.brand strong,.brand small,.section-title strong,.section-title small{display:block}
.brand strong,.section-title strong{font-family:Georgia,"Times New Roman",serif;font-size:1rem;font-weight:500}
.brand small,.section-title small{margin-top:2px;color:var(--muted);font-size:.72rem}
.back-link{justify-self:start;text-decoration:none;color:var(--brown);font-size:.86rem;font-weight:750}
.back-link:hover{text-decoration:underline}
.topbar form{justify-self:end}
.text-button{padding:8px 11px;border:0;background:transparent;color:var(--muted);cursor:pointer}
.text-button:hover{color:var(--brown)}
.dashboard-shell{width:min(1180px,calc(100% - 40px));margin:0 auto;padding:52px 0 60px}
.welcome{display:flex;align-items:flex-end;justify-content:space-between;gap:30px;margin-bottom:30px}
.compact-welcome{align-items:center}
.welcome p:not(.eyebrow){margin:0;color:var(--muted);line-height:1.6;max-width:780px}
.status-pill{display:inline-flex;align-items:center;gap:8px;flex:0 0 auto;padding:9px 12px;border:1px solid var(--line);border-radius:999px;background:rgba(255,255,255,.55);color:var(--muted);font-size:.78rem;font-weight:700}
.status-pill span{width:8px;height:8px;border-radius:50%;background:var(--amber)}
.status-pill.is-good span{background:var(--green)}
.admin-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px}
.admin-card{display:flex;flex-direction:column;padding:25px;border:1px solid var(--line);border-radius:18px;background:rgba(255,253,249,.94);box-shadow:var(--shadow)}
.admin-grid .admin-card{min-height:245px}
.card-top{display:flex;justify-content:space-between;gap:18px;margin-bottom:22px}
.card-kicker{color:var(--gold);font-size:.72rem;font-weight:800;letter-spacing:.12em;text-transform:uppercase}
.card-state{color:#9b8e84;font-size:.72rem}
.admin-card p{margin:0;color:var(--muted);line-height:1.62}
.card-actions{display:flex;align-items:center;gap:14px;flex-wrap:wrap;margin-top:auto;padding-top:26px}
.primary-link{display:inline-flex;align-items:center;min-height:40px;padding:0 14px;border-radius:8px;background:var(--brown);color:#fff;text-decoration:none;font-size:.82rem;font-weight:750}
.primary-link:hover{background:var(--brown-dark)}
.disabled-link{color:#aaa097;font-size:.8rem}
.manage-grid{display:grid;grid-template-columns:minmax(0,1.15fr) minmax(320px,.85fr);gap:20px;align-items:start}
.form-panel,.list-panel{min-height:0}
.field{margin-bottom:22px}
.field label{display:block;margin:0 0 8px;color:var(--brown-dark);font-size:.87rem;font-weight:750}
input[type=text],input[type=url],input[type=password]{width:100%;min-height:48px;padding:0 14px;border:1px solid #d9cab8;border-radius:10px;background:#fff;color:var(--ink);outline:none}
input[type=text]:focus,input[type=url]:focus,input[type=password]:focus{border-color:#a78561;box-shadow:0 0 0 3px rgba(167,133,97,.12)}
.field-help{margin:8px 0 0;color:var(--muted);font-size:.8rem}
.file-input{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none}
.upload-box{display:block;margin:0;border:1px dashed #cbb899;border-radius:14px;background:#fcf8f1;cursor:pointer;overflow:hidden}
.upload-box:hover{background:#faf3e8;border-color:#a98b61}
.upload-preview-wrap{display:grid;min-height:220px;place-items:center;padding:20px}
.upload-placeholder{display:grid;justify-items:center;gap:7px;color:var(--muted);text-align:center}
.upload-placeholder small{color:#9a8f86}
.upload-placeholder.is-hidden{display:none}
.upload-icon{display:grid;place-items:center;width:44px;height:44px;margin-bottom:4px;border-radius:50%;background:#efe4d5;color:var(--brown);font-family:Georgia,serif;font-size:1.7rem}
.cover-preview{display:none;max-width:190px;max-height:280px;border-radius:7px;box-shadow:0 14px 28px rgba(47,34,25,.18)}
.cover-preview.is-visible{display:block}
.primary-button{width:100%;min-height:49px;margin-top:2px;border:0;border-radius:9px;background:var(--brown);color:#fff;font-weight:750;cursor:pointer}
.primary-button:hover{background:var(--brown-dark)}
.primary-button:disabled{opacity:.5;cursor:not-allowed}
.notice{margin:0 0 22px;padding:14px 16px;border:1px solid #dacbb9;border-radius:10px;background:#faf5ed;color:#63584f;font-size:.86rem;line-height:1.5}
.notice ul{margin:8px 0 0 18px;padding:0}
.notice-error{border-color:#dab2aa;background:#fbefec;color:#7d3d32}
.notice-success{border-color:#bfd0b8;background:#eef5eb;color:#43553f}
.recent-heading{display:flex;justify-content:space-between;align-items:flex-start;gap:15px;padding-bottom:18px;border-bottom:1px solid var(--line)}
.pill{display:inline-flex;align-items:center;padding:7px 10px;border:1px solid var(--line);border-radius:999px;background:#fffaf4;color:var(--muted);font-size:.72rem;white-space:nowrap}
.recent-list{display:grid}
.recent-book{display:grid;grid-template-columns:24px 42px minmax(0,1fr);gap:12px;align-items:center;padding:12px 0;border-bottom:1px solid var(--line)}
.recent-book:last-child{border-bottom:0}
.recent-number{color:#aa9b8f;font-family:Georgia,serif;font-size:.85rem;text-align:center}
.recent-book img{width:42px;height:61px;object-fit:cover;border-radius:4px;background:#eee6dc;box-shadow:0 4px 10px rgba(45,33,25,.10)}
.recent-copy{min-width:0;display:grid;gap:4px}
.recent-copy strong{overflow:hidden;color:var(--ink);font-family:Georgia,"Times New Roman",serif;font-size:.91rem;font-weight:500;line-height:1.22;text-overflow:ellipsis}
.recent-copy span{overflow:hidden;color:var(--muted);font-size:.77rem;line-height:1.25;text-overflow:ellipsis}
@media(max-width:800px){
    .topbar{grid-template-columns:1fr auto;padding-left:16px;padding-right:16px}
    .section-title{display:none}
    .dashboard-shell{width:min(100% - 24px,650px);padding-top:34px}
    .welcome{display:grid;align-items:start}
    .admin-grid,.manage-grid{grid-template-columns:1fr}
}
