/* =========================================================
   ToolBelt — dark theme
   ========================================================= */

:root {
    --bg-0: #0b0d11;
    --bg-1: #11141a;
    --bg-2: #161a22;
    --bg-3: #1d212b;
    --bg-hover: #232834;

    --border: #262b36;
    --border-strong: #343a48;

    --text: #e7ebf2;
    --text-dim: #a4adba;
    --text-faint: #6b7280;

    --accent: #7c6cf3;
    --accent-strong: #9a8cff;
    --danger: #e5484d;

    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 16px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.45);

    --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;

    --header-h: 64px;
    --sidebar-w: 260px;
    --max-w: 1400px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }
body {
    margin: 0;
    background: var(--bg-0);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

h1, h2, h3, h4 { color: var(--text); margin: 0 0 .5rem 0; font-weight: 600; line-height: 1.25; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; }

code, pre { font-family: var(--font-mono); font-size: .9em; }
code { background: var(--bg-2); border: 1px solid var(--border); padding: 1px 5px; border-radius: var(--r-sm); }

::selection { background: rgba(124, 108, 243, 0.4); }

/* =========================================================
   App shell: header / sidebar / main / footer
   ========================================================= */
.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(11, 13, 17, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}
.app-header__inner {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1rem;
    align-items: center;
    height: var(--header-h);
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 1.25rem;
}
.app-header__brand {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    color: var(--text);
    font-weight: 700;
    font-size: 1.05rem;
}
.app-header__brand i { color: var(--accent-strong); font-size: 1.4rem; }
.app-header__brand:hover { text-decoration: none; color: var(--text); }

.app-header__nav { display: flex; gap: 1rem; }
.app-header__link { color: var(--text-dim); font-weight: 500; }
.app-header__link:hover { color: var(--text); text-decoration: none; }

.app-header__ad {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 1.25rem;
}
.app-header__ad:empty { display: none; }

.app-body {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    gap: 1.5rem;
    max-width: var(--max-w);
    width: 100%;
    margin: 0 auto;
    padding: 1.5rem 1.25rem;
    flex: 1;
}

.app-sidebar {
    position: sticky;
    top: calc(var(--header-h) + 1rem);
    align-self: start;
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 1rem;
    max-height: calc(100vh - var(--header-h) - 2rem);
    overflow: auto;
}
.app-sidebar__title {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-faint);
    margin-bottom: .5rem;
}
.app-sidebar__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.app-sidebar__item {
    display: grid;
    grid-template-columns: 18px 1fr auto;
    align-items: center;
    gap: .55rem;
    padding: .5rem .65rem;
    border-radius: var(--r-sm);
    color: var(--text-dim);
    transition: background-color .15s, color .15s;
}
.app-sidebar__item i { color: var(--accent, var(--accent-strong)); font-size: 1rem; }
.app-sidebar__item:hover {
    background: var(--bg-hover);
    color: var(--text);
    text-decoration: none;
}
.app-sidebar__count {
    font-size: .7rem;
    background: var(--bg-3);
    color: var(--text-dim);
    padding: 1px 7px;
    border-radius: 999px;
}
.app-sidebar__ad { margin-top: 1rem; }

.app-main { min-width: 0; }

.app-footer { border-top: 1px solid var(--border); background: var(--bg-1); margin-top: auto; }
.app-footer__ad { max-width: var(--max-w); margin: 0 auto; padding: 0 1.25rem; }
.app-footer__inner {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 1.25rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    color: var(--text-dim);
    font-size: .85rem;
}
.app-footer__nav { display: flex; gap: 1rem; }
.app-footer__nav a { color: var(--text-dim); }
.app-footer__nav a:hover { color: var(--text); }

/* =========================================================
   Search bar
   ========================================================= */
.searchbar {
    display: grid;
    grid-template-columns: 20px 1fr auto;
    align-items: center;
    gap: .55rem;
    width: 100%;
    max-width: 600px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: .35rem .9rem;
    transition: border-color .15s, box-shadow .15s;
}
.searchbar:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(124, 108, 243, 0.2);
}
.searchbar__icon { color: var(--text-faint); font-size: 1rem; }
.searchbar__input {
    background: transparent;
    border: none;
    color: var(--text);
    font-size: .95rem;
    outline: none;
    width: 100%;
}
.searchbar__input::placeholder { color: var(--text-faint); }
.searchbar__submit {
    background: var(--accent);
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color .15s;
}
.searchbar__submit:hover { background: var(--accent-strong); }

/* =========================================================
   Hero / sections
   ========================================================= */
.hero {
    padding: 1.5rem 0 2rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}
.hero__title { font-size: 2rem; margin-bottom: .5rem; }
.hero__sub { color: var(--text-dim); font-size: 1.05rem; max-width: 64ch; }

.cat-section {
    margin-bottom: 2.5rem;
}
.cat-section__head {
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    gap: .75rem;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: .5rem;
    border-bottom: 1px solid var(--border);
}
.cat-section__head i { color: var(--accent); font-size: 1.2rem; }
.cat-section__name { font-size: 1.1rem; font-weight: 600; }
.cat-section__name a { color: var(--text); }
.cat-section__count {
    font-size: .75rem;
    background: color-mix(in srgb, var(--accent) 18%, transparent);
    color: var(--accent);
    padding: 2px 9px;
    border-radius: 999px;
    font-weight: 600;
}
.cat-section__desc { grid-column: 1 / -1; color: var(--text-dim); font-size: .85rem; margin: 0; }
.cat-section__empty { color: var(--text-faint); font-size: .9rem; padding: 1rem; background: var(--bg-1); border: 1px dashed var(--border); border-radius: var(--r-md); }
.cat-section__more {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    margin-top: .9rem;
    padding: .45rem .8rem;
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    color: var(--text-dim);
    font-size: .85rem;
    font-weight: 500;
    transition: background-color .15s, border-color .15s, color .15s;
}
.cat-section__more:hover {
    background: var(--bg-2);
    border-color: var(--accent);
    color: var(--accent-strong);
    text-decoration: none;
}
.cat-section__more i { font-size: 1rem; }

/* =========================================================
   Tool grid + cards
   ========================================================= */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: .75rem;
}
.tool-card {
    display: block;
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: .9rem 1rem;
    color: var(--text);
    transition: background-color .15s, border-color .15s, transform .15s;
    position: relative;
    overflow: hidden;
}
.tool-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: var(--accent, var(--accent-strong));
    opacity: .35;
    transition: opacity .15s, width .15s;
}
.tool-card:hover {
    background: var(--bg-2);
    border-color: var(--border-strong);
    text-decoration: none;
    transform: translateY(-1px);
}
.tool-card:hover::before { opacity: 1; width: 4px; }
.tool-card__icon { font-size: 1.15rem; color: var(--accent, var(--accent-strong)); display: block; margin-bottom: .35rem; }
.tool-card__name { font-weight: 600; font-size: .95rem; margin-bottom: 2px; }
.tool-card__desc { color: var(--text-dim); font-size: .82rem; line-height: 1.4; }

/* =========================================================
   Category cards (homepage / search results)
   ========================================================= */
.cat-card {
    display: block;
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 1rem;
    color: var(--text);
}
.cat-card:hover { background: var(--bg-2); text-decoration: none; }
.cat-card__head { display: flex; align-items: center; gap: .5rem; }
.cat-card__head i { color: var(--accent, var(--accent-strong)); font-size: 1.1rem; }
.cat-card__name { font-weight: 600; font-size: .95rem; }
.cat-card__count { margin-left: auto; font-size: .7rem; color: var(--text-faint); }
.cat-card__desc { font-size: .82rem; color: var(--text-dim); margin-top: .25rem; }

/* =========================================================
   Category page
   ========================================================= */
.cat-page__head {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1rem;
    align-items: center;
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
}
.cat-page__icon { color: var(--accent, var(--accent-strong)); font-size: 2rem; }
.cat-page__count { color: var(--text-dim); font-size: .85rem; }

/* =========================================================
   Tool page
   ========================================================= */
.tool-page__head {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1rem;
    align-items: center;
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}
.tool-page__icon { color: var(--accent, var(--accent-strong)); font-size: 2rem; }
.tool-page__desc { color: var(--text-dim); margin: .25rem 0 0; }
.tool-page__layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1.25rem;
}
.tool-page__main {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 1.25rem;
}
.tool-page__aside { display: flex; flex-direction: column; gap: 1rem; }
.tool-page__related {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: .9rem 1rem;
}
.tool-page__related h3 { font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); margin-bottom: .5rem; }
.tool-page__related ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.tool-page__related li a {
    display: flex;
    align-items: center;
    gap: .5rem;
    color: var(--text-dim);
    padding: .35rem .5rem;
    border-radius: var(--r-sm);
}
.tool-page__related li a:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.tool-page__about {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    color: var(--text-dim);
}

/* =========================================================
   Breadcrumbs
   ========================================================= */
.breadcrumbs ol {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
    margin: 0 0 .75rem 0;
    padding: 0;
    font-size: .82rem;
}
.breadcrumbs a { color: var(--text-dim); }
.breadcrumbs a:hover { color: var(--text); }
.breadcrumbs__sep { color: var(--text-faint); margin: 0 .25rem; }

/* =========================================================
   Search page
   ========================================================= */
.search-page { display: flex; flex-direction: column; gap: 1rem; }
.search-page__hint, .search-page__meta { color: var(--text-dim); }
.search-page__meta strong { color: var(--text); }

/* =========================================================
   Static content pages
   ========================================================= */
.content-page {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 1.5rem;
    max-width: 72ch;
}
.content-page h1 { margin-bottom: 1rem; }
.content-page h2 { margin-top: 1.5rem; }
.content-page p, .content-page li { color: var(--text-dim); }

/* =========================================================
   Empty / not-found states
   ========================================================= */
.empty {
    background: var(--bg-1);
    border: 1px dashed var(--border);
    border-radius: var(--r-md);
    padding: 2rem;
    text-align: center;
    color: var(--text-dim);
}
.empty h1, .empty h2 { color: var(--text); }

/* =========================================================
   Buttons / inputs (used inside tools)
   ========================================================= */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    border: 1px solid var(--border);
    background: var(--bg-2);
    color: var(--text);
    padding: .5rem .9rem;
    border-radius: var(--r-sm);
    font-size: .9rem;
    cursor: pointer;
    transition: background-color .15s, border-color .15s;
}
.btn:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-ghost { background: transparent; }

select, input[type="text"], input[type="number"], input[type="search"], textarea {
    background: var(--bg-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: .45rem .65rem;
    font-family: inherit;
    font-size: .9rem;
    outline: none;
}
select:focus, input:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(124, 108, 243, 0.2);
}
textarea { font-family: var(--font-mono); resize: vertical; min-height: 80px; width: 100%; }

label { display: inline-flex; flex-direction: column; gap: .25rem; font-size: .8rem; color: var(--text-dim); }

/* =========================================================
   Ad slots
   ========================================================= */
.ad-slot { width: 100%; margin: 1rem 0; }
.ad-slot--header { margin: 0 0 .5rem; min-height: 90px; }
.ad-slot--sidebar { min-height: 250px; }
.ad-slot--footer { min-height: 90px; margin: 1rem 0 0; }
.ad-slot--placeholder {
    background: repeating-linear-gradient(45deg, var(--bg-1), var(--bg-1) 8px, var(--bg-2) 8px, var(--bg-2) 16px);
    border: 1px dashed var(--border);
    border-radius: var(--r-sm);
    color: var(--text-faint);
    font-size: .75rem;
    text-align: center;
    padding: .5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* =========================================================
   Generic tool shell (used by simple text-transform tools)
   ========================================================= */
.tool-shell { display: flex; flex-direction: column; gap: 1rem; }
.tool-shell__controls { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; padding-bottom: .75rem; border-bottom: 1px solid var(--border); }
.tool-shell__io { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: stretch; }
.tool-shell__col { display: flex; flex-direction: column; gap: .35rem; }
.tool-shell__col > textarea { flex: 1; min-height: 220px; }
.tool-shell__below { margin-top: .5rem; }
@media (max-width: 720px) {
    .tool-shell__io { grid-template-columns: 1fr; }
}

/* =========================================================
   Copyable output
   ========================================================= */
.copyable { position: relative; }
.copyable__output { width: 100%; padding-right: 5rem; }
.copyable__code { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: .75rem 5rem .75rem .75rem; font-family: var(--font-mono); font-size: .85rem; max-height: 320px; overflow: auto; white-space: pre-wrap; word-break: break-word; }
.copyable__btn { position: absolute; top: .35rem; right: .35rem; font-size: .8rem; padding: .3rem .55rem; }

/* =========================================================
   Stats grid (used by Word Counter etc.)
   ========================================================= */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .5rem; }
.stat { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: .65rem .85rem; }
.stat__value { font-size: 1.4rem; font-weight: 600; color: var(--text); }
.stat__label { font-size: .72rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: .04em; }

/* =========================================================
   Diff viewer
   ========================================================= */
.diff { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.diff__col { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: .5rem; font-family: var(--font-mono); font-size: .85rem; min-height: 220px; max-height: 480px; overflow: auto; }
.diff__line { padding: 0 .25rem; display: block; white-space: pre-wrap; word-break: break-word; }
.diff__line--add { background: rgba(86, 211, 100, 0.15); color: #b8f0c5; }
.diff__line--del { background: rgba(229, 72, 77, 0.18); color: #fcc1c3; text-decoration: line-through; }
.diff__line--eq { color: var(--text-dim); }
.diff__line--ctx { color: var(--text-faint); }
@media (max-width: 720px) {
    .diff { grid-template-columns: 1fr; }
}

/* =========================================================
   Color tools
   ========================================================= */
.color-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.color-input { display: inline-flex; align-items: center; gap: .5rem; }
.color-input input[type="color"] { width: 48px; height: 36px; padding: 0; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--bg-2); cursor: pointer; }

.swatch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .5rem; margin-top: .75rem; }
.swatch { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; background: var(--bg-2); cursor: pointer; }
.swatch__chip { height: 60px; }
.swatch__label { font-family: var(--font-mono); font-size: .75rem; color: var(--text); padding: .35rem .5rem; text-align: center; background: var(--bg-2); }
.swatch.is-light .swatch__label { color: var(--text); }

.preview-large { height: 96px; border-radius: var(--r-md); border: 1px solid var(--border); }
.preview-strip { height: 28px; border-radius: var(--r-sm); border: 1px solid var(--border); }
.gradient-preview { height: 160px; border-radius: var(--r-md); border: 1px solid var(--border); }

.kbd { display: inline-block; padding: 1px 5px; border-radius: 4px; background: var(--bg-2); border: 1px solid var(--border); font-family: var(--font-mono); font-size: .75rem; color: var(--text-dim); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .72rem; font-weight: 600; }
.badge--good { background: rgba(86, 211, 100, 0.18); color: #a7e3b3; }
.badge--bad  { background: rgba(229, 72, 77, 0.18); color: #fcb6b9; }
.badge--meh  { background: rgba(250, 184, 0, 0.16); color: #fce0a7; }

/* =========================================================
   Emoji picker
   ========================================================= */
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 4px; max-height: 360px; overflow: auto; padding-top: .5rem; }
.emoji-btn { background: transparent; border: 1px solid transparent; border-radius: var(--r-sm); padding: 4px; font-size: 1.5rem; line-height: 1; cursor: pointer; }
.emoji-btn:hover { background: var(--bg-hover); border-color: var(--border); }
.emoji-section-title { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-faint); margin: .75rem 0 .25rem; }

/* =========================================================
   Markdown preview
   ========================================================= */
.md-preview { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 1rem; min-height: 220px; max-height: 540px; overflow: auto; }
.md-preview h1, .md-preview h2, .md-preview h3 { color: var(--text); margin: 1em 0 .4em; }
.md-preview p { color: var(--text-dim); }
.md-preview code { background: var(--bg-3); }
.md-preview pre { background: var(--bg-3); padding: .75rem; border-radius: var(--r-sm); overflow: auto; }
.md-preview blockquote { border-left: 3px solid var(--border-strong); padding: 0 1rem; color: var(--text-faint); margin: 1em 0; }
.md-preview a { color: var(--accent-strong); }

/* =========================================================
   Tool-specific: UUID generator
   ========================================================= */
.tool-uuid { display: flex; flex-direction: column; gap: .9rem; }
.tool-uuid__controls { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; }
.tool-uuid__label { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-faint); }
.tool-uuid__select, .tool-uuid__input { min-width: 90px; }
.tool-uuid__check { flex-direction: row; align-items: center; gap: .35rem; color: var(--text); }
.tool-uuid__meta { font-size: .8rem; color: var(--text-faint); margin-bottom: .35rem; }
.tool-uuid__output { font-family: var(--font-mono); font-size: .9rem; }

/* =========================================================
   Phase 3: shared form/UI atoms
   ========================================================= */
.control-row {
    display: flex;
    flex-wrap: wrap;
    gap: .85rem;
    align-items: center;
    width: 100%;
}
.radio, .checkbox {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: .35rem;
    color: var(--text-dim);
    font-size: .82rem;
    cursor: pointer;
    user-select: none;
}
.radio input, .checkbox input { accent-color: var(--accent); }
.radio:hover, .checkbox:hover { color: var(--text); }

.callout {
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    padding: .8rem 1rem;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    font-size: .85rem;
    color: var(--text-dim);
    background: var(--bg-2);
    margin: .5rem 0;
}
.callout i { color: var(--accent-strong); font-size: 1.1rem; margin-top: 1px; }
.callout strong { color: var(--text); }
.callout--info    { background: rgba(124, 108, 243, 0.10); border-color: rgba(124, 108, 243, 0.30); }
.callout--success { background: rgba(86, 211, 100, 0.10); border-color: rgba(86, 211, 100, 0.30); }
.callout--success i { color: #6ce28a; }
.callout--warn    { background: rgba(229, 72, 77, 0.10); border-color: rgba(229, 72, 77, 0.30); }
.callout--warn i  { color: #ef7d80; }

.quick-pills { display: inline-flex; flex-wrap: wrap; gap: .35rem; }
.pill {
    background: var(--bg-2);
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: .25rem .65rem;
    font-size: .75rem;
    border-radius: 999px;
    cursor: pointer;
    transition: background-color .12s, border-color .12s, color .12s;
    font-family: var(--font-mono);
}
.pill:hover { background: var(--bg-hover); color: var(--text); border-color: var(--border-strong); }

.chip-row { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip {
    background: var(--bg-2);
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: .35rem .75rem;
    font-size: .8rem;
    border-radius: 999px;
    cursor: pointer;
    transition: background-color .12s, color .12s, border-color .12s;
}
.chip:hover { background: var(--bg-hover); color: var(--text); }
.chip--on {
    background: color-mix(in srgb, var(--accent) 22%, transparent);
    border-color: var(--accent);
    color: var(--text);
}
.chip--ok   { background: color-mix(in srgb, #2e8b57 22%, transparent); border-color: #2e8b57; color: #2e8b57; }
.chip--warn { background: color-mix(in srgb, #d99000 22%, transparent); border-color: #d99000; color: #d99000; }
.chip--err  { background: color-mix(in srgb, #b03030 22%, transparent); border-color: #b03030; color: #b03030; }

.image-output {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 1rem;
    text-align: center;
}
.image-output img {
    max-width: 100%;
    max-height: 480px;
    background-image:
        linear-gradient(45deg, var(--bg-3) 25%, transparent 25%),
        linear-gradient(-45deg, var(--bg-3) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, var(--bg-3) 75%),
        linear-gradient(-45deg, transparent 75%, var(--bg-3) 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    border-radius: var(--r-md);
}
.image-output__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: .75rem;
    color: var(--text-faint);
    font-size: .85rem;
}

.palette-row {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin: .75rem 0;
}
.palette-row__swatch {
    flex: 1 1 110px;
    min-height: 90px;
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    display: flex;
    align-items: flex-end;
    padding: .5rem .75rem;
    font-family: var(--font-mono);
    font-size: .8rem;
}
.palette-row__label small { opacity: .85; }

/* === Admin dashboard ====================================================== */
.admin-section {
    margin: 2rem 0;
}
.admin-section h2 {
    font-size: 1.1rem;
    margin-bottom: .75rem;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: .04em;
}
.admin-list {
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: rank;
}
.admin-list li {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 1rem;
    align-items: center;
    padding: .5rem .25rem;
    border-bottom: 1px solid var(--border);
}
.admin-list li::before {
    counter-increment: rank;
    content: counter(rank);
    color: var(--text-faint);
    font-family: var(--font-mono);
    font-size: .8rem;
    margin-right: .5rem;
}
.admin-list--plain li { grid-template-columns: 1fr auto; }
.admin-list__bar {
    width: 220px;
    height: 8px;
    background: var(--bg-3);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}
.admin-list__bar::after {
    content: "";
    display: block;
    height: 100%;
    width: var(--pct, 0%);
    background: var(--accent, #534AB7);
}
.admin-list__count {
    font-variant-numeric: tabular-nums;
    color: var(--text-faint);
    min-width: 4rem;
    text-align: right;
}
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}
.admin-table th, .admin-table td {
    padding: .5rem .75rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
}
.admin-table th.num, .admin-table td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.daily-bars {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 140px;
    padding: .5rem;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
}
.daily-bars__col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    min-width: 0;
}
.daily-bars__bar {
    background: linear-gradient(to top, #534AB7, #7d75d8);
    border-radius: 2px;
    min-height: 1px;
    transition: height .15s ease-in-out;
}
.daily-bars__label {
    text-align: center;
    font-size: .65rem;
    color: var(--text-faint);
    font-variant-numeric: tabular-nums;
}

/* === Accessibility ======================================================= */
.skip-link {
    position: absolute;
    top: -100px;
    left: 1rem;
    z-index: 1000;
    padding: .75rem 1rem;
    background: var(--accent, #534AB7);
    color: white;
    border-radius: var(--r-md);
    font-weight: 600;
    text-decoration: none;
    transition: top .15s ease-in-out;
}
.skip-link:focus {
    top: 1rem;
    outline: 2px solid white;
    outline-offset: 2px;
}
.app-main:focus { outline: none; }

/* === Related-tools sidebar (tag-overlap recommender) ===================== */
.tool-page__related {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
}
.tool-page__related h3 {
    margin: 0 0 .75rem 0;
    font-size: .85rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-faint);
}
.tool-page__related ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: .25rem;
}
.tool-page__related a {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .4rem .5rem;
    border-radius: var(--r-sm);
    color: var(--text);
    text-decoration: none;
    line-height: 1.3;
}
.tool-page__related a:hover { background: var(--bg-3); }
.tool-page__related .ti { color: var(--accent, var(--text-faint)); flex-shrink: 0; }
.tool-page__related .related__name { flex: 1; }
.tool-page__related .related__cat {
    font-size: .7rem;
    color: var(--text-faint);
    background: var(--bg-1);
    border: 1px solid var(--border);
    padding: 1px .35rem;
    border-radius: 10px;
    white-space: nowrap;
}
.tool-page__related-more {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    margin-top: .75rem;
    font-size: .85rem;
    color: var(--text-faint);
    text-decoration: none;
}
.tool-page__related-more:hover { color: var(--text); }

/* === ExampleLoader pill button =========================================== */
.example-loader {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    margin: 0 0 .25rem 0;
    padding: .25rem .6rem;
    font-size: .8rem;
    color: var(--text-faint);
    background: transparent;
    border: 1px dashed var(--border);
    border-radius: 999px;
    cursor: pointer;
    transition: all .15s ease-in-out;
}
.example-loader:hover {
    color: var(--text);
    border-style: solid;
    border-color: var(--accent, var(--text-faint));
}
.example-loader .ti { color: #d99000; }

.tag {
    display: inline-block;
    background: var(--bg-3);
    color: var(--text-dim);
    padding: 1px 7px;
    border-radius: var(--r-sm);
    font-size: .7rem;
    font-family: var(--font-mono);
}

.kv-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .85rem;
    margin-top: .5rem;
}
.kv-table th, .kv-table td {
    padding: .45rem .75rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}
.kv-table thead th {
    color: var(--text-faint);
    text-transform: uppercase;
    font-size: .68rem;
    letter-spacing: .04em;
    background: var(--bg-1);
}
.kv-table tbody th { color: var(--text-dim); font-weight: 500; width: 180px; }
.kv-table tbody tr:hover { background: var(--bg-1); }

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem;
}
.form-grid > label.span-2 { grid-column: 1 / -1; }
.form-grid > label { gap: .25rem; }
.form-grid input, .form-grid select, .form-grid textarea { width: 100%; }

.below-table { margin-top: .75rem; }

.jwt-output { display: flex; flex-direction: column; gap: .75rem; }
.jwt-section label {
    display: block;
    color: var(--text-faint);
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: .25rem;
}

.bullet-notes {
    list-style: none;
    padding: 0;
    margin: .75rem 0 0;
    font-size: .82rem;
    color: var(--text-dim);
}
.bullet-notes li { display: flex; align-items: center; gap: .4rem; padding: 2px 0; }
.bullet-notes i { color: #fcb6b9; }

.strength-bar {
    display: block;
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow: hidden;
    height: 8px;
    margin: .25rem 0 .75rem;
}
.strength-bar > span { display: block; height: 100%; transition: width .25s, background-color .25s; }
.strength-0 > span { width: 20%;  background: #ef4444; }
.strength-1 > span { width: 40%;  background: #f97316; }
.strength-2 > span { width: 60%;  background: #facc15; }
.strength-3 > span { width: 80%;  background: #a3e635; }
.strength-4 > span { width: 100%; background: #4ade80; }

.totp-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
    padding: 1.25rem;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
}
.totp-code {
    font-family: var(--font-mono);
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--accent-strong);
    letter-spacing: .1em;
}
.totp-meta { color: var(--text-faint); font-size: .8rem; }

.countdown {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .5rem;
    text-align: center;
    margin: .75rem 0;
}
.countdown__cell {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 1rem .5rem;
}
.countdown__num {
    font-family: var(--font-mono);
    font-size: 2.25rem;
    font-weight: 600;
    color: var(--accent-strong);
}
.countdown__lbl {
    color: var(--text-faint);
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}
@media (max-width: 540px) {
    .countdown { grid-template-columns: repeat(2, 1fr); }
}

.serp-preview {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 1rem 1.25rem;
    max-width: 600px;
}
.serp-preview__site { color: var(--text-faint); font-size: .8rem; }
.serp-preview__crumb { color: var(--text-dim); font-size: .8rem; margin-bottom: .35rem; }
.serp-preview__title { color: #1a0dab; font-size: 1.25rem; line-height: 1.3; }
.serp-preview__desc { color: var(--text-dim); font-size: .9rem; margin-top: .25rem; line-height: 1.45; }

.og-card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    overflow: hidden;
    max-width: 540px;
}
.og-card--twitter { border-radius: 16px; }
.og-card__img {
    height: 220px;
    background-size: cover;
    background-position: center;
    background-color: var(--bg-3);
}
.og-card__img--small { height: 120px; }
.og-card__body { padding: .75rem 1rem 1rem; }
.og-card__host { color: var(--text-faint); font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; }
.og-card__title { font-weight: 600; font-size: 1.05rem; margin: .15rem 0; }
.og-card__desc { color: var(--text-dim); font-size: .85rem; line-height: 1.4; }

/* =========================================================
   Error UI (Blazor SSR reconnect)
   ========================================================= */
#blazor-error-ui {
    color-scheme: dark;
    background: var(--bg-2);
    color: var(--text);
    bottom: 0;
    box-shadow: 0 -1px 6px rgba(0,0,0,.6);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: .6rem 1.25rem .7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    border-top: 1px solid var(--border);
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }
#blazor-error-ui .reload { color: var(--accent-strong); margin-left: .5rem; }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1024px) {
    .tool-page__layout { grid-template-columns: 1fr; }
    .tool-page__aside { order: 2; }
}
@media (max-width: 820px) {
    .app-body { grid-template-columns: 1fr; }
    .app-sidebar {
        position: static;
        max-height: none;
    }
}
@media (max-width: 540px) {
    .app-header__inner { grid-template-columns: auto 1fr; gap: .5rem; }
    .app-header__nav { display: none; }
    .hero__title { font-size: 1.5rem; }
    .tool-grid { grid-template-columns: 1fr 1fr; }
}
