/* ============================================================================
   farsimcp — design system (faithful to the marketplace look-and-feel)
   ============================================================================ */

:root {
    --bg: #eceef6;
    --surface: #fff;
    --surface-2: #eef0f8;
    --ink: #0d1230;
    --ink-2: #565e7e;
    --line: #e1e4ef;
    --line-strong: #c9cee2;
    --accent: #1d4ed8;
    --accent-strong: #1e3a8a;
    --accent-soft: #e3ebfd;
    --accent-fill: #1d4ed8;
    --accent-fill-strong: #1e40af;
    --signal: #0b8ea2;
    --signal-soft: #dcf5f8;
    --warn: #9a5b00;
    --warn-soft: #fdf1dc;
    --danger: #c2283c;
    --danger-soft: #fde7ea;
    --code-bg: #0d1230;
    --code-ink: #dfe4ff;
    --on-accent: #fff;
    --selected: #eef3fe;
    --success-ink: #0a6e7c;
    --scrim: #0d123059;

    --cat-ecommerce: #ef4056;
    --cat-classifieds: #e5484d;
    --cat-payment: #2fbf71;
    --cat-messaging: #2f6fed;
    --cat-maps: #22b8cf;
    --cat-finance: #f5a524;
    --cat-cloud: #5b8cff;
    --cat-travel: #38bdf8;
    --cat-content: #d4a373;
    --cat-health: #f472b6;
    --cat-language: #14b8a6;
    --cat-utilities: #34d399;
    --cat-dev: #94a3b8;

    --font: "Vazirmatn", "Vazirmatn Variable", Tahoma, sans-serif;
    --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, monospace;

    --radius-xs: 6px;
    --radius-s: 8px;
    --radius-m: 14px;
    --radius-l: 20px;
    --radius-xl: 28px;
    --radius-pill: 999px;

    /* Fluid type scale (mcpfarsi) */
    --step--2: 0.78rem;
    --step--1: 0.85rem;
    --step-0: 1rem;
    --step-1: 1.2rem;
    --step-2: 1.5rem;
    --step-3: 1.95rem;
    --step-4: clamp(2.1rem, 4.6vw, 3.5rem);

    /* Glassmorphism surfaces */
    --glass-card: #ffffffa8;
    --glass-line: #0d123014;
    --glass-card-shadow: inset 0 1px 0 #fffffff2, 0 1px 2px #0d12300a, 0 8px 24px -12px #0d123029;
    --aura: radial-gradient(70% 55% at 100% 0%, #1d4ed829, transparent 70%),
            radial-gradient(60% 50% at 0% 100%, #0b8ea21f, transparent 70%),
            radial-gradient(45% 40% at 20% 15%, #6366f117, transparent 70%);
    --ease-pop: cubic-bezier(.34, 1.56, .64, 1);
    --dur-pop: .42s;

    --wrap: 74rem;
    --gutter: clamp(16px, 4vw, 40px);
    --sticky-top: 4.25rem;
    color-scheme: light;
}

[data-theme="dark"] {
    --bg: #070a17;
    --surface: #0f152c;
    --surface-2: #151c38;
    --ink: #e8ebf7;
    --ink-2: #8f99bf;
    --line: #1f2849;
    --line-strong: #2e3a66;
    --accent: #6f9cff;
    --accent-strong: #9dbcff;
    --accent-soft: #12224a;
    --accent-fill: #1f4fd1;
    --accent-fill-strong: #2a5fe6;
    --signal: #3fdcea;
    --signal-soft: #0d3340;
    --warn: #f5b544;
    --warn-soft: #3a2a0c;
    --danger: #ff7586;
    --danger-soft: #3d1620;
    --code-bg: #060917;
    --code-ink: #dfe4ff;
    --on-accent: #fff;
    --selected: #0f1d40;
    --success-ink: #7ae1ee;
    --scrim: #0508148c;
    --glass-card: #161e3e8c;
    --glass-line: #ffffff12;
    --glass-card-shadow: inset 0 1px 0 #ffffff14, 0 1px 2px #0003, 0 12px 28px -14px #00000080;
    --aura: radial-gradient(70% 55% at 100% 0%, #1f4fd152, transparent 70%),
            radial-gradient(60% 50% at 0% 100%, #3fdcea1f, transparent 70%),
            radial-gradient(45% 40% at 20% 15%, #6f9cff24, transparent 70%);
    color-scheme: dark;
}

@media (min-width: 60rem) {
    :root { --sticky-top: 5.5rem; }
}

/* ---- reset ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: var(--sticky-top); }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.75;
    color: var(--ink);
    background:
        var(--aura),
        var(--bg);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; height: auto; display: inline-block; vertical-align: middle; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 0.4em; font-weight: 900; color: var(--ink); letter-spacing: -0.01em; }
h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-3); font-weight: 800; }
h3 { font-size: var(--step-1); font-weight: 700; }
h4 { font-size: var(--step-0); font-weight: 700; }
p { margin: 0 0 1em; }
code, .mono {
    font-family: var(--mono);
    font-size: 0.88em;
    direction: ltr;
    unicode-bidi: embed;
}
pre {
    background: var(--code-bg);
    color: var(--code-ink);
    padding: 1rem 1.25rem;
    border-radius: var(--radius-m);
    overflow-x: auto;
    direction: ltr;
    text-align: left;
    font-family: var(--mono);
    font-size: 0.88rem;
    line-height: 1.6;
}
.ltr { direction: ltr; unicode-bidi: isolate; }
.visually-hidden {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.muted { color: var(--ink-2); }

/* ---- layout --------------------------------------------------------------- */
.wrap {
    max-width: var(--wrap);
    margin-inline: auto;
    padding-inline: var(--gutter);
}
.block { margin-top: clamp(2.5rem, 6vw, 3.5rem); }

/* ---- top announcement bar ------------------------------------------------- */
.announce {
    position: relative;
    background: var(--accent);
    color: var(--on-accent);
    text-align: center;
    font-size: 0.9rem;
    padding: 0.5rem calc(var(--gutter) + 2rem);
}
.announce a { color: var(--on-accent); font-weight: 700; text-decoration: underline; }
.announce-x {
    position: absolute;
    inset-inline-end: 0.6rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.6rem;
    height: 1.6rem;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: color-mix(in srgb, var(--on-accent) 18%, transparent);
    color: var(--on-accent);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
}
.announce-x:hover { background: color-mix(in srgb, var(--on-accent) 30%, transparent); }
[hidden] { display: none !important; }

/* ---- header --------------------------------------------------------------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--line);
}
.site-header .bar {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.6rem 0.8rem;
    min-height: var(--sticky-top);
    padding-block: 0.5rem;
    /* the header gets the full window width (the page content keeps its narrower
       measure): the nav, search and account links then fit on one line instead of
       being cut off at the end of a 74rem column */
    max-width: 100%;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--ink);
}
.brand:hover { text-decoration: none; }
.brand .mark {
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius-s);
    background: var(--accent-fill);
    color: var(--on-accent);
    font-size: 1rem;
}
.brand .mark svg { width: 1.15rem; height: 1.15rem; }

/* the nav takes the slack between the brand and the actions; on a narrow desktop it
   scrolls sideways rather than breaking the header into ragged rows */
.main-nav {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.25rem;
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
}
.main-nav::-webkit-scrollbar { display: none; }
.main-nav a {
    color: var(--ink-2);
    padding: 0.4rem 0.6rem;
    border-radius: var(--radius-s);
    font-size: 0.95rem;
    white-space: nowrap;
    flex: none;
}
/* the secondary group is one unbreakable row: as a plain inline span it used to be
   squeezed to min-content and its links stacked on three lines inside the header */
.main-nav .hide-m { display: inline-flex; align-items: center; gap: 0.25rem; flex: none; }
.main-nav a:hover { color: var(--ink); text-decoration: none; background: var(--surface-2); }
.main-nav a.on { color: var(--accent); font-weight: 700; }
.main-nav .sep { color: var(--line-strong); }

/* account links + theme toggle: one group, so a wrap moves them together instead of
   splitting "حساب" and "خروج" onto different rows */
.bar-actions { display: flex; align-items: center; gap: 0.5rem; flex: none; }

.search-form { position: relative; display: flex; align-items: center; flex: 0 1 auto; min-width: 0; }
.search-form input[type="search"] {
    width: 10rem;
    padding: 0.45rem 0.9rem;
    padding-inline-end: 2.2rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--ink);
    font-family: var(--font);
    font-size: 0.9rem;
}
.search-form input:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.search-form button {
    position: absolute;
    inset-inline-end: 0.5rem;
    border: 0; background: none; color: var(--ink-2); cursor: pointer;
}
.search-form button svg { width: 1rem; height: 1rem; }

/* ---- buttons -------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5em;
    min-height: 44px;
    padding: 0.4em 1.1em;
    border-radius: var(--radius-pill);
    border: 1px solid var(--line-strong);
    background: var(--surface);
    font-family: var(--font);
    font-size: var(--step-0);
    font-weight: 600;
    cursor: pointer;
    line-height: 1.4;
    color: var(--ink);
    text-decoration: none;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease, transform var(--dur-pop) var(--ease-pop);
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent-fill); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-fill-strong); border-color: var(--accent-strong); }
.btn-ghost { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-s { padding: 0 0.8rem; min-height: 34px; font-size: var(--step--1); }
.btn-l { padding: 0.6em 1.5em; font-size: var(--step-1); }
.btn:active { transform: translateY(1px); }

/* ---- hero ----------------------------------------------------------------- */
.hero {
    position: relative;
    padding-block: clamp(1.75rem, 4vw, 3rem) 2rem;
    text-align: center;
    border-bottom: 1px solid var(--line);
}
/* two columns on desktop, like the reference: promise on one side, a worked
   example on the other */
.hero-grid {
    display: grid;
    gap: clamp(1.5rem, 4vw, 2.5rem);
    align-items: center;
    grid-template-columns: 1fr;
    text-align: center;
}
/* the code sample inside the hero card is unbreakable by nature; without this the grid
   column grows to the sample's min-content width and pushes the whole page sideways */
.hero-grid > * { min-width: 0; }
@media (min-width: 64rem) {
    .hero-grid { grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); text-align: start; }
    .hero-grid .hero-text { text-align: start; }
    .hero-grid .hero-text p.lead,
    .hero-grid .hero-search { margin-inline: 0; }
    .hero-grid .hero-text .meta { text-align: start; }
}
.hero-text > *:first-child { margin-top: 0; }
.hero .kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--accent);
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}
.hero .kicker .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--signal); }
.hero p.lead { max-width: 42rem; margin: 0.8rem auto 1.5rem; color: var(--ink-2); font-size: 1.1rem; }
.hero .meta { color: var(--ink-2); font-size: 0.85rem; margin-top: 0.75rem; }
.hero-search { max-width: 40rem; margin-inline: auto; }
.hero-search .search-form input[type="search"] { width: 100%; padding: 0.8rem 1.2rem; padding-inline-end: 3rem; font-size: 1rem; border-radius: var(--radius-pill); }
.hero-search .search-form button { inset-inline-end: 0.9rem; }

/* the worked example that sits beside the headline */
.hero-demo {
    background: var(--glass-card, var(--surface));
    border: 1px solid var(--glass-line, var(--line));
    border-radius: var(--radius-l);
    box-shadow: var(--glass-card-shadow, none);
    padding: 1rem 1.1rem 1.15rem;
    text-align: start;
    min-width: 0;
    overflow: hidden;
}
.hero-demo .dots { display: flex; gap: 0.35rem; margin-bottom: 0.85rem; }
.hero-demo .dots i { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--line-strong); }
.hero-demo .q {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0 0 0.85rem;
}
.hero-demo .q .tile { flex: none; width: 2rem; height: 2rem; border-radius: var(--radius-s); font-size: 0.9rem; }
.hero-demo .call {
    position: relative;
    background: var(--code-bg);
    color: var(--code-ink);
    border-radius: var(--radius-s);
    padding: 0.6rem 3.6rem 0.6rem 0.75rem;
    font-family: var(--mono);
    font-size: 0.8rem;
    direction: ltr;
    text-align: left;
    overflow-wrap: anywhere;
    margin: 0;
}
.hero-demo .call .copy-btn {
    position: absolute;
    top: 0.35rem;
    right: 0.4rem;
    background: color-mix(in srgb, var(--code-ink) 14%, transparent);
    color: var(--code-ink);
    border-color: color-mix(in srgb, var(--code-ink) 30%, transparent);
}
.hero-demo .a { color: var(--ink-2); font-size: 0.85rem; margin: 0.8rem 0 0; }

/* ---- tiles / badges / cards ---------------------------------------------- */
.tile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-m);
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--ink);
    overflow: hidden;
}
.tile-s { width: 2.75rem; height: 2.75rem; border-radius: var(--radius-s); }
.tile-m { width: 3.5rem; height: 3.5rem; }
.tile-logo {
    background: color-mix(in srgb, var(--tile, var(--accent)) 14%, var(--surface));
    border-color: color-mix(in srgb, var(--tile, var(--accent)) 34%, var(--line));
    color: var(--tile, var(--accent));
    font-weight: 700;
    font-size: 1.2rem;
}
.tile-logo img { width: 60%; height: 60%; object-fit: contain; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    padding: 0 0.6em;
    border-radius: var(--radius-xs);
    font-size: var(--step--2);
    font-weight: 600;
    line-height: 1.9;
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--ink-2);
    white-space: nowrap;
}
.badge-official { color: var(--success-ink); border-color: color-mix(in srgb, var(--signal) 40%, var(--line)); background: var(--signal-soft); }
.badge-first-party { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); background: var(--accent-soft); }
.badge-warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); background: var(--warn-soft); }
.badge-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); background: var(--danger-soft); }
.mode-local { color: var(--ink-2); }
.mode-hosted { color: var(--accent); }
.mode-remote { color: var(--signal); border-style: dashed; }

/* ---- card grid ------------------------------------------------------------ */
.card-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
}
@media (min-width: 40rem) { .card-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 64rem) { .card-grid { grid-template-columns: 1fr 1fr 1fr; } }

.card {
    display: grid;
    grid-template-rows: auto 1fr auto auto;
    gap: 0.6rem;
    background: var(--glass-card);
    border: 1px solid var(--glass-line);
    border-radius: var(--radius-l);
    box-shadow: var(--glass-card-shadow);
    padding: 0.95rem 1rem;
    transition: border-color 0.15s ease, transform var(--dur-pop) var(--ease-pop), box-shadow 0.15s ease;
}
.card:hover {
    border-color: var(--line-strong);
    transform: translateY(-2px);
    text-decoration: none;
}
.card-head { display: flex; gap: 0.75rem; align-items: center; }
.card-title { min-width: 0; flex: 1; line-height: 1.5; }
.card-title h3 { margin: 0; font-size: var(--step-0); }
.card-title h3 a { color: var(--ink); }
.card-title h3 a:hover { color: var(--accent); text-decoration: none; }
.card-en { display: block; color: var(--ink-2); font-size: var(--step--2); }
.card-summary { margin: 0; color: var(--ink-2); font-size: var(--step--1); line-height: 1.75; align-self: start; }
.card-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; margin: 0; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.card-n { color: var(--ink-2); font-size: var(--step--2); white-space: nowrap; }

/* ---- section headers ------------------------------------------------------ */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.section-head h2 { margin: 0; }
.section-head a.more { color: var(--accent); font-weight: 700; font-size: 0.9rem; white-space: nowrap; }

/* ---- category pills ------------------------------------------------------- */
.cats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    list-style: none;
    margin: 0;
    padding: 0;
}
.cats li a {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.9rem;
    border-radius: var(--radius-pill);
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    font-size: 0.9rem;
}
.cats li a:hover { border-color: var(--cat, var(--accent)); color: var(--ink); text-decoration: none; }
.cats li a .swatch { width: 10px; height: 10px; border-radius: 50%; background: var(--cat, var(--accent)); }
.cats li a .count { color: var(--ink-2); font-size: 0.8rem; }

/* ---- example / showcase --------------------------------------------------- */
.examples { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 52rem) { .examples { grid-template-columns: 1fr 1fr; } }
.examples > * { min-width: 0; }
.example {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-l);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 0;
}
.example .q { font-weight: 700; }
.example .call {
    background: var(--code-bg);
    color: var(--code-ink);
    border-radius: var(--radius-s);
    padding: 0.55rem 0.8rem;
    font-family: var(--mono);
    font-size: 0.82rem;
    direction: ltr;
    text-align: left;
    /* a long tool call must wrap on a phone instead of widening the whole page */
    overflow-wrap: anywhere;
}
.example .a { color: var(--ink-2); font-size: 0.9rem; margin: 0; }
.example .tile { flex: none; }
.example .ex-head { display: flex; gap: 0.75rem; align-items: center; }
.example .ex-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-top: auto; }

/* ---- app / client grid ---------------------------------------------------- */
.app-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 40rem) { .app-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 64rem) { .app-grid { grid-template-columns: repeat(5, 1fr); } }
.app-grid a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 1rem 0.75rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-m);
    background: var(--surface);
    color: var(--ink);
    text-align: center;
    font-size: 0.85rem;
}
.app-grid a:hover { border-color: var(--accent); text-decoration: none; }
.app-grid .app-ico {
    width: 2.25rem;
    height: 2.25rem;
    display: grid;
    place-items: center;
    border-radius: var(--radius-s);
    background: var(--surface-2);
    color: var(--ink);
}
.app-grid .app-ico svg { width: 1.3rem; height: 1.3rem; }

/* ---- how / feature rows --------------------------------------------------- */
.how {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: 1fr;
}
@media (min-width: 52rem) { .how { grid-template-columns: 1fr 1fr 1fr; } }
.how .step {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-l);
    padding: 1.25rem;
}
.how .step .n {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 700;
    margin-bottom: 0.6rem;
}
.how .step h3 { font-size: 1.05rem; }
.how .step p { margin: 0; color: var(--ink-2); font-size: 0.9rem; }

/* ---- skills list ---------------------------------------------------------- */
.skill-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.skill-list > li { margin: 0; }
.skill-list a {
    display: flex;
    gap: 0.9rem;
    align-items: center;
    padding: 1rem 1.1rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-m);
    color: var(--ink);
}
.skill-list a:hover { border-color: var(--accent); text-decoration: none; }
.skill-main { min-width: 0; }
.skill-title { display: block; font-size: 1rem; }
.skill-summary { display: block; color: var(--ink-2); font-size: 0.88rem; }

/* ---- CTA ------------------------------------------------------------------ */
.cta {
    margin-block: 2.5rem;
    padding: 2rem;
    border-radius: var(--radius-xl);
    background:
        radial-gradient(60% 120% at 100% 0%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 70%),
        var(--surface);
    border: 1px solid var(--line);
    text-align: center;
}
.cta h2 { font-size: 1.5rem; }
.cta p { color: var(--ink-2); max-width: 40rem; margin-inline: auto; }

/* ---- sponsors ------------------------------------------------------------- */
.sponsors {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 40rem) { .sponsors { grid-template-columns: repeat(4, 1fr); } }
.sponsors .slot {
    display: grid;
    place-items: center;
    padding: 1rem;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-m);
    color: var(--ink-2);
    font-size: 0.85rem;
    min-height: 4rem;
}
.sponsors a.slot:hover { border-color: var(--accent); text-decoration: none; }

/* ---- footer --------------------------------------------------------------- */
.site-footer {
    border-top: 1px solid var(--line);
    background: var(--surface);
    margin-top: clamp(2.5rem, 6vw, 4rem);
    padding-block: 2.75rem 1.25rem;
}
.site-footer .cols {
    display: grid;
    gap: 2rem;
    grid-template-columns: 1fr;
    align-items: start;
}
@media (min-width: 52rem) { .site-footer .cols { grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 2.5rem; } }
.site-footer .about p { color: var(--ink-2); font-size: 0.9rem; margin-bottom: 0.7rem; }
/* phone numbers and the ecosystem line under the footer brand */
.foot-contact {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.5rem;
    margin-bottom: 0.5rem !important;
    font-size: 0.9rem;
}
.foot-contact a { color: var(--ink); font-variant-numeric: tabular-nums; }
.foot-contact a:hover { color: var(--accent); text-decoration: none; }
.foot-dot { color: var(--line-strong); }
.foot-eco { font-size: 0.85rem; }
.foot-eco a { color: var(--accent); font-weight: 700; }
.site-footer h3 { font-size: 0.95rem; margin-bottom: 0.85rem; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer ul li { margin-bottom: 0.45rem; }
.site-footer ul a { color: var(--ink-2); font-size: 0.9rem; }
.site-footer ul a:hover { color: var(--accent); }
/* a link-shaped button: opens the feedback dialog without looking like a control */
.foot-link {
    border: 0;
    background: none;
    padding: 0;
    cursor: pointer;
    font-family: var(--font);
    font-size: 0.9rem;
    color: var(--ink-2);
    text-align: start;
}
.foot-link:hover { color: var(--accent); text-decoration: underline; }
.foot-bottom {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem 1.5rem;
    align-items: center;
    justify-content: space-between;
    margin-top: 2.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
    color: var(--ink-2);
    font-size: 0.82rem;
}
.foot-bottom p { margin: 0; }
.trust-badges { display: flex; gap: 0.6rem; margin-top: 1.25rem; align-items: center; flex-wrap: wrap; }
.trust-badges img { height: 3rem; width: auto; }

/* ---- dialog / sheet (feedback, and any other request form) ---------------- */
/* Glass tokens the dialog and the mobile tab bar use (same as the reference build). */
:root {
    --glass-blur: saturate(180%) blur(14px);
    --glass-inset: #0d12300a;
    --glass-fill: #ffffff9e;
    --glass-sheet-fill: #ffffffeb;
    --glass-panel-shadow: 0 20px 50px -26px #0d12304d;
    --glass-shadow: 0 10px 30px -12px #0d12304d;
    --scrim-strong: #0d123099;
    --focus: var(--accent);
    --danger-ink: var(--danger);
}
[data-theme="dark"] {
    --glass-blur: saturate(160%) blur(16px);
    --glass-inset: #ffffff0a;
    --glass-fill: #151c389e;
    --glass-sheet-fill: #0f152cdb;
    --glass-panel-shadow: inset 0 1px 0 #ffffff1a, inset 0 0 0 .5px #ffffff0f, 0 0 0 1px #ffffff0f, 0 20px 50px #00000073;
    --glass-shadow: inset 0 1px 0 #ffffff1a, inset 0 0 0 .5px #ffffff0f, 0 0 0 1px #ffffff0f, 0 10px 30px #0006;
    --scrim-strong: #050814cc;
    --focus: #9dbcff;
    --danger-ink: #ffb3bd;
}

.fbd {
    width: min(34rem, calc(100vw - 2rem));
    max-height: calc(100dvh - 2rem);
    margin: auto;
    padding: 1rem 1.25rem 1.25rem;
    border: 1px solid var(--glass-line);
    border-radius: var(--radius-xl);
    background: var(--glass-sheet-fill);
    backdrop-filter: var(--glass-blur);
    box-shadow: var(--glass-panel-shadow);
    color: var(--ink);
    overflow-y: auto;
    overscroll-behavior: contain;
}
/* A dialog that is not open must never be laid out in the page flow; and when it is
   shown without showModal() (old browser fallback) it still floats centred instead of
   shoving the page content aside. */
dialog.fbd:not([open]) { display: none; }
dialog.fbd[open] {
    position: fixed;
    inset: 0;
    margin: auto;
    height: max-content;
    z-index: 100;
}
.fbd::backdrop { background: var(--scrim-strong); backdrop-filter: blur(3px); }
.fbd-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.fbd-head h2 { font-size: var(--step-1); margin: 0; }
.fbd-close {
    display: grid;
    place-items: center;
    flex: none;
    width: 44px;
    height: 44px;
    margin-inline-end: -0.5rem;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--ink-2);
    cursor: pointer;
}
.fbd-close:hover { background: var(--glass-inset); color: var(--ink); }
.fbd-close svg { width: 1.25rem; height: 1.25rem; }
.fbd-lead { font-size: var(--step--1); margin: 0.1rem 0 1rem; }

.fbf { display: grid; }
.fbf-form, .fbf-done { grid-area: 1 / 1; }
.fbf-form { display: grid; gap: 1.1rem; }
.fbf[data-done] .fbf-form,
.fbf:not([data-done]) .fbf-done { visibility: hidden; }
.fbf-kinds { border: 0; margin: 0; padding: 0; min-width: 0; }
.fbf-kinds legend { margin-bottom: 0.45rem; padding: 0; font-weight: 600; }
.fbf-kind-row {
    display: flex;
    padding: 3px;
    border: 1px solid var(--glass-line);
    border-radius: var(--radius-pill);
    background: var(--glass-inset);
}
.fbf-kind {
    display: grid;
    place-items: center;
    flex: 1;
    min-height: 44px;
    padding-inline: 0.75rem;
    border-radius: var(--radius-pill);
    color: var(--ink-2);
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
}
.fbf-kind:hover { color: var(--ink); }
.fbf-kind:has(:checked) { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--accent); }
.fbf-kind:has(:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.fbf-field { display: grid; gap: 0.35rem; }
.fbf-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.fbf-label-row label { font-size: 0.88rem; font-weight: 700; }
.fbf-field label { font-size: 0.88rem; font-weight: 700; }
.fbf-count { color: var(--ink-2); font-size: var(--step--1); font-variant-numeric: tabular-nums; }
.fbf textarea { min-height: 8rem; resize: vertical; }
.fbf-hint { margin: 0; color: var(--ink-2); font-size: var(--step--1); line-height: 1.8; }
.fbf-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; }
.fbf-status { flex: 1 1 14rem; min-height: 1.7em; margin: 0; font-size: var(--step--1); line-height: 1.7; }
.fbf-status-err { color: var(--danger-ink); }
.fbf-done {
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 0.6rem;
    padding: 1rem;
    text-align: center;
}
.fbf-done svg { width: 3rem; height: 3rem; color: var(--success-ink); }
.fbf-done h3 { margin: 0; }
.fbf-done h3:focus { outline: none; }
.fbf-done p { max-width: 30rem; margin: 0 0 0.4rem; line-height: 1.9; }

/* ---- mobile tab bar ------------------------------------------------------- */
.tabbar { display: none; }
@media (max-width: 40rem) {
    .tabbar {
        position: fixed;
        inset-inline: 0.75rem;
        bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
        z-index: 30;
        display: flex;
        gap: 0.6rem;
    }
    .tabbar ul {
        display: flex;
        flex: 1;
        margin: 0;
        padding: 4px;
        height: 3.9rem;
        list-style: none;
        border-radius: var(--radius-pill);
        background: var(--glass-fill);
        box-shadow: var(--glass-shadow);
        backdrop-filter: var(--glass-blur);
    }
    .tabbar li { display: flex; flex: 1; }
    .tabbar a {
        display: flex;
        flex: 1;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        border-radius: var(--radius-pill);
        color: var(--ink);
        font-size: var(--step--2);
        font-weight: 500;
        line-height: 1.3;
        text-decoration: none;
    }
    .tabbar a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
    .tabbar svg { width: 22px; height: 22px; }
    /* keep the tab bar clear of the page end */
    body { padding-bottom: calc(5.25rem + env(safe-area-inset-bottom, 0px)); }
}

/* ---- form fields ---------------------------------------------------------- */
/* One appearance for every control on the site, wherever it lives. Admin tables and
   inline forms have bare inputs with no .field wrapper, and those used to fall back to
   the browser's grey square box. :where() keeps the specificity at zero so any
   component rule (search pill, install box…) still wins. */
:where(input, select, textarea):where(
    :not([type="checkbox"]):not([type="radio"]):not([type="submit"])
    :not([type="button"]):not([type="reset"]):not([type="file"]):not([type="hidden"])) {
    padding: 0.55rem 0.8rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-s);
    background: var(--surface);
    color: var(--ink);
    font-family: var(--font);
    font-size: 0.92rem;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}
:where(input, select, textarea):where(
    :not([type="checkbox"]):not([type="radio"]):not([type="submit"])
    :not([type="button"]):not([type="reset"]):not([type="file"]):not([type="hidden"])):hover {
    border-color: color-mix(in srgb, var(--accent) 45%, var(--line-strong));
}
:where(input, select, textarea):where(
    :not([type="checkbox"]):not([type="radio"]):not([type="submit"])
    :not([type="button"]):not([type="reset"]):not([type="file"]):not([type="hidden"])):focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
    border-color: var(--accent);
}
select option { background: var(--surface); color: var(--ink); }

/* inside a .field the control takes the full column width (checkbox/radio keep theirs) */
.field { display: grid; gap: 0.35rem; }
.field label { font-size: 0.88rem; font-weight: 700; }
.field input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]),
.field select,
.field textarea { width: 100%; }
.field textarea { min-height: 7rem; resize: vertical; }

/* a row of controls with a button — plan / member forms in the admin panel */
.inline-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
}
.inline-form > input:not([type="hidden"]),
.inline-form > select { min-width: 0; flex: 1 1 8rem; }
.inline-form > .inline-form-narrow { flex: 0 1 5.5rem; }
.inline-form > .btn { flex: none; }

/* a little breathing room between the dots, so a filled password field reads as a field
   and not as a grey blur; RTL layout is unaffected (dots are direction-neutral) */
.field input[type="password"] { letter-spacing: 0.04em; }

/* Chrome/Edge autofill otherwise paints a pale yellow/blue box over the dark theme */
.field input:-webkit-autofill,
.field input:-webkit-autofill:hover,
.field input:-webkit-autofill:focus,
.field textarea:-webkit-autofill {
    -webkit-text-fill-color: var(--ink);
    -webkit-box-shadow: 0 0 0 1000px var(--surface) inset;
    box-shadow: 0 0 0 1000px var(--surface) inset;
    caret-color: var(--ink);
    border-color: var(--line-strong);
}
.field input:-webkit-autofill:focus {
    border-color: var(--accent);
}
.radio-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.radio-row label { display: inline-flex; align-items: center; gap: 0.3rem; font-weight: 400; }
.char-count { color: var(--ink-2); font-size: 0.78rem; text-align: end; }

/* ---- prose (guide / about / blog / detail body) --------------------------- */
.prose { max-width: 46rem; }
.prose h2 { margin-top: 1.75em; }
.prose h3 { margin-top: 1.4em; }
.prose ul, .prose ol { padding-inline-start: 1.4rem; }
.prose li { margin-bottom: 0.35rem; }
.prose blockquote {
    margin: 1em 0;
    padding: 0.5rem 1rem;
    border-inline-start: 3px solid var(--accent);
    background: var(--surface-2);
    border-radius: var(--radius-s);
    color: var(--ink-2);
}
.prose a { text-decoration: underline; }
.prose code { background: var(--surface-2); padding: 0.1em 0.4em; border-radius: var(--radius-xs); }
.prose pre code { background: none; padding: 0; }

/* ---- filters (explore) ---------------------------------------------------- */
.filters {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: 1fr;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-l);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}
@media (min-width: 52rem) { .filters { grid-template-columns: 1fr 1fr; } }
.filter-group h4 { margin: 0 0 0.5rem; font-size: 0.9rem; color: var(--ink-2); }
.filter-group .chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-pill);
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink-2);
    font-size: 0.85rem;
}
.chip:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.chip.on { background: var(--accent-fill); border-color: var(--accent); color: var(--on-accent); }
.chip .count { font-size: 0.75rem; opacity: 0.75; }
.chip .swatch { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

.list-meta { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; color: var(--ink-2); }
.list-meta form { display: flex; align-items: center; gap: 0.5rem; }
.list-meta select {
    padding: 0.35rem 0.7rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-s);
    background: var(--surface);
    color: var(--ink);
    font-family: var(--font);
}

/* ---- detail page ---------------------------------------------------------- */
.breadcrumbs { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; list-style: none; margin: 1rem 0; padding: 0; font-size: 0.85rem; color: var(--ink-2); }
.breadcrumbs li + li::before { content: "/"; margin-inline-end: 0.4rem; color: var(--line-strong); }
.breadcrumbs a { color: var(--ink-2); }

.detail-head { display: flex; gap: 1rem; align-items: center; margin-bottom: 1rem; }
.detail-head h1 { margin: 0; font-size: clamp(1.6rem, 3.5vw, 2.3rem); }
.detail-head .en { color: var(--ink-2); font-size: 1rem; font-weight: 400; }

.detail-layout { display: grid; gap: 2rem; grid-template-columns: 1fr; }
@media (min-width: 60rem) { .detail-layout { grid-template-columns: minmax(0, 1fr) 18rem; } }
.detail-layout > * { min-width: 0; }
.detail-layout aside { align-self: start; min-width: 0; }
/* long URLs and repo paths in the narrow rail must break instead of running over the
   panel edge and out of the column */
.detail-layout aside .panel { overflow-wrap: anywhere; }
/* a 2-up grid inside an 18rem rail squeezes each card to ~8rem and mangles the titles */
.detail-layout aside .related-grid { grid-template-columns: 1fr; }

.fact-grid { display: grid; gap: 0.9rem; grid-template-columns: 1fr; }
@media (min-width: 40rem) { .fact-grid { grid-template-columns: 1fr 1fr; } }
/* a lone trailing fact used to leave half the row as an empty hole */
@media (min-width: 40rem) { .fact-grid > :last-child:nth-child(odd) { grid-column: 1 / -1; } }
.fact {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-m);
    padding: 1rem;
}
.fact .label { display: block; color: var(--ink-2); font-size: 0.82rem; margin-bottom: 0.3rem; }
/* value and its hint are separate lines: as inline spans they ran together as
   «رسمیخود سرویس آن را منتشر کرده است» */
.fact .value { display: block; font-weight: 700; }
.fact .muted { display: block; }
.fact .value + .muted { margin-top: 0.15rem; }

.panel {
    background: var(--glass-card);
    border: 1px solid var(--glass-line);
    border-radius: var(--radius-l);
    box-shadow: var(--glass-card-shadow);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}
.panel h2, .panel h3 { margin-top: 0; }

/* inline form feedback (saved / failed) */
.notice {
    padding: 0.65rem 0.9rem;
    border-radius: var(--radius-s);
    border: 1px solid var(--line-strong);
    background: var(--surface-2);
    color: var(--ink);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}
.notice-ok {
    background: var(--signal-soft);
    border-color: color-mix(in srgb, var(--signal) 45%, var(--line));
    color: var(--ink);
}
.notice-bad {
    background: var(--danger-soft);
    border-color: color-mix(in srgb, var(--danger) 45%, var(--line));
    color: var(--danger);
}

/* app tabs */
.tabs { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1rem; }
.tabs a {
    padding: 0.4rem 0.9rem;
    border-radius: var(--radius-pill);
    border: 1px solid var(--line);
    color: var(--ink-2);
    font-size: 0.9rem;
}
.tabs a.on, .tabs a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.tabs a.on { background: var(--accent-soft); font-weight: 700; }

/* tool list */
.tools { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; }
.tools li {
    display: flex;
    gap: 0.6rem;
    align-items: baseline;
    padding: 0.5rem 0.75rem;
    background: var(--surface-2);
    border-radius: var(--radius-s);
}
.tools li code { color: var(--accent); font-weight: 700; flex: none; }
.tools li span { color: var(--ink-2); font-size: 0.9rem; }

/* prompt list (copy-able questions) */
.prompts { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.prompts li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.6rem 0.9rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-s);
}
.prompts .q { font-size: 0.95rem; }
.copy-btn {
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--ink-2);
    border-radius: var(--radius-xs);
    padding: 0.15rem 0.6rem;
    font-size: 0.75rem;
    cursor: pointer;
    font-family: var(--font);
}
.copy-btn:hover { color: var(--accent); border-color: var(--accent); }

/* install command block */
.install-cmd { position: relative; }
/* the <pre> is LTR (code), so its reserved gutter is on the physical right; the copy
   button used to be placed by the RTL parent on the left and landed on top of the
   command text */
.install-cmd pre { margin: 0; padding: 0.9rem 5rem 0.9rem 1.1rem; white-space: pre-wrap; word-break: break-word; }
.install-cmd .copy-btn {
    position: absolute;
    top: 0.55rem;
    right: 0.6rem;
    left: auto;
    background: color-mix(in srgb, var(--code-ink) 12%, transparent);
    color: var(--code-ink);
    border-color: color-mix(in srgb, var(--code-ink) 30%, transparent);
}

/* related */
.related-grid { display: grid; gap: 0.75rem; grid-template-columns: 1fr; }
@media (min-width: 40rem) { .related-grid { grid-template-columns: 1fr 1fr; } }
.related-card {
    display: block;
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-m);
    color: var(--ink);
}
.related-card:hover { border-color: var(--accent); text-decoration: none; }
.related-card strong { display: block; }
.related-card .en { color: var(--ink-2); font-size: 0.8rem; }
.related-card .sum { color: var(--ink-2); font-size: 0.85rem; display: block; margin-top: 0.3rem; }

/* ---- pricing -------------------------------------------------------------- */
.plans { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 52rem) { .plans { grid-template-columns: repeat(4, 1fr); } }
.plan {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-l);
    padding: 1.4rem;
}
.plan.featured { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.plan .pname { font-size: 1.15rem; font-weight: 700; }
.plan .pdesc { color: var(--ink-2); font-size: 0.85rem; min-height: 2.6em; }
.plan .price { font-size: 1.8rem; font-weight: 700; margin-block: 0.5rem; }
.plan .price .old { color: var(--ink-2); text-decoration: line-through; font-size: 1rem; font-weight: 400; }
.plan .per { color: var(--ink-2); font-size: 0.8rem; }
.plan ul { list-style: none; margin: 1rem 0; padding: 0; font-size: 0.9rem; }
.plan ul li { padding: 0.4rem 0; border-top: 1px solid var(--line); display: flex; gap: 0.5rem; align-items: baseline; }
.plan ul li .v { font-weight: 700; flex: none; min-width: 3rem; }
.plan ul li .k { color: var(--ink-2); }
.plan .cta-btn { margin-top: auto; }

/* ---- responsive nav ------------------------------------------------------- */
/* Secondary links (blog, add-a-tool) give way from 86rem down; the admin link stays
   because it is the owner's only way into the panel. */
@media (max-width: 86rem) {
    .main-nav .hide-m { display: none; }
}
@media (max-width: 64rem) {
    .main-nav a { font-size: 0.9rem; padding: 0.4rem 0.5rem; }
    .search-form input[type="search"] { width: 9rem; }
    .site-header .bar { gap: 0.5rem; }
}
@media (max-width: 42rem) {
    .search-form input[type="search"] { width: 8rem; }
}

/* Phones: the mark alone, a flexible search, the actions on row one, and the links as
   a swipeable strip underneath — instead of a sticky header four rows tall. */
@media (max-width: 40rem) {
    .site-header .bar { gap: 0.45rem 0.5rem; flex-wrap: wrap; }
    .brand span:not(.mark) { display: none; }
    .brand { min-height: 2.25rem; }
    .search-form { flex: 1 1 6rem; }
    .search-form input[type="search"] { width: 100%; }
    .bar-actions { margin-inline-start: 0; }
    .main-nav {
        order: 5;
        width: 100%;
        margin-inline-start: 0;
        flex-wrap: nowrap;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scrollbar-width: none;
        padding-bottom: 0.1rem;
    }
    .main-nav::-webkit-scrollbar { display: none; }
    .main-nav a { flex: none; }
    .announce { font-size: 0.82rem; padding-inline: calc(var(--gutter) + 1.8rem); }
}

/* wide tables scroll inside their panel instead of pushing the page sideways */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll .admin-table { min-width: 34rem; }

/* ---- theme toggle --------------------------------------------------------- */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-s);
    background: var(--surface);
    color: var(--ink-2);
    cursor: pointer;
    flex: none;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle svg { width: 1.1rem; height: 1.1rem; }
.theme-toggle .ico-moon { display: none; }
[data-theme="dark"] .theme-toggle .ico-sun { display: none; }
[data-theme="dark"] .theme-toggle .ico-moon { display: inline; }

/* ---- playground chat ------------------------------------------------------- */
.playground-log {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 16rem;
    max-height: 26rem;
    overflow-y: auto;
    padding: 0.25rem;
}
.pg-msg {
    max-width: 85%;
    padding: 0.6rem 0.9rem;
    border-radius: var(--radius-m);
    border: 1px solid var(--line);
    background: var(--surface-2);
}
.pg-msg p { margin: 0; font-size: 0.95rem; }
.pg-msg .pg-who { display: block; font-size: 0.75rem; color: var(--ink-2); margin-bottom: 0.2rem; }
.pg-user { align-self: flex-end; background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); }
.pg-user .pg-who { color: var(--accent); }

/* topbar link (account/logout) */
.topbar-link { text-decoration: none; }
.topbar-link:hover { color: var(--accent); text-decoration: none; }

/* ---- admin tables ----------------------------------------------------------- */
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.admin-table th, .admin-table td { text-align: start; padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--line); }
.admin-table th { color: var(--ink-2); font-weight: 700; font-size: 0.8rem; }
.admin-table tr:hover td { background: var(--surface-2); }
.admin-table code { color: var(--accent); font-weight: 700; }

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
