:root {
    --ink: #071f3a;
    --ink-soft: #1d3a55;
    --muted: #647381;
    --line: #d9e4ea;
    --paper: #f4f8fa;
    --panel: #ffffff;
    --brand: #16b956;
    --brand-dark: #052447;
    --brand-soft: #e7f8ee;
    --accent: #0c755f;
    --warning: #d76638;
    --shadow: 0 18px 45px rgba(5, 36, 71, 0.08);
    --radius: 8px;
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body {
    margin: 0;
    color: var(--ink);
    background: var(--paper);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; font-weight: 700; }
a:hover { color: var(--brand-dark); }
.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    padding: 14px clamp(18px, 5vw, 56px);
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(18px);
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: max-content;
    color: var(--brand-dark);
    font-size: 22px;
    font-weight: 900;
}
.brand img {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    box-shadow: 0 8px 18px rgba(5, 36, 71, 0.12);
}
.brand span span { color: var(--brand); }
nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
nav a, .link-button {
    min-height: 36px;
    padding: 8px 10px;
    border-radius: 6px;
    color: var(--ink-soft);
    font-size: 14px;
}
nav a:hover, .link-button:hover { background: var(--brand-soft); color: var(--brand-dark); }
.page { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 38px 0 72px; }
.hero {
    min-height: 62vh;
    display: grid;
    align-items: center;
    gap: 34px;
}
.hero-brand { grid-template-columns: minmax(0, 1fr) 360px; }
.hero-logo {
    display: block;
    width: min(360px, 84vw);
    height: auto;
    margin-bottom: 26px;
}
.hero h1 { max-width: 820px; margin: 0; font-size: 68px; line-height: 1.02; letter-spacing: 0; }
.lead { max-width: 720px; color: var(--muted); font-size: 21px; }
.eyebrow { color: var(--accent); font-weight: 900; text-transform: uppercase; font-size: 12px; letter-spacing: 0.08em; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.button, button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 16px;
    border: 0;
    border-radius: 6px;
    background: var(--brand);
    color: white;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 10px 22px rgba(22, 185, 86, 0.24);
}
.button:hover, button:hover { background: #13a84d; color: white; }
.button.secondary { background: var(--brand-soft); color: var(--brand-dark); box-shadow: none; }
.button.small { min-height: 34px; padding: 7px 11px; font-size: 13px; }
.link-button { background: transparent; border: 0; box-shadow: none; color: var(--accent); padding: 8px 10px; min-height: 36px; }
.inline { display: inline; margin: 0; }
.band, .panel, .card, .auth-panel, .metric {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.panel, .auth-panel, .band { padding: 24px; box-shadow: 0 1px 2px rgba(5, 36, 71, 0.03); }
.notice { margin-bottom: 18px; background: #fff8f5; border-color: #f0c3b4; }
.grid { display: grid; gap: 16px; margin: 20px 0; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card { display: block; padding: 20px; color: var(--ink); }
.card:hover, .panel:hover, .metric:hover { border-color: #c7d6de; }
.metric {
    position: relative;
    overflow: hidden;
    padding: 20px;
    box-shadow: var(--shadow);
}
.metric span { display: block; color: var(--muted); font-weight: 800; }
.metric strong { position: relative; z-index: 1; font-size: 38px; color: var(--brand-dark); }
.dashboard-head { display: flex; justify-content: space-between; gap: 24px; align-items: end; margin-bottom: 20px; }
.dashboard-head h1 { max-width: 760px; margin: 0; font-size: 42px; line-height: 1.12; letter-spacing: 0; }
.inbox-address {
    padding: 16px;
    border-left: 4px solid var(--brand);
    background: var(--brand-soft);
    border-radius: 6px;
    min-width: 280px;
    color: var(--brand-dark);
}
.focus-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin: 18px 0 4px;
    background: #f5fbf8;
}
.focus-panel h2 { margin: 0; font-size: 22px; }
.focus-panel code { padding: 10px 12px; background: white; border: 1px solid var(--line); border-radius: 6px; color: var(--brand-dark); font-weight: 900; }
.auth-panel {
    max-width: 460px;
    margin: 36px auto;
    box-shadow: var(--shadow);
}
.auth-logo { display: block; width: 230px; max-width: 80%; height: auto; margin: 0 auto 18px; }
form label { display: grid; gap: 6px; margin-bottom: 14px; font-weight: 800; color: var(--ink-soft); }
input, textarea, select {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 9px 11px;
    background: white;
    color: var(--ink);
    font: inherit;
}
input:focus, textarea:focus, select:focus {
    outline: 3px solid rgba(22, 185, 86, 0.16);
    border-color: var(--brand);
}
.alert { background: #fff1ee; color: #8d2e15; border: 1px solid #f0b7a9; padding: 10px 12px; border-radius: 6px; }
.muted { color: var(--muted); }
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.section-title h1, .section-title h2 { margin: 0; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 13px 10px; border-top: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; }
tbody tr:hover { background: #f9fcfd; }
.details p { margin: 8px 0; overflow-wrap: anywhere; }
.alias-line { padding: 12px; background: var(--paper); border-radius: 6px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: end; }
.form-grid .full { grid-column: 1 / -1; }
.item-list, .stack-list { display: grid; gap: 12px; }
.item-editor h2 { margin: 4px 0 0; }
.stack-list article {
    display: grid;
    gap: 2px;
    padding: 12px;
    background: var(--paper);
    border: 1px solid #e7eef2;
    border-radius: 6px;
}
.stack-list span { color: var(--muted); font-size: 13px; }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.status-pill { display: inline-block; margin-top: 6px; color: var(--muted); font-size: 13px; }
.admin-nav { display: flex; gap: 16px; flex-wrap: wrap; font-weight: 800; }
code { overflow-wrap: anywhere; }
.text-preview {
    max-height: 520px;
    overflow: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    background: #f1f5f7;
    border-radius: 6px;
    padding: 16px;
}
.hero-inbox {
    display: grid;
    gap: 12px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.8);
    box-shadow: var(--shadow);
}
.mail-card {
    display: grid;
    gap: 4px;
    padding: 16px;
    border: 1px solid #dfe9ee;
    border-radius: 8px;
    background: white;
}
.mail-card span { color: var(--muted); font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.08em; }
.mail-card strong { font-size: 19px; }
.mail-card small { color: var(--muted); }
.mail-card.done { border-left: 4px solid var(--brand); }
.feature-band { margin-top: -14px; }
.site-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto 32px;
    padding: 18px 0 0;
    color: var(--muted);
    font-size: 13px;
}
.site-footer a { color: var(--muted); font-weight: 700; }
.cookie-banner {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    z-index: 40;
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    max-width: 980px;
    margin: 0 auto;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
    box-shadow: var(--shadow);
}
.cookie-banner[hidden], .cookie-modal[hidden] { display: none; }
.cookie-banner p { margin: 4px 0 0; color: var(--muted); }
.cookie-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; min-width: 300px; }
.cookie-modal {
    position: fixed;
    inset: 0;
    z-index: 45;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(5, 36, 71, 0.22);
}
.cookie-dialog { width: min(520px, 100%); box-shadow: var(--shadow); }
.toggle-line {
    display: flex;
    grid-template-columns: none;
    align-items: center;
    gap: 10px;
    margin: 12px 0;
}
.toggle-line input { width: auto; min-height: 0; }
.legal-page h1 { margin-top: 0; }
.legal-page h2 { margin-top: 28px; }
.legal-page li { margin: 8px 0; }
.quick-capture { margin: -4px 0 18px; }
.capture-shell h1 { margin-top: 0; font-size: 44px; line-height: 1.1; }
.capture-actions { align-items: stretch; }
.capture-action label {
    display: grid;
    min-height: 190px;
    align-content: center;
    gap: 8px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: white;
    box-shadow: var(--shadow);
    cursor: pointer;
}
.capture-action strong { font-size: 22px; color: var(--brand-dark); }
.capture-action span { color: var(--muted); font-weight: 600; }
.capture-action input { min-height: 48px; }
.capture-steps {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}
.capture-steps span {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--paper);
    font-weight: 800;
}
.capture-status {
    margin: 18px 0;
    border-left: 4px solid var(--brand);
}
.receipt-thumb {
    display: block;
    width: min(100%, 360px);
    height: auto;
    margin-bottom: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
}
.danger-form { margin-top: 14px; }

@media (max-width: 900px) {
    .hero-brand { grid-template-columns: 1fr; }
    .hero-inbox { order: -1; }
    .hero h1 { font-size: 48px; }
}

@media (max-width: 760px) {
    .topbar, .dashboard-head, .focus-panel { align-items: flex-start; flex-direction: column; }
    nav { justify-content: flex-start; }
    .grid.two, .grid.three, .grid.four { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .hero h1 { font-size: 38px; }
    .dashboard-head h1 { font-size: 30px; }
    table { display: block; overflow-x: auto; }
    .page { width: min(100% - 24px, 1180px); padding-top: 28px; padding-bottom: 96px; }
    .quick-capture {
        position: sticky;
        bottom: 14px;
        z-index: 10;
        display: flex;
        justify-content: center;
        margin: 0 0 18px;
    }
    .quick-capture .button {
        width: min(100%, 340px);
        min-height: 56px;
        font-size: 17px;
    }
    .capture-shell h1 { font-size: 36px; }
    .capture-action label { min-height: 150px; }
    .capture-steps { grid-template-columns: 1fr; }
    .cookie-banner {
        flex-direction: column;
        align-items: stretch;
        left: 10px;
        right: 10px;
        bottom: 10px;
    }
    .cookie-actions { min-width: 0; justify-content: stretch; }
    .cookie-actions .button { flex: 1 1 100%; }
}
