:root {
    --bg: #ece6df;
    --paper: rgba(255, 252, 248, 0.9);
    --paper-strong: #fbf6f1;
    --ink: #3f3a36;
    --muted: #7b726a;
    --line: rgba(100, 93, 86, 0.14);
    --primary: #7d8f87;
    --primary-strong: #677972;
    --secondary: #bda59a;
    --accent: #a78f82;
    --warn: #c78c6b;
    --danger: #b96e69;
    --ok: #879b79;
    --shadow: 0 18px 40px rgba(93, 79, 68, 0.12);
    --radius: 22px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "PingFang SC", "Noto Sans SC", "Helvetica Neue", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top right, rgba(188, 173, 164, 0.28), transparent 24rem),
        radial-gradient(circle at bottom left, rgba(125, 143, 135, 0.22), transparent 28rem),
        linear-gradient(180deg, #f3ede6 0%, #ece6df 100%);
}

a {
    color: var(--primary-strong);
    text-decoration: none;
}

a:hover {
    opacity: 0.88;
}

.app-header,
.app-nav,
.page-shell,
.login-shell {
    animation: fadeUp 0.45s ease;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.2rem 1rem 0.8rem;
}

.brand {
    display: inline-block;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.header-meta {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.session-text {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.2rem;
    margin: 0;
    font-size: 0.92rem;
    color: var(--muted);
}

.session-text strong {
    color: var(--ink);
}

.brand-subtitle,
.muted,
.help-text,
.form-hint {
    color: var(--muted);
}

.brand-subtitle,
.eyebrow,
.help-text,
.form-hint {
    margin: 0.25rem 0 0;
    font-size: 0.92rem;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent);
}

.header-actions,
.button-group,
.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.inline-form {
    margin: 0;
}

.top-gap {
    margin-top: 0.9rem;
}

.app-nav {
    display: flex;
    gap: 0.6rem;
    overflow-x: auto;
    padding: 0 1rem 1rem;
}

.app-nav a {
    padding: 0.7rem 1rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.45);
    border: 1px solid var(--line);
    white-space: nowrap;
}

.app-nav a.active {
    background: var(--primary);
    color: #fffaf4;
    border-color: transparent;
}

.page-shell {
    padding: 0 1rem 2rem;
}

.page-header {
    margin-bottom: 1rem;
}

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

.panel,
.stat-card,
.login-card {
    background: var(--paper);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    border-radius: var(--radius);
    backdrop-filter: blur(18px);
}

.panel {
    padding: 1.1rem;
    margin-bottom: 1rem;
}

.narrow-panel {
    max-width: 720px;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.stats-grid,
.card-grid {
    display: grid;
    gap: 1rem;
}

.stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    margin-bottom: 1rem;
}

.card-grid.two-columns {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.full-span {
    grid-column: 1 / -1;
}

.stat-card {
    padding: 1rem;
}

.stat-card span {
    display: block;
    font-size: 0.92rem;
    color: var(--muted);
}

.stat-card strong {
    display: block;
    margin-top: 0.45rem;
    font-size: 1.55rem;
}

.list-stack {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(123, 114, 106, 0.1);
}

.share-box,
.form-control {
    width: 100%;
    border: 1px solid rgba(123, 114, 106, 0.18);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.86);
    color: var(--ink);
    padding: 0.9rem 1rem;
    font-size: 0.98rem;
}

.share-box {
    min-height: 230px;
    resize: vertical;
}

.stack-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-field label {
    display: block;
    margin-bottom: 0.45rem;
    font-weight: 600;
}

.form-field ul {
    margin: 0;
    padding-left: 1.25rem;
}

.field-error {
    margin-top: 0.35rem;
    color: var(--danger);
    font-size: 0.88rem;
}

.has-error .form-control {
    border-color: rgba(185, 110, 105, 0.5);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 44px;
    padding: 0.78rem 1.05rem;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button-primary {
    background: var(--primary);
    color: #fffaf4;
}

.button-secondary {
    background: rgba(255, 255, 255, 0.6);
    color: var(--ink);
    border: 1px solid var(--line);
}

.button-danger {
    background: var(--danger);
    color: #fffaf4;
}

.filter-grid,
.detail-grid {
    display: grid;
    gap: 0.8rem;
}

.filter-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    margin-bottom: 1rem;
}

.detail-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.table-wrap {
    overflow-x: auto;
}

.responsive-table {
    width: 100%;
    border-collapse: collapse;
}

.responsive-table th,
.responsive-table td {
    padding: 0.95rem 0.8rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.responsive-table tbody tr:nth-child(odd) {
    background: rgba(255, 255, 255, 0.36);
}

.responsive-table tbody tr:nth-child(even) {
    background: rgba(196, 182, 171, 0.14);
}

.responsive-table th {
    font-size: 0.9rem;
    color: var(--muted);
}

.tag {
    display: inline-flex;
    align-items: center;
    padding: 0.38rem 0.72rem;
    border-radius: 999px;
    font-size: 0.84rem;
}

.tag-neutral {
    background: rgba(123, 114, 106, 0.12);
}

.tag-ok {
    background: rgba(135, 155, 121, 0.16);
    color: #516046;
}

.tag-warn {
    background: rgba(199, 140, 107, 0.16);
    color: #86563b;
}

.tag-danger {
    background: rgba(185, 110, 105, 0.18);
    color: #804a45;
}

.message-stack {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.message {
    padding: 0.9rem 1rem;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.7);
}

.message-success {
    border-color: rgba(135, 155, 121, 0.3);
}

.message-error {
    border-color: rgba(185, 110, 105, 0.3);
}

.permit-checklist {
    display: grid;
    gap: 0.75rem;
}

.permit-choice {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid var(--line);
}

.divider-dot::before {
    content: "·";
    margin: 0 0.4rem;
}

.empty-state {
    color: var(--muted);
    text-align: center;
    padding: 1rem;
}

.login-body {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 1rem;
}

.login-card {
    width: min(460px, 100%);
    padding: 1.6rem;
}

.nav-toggle {
    display: none;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 820px) {
    .app-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .split-header {
        flex-direction: column;
    }

    .nav-toggle {
        display: inline-flex;
    }

    .app-nav {
        display: none;
        flex-wrap: wrap;
    }

    .app-nav.is-open {
        display: flex;
    }
}

@media (max-width: 680px) {
    .responsive-table thead {
        display: none;
    }

    .table-wrap {
        overflow-x: visible;
    }

    .responsive-table,
    .responsive-table tbody {
        display: block;
        width: 100%;
    }

    .responsive-table tr {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.45rem 0.8rem;
        margin-bottom: 0.8rem;
        padding: 0.9rem;
        border: 1px solid var(--line);
        border-radius: 18px;
        box-shadow: 0 10px 24px rgba(93, 79, 68, 0.08);
    }

    .responsive-table td {
        display: block;
        width: auto;
        min-width: 0;
        border-bottom: none;
        padding: 0;
    }

    .responsive-table td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 0.12rem;
        color: var(--muted);
        font-size: 0.78rem;
    }
}
