:root {
    --bg: #050505;
    --bg-soft: #111111;
    --panel: #141414;
    --panel-alt: #1a1a1a;
    --primary: #f5c84c;
    --primary-soft: rgba(245, 200, 76, 0.14);
    --secondary: #f3d76a;
    --warning: #f5c84c;
    --text: #f5f5f5;
    --muted: #c7c7c7;
    --line: rgba(245, 200, 76, 0.25);
    --white: #ffffff;
    --danger: #ff5a5a;
    --success: #f5c84c;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: linear-gradient(180deg, var(--bg) 0%, #0b1120 100%);
    color: var(--text);
}

button, input, select, textarea, a {
    font: inherit;
}

button, .nav-btn, .primary-btn, .secondary-btn {
    transition: 0.2s ease;
}

.app-shell {
    display: flex;
    min-height: 100vh;
    height: auto;
    padding: 20px;
    gap: 20px;
    align-items: stretch;
}

.topbar {
    width: 260px;
    min-width: 260px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 18px 16px;
    background: rgba(17, 24, 39, 0.85);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.28);
    backdrop-filter: blur(6px);
}

.brand {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    padding: 8px 6px 14px;
    border-bottom: 1px solid var(--line);
}

.brand-logo {
    display: block;
    width: 180px;
    max-width: 100%;
    height: auto;
    filter: brightness(1.15);
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), #d79d00);
    font-weight: 700;
    color: var(--bg);
}

.logo.large {
    width: 62px;
    height: 62px;
    font-size: 1.8rem;
    margin: 0 auto 12px;
}

.brand strong {
    display: block;
    font-size: 1rem;
}

.brand small {
    color: var(--muted);
}

.main-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
}

.nav-btn,
.primary-btn,
.secondary-btn {
    border: 0;
    border-radius: 12px;
    cursor: pointer;
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    background: rgba(255, 255, 255, 0.02);
    color: var(--text);
    padding: 14px 16px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    font-weight: 700;
    text-decoration: none;
    letter-spacing: 0.02em;
}

.nav-btn:hover {
    border-color: rgba(245, 200, 76, 0.35);
    transform: translateX(1px);
}

.nav-btn.active {
    background: linear-gradient(135deg, rgba(245, 200, 76, 0.18), rgba(245, 200, 76, 0.1));
    color: var(--primary);
    border-color: rgba(245, 200, 76, 0.34);
    box-shadow: inset 0 0 0 1px rgba(245, 200, 76, 0.16);
}

.nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    min-width: 24px;
    font-size: 1.35rem;
    line-height: 1;
}

.nav-icon i {
    display: inline-block;
    font-size: 1.25rem;
    color: currentColor;
}

.danger-link {
    color: #fde7a9;
    border-color: rgba(255, 90, 90, 0.4);
    background: rgba(255, 90, 90, 0.05);
}

.container {
    flex: 1;
    margin-top: 0;
    padding: 6px 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.panel {
    display: none;
    animation: fadeIn 0.25s ease;
    flex: 0 0 auto;
}

.panel.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.welcome {
    margin-bottom: 18px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.72rem;
    font-weight: 700;
}

h1, h2, h3 {
    margin: 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 16px;
}

.stat-card,
.form-card,
.table-card,
.chart-box {
    background: rgba(17, 24, 39, 0.82);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.22);
}

.stat-card {
    padding: 22px;
}

.stat-card span {
    display: block;
    color: var(--muted);
    margin-bottom: 8px;
}

.stat-card strong {
    font-size: 2rem;
}

.chart-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(260px, 1fr));
    gap: 18px;
    margin-top: 18px;
}

.chart-box {
    min-height: 300px;
    padding: 18px;
}

.chart-box.full-width {
    grid-column: 1 / -1;
}

.section-head {
    margin-bottom: 18px;
}

.form-card,
.table-card {
    padding: 20px;
    margin-top: 12px;
}

.stack-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.field-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 16px;
}

label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: var(--muted);
    font-size: 0.95rem;
}

input, select, textarea {
    width: 100%;
    background: var(--panel-alt);
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--text);
    padding: 12px 14px;
    outline: none;
}

input:focus, select:focus, textarea:focus {
    border-color: rgba(79, 70, 229, 0.8);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.18);
}

input[type="date"] {
    cursor: pointer;
    flex: 1;
    min-width: 0;
    padding-right: 42px;
}

.date-field {
    display: flex;
    align-items: center;
    position: relative;
    width: 100%;
}

.date-field input {
    width: 100%;
}

.date-trigger {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    background: rgba(245, 200, 76, 0.12);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.date-trigger:hover {
    background: rgba(245, 200, 76, 0.2);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

.primary-btn,
.secondary-btn {
    padding: 12px 16px;
    font-weight: 700;
}

.danger-btn {
    border: 0;
    background: rgba(255, 90, 90, 0.12);
    color: #ffb4b4;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.edit-btn {
    border: 0;
    background: rgba(245, 200, 76, 0.12);
    color: var(--primary);
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-decoration: none;
    margin-right: 6px;
}

.edit-btn:hover,
.danger-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.15);
}

.primary-btn {
    background: linear-gradient(135deg, var(--primary), #d79d00);
    color: #111111;
    max-width: 220px;
    border: 0;
    box-shadow: 0 8px 18px rgba(245, 200, 76, 0.22);
}

.secondary-btn {
    background: rgba(34, 197, 94, 0.12);
    color: #bbf7d0;
    border: 1px solid rgba(34, 197, 94, 0.35);
}

.full {
    max-width: 100%;
    width: 100%;
}

.alert {
    margin: 18px 0;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(59, 130, 246, 0.12);
    color: var(--text);
}

.alert.success {
    border-color: rgba(34, 197, 94, 0.45);
    background: rgba(34, 197, 94, 0.12);
    color: #d1fae5;
}

.alert.danger {
    border-color: rgba(239, 68, 68, 0.45);
    background: rgba(239, 68, 68, 0.12);
    color: #fecaca;
}

.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-box {
    width: min(100%, 440px);
    background: rgba(19, 19, 19, 0.95);
    border: 1px solid rgba(245, 200, 76, 0.25);
    border-radius: 22px;
    padding: 28px 24px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

.login-header {
    text-align: center;
    margin-bottom: 16px;
}

.login-logo {
    display: block;
    width: 190px;
    max-width: 100%;
    height: auto;
    margin: 0 auto 18px;
}

.login-header h1 {
    margin-bottom: 8px;
}

.login-header p {
    color: var(--muted);
    margin: 0;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 18px;
}

.login-foot {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: center;
    margin-top: 16px;
    color: var(--muted);
}

.table-card table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
}

.table-scroll {
    max-height: 420px;
    overflow: auto;
    border-top: 1px solid var(--line);
}

.entries-table {
    min-width: 820px;
    table-layout: fixed;
}

.entries-table th:nth-child(1),
.entries-table td:nth-child(1) {
    width: 16%;
}

.entries-table th:nth-child(2),
.entries-table td:nth-child(2) {
    width: 16%;
}

.entries-table th:nth-child(3),
.entries-table td:nth-child(3) {
    width: 21%;
}

.entries-table th:nth-child(4),
.entries-table td:nth-child(4) {
    width: 11%;
    text-align: center;
}

.entries-table th:nth-child(5),
.entries-table td:nth-child(5) {
    width: 15%;
}

.entries-table th:nth-child(6),
.entries-table td:nth-child(6) {
    width: 11%;
}

.entries-table th:nth-child(7),
.entries-table td:nth-child(7) {
    width: 10%;
    white-space: nowrap;
}

.number-cell {
    font-variant-numeric: tabular-nums;
}

.table-scroll thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--panel);
}

.table-card th,
.table-card td {
    text-align: left;
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

.inline-action {
    display: inline-flex;
    margin: 0;
}

.entry-list-head {
    align-items: center;
}

.search-field {
    position: relative;
    min-width: min(100%, 280px);
    margin: 0;
}

.search-field i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
}

.search-field input {
    padding-left: 40px;
}

.table-card th {
    color: var(--muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.filter-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.inline-filter {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.inline-filter select {
    min-width: 180px;
}

.date-filter-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.date-filter-group input {
    min-width: 150px;
    width: 150px;
}

@media (max-width: 800px) {
    .app-shell {
        flex-direction: column;
        padding: 14px;
    }

    .topbar {
        width: 100%;
        min-width: 100%;
    }

    .main-nav {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .filter-row,
    .inline-filter {
        flex-direction: column;
        align-items: flex-start;
    }

    .field-row,
    .stats-grid,
    .chart-grid {
        grid-template-columns: 1fr;
    }

    .primary-btn {
        max-width: 100%;
    }

    .entry-list-head,
    .search-field {
        width: 100%;
    }
}
