:root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --surface-muted: #f1f5f9;
    --text: #111827;
    --muted: #64748b;
    --line: #e2e8f0;
    --line-strong: #cbd5e1;
    --primary: #0f766e;
    --primary-dark: #115e59;
    --primary-soft: #ccfbf1;
    --danger: #be123c;
    --danger-soft: #ffe4e6;
    --warning-soft: #fef3c7;
    --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
    --shadow-soft: 0 8px 24px rgba(15, 23, 42, 0.06);
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

html {
    background: var(--bg);
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        linear-gradient(180deg, rgba(15, 118, 110, 0.08), rgba(15, 118, 110, 0) 280px),
        var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

.app-shell {
    min-height: 100vh;
}

.auth-shell {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
}

.auth-shell > * {
    width: min(100%, 420px);
}

.app-sidebar {
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-soft);
}

.brand-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 76px;
    padding: 18px 20px 14px;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.brand-icon {
    display: inline-grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 8px;
    background: var(--primary);
    color: white;
    font-size: 0.8rem;
    font-weight: 800;
}

.brand-mark strong {
    display: block;
    color: var(--text);
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.2;
}

.brand-mark small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.78rem;
}

.version-pill {
    border: 1px solid rgba(15, 118, 110, 0.18);
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    padding: 5px 10px;
    font-size: 0.72rem;
    font-weight: 800;
}

.sidebar-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 0 14px 16px;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    min-width: max-content;
    border-radius: 8px;
    padding: 10px 12px;
    color: #475569;
    font-size: 0.9rem;
    font-weight: 700;
    transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.nav-link:hover {
    background: var(--surface-muted);
    color: var(--text);
}

.nav-link.bg-slate-900,
.nav-link.text-white {
    background: var(--primary) !important;
    color: #ffffff !important;
    box-shadow: 0 8px 18px rgba(15, 118, 110, 0.22);
}

.nav-link.is-disabled {
    color: #94a3b8;
    cursor: not-allowed;
}

.sidebar-note {
    display: none;
    padding: 12px 20px 24px;
}

.sidebar-note > div {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(180deg, #ffffff, #f8fafc);
    padding: 16px;
}

.sidebar-note p:not(.eyebrow) {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.55;
}

.app-main {
    min-width: 0;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 76px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.86);
    background: rgba(255, 255, 255, 0.88);
    padding: 18px 20px;
    backdrop-filter: blur(18px);
}

.app-header h1 {
    margin: 2px 0 0;
    color: var(--text);
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.2;
}

.eyebrow {
    margin: 0;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.page-content {
    width: 100%;
    max-width: 1480px;
    margin: 0 auto;
    padding: 24px 20px 40px;
}

.panel,
.metric-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}

.panel {
    padding: 22px;
}

.metric-card {
    position: relative;
    overflow: hidden;
    min-height: 126px;
    padding: 20px;
}

.metric-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    background: var(--primary);
}

.metric-card p:first-child,
.panel h2 + p,
.panel .text-slate-500,
.text-slate-500 {
    color: var(--muted) !important;
}

.metric-card p:first-child {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.metric-card p:last-child {
    margin: 14px 0 0;
    color: var(--text);
    font-size: 1.55rem;
    font-weight: 850;
    line-height: 1.15;
}

.chart-box {
    height: 320px;
}

.formula-cell {
    display: flex;
    min-height: 92px;
    flex-direction: column;
    justify-content: center;
    border-radius: var(--radius);
    padding: 16px;
    font-size: 0.92rem;
    font-weight: 800;
    line-height: 1.45;
}

.data-table {
    width: 100%;
    min-width: 760px;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: white;
    font-size: 0.9rem;
}

.data-table th {
    background: #f8fafc;
    color: #475569;
    font-size: 0.75rem;
    font-weight: 850;
    letter-spacing: 0.04em;
    text-align: left;
    text-transform: uppercase;
}

.data-table th,
.data-table td {
    border-bottom: 1px solid var(--line);
    padding: 14px 16px;
    vertical-align: middle;
}

.data-table tr:last-child td {
    border-bottom: 0;
}

.data-table tbody tr:hover td {
    background: #fbfdff;
}

.data-table a {
    font-weight: 800;
}

.data-table button {
    border: 0;
    background: transparent;
    padding: 0;
    cursor: pointer;
}

.empty-cell {
    color: var(--muted);
    text-align: center;
}

.form-input {
    margin-top: 6px;
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: white;
    padding: 10px 12px;
    color: var(--text);
    outline: none;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

label span {
    color: #334155;
    font-size: 0.86rem;
    font-weight: 800;
}

.btn,
button,
a.rounded-md,
button.rounded-md {
    border-radius: var(--radius) !important;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border: 1px solid transparent;
    padding: 9px 14px;
    font-size: 0.9rem;
    font-weight: 800;
    transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.btn-secondary {
    border-color: var(--line-strong);
    background: white;
    color: #334155;
}

.btn-secondary:hover {
    background: var(--surface-muted);
}

a.bg-slate-900,
button.bg-slate-900 {
    background: var(--primary) !important;
    color: white !important;
    box-shadow: 0 8px 18px rgba(15, 118, 110, 0.18);
}

article.rounded-lg.border.border-stone-200.bg-white {
    border: 1px solid var(--line) !important;
    border-radius: var(--radius) !important;
    background: linear-gradient(180deg, #ffffff, #fbfdff) !important;
    box-shadow: var(--shadow-soft) !important;
}

article.rounded-lg.border.border-stone-200.bg-white h3 {
    color: var(--text);
    font-size: 1rem;
    font-weight: 850;
}

article.rounded-lg.border.border-stone-200.bg-white dl dt {
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

article.rounded-lg.border.border-stone-200.bg-white dl dd {
    color: var(--text);
}

form.rounded-lg.bg-stone-50,
.bg-stone-50 {
    background: #f8fafc !important;
}

a.bg-slate-900:hover,
button.bg-slate-900:hover {
    background: var(--primary-dark) !important;
}

.text-rose-700 {
    color: var(--danger) !important;
}

.bg-rose-50 {
    background: var(--danger-soft) !important;
}

.bg-amber-50 {
    background: var(--warning-soft) !important;
}

@media (min-width: 1024px) {
    .app-shell {
        display: grid;
        grid-template-columns: 284px minmax(0, 1fr);
    }

    .app-sidebar {
        position: sticky;
        top: 0;
        height: 100vh;
        border-right: 1px solid var(--line);
        border-bottom: 0;
        box-shadow: none;
    }

    .brand-row {
        min-height: 92px;
        padding: 24px 22px 18px;
    }

    .sidebar-nav {
        display: grid;
        overflow: visible;
        padding: 0 14px;
    }

    .nav-link {
        width: 100%;
        padding: 12px 14px;
    }

    .sidebar-note {
        display: block;
    }

    .app-header {
        min-height: 92px;
        padding: 22px 32px;
    }

    .app-header h1 {
        font-size: 1.55rem;
    }

    .page-content {
        padding: 32px;
    }
}
