/*
 * Panel Ezzat
 *
 * A control surface for machines, not a marketing page. Two typographic voices:
 * a system sans for chrome a human reads, and a mono for every value the server
 * produced. If a string came out of nginx, MySQL or /proc, it is set in mono so
 * it can be scanned, compared and trusted at a glance.
 *
 * Surfaces are warm paper; text and the single accent are cool ink. That warm
 * against cool is what keeps this from reading as another blue SaaS dashboard,
 * and it sits comfortably in a tab beside the WordPress sites it manages.
 */

/* ---------------------------------------------------------------- tokens */

:root {
    /* Warm paper. Never pure white: pure white glares beside a content site. */
    --paper: oklch(98.6% 0.004 85);
    --surface: oklch(99.4% 0.003 85);
    --rail: oklch(96.4% 0.006 85);
    --sunken: oklch(95.2% 0.007 85);

    --line: oklch(90.5% 0.006 85);
    --line-strong: oklch(82% 0.008 85);

    /* Cool ink against the warm ground. */
    --ink: oklch(25% 0.016 275);
    --ink-2: oklch(46% 0.013 275);
    --ink-3: oklch(62% 0.011 275);

    /* One accent, for primary action and current selection only. */
    --accent: oklch(43% 0.132 272);
    --accent-hover: oklch(37% 0.142 272);
    --accent-soft: oklch(95.5% 0.028 272);
    --accent-line: oklch(84% 0.06 272);

    /* Semantic state. Deliberately far from the accent hue. */
    --ok: oklch(52% 0.126 155);
    --ok-soft: oklch(96% 0.035 155);
    --ok-line: oklch(85% 0.07 155);

    --warn: oklch(56% 0.128 75);
    --warn-soft: oklch(96.5% 0.045 75);
    --warn-line: oklch(86% 0.085 75);

    --bad: oklch(51% 0.178 27);
    --bad-soft: oklch(96% 0.033 27);
    --bad-line: oklch(87% 0.065 27);

    --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, sans-serif;
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

    --r-sm: 4px;
    --r-md: 6px;

    --shadow-sm: 0 1px 2px oklch(25% 0.016 275 / 0.06);
    --shadow-md: 0 2px 8px oklch(25% 0.016 275 / 0.08);

    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --fast: 140ms;
    --base: 200ms;
}

/* ------------------------------------------------------------------ base */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--sans);
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
    text-underline-offset: 2px;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 2px;
}

::selection {
    background: var(--accent-soft);
}

/* Machine-produced values: paths, domains, identifiers, counts, codes. */
.mono,
code {
    font-family: var(--mono);
    font-size: 0.925em;
    font-variant-ligatures: none;
}

.num {
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- layout */

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

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

/* Sidebar --------------------------------------------------------------- */

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

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

.brand-mark {
    width: 24px;
    height: 24px;
    border-radius: var(--r-sm);
    background: var(--accent);
    color: var(--paper);
    display: grid;
    place-items: center;
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.brand-name {
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.nav {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1;
}

.nav-label {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--ink-3);
    padding: 12px 8px 5px;
}

.nav a {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 8px;
    border-radius: var(--r-sm);
    color: var(--ink-2);
    font-size: 13px;
    font-weight: 500;
    transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}

.nav a svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    opacity: 0.75;
}

.nav a:hover {
    background: oklch(93% 0.008 85);
    color: var(--ink);
    text-decoration: none;
}

.nav a.active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}

.nav a.active svg {
    opacity: 1;
}

.sidebar-foot {
    padding: 12px;
    border-top: 1px solid var(--line);
}

/* Main ------------------------------------------------------------------ */

.main {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
    flex-wrap: wrap;
}

.topbar h1 {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.015em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar .sub {
    font-size: 12px;
    color: var(--ink-3);
    margin-top: 1px;
}

.actions {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

.content {
    padding: 20px 24px 48px;
    flex: 1;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.grid2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 20px;
    align-items: start;
}

/* -------------------------------------------------------------- sections */

.section {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 16px;
    border-bottom: 1px solid var(--line);
}

.section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--ink-2);
}

.section-body {
    padding: 16px;
}

.section-body.flush {
    padding: 0;
}

/* --------------------------------------------------------------- readouts */

/*
 * Instrument readouts, not hero metrics. The label leads, the value is set in
 * mono at a size you can scan down a row, and the bar underneath gives the
 * proportion without needing a second glance at the numbers.
 */

.readouts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface);
    overflow: hidden;
}

.readout {
    padding: 13px 16px 14px;
    border-right: 1px solid var(--line);
}

.readout:last-child {
    border-right: none;
}

.readout-label {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--ink-3);
}

.readout-value {
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    font-size: 21px;
    font-weight: 500;
    letter-spacing: -0.02em;
    margin-top: 5px;
    line-height: 1.15;
}

.readout-value .unit {
    font-size: 12px;
    color: var(--ink-3);
    margin-left: 2px;
}

.readout-sub {
    font-size: 11.5px;
    color: var(--ink-3);
    margin-top: 3px;
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
}

.meter {
    height: 3px;
    background: var(--sunken);
    border-radius: 2px;
    margin-top: 10px;
    overflow: hidden;
}

.meter > span {
    display: block;
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width var(--base) var(--ease);
}

.meter.is-warn > span {
    background: var(--warn);
}

.meter.is-bad > span {
    background: var(--bad);
}

/* ------------------------------------------------------------------ chart */

/*
 * Chart.js with maintainAspectRatio:false sizes itself to its parent, so the
 * height belongs on this wrapper. Putting it on the canvas instead makes each
 * resize feed back into the next and the chart grows down the page forever.
 */
.chart-frame {
    position: relative;
    height: 200px;
}

.chart-frame canvas {
    display: block;
}

/* ------------------------------------------------------------------ table */

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

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

th {
    text-align: left;
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--ink-3);
    padding: 9px 16px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
    background: var(--surface);
}

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

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

tbody tr {
    transition: background var(--fast) var(--ease);
}

tbody tr:hover {
    background: oklch(97.6% 0.005 85);
}

td.right,
th.right {
    text-align: right;
}

td.shrink {
    width: 1%;
    white-space: nowrap;
}

/* Definition rows on the detail page. */
.facts {
    width: 100%;
}

.facts th {
    background: none;
    text-transform: none;
    letter-spacing: 0;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--ink-3);
    width: 132px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--line);
}

.facts td {
    padding: 8px 16px;
    font-size: 12.5px;
}

.facts tr:last-child th,
.facts tr:last-child td {
    border-bottom: none;
}

/* Numbered step list reuses the fact rows, but the number needs no gutter. */
.facts.steps th {
    width: 38px;
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    color: var(--ink-3);
}

/* ----------------------------------------------------------------- status */

.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 500;
    white-space: nowrap;
}

.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ink-3);
    flex-shrink: 0;
}

.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); }

.dot.pulse {
    animation: pulse 1.6s var(--ease) infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

@media (prefers-reduced-motion: reduce) {
    .dot.pulse { animation: none; }
    * { transition-duration: 1ms !important; }
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 7px;
    border-radius: var(--r-sm);
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 500;
    border: 1px solid var(--line);
    background: var(--sunken);
    color: var(--ink-2);
    white-space: nowrap;
}

.badge.ok { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok); }
.badge.warn { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); }
.badge.bad { background: var(--bad-soft); border-color: var(--bad-line); color: var(--bad); }
.badge.accent { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }

/* ---------------------------------------------------------------- buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--r-sm);
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.5;
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease),
        color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}

.btn svg {
    width: 14px;
    height: 14px;
}

.btn:hover {
    background: var(--rail);
    border-color: var(--ink-3);
    text-decoration: none;
}

.btn:active {
    background: var(--sunken);
    transform: translateY(0.5px);
}

.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: oklch(99% 0.005 85);
    box-shadow: var(--shadow-sm);
}

.btn.primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.btn.danger {
    color: var(--bad);
    border-color: var(--bad-line);
    background: var(--surface);
}

.btn.danger:hover {
    background: var(--bad-soft);
    border-color: var(--bad);
}

.btn.sm {
    padding: 3.5px 9px;
    font-size: 12px;
}

.btn.block {
    width: 100%;
}

/* ------------------------------------------------------------------ forms */

.field {
    margin-bottom: 15px;
}

label {
    display: block;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--ink);
    margin-bottom: 5px;
}

input[type="text"],
input[type="email"],
input[type="password"] {
    width: 100%;
    padding: 8px 11px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 13.5px;
    transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}

input.mono-input {
    font-family: var(--mono);
    font-size: 13px;
}

input::placeholder {
    color: var(--ink-3);
}

input:hover {
    border-color: var(--ink-3);
}

input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

input[aria-invalid="true"] {
    border-color: var(--bad);
}

input[aria-invalid="true"]:focus {
    box-shadow: 0 0 0 3px var(--bad-soft);
}

.hint {
    font-size: 11.5px;
    color: var(--ink-3);
    margin-top: 5px;
}

.field-error {
    font-size: 11.5px;
    color: var(--bad);
    margin-top: 5px;
}

/* ----------------------------------------------------------------- alerts */

.alert {
    display: flex;
    gap: 9px;
    padding: 10px 13px;
    border-radius: var(--r-md);
    border: 1px solid var(--line);
    background: var(--surface);
    font-size: 12.5px;
    margin-bottom: 16px;
}

.alert svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    margin-top: 1px;
}

.alert.success { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok); }
.alert.error { background: var(--bad-soft); border-color: var(--bad-line); color: var(--bad); }

.alert .when {
    color: inherit;
    opacity: 0.7;
    font-family: var(--mono);
    font-size: 11px;
}

/* ------------------------------------------------------------------ empty */

/*
 * Empty states teach the next action rather than announcing emptiness.
 */
.empty {
    padding: 44px 24px;
    text-align: center;
}

.empty-mark {
    width: 34px;
    height: 34px;
    margin: 0 auto 12px;
    border-radius: var(--r-md);
    border: 1px solid var(--line);
    background: var(--rail);
    display: grid;
    place-items: center;
    color: var(--ink-3);
}

.empty-mark svg {
    width: 17px;
    height: 17px;
}

.empty h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.empty p {
    font-size: 12.5px;
    color: var(--ink-3);
    max-width: 42ch;
    margin: 0 auto 16px;
}

/* -------------------------------------------------------------------- log */

.log {
    font-family: var(--mono);
    font-size: 11.5px;
    line-height: 1.65;
    color: oklch(84% 0.012 275);
    background: oklch(23% 0.018 275);
    padding: 13px 15px;
    border-radius: var(--r-md);
    max-height: 300px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    tab-size: 4;
}

.log:empty::after {
    content: "(kosong)";
    color: oklch(55% 0.012 275);
}

/* ------------------------------------------------------------------ misc */

.muted {
    color: var(--ink-3);
}

.progress-note {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 12.5px;
    color: var(--ink-2);
}

.auth {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: var(--paper);
}

.auth-card {
    width: 100%;
    max-width: 348px;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 9px;
    justify-content: center;
    margin-bottom: 18px;
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 900px) {
    .layout {
        grid-template-columns: 60px minmax(0, 1fr);
    }

    .brand {
        justify-content: center;
        padding: 18px 8px 16px;
    }

    .brand-name,
    .nav-label {
        display: none;
    }

    .nav a {
        justify-content: center;
        padding: 9px;
    }

    .nav a span {
        display: none;
    }

    .sidebar-foot .btn span {
        display: none;
    }
}

@media (max-width: 620px) {
    .content,
    .topbar {
        padding-left: 14px;
        padding-right: 14px;
    }

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

    .readout {
        border-bottom: 1px solid var(--line);
    }
}
