:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --panel-strong: #f8fafc;
    --text: #172033;
    --muted: #64748b;
    --line: #dbe4ef;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --teal: #0f766e;
    --danger: #b91c1c;
    --warning: #a16207;
    --shadow: 0 18px 45px rgba(15, 23, 42, 0.09);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    letter-spacing: 0;
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

[hidden] {
    display: none !important;
}

.app-shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: #ffffff;
    border-right: 1px solid var(--line);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: sticky;
    top: 0;
    height: 100vh;
}

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

.brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    color: #ffffff;
    background: var(--primary);
    font-weight: 800;
    font-size: 24px;
}

.brand h1,
.brand p,
.hero h2,
.hero p,
.panel-title h3,
.panel-title p,
.section-heading h2,
.eyebrow {
    margin: 0;
}

.brand h1 {
    font-size: 22px;
}

.brand p,
.panel-title p,
.hero p,
.muted {
    color: var(--muted);
}

.tabs {
    display: grid;
    gap: 8px;
}

.menu-toggle {
    display: none;
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    padding: 9px;
}

.menu-toggle span {
    display: block;
    height: 2px;
    background: var(--text);
    border-radius: 999px;
}

.menu-toggle span + span {
    margin-top: 6px;
}

.tab {
    border: 1px solid transparent;
    background: transparent;
    color: var(--text);
    text-align: left;
    padding: 12px 14px;
    border-radius: 8px;
    font-weight: 700;
}

.tab:hover,
.tab.active {
    background: #eff6ff;
    color: var(--primary-dark);
    border-color: #bfdbfe;
}

.status-card {
    margin-top: auto;
    border: 1px solid var(--line);
    background: var(--panel-strong);
    padding: 16px;
    border-radius: 8px;
    display: grid;
    gap: 5px;
}

.status-card span {
    color: var(--muted);
    font-size: 13px;
}

.content {
    padding: 28px;
    display: grid;
    gap: 22px;
}

.hero {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.hero h2 {
    font-size: clamp(26px, 4vw, 44px);
    line-height: 1.05;
    max-width: 820px;
}

.hero p {
    margin-top: 10px;
    max-width: 680px;
}

.eyebrow {
    color: var(--teal);
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 800;
    margin-bottom: 8px;
}

.module-panel {
    display: none;
    gap: 18px;
}

.module-panel.active {
    display: grid;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 16px;
}

.section-heading h2 {
    font-size: 28px;
}

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

.dashboard-grid.two {
    grid-template-columns: minmax(320px, 0.85fr) minmax(360px, 1.15fr);
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
    min-width: 0;
}

.panel-title {
    margin-bottom: 16px;
}

.panel-title h3 {
    font-size: 19px;
}

.form-row {
    display: grid;
    gap: 7px;
    margin-bottom: 14px;
}

label {
    font-weight: 700;
    color: #334155;
}

input,
select {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px 11px;
    background: #ffffff;
    color: var(--text);
}

input:focus,
select:focus {
    outline: 3px solid #dbeafe;
    border-color: var(--primary);
}

.btn,
.icon-btn {
    border: 0;
    border-radius: 8px;
    font-weight: 800;
}

.btn {
    min-height: 42px;
    padding: 10px 14px;
}

.btn.primary {
    background: var(--primary);
    color: #ffffff;
}

.btn.primary:hover {
    background: var(--primary-dark);
}

.btn.ghost {
    background: #e0f2fe;
    color: #075985;
}

.btn.full {
    width: 100%;
}

.icon-btn {
    width: 34px;
    height: 34px;
    background: #fee2e2;
    color: var(--danger);
    font-size: 22px;
    line-height: 1;
}

.table-wrap {
    overflow-x: auto;
}

.table-wrap.compact {
    margin-bottom: 14px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 11px;
    text-align: left;
    vertical-align: middle;
}

th {
    color: #475569;
    font-size: 13px;
    background: var(--panel-strong);
}

td input {
    min-width: 76px;
}

tr.invalid td {
    color: var(--warning);
    background: #fffbeb;
}

.quantum-row {
    display: none;
}

.quantum-row.show {
    display: grid;
}

.alert {
    margin-top: 12px;
    border-radius: 8px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    background: #eef2ff;
    color: #3730a3;
    font-weight: 700;
}

.alert-danger {
    background: #fef2f2;
    border-color: #fecaca;
    color: var(--danger);
}

.alert-warning {
    background: #fffbeb;
    border-color: #fde68a;
    color: var(--warning);
}

.hidden {
    display: none;
}

.gantt {
    display: flex;
    align-items: stretch;
    gap: 4px;
    min-height: 118px;
    padding: 10px;
    background: var(--panel-strong);
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    overflow-x: auto;
}

.gantt-segment {
    color: #ffffff;
    border-radius: 8px;
    min-width: 82px;
    padding: 12px 10px;
    display: grid;
    align-content: center;
    gap: 5px;
    text-align: center;
}

.gantt-segment.idle {
    color: #0f172a;
}

.gantt-segment span {
    font-size: 12px;
    font-weight: 700;
}

.summary-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.summary-strip span,
.metric {
    background: var(--panel-strong);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    font-weight: 800;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.metric {
    display: grid;
    gap: 5px;
}

.metric span {
    color: var(--muted);
    font-size: 12px;
}

.metric strong {
    font-size: 18px;
}

.memory-map {
    display: flex;
    align-items: end;
    gap: 12px;
    min-height: 210px;
    padding: 12px;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    background: var(--panel-strong);
    overflow-x: auto;
}

.memory-block {
    position: relative;
    width: 96px;
    border: 2px solid #cbd5e1;
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    display: grid;
    place-items: center;
    text-align: center;
    flex: 0 0 96px;
}

.memory-block.selected {
    border-color: var(--teal);
}

.memory-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(15, 118, 110, 0.24);
}

.memory-block strong,
.memory-block span {
    position: relative;
    z-index: 1;
}

.memory-block span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

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

    .sidebar {
        position: sticky;
        height: auto;
        z-index: 20;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        top: 0;
    }

    .brand-mark {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

    .brand h1 {
        font-size: 18px;
    }

    .brand p,
    .status-card {
        display: none;
    }

    .menu-toggle {
        display: block;
    }

    .tabs {
        display: none;
        position: absolute;
        top: calc(100% + 1px);
        left: 0;
        right: 0;
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 12px 16px 16px;
        background: #ffffff;
        border-bottom: 1px solid var(--line);
        box-shadow: 0 18px 36px rgba(15, 23, 42, 0.12);
    }

    .sidebar.menu-open .tabs {
        display: grid;
    }

    .tab {
        text-align: left;
        background: var(--panel-strong);
    }

    .dashboard-grid.two {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .content,
    .sidebar {
        padding: 16px;
    }

    .content {
        width: 100%;
        overflow-x: hidden;
    }

    .hero {
        padding: 18px;
    }

    .hero h2 {
        font-size: 28px;
    }

    .section-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .metric-grid {
        grid-template-columns: 1fr;
    }

    th,
    td {
        padding: 8px;
    }
}
