/* PostingScript theme — light blue base, orange highlights. Dark mode via prefers-color-scheme. */
:root {
    --bg: #ffffff;          /* white page */
    --panel: #eef4fc;       /* light-blue cards (keeps the blue identity on white) */
    --field: #ffffff;       /* inputs */
    --text: #15273b;        /* dark slate */
    --muted: #5a6b7d;
    --accent: #1f74c4;      /* blue — links, accents */
    --accent-strong: #155a9c;
    --highlight: #f5821f;   /* orange — CTAs, highlights */
    --highlight-strong: #d96b0c;
    --border: #cfe0f1;
    --ok-bg: #e6f7ec; --ok-fg: #1c7a45;
    --err-bg: #fdeaec; --err-fg: #b3261e;
    --shadow: 0 1px 3px rgba(21, 39, 59, .08), 0 6px 18px rgba(21, 39, 59, .06);
    --maxw: 960px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0e1726;          /* deep navy-blue */
        --panel: #16233a;
        --field: #0c1320;       /* inputs (darker than panel) */
        --text: #e6eef8;
        --muted: #9fb2c6;
        --accent: #4f9ae6;      /* lighter blue on dark */
        --accent-strong: #6fb0f0;
        --highlight: #ff9233;   /* orange, a touch brighter */
        --highlight-strong: #ffab5e;
        --border: #24364f;
        --ok-bg: #133024; --ok-fg: #7fe0a6;
        --err-bg: #3a1620; --err-fg: #ff9bb0;
        --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .35);
    }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.55;
}

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

.site-header {
    display: flex; align-items: center; justify-content: space-between;
    max-width: var(--maxw); margin: 0 auto; padding: 20px 24px;
}
.site-header .brand { font-weight: 700; font-size: 1.25rem; color: var(--text); letter-spacing: .2px; }
.site-header nav a { margin-left: 18px; color: var(--muted); }
.site-header nav a:hover { color: var(--accent); }

main { max-width: var(--maxw); margin: 0 auto; padding: 24px; }

.hero { padding: 56px 0 32px; text-align: center; }
.hero h1 { font-size: 3rem; margin: 0 0 8px; letter-spacing: -.5px; }
.hero .tagline { font-size: 1.4rem; color: var(--accent); margin: 0 0 20px; font-weight: 600; }
.hero .lede { max-width: 620px; margin: 0 auto 28px; color: var(--muted); font-size: 1.1rem; }

.cta, button {
    display: inline-block; background: var(--highlight); color: #fff;
    border: none; border-radius: 8px; padding: 12px 22px;
    font-size: 1rem; font-weight: 600; cursor: pointer;
}
.cta:hover, button:hover { background: var(--highlight-strong); color: #fff; text-decoration: none; }

.post-fab {
    position: fixed; right: 24px; bottom: 24px; z-index: 50;
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--highlight); color: #fff;
    border-radius: 999px; padding: 14px 22px;
    font-weight: 700; font-size: 1.05rem; line-height: 1;
    box-shadow: 0 6px 20px rgba(0,0,0,.28);
}
.post-fab:hover { background: var(--highlight-strong); color: #fff; text-decoration: none; box-shadow: 0 8px 26px rgba(0,0,0,.34); }
.post-fab-plus { font-size: 1.4rem; font-weight: 700; }

.assistant {
    border: 1px solid var(--border); border-radius: 10px;
    background: var(--panel); padding: 14px; margin: 4px 0 18px;
}
.assistant-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.assistant-badge { font-weight: 700; color: var(--accent); }
.assistant-status { font-size: .9rem; }
.assistant-status.ok { color: #1f9d55; }
.assistant-status.err { color: #c0392b; }
.drag-handle { cursor: grab; color: var(--muted); user-select: none; text-align: center; width: 1.5rem; }
#queue-items tr[data-post] { cursor: default; }
#queue-items tr.dragging { opacity: .45; background: var(--panel); }

.url-import { display: flex; gap: 8px; align-items: stretch; }
.url-import input { flex: 1; }
.url-import button { white-space: nowrap; }
.import-preview { margin: 10px 0 4px; }
.import-preview.err { color: #c0392b; }
.import-preview.ok { color: #1f9d55; }
.import-preview .thumb { display: block; margin-bottom: 6px; }

.mention-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: -2px 0 10px; }
.mention-tools .translate-btn { white-space: nowrap; font-size: .9rem; padding: 4px 10px; }
.mention-status { font-size: .85rem; }
.mention-status.ok { color: #1f9d55; }
.mention-status.err { color: #c0392b; }

.assistant-hint { margin: 0 0 8px; font-size: .88rem; }
.assistant-brief { width: 100%; margin-bottom: 10px; }
.assistant-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.assistant-btn {
    background: transparent; color: var(--accent);
    border: 1px solid var(--border); border-radius: 999px;
    padding: 7px 14px; font-size: .92rem; font-weight: 600;
}
.assistant-btn:hover { background: var(--accent); color: #fff; }
.assistant-btn:disabled { opacity: .5; cursor: default; }
.assistant-btn:disabled:hover { background: transparent; color: var(--accent); }
@media (max-width: 560px) {
    .post-fab { right: 16px; bottom: 16px; padding: 14px; }
    .post-fab-label { display: none; }
    .post-fab-plus { font-size: 1.6rem; }
}

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; margin: 32px 0; }
.feature { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 22px; box-shadow: var(--shadow); }
.feature h3 { margin: 0 0 8px; color: var(--accent); }
.feature p { margin: 0; color: var(--muted); }

.contact, .auth, .admin { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 28px; margin: 32px 0; box-shadow: var(--shadow); }
.auth { max-width: 460px; }
.admin { overflow-x: auto; }
.contact h2, .auth h1, .admin h1 { margin-top: 0; }
.muted { color: var(--muted); }

.form { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: .95rem; color: var(--muted); }
.form input, .form textarea {
    background: var(--field); color: var(--text);
    border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-size: 1rem; font-family: inherit;
}
.form input:focus, .form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31, 116, 196, .15); }
.form button { align-self: flex-start; }
/* Two-column form layout (e.g. queue Settings). Each .col keeps the normal stacked-field flow. */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 24px; }
.settings-grid .col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
@media (max-width: 680px) { .settings-grid { grid-template-columns: 1fr; } }

/* Network glyphs (X / Instagram / Reddit) — themed via currentColor on a per-network class. */
.net-ic { display: inline-block; width: 16px; height: 16px; vertical-align: -3px; }
.net-ic svg { display: block; width: 100%; height: 100%; }
.net-cell { white-space: nowrap; }
.net-cell .net-ic + .net-ic { margin-left: 5px; }
.net-ic.x { color: var(--text); }
.net-ic.instagram { color: #e1306c; }
.net-ic.reddit { color: #ff4500; }

/* Inline action row (e.g. queue New post + Randomize) with a smaller button size. */
.queue-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 12px 0; }
.queue-actions form { margin: 0; }
.cta.btn-sm, button.btn-sm { padding: 7px 14px; font-size: .9rem; }
.reorder-hint { display: flex; align-items: center; gap: 12px; }

.flash { padding: 12px 16px; border-radius: 8px; margin: 16px 0; }
.flash-ok { background: var(--ok-bg); color: var(--ok-fg); }
.flash-error { background: var(--err-bg); color: var(--err-fg); }

.site-footer { max-width: var(--maxw); margin: 40px auto 24px; padding: 0 24px; color: var(--muted); font-size: .9rem; }

/* Admin — full-page view with a left sidebar */
.admin-body .site-header, .admin-body .site-footer { max-width: none; }
.admin-shell { display: flex; align-items: stretch; max-width: none; margin: 0; min-height: calc(100vh - 150px); }
.side-nav { flex: 0 0 200px; border-right: 1px solid var(--border); padding: 16px 0; display: flex; flex-direction: column; }
.side-nav a { display: block; padding: 10px 24px; color: var(--muted); }
.side-nav a:hover { color: var(--text); background: var(--panel); text-decoration: none; }
.side-nav a.active { color: var(--accent); font-weight: 600; border-left: 3px solid var(--accent); padding-left: 21px; }
.side-nav a.sep { margin-top: auto; border-top: 1px solid var(--border); padding-top: 16px; }
.side-nav-top { font-weight: 600; padding-top: 14px; padding-bottom: 14px; }
.side-nav-label { padding: 14px 24px 4px; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.side-nav a.profile-link { padding-left: 36px; font-size: .95rem; }
.side-nav a.profile-link.active { padding-left: 33px; }
.profile-switcher { padding: 4px 16px 14px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.profile-switcher select { width: 100%; background: var(--field); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 9px 10px; font-size: 1rem; font-weight: 600; }
.profile-switcher .new-profile { margin-top: 8px; }
.profile-switcher .new-profile summary { cursor: pointer; color: var(--accent); font-size: .9rem; list-style: none; }
.profile-switcher .new-profile summary::-webkit-details-marker { display: none; }
.profile-switcher .new-profile form { display: flex; gap: 6px; margin-top: 8px; }
.profile-switcher .new-profile input[type=text] { flex: 1; min-width: 0; background: var(--field); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 7px 9px; }
.profile-switcher .new-profile button { padding: 7px 12px; font-size: .9rem; }
.side-nav-sublabel { padding: 8px 24px 2px 36px; font-size: .8rem; color: var(--muted); }

/* Account Dashboard — one card per profile across the whole account. */
.acct-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin: 8px 0 24px; }
.acct-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; }
.acct-card.active { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.acct-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.acct-name { font-weight: 700; font-size: 1.05rem; }
.badge-active { background: var(--accent); color: #fff; }
.acct-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 10px; }
.acct-stats > span { display: flex; flex-direction: column; line-height: 1.15; }
.acct-stats b { font-size: 1.3rem; font-weight: 700; color: var(--accent); }
.acct-stats b.warn { color: #c0392b; }
.acct-stats > span > span { font-size: .68rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.acct-card-foot { margin-top: auto; padding-top: 4px; border-top: 1px solid var(--border); }
.acct-card-foot a, .link-btn { color: var(--accent); font-size: .9rem; }
.link-btn { background: none; border: none; padding: 0; font: inherit; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.page-head { margin-bottom: 8px; }

.stat .num.warn { color: #c0392b; }

/* Contact submissions (sysadmin). */
.badge-ok { background: var(--ok-bg, #1e3a23); color: var(--ok-fg, #7fd18a); }
.msg-cell { white-space: pre-wrap; word-break: break-word; max-width: 520px; }
.nowrap { white-space: nowrap; }
.tiny { font-size: .72rem; }
tr.row-handled td { opacity: .6; }
.inline-form { display: inline; }
.link-danger { color: #c0392b; }
/* Queue weekly 7-day calendar (interactive editor) */
.cal7 { display: grid; grid-template-columns: repeat(7, minmax(150px, 1fr)); gap: 8px; margin: 16px 0; }
.cal-day { border: 1px solid var(--border); border-radius: 8px; padding: 8px; background: var(--panel); min-height: 70px; }
.cal-day-name { font-size: .8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.cal-slots { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.cal-slot-edit { display: flex; align-items: center; gap: 4px; }
.cal-slot-edit input[type=time] { flex: 1 1 auto; min-width: 108px; background: var(--field); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 4px 6px; font-size: .9rem; font-family: inherit; }
.cal-slot-edit .slot-del { flex: 0 0 auto; background: none; border: none; color: var(--err-fg); cursor: pointer; font-size: 1.2rem; line-height: 1; padding: 0 2px; }
.cal-add { width: 100%; background: none; border: 1px dashed var(--border); color: var(--accent); border-radius: 6px; padding: 5px; font-size: .82rem; cursor: pointer; }
.cal-add:hover { border-color: var(--accent); background: var(--field); }
.side-nav a.queue-link { padding-left: 52px; font-size: .95rem; }
.side-nav a.queue-link.active { padding-left: 49px; }
.admin-main { flex: 1; min-width: 0; max-width: none; margin: 0; padding: 4px 28px 28px; }
@media (max-width: 700px) {
    .admin-shell { flex-direction: column; min-height: 0; }
    .side-nav { flex-basis: auto; flex-direction: row; flex-wrap: wrap; border-right: none; border-bottom: 1px solid var(--border); padding: 8px; }
    .side-nav a { padding: 8px 12px; }
    .side-nav a.active { border-left: none; padding-left: 12px; }
    .side-nav a.sep { margin-top: 0; border-top: none; padding-top: 8px; }
    .admin-main { padding: 8px 16px; }
}
.subnav { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 18px; border-bottom: 1px solid var(--border); }
.subnav a { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subnav a:hover { color: var(--text); text-decoration: none; }
.subnav a.active { color: var(--accent); font-weight: 600; border-bottom-color: var(--accent); }
.stats { display: flex; flex-wrap: wrap; gap: 14px; margin: 18px 0; }
.stat { display: flex; flex-direction: column; align-items: center; min-width: 96px; padding: 16px 18px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; }
.stat { flex: 1 1 130px; }
.stat .num { font-size: 1.8rem; font-weight: 700; color: var(--accent); }
.stat .lbl { color: var(--muted); font-size: .9rem; }
.stat .stat-sub { color: var(--muted); font-size: .76rem; margin-top: 4px; text-align: center; white-space: nowrap; }
a.stat:hover { border-color: var(--accent); text-decoration: none; }
.dash-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.dash-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.loop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-top: 14px; }
.loop-card { border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; background: var(--panel); }
.loop-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 2px; }
.loop-stats { display: flex; flex-wrap: wrap; gap: 14px; margin: 10px 0 6px; }
.loop-stats strong { color: var(--accent); }
.loop-meta { font-size: .8rem; }
.dash-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
@media (max-width: 760px) { .dash-cols { grid-template-columns: 1fr; } }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot-on { background: #2e7d32; }
.dot-off { background: #9aa6b2; }
.ok { color: #2e7d32; }
.warn { color: #c0392b; }
.tbl { width: 100%; border-collapse: collapse; margin-top: 16px; }
.tbl th, .tbl td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl th { color: var(--muted); font-weight: 600; font-size: .9rem; }
.tbl td.right, .tbl th.right { text-align: right; }
.form-inline { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 16px 0; }
.form-inline input[type=text], .form-inline select, .device-form input[type=text] {
    background: var(--field); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px; font-size: 1rem; font-family: inherit;
}
.device-form { display: flex; flex-direction: column; gap: 12px; margin: 16px 0; max-width: 520px; }
.device-form fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 12px; }
.device-form legend { color: var(--muted); font-size: .9rem; padding: 0 6px; }
.chk { display: inline-flex; align-items: center; gap: 6px; margin: 4px 14px 4px 0; color: var(--text); }
.net { font-weight: 700; color: var(--accent); }
button.danger { background: transparent; color: var(--err-fg); border: 1px solid var(--border); padding: 6px 12px; font-size: .9rem; }
button.danger:hover { background: var(--err-bg); border-color: var(--err-fg); }
.thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); display: block; }
.form input[type=file] { background: var(--field); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px; }
.form input[type=datetime-local], .form input[type=time], .form input[type=number], .form select { background: var(--field); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px; font-size: 1rem; font-family: inherit; max-width: 280px; }
.linkbtn { background: none; border: none; color: var(--accent); padding: 0; font: inherit; cursor: pointer; text-decoration: underline; }
.linkbtn:hover { color: var(--accent-strong); }

/* Per-network text overrides on the post form. */
.variations details { border: 1px solid var(--border); border-radius: 8px; margin: 8px 0; padding: 0 12px; }
.variations details[open] { padding-bottom: 10px; }
.variations summary { cursor: pointer; color: var(--accent); font-weight: 600; padding: 10px 0; list-style: none; }
.variations summary::-webkit-details-marker { display: none; }
.variations summary::before { content: '▸ '; color: var(--muted); }
.variations details[open] summary::before { content: '▾ '; }
.variations label { margin-top: 4px; }

/* Horizontal radio/checkbox rows (override .form label's column flex). */
.form label.chk { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; width: auto; }
.chk-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 6px 0; }
/* Split time selector: hour : min-tens min-ones */
.time-sel { display: inline-flex; align-items: center; gap: 6px; }
.time-sel select { max-width: 84px; }
.time-sel .tcolon { font-weight: 700; }

/* Inline status badge (e.g. a paused queue). */
.badge { display: inline-block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
    padding: 2px 8px; border-radius: 999px; vertical-align: middle; }
.badge-paused { background: var(--err-bg); color: var(--err-fg); }
tr.row-paused td { opacity: .7; }
.bulk-actions { display: flex; gap: 10px; margin: 16px 0 8px; }

@media (max-width: 520px) { .hero h1 { font-size: 2.2rem; } .hero .tagline { font-size: 1.15rem; } }

/* Data Sources */
.ds-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ds-head form { margin: 0; }
.tab-bar { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 16px 0 20px; flex-wrap: wrap; }
.tab-btn { background: none; border: none; border-bottom: 2px solid transparent; padding: 8px 14px; color: var(--muted, #9bb0c9); font: inherit; cursor: pointer; margin-bottom: -1px; }
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--text); border-bottom-color: var(--accent, #6aa3ff); font-weight: 600; }
.tabpanel { display: none; }
.tabpanel.active { display: block; }
a.tab-btn { text-decoration: none; }

/* Clickable stat tiles (sysadmin overview). */
a.stat { text-decoration: none; transition: border-color .12s ease; }
a.stat:hover { border-color: var(--accent, #6aa3ff); }

/* Storage usage table (sysadmin). */
.tbl-usage .row-user td { border-top: 2px solid var(--border); }
.tbl-usage .row-profile td.indent { padding-left: 28px; }
.tbl .row-total td { border-top: 2px solid var(--border); font-weight: 600; }
.ds-caps { white-space: nowrap; }
.ds-caps .cap-count { font-variant-numeric: tabular-nums; margin-right: 8px; }
.ds-caps .cap-genstatus { display: inline-block; margin-left: 8px; font-size: .8rem; }
.qs-card { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: var(--panel); max-width: 920px; }
.qs-card-actions { display: flex; align-items: center; gap: 10px; }
.qs-card-actions form { margin: 0; }
.qs-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 14px; }
.qs-grid input { width: 100%; }
.qs-targets { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; margin: 0; max-height: 180px; overflow: auto; }
.qs-targets legend { font-size: .85rem; padding: 0 4px; }
.qs-targets .chk { display: flex; align-items: center; gap: 6px; margin: 2px 0; }
.ds-filter { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; margin: 8px 0 14px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); }
.ds-filter label { display: flex; flex-direction: column; font-size: .78rem; gap: 3px; }
.ds-filter label.chk { flex-direction: row; align-items: center; gap: 6px; }
.ds-filter input[type=text], .ds-filter input[type=number], .ds-filter input[type=date], .ds-filter select { font-size: .85rem; }
.media-grid { display: grid; grid-template-columns: 200px 1fr; gap: 22px; align-items: start; }
.media-grid.one-col { grid-template-columns: 1fr; }
.media-current { display: flex; flex-direction: column; gap: 10px; }
.media-thumb-lg { width: 100%; max-width: 200px; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: var(--bg); border: 1px solid var(--border); display: block; }
.media-thumb-kind { display: flex; align-items: center; justify-content: center; font-weight: 700; letter-spacing: .05em; color: var(--muted, #9bb0c9); }
.media-controls { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
@media (max-width: 560px) { .media-grid { grid-template-columns: 1fr; } .media-thumb-lg { max-width: 160px; } }
.caption-btn { white-space: nowrap; }
.cap-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cap-list { display: flex; flex-direction: column; gap: 8px; margin: 6px 0; }
.cap-row { display: flex; gap: 8px; align-items: flex-start; }
.cap-row textarea { flex: 1; resize: vertical; }
.pool-table td { vertical-align: top; }
.pool-table .pool-prod { width: 246px; }
.pool-prod-meta { min-width: 0; margin-bottom: 8px; }
.pool-gallery { display: grid; grid-template-columns: repeat(auto-fill, 64px); gap: 8px; }
.pg-item { position: relative; width: 64px; height: 64px; }
.pg-item img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); display: block; background: var(--bg); }
.pg-item.pg-excluded img { opacity: .3; filter: grayscale(1); }
.pg-toggle { position: absolute; top: -7px; right: -7px; width: 19px; height: 19px; line-height: 17px; text-align: center; border-radius: 50%; border: 1px solid var(--panel); background: #c0392b; color: #fff; font-size: 12px; cursor: pointer; padding: 0; }
.pg-item.pg-excluded .pg-toggle { background: #2e7d32; }
.pg-toggle:disabled { opacity: .5; }
.prod-refresh-row { margin-top: 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.prod-refresh-status { font-size: .78rem; }
.prod-refresh-status.err { color: #c0392b; }
.pool-prod-err { color: #c0392b; font-size: .8rem; margin-top: 8px; line-height: 1.4; }
.pool-prod-err:empty { display: none; }
.pool-table .pt-caps { width: auto; }
.cap-cell { display: flex; flex-direction: column; gap: 6px; }
.cap-line { display: flex; gap: 6px; align-items: flex-start; }
.cap-line textarea { flex: 1; resize: vertical; font-size: .85rem; }
.cap-actions { display: flex; align-items: center; gap: 10px; margin-top: 2px; }
.cap-actions .cap-status { font-size: .8rem; }
.cap-status.err { color: #c0392b; }
.cap-status.ok { color: #2e7d32; }
.row-link { cursor: pointer; }
.row-link:hover td { background: rgba(127, 160, 200, .10); }
.ds-modal { border: 1px solid var(--border); border-radius: 12px; padding: 0; width: min(460px, 92vw); background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.ds-modal::backdrop { background: rgba(0, 0, 0, .55); }
.ds-modal form { padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.ds-modal h2 { margin: 0; }
.ds-modal label { display: flex; flex-direction: column; gap: 4px; font-size: .92rem; }
.ds-modal input, .ds-modal select { background: var(--field); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font: inherit; }
.ds-fields { display: none; flex-direction: column; gap: 12px; }
.ds-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-top: 14px; }
.product-card { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--panel); }
.product-card img, .product-card .pc-noimg { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--bg); display: block; }
.product-card .pc-body { padding: 10px 12px; }
.product-card .pc-name { font-weight: 600; font-size: .92rem; line-height: 1.3; }
.product-card .pc-meta { color: var(--muted); font-size: .82rem; margin-top: 5px; }
.product-table td, .product-table th { font-size: .88rem; }
.product-table .pt-thumb { width: 52px; height: 52px; object-fit: cover; border-radius: 6px; display: block; background: var(--bg); }
.product-table .pt-title { font-weight: 600; max-width: 220px; }
.product-table .pt-desc { max-width: 260px; }
.product-table .pt-tax { max-width: 170px; }
.product-table .pt-img { position: relative; width: 52px; }
.product-table .pt-gallery { position: absolute; right: -4px; bottom: -4px; background: var(--accent, #6aa3ff); color: #fff; font-size: .64rem; font-weight: 700; line-height: 1; padding: 2px 4px; border-radius: 6px; }
.product-table .pt-pop { white-space: nowrap; }
.pt-pop .pop-rank { display: inline-block; min-width: 2.2em; font-weight: 700; color: var(--accent, #6aa3ff); }
.pt-pop .pop-score { font-variant-numeric: tabular-nums; font-weight: 600; }
.pt-pop .pop-sig { display: block; font-size: .76rem; margin-top: 2px; }
