@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&display=swap');

:root {
    --bg: #f4f1e8;
    --surface: #fffdf7;
    --surface-strong: #fff8ea;
    --ink: #14213d;
    --muted: #6b7280;
    --line: #ded6c4;
    --brand: #c84c09;
    --brand-dark: #8f3200;
    --success: #1f7a5c;
    --warning: #c07b10;
    --danger: #b42318;
    --radius: 18px;
    --shadow: 0 18px 36px rgba(20, 33, 61, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    margin: 0;
    font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(200, 76, 9, 0.14), transparent 30%),
        linear-gradient(180deg, #faf6ee 0%, var(--bg) 100%);
    color: var(--ink);
}

small {
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

.app-shell {
    max-width: 760px;
    margin: 0 auto;
    min-height: 100vh;
    padding: 1rem 1rem 6rem;
}

.topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.topbar h1 {
    margin: 0.2rem 0 0;
    font-size: 1.6rem;
}

.topbar-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
    text-align: right;
    font-size: 0.85rem;
}

.topbar-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.eyebrow {
    margin: 0;
    color: var(--brand);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.72rem;
    font-weight: 700;
}

.chip {
    background: rgba(200, 76, 9, 0.08);
    color: var(--brand-dark);
    border-radius: 999px;
    padding: 0.35rem 0.7rem;
}

.chip-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 0.95rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.82);
    font-weight: 700;
    color: var(--ink);
}

.content {
    display: grid;
    gap: 1rem;
}

.section-nav {
    display: flex;
    gap: 0.65rem;
    overflow-x: auto;
    padding: 0.1rem 0 0.35rem;
    margin-bottom: 1rem;
    scrollbar-width: none;
}

.section-nav::-webkit-scrollbar {
    display: none;
}

.section-nav a {
    flex: 0 0 auto;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    padding: 0 0.95rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--line);
    font-size: 0.88rem;
    font-weight: 600;
}

.section-nav a.active {
    background: var(--ink);
    color: #fff8ea;
    border-color: var(--ink);
}

.network-banner,
.flash {
    padding: 0.95rem 1rem;
    border-radius: 14px;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.network-banner {
    background: #fff0cc;
    color: #6b4a00;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.network-banner strong,
.network-banner small {
    display: block;
}

.banner-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.banner-button {
    min-height: 40px;
    padding: 0.65rem 0.9rem;
    border: 1px solid rgba(20, 33, 61, 0.12);
}

.flash-success {
    background: #e8f5ef;
    color: var(--success);
}

.flash-error {
    background: #fdecec;
    color: var(--danger);
}

.section {
    display: grid;
    gap: 0.8rem;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.section-header h3 {
    margin: 0;
    font-size: 1.05rem;
}

.section-header a {
    color: var(--brand-dark);
    font-weight: 600;
}

.hero-card,
.stat-card,
.form-card,
.list-card,
.alert-card,
.shortcut-card,
.empty-state {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.hero-card {
    padding: 1.1rem;
    display: grid;
    gap: 1rem;
    background:
        linear-gradient(140deg, rgba(255, 255, 255, 0.95), rgba(255, 248, 234, 0.96)),
        radial-gradient(circle at top right, rgba(200, 76, 9, 0.16), transparent 30%);
}

.hero-card h2 {
    margin: 0.15rem 0 0.3rem;
    font-size: 2rem;
}

.muted {
    margin: 0;
    color: var(--muted);
}

.hero-grid,
.stats-grid,
.shortcut-grid,
.split-grid {
    display: grid;
    gap: 0.8rem;
}

.hero-grid {
    grid-template-columns: repeat(2, 1fr);
}

.hero-grid div,
.stat-card,
.shortcut-card {
    padding: 0.9rem;
}

.hero-grid span,
.stat-card span,
.shortcut-card span {
    display: block;
    color: var(--muted);
    font-size: 0.82rem;
}

.hero-grid strong,
.stat-card strong,
.shortcut-card strong {
    display: block;
    margin-top: 0.3rem;
    font-size: 1.05rem;
}

.stats-grid {
    grid-template-columns: repeat(2, 1fr);
}

.shortcut-grid {
    grid-template-columns: repeat(2, 1fr);
}

.shortcut-card {
    background: var(--surface-strong);
    min-height: 84px;
}

.ops-grid {
    display: grid;
    gap: 0.8rem;
}

.ops-card {
    background: linear-gradient(180deg, rgba(255, 253, 247, 0.98), rgba(255, 248, 234, 0.96));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem;
    display: grid;
    gap: 0.75rem;
}

.ops-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.ops-header span,
.ops-list small,
.audit-diff span {
    color: var(--muted);
    font-size: 0.8rem;
}

.ops-header strong {
    display: block;
    margin-top: 0.2rem;
    font-size: 1.25rem;
}

.ops-header a {
    color: var(--brand-dark);
    font-weight: 700;
}

.ops-list {
    display: grid;
    gap: 0.75rem;
}

.ops-list article {
    padding-top: 0.75rem;
    border-top: 1px dashed var(--line);
}

.ops-list article:first-child {
    padding-top: 0;
    border-top: 0;
}

.ops-list p,
.audit-card p {
    margin: 0.2rem 0 0;
    color: var(--muted);
}

.alert-stack,
.list-stack {
    display: grid;
    gap: 0.75rem;
}

.alert-card,
.empty-state {
    padding: 0.95rem 1rem;
}

.alert-warning {
    border-left: 4px solid var(--warning);
}

.alert-danger {
    border-left: 4px solid var(--danger);
}

.alert-success {
    border-left: 4px solid var(--success);
}

.list-card {
    padding: 0.95rem 1rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.list-card p,
.list-card small {
    margin: 0.2rem 0 0;
    color: var(--muted);
}

.list-card strong {
    display: block;
}

.list-actions,
.list-value {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.45rem;
    text-align: right;
}

.inline-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.55rem;
}

.status-row,
.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.status-row {
    margin-top: 0.55rem;
}

.inline-actions a {
    font-weight: 600;
    color: var(--brand-dark);
}

.form-card,
.mini-form {
    display: grid;
    gap: 0.8rem;
    padding: 1rem;
}

.auth-shell {
    max-width: 540px;
    padding-bottom: 1rem;
}

.auth-wrap {
    min-height: calc(100vh - 120px);
    display: grid;
    align-items: center;
}

.auth-card {
    display: grid;
    gap: 1rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow);
    padding: 1.2rem;
}

.auth-card h2 {
    margin: 0.25rem 0 0;
    font-size: 1.8rem;
}

.auth-form {
    padding: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
}

.auth-note {
    display: grid;
    gap: 0.3rem;
    background: rgba(20, 33, 61, 0.05);
    border-radius: 18px;
    padding: 0.95rem 1rem;
}

.compact-form {
    grid-template-columns: 1fr;
}

.form-card label,
.mini-form label {
    display: grid;
    gap: 0.35rem;
}

.form-card span,
.mini-form span {
    font-size: 0.85rem;
    font-weight: 600;
}

.form-card small,
.mini-form small {
    color: var(--muted);
    line-height: 1.4;
}

input,
select,
textarea {
    width: 100%;
    min-height: 48px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: #fff;
    padding: 0.8rem 0.9rem;
    color: var(--ink);
}

textarea {
    min-height: 110px;
    resize: vertical;
}

.checkbox-line {
    display: flex !important;
    align-items: center;
    gap: 0.75rem;
}

.checkbox-line input {
    width: 20px;
    min-height: 20px;
    margin: 0;
}

.primary-button,
.ghost-button {
    min-height: 50px;
    border-radius: 16px;
    border: 0;
    padding: 0.85rem 1rem;
    font-weight: 700;
}

.slim-button {
    min-height: 40px;
    padding: 0.65rem 0.95rem;
}

.primary-button {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
    color: #fff;
}

.ghost-button {
    background: rgba(20, 33, 61, 0.08);
    color: var(--ink);
}

.ghost-link-button {
    min-height: 50px;
    border-radius: 16px;
    padding: 0.85rem 1rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(20, 33, 61, 0.08);
    color: var(--ink);
}

.checklist-card.is-done {
    border-color: rgba(31, 122, 92, 0.28);
    background: linear-gradient(180deg, rgba(232, 245, 239, 0.8), rgba(255, 253, 247, 0.98));
}

.chip-soft {
    background: rgba(20, 33, 61, 0.08);
    color: var(--ink);
}

.chip-success {
    background: rgba(31, 122, 92, 0.12);
    color: var(--success);
}

.chip-warning {
    background: rgba(192, 123, 16, 0.12);
    color: var(--warning);
}

.chip-danger {
    background: rgba(180, 35, 24, 0.12);
    color: var(--danger);
}

.audit-card {
    align-items: stretch;
}

.audit-diff {
    display: grid;
    gap: 0.6rem;
    margin-top: 0.65rem;
}

.audit-diff div {
    background: rgba(20, 33, 61, 0.04);
    border-radius: 14px;
    padding: 0.7rem 0.8rem;
}

.bottom-nav {
    position: fixed;
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    max-width: 736px;
    margin: 0 auto;
    background: rgba(20, 33, 61, 0.94);
    color: #dfe7f7;
    border-radius: 22px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    padding: 0.4rem;
    gap: 0.35rem;
    box-shadow: 0 24px 40px rgba(20, 33, 61, 0.18);
}

.fab-launch {
    position: fixed;
    right: max(18px, env(safe-area-inset-right));
    bottom: calc(max(12px, env(safe-area-inset-bottom)) + 84px);
    z-index: 20;
    min-height: 52px;
    padding: 0.85rem 1rem;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 18px 32px rgba(143, 50, 0, 0.28);
}

.bottom-nav a {
    text-align: center;
}

.bottom-nav a {
    display: grid;
    place-items: center;
    min-height: 48px;
    border-radius: 16px;
    font-size: 0.82rem;
    font-weight: 600;
}

.bottom-nav a.active {
    background: #fff;
    color: var(--ink);
}

@media (min-width: 768px) {
    .stats-grid,
    .shortcut-grid,
    .ops-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .split-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 520px) {
    .network-banner {
        align-items: stretch;
        flex-direction: column;
    }

    .banner-actions {
        justify-content: stretch;
    }

    .banner-button {
        width: 100%;
    }

    .button-row {
        display: grid;
    }

    .fab-launch {
        left: max(18px, env(safe-area-inset-left));
        right: max(18px, env(safe-area-inset-right));
        text-align: center;
        justify-content: center;
    }
}
