/*
 * devtools.css — unified design system
 * Cool white · DM Sans + DM Mono · Electric blue #2563EB
 * ─────────────────────────────────────────────────────────────────────────
 *
 * FONT IMPORT (add once in your root layout or index.html):
 *
 *   <link rel="preconnect" href="https://fonts.googleapis.com">
 *   <link href="https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,300&family=DM+Mono:wght@300;400;500&display=swap" rel="stylesheet">
 *
 * ─────────────────────────────────────────────────────────────────────────
 */

/* ── Reset ────────────────────────────────────────────────────────────── */

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

html {
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility
}

body {
    background: var(--bg);
    color: var(--ink)
}


/* ── Design tokens ────────────────────────────────────────────────────── */

:root {
    /* Backgrounds — cool white scale */
    --bg: #f4f5f7;
    /* page base */
    --bg-raised: #ffffff;
    /* panels, cards, inputs */
    --bg-sunken: #eceef2;
    /* code areas, canvas backgrounds */
    --bg-overlay: #eef0f4;
    /* hover surfaces */

    /* Borders */
    --rule: #e1e4ea;
    /* main dividers */
    --rule-soft: #eaecf0;
    /* subtle */
    --rule-hard: #c8cdd8;
    /* emphasized, input borders */

    /* Ink — five steps */
    --ink: #0d1117;
    --ink-2: #374151;
    --ink-3: #6b7280;
    --ink-4: #9ca3af;
    --ink-5: #d1d5db;

    /* Accent */
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-dim: #dbeafe;
    --accent-muted: #93c5fd;
    --accent-text: #1e40af;

    /* Semantic */
    --pass: #16a34a;
    --pass-bg: #dcfce7;
    --fail: #dc2626;
    --fail-bg: #fee2e2;
    --warn: #d97706;
    --warn-bg: #fef3c7;
    --info: #2563eb;
    --info-bg: #dbeafe;

    /* Typography */
    --font-ui: 'DM Sans', system-ui, sans-serif;
    --font-mono: 'DM Mono', 'Fira Code', monospace;

    /* Spacing */
    --sp-1: 0.25rem;
    --sp-2: 0.5rem;
    --sp-3: 0.75rem;
    --sp-4: 1rem;
    --sp-5: 1.25rem;
    --sp-6: 1.5rem;
    --sp-8: 2rem;
    --sp-10: 2.5rem;

    /* Radii */
    --r-sm: 3px;
    --r-md: 6px;
    --r-lg: 10px;
    --r-xl: 14px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);

    /* Transitions */
    --t-fast: 80ms ease;
    --t-base: 150ms ease;
}


/* ── Page scaffold ────────────────────────────────────────────────── */

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
    padding: var(--sp-5) var(--sp-6) var(--sp-6);
    background: var(--bg);
    font-family: var(--font-ui);
}

/* ── Shell ────────────────────────────────────────────────────────────── */

.shell {
    font-family: var(--font-ui);
    background: var(--bg);
    color: var(--ink);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}


/* ── Toolbar ──────────────────────────────────────────────────────────── */

.dt-toolbar {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: 0 var(--sp-4);
    height: 42px;
    border-bottom: 1px solid var(--rule);
    background: var(--bg-raised);
    flex-shrink: 0;
}


/* ── Main + layout primitives ─────────────────────────────────────────── */

.dt-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
}

/* Two-pane side-by-side */
.dt-split {
    display: grid;
    flex: 1;
    grid-template-columns: 1fr 1fr;
    overflow: hidden;
}

@media (max-width: 700px) {
    .dt-split {
        grid-template-columns: 1fr
    }
}

/* Vertical stack */
.dt-stack {
    display: flex;
    flex-direction: column;
    flex: 1
}

/* Pane */
.dt-pane {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--rule);
    overflow: hidden;
    background: var(--bg-raised);
}

.dt-pane:last-child {
    border-right: none
}

.dt-pane-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    padding: 0 var(--sp-4);
    height: 36px;
    border-bottom: 1px solid var(--rule);
    background: var(--bg);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-3);
    flex-shrink: 0;
}

.dt-pane-body {
    flex: 1;
    overflow: auto;
    /* padding: var(--sp-4) */
}

.dt-pane-body.no-pad {
    padding: 0
}

/* Named section */
.dt-section {
    border-bottom: 1px solid var(--rule);
    padding: var(--sp-6);
    background: var(--bg-raised);
}

.dt-section:last-child {
    border-bottom: none
}

.dt-section-label {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin-bottom: var(--sp-4);
}


/* ── Card shell ───────────────────────────────────────────────────── */

.page-card {
    background: var(--bg-raised);
    border: 1px solid var(--rule);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    /*flex: 1;*/
    min-height: 0;
}

.card-header {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-5);
    border-bottom: 1px solid var(--rule);
    background: var(--bg);
    flex-wrap: wrap;
    min-height: 42px;
    flex-shrink: 0;
}

.card-header-left {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    flex: 1;
    min-width: 0;
}

.card-header-right {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    flex-wrap: wrap;
}

.card-title {
    display: flex;
    align-items: baseline;
    gap: 2px;
}

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

.card-body {
    padding: var(--sp-4) var(--sp-5);
}

/* ── Tabs ─────────────────────────────────────────────────────────────── */

.dt-tabs {
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid var(--rule);
    background: var(--bg);
    flex-shrink: 0;
}

.dt-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--ink-3);
    font-family: var(--font-ui);
    font-size: 0.78rem;
    font-weight: 500;
    padding: 0 var(--sp-5);
    height: 40px;
    cursor: pointer;
    transition: all var(--t-base);
    letter-spacing: 0.01em;
    margin-bottom: -1px;
    white-space: nowrap;
}

.dt-tab:hover:not(.active) {
    color: var(--ink-2);
    background: var(--bg-overlay)
}

.dt-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    background: var(--bg-raised);
}

/* Tab strip hint — right-aligned label inside .dt-tabs */
.dt-tab-hint {
    margin-left: auto;
    padding-right: var(--sp-4);
    font-size: 0.65rem;
    color: var(--ink-4);
    align-self: center;
}


/* ── Inputs ───────────────────────────────────────────────────────────── */

.dt-input {
    width: 100%;
    background: var(--bg-raised);
    border: 1px solid var(--rule-hard);
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 0.82rem;
    padding: var(--sp-2) var(--sp-3);
    outline: none;
    border-radius: var(--r-md);
    transition: border-color var(--t-base), box-shadow var(--t-base);
}

.dt-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.dt-input.err {
    border-color: var(--fail);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
    color: var(--fail);
}

.dt-input::placeholder {
    color: var(--ink-4)
}

.dt-textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.6
}

/* Full-bleed code editor */
.dt-editor {
    width: 100%;
    height: 100%;
    background: var(--bg-sunken);
    border: none;
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.7;
    padding: var(--sp-4);
    outline: none;
    resize: none;
}

.dt-editor::placeholder {
    color: var(--ink-4)
}


/* ── Buttons ──────────────────────────────────────────────────────────── */

.dt-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    background: var(--bg-raised);
    border: 1px solid var(--rule-hard);
    color: var(--ink-2);
    font-family: var(--font-ui);
    font-size: 0.78rem;
    font-weight: 500;
    padding: var(--sp-2) var(--sp-4);
    cursor: pointer;
    border-radius: var(--r-md);
    transition: all var(--t-base);
    white-space: nowrap;
    letter-spacing: 0.01em;
    user-select: none;
}

.dt-btn:hover {
    background: var(--bg-overlay);
    color: var(--ink);
    border-color: var(--rule-hard)
}

.dt-btn:active {
    background: var(--bg-sunken)
}

.dt-btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

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

.dt-btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--ink-3);
}

.dt-btn-ghost:hover {
    background: var(--bg-overlay);
    border-color: transparent;
    color: var(--ink-2);
}

/* Small variant */
.dt-btn-sm {
    font-size: 0.7rem;
    padding: var(--sp-1) var(--sp-3)
}

/* Inline copy button */
.dt-copy {
    background: none;
    border: none;
    color: var(--ink-4);
    font-family: var(--font-ui);
    font-size: 0.68rem;
    font-weight: 500;
    cursor: pointer;
    padding: 2px var(--sp-2);
    border-radius: var(--r-sm);
    transition: all var(--t-fast);
    flex-shrink: 0;
}

.dt-copy:hover {
    color: var(--accent);
    background: var(--accent-dim)
}

.dt-copy.copied {
    color: var(--pass);
    background: var(--pass-bg)
}


/* ── Output table ─────────────────────────────────────────────────────── */
/*
 *   <div class="dt-out-table">
 *     <div class="dt-out-row">
 *       <span class="dt-out-lbl">ISO 8601</span>
 *       <span class="dt-out-val">2024-01-15T…</span>
 *       <button class="dt-copy">copy</button>
 *     </div>
 *   </div>
 */

.dt-out-table {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--rule);
    border-radius: var(--r-lg);
    overflow: hidden;
    background: var(--bg-raised);
    box-shadow: var(--shadow-sm);
}

.dt-out-row {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: 0.45rem var(--sp-4);
    border-bottom: 1px solid var(--rule-soft);
    transition: background var(--t-fast);
}

.dt-out-row:last-child {
    border-bottom: none
}

.dt-out-row:hover {
    background: var(--bg-overlay)
}

.dt-out-lbl {
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--ink-3);
    min-width: 72px;
    flex-shrink: 0;
}

.dt-out-val {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


/* ── Badges ───────────────────────────────────────────────────────────── */

.dt-badge {
    display: inline-flex;
    align-items: center;
    font-family: var(--font-ui);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    padding: 0.15rem 0.45rem;
    border-radius: var(--r-sm);
}

.dt-badge-pass {
    color: var(--pass);
    background: var(--pass-bg)
}

.dt-badge-fail {
    color: var(--fail);
    background: var(--fail-bg)
}

.dt-badge-warn {
    color: var(--warn);
    background: var(--warn-bg)
}

.dt-badge-info {
    color: var(--info);
    background: var(--info-bg)
}

.dt-badge-muted {
    color: var(--ink-3);
    background: var(--bg-sunken)
}


/* ── Banners ──────────────────────────────────────────────────────────── */

.dt-banner {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    font-size: 0.78rem;
    line-height: 1.55;
    border-radius: var(--r-md);
    border: 1px solid;
}

.dt-banner-err {
    border-color: #fca5a5;
    background: var(--fail-bg);
    color: var(--fail)
}

.dt-banner-warn {
    border-color: #fcd34d;
    background: var(--warn-bg);
    color: var(--warn)
}

.dt-banner-info {
    border-color: #93c5fd;
    background: var(--info-bg);
    color: var(--accent-text)
}

.dt-banner-pass {
    border-color: #86efac;
    background: var(--pass-bg);
    color: var(--pass)
}


/* ── Status bar ───────────────────────────────────────────────────────── */

.dt-statusbar {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: 0 var(--sp-4);
    height: 28px;
    border-top: 1px solid var(--rule);
    background: var(--bg);
    font-size: 0.65rem;
    color: var(--ink-3);
    flex-shrink: 0;
}

.dt-status-sep {
    color: var(--ink-5)
}

.dt-status-item.ok {
    color: var(--pass)
}

.dt-status-item.err {
    color: var(--fail)
}

.dt-status-right {
    margin-left: auto
}


/* ── Reference cards ──────────────────────────────────────────────────── */

.dt-ref-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: var(--sp-3);
}

.dt-ref-card {
    background: var(--bg-raised);
    border: 1px solid var(--rule);
    border-radius: var(--r-lg);
    padding: var(--sp-4);
    text-align: left;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: var(--sp-1);
    transition: all var(--t-base);
    font-family: var(--font-ui);
    box-shadow: var(--shadow-sm);
}

.dt-ref-card:hover {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1), var(--shadow-sm);
}

.dt-ref-val {
    font-family: var(--font-mono);
    font-size: 0.88rem;
    color: var(--accent);
    font-weight: 500
}

.dt-ref-lbl {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--ink)
}

.dt-ref-note {
    font-size: 0.65rem;
    color: var(--ink-3);
    margin-top: var(--sp-1)
}


/* ── Typography helpers ───────────────────────────────────────────────── */

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

.dt-mono {
    font-family: var(--font-mono);
    font-size: 0.82rem
}

.dt-dim {
    color: var(--ink-3)
}

.dt-muted {
    color: var(--ink-4)
}

.dt-accent {
    color: var(--accent)
}

.dt-pass-txt {
    color: var(--pass)
}

.dt-fail-txt {
    color: var(--fail)
}


/* ── Footer ───────────────────────────────────────────────────────────── */

.dt-footer {
    padding: var(--sp-4) var(--sp-6);
    border-top: 1px solid var(--rule);
    background: var(--bg-raised);
    font-size: 0.65rem;
    color: var(--ink-4);
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    flex-shrink: 0;
}

.dt-footer a {
    color: var(--ink-3);
    text-decoration: none
}

.dt-footer a:hover {
    color: var(--accent)
}


/* ── Status footer ────────────────────────────────────────────────── */

.status-footer {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    font-size: 0.65rem;
    color: var(--ink-3);
    padding: var(--sp-2) var(--sp-1);
    flex-wrap: wrap;
    flex-shrink: 0;
}

/* ── Scrollbars ───────────────────────────────────────────────────────── */

::-webkit-scrollbar {
    width: 6px;
    height: 6px
}

::-webkit-scrollbar-track {
    background: transparent
}

::-webkit-scrollbar-thumb {
    background: var(--rule-hard);
    border-radius: 3px
}

::-webkit-scrollbar-thumb:hover {
    background: var(--ink-4)
}


/* ── Utilities ────────────────────────────────────────────────────────── */

.dt-flex {
    display: flex
}

.dt-col {
    flex-direction: column
}

.dt-gap-1 {
    gap: var(--sp-1)
}

.dt-gap-2 {
    gap: var(--sp-2)
}

.dt-gap-3 {
    gap: var(--sp-3)
}

.dt-gap-4 {
    gap: var(--sp-4)
}

.dt-ml-auto {
    margin-left: auto
}

.dt-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap
}

.dt-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}