:root {
    --bg: #0b111b;
    --bg-soft: #111827;
    --bg-card: #151f2e;
    --bg-card-2: #192536;
    --border: rgba(148, 163, 184, 0.18);
    --border-strong: rgba(148, 163, 184, 0.34);
    --text: #edf4ff;
    --muted: #98a6ba;
    --muted-2: #748096;
    --primary: #38bdf8;
    --primary-dark: #0284c7;
    --secondary: #a78bfa;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
    --radius: 22px;
    --radius-sm: 14px;
    --sidebar: 280px;
    --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    font-family: var(--font);
    color: var(--text);
    background:
        radial-gradient(circle at 10% 0%, rgba(56, 189, 248, 0.12), transparent 32%),
        radial-gradient(circle at 90% 20%, rgba(167, 139, 250, 0.12), transparent 28%),
        linear-gradient(135deg, #070b12 0%, #0b111b 42%, #0d1420 100%);
    overflow-x: hidden;
}

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

button {
    cursor: pointer;
}

.is-hidden {
    display: none !important;
}

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

.login-card {
    width: min(480px, 100%);
    padding: 34px;
    border: 1px solid var(--border);
    border-radius: 30px;
    background: rgba(21, 31, 46, 0.88);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.brand-mark {
    width: 62px;
    height: 62px;
    display: grid;
    place-items: center;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #07111d;
    font-weight: 900;
    letter-spacing: -0.04em;
    margin-bottom: 22px;
}

.brand-mark.small {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    margin: 0;
    font-size: 0.88rem;
}

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

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    font-size: clamp(2rem, 7vw, 3.15rem);
    line-height: 0.98;
    margin-bottom: 14px;
    letter-spacing: -0.06em;
}

h2 {
    margin-bottom: 0;
    font-size: clamp(1.45rem, 4vw, 2.35rem);
    letter-spacing: -0.04em;
}

h3 {
    margin-bottom: 0;
    font-size: 1.1rem;
    letter-spacing: -0.02em;
}

.login-text {
    color: var(--muted);
    line-height: 1.6;
    margin-bottom: 24px;
}

.login-form,
.form-grid {
    display: grid;
    gap: 16px;
}

.form-grid.two-cols {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.full-span {
    grid-column: 1 / -1;
}

label {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 650;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 13px 14px;
    color: var(--text);
    background: rgba(8, 13, 22, 0.74);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

textarea {
    resize: vertical;
    line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(56, 189, 248, 0.65);
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.12);
}

.checkbox-line {
    grid-template-columns: 18px 1fr;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px dashed var(--border);
    border-radius: 14px;
    background: rgba(8, 13, 22, 0.34);
}

.checkbox-line input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.form-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn {
    border: 0;
    border-radius: 999px;
    padding: 12px 18px;
    font-weight: 850;
    color: var(--text);
    transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease, border-color 0.15s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    color: #06101a;
    background: linear-gradient(135deg, var(--primary), #7dd3fc);
}

.btn-secondary {
    color: #07111d;
    background: linear-gradient(135deg, var(--secondary), #c4b5fd);
}

.btn-outline {
    color: var(--text);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-strong);
}

.btn-ghost {
    color: var(--muted);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
}

.btn-full {
    width: 100%;
}

.form-feedback {
    min-height: 22px;
    color: var(--danger);
    font-weight: 700;
}

.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar) minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 22px;
    border-right: 1px solid var(--border);
    background: rgba(9, 14, 24, 0.78);
    backdrop-filter: blur(16px);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
}

.sidebar-brand strong,
.sidebar-brand span {
    display: block;
}

.sidebar-brand span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.84rem;
}

.sidebar-nav {
    display: grid;
    gap: 8px;
}

.nav-item {
    width: 100%;
    border: 1px solid transparent;
    border-radius: 16px;
    padding: 13px 14px;
    color: var(--muted);
    background: transparent;
    text-align: left;
    font-weight: 800;
}

.nav-item:hover,
.nav-item.is-active {
    color: var(--text);
    border-color: var(--border);
    background: rgba(56, 189, 248, 0.09);
}

.sidebar-footer {
    margin-top: auto;
}

.workspace {
    min-width: 0;
    padding: 24px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin: -24px -24px 24px;
    padding: 22px 24px;
    border-bottom: 1px solid var(--border);
    background: rgba(11, 17, 27, 0.82);
    backdrop-filter: blur(18px);
}

.topbar-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.panel {
    display: none;
}

.panel.is-visible {
    display: block;
}

.grid {
    display: grid;
    gap: 18px;
}

.grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dashboard-grid {
    margin-top: 18px;
}

.metric-card,
.card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(180deg, rgba(21, 31, 46, 0.96), rgba(16, 24, 37, 0.96));
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.18);
}

.metric-card {
    padding: 20px;
}

.metric-card span {
    color: var(--muted);
    font-weight: 750;
    font-size: 0.88rem;
}

.metric-card strong {
    display: block;
    margin-top: 12px;
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    letter-spacing: -0.05em;
}

.metric-card.accent {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.22), rgba(167, 139, 250, 0.18));
}

.card {
    padding: 22px;
}

.wide-card {
    min-height: 520px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
}

.data-list {
    display: grid;
    gap: 12px;
}

.data-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(8, 13, 22, 0.42);
}

.data-row strong,
.data-row span {
    display: block;
}

.data-row span,
.meta-line {
    color: var(--muted);
    font-size: 0.86rem;
    line-height: 1.5;
}

.row-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-button {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 8px 10px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.04);
    font-weight: 850;
}

.icon-button.danger {
    color: #fecaca;
    border-color: rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.08);
}

.empty-list,
.empty-state {
    padding: 22px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--muted);
    background: rgba(8, 13, 22, 0.34);
}

.efficiency-box {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 18px;
    align-items: center;
}

.efficiency-ring {
    --score: 0;
    width: 112px;
    height: 112px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: conic-gradient(var(--primary) calc(var(--score) * 1%), rgba(255, 255, 255, 0.08) 0);
    position: relative;
}

.efficiency-ring::after {
    content: '';
    position: absolute;
    inset: 12px;
    border-radius: 50%;
    background: var(--bg-card);
}

.efficiency-ring span {
    position: relative;
    z-index: 1;
    font-size: 1.35rem;
    font-weight: 950;
}

.efficiency-box p,
.warnings-box p {
    margin: 6px 0 0;
    color: var(--muted);
    line-height: 1.55;
}

.warnings-box {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.warning-item {
    padding: 12px 14px;
    border: 1px solid rgba(245, 158, 11, 0.32);
    border-radius: 14px;
    background: rgba(245, 158, 11, 0.08);
    color: #fde68a;
    font-size: 0.9rem;
    line-height: 1.45;
}

.cutting-plans {
    display: grid;
    gap: 18px;
}

.plan-block {
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 16px;
    background: rgba(8, 13, 22, 0.36);
}

.plan-block h4 {
    margin: 0 0 10px;
    font-size: 1rem;
}

.plan-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(56, 189, 248, 0.1);
    color: #bae6fd;
    border: 1px solid rgba(56, 189, 248, 0.18);
    font-size: 0.78rem;
    font-weight: 850;
}

.plan-svg-wrap {
    overflow: auto;
    max-width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #07111d;
}

.plan-svg-wrap svg {
    max-width: 100%;
    height: auto;
    min-width: 680px;
}

.financial-summary {
    display: grid;
    gap: 12px;
}

.finance-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(8, 13, 22, 0.36);
}

.finance-line.total {
    border-color: rgba(56, 189, 248, 0.35);
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.12), rgba(167, 139, 250, 0.08));
}

.finance-line strong:last-child {
    text-align: right;
}

.report-area {
    position: fixed;
    left: -99999px;
    top: 0;
    width: 1120px;
    padding: 34px;
    color: #132033;
    background: #ffffff;
}

.report-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding-bottom: 20px;
    border-bottom: 4px solid #111827;
    margin-bottom: 20px;
}

.report-header h1 {
    color: #111827;
    font-size: 30px;
    letter-spacing: -0.035em;
    margin: 0 0 8px;
}

.report-header p {
    color: #4b5563;
    margin: 0;
}

.report-area .report-section {
    margin-bottom: 24px;
    page-break-inside: avoid;
}

.report-area h2,
.report-area h3,
.report-area h4 {
    color: #111827;
}

.report-area table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.report-area th,
.report-area td {
    border: 1px solid #d1d5db;
    padding: 9px 10px;
    text-align: left;
    font-size: 13px;
}

.report-area th {
    background: #f3f4f6;
}

.report-area .plan-svg-wrap {
    border-color: #d1d5db;
    background: #ffffff;
}

.report-area .plan-svg-wrap svg {
    min-width: 0;
    width: 100%;
}

.toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 999;
    max-width: 420px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid var(--border-strong);
    background: rgba(9, 14, 24, 0.92);
    color: var(--text);
    box-shadow: var(--shadow);
    transform: translateY(120%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.toast.is-visible {
    transform: translateY(0);
    opacity: 1;
}

@media (max-width: 1180px) {
    .grid-4,
    .grid-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

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

    .sidebar {
        position: relative;
        height: auto;
        padding: 14px;
    }

    .sidebar-nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .topbar {
        position: relative;
        flex-direction: column;
        align-items: stretch;
        margin-top: 0;
    }

    .topbar-actions {
        justify-content: stretch;
    }

    .topbar-actions .btn {
        flex: 1;
    }
}

@media (max-width: 680px) {
    .workspace {
        padding: 14px;
    }

    .topbar {
        margin-left: -14px;
        margin-right: -14px;
        padding: 18px 14px;
    }

    .grid-4,
    .grid-2,
    .form-grid.two-cols,
    .efficiency-box {
        grid-template-columns: 1fr;
    }

    .sidebar-nav {
        grid-template-columns: 1fr;
    }

    .login-card,
    .card {
        padding: 18px;
    }

    .data-row {
        grid-template-columns: 1fr;
    }

    .row-actions {
        justify-content: flex-start;
        flex-wrap: wrap;
    }
}
