:root {
    --bg: #e7e0d5;
    --bg-soft: #ddd4c7;
    --surface: rgba(250, 247, 241, 0.92);
    --surface-strong: rgba(244, 238, 228, 0.96);
    --surface-muted: #efe8dc;
    --surface-deep: #e8e0d2;
    --line: #d7cbb9;
    --line-strong: #c7b79e;
    --line-soft: rgba(120, 92, 49, 0.12);
    --text: #24303d;
    --text-soft: #5d6874;
    --text-faint: #7b847f;
    --gold: #9d7a45;
    --gold-strong: #7c5e31;
    --gold-soft: #ebe0cc;
    --gold-tint: rgba(157, 122, 69, 0.08);
    --danger: #c55b5b;
    --danger-soft: #faecea;
    --success: #2f8f61;
    --success-soft: #edf8f2;
    --warning: #b17d29;
    --warning-soft: #fff6e7;
    --shadow: 0 16px 36px rgba(58, 45, 25, 0.10);
    --shadow-soft: 0 8px 18px rgba(58, 45, 25, 0.06);
    --radius-xl: 26px;
    --radius-lg: 20px;
    --radius-md: 16px;
    --radius-sm: 12px;
    --content-max: 1260px;
    --content-form-max: 1120px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { font-size: 14px; }
body {
    min-height: 100vh;
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(157, 122, 69, 0.10), transparent 24%),
        radial-gradient(circle at 100% 12%, rgba(88, 70, 43, 0.05), transparent 16%),
        linear-gradient(180deg, #ece4d8 0%, #e6ddd1 55%, #e2d8ca 100%);
}
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(255,255,255,.10), rgba(255,255,255,0));
    opacity: .75;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.bg-orb {
    position: fixed;
    border-radius: 999px;
    filter: blur(90px);
    opacity: .18;
    pointer-events: none;
    z-index: 0;
}
.orb-one { width: 320px; height: 320px; left: -140px; top: 40px; background: rgba(160, 121, 58, 0.22); }
.orb-two { width: 340px; height: 340px; right: -130px; top: 240px; background: rgba(110, 90, 57, 0.14); }

.auth-shell, .layout-shell, .topbar, .content, .sidebar, .card, .page-hero, .stat, .note-box, .sidebar-panel, .auth-card, .form-card, .form-sheet, .filter-panel, .table-card {
    position: relative;
    z-index: 1;
}

.card,
.page-hero,
.stat,
.note-box,
.sidebar-panel,
.auth-card,
.form-card,
.form-sheet,
.filter-panel,
.table-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

.muted,
.subtitle,
.stat-foot,
.hero-copy,
.field-note,
.entry-copy,
.recent-meta,
.small,
.sheet-copy {
    color: var(--text-soft);
}

.eyebrow,
.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(157, 122, 69, 0.09);
    border: 1px solid rgba(157, 122, 69, 0.16);
    color: var(--gold-strong);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.brand,
.topbar-brand,
.auth-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand {
    font-size: .95rem;
    font-weight: 800;
    letter-spacing: .03em;
}

.brand-mark {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: linear-gradient(135deg, #8f6a36, #b48d55);
    color: #fff;
    font-weight: 900;
    letter-spacing: .08em;
    box-shadow: 0 10px 18px rgba(124, 94, 49, 0.22);
}

.page-title,
.hero-title,
.section-title,
.sheet-title,
.entry-title,
.entry-side-title {
    margin: 0;
    color: #202a34;
    line-height: 1.12;
    letter-spacing: -.03em;
}
.hero-title { font-size: clamp(2rem, 3vw, 2.55rem); margin-top: 16px; }
.page-title { font-size: clamp(1.4rem, 2.2vw, 1.9rem); margin-top: 10px; }
.section-title,
.sheet-title,
.entry-title,
.entry-side-title { font-size: 1.1rem; }

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px;
}
.auth-card {
    width: min(1120px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(380px, .95fr);
    overflow: hidden;
    border-radius: 30px;
}
.hero-panel,
.form-panel { padding: 32px; }
.hero-panel {
    background: linear-gradient(145deg, rgba(240, 233, 222, 0.95) 0%, rgba(228, 220, 208, 0.92) 100%);
    border-right: 1px solid var(--line);
}
.form-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(248,244,238,.96) 0%, rgba(243,238,230,.93) 100%);
}
.form-card {
    width: 100%;
    max-width: 455px;
    padding: 24px;
    background: rgba(252,250,246,.98);
}
.form-card-head { margin-bottom: 16px; }
.form-card-head h2 { margin: 0 0 8px; font-size: 1.35rem; }
.form-card-head p { margin: 0; }
.hero-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 24px;
}
.info-chip {
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,.5);
    box-shadow: var(--shadow-soft);
}
.info-chip strong {
    display: block;
    margin-bottom: 6px;
    color: #27303c;
}

.form-grid,
.field,
.entry-side-list,
.recent-list,
.metric-list,
.compact-note,
.entry-submit-box,
.summary-list,
.form-stack {
    display: block;
    gap: 14px;
}

.field label {
    display: block;
    margin-bottom: 7px;
    color: #354151;
    font-size: .78rem;
    font-weight: 700;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,.72);
    color: var(--text);
    outline: none;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.field input::placeholder,
.field textarea::placeholder { color: #8f97a1; }
.field textarea { min-height: 118px; resize: vertical; }
.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: rgba(157, 122, 69, 0.45);
    box-shadow: 0 0 0 4px rgba(157, 122, 69, 0.10);
    background: rgba(255,255,255,.9);
}
input[type="date"],
input[type="time"],
select { color-scheme: light; }

.input-group {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 56px;
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    background: rgba(255,255,255,.76);
}
.input-group:focus-within {
    border-color: rgba(157, 122, 69, 0.45);
    box-shadow: 0 0 0 4px rgba(157, 122, 69, 0.10);
}
.input-group input {
    border: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
}
.input-addon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-left: 1px solid var(--line);
    background: rgba(157, 122, 69, 0.08);
    color: var(--gold-strong);
    font-weight: 800;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 10px 16px;
    border-radius: 13px;
    font-size: .82rem;
    font-weight: 800;
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, #926834, #ae834b);
    box-shadow: 0 10px 20px rgba(146, 104, 52, 0.18);
}
.btn-outline {
    color: #374252;
    background: rgba(255,255,255,.58);
    border-color: var(--line);
}
.btn-outline:hover { border-color: var(--line-strong); background: rgba(255,255,255,.82); }
.btn-danger {
    color: #fff;
    background: linear-gradient(135deg, #bf5a5a, #d87272);
}
.btn-compact { min-height: 38px; padding: 8px 12px; font-size: .76rem; }
.btn-wide { width: 100%; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: .78rem;
}
.badge-soft {
    background: rgba(157, 122, 69, 0.09);
    border: 1px solid rgba(157, 122, 69, 0.14);
    color: var(--gold-strong);
}
.lang-link {
    min-width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,.58);
    font-size: .78rem;
    font-weight: 800;
    color: #384455;
}
.lang-link:hover { border-color: var(--line-strong); background: rgba(255,255,255,.82); }

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 20px;
    background: rgba(235, 227, 215, 0.82);
    border-bottom: 1px solid rgba(157, 122, 69, 0.12);
    backdrop-filter: blur(18px);
}
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.layout-shell {
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr);
    min-height: calc(100vh - 72px);
}
.sidebar {
    padding: 18px;
    border-right: 1px solid rgba(157, 122, 69, 0.12);
    background: linear-gradient(180deg, rgba(239,232,221,.82), rgba(229,220,208,.88));
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.sidebar-panel,
.note-box { padding: 14px; }
.sidebar-caption {
    color: var(--text-faint);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
    padding: 8px 12px 12px;
}
.sidebar a {
    display: block;
    margin-bottom: 8px;
    padding: 11px 13px;
    border-radius: 14px;
    border: 1px solid transparent;
    color: #344050;
    font-size: .84rem;
    font-weight: 700;
}
.sidebar a:hover,
.sidebar a.active {
    border-color: rgba(157, 122, 69, 0.16);
    background: rgba(255,255,255,.55);
    color: var(--gold-strong);
}

.content { padding: 22px; }
.content-shell {
    max-width: var(--content-max);
    margin: 0 auto;
    display: grid;
    gap: 18px;
}
.page-hero {
    padding: 22px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: linear-gradient(135deg, rgba(246,241,233,.95) 0%, rgba(235,226,213,.90) 100%);
}
.page-hero-form,
.entry-form-shell {
    width: min(100%, var(--content-form-max));
    margin-left: auto;
    margin-right: auto;
}
.compact-hero { padding: 20px 22px; }
.compact-subtitle { margin: 8px 0 0; }
.card { padding: 18px; }
.table-card { padding: 14px; }
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}
.stat {
    padding: 18px;
    min-height: 114px;
    background: linear-gradient(180deg, rgba(248,244,238,.94) 0%, rgba(239,233,224,.90) 100%);
}
.stat-label {
    color: var(--text-faint);
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .12em;
    margin-bottom: 10px;
}
.stat-value {
    font-size: clamp(1.1rem, 1.8vw, 1.55rem);
    font-weight: 900;
    color: #1f2b36;
    letter-spacing: -.03em;
    margin-bottom: 8px;
}
.stat-foot { font-size: .8rem; }

.actions-row,
.inline-form,
.filter-toolbar-actions,
.hero-actions-compact,
.actions-stack {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}
.inline-form { display: inline-flex; }

.alert {
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid transparent;
    font-size: .84rem;
}
.auth-alert { width: min(1120px, 100%); margin-bottom: 16px; }
.alert-success { background: var(--success-soft); border-color: rgba(47, 143, 97, 0.18); color: #116744; }
.alert-danger { background: var(--danger-soft); border-color: rgba(197, 91, 91, 0.18); color: #8e2f2f; }
.alert-warning { background: var(--warning-soft); border-color: rgba(177, 125, 41, 0.18); color: #8b5e16; }

.filter-panel {
    padding: 16px 18px;
    background: rgba(247,243,237,.92);
}
.filter-toolbar-form {
    display: grid;
    gap: 14px;
    align-items: end;
}
.filter-toolbar-form-simple {
    grid-template-columns: minmax(0, 1.35fr) repeat(2, minmax(150px, .9fr)) auto;
}
.filter-toolbar-form-extended {
    grid-template-columns: minmax(0, 1.2fr) repeat(3, minmax(150px, .85fr)) auto;
}
.filter-toolbar-actions { justify-content: flex-end; }

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255,255,255,.62);
}
.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: .82rem;
}
.table th,
.table td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(199,183,158,.55);
    text-align: left;
    vertical-align: middle;
}
.table th {
    background: rgba(237,228,213,.72);
    color: var(--gold-strong);
    font-size: .67rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}
.table tbody tr:hover td { background: rgba(255,255,255,.45); }
.table tbody tr:last-child td { border-bottom: 0; }
.table td { color: #2b3642; line-height: 1.55; background: rgba(255,255,255,.20); }
.table td:first-child,
.table th:first-child { padding-left: 18px; }
.table td:last-child,
.table th:last-child { padding-right: 18px; }
.row-id {
    display: inline-flex;
    min-width: 34px;
    height: 28px;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    border-radius: 999px;
    background: rgba(157, 122, 69, 0.10);
    border: 1px solid rgba(157, 122, 69, 0.18);
    color: var(--gold-strong);
    font-size: .74rem;
    font-weight: 800;
}
.row-title { font-weight: 700; color: #1f2b36; }
.cell-meta { color: #576372; }
.amount-text {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 12px;
    border-radius: 999px;
    background: rgba(157, 122, 69, 0.10);
    border: 1px solid rgba(157, 122, 69, 0.16);
    color: var(--gold-strong);
    font-weight: 800;
    font-size: .8rem;
}
.actions-cell { white-space: nowrap; }
.empty-state {
    text-align: center;
    color: var(--text-faint);
    padding: 28px 18px !important;
}

.grid-two {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}
.dashboard-card { display: grid; gap: 12px; }
.recent-list { gap: 10px; }
.recent-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 15px;
    border-radius: 16px;
    background: rgba(255,255,255,.55);
    border: 1px solid var(--line);
}
.recent-main { min-width: 0; }
.recent-main .row-title { margin-bottom: 4px; }
.empty-panel {
    padding: 18px;
    border-radius: 16px;
    border: 1px dashed var(--line-strong);
    background: rgba(255,255,255,.4);
    color: var(--text-faint);
}

.record-form-grid,
.entry-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 18px;
    align-items: start;
}
.form-sheet,
.entry-card {
    padding: 20px;
    background: rgba(248,244,238,.92);
}
.form-sheet-head,
.entry-side-group {
    margin-bottom: 16px;
}
.sheet-title,
.entry-side-title { margin-top: 10px; }
.form-block,
.entry-section,
.entry-datetime-block,
.entry-side-item {
    padding: 16px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,.38);
}
.form-block + .form-block,
.entry-section + .entry-section { margin-top: 14px; }
.block-head,
.entry-section-head {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.block-head h3,
.entry-section-head h2,
.entry-section-head .entry-title { margin: 0; font-size: 1rem; }
.form-columns,
.entry-inline-grid,
.datetime-grid {
    display: grid;
    gap: 14px;
}
.form-columns.two,
.entry-inline-grid-2,
.datetime-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.datetime-card,
.entry-datetime-block {
    padding: 15px;
}
.datetime-card strong,
.entry-datetime-block > strong {
    display: block;
    margin-bottom: 10px;
    color: var(--gold-strong);
    font-size: .76rem;
    text-transform: uppercase;
    letter-spacing: .12em;
}
.form-summary,
.entry-card-side {
    position: sticky;
    top: 90px;
    display: grid;
    gap: 14px;
}
.summary-list,
.entry-side-list { gap: 10px; }
.summary-row,
.entry-side-item {
    display: grid;
    gap: 4px;
}
.summary-label,
.entry-side-label {
    font-size: .69rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--gold-strong);
}
.summary-value,
.entry-side-item strong {
    color: #243040;
    font-weight: 700;
}
.form-actions,
.entry-submit-box {
    display: grid;
    gap: 10px;
}

@media (max-width: 1280px) {
    .auth-card { grid-template-columns: 1fr; }
    .hero-panel { border-right: 0; border-bottom: 1px solid var(--line); }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .record-form-grid,
    .entry-grid { grid-template-columns: 1fr; }
    .form-summary,
    .entry-card-side { position: static; }
}

@media (max-width: 1080px) {
    .layout-shell { grid-template-columns: 1fr; }
    .sidebar {
        border-right: 0;
        border-bottom: 1px solid rgba(157, 122, 69, 0.12);
        padding-bottom: 14px;
    }
    .sidebar-panel {
        display: flex;
        align-items: center;
        gap: 10px;
        overflow-x: auto;
        padding: 12px;
        scrollbar-width: thin;
    }
    .sidebar-caption { flex: 0 0 100%; padding: 4px 4px 8px; }
    .sidebar a {
        margin: 0;
        display: inline-flex;
        white-space: nowrap;
        min-height: 40px;
        align-items: center;
    }
    .filter-toolbar-form-simple,
    .filter-toolbar-form-extended { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filter-toolbar-actions { grid-column: 1 / -1; }
}

@media (max-width: 860px) {
    .auth-shell { padding: 16px; }
    .hero-grid,
    .grid-two,
    .stats,
    .form-columns.two,
    .entry-inline-grid-2,
    .datetime-grid,
    .filter-toolbar-form-simple,
    .filter-toolbar-form-extended { grid-template-columns: 1fr; }
    .topbar {
        padding: 14px 16px;
        flex-direction: column;
        align-items: flex-start;
    }
    .topbar-actions,
    .actions-row,
    .hero-actions-compact,
    .filter-toolbar-actions,
    .actions-stack { width: 100%; }
    .page-hero {
        flex-direction: column;
        align-items: flex-start;
        padding: 18px;
    }
    .topbar-actions .btn,
    .topbar-actions .badge,
    .topbar-actions .lang-link,
    .actions-row .btn,
    .actions-row a,
    .filter-toolbar-actions .btn,
    .filter-toolbar-actions a { width: 100%; }

    .table-wrap {
        overflow: visible;
        border: 0;
        background: transparent;
        box-shadow: none;
    }
    .table,
    .table-wide,
    .table-list { min-width: 100%; }
    .table thead { display: none; }
    .table tbody,
    .table tr,
    .table td { display: block; width: 100%; }
    .table tbody { display: grid; gap: 12px; }
    .table tr {
        padding: 14px;
        border-radius: 18px;
        border: 1px solid var(--line);
        background: rgba(251,249,245,.9);
        box-shadow: var(--shadow-soft);
    }
    .table td {
        padding: 8px 0;
        border-bottom: 1px dashed rgba(199,183,158,.7);
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 14px;
        white-space: normal;
        background: transparent;
    }
    .table td:last-child { border-bottom: 0; padding-bottom: 0; }
    .table td::before {
        content: attr(data-label);
        flex: 0 0 108px;
        color: var(--gold-strong);
        font-size: .66rem;
        font-weight: 800;
        letter-spacing: .1em;
        text-transform: uppercase;
        line-height: 1.45;
    }
    .actions-cell,
    .inline-form { width: 100%; }
    .actions-stack {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }
    .actions-stack .btn,
    .inline-form .btn { width: 100%; }
    .recent-item { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 560px) {
    html { font-size: 13px; }
    .hero-panel,
    .form-panel,
    .content,
    .sidebar { padding: 14px; }
    .card,
    .page-hero,
    .auth-card,
    .stat { border-radius: 18px; }
    .form-sheet,
    .entry-card,
    .filter-panel,
    .table-card,
    .form-block,
    .entry-section,
    .entry-datetime-block,
    .entry-side-item { padding: 14px; }
    .form-card { padding: 18px; }
    .field textarea { min-height: 110px; }
    .table td {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    .table td::before { flex: 0 0 auto; }
    .actions-stack { grid-template-columns: 1fr; }
}
