:root {
    color-scheme: light;
    --bg: #f6f7fb;
    --card: #ffffff;
    --border: #e2e6ef;
    --text: #1b1f2a;
    --muted: #5f6b7a;
    --primary: #4a6cf7;
    --danger: #d64545;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
}

.layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: #101828;
    color: #fff;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.brand {
    font-weight: 700;
    font-size: 18px;
}

.nav-link {
    display: block;
    color: #c6d0ff;
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 10px;
    margin-bottom: 6px;
}

.nav-link.active,
.nav-link:hover {
    background: rgba(74, 108, 247, 0.2);
    color: #fff;
}

.sidebar-note {
    margin-top: auto;
    font-size: 12px;
    color: #95a3ff;
}

.content {
    padding: 28px;
}

.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 52px;
    background: #101828;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0 16px;
    align-items: center;
    gap: 10px;
    z-index: 11;
}

.mobile-header-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.mobile-header-title {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.mobile-nav {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: #101828;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 8px 10px 10px;
    gap: 6px;
    overflow-x: auto;
    z-index: 10;
}

.mobile-nav-link {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 6px 8px;
    color: #c6d0ff;
    text-decoration: none;
    border-radius: 10px;
    font-size: 12px;
    min-width: 72px;
    flex: 0 0 auto;
}

.mobile-nav-link.active,
.mobile-nav-link:hover {
    background: rgba(74, 108, 247, 0.2);
    color: #fff;
}

.mobile-nav-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.mobile-nav-label {
    font-weight: 600;
    white-space: nowrap;
}

h1 {
    margin-top: 0;
    margin-bottom: 16px;
    font-size: 28px;
    font-weight: 700;
}

.cards {
    display: grid;
    gap: 20px;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
}

.card h2 {
    margin-top: 0;
    font-size: 18px;
    font-weight: 600;
}

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

label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 14px;
    color: var(--muted);
}

input,
select {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.15);
}

.nav-section {
    margin-top: 12px;
    margin-bottom: 6px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #7f8cff;
}

.stat-summary {
    display: flex;
    gap: 24px;
    margin-bottom: 12px;
}

.stat-label {
    font-size: 12px;
    color: var(--muted);
}

.stat-number {
    font-size: 20px;
    font-weight: 700;
}

.tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    background: #eef1ff;
    color: var(--primary);
    font-size: 12px;
}

.tag.muted {
    background: #eef5f0;
    color: #2b6d52;
}

.amount {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

input[type="file"] {
    padding: 6px 0;
}

small {
    color: var(--muted);
}

.form-actions {
    margin-top: 14px;
}

.btn {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 14px;
}

.btn.secondary {
    background: #eef1ff;
    color: var(--primary);
    border: 1px solid #cfd6ff;
}

.btn.small {
    padding: 4px 10px;
    font-size: 12px;
}

.inline {
    display: inline;
}

.segmented {
    display: flex;
    gap: 8px;
}

.segmented label {
    flex: 1;
}

.segmented input {
    display: none;
}

.segmented span {
    display: block;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    background: #fff;
}

.segmented input:checked + span {
    border-color: var(--primary);
    background: rgba(74, 108, 247, 0.1);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th,
td {
    text-align: left;
    padding: 10px 8px;
    border-bottom: 1px solid var(--border);
}

th {
    color: var(--muted);
    font-weight: 600;
}

.notice {
    background: #fff7e6;
    color: #8a5a00;
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 10px;
}

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

.toast {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 10px;
    font-weight: 600;
}

.toast.ok {
    background: #e7f8ee;
    color: #237a4b;
}

.toast.err {
    background: #fdecea;
    color: #b42318;
}

.hidden {
    display: none;
}

@media (max-width: 900px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }

    .sidebar-note {
        margin-top: 0;
        width: 100%;
        text-align: left;
    }

    .sidebar nav {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px 10px;
        width: 100%;
    }

    .nav-section {
        grid-column: 1 / -1;
        margin-top: 6px;
    }

    .nav-link {
        margin-bottom: 0;
        text-align: center;
    }

    .content {
        padding: 64px 20px 86px;
    }

    .mobile-nav {
        display: flex;
        flex-wrap: nowrap;
        justify-content: space-around;
    }

    .mobile-header {
        display: flex;
    }
}
