/* cms6.org admin styles - minimal, dark, function-first */

:root {
    --bg: #0d1117;
    --surface: #161b22;
    --surface-2: #1f2733;
    --border: #21262d;
    --border-strong: #30363d;
    --text: #e6edf3;
    --muted: #7d8590;
    --accent: #2f81f7;
    --accent-hover: #4493f8;
    --success: #3fb950;
    --danger: #f85149;
    --warning: #d29922;
    --radius: 6px;
    --radius-sm: 4px;
    --shadow: 0 6px 24px rgba(0,0,0,.35);
    --topbar-h: 52px;
    --sidenav-w: 220px;
}

* { box-sizing: border-box }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

/* ── Topbar ─────────────────────────────────────────────── */
.topbar {
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky; top: 0; z-index: 10;
}
.topbar__brand { display: flex; align-items: center; gap: 0; min-width: 0; }
.topbar__brand a { color: var(--text); font-weight: 600; font-size: 15px; text-decoration: none; }
.topbar__sep { color: var(--muted); margin: 0 8px; }
.topbar__site { color: var(--muted) !important; font-weight: 400; }
.topbar__site:hover { color: var(--text) !important; }
.topbar__open {
    display: inline-flex; align-items: center; gap: 4px;
    margin-left: 10px;
    padding: 3px 9px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--muted) !important;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    transition: color .12s, border-color .12s, background .12s;
}
.topbar__open:hover { color: var(--accent) !important; border-color: var(--accent); background: var(--surface-2); text-decoration: none; }
.topbar__actions { display: flex; align-items: center; gap: 12px; }
.topbar__user { color: var(--muted); font-size: 13px; }

/* ── Topbar quick-switcher ──────────────────────────────── */
.topbar__switcher { position: relative; flex: 1; max-width: 360px; margin: 0 20px; }
.switcher__input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border-strong);
    color: var(--text);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font: inherit; font-size: 13px;
}
.switcher__input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(47,129,247,.25); }
.switcher__menu {
    position: absolute; top: calc(100% + 4px); left: 0; right: 0;
    list-style: none; padding: 4px; margin: 0;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-height: 320px;
    overflow-y: auto;
    z-index: 30;
}
.switcher__item { border-radius: var(--radius-sm); }
.switcher__item a {
    display: flex; flex-direction: column; gap: 1px;
    padding: 7px 10px;
    text-decoration: none;
    color: var(--text);
}
.switcher__item a:hover { background: var(--surface-2); text-decoration: none; }
.switcher__item--cursor a { background: var(--surface-2); }
.switcher__item--active a { color: var(--accent); }
.switcher__name { font-size: 13px; font-weight: 500; }
.switcher__domain { font-size: 11.5px; color: var(--muted); font-family: ui-monospace, Menlo, monospace; }
.switcher__empty { padding: 10px; text-align: center; font-size: 12.5px; }
@media (max-width: 720px) {
    .topbar__switcher { display: none; }
}

/* ── Sidenav ────────────────────────────────────────────── */
.sidenav {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    bottom: 0;
    width: var(--sidenav-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 16px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}
.sidenav a {
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text);
    text-decoration: none;
    font-size: 13.5px;
}
.sidenav a:hover { background: var(--surface-2); text-decoration: none; }
.sidenav a.active { background: var(--accent); color: #fff; font-weight: 500; }

/* ── Main ───────────────────────────────────────────────── */
.main { padding: 24px; max-width: 1200px; margin: 0 auto; }
.main--with-sidenav { margin-left: var(--sidenav-w); max-width: none; padding: 24px 32px; }

/* ── Headings ───────────────────────────────────────────── */
h1 { font-size: 22px; font-weight: 600; margin: 0 0 4px; }
h2 { font-size: 17px; font-weight: 600; margin: 24px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
h3 { font-size: 14px; font-weight: 600; margin: 20px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.page-subtitle { color: var(--muted); margin: 0 0 24px; }

/* ── Cards ──────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}
.card__title { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
.card__desc { color: var(--muted); margin: 0 0 12px; font-size: 13px; }

/* ── Page head with search ──────────────────────────────── */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin-bottom: 4px; }
.page-head .page-subtitle { margin-bottom: 0; }
.page-head__search { display: flex; align-items: center; gap: 10px; min-width: 260px; }
.search-input { max-width: 320px; }
.search-input__count { color: var(--muted); font-size: 12px; white-space: nowrap; }
.site-search-empty { margin-top: 16px; }

/* ── Site grid ──────────────────────────────────────────── */
.site-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.site-card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color .15s;
}
.site-card:hover { border-color: var(--accent); }
.site-card__link { display: block; padding: 18px; padding-right: 44px; color: var(--text); text-decoration: none; }
.site-card__link:hover { text-decoration: none; color: var(--text); }
.site-card__name { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.site-card__domain { color: var(--muted); font-size: 13px; font-family: ui-monospace, Menlo, monospace; }
.site-card__meta { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }
.site-card__open {
    position: absolute; top: 10px; right: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px;
    border-radius: var(--radius-sm);
    color: var(--muted) !important;
    background: transparent;
    border: 1px solid transparent;
    text-decoration: none;
    transition: background .12s, color .12s, border-color .12s;
}
.site-card__open:hover { color: var(--accent) !important; background: var(--surface-2); border-color: var(--border-strong); text-decoration: none; }

/* Language chips on site cards */
.site-card__langs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.site-card__langs--empty { font-size: 12px; }
.lang-chip {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 8px;
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 500;
    color: var(--text);
    line-height: 1.5;
}
.lang-chip__flag { font-size: 12px; }
.lang-chip__code { font-family: ui-monospace, Menlo, monospace; letter-spacing: .02em; color: var(--muted); }

/* Theme chip on site cards */
.site-card__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.site-card__row .site-card__langs { margin-top: 0; flex: 1 1 auto; min-width: 0; }
.theme-chip {
    display: inline-flex; align-items: center;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    line-height: 1.6;
    flex: 0 0 auto;
    border: 1px solid transparent;
}
.theme-chip--t1 { background: rgba(139, 148, 158, 0.14); color: #c9d1d9; border-color: rgba(139, 148, 158, 0.32); }
.theme-chip--t2 { background: rgba(99, 179, 237, 0.14); color: #79c0ff; border-color: rgba(99, 179, 237, 0.34); }
.theme-chip--t3 { background: rgba(255, 191, 73, 0.14); color: #ffd166; border-color: rgba(255, 191, 73, 0.34); }

/* ── Forms ──────────────────────────────────────────────── */
.field { margin-bottom: 16px; }
.field__label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--text); }
.field__hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.field__row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field__row--3 { grid-template-columns: repeat(3, 1fr); }
.field__row--auto { grid-template-columns: auto 1fr; }

.input, .textarea, .select {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border-strong);
    color: var(--text);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 13.5px;
}
.input:focus, .textarea:focus, .select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(47, 129, 247, .25);
}
.textarea { resize: vertical; min-height: 80px; font-family: ui-monospace, Menlo, monospace; }
.textarea--code { min-height: 320px; font-family: ui-monospace, Menlo, monospace; font-size: 13px; tab-size: 2; }
.input--mono { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }

.color-field { display: flex; align-items: center; gap: 8px; }
.color-field input[type=color] { width: 40px; height: 36px; padding: 0; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--bg); cursor: pointer; }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--surface-2); color: var(--text);
    border: 1px solid var(--border-strong);
    padding: 8px 14px; border-radius: var(--radius-sm);
    font: inherit; font-size: 13.5px; font-weight: 500;
    cursor: pointer; text-decoration: none;
    transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--border-strong); text-decoration: none; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn--danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn--danger:hover { background: var(--danger); color: #fff; }
.btn--ghost { background: transparent; border-color: var(--border); }
.btn--ghost:hover { background: var(--surface-2); }
.btn--sm { padding: 5px 10px; font-size: 12.5px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.btn-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ── Sticky save bar ────────────────────────────────────── */
.savebar {
    position: sticky; bottom: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 14px 20px;
    margin: 24px -32px -24px;
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px;
    z-index: 5;
}
.savebar__status { font-size: 13px; color: var(--muted); }
.savebar__status--success { color: var(--success); }
.savebar__status--error { color: var(--danger); }

/* ── Tables ─────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.table th { font-weight: 500; color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em; }
.table tr:hover td { background: var(--surface-2); }

/* ── Login ──────────────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; }
.login-card h1 { text-align: center; margin: 0 0 24px; }
.login-error { background: rgba(248,81,73,.1); border: 1px solid rgba(248,81,73,.4); color: var(--danger); padding: 10px 12px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 13px; }

/* ── Drag handles for nav reorder ───────────────────────── */
.drag-list { list-style: none; padding: 0; margin: 0; }
.drag-item {
    display: grid;
    grid-template-columns: auto 1fr 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}
.drag-handle { cursor: grab; color: var(--muted); user-select: none; padding: 0 4px; }
.drag-handle:active { cursor: grabbing; }
.drag-item.dragging { opacity: .4; }

/* ── Stacked drag items (FAQ Q&A) ───────────────────────── */
.drag-item--stack { grid-template-columns: auto 1fr; grid-auto-rows: auto; }
.drag-item--stack .drag-handle { grid-row: span 3; align-self: start; padding-top: 8px; }
.drag-item--stack > input,
.drag-item--stack > textarea { grid-column: 2; }
.drag-item--stack > button { grid-column: 2; justify-self: start; margin-top: 4px; }

/* ── Section ordering row ────────────────────── */
.drag-list--sections { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.drag-item--section {
    grid-template-columns: auto minmax(160px, 1.4fr) minmax(120px, 1fr) auto auto auto;
    grid-auto-rows: auto;
}
.drag-item--section > .section-options {
    grid-column: 2 / -1;
    margin-top: 6px;
    font-family: ui-monospace, Menlo, monospace;
    font-size: 12.5px;
}
.section-toggle {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    color: var(--muted);
    font-size: 12.5px;
    user-select: none;
    white-space: nowrap;
}
.sections-add {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.sections-add .input { max-width: 280px; }

/* ── Pages list ─────────────────────────────────────────── */
.table--rows td { vertical-align: middle; }

/* ── Module editor (flexible content) ──────────────────── */
.mod-modules { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.mod-card.drag-item {
    display: block;
    padding: 0;
    grid-template-columns: none;
}
.mod-card.dragging { opacity: .4; }
.mod-card__head {
    display: grid;
    grid-template-columns: auto 1fr minmax(120px, 220px) auto auto;
    gap: 10px;
    align-items: center;
    padding: 10px;
}
.mod-card__expand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: 0;
    padding: 4px 6px;
    color: var(--text);
    cursor: pointer;
    text-align: left;
    font: inherit;
    border-radius: var(--radius-sm);
    min-width: 0;
}
.mod-card__expand:hover { background: var(--surface-2); }
.mod-card__expand-icon { color: var(--muted); font-size: 11px; line-height: 1; flex-shrink: 0; }
.mod-card__type-label { font-weight: 600; font-size: 14px; white-space: nowrap; }
.mod-card__type-slug {
    font-family: ui-monospace, Menlo, monospace;
    font-size: 11.5px;
    color: var(--muted);
    background: var(--surface-2);
    padding: 1px 6px;
    border-radius: 3px;
    border: 1px solid var(--border-strong);
}
.mod-card__id { font-size: 12.5px; }
.mod-card__remove {
    color: var(--danger);
    font-size: 18px;
    line-height: 1;
    padding: 4px 10px;
}
.mod-card__body {
    padding: 6px 14px 16px 38px;
    border-top: 1px solid var(--border);
}
.mod-card--unknown .mod-card__type-label { color: var(--muted); font-style: italic; }

.mod-toggle {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    color: var(--muted);
    font-size: 12.5px;
    user-select: none;
    white-space: nowrap;
}

.mod-add {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    padding: 8px 0;
}
.mod-add .input { max-width: 300px; }

.mod-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 8px 0;
}
.mod-grid--3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 720px) {
    .mod-grid, .mod-grid--3 { grid-template-columns: 1fr; }
    .mod-card__head { grid-template-columns: auto 1fr auto; }
    .mod-card__id { grid-column: 2; }
}

.mod-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}
.mod-field > span:first-child {
    font-size: 12.5px;
    color: var(--muted);
    font-weight: 500;
}
.mod-field--wide { grid-column: 1 / -1; }

.mod-subhead {
    margin: 18px 0 6px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
    font-weight: 600;
}

.mod-faq-list { margin: 8px 0; display: flex; flex-direction: column; gap: 6px; }

/* ── Misc ───────────────────────────────────────────────── */
.muted { color: var(--muted); }
.kbd { font-family: ui-monospace, Menlo, monospace; font-size: 12px; background: var(--surface-2); padding: 1px 5px; border-radius: 3px; border: 1px solid var(--border-strong); }
.flash { padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 13.5px; }
.flash--success { background: rgba(63,185,80,.12); border: 1px solid rgba(63,185,80,.35); color: var(--success); }
.flash--error { background: rgba(248,81,73,.12); border: 1px solid rgba(248,81,73,.35); color: var(--danger); }

/* Topbar Domains button active state (legacy) */
.topbar__domains.is-active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.topbar__domains.is-active:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

/* ── Top nav grouped menus (Websites / Domains / Settings) ───────── */
.topnav-menu {
    position: relative;
    outline: none;
}
.topnav-menu__btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 1;
    height: 30px;
    text-decoration: none;
    font-family: inherit;
    white-space: nowrap;
}
.topnav-menu__btn:hover { text-decoration: none; color: var(--text); }
.topnav-menu__btn svg { flex-shrink: 0; opacity: .85; }
.topnav-menu__btn:hover { background: var(--surface-2); }
.topnav-menu__caret {
    font-size: 10px;
    color: var(--muted);
    margin-top: 1px;
    transition: transform .15s ease;
}
.topnav-menu.is-active .topnav-menu__btn {
    background: var(--surface-2);
    color: var(--accent);
    border-color: var(--border);
}
.topnav-menu.is-active .topnav-menu__btn svg { opacity: 1; }
.topnav-menu:hover .topnav-menu__caret,
.topnav-menu:focus-within .topnav-menu__caret { transform: rotate(180deg); }

.topnav-menu__list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 220px;
    margin: 0;
    padding: 6px;
    list-style: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,.35);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity .12s ease, transform .12s ease, visibility 0s linear .12s;
    z-index: 100;
}
.topnav-menu:hover .topnav-menu__list,
.topnav-menu:focus-within .topnav-menu__list {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: opacity .12s ease, transform .12s ease, visibility 0s linear 0s;
}
/* Right-anchor dropdown for the last menu (avoids clipping at viewport edge) */
.topnav-menu--right .topnav-menu__list { left: auto; right: 0; }
.topnav-menu__list li { margin: 0; }
.topnav-menu__list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 10px;
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
    border-radius: 5px;
    line-height: 1.3;
}
.topnav-menu__list a:hover { background: var(--surface-2); color: var(--accent); }
.topnav-menu__hint {
    font-size: 11px;
    color: var(--muted);
    font-weight: 400;
    white-space: nowrap;
}
.topnav-menu__list a:hover .topnav-menu__hint { color: var(--text); }

/* ── Data table (Domains, Users, Tags) ──────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th, .data-table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.data-table th {
    font-weight: 500;
    color: var(--muted);
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .04em;
    background: var(--surface-2);
    white-space: nowrap;
    border-bottom: 1px solid var(--border-strong);
}
.data-table tbody tr:hover td { background: var(--surface-2); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table .row-actions { white-space: nowrap; text-align: right; }
.data-table .row-actions > * { margin-left: 4px; }

/* ── Status pills ───────────────────────────────────────── */
.status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 500;
    line-height: 1.6;
    border: 1px solid transparent;
    text-transform: lowercase;
    letter-spacing: .01em;
    white-space: nowrap;
}
.status::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}
.status--ok { background: rgba(63,185,80,.10); color: #4ac95a; border-color: rgba(63,185,80,.28); }
.status--off { background: rgba(248,81,73,.10); color: #f87168; border-color: rgba(248,81,73,.28); }
.status--warn { background: rgba(210,153,34,.12); color: #e3a82b; border-color: rgba(210,153,34,.30); }
.status--info { background: rgba(47,129,247,.10); color: #5fa8ff; border-color: rgba(47,129,247,.28); }
.status--neutral { background: var(--surface-2); color: var(--muted); border-color: var(--border-strong); }
.status--neutral::before { background: var(--muted); }

/* ── Card variants ──────────────────────────────────────── */
.card--ok { background: rgba(63,185,80,.06); border-color: rgba(63,185,80,.30); }
.card--error { background: rgba(248,81,73,.06); border-color: rgba(248,81,73,.30); }
.card--info { background: rgba(47,129,247,.06); border-color: rgba(47,129,247,.30); }
.card--ok h3, .card--error h3, .card--info h3 { margin-top: 0; }

/* ── Form rows ──────────────────────────────────────────── */
.form-row { margin-bottom: 14px; }
.form-row > label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; font-weight: 500; }
.form-row > input.input,
.form-row > select.input,
.form-row > textarea.input { width: 100%; }

/* ── Domain manager specific ────────────────────────────── */
.dm-domain-cell { display: flex; align-items: center; gap: 8px; }
.dm-domain-cell strong { font-weight: 600; font-size: 14px; }
.dm-domain-cell .open-link {
    color: var(--muted);
    font-size: 11px;
    padding: 2px 5px;
    border: 1px solid transparent;
    border-radius: 3px;
    text-decoration: none;
}
.dm-domain-cell .open-link:hover { color: var(--accent); border-color: var(--border-strong); background: var(--surface-2); text-decoration: none; }

.dm-account-chip {
    display: inline-block;
    font-size: 11px;
    color: var(--muted);
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 1px 7px;
    border-radius: 3px;
    margin-top: 3px;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

.dm-stats-bar {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    align-items: center;
}
.dm-stats-bar .stat {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    font-size: 13px;
}
.dm-stats-bar .stat__num { font-size: 18px; font-weight: 600; color: var(--text); }
.dm-stats-bar .stat__label { color: var(--muted); font-size: 12px; }
.dm-stats-bar .stat--ok .stat__num { color: #4ac95a; }
.dm-stats-bar .stat--off .stat__num { color: #f87168; }
.dm-stats-bar .stat__sep { width: 1px; height: 24px; background: var(--border); }

.dm-filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.dm-filter-bar .input { padding: 6px 10px; font-size: 13px; }

/* Tighter table wrapper */
.table-wrap { padding: 0; overflow-x: auto; }
.table-wrap > .data-table { margin: 0; }


/* ============================================================
 * Light theme (opt-in via <html data-theme="light">)
 *
 * Dark mode is default. To activate light, either:
 *   - Click the theme toggle button in the topbar (persisted in localStorage)
 *   - Or set the OS to prefers-color-scheme: light on first visit
 *
 * Every override targets a CSS custom property already declared in :root
 * so downstream selectors adapt automatically. A handful of hardcoded
 * hex/rgba values in status pills and theme chips also get tuned here
 * for the light background.
 * ============================================================ */
:root[data-theme="light"] {
    --bg:              #f6f8fa;
    --surface:         #ffffff;
    --surface-2:       #f0f3f6;
    --border:          #d0d7de;
    --border-strong:   #afb8c1;
    --text:            #1f2328;
    --muted:           #59636e;
    --accent:          #0969da;
    --accent-hover:    #0550ae;
    --success:         #1a7f37;
    --danger:          #cf222e;
    --warning:         #9a6700;
    --shadow:          0 6px 24px rgba(31, 35, 40, .10);
}

/* Ensure primary buttons keep white text on the blue accent in both themes. */
:root[data-theme="light"] .btn--primary,
:root[data-theme="light"] .btn.btn--primary { color: #ffffff; }

/* Muted-on-dark tints inside status pills read fine on light too, but
   deepen them slightly so contrast passes AA. */
:root[data-theme="light"] .status--ok    { color: #1a7f37; background: rgba(26,127,55,.08);  border-color: rgba(26,127,55,.28); }
:root[data-theme="light"] .status--off   { color: #cf222e; background: rgba(207,34,46,.08);  border-color: rgba(207,34,46,.28); }
:root[data-theme="light"] .status--warn  { color: #9a6700; background: rgba(154,103,0,.10);  border-color: rgba(154,103,0,.30); }
:root[data-theme="light"] .status--info  { color: #0969da; background: rgba(9,105,218,.08);  border-color: rgba(9,105,218,.28); }

/* Theme-N chips: keep bg alpha low, force readable text on light. */
:root[data-theme="light"] .theme-chip--t1 { color: #59636e; }
:root[data-theme="light"] .theme-chip--t2 { color: #0550ae; }
:root[data-theme="light"] .theme-chip--t3 { color: #7d4e00; }

/* Card variants: deepen borders slightly for legibility on white. */
:root[data-theme="light"] .card--ok    { background: rgba(26,127,55,.05);  border-color: rgba(26,127,55,.30); }
:root[data-theme="light"] .card--error { background: rgba(207,34,46,.05);  border-color: rgba(207,34,46,.30); }
:root[data-theme="light"] .card--info  { background: rgba(9,105,218,.05);  border-color: rgba(9,105,218,.30); }

/* Callouts used by the geo module. */
:root[data-theme="light"] .callout--info { background: #ddf4ff; border-left-color: #0969da; color: #0550ae; }
:root[data-theme="light"] .callout--warn { background: #fff8c5; border-left-color: #9a6700; color: #4d3800; }
:root[data-theme="light"] .callout--ok   { background: #dafbe1; border-left-color: #1a7f37; color: #0a4020; }

/* Geo stat cards + pills. */
:root[data-theme="light"] .stat { background: var(--surface); border: 1px solid var(--border); }
:root[data-theme="light"] .pill--open  { background: #eaeef2; color: #59636e; }
:root[data-theme="light"] .pill--ok    { background: #dafbe1; color: #1a7f37; }
:root[data-theme="light"] .pill--drift { background: #fff8c5; color: #9a6700; }

/* Country picker chips need a light-mode background. */
:root[data-theme="light"] .chip { background: #eaeef2; }
:root[data-theme="light"] .country-picker { border-color: var(--border); }

/* ============================================================
 * Theme toggle button in the topbar
 * ============================================================ */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px; height: 32px;
    padding: 0;
    background: transparent;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--muted);
    cursor: pointer;
    transition: color .12s, border-color .12s, background .12s;
}
.theme-toggle:hover { color: var(--text); border-color: var(--accent); background: var(--surface-2); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-toggle svg { width: 16px; height: 16px; display: block; }
/* Show only the icon matching the CURRENT theme.
   Dark theme -> show moon (click to go light).
   Light theme -> show sun (click to go dark). */
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }
:root[data-theme="light"] .theme-toggle .icon-sun  { display: block; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* ---------------------------------------------------------
   SEO indexing badge on site cards (Dashboard)
   Added 2026-08-14. Powered by DataForSEO snapshots.
   --------------------------------------------------------- */
.site-card__seo {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 6px;
}
.seo-badge {
    display: inline-flex; align-items: center;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    line-height: 1.4;
    white-space: nowrap;
}
.seo-badge--unknown { background: var(--surface-2); color: var(--muted);    border-color: var(--border); }
.seo-badge--ok      { background: rgba(34, 197, 94, 0.12);  color: #16a34a; border-color: rgba(34, 197, 94, 0.35); }
.seo-badge--zero    { background: rgba(239, 68, 68, 0.12);  color: #dc2626; border-color: rgba(239, 68, 68, 0.35); }
.seo-badge--err     { background: rgba(234, 179, 8, 0.12);  color: #b45309; border-color: rgba(234, 179, 8, 0.35); }
/* Dark theme keeps hues but softens the text so it stays readable */
:root[data-theme="dark"] .seo-badge--ok      { color: #4ade80; }
:root[data-theme="dark"] .seo-badge--zero    { color: #f87171; }
:root[data-theme="dark"] .seo-badge--err     { color: #fbbf24; }

.site-card__seo-recheck {
    position: absolute; top: 44px; right: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px;
    padding: 0;
    border-radius: var(--radius-sm);
    color: var(--muted);
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background .12s, color .12s, border-color .12s;
}
.site-card__seo-recheck:hover { color: var(--accent); background: var(--surface-2); border-color: var(--border-strong); }
.site-card__seo-recheck.is-loading { opacity: 0.5; pointer-events: none; }
.site-card__seo-recheck.is-loading svg { animation: seo-spin 1s linear infinite; }
@keyframes seo-spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------
   SEO fleet-scan progress bar (Settings > Integrations)
   Added 2026-08-14 alongside the /api/seo_scan_batch endpoint.
   --------------------------------------------------------- */
.seo-progress {
    width: 100%;
    height: 8px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.seo-progress__fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #4ade80);
    transition: width .25s ease-out;
    border-radius: var(--radius-sm);
}
