:root {
    --bg: #eef1f6;
    --surface: #ffffff;
    --surface-soft: #f7f8fb;
    --line: #e5e8ef;
    --text: #161b2c;
    --muted: #777f91;
    --blue: #4657f0;
    --blue-soft: #eef0ff;
    --green: #21c784;
    --red: #ef5b63;
    --yellow: #f2b705;
    --teal: #16a7a0;
    --shadow: 0 18px 45px rgba(31, 42, 68, .08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, Segoe UI, Roboto, Arial, sans-serif;
}

button, input { font: inherit; }

.dashboard-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr);
}

.side-rail {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 24px 0;
    background: var(--surface);
    border-right: 1px solid var(--line);
}

.rail-logo {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--blue-soft);
}

.rail-logo img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 8px;
}

.rail-btn {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: #9aa1af;
    cursor: pointer;
    transition: .18s ease;
}

.rail-btn:hover,
.rail-btn.active {
    color: var(--blue);
    background: var(--blue-soft);
}

.rail-btn i { font-size: 20px; }

.workspace {
    width: min(1480px, calc(100vw - 132px));
    margin: 0 auto;
    padding: 26px 0 34px;
}

.topbar,
.top-actions,
.hero-card,
.panel-heading,
.activity-row,
.check-item,
.module-item {
    display: flex;
    align-items: center;
}

.topbar {
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 22px;
}

.title-block h1 {
    margin: 10px 0 6px;
    font-size: 34px;
    line-height: 1.05;
    letter-spacing: 0;
}

.title-block p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.app-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--blue);
    font-weight: 800;
    font-size: 13px;
}

.top-actions { gap: 12px; }

.sync-pill,
.clock,
.icon-button {
    border: 1px solid var(--line);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.sync-pill {
    min-width: 140px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 999px;
    color: var(--muted);
    font-weight: 900;
}

.sync-pill span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--yellow);
}

.sync-pill.ok span { background: var(--green); }
.sync-pill.bad span { background: var(--red); }

.clock {
    min-width: 126px;
    height: 58px;
    border-radius: 16px;
    padding: 8px 13px;
}

.clock strong,
.clock small { display: block; }
.clock strong { font-size: 21px; }
.clock small { color: var(--muted); }

.icon-button {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    color: var(--text);
    cursor: pointer;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.35fr repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

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

.hero-card {
    justify-content: space-between;
    min-height: 132px;
    padding: 20px;
}

.hero-card span,
.hero-card small,
.panel-heading p,
.progress-row span,
.module-item small,
.activity-row small,
.check-item small {
    color: var(--muted);
}

.hero-card strong {
    display: block;
    margin: 10px 0 5px;
    font-size: 32px;
    line-height: 1;
    letter-spacing: 0;
}

.hero-card i {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    color: var(--blue);
    background: var(--blue-soft);
    font-size: 22px;
}

.hero-sales {
    background: linear-gradient(135deg, #ffffff 0%, #f7fbff 52%, #eef0ff 100%);
}

.content-grid {
    display: grid;
    grid-template-columns: 1.2fr .8fr;
    gap: 16px;
}

.panel {
    min-height: 320px;
    padding: 18px;
}

.panel-wide,
.panel-chart { min-height: 372px; }

.panel-heading {
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.panel-heading p {
    margin: 0 0 5px;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0;
}

.panel-heading h2 {
    margin: 0;
    font-size: 20px;
    letter-spacing: 0;
}

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

.chart-wrap {
    position: relative;
    height: 292px;
}

.chart-wrap.compact { height: 210px; }

.tab-strip {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}

.tab-strip button {
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--muted);
    font-weight: 800;
}

.tab-strip button.active {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
}

.activity-list,
.progress-list,
.module-list,
.check-list {
    display: grid;
    gap: 12px;
}

.activity-row {
    gap: 12px;
    padding: 10px;
    border-radius: 8px;
    background: var(--surface-soft);
}

.activity-icon,
.module-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 14px;
    background: var(--blue-soft);
    color: var(--blue);
}

.activity-row strong,
.module-item strong,
.check-item strong { display: block; }

.activity-row b {
    margin-left: auto;
    color: var(--green);
    white-space: nowrap;
}

.micro-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 12px;
}

.micro-card {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.micro-card strong {
    display: block;
    font-size: 22px;
}

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

.progress-row {
    display: grid;
    gap: 8px;
}

.progress-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-weight: 800;
}

.progress-track {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: #e7eaf1;
}

.progress-track b {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--blue);
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.kpi-card {
    min-height: 116px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.kpi-card i {
    color: var(--blue);
    font-size: 22px;
}

.kpi-card strong {
    display: block;
    margin-top: 14px;
    font-size: 27px;
}

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

.table-wrap {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
}

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

th,
td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

th {
    color: var(--muted);
    background: var(--surface-soft);
    font-size: 12px;
    text-transform: uppercase;
}

tbody tr:last-child td { border-bottom: 0; }

.status-badge {
    display: inline-flex;
    align-items: center;
    height: 26px;
    padding: 0 9px;
    border-radius: 999px;
    background: #eef8f3;
    color: #0c9f63;
    font-size: 12px;
    font-weight: 900;
}

.module-item,
.check-item {
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.module-item b,
.check-item b {
    margin-left: auto;
    color: var(--text);
}

.check-item i {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background: #eef8f3;
    color: var(--green);
    font-size: 18px;
}

.check-item.bad i {
    color: var(--red);
    background: #fff0f1;
}

.login-overlay {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(238, 241, 246, .86);
    backdrop-filter: blur(12px);
}

.login-overlay.hidden { display: none; }
[hidden] { display: none !important; }

.login-card {
    width: min(420px, 100%);
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 24px 90px rgba(31, 42, 68, .18);
}

.login-card img {
    width: 62px;
    height: 62px;
    object-fit: contain;
    border-radius: 12px;
}

.eyebrow {
    margin: 16px 0 4px;
    color: var(--blue);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.login-card h2 {
    margin: 0 0 20px;
    font-size: 28px;
    letter-spacing: 0;
}

.login-card label {
    display: grid;
    gap: 7px;
    margin-bottom: 14px;
    color: #243047;
    font-weight: 800;
}

.login-card input {
    height: 48px;
    border: 1px solid #ccd3df;
    border-radius: 8px;
    padding: 0 12px;
}

.login-card button {
    width: 100%;
    height: 50px;
    border: 0;
    border-radius: 8px;
    background: var(--blue);
    color: #fff;
    font-weight: 900;
    cursor: pointer;
}

.login-card .secondary-button {
    margin-top: 10px;
    border: 1px solid var(--line);
    background: var(--surface-soft);
    color: var(--text);
}

.login-error {
    min-height: 22px;
    margin: 14px 0 0;
    color: var(--red);
    font-weight: 800;
}

@media (max-width: 1180px) {
    .hero-grid,
    .content-grid { grid-template-columns: 1fr 1fr; }
    .hero-sales,
    .panel-wide,
    .panel-chart { grid-column: 1 / -1; }
    .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .dashboard-shell { grid-template-columns: 1fr; }
    .side-rail {
        position: static;
        height: auto;
        flex-direction: row;
        justify-content: center;
        overflow-x: auto;
        padding: 12px;
    }
    .workspace {
        width: min(100vw - 24px, 1480px);
        padding-top: 14px;
    }
    .topbar,
    .top-actions {
        align-items: flex-start;
        flex-direction: column;
    }
    .hero-grid,
    .content-grid,
    .kpi-grid,
    .micro-grid { grid-template-columns: 1fr; }
    th:nth-child(2),
    td:nth-child(2) { display: none; }
}
