:root {
    --navy: #0c2d3a;
    --navy-mid: #164a5e;
    --gold: #b7862f;
    --ink: #1e293b;
    --muted: #64748b;
    --line: #e7dfd0;
    --paper: #f6f4ee;
    --card: #fffdf8;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(ellipse at top, rgba(22, 74, 94, 0.07), transparent 42%),
        var(--paper);
    color: var(--ink);
    font-family: Inter, "Segoe UI", sans-serif;
}
.top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 14px 28px;
    background: linear-gradient(90deg, var(--navy), var(--navy-mid));
    color: #f7f1e3;
    border-bottom: 3px solid var(--gold);
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: inherit;
    text-decoration: none;
}
.brand-text { display: flex; flex-direction: column; gap: 1px; }
.brand strong {
    font-family: Fraunces, Georgia, serif;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
}
.brand small {
    color: #e8d5ab;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}
.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #fff;
    padding: 3px;
    box-sizing: border-box;
    object-fit: contain;
    border: 2px solid var(--gold);
}
.top-actions { display: flex; align-items: center; gap: 12px; }
.menu {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(232, 213, 171, 0.28);
}
.menu-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 0 16px;
    border-radius: 999px;
    color: #e8d5ab;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}
.menu-count {
    display: inline-grid;
    place-items: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--gold);
    color: var(--navy);
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
}
.menu-link:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.menu-link.is-on {
    background: #f7f1e3;
    color: var(--navy);
}
.menu-link.is-on .menu-count {
    background: var(--navy);
    color: #f7f1e3;
}
.account { position: relative; }
.account summary {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 4px 12px 4px 4px;
    border-radius: 999px;
    border: 1px solid rgba(232, 213, 171, 0.45);
    background: rgba(255, 255, 255, 0.08);
    color: #f7f1e3;
    list-style: none;
    cursor: pointer;
}
.account summary::-webkit-details-marker { display: none; }
.account summary:hover { background: rgba(255, 255, 255, 0.14); }
.account[open] summary { background: rgba(255, 255, 255, 0.16); }
.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--gold);
    color: var(--navy);
    font-size: 13px;
    font-weight: 800;
}
.who { font-size: 13px; font-weight: 700; }
.account-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 30;
    min-width: 196px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--card);
    box-shadow: 0 16px 40px rgba(12, 45, 58, 0.18);
}
.account-panel form { margin: 0; }
.account-panel a,
.account-panel button {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    min-height: 38px;
    margin: 0;
    padding: 8px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--navy);
    font-size: 13px;
    font-weight: 700;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}
.account-panel a:hover,
.account-panel button:hover { background: #f6f1e6; }
.account-panel a.is-on { background: #f3efe6; }
.account-panel button { color: #9f1239; }
.password-card { width: min(480px, 100%); }
#new-folder { margin: 8px 0 0; }
.password-card .form-actions { margin-top: 18px; }
main { max-width: 1120px; margin: 0 auto; padding: 24px; }
h1 { margin: 0; font-family: Fraunces, Georgia, serif; font-size: 30px; font-weight: 700; letter-spacing: -0.03em; color: var(--navy); }
.lede { margin: 6px 0 0; color: var(--muted); font-size: 14px; line-height: 1.45; max-width: 640px; }
.page-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; margin-bottom: 18px; }
.count-chip {
    flex-shrink: 0;
    padding: 8px 12px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--line);
    color: var(--navy);
    font-size: 13px;
    font-weight: 700;
}
.site-name { font-weight: 700; color: var(--navy); }
.site-host { margin-top: 2px; color: var(--muted); font-size: 12px; }
.db {
    display: inline-flex;
    padding: 3px 8px;
    border-radius: 6px;
    background: #f3efe6;
    color: #3f3a32;
    font-size: 12px;
    font-weight: 600;
}
.eyebrow { margin: 0 0 8px; color: #2563eb; font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.auth { background: var(--paper); }
.auth main { display: flex; justify-content: center; padding-top: 48px; }
.auth-card, .form-card, .panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}
.auth-card, .form-card { width: min(480px, 100%); padding: 28px 24px; }
.form-card { width: min(640px, 100%); }
.client-request-form { width: min(720px, 100%); margin-bottom: 18px; }
.client-request-form textarea { min-height: 72px; resize: vertical; }
.note-cell { max-width: 240px; white-space: pre-wrap; }
.row-actions form, td form { margin: 0; }
label { display: block; margin: 14px 0 6px; font-size: 13px; font-weight: 700; }
input[type=text], input[type=password], input[type=date], input[type=time], input[type=number], select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    font: inherit;
}
input:focus { outline: 2px solid #93c5fd; border-color: #2563eb; }
button, .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--navy);
    background: var(--navy);
    color: #fff;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
}
.auth-card button, .form-card button[type=submit] { margin-top: 18px; }
.password-card .form-actions button[type=submit],
.password-card .form-actions .quiet { margin-top: 0; }
button.link { background: transparent; border-color: transparent; color: #fff; min-height: 0; padding: 0; }
button.quiet, .quiet { background: #fff; color: var(--navy); }
button.warn { background: #b45309; border-color: #b45309; }
button.danger { background: #fff; color: #b91c1c; border-color: #fecaca; }
.form-actions, .row-actions, .date-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.date-row > div { flex: 1; min-width: 160px; }
.form-actions { margin-top: 8px; }
.form-actions .quiet { margin-top: 18px; }
.toolbar { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; margin-bottom: 16px; }
.toolbar .button { flex-shrink: 0; }
.panel { overflow: hidden; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 860px; }
th, td { padding: 14px 16px; border-bottom: 1px solid #f0ebe3; text-align: left; vertical-align: middle; font-size: 13px; }
th { background: #faf7f1; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fffaf3; }
.panel-foot { padding: 12px 14px; background: #f8fafc; }
.muted { color: var(--muted); }
.bad { color: #b91c1c; font-weight: 700; }
.pill { display: inline-flex; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: 0.03em; text-transform: uppercase; }
.pill.ok { background: #ecfdf5; color: #047857; }
.pill.soon { background: #fff7ed; color: #c2410c; }
.pill.bad { background: #fef2f2; color: #b91c1c; }
.pill.muted { background: #f1f5f9; color: #64748b; }
code { font-size: 12px; color: #334155; }
button.date-link {
    gap: 6px;
    min-height: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--navy);
    font-weight: 700;
}
button.date-link span {
    text-decoration: underline;
    text-underline-offset: 3px;
}
button.date-link:hover { color: #1d4ed8; }
.edit-icon { width: 14px; height: 14px; flex: 0 0 auto; }
.end-dialog {
    width: min(420px, calc(100% - 32px));
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
}
.end-dialog::backdrop { background: rgba(15, 23, 42, 0.45); }
.end-dialog form { padding: 22px 22px 18px; }
.end-dialog h2 { margin: 0; font-size: 22px; letter-spacing: -0.02em; }
.end-dialog button[type=submit] { margin-top: 18px; }
.renew-dialog { width: min(480px, calc(100% - 32px)); }
.request-dialog { width: min(560px, calc(100% - 32px)); }
.request-dialog form { padding: 0; }
.request-dialog-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 20px 22px 16px;
    border-bottom: 1px solid var(--line);
}
.request-dialog h2 {
    font-family: Fraunces, Georgia, serif;
    font-size: 26px;
    color: var(--navy);
}
.request-kicker {
    margin: 0 0 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.request-facts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin: 0;
    padding: 16px 22px;
}
.request-facts dt {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.request-facts dd {
    margin: 4px 0 0;
    font-size: 14px;
    font-weight: 600;
    overflow-wrap: anywhere;
}
.request-complaint {
    margin: 0 22px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #faf7f1;
}
.request-dialog-actions {
    justify-content: flex-end;
    margin: 0;
    padding: 16px 22px 18px;
}
#request-close[hidden] { display: none !important; }
#request-close { margin-right: auto; }
.close-card { width: min(720px, 100%); }
.close-card .form-actions { margin-top: 18px; }
.close-card .form-actions .quiet,
.close-card .form-actions button { margin-top: 0; }
.request-dialog button[type=submit],
.request-dialog .form-actions .quiet { margin-top: 0; }
.request-group { margin-bottom: 16px; }
.request-head, .request-error, .empty-note { padding: 14px 16px 0; }
.request-group h2 { margin: 0; font-family: Fraunces, Georgia, serif; font-size: 20px; color: var(--navy); }
.request-error, .empty-note { padding-bottom: 14px; }
.complaint-clip { max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.request-body { margin: 0; white-space: pre-wrap; line-height: 1.55; font-size: 14px; }
.flash { margin-bottom: 16px; padding: 12px 14px; border-radius: 10px; font-size: 13px; font-weight: 600; line-height: 1.45; }
.flash-ok { background: #f0fdf4; border: 1px solid #86efac; color: #166534; }
.flash-error { background: #fef2f2; border: 1px solid #fca5a5; color: #991b1b; }
@media (max-width: 720px) {
    .toolbar, .page-head { align-items: stretch; flex-direction: column; }
    .top { align-items: flex-start; flex-wrap: wrap; padding: 12px 16px; }
    .top-actions { width: 100%; justify-content: space-between; }
    .who { display: none; }
    main { padding: 16px; }
    .request-facts { grid-template-columns: 1fr; }
}
