:root {
    --ink: #1e1b4b;
    --gold: #4f46e5;
    --gold-deep: #4338ca;
    --gold-soft: #e0e7ff;
    --paper: #f4f6fb;
    --card: #ffffff;
    --line: #e2e8f0;
    --muted: #64748b;
    --text: #0f172a;
    --danger: #e11d48;
    --ok: #047857;
    --shadow: 0 18px 40px rgba(30, 27, 75, 0.08);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(900px 320px at 0% -10%, rgba(99, 102, 241, 0.16), transparent 55%),
        var(--paper);
    color: var(--text);
    font-family: Manrope, "Segoe UI", sans-serif;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }
img { max-width: 100%; }

.wrap { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }

.top {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(30, 27, 75, 0.97);
    color: #eef2ff;
    border-bottom: 3px solid var(--gold);
}
.top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0 8px;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand img {
    width: 46px;
    height: 46px;
    object-fit: contain;
    background: #fff;
    border-radius: 50%;
    padding: 3px;
}
.brand b { display: block; font-family: Literata, Georgia, serif; font-size: 1.2rem; font-weight: 680; }
.brand small { color: #c7d2fe; font-size: 0.78rem; }
.top-links { display: flex; gap: 8px; flex-shrink: 0; }
.top-links a, .top-links button.out, .subnav a, .btn, .pager a, .chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 999px;
    font-weight: 750;
}
.top-links a, .top-links button.out, .subnav a {
    padding: 8px 12px;
    color: #e0e7ff;
    font-size: 0.86rem;
}
.nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.15rem;
    height: 1.15rem;
    margin-left: 6px;
    padding: 0 5px;
    border-radius: 999px;
    background: #e11d48;
    color: #fff;
    font-size: 0.7rem;
    line-height: 1;
}
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.stat-grid .panel { margin: 0; }
.stat-grid span { color: var(--muted); font-size: 0.84rem; font-weight: 700; }
.stat-grid b { display: block; margin-top: 8px; font-size: 1.8rem; }
.top-links button.out {
    background: transparent;
    border: 1px solid rgba(238, 242, 255, 0.28);
    cursor: pointer;
    font-family: inherit;
}
.top-links a:hover, .top-links button.out:hover, .subnav a:hover, .subnav a.is-on { background: rgba(129, 140, 248, 0.28); color: #fff; }
.top-links .out { border: 1px solid rgba(238, 242, 255, 0.28); }
.subnav { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 0 12px; }
.password-slot { padding-top: 18px; }
.password-slot .sheet { margin: 0; }

.page { padding: 22px 0 48px; }
h1 {
    margin: 0;
    font-family: Literata, Georgia, serif;
    font-size: 2rem;
    color: var(--ink);
}
.lead { margin: 6px 0 0; color: var(--muted); }
.head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 16px;
}

.flash {
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: 14px;
    background: var(--gold-soft);
    color: #3730a3;
    font-weight: 650;
}
.flash.success { background: #e7f6ee; color: var(--ok); }
.flash.danger { background: #ffe4e6; color: var(--danger); }
.flash.warning, .flash.info { background: #eef2ff; color: var(--ink); }

.finder {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}
.finder input, .sheet input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]), .sheet input[type="file"], .sheet textarea, .sheet select,
.tool-fold input[type="text"], .tool-fold input[type="search"], .tool-fold input[type="password"], .tool-fold textarea, .tool-fold select, .tool-fold input[type="file"] {
    width: 100%;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 14px;
    padding: 12px 14px;
    font-size: 1rem;
    color: var(--text);
    outline: none;
}
.finder input { border-radius: 999px; padding-left: 16px; }
.finder input:focus, .sheet input:focus, .sheet textarea:focus, .sheet select:focus,
.tool-fold input:focus, .tool-fold textarea:focus, .tool-fold select:focus { border-color: var(--gold); }
.finder button, .btn, .actions button, .actions a, .row-actions button, .row-actions a, .table-actions button, .table-actions a, .group-head a.primary, .group-create button {
    border: 0;
    cursor: pointer;
    border-radius: 999px;
    padding: 10px 16px;
    font-weight: 750;
    font-size: 0.9rem;
}
.finder button, .primary, .actions .primary, .group-head a.primary, .group-create button {
    background: var(--gold);
    color: #fff;
}
.primary:hover, .finder button:hover { background: #6366f1; }
.ghost, .actions .ghost, .row-actions a {
    background: #fff;
    color: var(--ink);
    border: 1px solid var(--line);
}
.danger, .row-actions .danger, .table-actions .danger {
    background: #fff;
    color: var(--danger);
    border: 1px solid #fecdd3;
}
.table-actions a {
    background: #fff;
    color: var(--ink);
    border: 1px solid var(--line);
}
.mini {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}
.mini a {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    min-height: 210px;
}
.mini .ph, .mini img {
    height: 120px;
    width: 100%;
    object-fit: contain;
    background: #fff;
}
.mini strong {
    margin: 8px 10px 0;
    font-size: 0.92rem;
    line-height: 1.3;
    height: 2.6em;
    overflow: hidden;
}
.mini em {
    margin: 4px 10px 10px;
    color: var(--muted);
    font-style: normal;
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
@media (max-width: 900px) {
    .mini { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 18px;
}
.chip {
    flex: 0 0 auto;
    background: #fff;
    border: 1px solid var(--line);
    color: var(--ink);
    padding: 8px 12px;
    font-size: 0.82rem;
}
.chip span { color: var(--muted); font-weight: 700; }
.chip.is-on, .chip:hover { background: var(--ink); color: #eef2ff; border-color: var(--ink); }
.chip.is-on span, .chip:hover span { color: #c7d2fe; }

.books {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}
.book {
    display: flex;
    flex-direction: column;
    height: 430px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    overflow: hidden;
}
.cover {
    height: 170px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
}
.cover img { max-width: 100%; max-height: 100%; object-fit: contain; }
.book-body { padding: 10px 12px 0; min-height: 0; flex: 1 1 auto; overflow: hidden; }
.tag {
    display: block;
    margin: 0 0 6px;
    color: var(--gold-deep);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.book h2 {
    margin: 0;
    height: 2.6em;
    font-family: Literata, Georgia, serif;
    font-size: 1rem;
    line-height: 1.3;
    overflow: hidden;
}
.book .author {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.book .desc {
    margin: 6px 0 0;
    height: 2.8em;
    color: #475569;
    font-size: 0.78rem;
    line-height: 1.4;
    overflow: hidden;
}
.row-actions {
    display: flex;
    gap: 6px;
    margin: 10px 12px 12px;
}
.row-actions a, .row-actions button { flex: 1 1 0; padding: 8px 6px; font-size: 0.78rem; }
.row-actions form { flex: 1 1 0; display: flex; }
.row-actions form button { width: 100%; }

.pager {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
    margin-top: 20px;
}
.pager a { background: #fff; border: 1px solid var(--line); color: var(--ink); padding: 8px 14px; }
.pager span { font-weight: 750; color: var(--ink); }
.empty {
    background: #fff;
    border: 1px dashed var(--line);
    border-radius: 16px;
    padding: 28px;
    color: var(--muted);
    text-align: center;
}

.panel {
    margin-top: 28px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    overflow: hidden;
}
.panel h2 {
    margin: 0;
    padding: 16px 16px 0;
    font-family: Literata, Georgia, serif;
    font-size: 1.35rem;
    color: var(--ink);
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 14px; text-align: left; border-top: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; background: #f8fafc; }
td { font-size: 0.92rem; }
body.is-admin tbody tr:hover td { background: #f8f7ff; }
body.is-admin td.when { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; font-size: 0.84rem; }
.log-act {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--gold-soft);
    color: var(--gold-deep);
    font-weight: 800;
    font-size: 0.78rem;
    white-space: nowrap;
}
.log-act.is-bad { background: #ffe4e6; color: var(--danger); }
.log-act.is-ok { background: #d1fae5; color: var(--ok); }
.blank {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 14px;
    padding: 14px 16px;
    border-radius: 14px;
    background: #f8fafc;
    color: var(--muted);
    font-weight: 750;
}
.blank i {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    background: var(--gold-soft);
    color: var(--gold-deep);
}
.workbar {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 12px 12px 10px;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
}
.workbar .head { margin-bottom: 8px; }
.req-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; margin: 0 0 8px; padding: 4px; background: #f1f5f3; border-radius: 12px; }
.access-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0; }
form.access-tools.people-find {
    margin: 0 0 14px;
    padding: 10px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
}
.access-tools input[type="search"], .access-tools select {
    height: 42px;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 999px;
    padding: 0 16px;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 650;
    color: var(--text);
}
.access-tools input[type="search"] { flex: 1 1 240px; min-width: 180px; max-width: 360px; }
.access-tools select { min-width: 140px; }
.access-tools .repeat {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 42px;
    margin: 0;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0 14px;
    font-weight: 750;
    font-size: 0.88rem;
    cursor: pointer;
}
.access-tools .repeat b {
    min-width: 1.5rem;
    padding: 1px 7px;
    border-radius: 999px;
    background: #eef2ff;
    color: #312e81;
    text-align: center;
}
.access-tools .repeat b.hot { background: #ffe4e6; color: var(--danger); }
.access-tools button, .access-tools a.ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 42px;
    border: 0;
    border-radius: 999px;
    padding: 0 18px;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 800;
    cursor: pointer;
    text-decoration: none;
}
.access-tools button { background: #312e81; color: #fff; }
.access-tools button:hover { background: #4338ca; }
.access-tools a.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
tr.is-repeat { background: #fff7ed; }
tr.is-repeat .status.no { margin-left: 8px; }
.req-tabs a {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: transparent;
    border: 0;
    border-radius: 9px;
    font-weight: 800;
    font-size: 0.88rem;
    box-shadow: none;
}
.req-tabs a b {
    min-width: 1.7rem;
    padding: 2px 8px;
    border-radius: 999px;
    background: #f1f5f9;
    text-align: center;
    font-size: 0.82rem;
}
.req-tabs a.is-on { background: var(--gold); border-color: var(--gold); color: #fff; }
.req-tabs a.is-on b { background: rgba(255, 255, 255, 0.22); color: #fff; }
@media (max-width: 800px) {
    .req-tabs { grid-template-columns: 1fr 1fr; }
    .access-tools { align-items: stretch; }
    .access-tools select, .access-tools button, .access-tools a.ghost, .access-tools .repeat { width: 100%; }
}
.table-actions { display: flex; gap: 8px; justify-content: flex-end; white-space: nowrap; }
.table-actions form { display: inline; }
.status {
    display: inline-flex;
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 0.78rem;
    font-weight: 800;
    background: #fef3c7;
    color: #92400e;
}
.status.ok { background: #d1fae5; color: var(--ok); }
.status.no { background: #ffe4e6; color: var(--danger); }

.sheet {
    width: min(720px, 100%);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 26px 24px;
    box-shadow: var(--shadow);
}
.sheet h1 { font-size: 1.8rem; }
.sheet label, .tool-fold label { display: block; margin: 14px 0 6px; font-weight: 750; }
.tool-fold .group-create label { margin-top: 0; }
.sheet .hint { margin: 6px 0 0; color: var(--muted); font-size: 0.84rem; }
.sheet .check {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-top: 16px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
}
.sheet .check input { margin-top: 3px; }
.sheet .check label { margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; align-items: center; }
.actions form { display: flex; margin: 0; }
.actions form.end { margin-left: auto; }
.actions .danger {
    background: #fff;
    color: var(--danger);
    border: 1px solid #fecdd3;
}
.split { display: grid; grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.2fr); gap: 16px; align-items: start; }
.split .sheet { width: auto; }
.file-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.file-row input[type="file"] { flex: 1; min-width: 180px; }
.group-note { margin: 0 16px 8px; color: var(--muted); }
.group-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 16px 16px 0; }
.group-head h2 { padding: 0; }
.group-head form, .group-head a.primary { margin: 0; }
.group-create {
    display: grid;
    grid-template-columns: minmax(180px, 1.4fr) minmax(180px, 1fr) auto;
    gap: 12px;
    align-items: end;
}
.group-create.single { grid-template-columns: minmax(220px, 1fr) auto; }
.group-create label { margin-top: 0; }
.group-create button { margin-bottom: 1px; }
@media (max-width: 800px) {
    .group-create { grid-template-columns: 1fr; }
}
.group-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 16px 16px;
}
.group-filter a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--text);
    font-size: 0.88rem;
    font-weight: 750;
}
.group-filter a small {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
}
.group-filter a b {
    min-width: 1.5rem;
    padding: 1px 7px;
    border-radius: 999px;
    background: #eef2ff;
    color: #312e81;
    text-align: center;
}
.group-filter a.is-on {
    background: #312e81;
    border-color: #312e81;
    color: #fff;
}
.group-filter a.is-on small,
.group-filter a.is-on b {
    background: transparent;
    color: #e0e7ff;
}
.group-pick {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: 4px;
}
.group-pick label {
    margin: 0;
    font-size: 0.84rem;
    font-weight: 750;
    color: var(--muted);
}
.group-pick select {
    min-width: 240px;
    max-width: 100%;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--text);
    padding: 8px 14px;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 750;
}
.member-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.member-form input:not([type="hidden"]) {
    flex: 1 1 180px;
    min-width: 140px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--text);
    padding: 10px 14px;
    font: inherit;
    font-size: 0.9rem;
}
.member-form button, .member-form a, button.primary, a.primary, button.danger, a.danger, button.ghost, a.ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 999px;
    padding: 10px 16px;
    font-weight: 800;
    font-size: 0.88rem;
    line-height: 1.2;
    cursor: pointer;
    text-decoration: none;
}
.member-form select {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 10px 14px;
    background: #fff;
    color: var(--text);
    max-width: 220px;
    font: inherit;
    font-weight: 750;
}
.member-form button { padding: 8px 12px; }

@media (max-width: 1020px) {
    .books { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
    .books { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .head, .top-row { align-items: flex-start; }
    .brand small { display: none; }
    .split { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
    .books { grid-template-columns: 1fr; }
    .book { height: auto; }
    .book h2, .book .desc { height: auto; }
    .finder { flex-direction: column; }
}

body.is-admin { background: var(--paper); }
body.is-admin .shell { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 100vh; }
body.is-admin .side {
    background: #fff;
    border-right: 1px solid var(--line);
    padding: 12px 10px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: auto;
}
body.is-admin .side-brand {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 14px;
    padding: 4px 8px 12px;
}
body.is-admin .side-brand img { width: 40px; height: 40px; object-fit: contain; }
body.is-admin .side-brand b { display: block; font-size: 0.92rem; line-height: 1.25; }
body.is-admin .side-brand small { color: var(--muted); }
body.is-admin .side > a {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 1px 0;
    padding: 7px 10px;
    border-radius: 10px;
    color: #334155;
    font-weight: 700;
    font-size: 0.86rem;
}
body.is-admin .side > a.is-on, body.is-admin .side > a:hover { background: var(--gold-soft); color: var(--gold-deep); }
body.is-admin .side > a.is-on { box-shadow: inset 3px 0 0 var(--gold); }
body.is-admin .dash-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 5;
}
body.is-admin .dash-top .top-links a,
body.is-admin .dash-top button.out { color: #1e293b; }
body.is-admin .who { font-weight: 800; color: var(--gold-deep); }
body.is-admin main.page { width: calc(100% - 28px); padding: 14px 0 28px; }
body.is-admin .books { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
body.is-admin h1 { font-size: 1.45rem; }
body.is-admin .head { margin-bottom: 10px; align-items: center; }
body.is-admin .lead { margin-top: 2px; font-size: 0.88rem; }
body.is-admin .panel { margin-top: 12px; border-radius: 14px; }
body.is-admin .panel h2 { font-size: 1.02rem; padding: 11px 14px; border-bottom: 1px solid var(--line); }
body.is-admin th, body.is-admin td { padding: 8px 12px; }
body.is-admin th { background: #f8fafc; position: sticky; top: 0; }
body.is-admin tbody tr:hover td { background: #f5f7ff; }
body.is-admin td[colspan] { text-align: center; color: var(--muted); padding: 16px 12px; background: #fafafa; }
body.is-admin .table-actions button, body.is-admin .table-actions a { padding: 6px 10px; font-size: 0.8rem; }
body.is-admin .metric { min-height: 72px; padding: 10px 12px; border-radius: 14px; }
body.is-admin .board { border-radius: 14px; }
body.is-admin .side { background: linear-gradient(180deg, #eef2ff 0%, #fff 220px); }
body.is-admin .side > a i { width: 1.15rem; color: var(--gold); font-size: 1.02rem; text-align: center; }
body.is-admin .dash-top { box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04); }
body.is-admin .who {
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--gold-soft);
}
.home .head { margin-bottom: 18px; }
.metrics { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.metric {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 92px;
    padding: 14px;
    border-radius: 18px;
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
}
.metric b { display: block; font-size: 1.45rem; line-height: 1.1; letter-spacing: -0.03em; }
.metric small { display: block; margin-top: 4px; color: var(--muted); font-size: 0.75rem; font-weight: 750; line-height: 1.25; }
.metric-ico {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border-radius: 14px;
    font-size: 1.2rem;
}
.tone-green .metric-ico, .tile.tone-green i { background: var(--gold-soft); color: var(--gold-deep); }
.tone-blue .metric-ico, .tile.tone-blue i { background: #dbeafe; color: #1d4ed8; }
.tone-amber .metric-ico, .tile.tone-amber i { background: #fef3c7; color: #b45309; }
.tone-violet .metric-ico, .tile.tone-violet i { background: #ede9fe; color: #6d28d9; }
.tone-rose .metric-ico, .tile.tone-rose i { background: #ffe4e6; color: #be123c; }
.tone-teal .metric-ico, .tile.tone-teal i { background: #ccfbf1; color: #0f766e; }
.tone-indigo .metric-ico, .tile.tone-indigo i { background: #e0e7ff; color: #4338ca; }
.tone-slate .metric-ico, .tile.tone-slate i { background: #e2e8f0; color: #334155; }
.home-grid { display: grid; grid-template-columns: 1.25fr 0.75fr; gap: 14px; margin-top: 14px; }
.board {
    margin-top: 14px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
    padding: 6px 8px 12px;
}
.home-grid .board { margin-top: 0; }
.board-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 12px 4px; }
.board-head h2 { margin: 0; padding: 0; font-family: Literata, Georgia, serif; font-size: 1.25rem; color: var(--ink); }
.board-head a { color: var(--gold-deep); font-weight: 800; font-size: 0.86rem; }
.ring-wrap { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 8px 18px; align-items: center; padding: 8px 12px 12px; }
.donut {
    width: 196px;
    height: 196px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    margin: 0 auto;
}
.donut-hole {
    width: 118px;
    height: 118px;
    border-radius: 50%;
    background: #fff;
    display: grid;
    place-items: center;
    align-content: center;
    text-align: center;
    box-shadow: inset 0 0 0 8px #fff;
}
.donut-hole b { font-size: 1.25rem; letter-spacing: -0.03em; }
.donut-hole small { color: var(--muted); font-weight: 750; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; }
.legend li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto auto; gap: 6px; align-items: center; font-size: 0.78rem; }
.legend i { width: 10px; height: 10px; border-radius: 50%; }
.legend span { line-height: 1.25; }
.legend b { font-size: 0.78rem; }
.legend small { color: var(--muted); min-width: 3.2rem; text-align: right; }
.feed { list-style: none; margin: 0; padding: 6px 8px 8px; }
.feed li { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 6px; border-top: 1px solid #f1f5f9; }
.feed li:first-child { border-top: 0; }
.feed b, .feed small { display: block; }
.feed b { font-size: 0.88rem; }
.feed small { color: var(--muted); font-size: 0.75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed time { color: var(--muted); font-size: 0.75rem; font-weight: 700; }
.feed-ico { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; background: var(--gold-soft); color: var(--gold-deep); }
.feed-empty { display: block; color: var(--muted); padding: 16px; }
.latest { padding: 4px 8px 8px; }
.latest-row { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px; border-radius: 14px; }
.latest-row:hover { background: #f8fafc; }
.latest-cover { position: relative; width: 46px; height: 58px; border-radius: 8px; overflow: hidden; background: #eef2ff; display: grid; place-items: center; color: #4338ca; }
.latest-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.latest-row b, .latest-row small { display: block; }
.latest-row b {
    font-size: 0.9rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.latest-row small { color: var(--muted); font-size: 0.75rem; margin-top: 2px; }
.latest-row em { font-style: normal; color: var(--gold-deep); font-weight: 800; font-size: 0.82rem; }
.tiles { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 10px; padding: 8px 12px 12px; }
.tile { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 12px 6px; border-radius: 16px; }
.tile:hover { background: #f8fafc; }
.tile i { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 16px; font-size: 1.2rem; }
.tile span { font-size: 0.75rem; font-weight: 800; line-height: 1.25; }
@media (max-width: 1100px) {
    .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .ring-wrap, .legend { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
    .metrics, .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .home-grid { grid-template-columns: 1fr; }
}
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; }
.stat-card span { color: var(--muted); font-size: 0.82rem; font-weight: 700; }
.stat-card b { display: block; margin-top: 6px; font-size: 1.7rem; }
.dash-grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 14px; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 180px) 1fr auto; gap: 8px; align-items: center; margin: 8px 0; font-size: 0.86rem; }
.bar { height: 8px; background: #e8eef0; border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--gold); }
.quick-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.author-rename { display: flex; gap: 8px; align-items: center; }
.author-rename input[type="text"] { min-width: 180px; flex: 1; }
.count-link {
    display: inline-flex;
    min-width: 2.4rem;
    justify-content: center;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--gold-soft);
    color: var(--gold-deep);
    font-weight: 800;
}
.count-link:hover { background: var(--gold); color: #fff; }
.tool-fold {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    margin: 0 0 10px;
    padding: 0 14px;
}
.tool-fold summary {
    cursor: pointer;
    font-weight: 800;
    padding: 12px 0;
}
.tool-fold[open] { padding-bottom: 14px; }
.tool-fold .hint { margin-top: 0; }
.member-line { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
.member-line .assign {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 4px 4px 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #f8fafc;
}
.member-line .assign > span { color: var(--muted); font-size: 0.75rem; font-weight: 800; }
.member-line a.ghost, .member-line button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
@media (max-width: 900px) {
    body.is-admin .shell { grid-template-columns: 1fr; }
    body.is-admin .side { position: static; height: auto; }
    .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    html { overflow-x: clip; }
    .wrap { width: min(1180px, calc(100% - 20px)); }
    .top-row { flex-wrap: wrap; gap: 10px; }
    .top-links { flex-wrap: wrap; width: 100%; flex-shrink: 1; }
    .brand b { font-size: 1.02rem; }
    .brand span, .brand { min-width: 0; }
    .subnav { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 10px; }
    .subnav a { flex: 0 0 auto; white-space: nowrap; }
    .head { flex-direction: column; align-items: flex-start; }
    h1 { font-size: 1.4rem; overflow-wrap: anywhere; }
    .sheet { width: 100%; padding: 18px 14px; }
    .sheet h1 { font-size: 1.35rem; }
    .actions a, .actions button, .actions .btn { flex: 1 1 auto; justify-content: center; }
    .table-wrap { max-width: 100%; }
    .group-head { flex-direction: column; align-items: stretch; }
    .group-create, .group-create.single { grid-template-columns: 1fr; }
    .member-form { flex-direction: column; align-items: stretch; }
    .member-form select { max-width: none; width: 100%; }
    .author-rename { flex-direction: column; align-items: stretch; }
    .author-rename input[type="text"] { min-width: 0; width: 100%; }
    .bar-row { grid-template-columns: minmax(0, 1fr); }
    .password-slot { padding-top: 12px; }
    body.is-admin .side {
        position: sticky;
        top: 0;
        z-index: 8;
        display: flex;
        flex-wrap: nowrap;
        gap: 6px;
        overflow-x: auto;
        height: auto;
        padding: 8px 10px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }
    body.is-admin .side-brand { display: none; }
    body.is-admin .side > a {
        flex: 0 0 auto;
        width: auto;
        margin: 0;
        white-space: nowrap;
        border-radius: 999px;
        border: 1px solid var(--line);
        background: #fff;
    }
    body.is-admin .dash-top { flex-wrap: wrap; padding: 10px 12px; position: static; }
    body.is-admin main.page { width: min(1240px, calc(100% - 16px)); }
}

.guest-hero {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 16px;
}
.guest-hero > i {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    background: var(--gold-soft);
    color: var(--gold-deep);
    font-size: 1.25rem;
}
body.guest-page .guest-hero,
body.guest-page .sheet {
    width: min(640px, 100%);
    margin-left: auto;
    margin-right: auto;
}
body.guest-page .sheet textarea { min-height: 140px; resize: vertical; }
body.guest-page .actions .primary { min-height: 44px; padding: 12px 22px; }
.contact-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.contact-row span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--gold-soft);
    color: var(--ink);
    font-weight: 750;
    font-size: 0.86rem;
}
.link-list { display: grid; gap: 10px; }
.link-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(30, 27, 75, 0.04);
}
.link-row span { min-width: 0; }
.link-row strong { display: block; color: var(--ink); }
.link-row em { display: block; margin-top: 2px; color: var(--muted); font-style: normal; font-size: 0.84rem; }
.link-row b {
    margin-left: auto;
    flex-shrink: 0;
    background: var(--gold-soft);
    color: var(--gold-deep);
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.8rem;
}
.link-row i { color: var(--gold-deep); }
.access-tools button.primary,
.access-tools a.ghost {
    height: 42px;
    padding: 0 18px;
    border-radius: 999px;
}
.access-tools button.primary { background: #312e81; color: #fff; }
.access-tools button.primary:hover { background: #4338ca; }
