/* =========================================================================
   DevTools — warm-paper design system
   Inspired by the fermi.gg / dialed.gg aesthetic:
   newsprint background, chunky pill controls, bold accent blocks,
   uppercase wide-tracked labels, soft deep shadows.
   ========================================================================= */

/* ---------- Tokens: light (paper) is the base ---------- */
:root {
    --bg:          #e9e6de;
    --bg-tint:     #efece5;
    --surface:     #fffbf3;
    --surface-2:   #f5f3ec;
    --surface-3:   #ebe7dd;
    --ink:         #1a1f2b;
    --ink-2:       #6b675d;
    --ink-3:       #928d81;
    --line:        #d8d3c7;
    --line-strong: #bdb7a8;

    --coral:  #ff5e3a;
    --yellow: #f4d53b;
    --blue:   #4e6bff;
    --green:  #2e9e5b;
    --purple: #8b5cf6;
    --red:    #e03131;

    --accent:      var(--coral);
    --accent-ink:  #ffffff;
    --marker:      rgba(244, 213, 59, 0.45);
    --link:        #d9451f;

    --shadow-sm: 0 4px 14px -8px rgba(26, 31, 43, 0.28);
    --shadow-md: 0 12px 30px -14px rgba(26, 31, 43, 0.34);
    --shadow-lg: 0 26px 60px -26px rgba(26, 31, 43, 0.42);

    --r-pill: 999px;
    --r-lg: 24px;
    --r-md: 16px;
    --r-sm: 10px;

    --font: Helvetica, "Helvetica Neue", Arial, sans-serif;
    --mono: "SF Mono", "JetBrains Mono", "Cascadia Code", Consolas, "Courier New", monospace;

    --ease: cubic-bezier(0.32, 0.72, 0, 1);
    --transition: all 0.22s var(--ease);

    /* legacy aliases so pre-existing tool markup keeps working */
    --bg-primary: var(--bg);
    --bg-secondary: var(--surface-2);
    --bg-card: var(--surface);
    --bg-card-hover: var(--surface-3);
    --text-primary: var(--ink);
    --text-secondary: var(--ink-2);
    --border-color: var(--line);
    --accent-color: var(--accent);
    --shadow: var(--shadow-sm);
    --shadow-hover: var(--shadow-md);
}

/* ---------- Tokens: dark ---------- */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg:          #191817;
        --bg-tint:     #1f1e1c;
        --surface:     #262420;
        --surface-2:   #2f2d28;
        --surface-3:   #3a3832;
        --ink:         #ede9e0;
        --ink-2:       #a8a296;
        --ink-3:       #837d71;
        --line:        #3a3833;
        --line-strong: #4d4a43;

        --accent-ink:  #1a1f2b;
        --marker:      rgba(244, 213, 59, 0.3);
        --link:        #ff8a5c;

        --shadow-sm: 0 4px 14px -8px rgba(0, 0, 0, 0.6);
        --shadow-md: 0 12px 30px -14px rgba(0, 0, 0, 0.7);
        --shadow-lg: 0 26px 60px -26px rgba(0, 0, 0, 0.8);
    }
}

:root[data-theme="dark"] {
    --bg:          #191817;
    --bg-tint:     #1f1e1c;
    --surface:     #262420;
    --surface-2:   #2f2d28;
    --surface-3:   #3a3832;
    --ink:         #ede9e0;
    --ink-2:       #a8a296;
    --ink-3:       #837d71;
    --line:        #3a3833;
    --line-strong: #4d4a43;

    --accent-ink:  #1a1f2b;
    --marker:      rgba(244, 213, 59, 0.3);
    --link:        #ff8a5c;

    --shadow-sm: 0 4px 14px -8px rgba(0, 0, 0, 0.6);
    --shadow-md: 0 12px 30px -14px rgba(0, 0, 0, 0.7);
    --shadow-lg: 0 26px 60px -26px rgba(0, 0, 0, 0.8);
}

/* ---------- Category accents ---------- */
[data-cat="text"]        { --cat: var(--coral); }
[data-cat="url"]         { --cat: var(--blue); }
[data-cat="web"]         { --cat: var(--purple); }
[data-cat="json"]        { --cat: var(--yellow); }
[data-cat="data"]        { --cat: var(--green); }
[data-cat="crypto"]      { --cat: var(--red); }
[data-cat="generators"]  { --cat: var(--purple); }
[data-cat="encoding"]    { --cat: var(--blue); }
[data-cat="sql"]         { --cat: var(--green); }
[data-cat="cloud"]       { --cat: var(--coral); }
[data-cat="image"]       { --cat: var(--yellow); }
[data-cat="network"]     { --cat: var(--blue); }
[data-cat="time"]        { --cat: var(--purple); }
[data-cat="devops"]      { --cat: var(--coral); }
[data-cat="conversion"]  { --cat: var(--green); }
[data-cat="utility"]     { --cat: var(--blue); }
[data-cat="security"]    { --cat: var(--red); }
[data-cat="frontend"]    { --cat: var(--purple); }
[data-cat="backend"]     { --cat: var(--yellow); }

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

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--ink);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    min-height: 100vh;
}

/* subtle paper grain */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.5;
    background-image:
        radial-gradient(circle at 1px 1px, rgba(0, 0, 0, 0.045) 1px, transparent 0);
    background-size: 22px 22px;
}
:root[data-theme="dark"] body::before { opacity: 0.35; background-image: radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.05) 1px, transparent 0); }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) body::before { opacity: 0.35; background-image: radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.05) 1px, transparent 0); }
}

::selection { background: var(--marker); color: var(--ink); }

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout ---------- */
.container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 6rem;
    position: relative;
    z-index: 1;
}

/* ---------- Shared eyebrow / label treatment ---------- */
.eyebrow,
.tool-section h3,
.tool-badge,
.category-btn,
button.action-btn,
.stat-label {
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-weight: 800;
}

/* ---------- Header ---------- */
header { margin-bottom: 2.5rem; }

.header-wrapper {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.header-content { display: flex; flex-direction: column; gap: 0.6rem; }

header h1 {
    font-size: clamp(2.4rem, 6vw, 3.6rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 0.98;
    color: var(--ink);
}

header h1 .mark {
    background: linear-gradient(transparent 62%, var(--marker) 62%);
    padding: 0 0.08em;
}

.header-subtitle {
    color: var(--ink-2);
    font-size: 0.95rem;
    max-width: 56ch;
}

.creator-link { color: var(--ink); font-weight: 700; border-bottom: 2px solid var(--accent); }
.creator-link:hover { text-decoration: none; color: var(--accent); }

.header-actions { display: flex; align-items: center; gap: 0.6rem; flex-shrink: 0; }

/* Round icon buttons (fermi-style pills) */
.icon-btn,
.env-settings-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--surface);
    color: var(--ink);
    border: 2px solid var(--ink);
    border-radius: var(--r-pill);
    padding: 0.7rem 1.1rem;
    font-family: var(--font);
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.icon-btn:hover,
.env-settings-btn:hover {
    background: var(--ink);
    color: var(--bg);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

#activeEnvIndicator:not(:empty) {
    padding-left: 0.55rem;
    margin-left: 0.1rem;
    border-left: 2px solid currentColor;
    opacity: 0.85;
}

/* ---------- Search ---------- */
.search-container { position: relative; margin-bottom: 1.75rem; }

#globalSearch {
    width: 100%;
    padding: 1.15rem 6.5rem 1.15rem 3.25rem;
    background: var(--surface);
    border: 2px solid var(--ink);
    border-radius: var(--r-pill);
    color: var(--ink);
    font-family: var(--font);
    font-size: 1.05rem;
    font-weight: 500;
    outline: none;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    min-height: 0;
}

#globalSearch::placeholder { color: var(--ink-3); font-weight: 400; }

#globalSearch:focus {
    box-shadow: 0 0 0 4px var(--marker), var(--shadow-md);
    transform: translateY(-1px);
}

.search-container::before {
    content: "⌕";
    position: absolute;
    left: 1.35rem;
    top: 50%;
    transform: translateY(-52%);
    font-size: 1.5rem;
    color: var(--ink-2);
    pointer-events: none;
}

.search-hint {
    position: absolute;
    right: 1.1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    color: var(--ink-2);
    background: var(--surface-2);
    border: 1.5px solid var(--line);
    border-radius: var(--r-pill);
    padding: 0.35rem 0.7rem;
    pointer-events: none;
    white-space: nowrap;
}

/* ---------- Category filter ---------- */
.category-filter {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding-top: 0.5rem;
}

.category-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: transparent;
    border: 2px solid var(--line-strong);
    color: var(--ink-2);
    padding: 0.55rem 1rem;
    border-radius: var(--r-pill);
    font-family: var(--font);
    font-size: 0.7rem;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.category-btn:hover {
    border-color: var(--ink);
    color: var(--ink);
    transform: translateY(-2px);
}

.category-btn.active {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--bg);
    box-shadow: var(--shadow-sm);
}

.category-btn .count {
    font-size: 0.65rem;
    opacity: 0.65;
    letter-spacing: 0.05em;
}

/* ---------- Tool grid ---------- */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
    gap: 1rem;
}

.section-heading {
    grid-column: 1 / -1;
    display: flex;
    align-items: baseline;
    gap: 0.9rem;
    margin: 2rem 0 0.25rem;
}
.section-heading:first-child { margin-top: 0; }

.section-heading h2 {
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--ink);
}

.section-heading .rule {
    flex: 1;
    height: 2px;
    background: var(--line-strong);
}

.section-heading .n {
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--ink-3);
    letter-spacing: 0.1em;
}

.tool-card {
    --cat: var(--accent);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    background: var(--surface);
    border: 2px solid var(--line);
    border-radius: var(--r-lg);
    padding: 1.4rem 1.35rem 1.25rem;
    cursor: pointer;
    transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease), border-color 0.22s var(--ease);
    overflow: hidden;
    text-align: left;
}

.tool-card::after {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    background: var(--cat);
    transform: scaleY(0);
    transform-origin: top;
    transition: transform 0.28s var(--ease);
}

.tool-card:hover {
    border-color: var(--ink);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.tool-card:hover::after { transform: scaleY(1); }

.tool-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--cat) 18%, transparent);
    color: var(--cat);
    font-size: 1.15rem;
    font-weight: 800;
    font-family: var(--mono);
    margin-bottom: 0.3rem;
    flex-shrink: 0;
}

.tool-name {
    font-size: 1.02rem;
    font-weight: 800;
    letter-spacing: -0.015em;
    line-height: 1.25;
    color: var(--ink);
}

.tool-description {
    color: var(--ink-2);
    font-size: 0.845rem;
    line-height: 1.5;
    flex: 1;
}

.tool-badge {
    align-self: flex-start;
    margin-top: 0.5rem;
    padding: 0.28rem 0.7rem;
    border-radius: var(--r-pill);
    background: color-mix(in srgb, var(--cat) 15%, transparent);
    color: color-mix(in srgb, var(--cat) 72%, var(--ink));
    font-size: 0.62rem;
    letter-spacing: 0.14em;
}

.tool-card.hidden { display: none; }

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 1rem;
    color: var(--ink-2);
}
.empty-state strong { display: block; font-size: 1.3rem; color: var(--ink); margin-bottom: 0.5rem; }

/* ---------- Full-page tool view ---------------------------------------
   Tools take over the whole viewport rather than opening in a dialog, so
   editors get the full height of the screen.                            */

/* The tool view is a normal block in document flow, not a fixed overlay.
   An overlay looked the same but broke full-page screenshots (they capture
   document height, leaving a blank band), printing, and find-in-page. */

.tool-view { display: none; background: var(--bg); }

body.tool-open .tool-view { display: block; animation: viewFade 0.16s var(--ease); }
body.tool-open > .container { display: none; }

@keyframes viewFade {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.tool-view-bar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.5rem;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 2px solid var(--line);
}

.tool-view-title {
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.tool-view-title .tool-icon {
    width: 30px;
    height: 30px;
    font-size: 0.9rem;
    margin-bottom: 0;
    border-radius: 9px;
}

.tool-view-actions { display: flex; gap: 0.4rem; flex-shrink: 0; }

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: var(--surface);
    border: 2px solid var(--ink);
    color: var(--ink);
    padding: 0.5rem 1rem;
    border-radius: var(--r-pill);
    font-family: var(--font);
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.back-btn:hover { background: var(--ink); color: var(--bg); transform: translateX(-2px); }

/* Use the height that is actually there.
   Rather than reserving a guessed number of pixels for the header, options and
   buttons, the body is a flex column and the editor panes take whatever is
   left over. Tools with many options simply get a shorter editor. */

.tool-view-body {
    max-width: 1680px;
    margin: 0 auto;
    padding: 1.75rem 1.5rem 2rem;
    display: flex;
    flex-direction: column;
    /* Fill the first screen, then grow with the content. */
    min-height: calc(100vh - 62px);
}

.tool-view .tool-interface {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.tool-view .io-grid,
.tool-view .tool-interface > .io-pane {
    flex: 1 1 auto;
    min-height: 300px;
    align-items: stretch;
}

.tool-view .io-pane { min-height: 0; }

.tool-view .io-grid textarea,
.tool-view .tool-interface > .io-pane > textarea {
    flex: 1 1 auto;
    height: auto;
    min-height: 260px;
    resize: vertical;
}

/* Sections that follow the editor must not be squashed by the flex growth. */
.tool-view .tool-interface > .btn-row,
.tool-view .tool-interface > .info-box,
.tool-view .tool-interface > #stExtra,
.tool-view .tool-interface > div[id$="_extra"],
.tool-view .tool-interface > div[id$="_error"] { flex: 0 0 auto; }

.tool-view .table-wrap { max-height: clamp(320px, calc(100vh - 340px), 1100px); }

.tool-view textarea.short { flex: 0 0 auto; height: auto; min-height: 110px; }

/* Once a tool has rendered extra content below (stats, tables, previews) the
   editor stops stretching so that content gets the room — and the body stops
   forcing a full screen, which is what used to leave a band of empty space
   under short results. */
.tool-view .tool-interface.has-extra .io-grid { flex: 0 0 auto; }
.tool-view .tool-interface.has-extra .io-grid textarea { min-height: 300px; }
.tool-view-body:has(> .tool-interface.has-extra) { min-height: 0; }

/* Generators and single-pane tools have nothing to stretch, so they should not
   be padded out to a full screen either. */
.tool-view-body:has(> .tool-interface > .btn-row:last-child) { min-height: 0; }

@media (max-width: 820px) {
    .tool-view-body { padding: 1.25rem 1rem 3rem; }
    .tool-view-bar { padding: 0.7rem 1rem; }
    .tool-view .io-grid textarea { min-height: 220px; }
    .tool-view-actions .modal-action-btn span:last-child { display: none; }
}

.modal-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--surface-2);
    border: 2px solid var(--line);
    color: var(--ink);
    padding: 0.5rem 0.95rem;
    border-radius: var(--r-pill);
    font-family: var(--font);
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: var(--transition);
}

.modal-action-btn:hover { border-color: var(--ink); transform: translateY(-1px); }
.modal-action-btn.is-ok { border-color: var(--green); color: var(--green); }

/* ---------- Command palette ---------- */

.palette {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: color-mix(in srgb, var(--bg) 55%, transparent);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: 10vh 1rem 2rem;
}

.palette.open { display: block; animation: viewFade 0.14s var(--ease); }

.palette-box {
    max-width: 680px;
    margin: 0 auto;
    background: var(--surface);
    border: 2px solid var(--ink);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

#paletteInput {
    width: 100%;
    border: none;
    border-bottom: 2px solid var(--line);
    border-radius: 0;
    background: transparent;
    padding: 1.1rem 1.35rem;
    font-family: var(--font);
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--ink);
    outline: none;
}

#paletteInput:focus { box-shadow: none; border-color: var(--line); }

.palette-results {
    list-style: none;
    max-height: 52vh;
    overflow-y: auto;
    padding: 0.4rem;
}

.palette-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.6rem 0.85rem;
    border-radius: var(--r-md);
    cursor: pointer;
    scroll-margin: 0.5rem;
}

.palette-item[aria-selected="true"] { background: var(--surface-3); }

.palette-item .pi-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: color-mix(in srgb, var(--cat, var(--accent)) 18%, transparent);
    color: var(--cat, var(--accent));
    font-family: var(--mono);
    font-size: 0.85rem;
    font-weight: 800;
    flex-shrink: 0;
}

.palette-item .pi-text { min-width: 0; flex: 1; }
.palette-item .pi-name { font-weight: 800; font-size: 0.88rem; }
.palette-item .pi-desc {
    font-size: 0.76rem;
    color: var(--ink-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.palette-item .pi-cat {
    font-size: 0.6rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-3);
    flex-shrink: 0;
}

.palette-empty { padding: 2rem 1rem; text-align: center; color: var(--ink-2); font-size: 0.88rem; }

.palette-foot {
    display: flex;
    gap: 1rem;
    padding: 0.6rem 1.1rem;
    border-top: 2px solid var(--line);
    font-size: 0.68rem;
    color: var(--ink-3);
    font-weight: 700;
    flex-wrap: wrap;
}

kbd {
    font-family: var(--font);
    font-size: 0.65rem;
    font-weight: 800;
    background: var(--surface-3);
    border: 1.5px solid var(--line);
    border-radius: 5px;
    padding: 0.1rem 0.35rem;
    margin-right: 0.2rem;
}

/* ---------- Tool interface ---------- */
.tool-interface h2 {
    font-size: 1.65rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    margin-bottom: 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.tool-interface > p,
.tool-lede {
    color: var(--ink-2);
    font-size: 0.92rem;
    margin-bottom: 1.75rem;
    max-width: 70ch;
}

.tool-section { margin-bottom: 1.6rem; }

.tool-section h3 {
    font-size: 0.7rem;
    color: var(--ink-2);
    margin-bottom: 0.7rem;
}

/* Two-pane in/out layout used by most converters */
.io-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    align-items: start;
}

@media (max-width: 820px) { .io-grid { grid-template-columns: 1fr; } }

.io-pane { display: flex; flex-direction: column; gap: 0.5rem; min-width: 0; }

.io-pane-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-height: 30px;
}

.io-pane-head h3 { margin-bottom: 0; }

.io-pane-actions { display: flex; gap: 0.35rem; }

/* ---------- Form controls ---------- */
label {
    display: block;
    margin-bottom: 0.4rem;
    color: var(--ink-2);
    font-size: 0.78rem;
    font-weight: 700;
}

textarea,
input[type="text"],
input[type="number"],
input[type="password"],
input[type="search"],
select {
    width: 100%;
    padding: 0.85rem 1rem;
    background: var(--surface-2);
    border: 2px solid var(--line);
    border-radius: var(--r-md);
    color: var(--ink);
    font-family: var(--mono);
    font-size: 0.875rem;
    line-height: 1.6;
    transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
    outline: none;
}

textarea { min-height: 220px; resize: vertical; display: block; }

textarea.tall { min-height: 340px; }
textarea.short { min-height: 110px; }

input[type="text"],
input[type="number"],
input[type="password"],
select {
    min-height: 0;
    font-family: var(--font);
    font-weight: 500;
}

select {
    cursor: pointer;
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
    background-position: calc(100% - 18px) calc(50% + 2px), calc(100% - 13px) calc(50% + 2px);
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    padding-right: 2.5rem;
}

textarea:focus,
input:focus,
select:focus {
    border-color: var(--ink);
    box-shadow: 0 0 0 4px var(--marker);
}

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

textarea[readonly], input[readonly] { background: var(--surface-3); }

/* checkbox / radio rows */
.opt-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    align-items: center;
    margin-bottom: 0.85rem;
}

.opt-row label { margin-bottom: 0; }

.check {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
    user-select: none;
    margin-bottom: 0;
}

.check input[type="checkbox"],
.check input[type="radio"] {
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--line-strong);
    border-radius: 6px;
    background: var(--surface-2);
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
    position: relative;
}

.check input[type="radio"] { border-radius: 50%; }

.check input:checked {
    background: var(--ink);
    border-color: var(--ink);
}

.check input[type="checkbox"]:checked::after {
    content: "✓";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bg);
    font-size: 0.75rem;
    font-weight: 900;
}

.check input[type="radio"]:checked::after {
    content: "";
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    background: var(--bg);
}

.field-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.85rem;
    margin-bottom: 0.85rem;
}

/* ---------- Buttons ---------- */
button.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    background: var(--ink);
    color: var(--bg);
    border: 2px solid var(--ink);
    padding: 0.8rem 1.6rem;
    border-radius: var(--r-pill);
    font-family: var(--font);
    font-size: 0.72rem;
    cursor: pointer;
    transition: var(--transition);
    margin: 0 0.4rem 0.4rem 0;
    box-shadow: var(--shadow-sm);
}

button.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-ink);
}

button.action-btn:active { transform: translateY(0); }

button.action-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

button.action-btn.secondary {
    background: transparent;
    color: var(--ink);
    border-color: var(--line-strong);
    box-shadow: none;
}

button.action-btn.secondary:hover {
    background: var(--surface-2);
    border-color: var(--ink);
    color: var(--ink);
}

button.action-btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
button.action-btn.danger:hover { background: #b02525; border-color: #b02525; color: #fff; }

/* small ghost button used inside pane headers */
.mini-btn {
    background: transparent;
    border: 2px solid var(--line);
    color: var(--ink-2);
    border-radius: var(--r-pill);
    padding: 0.3rem 0.7rem;
    font-family: var(--font);
    font-size: 0.62rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: var(--transition);
}

.mini-btn:hover { border-color: var(--ink); color: var(--ink); }
.mini-btn.is-ok { border-color: var(--green); color: var(--green); }

/* Mermaid quick-start template chips */
.template-btn {
    padding: 0.5rem 0.95rem;
    background: var(--surface-2);
    border: 2px solid var(--line);
    border-radius: var(--r-pill);
    color: var(--ink);
    font-family: var(--font);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.template-btn:hover {
    border-color: var(--ink);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.btn-row { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }

/* ---------- Output ---------- */
.output-section {
    background: var(--surface-2);
    border: 2px solid var(--line);
    border-radius: var(--r-md);
    padding: 1.1rem 1.2rem;
    min-height: 90px;
    overflow-x: auto;
}

.output-section pre,
pre.code {
    white-space: pre-wrap;
    word-break: break-word;
    font-family: var(--mono);
    font-size: 0.845rem;
    line-height: 1.65;
    color: var(--ink);
}

code {
    font-family: var(--mono);
    font-size: 0.85em;
    background: var(--surface-3);
    padding: 0.15em 0.4em;
    border-radius: 5px;
}

/* status / alert banners */
.alert {
    border-radius: var(--r-md);
    padding: 0.85rem 1.1rem;
    font-size: 0.85rem;
    font-weight: 600;
    border: 2px solid;
    margin-bottom: 1rem;
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
}

.alert.ok    { background: color-mix(in srgb, var(--green) 12%, transparent);  border-color: var(--green);  color: color-mix(in srgb, var(--green) 78%, var(--ink)); }
.alert.err   { background: color-mix(in srgb, var(--red) 12%, transparent);    border-color: var(--red);    color: color-mix(in srgb, var(--red) 78%, var(--ink)); }
.alert.warn  { background: color-mix(in srgb, var(--yellow) 20%, transparent); border-color: #c9a800;       color: color-mix(in srgb, #8a7400 80%, var(--ink)); }
.alert.info  { background: color-mix(in srgb, var(--blue) 12%, transparent);   border-color: var(--blue);   color: color-mix(in srgb, var(--blue) 78%, var(--ink)); }

.info-box {
    background: var(--surface-2);
    border: 2px solid var(--line);
    border-left: 6px solid var(--accent);
    border-radius: var(--r-md);
    padding: 1.2rem 1.35rem;
    font-size: 0.87rem;
    color: var(--ink-2);
}
.info-box ul { margin: 0.5rem 0 0 1.2rem; }
.info-box li { margin-bottom: 0.35rem; }

.helper-text { color: var(--ink-3); font-size: 0.78rem; margin-top: 0.45rem; }

details {
    background: var(--surface-2);
    border: 2px solid var(--line);
    border-radius: var(--r-md);
    padding: 1rem 1.2rem;
}
details summary { cursor: pointer; font-weight: 800; font-size: 0.82rem; color: var(--ink); }
details[open] summary { margin-bottom: 0.75rem; }

/* ---------- Stats (parquet etc.) ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.stat-tile {
    background: var(--surface-2);
    border: 2px solid var(--line);
    border-radius: var(--r-md);
    padding: 0.95rem 1.05rem;
}

.stat-label {
    font-size: 0.62rem;
    color: var(--ink-3);
    margin-bottom: 0.3rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
    word-break: break-word;
}

.stat-sub { font-size: 0.72rem; color: var(--ink-3); margin-top: 0.15rem; }

/* ---------- Data tables ---------- */
.table-wrap {
    overflow: auto;
    max-height: 520px;
    border: 2px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface-2);
}

table.data {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.8rem;
    font-family: var(--mono);
}

table.data thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--surface-3);
    color: var(--ink);
    text-align: left;
    font-family: var(--font);
    font-size: 0.66rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0.7rem 0.85rem;
    border-bottom: 2px solid var(--line-strong);
    white-space: nowrap;
}

table.data thead th .th-type {
    display: block;
    font-family: var(--mono);
    font-size: 0.6rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: none;
    color: var(--ink-3);
    margin-top: 0.15rem;
}

table.data td {
    padding: 0.55rem 0.85rem;
    border-bottom: 1px solid var(--line);
    max-width: 340px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--ink);
}

table.data tbody tr:hover td { background: color-mix(in srgb, var(--yellow) 12%, transparent); }
table.data tbody tr:last-child td { border-bottom: none; }

table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .nul { color: var(--ink-3); font-style: italic; }

.row-index {
    color: var(--ink-3);
    text-align: right;
    user-select: none;
    background: var(--surface-3);
    position: sticky;
    left: 0;
}

/* ---------- Copyable values ----------------------------------------
   Anything with data-copy is click-to-copy, handled by one delegated
   listener in app.js.                                                 */

[data-copy] { cursor: pointer; position: relative; }

.copy-cell {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    max-width: 100%;
}

.copy-cell > span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.copy-chip {
    flex-shrink: 0;
    background: transparent;
    border: 1.5px solid var(--line);
    border-radius: 6px;
    color: var(--ink-3);
    font-family: var(--font);
    font-size: 0.6rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.12rem 0.4rem;
    cursor: pointer;
    transition: var(--transition);
}

.copy-chip:hover { border-color: var(--ink); color: var(--ink); }
.copy-chip.is-ok { border-color: var(--green); color: var(--green); }

table.data tr:hover .copy-chip { border-color: var(--line-strong); }

/* ---------- Agent cards ---------- */

.agent-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1.25rem;
}

.agent-body {
    background: var(--surface-2);
    border: 2px solid var(--line);
    border-radius: var(--r-md);
    padding: 1.5rem 1.75rem;
    line-height: 1.7;
    font-size: 0.92rem;
    overflow-wrap: break-word;
}

.agent-body h1 { font-size: 1.4rem; margin: 0 0 0.75rem; letter-spacing: -0.02em; }
.agent-body h2 {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--ink-2);
    margin: 1.75rem 0 0.6rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--line);
}
.agent-body h3 { font-size: 1rem; margin: 1.25rem 0 0.4rem; }
.agent-body p { margin-bottom: 0.85rem; }
.agent-body ul, .agent-body ol { margin: 0 0 0.95rem 1.35rem; }
.agent-body li { margin-bottom: 0.4rem; }
.agent-body li::marker { color: var(--accent); }
.agent-body strong { font-weight: 800; }
.agent-body code {
    background: var(--surface-3);
    padding: 0.12em 0.4em;
    border-radius: 5px;
    font-size: 0.86em;
}
.agent-body pre {
    background: var(--surface-3);
    border: 2px solid var(--line);
    border-radius: var(--r-md);
    padding: 1rem 1.15rem;
    overflow-x: auto;
    margin-bottom: 1rem;
}
.agent-body pre code { background: none; padding: 0; }
.agent-body hr { border: none; border-top: 2px solid var(--line); margin: 1.5rem 0; }
.agent-body blockquote {
    border-left: 4px solid var(--accent);
    padding-left: 1rem;
    margin: 0 0 1rem;
    color: var(--ink-2);
}

/* ---------- Markdown reader ---------- */

.md-layout {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 900px) {
    .md-layout { grid-template-columns: 1fr; }
    .md-toc { position: static !important; max-height: none !important; }
}

.md-toc {
    position: sticky;
    top: 74px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    background: var(--surface-2);
    border: 2px solid var(--line);
    border-radius: var(--r-md);
    padding: 1rem 1.1rem;
}

.md-toc-title {
    font-size: 0.62rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--ink-3);
    margin-bottom: 0.6rem;
}

.md-toc ul { list-style: none; margin: 0; }
.md-toc li { margin: 0.1rem 0; }
.md-toc a {
    color: var(--ink-2);
    font-size: 0.8rem;
    text-decoration: none;
    display: block;
    padding: 0.18rem 0;
    line-height: 1.35;
    border-left: 2px solid transparent;
    padding-left: 0.5rem;
}
.md-toc a:hover { color: var(--ink); border-left-color: var(--accent); text-decoration: none; }

.md-toc-l1 > a { font-weight: 800; }
.md-toc-l2 > a { padding-left: 0.9rem; }
.md-toc-l3 > a { padding-left: 1.5rem; font-size: 0.76rem; }
.md-toc-l4 > a, .md-toc-l5 > a, .md-toc-l6 > a { padding-left: 2.1rem; font-size: 0.74rem; }

.md-doc { max-width: none; }

.md-doc h1, .md-doc h2, .md-doc h3, .md-doc h4 { scroll-margin-top: 80px; position: relative; }

.md-anchor {
    opacity: 0;
    margin-left: 0.4rem;
    color: var(--ink-3);
    text-decoration: none;
    font-weight: 400;
    transition: opacity 0.15s var(--ease);
}
.md-doc h1:hover .md-anchor, .md-doc h2:hover .md-anchor,
.md-doc h3:hover .md-anchor, .md-doc h4:hover .md-anchor { opacity: 1; }

.md-doc table { border-collapse: collapse; width: 100%; margin: 1rem 0; font-size: 0.88rem; display: block; overflow-x: auto; }
.md-doc th, .md-doc td { border: 1px solid var(--line); padding: 0.5rem 0.75rem; text-align: left; }
.md-doc th { background: var(--surface-3); font-weight: 800; }
.md-doc tr:hover td { background: color-mix(in srgb, var(--yellow) 10%, transparent); }

.md-doc img { max-width: 100%; height: auto; border-radius: 8px; }

.md-doc input[type="checkbox"] {
    appearance: none;
    width: 16px; height: 16px;
    border: 2px solid var(--line-strong);
    border-radius: 4px;
    background: var(--surface-2);
    vertical-align: -2px;
    margin-right: 0.4rem;
    position: relative;
}
.md-doc input[type="checkbox"]:checked { background: var(--green); border-color: var(--green); }
.md-doc input[type="checkbox"]:checked::after {
    content: "✓"; position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 0.6rem; font-weight: 900;
}
.md-doc li:has(> input[type="checkbox"]) { list-style: none; margin-left: -1rem; }

.md-code-copy { position: absolute; top: 0.5rem; right: 0.5rem; opacity: 0; }
.md-doc pre:hover .md-code-copy { opacity: 1; }

.md-diagram {
    background: var(--surface);
    border: 2px solid var(--line);
    border-radius: var(--r-md);
    padding: 1.25rem;
    margin: 1.25rem 0;
    overflow-x: auto;
    text-align: center;
}
.md-diagram svg { max-width: 100%; height: auto; }

/* ---------- Chips / tags ---------- */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--surface-3);
    border: 2px solid var(--line);
    border-radius: var(--r-pill);
    padding: 0.3rem 0.75rem;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--ink-2);
}

.chip.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }

/* ---------- File list rows ---------- */
.file-input {
    width: 100%;
    padding: 1.5rem;
    background: var(--surface-2);
    border: 3px dashed var(--line-strong);
    border-radius: var(--r-lg);
    color: var(--ink-2);
    font-family: var(--font);
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}

.file-input:hover { border-color: var(--accent); background: var(--surface-3); color: var(--ink); }
.file-input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 4px var(--marker); }

.file-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.9rem;
    padding: 0.75rem 1rem;
    background: var(--surface-2);
    border: 2px solid var(--line);
    border-radius: var(--r-md);
    margin-bottom: 0.5rem;
    transition: var(--transition);
}

.file-row.active { border-color: var(--ink); background: var(--surface-3); }
.file-row .fname { font-weight: 700; font-size: 0.87rem; }
.file-row .fmeta { color: var(--ink-3); font-size: 0.75rem; font-family: var(--mono); }

/* ---------- Environment panel ---------- */
.environment-panel { padding-top: 0.5rem; }
.env-header h2 { font-size: 1.65rem; font-weight: 800; letter-spacing: -0.025em; margin-bottom: 0.4rem; }
.env-section { margin-bottom: 1.75rem; }
.env-section h3 { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.16em; font-weight: 800; color: var(--ink-2); margin-bottom: 0.8rem; }
.env-section h4 { font-size: 0.95rem; font-weight: 800; margin-bottom: 0.6rem; }
.env-list { display: grid; gap: 0.75rem; }

.env-card {
    background: var(--surface-2);
    border: 2px solid var(--line);
    border-radius: var(--r-md);
    padding: 1.1rem 1.25rem;
    transition: var(--transition);
    cursor: pointer;
}
.env-card:hover { border-color: var(--ink); transform: translateY(-2px); }
.env-card.active { border-color: var(--green); background: color-mix(in srgb, var(--green) 10%, transparent); }

.env-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 0.5rem; }
.env-name { font-weight: 800; font-size: 1rem; }
.env-description { color: var(--ink-2); font-size: 0.83rem; }
.env-actions { display: flex; gap: 0.35rem; }

.env-btn {
    background: transparent;
    border: 2px solid var(--line);
    border-radius: var(--r-pill);
    padding: 0.35rem 0.6rem;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    line-height: 1;
    color: var(--ink);
}
.env-btn:hover { border-color: var(--ink); background: var(--surface-3); }

.env-vars-count { color: var(--ink-3); font-size: 0.75rem; font-family: var(--mono); }

/* ---------- Status dots & message cards ---------- */
.status-indicator { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 0.5rem; }
.status-indicator.success { background: var(--green); animation: pulse 2s ease-in-out infinite; }
.status-indicator.error   { background: var(--red); }
.status-indicator.warning { background: var(--yellow); }

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

.message-card {
    padding: 0.85rem 1rem;
    margin-bottom: 0.6rem;
    background: var(--surface-2);
    border: 2px solid var(--line);
    border-left: 6px solid var(--green);
    border-radius: var(--r-md);
    animation: slideIn 0.25s var(--ease);
}

.message-card .msg-head {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-3);
    margin-bottom: 0.5rem;
}

.message-card pre { font-size: 0.8rem; }

@keyframes slideIn { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: translateX(0); } }

/* ---------- Toasts ---------- */
.toast-stack {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    background: var(--ink);
    color: var(--bg);
    border-radius: var(--r-pill);
    padding: 0.75rem 1.35rem;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.25s var(--ease);
}

.toast.err { background: var(--red); color: #fff; }
.toast.out { animation: slideOutRight 0.25s var(--ease) forwards; }

@keyframes slideInRight  { from { opacity: 0; transform: translateX(60px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideOutRight { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(60px); } }

/* ---------- Inline share bars ---------- */

.bar {
    display: inline-block;
    height: 10px;
    background: var(--accent);
    border-radius: 3px;
    vertical-align: 0;
    margin-right: 0.4rem;
    min-width: 2px;
    max-width: 110px;
}

.bar-label { font-size: 0.72rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ---------- Diff legend & moved blocks ---------- */

.diff-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.1rem;
    margin: 0.75rem 0 0.25rem;
    font-size: 0.76rem;
    color: var(--ink-2);
    align-items: center;
}

.diff-legend small { color: var(--ink-3); }

.sw {
    display: inline-block;
    width: 13px;
    height: 13px;
    border-radius: 4px;
    vertical-align: -2px;
    margin-right: 0.35rem;
    border: 1px solid var(--line-strong);
}

.sw-add { background: rgba(46, 158, 91, 0.45); }
.sw-del { background: rgba(224, 49, 49, 0.45); }
.sw-mod { background: rgba(244, 213, 59, 0.55); }
.sw-mov { background: rgba(139, 92, 246, 0.5); }

.move-tag {
    display: inline-block;
    background: var(--purple);
    color: #fff;
    border-radius: 5px;
    font-size: 0.6rem;
    font-weight: 800;
    padding: 0.05rem 0.32rem;
    margin-right: 0.4rem;
    vertical-align: 1px;
    cursor: help;
}

/* ---------- Coming soon ---------- */

.soon {
    margin-top: 3.5rem;
    padding: 1.75rem 1.9rem;
    background: var(--surface);
    border: 2px dashed var(--line-strong);
    border-radius: var(--r-lg);
}

.soon-head { display: flex; align-items: center; gap: 0.85rem; flex-wrap: wrap; margin-bottom: 0.85rem; }

.soon-badge {
    background: var(--yellow);
    color: #1a1f2b;
    border-radius: var(--r-pill);
    padding: 0.3rem 0.85rem;
    font-size: 0.62rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    white-space: nowrap;
}

.soon h2 { font-size: 1.15rem; font-weight: 800; letter-spacing: -0.02em; }
.soon p { color: var(--ink-2); font-size: 0.92rem; max-width: 72ch; }
.soon-list { margin: 0.9rem 0 0.9rem 1.1rem; color: var(--ink-2); font-size: 0.88rem; }
.soon-list li { margin-bottom: 0.35rem; }
.soon-list li::marker { color: var(--accent); }
.soon-list strong { color: var(--ink); }
.soon-note { font-size: 0.82rem; color: var(--ink-3); margin-top: 0.75rem; }

body.tool-open .soon { display: none; }

/* ---------- Footer ---------- */
.site-footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 2px solid var(--line);
    color: var(--ink-3);
    font-size: 0.8rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
    justify-content: space-between;
}

/* ---------- Scrollbars ---------- */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-3); }

/* ---------- Focus ---------- */
*:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .container { padding: 1.75rem 1rem 4rem; }
    .header-wrapper { flex-direction: column; align-items: stretch; }
    .header-actions { justify-content: flex-start; }
    .modal { padding: 1rem 0.5rem; }
    .modal-content { padding: 1.5rem 1.25rem; }
    .search-hint { display: none; }
    #globalSearch { padding-right: 1.5rem; }
}

@media (max-width: 560px) {
    .bento-grid { grid-template-columns: 1fr; }
    button.action-btn { width: 100%; margin-right: 0; }
    .btn-row button.action-btn { width: auto; flex: 1 1 auto; }
    .stat-grid { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
