/* ============================================================
   lab.admin — design system
   ============================================================ */

/* --- Google Fonts (Caveat + JetBrains Mono) --- */
/* Geist is bundled locally via @font-face below  */

@font-face {
    font-family: 'Geist';
    src: url('/fonts/Geist-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Geist';
    src: url('/fonts/Geist-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Geist';
    src: url('/fonts/Geist-SemiBold.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

/* --- Color tokens --- */
:root,
[data-theme="light"] {
    --paper:    #faf7ee;
    --paper-2:  #f1ede0;
    --paper-3:  #e8e3d2;
    --ink:      #1a1a17;
    --ink-soft: #6e6c63;
    --ink-fade: #a8a59a;
    --line:     rgba(26, 26, 23, .55);
    --line-soft: rgba(26, 26, 23, .22);
    --accent:   #2f7466;
    --accent-soft: rgba(47, 116, 102, .10);
    --ok:       #4a7c59;
    --warn:     #8b4c3b;
    --ok-soft:  rgba(74, 124, 89, .12);
    --warn-soft: rgba(139, 76, 59, .12);
}

[data-theme="dark"] {
    --paper:    #161714;
    --paper-2:  #1f201c;
    --paper-3:  #2a2b26;
    --ink:      #ece8d9;
    --ink-soft: #918d7f;
    --ink-fade: #5b574c;
    --line:     rgba(236, 232, 217, .55);
    --line-soft: rgba(236, 232, 217, .22);
    --accent:   #6ab9a8;
    --accent-soft: rgba(106, 185, 168, .12);
    --ok:       #7ab58a;
    --warn:     #c47a5a;
    --ok-soft:  rgba(122, 181, 138, .12);
    --warn-soft: rgba(196, 122, 90, .12);
}

/* --- Font stack --- */
:root {
    --font-hand: 'Caveat', cursive;
    --font-sans: 'Geist', 'Inter', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* --- Paper grid background --- */
html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    background-color: var(--paper);
    background-image:
        linear-gradient(var(--line-soft) 1px, transparent 1px),
        linear-gradient(90deg, var(--line-soft) 1px, transparent 1px),
        linear-gradient(rgba(26, 26, 23, .08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(26, 26, 23, .08) 1px, transparent 1px);
    background-size: 24px 24px, 24px 24px, 120px 120px, 120px 120px;
    font-family: var(--font-sans);
    font-size: 13px;
    color: var(--ink);
    transition: background-color .2s ease, color .2s ease;
}

[data-theme="dark"] body {
    background-image:
        linear-gradient(var(--line-soft) 1px, transparent 1px),
        linear-gradient(90deg, var(--line-soft) 1px, transparent 1px),
        linear-gradient(rgba(236, 232, 217, .06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(236, 232, 217, .06) 1px, transparent 1px);
    background-size: 24px 24px, 24px 24px, 120px 120px, 120px 120px;
}

/* --- Typography --- */
.t-hand {
    font-family: var(--font-hand);
    font-weight: 600;
    line-height: 1.1;
}

.t-h1 {
    font-family: var(--font-hand);
    font-size: 36px;
    font-weight: 600;
    line-height: 1.1;
    color: var(--ink);
}

.t-mono {
    font-family: var(--font-mono);
    font-size: 12px;
}

.t-cap {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

.t-body {
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 400;
    color: var(--ink);
}

.t-small {
    font-family: var(--font-sans);
    font-size: 11px;
    color: var(--ink-soft);
}

.t-faint  { color: var(--ink-fade); }
.t-fade   { color: var(--ink-soft); }
.t-accent { color: var(--accent); }

/* --- Layout utilities --- */
.col  { display: flex; flex-direction: column; }
.row  { display: flex; flex-direction: row; align-items: center; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; min-width: 0; }

.gap-4  { gap: 4px; }
.gap-6  { gap: 6px; }
.gap-8  { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.gap-24 { gap: 24px; }

/* --- Cards --- */
.card {
    background: var(--paper-2);
    border: 1.5px solid var(--line);
    position: relative;
}

.card-sm  { border-radius: 6px 9px 7px 10px; padding: 12px 14px; }
.card-md  { border-radius: 14px 10px 16px 11px; padding: 18px 20px; }
.card-lg  { border-radius: 22px 18px 24px 20px; padding: 24px 28px; }

.card-flat {
    background: var(--paper-3);
    border: 1.5px solid var(--line-soft);
    border-radius: 6px;
    padding: 12px 14px;
}

.card-dashed {
    background: transparent;
    border: 1.5px dashed var(--line-soft);
    border-radius: 8px;
    padding: 14px;
}

.card-accent {
    border-color: var(--accent);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    padding: 0 14px;
    border-radius: 5px;
    border: 1.5px solid var(--line);
    background: var(--paper-2);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, border-color .15s;
    white-space: nowrap;
    text-decoration: none;
}
.btn:hover { background: var(--paper-3); }

.btn-primary {
    background: var(--ink);
    color: var(--paper);
    border-color: var(--ink);
}
.btn-primary:hover { opacity: .88; }

.btn-accent {
    background: var(--accent);
    color: var(--paper);
    border-color: var(--accent);
}
.btn-accent:hover { opacity: .88; }

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--ink-soft);
}
.btn-ghost:hover { background: var(--paper-2); color: var(--ink); }

/* --- Inputs --- */
.input-field {
    display: flex;
    align-items: center;
    height: 36px;
    padding: 0 10px;
    background: var(--paper-2);
    border: 1.5px solid var(--line-soft);
    border-radius: 5px;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--ink);
    transition: border-color .15s;
}
.input-field:focus-within { border-color: var(--accent); }

.input-field input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--ink);
    min-width: 0;
}
.input-field input::placeholder { color: var(--ink-fade); }

.input-icon {
    color: var(--ink-soft);
    font-size: 13px;
    flex-shrink: 0;
}

/* --- Terminal-style input (login) --- */
.term-input-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.term-prompt {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--ink-soft);
}
.term-input-row {
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1.5px solid var(--line);
    padding-bottom: 4px;
}
.term-prefix { color: var(--accent); font-family: var(--font-mono); font-size: 14px; }
.term-input-row input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--ink);
}
.term-input-row input::placeholder { color: var(--ink-fade); }

/* --- Pills --- */
.pill {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    border: 1px solid var(--line-soft);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-soft);
    white-space: nowrap;
}
.pill-ok   { border-color: var(--ok);   color: var(--ok);   background: var(--ok-soft); }
.pill-warn { border-color: var(--warn); color: var(--warn); background: var(--warn-soft); }
.pill-on   { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* --- Tables --- */
.tbl {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: 11px;
}
.tbl th {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-fade);
    text-align: left;
    padding: 4px 6px;
    border-bottom: 1.5px solid var(--line-soft);
}
.tbl td {
    padding: 5px 6px;
    color: var(--ink-soft);
    border-bottom: 1px dashed var(--line-soft);
}
.tbl tr:last-child td { border-bottom: none; }
.tbl td:first-child { color: var(--ink); }

/* --- Section header --- */
.section-head {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 14px;
}
.section-num {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-fade);
}
.section-title {
    font-family: var(--font-hand);
    font-size: 26px;
    font-weight: 600;
    color: var(--ink);
    line-height: 1;
}
.section-sub {
    font-size: 11px;
    color: var(--ink-soft);
    margin-left: 2px;
}

/* --- Container boxes (rack nodes) --- */
.container-box {
    background: var(--paper-2);
    border: 1.5px solid var(--line);
    border-radius: 6px;
    padding: 10px 12px;
    position: relative;
    display: flex;
    flex-direction: column;
}
.container-box.accent-border { border-color: var(--accent); }

.cbox-vol {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.05em;
    color: var(--ink-fade);
    margin-top: 5px;
}

.cbox-links {
    display: flex;
    gap: 8px;
    margin-top: auto;
    padding-top: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.cbox-link {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.05em;
    color: var(--accent);
    text-decoration: none;
}
.cbox-link:hover { text-decoration: underline; }

.port-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}
.port-dot.ok   { background: var(--ok); }
.port-dot.warn { background: var(--warn); }
.port-dot.left { left: -6px; }
.port-dot.right { right: -6px; }

/* --- Annotation --- */
.annotation {
    display: flex;
    align-items: center;
    gap: 6px;
    position: absolute;
    pointer-events: none;
    white-space: nowrap;
}
.annotation-text {
    font-family: var(--font-hand);
    font-size: 16px;
    color: var(--accent);
    line-height: 1;
}
.annotation-arrow {
    display: flex;
    align-items: center;
    color: var(--accent);
}
.annotation-arrow::before {
    content: '';
    display: block;
    width: 28px;
    height: 1px;
    background: var(--accent);
}
.annotation-arrow::after {
    content: '›';
    font-size: 14px;
    line-height: 1;
    margin-left: -2px;
}

/* --- Corner marks --- */
.corner-marks {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1000;
}
.corner-mark {
    position: absolute;
    width: 10px;
    height: 10px;
    opacity: 0.25;
    color: var(--ink-soft);
}
.corner-mark::before,
.corner-mark::after {
    content: '';
    position: absolute;
    background: currentColor;
}
.corner-mark::before { width: 1px; height: 100%; left: 50%; transform: translateX(-50%); }
.corner-mark::after  { height: 1px; width: 100%;  top: 50%;  transform: translateY(-50%); }
.corner-mark.tl { top: 12px; left: 12px; }
.corner-mark.tr { top: 12px; right: 12px; }
.corner-mark.bl { bottom: 12px; left: 12px; }
.corner-mark.br { bottom: 12px; right: 12px; }

/* --- Fig caption strip --- */
.fig-caption {
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-fade);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 20px;
    border-top: 1px dashed var(--line-soft);
    margin-top: auto;
}
.fig-caption-rule { flex: 1; height: 1px; border-top: 1px dashed var(--line-soft); }

/* --- WIP section --- */
.wip-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    text-align: center;
    gap: 16px;
    position: relative;
}
.wip-card {
    border: 1.5px dashed var(--line-soft);
    border-radius: 12px;
    padding: 40px 60px;
    background: transparent;
    position: relative;
}

/* --- Uptime strip --- */
.uptime-strip {
    display: flex;
    gap: 3px;
    flex-wrap: wrap;
}
.uptime-day {
    flex: 1 1 14px;
    height: 24px;
    border-radius: 2px;
    min-width: 8px;
}

/* --- Storage bar --- */
.storage-bar {
    display: flex;
    height: 16px;
    border-radius: 3px;
    overflow: hidden;
    border: 1.5px solid var(--line);
}

/* --- Scrollbars --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-soft); border-radius: 3px; }

/* --- Blazor error boundary --- */
.blazor-error-boundary {
    background: var(--warn-soft);
    border: 1px solid var(--warn);
    border-radius: 6px;
    padding: 12px 16px;
    color: var(--warn);
    font-family: var(--font-mono);
    font-size: 11px;
}
.blazor-error-boundary::after {
    content: "An error has occurred.";
}

/* --- Shell layout --- */
.shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
}
.shell-main {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}
.shell-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}
#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--warn-soft);
    border-top: 1.5px solid var(--warn);
    color: var(--warn);
    font-family: var(--font-mono);
    font-size: 11px;
    padding: 8px 16px;
    align-items: center;
    gap: 10px;
    z-index: 9999;
}
#blazor-error-ui .reload { color: var(--warn); text-decoration: underline; cursor: pointer; }
#blazor-error-ui .dismiss { margin-left: auto; cursor: pointer; opacity: .6; }

/* --- Nav sidebar --- */
.nav-sidebar {
    width: 200px;
    min-width: 200px;
    height: 100vh;
    background: var(--paper-2);
    border-right: 1.5px dashed var(--line-soft);
    padding: 20px 14px;
    overflow-y: auto;
    gap: 6px;
}
.nav-logo { padding: 4px 8px 18px; align-items: center; }
.nav-logo-icon {
    width: 24px;
    height: 24px;
    border: 1.5px solid var(--ink);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}
.nav-items { flex: 1; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 32px;
    padding: 0 8px;
    border-radius: 5px;
    border: 1.5px solid transparent;
    color: var(--ink-soft);
    font-family: var(--font-sans);
    font-size: 13px;
    text-decoration: none;
    cursor: pointer;
    transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--paper-3); color: var(--ink); }
.nav-item.active {
    background: var(--paper-3);
    border-color: var(--line-soft);
    color: var(--ink);
    font-weight: 600;
}
.nav-item-icon { width: 14px; font-size: 12px; color: var(--ink-fade); flex-shrink: 0; }
.nav-item.active .nav-item-icon { color: var(--accent); }
.nav-operator { margin-top: auto; padding-top: 16px; border-top: 1px dashed var(--line-soft); }
.nav-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1.5px solid var(--line);
    background: var(--paper-3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-soft);
    flex-shrink: 0;
}

/* --- Top bar --- */
.topbar {
    height: 44px;
    min-height: 44px;
    padding: 0 20px;
    background: var(--paper);
    border-bottom: 1.5px solid var(--line-soft);
    gap: 12px;
    flex-shrink: 0;
}
.topbar-breadcrumb { font-size: 10px; color: var(--ink-fade); letter-spacing: 0.12em; }

/* --- Checkbox --- */
input[type="checkbox"] {
    accent-color: var(--accent);
    width: 14px;
    height: 14px;
    cursor: pointer;
}

/* --- Focus ring --- */
*:focus-visible {
    outline: 1.5px solid var(--accent);
    outline-offset: 2px;
}

/* --- Selection --- */
::selection { background: var(--accent-soft); color: var(--ink); }
