* {
    box-sizing: border-box;
}

:root {
    --ink: #0f172a;
    --ink-muted: #64748b;
    --ink-faint: #94a3b8;

    --bg: #f6f7fb;
    --panel: #ffffff;
    --panel-border: #e6e9f0;

    --sidebar-bg: #0b0f1a;
    --sidebar-bg-2: #10162a;
    --sidebar-ink: #cbd5e1;
    --sidebar-ink-muted: #7c8aa5;
    --sidebar-border: rgba(255, 255, 255, 0.08);

    --accent: #f5720c;
    --accent-strong: #d9600a;
    --accent-soft: #fff1e6;
    --accent-ink: #7a2e02;

    --success: #16a34a;
    --success-soft: #dcfce7;
    --danger: #ef4444;
    --danger-soft: #fef2f2;

    --radius: 14px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 12px 28px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 24px 60px rgba(8, 12, 24, 0.35);
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: "Inter", "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    background: var(--bg);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    margin: 0;
    letter-spacing: -0.01em;
}

p {
    margin: 0;
}

a {
    color: inherit;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
}

/* =========================================================
   Auth screens (login)
   ========================================================= */

.auth-body {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
    background: var(--panel);
}

.auth-visual {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 48px;
    color: #f8fafc;
    background-size: cover;
    background-position: center;
    overflow: hidden;
}

.auth-visual::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(8, 11, 20, 0.75) 0%, rgba(8, 11, 20, 0.55) 45%, rgba(8, 11, 20, 0.92) 100%);
}

.auth-visual > * {
    position: relative;
    z-index: 1;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 900;
    font-size: 18px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.brand-mark svg {
    color: var(--accent);
    flex-shrink: 0;
}

.auth-visual-copy h1 {
    font-size: 40px;
    line-height: 1.12;
    font-weight: 800;
    max-width: 480px;
    margin-bottom: 14px;
}

.auth-visual-copy p {
    font-size: 15px;
    color: #cbd5e1;
    max-width: 420px;
    line-height: 1.6;
}

.auth-visual-features {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    margin-top: 28px;
}

.auth-visual-features li {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #e2e8f0;
}

.auth-visual-features svg {
    color: var(--accent);
    flex-shrink: 0;
}

.auth-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 32px;
}

.auth-card {
    width: 100%;
    max-width: 380px;
}

.auth-card .eyebrow {
    margin-bottom: 10px;
}

.auth-card h1 {
    font-size: 26px;
    font-weight: 800;
    margin-bottom: 6px;
}

.auth-card > p {
    font-size: 14px;
    color: var(--ink-muted);
    margin-bottom: 28px;
}

form {
    display: grid;
    gap: 14px;
    margin-top: 0;
}

.field {
    display: grid;
    gap: 6px;
}

.currency-input {
    position: relative;
}

.currency-input input {
    padding-left: 28px;
}

.currency-input::before {
    content: '\20A6';
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ink-muted);
    font-weight: 700;
    font-size: 14px;
    pointer-events: none;
}

label {
    font-size: 12px;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: 0.01em;
}

input, select, textarea {
    border: 1px solid #dbe0ea;
    border-radius: var(--radius-sm);
    padding: 11px 13px;
    font-size: 14px;
    font-family: inherit;
    color: var(--ink);
    background: #ffffff;
    width: 100%;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

button, .btn {
    border: 0;
    border-radius: var(--radius-sm);
    padding: 11px 16px;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    font-family: inherit;
    transition: background 0.15s ease, transform 0.1s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

button:hover, .btn:hover {
    background: var(--accent-strong);
}

button:active, .btn:active {
    transform: translateY(1px);
}

button[type="submit"] {
    width: 100%;
    height: 46px;
    margin-top: 4px;
}

.btn-secondary {
    background: #eef1f6;
    color: var(--ink);
}

.btn-secondary:hover {
    background: #e2e7f0;
}

.error {
    color: #b91c1c;
    background: var(--danger-soft);
    border: 1px solid #fecaca;
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 600;
}

.error:empty {
    display: none;
}

.hint {
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: #f1f5f9;
    font-size: 13px;
    color: var(--ink-muted);
}

/* =========================================================
   App shell (sidebar + content)
   ========================================================= */

.dashboard-body {
    min-height: 100vh;
    display: flex;
}

.topbar {
    width: 260px;
    background: linear-gradient(190deg, var(--sidebar-bg-2) 0%, var(--sidebar-bg) 65%);
    color: var(--sidebar-ink);
    display: flex;
    flex-direction: column;
    padding: 22px 14px;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 50;
    border-right: 1px solid var(--sidebar-border);
}

.topbar h1 {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 15px;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #f8fafc;
    padding: 6px 10px 22px;
}

.topbar h1 svg {
    color: var(--accent);
    flex-shrink: 0;
}

.topnav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-grow: 1;
}

.nav-section-label {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--sidebar-ink-muted);
    padding: 16px 12px 6px;
}

.topnav a {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    color: var(--sidebar-ink);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 600;
    border-radius: 10px;
    border-left: 3px solid transparent;
    transition: background 0.15s ease, color 0.15s ease;
}

.topnav a svg {
    flex-shrink: 0;
    opacity: 0.85;
}

.topnav a:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}

.topnav a.is-active {
    background: rgba(245, 114, 12, 0.16);
    color: #ffffff;
    border-left-color: var(--accent);
}

.topnav a.is-active svg {
    color: var(--accent);
    opacity: 1;
}

.sidebar-foot {
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid var(--sidebar-border);
    display: grid;
    gap: 10px;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
}

.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-ink);
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 800;
    flex-shrink: 0;
}

.sidebar-user-meta {
    min-width: 0;
    display: grid;
}

.sidebar-user-meta strong {
    font-size: 12.5px;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-meta span {
    font-size: 11px;
    color: var(--sidebar-ink-muted);
}

#logout {
    width: 100%;
    background: rgba(239, 68, 68, 0.12);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 700;
    justify-content: flex-start;
}

#logout:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #fecaca;
}

.page-wrap {
    margin-left: 260px;
    width: calc(100% - 260px);
    padding: 28px 32px 40px;
    display: grid;
    gap: 18px;
    align-content: start;
}

.dashboard-grid {
    margin-left: 260px;
    width: calc(100% - 260px);
    padding: 28px 32px 40px;
    max-width: 1320px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    align-content: start;
}

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.page-head h2 {
    font-size: 22px;
    font-weight: 800;
}

.page-head p {
    color: var(--ink-muted);
    font-size: 13.5px;
    margin-top: 4px;
}

/* =========================================================
   Cards, panels, tables
   ========================================================= */

.panel {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.form-panel {
    width: 100%;
    margin: 0 auto;
}

.two-col {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
}

.form-grid {
    display: grid;
    gap: 12px;
}

.actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 6px;
}

.btn-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 14px;
    border-radius: var(--radius-sm);
    background: #f1f3f9;
    color: var(--ink);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 700;
    border: 1px solid var(--panel-border);
    transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-link:hover {
    background: #e7eaf3;
}

.btn-link.btn-link-accent {
    background: var(--accent);
    color: #fff;
    border-color: transparent;
}

.btn-link.btn-link-accent:hover {
    background: var(--accent-strong);
}

.btn-link.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.inline-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

th, td {
    border-bottom: 1px solid #eef0f5;
    padding: 12px 10px;
    text-align: left;
    vertical-align: middle;
    font-size: 13.5px;
}

th {
    background: #fafbfd;
    color: var(--ink-muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

tbody tr:hover {
    background: #fafbff;
}

.success {
    color: #166534;
    background: var(--success-soft);
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 600;
}

.pagination {
    margin-top: 4px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.pagination-summary {
    margin: 0;
    font-size: 13px;
    color: var(--ink-muted);
}

.pagination-links {
    display: flex;
    gap: 8px;
}

.field-error {
    color: #b91c1c;
    margin: 0;
    font-size: 12px;
}

.profile-grid {
    display: grid;
    gap: 10px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.stat-box {
    border: 1px solid var(--panel-border);
    background: #fafbfd;
    border-radius: var(--radius-sm);
    padding: 14px;
    display: grid;
    gap: 4px;
}

.stat-box span {
    font-size: 22px;
    font-weight: 800;
    color: var(--ink);
}

.checkbox-list {
    border: 1px solid #dbe0ea;
    border-radius: var(--radius-sm);
    padding: 8px;
    max-height: 180px;
    overflow-y: auto;
    display: grid;
    gap: 6px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

small {
    color: var(--ink-muted);
}

/* =========================================================
   Dashboard-specific
   ========================================================= */

.hero-panel {
    grid-column: 1 / -1;
    position: relative;
    color: #f8fafc;
    background-size: cover;
    background-position: center 30%;
    padding: 30px 28px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    justify-content: flex-end;
    min-height: 168px;
    overflow: hidden;
    border: none;
}

.hero-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg, rgba(8, 11, 20, 0.92) 15%, rgba(8, 11, 20, 0.55) 65%, rgba(8, 11, 20, 0.25) 100%);
}

.hero-panel > * {
    position: relative;
    z-index: 1;
}

.hero-panel h2 {
    font-size: 24px;
    font-weight: 800;
}

.hero-panel #me {
    font-size: 12.5px;
    font-weight: 700;
    color: #ffe9d6;
    background: rgba(245, 114, 12, 0.22);
    border: 1px solid rgba(245, 114, 12, 0.4);
    padding: 5px 12px;
    border-radius: 999px;
    display: inline-block;
    width: fit-content;
    letter-spacing: 0.02em;
}

.hero-panel .hint {
    background: transparent;
    color: #cbd5e1;
    padding: 0;
    margin-top: 2px;
    font-size: 13.5px;
}

.route-panel {
    display: flex;
    flex-direction: column;
    min-height: 168px;
}

.route-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent-ink);
    display: grid;
    place-items: center;
    margin-bottom: 12px;
}

.route-panel h3 {
    font-size: 15px;
    font-weight: 800;
    margin-bottom: 6px;
}

.route-panel p {
    font-size: 13px;
    color: var(--ink-muted);
    line-height: 1.55;
    margin-bottom: 16px;
    flex-grow: 1;
}

.route-panel .actions {
    margin-top: 0;
}

@media (max-width: 900px) {
    .topbar {
        transform: translateX(-100%);
        transition: transform 0.24s ease;
        box-shadow: var(--shadow-lg);
    }

    .page-wrap,
    .dashboard-grid {
        margin-left: 0;
        width: 100%;
        max-width: 100%;
        padding: 76px 16px 24px;
        grid-template-columns: 1fr;
    }

    .auth-body {
        grid-template-columns: 1fr;
    }

    .auth-visual {
        min-height: 220px;
        padding: 28px 24px;
    }

    .auth-visual-copy h1 {
        font-size: 26px;
    }

    .auth-visual-features {
        display: none;
    }
}

@media (min-width: 901px) {
    .dashboard-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}
