:root {
    --ink: #17251e;
    --muted: #68766e;
    --paper: #f4f1e9;
    --surface: #fffdf8;
    --line: #dedbd2;
    --green: #176b45;
    --green-soft: #dff3e7;
    --blue: #285b9a;
    --blue-soft: #e6effa;
    --amber: #9a650f;
    --amber-soft: #fff0cb;
    --red: #a33a32;
    --shadow: 0 18px 60px rgba(32, 45, 37, .11);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at 10% 0%, rgba(35, 112, 76, .10), transparent 34rem),
        var(--paper);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.topbar {
    height: 72px;
    padding: 0 clamp(20px, 4vw, 64px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 253, 248, .92);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(14px);
    position: sticky;
    top: 0;
    z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 15px; letter-spacing: -.01em; }
.brand span { color: var(--muted); font-size: 12px; margin-top: 2px; }
.brand-mark {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: var(--ink);
    color: #fff;
    font-weight: 800;
    letter-spacing: .08em;
}
.brand-mark.small { width: 42px; height: 42px; border-radius: 12px; font-size: 13px; }
.logout { color: var(--muted); text-decoration: none; font-size: 14px; }
.logout:hover { color: var(--ink); }

.shell { width: min(1480px, calc(100% - 40px)); margin: 0 auto 64px; }
.hero {
    padding: 54px 0 34px;
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 32px;
    align-items: end;
}
.eyebrow {
    margin: 0 0 10px;
    color: var(--green);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .14em;
    text-transform: uppercase;
}
.hero h1, .login-card h1 {
    margin: 0;
    max-width: 720px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(34px, 5vw, 62px);
    line-height: .98;
    letter-spacing: -.04em;
    font-weight: 500;
}
.hero p:not(.eyebrow) { color: var(--muted); margin: 18px 0 0; font-size: 16px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stat {
    min-height: 94px;
    padding: 17px;
    border-radius: 18px;
    background: var(--surface);
    border: 1px solid var(--line);
}
.stat span { display: block; font: 500 30px/1 Georgia, serif; }
.stat small { display: block; margin-top: 9px; color: var(--muted); }
.stat.green { background: var(--green-soft); border-color: #b9dcc7; }
.stat.blue { background: var(--blue-soft); border-color: #c6d8ed; }
.stat.amber { background: var(--amber-soft); border-color: #ead69f; }

.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tab {
    padding: 12px 18px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    background: rgba(255,255,255,.55);
    cursor: pointer;
    font-weight: 700;
}
.tab.active { color: #fff; background: var(--ink); border-color: var(--ink); }
.panel {
    display: none;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow);
}
.panel.active { display: block; }
.panel-head {
    padding: 25px 28px;
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: center;
    border-bottom: 1px solid var(--line);
}
.panel-head h2 { margin: 0; font-family: Georgia, serif; font-weight: 500; font-size: 27px; }
.panel-head p { margin: 5px 0 0; color: var(--muted); font-size: 14px; }
.search {
    width: min(340px, 100%);
    padding: 11px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    color: var(--ink);
    outline: none;
}
.search:focus, .id-input:focus, .login-card input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(23, 107, 69, .12); }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 920px; }
th, td { padding: 15px 18px; text-align: left; border-bottom: 1px solid #ebe8df; vertical-align: middle; }
th {
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
    background: #faf8f2;
    position: sticky;
    top: 0;
    z-index: 1;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr.confirmed { background: rgba(223, 243, 231, .68); }
.book-title { min-width: 310px; max-width: 560px; }
.book-title strong { display: block; font-size: 14px; line-height: 1.4; }
.title-line { display: flex; align-items: flex-start; gap: 8px; }
.title-line strong { flex: 1; }
.folder-link {
    flex: 0 0 auto;
    width: 29px;
    height: 29px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    color: var(--amber);
    background: var(--amber-soft);
    text-decoration: none;
    font-size: 15px;
}
.folder-link:hover { filter: brightness(.96); transform: translateY(-1px); }
.book-title small { display: block; color: var(--muted); margin-top: 5px; }
.asin { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.muted { color: var(--muted); }
.canva-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 10px;
    color: var(--blue);
    background: var(--blue-soft);
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}
.canva-cell { min-width: 320px; }
.canva-entry { display: flex; gap: 7px; align-items: center; }
.url-input {
    width: 230px;
    padding: 8px 9px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
    outline: none;
    font-size: 12px;
}
.url-input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(23, 107, 69, .12); }
.url-input:disabled, .id-input:disabled {
    color: #506159;
    background: #edf2ee;
    border-color: #d0ddd4;
    opacity: 1;
}
.id-cell { display: flex; gap: 7px; align-items: center; }
.id-input {
    width: 155px;
    padding: 8px 9px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
    outline: none;
    font: 12px ui-monospace, SFMono-Regular, Menlo, monospace;
}
.icon-button, .status-button {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    border-radius: 10px;
    padding: 8px 11px;
    cursor: pointer;
    font-weight: 750;
    white-space: nowrap;
}
.icon-button { padding: 8px 9px; }
.status-button:hover, .icon-button:hover { border-color: #aeb9b2; }
.status-button.confirmed, .status-button.ready {
    color: #fff;
    background: var(--green);
    border-color: var(--green);
}
.status-button:disabled { cursor: not-allowed; opacity: .45; }
.status-button.confirmed:disabled { opacity: 1; }
.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 7px 10px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
    color: var(--muted);
    background: #efeee9;
}
.badge.ok { color: var(--green); background: var(--green-soft); }
.badge.reviewed { color: var(--blue); background: var(--blue-soft); }
.empty { padding: 42px; text-align: center; color: var(--muted); }
.hidden { display: none !important; }
.toast {
    position: fixed;
    right: 22px;
    bottom: 22px;
    max-width: 380px;
    padding: 13px 16px;
    border-radius: 12px;
    color: #fff;
    background: var(--ink);
    box-shadow: var(--shadow);
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: .2s ease;
    z-index: 30;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--red); }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
    width: min(440px, 100%);
    padding: 38px;
    border: 1px solid var(--line);
    border-radius: 28px;
    background: var(--surface);
    box-shadow: var(--shadow);
}
.login-card .brand-mark { margin-bottom: 30px; }
.login-card h1 { font-size: 48px; }
.login-card .muted { margin: 16px 0 28px; }
.login-card label { display: block; margin: 14px 0 6px; font-size: 13px; font-weight: 800; }
.login-card input {
    width: 100%;
    padding: 12px 13px;
    border: 1px solid var(--line);
    border-radius: 11px;
    outline: none;
}
.primary {
    margin-top: 22px;
    padding: 12px 16px;
    border: 0;
    border-radius: 11px;
    background: var(--green);
    color: #fff;
    cursor: pointer;
    font-weight: 800;
}
.full { width: 100%; }
.alert { padding: 11px 13px; margin: 16px 0; border-radius: 10px; color: var(--red); background: #f8e4e1; font-size: 14px; }

@media (max-width: 900px) {
    .hero { grid-template-columns: 1fr; padding-top: 36px; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .panel-head { align-items: stretch; flex-direction: column; }
    .search { width: 100%; }
}
@media (max-width: 560px) {
    .shell { width: min(100% - 20px, 1480px); }
    .topbar { padding: 0 14px; }
    .brand span { display: none; }
    .hero h1 { font-size: 39px; }
    .tabs { display: grid; grid-template-columns: 1fr; }
    .panel { border-radius: 17px; }
    .panel-head { padding: 20px; }
    .login-card { padding: 28px 24px; }
}
