/* derdium. brand: black, white, amber dot. Headings in League Spartan. */
:root {
  --bg: #0a0a0a;
  --bg-glow: radial-gradient(900px 420px at 50% -160px, rgba(245,166,35,.16) 0%, rgba(10,10,10,0) 70%);
  --surface: #141414;
  --surface-2: #1c1c1c;
  --surface-3: #242424;
  --border: #2a2a2a;
  --border-strong: #3a3a3a;
  --text: #fafafa;
  --muted: #a3a3a3;
  --faint: #737373;
  --accent: #f5a623;
  --accent-hover: #ffb944;
  --accent-soft: rgba(245,166,35,.13);
  --accent-text: #0a0a0a;
  --success: #34d399;
  --success-soft: rgba(52,211,153,.13);
  --danger: #f87171;
  --danger-soft: rgba(248,113,113,.13);
  --info: #60a5fa;
  --info-soft: rgba(96,165,250,.14);
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.35);
  --radius: 16px;
  --font-brand: "League Spartan", Inter, system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.55 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-glow), var(--bg);
  background-repeat: no-repeat;
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
a { color: var(--accent); }
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.wrap.narrow { max-width: 920px; }
.muted { color: var(--muted); }
h1, h2, h3, h4 { font-family: var(--font-brand); letter-spacing: -.01em; }

/* ---------- Brand ---------- */
.wordmark { font-family: var(--font-brand); font-weight: 700; font-size: 26px; letter-spacing: -.02em; color: var(--text); line-height: 1; }
.wordmark i, .mark i { font-style: normal; color: var(--accent); }
.mark { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 9px; background: #000; border: 1px solid var(--border-strong);
  font-family: var(--font-brand); font-weight: 700; font-size: 22px; line-height: 1; color: #fff; padding-top: 3px; }

/* ---------- Top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 30; backdrop-filter: blur(12px); background: rgba(10,10,10,.82); border-bottom: 1px solid var(--border); }
.topbar-inner { display: flex; align-items: center; gap: 14px; height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex-shrink: 0; }
.brand .mark { display: none; }
.brand .mark i, .mark i { line-height: 1; }
.brand .tag { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); border: 1px solid var(--border); padding: 3px 7px; border-radius: 6px; }
.nav { display: flex; gap: 2px; margin-left: 8px; }
.nav a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14.5px; padding: 8px 12px; border-radius: 9px; white-space: nowrap; }
.nav a:hover { color: var(--text); }
.nav a.on { color: var(--text); background: var(--surface-2); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); background: var(--surface); border: 1px solid var(--border); padding: 6px 11px; border-radius: 999px; white-space: nowrap; }
.pill b { color: var(--text); }
.pill .coin { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.acct-btn { display: inline-flex; align-items: center; gap: 8px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-text); font-weight: 800; font-family: var(--font-brand); font-size: 15px; padding-top: 2px; }

.menu { position: absolute; right: 16px; top: 60px; width: 290px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: 8px; z-index: 40; }
.menu .menu-head { padding: 10px 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.menu .menu-head strong { display: block; overflow-wrap: anywhere; }
.menu a, .menu button.item { display: flex; width: 100%; text-align: left; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; border: 0; background: none; color: var(--text); text-decoration: none; font-size: 14.5px; }
.menu a:hover, .menu button.item:hover { background: var(--surface-2); }
.usage-list { display: grid; gap: 6px; padding: 6px 10px 10px; font-size: 13px; }
.usage-list div { display: flex; justify-content: space-between; color: var(--muted); }
.usage-list b { color: var(--text); font-weight: 600; }

/* ---------- Hero & tabs ---------- */
.hero { text-align: center; padding-top: 52px; padding-bottom: 8px; }
h1 { font-size: clamp(34px, 6.4vw, 60px); line-height: 1.02; letter-spacing: -.03em; margin: 0 0 16px; font-weight: 700; }
.grad, .accent { color: var(--accent); }
.lead { color: var(--muted); max-width: 640px; margin: 0 auto 28px; font-size: 17px; }

.tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 9px 16px; border-radius: 10px; font-weight: 600; font-size: 15px; color: var(--muted); white-space: nowrap; }
.tab svg { width: 18px; height: 18px; }
.tab.active { background: var(--accent); color: var(--accent-text); }
.tab:hover:not(.active) { color: var(--text); }

.panel { padding-top: 24px; }

/* ---------- Inputs & buttons ---------- */
.urlbar { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius); padding: 8px 8px 8px 16px; transition: border-color .15s, box-shadow .15s; }
.urlbar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.urlbar-icon { color: var(--muted); }
.urlbar input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 16px; padding: 10px 0; }

.primary, .outline, .ghost, .danger-btn { border-radius: 11px; font-weight: 600; padding: 11px 20px; border: 1.5px solid transparent; transition: transform .05s, background .15s, opacity .15s, border-color .15s, color .15s; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; white-space: nowrap; }
.primary { background: var(--accent); color: var(--accent-text); }
.primary:hover { background: var(--accent-hover); }
.primary:active, .outline:active, .ghost:active { transform: translateY(1px); }
.primary:disabled, .outline:disabled { opacity: .45; cursor: not-allowed; }
.outline { background: transparent; border-color: var(--border-strong); color: var(--text); }
.outline:hover { border-color: var(--accent); color: var(--accent); }
.ghost { background: var(--surface-2); color: var(--muted); }
.ghost:hover { color: var(--text); }
.danger-btn { background: var(--danger-soft); color: var(--danger); }
.sm { padding: 8px 14px; font-size: 14px; border-radius: 10px; }
.xs { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.block { width: 100%; padding: 14px; font-size: 16px; }
.icon-btn { width: 36px; height: 36px; padding: 0; border-radius: 10px; display: inline-grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
.icon-btn svg { width: 18px; height: 18px; }

.spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.platforms { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 16px 0 0; }
.platforms span { font-size: 12.5px; color: var(--muted); background: var(--surface); border: 1px solid var(--border); padding: 4px 10px; border-radius: 999px; }
.platforms .more { color: var(--accent); border-color: transparent; background: var(--accent-soft); }

select, input[type=number], input[type=text], input[type=email], input[type=date], input[type=search], textarea {
  background: var(--surface-2); border: 1.5px solid var(--border); border-radius: 10px; padding: 9px 12px; font-size: 15px; outline: 0; min-width: 0; color: var(--text);
}
select:focus, input:focus, textarea:focus { border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--faint); }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-top: 20px; }
.alert { border-radius: 12px; padding: 12px 16px; margin-top: 16px; font-size: 15px; }
.alert.error { background: var(--danger-soft); color: var(--danger); }
.alert.info { background: var(--accent-soft); color: var(--accent); }
.alert a { color: inherit; font-weight: 700; }

.skeleton { display: flex; gap: 16px; }
.sk-thumb { width: 200px; aspect-ratio: 16/9; border-radius: 12px; background: var(--surface-2); animation: pulse 1.2s ease-in-out infinite; flex-shrink: 0; }
.sk-lines { flex: 1; display: grid; gap: 10px; align-content: start; padding-top: 6px; }
.sk-lines div { height: 14px; border-radius: 6px; background: var(--surface-2); animation: pulse 1.2s ease-in-out infinite; }
.sk-lines div:nth-child(1) { width: 30%; } .sk-lines div:nth-child(2) { width: 85%; } .sk-lines div:nth-child(3) { width: 50%; }
@keyframes pulse { 50% { opacity: .5; } }

.media-head { display: flex; gap: 18px; align-items: flex-start; }
.thumb { position: relative; width: 220px; flex-shrink: 0; aspect-ratio: 16/9; border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dur { position: absolute; right: 6px; bottom: 6px; background: rgba(0,0,0,.8); color: #fff; font-size: 12px; font-weight: 600; padding: 2px 6px; border-radius: 6px; }
.dur:empty { display: none; }
.media-meta { min-width: 0; }
.media-meta h2 { font-size: 21px; line-height: 1.25; margin: 6px 0 4px; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.media-meta p { margin: 0; font-size: 14px; }
.badge { display: inline-block; font-size: 12px; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 2px 9px; border-radius: 999px; }

.items { display: flex; gap: 8px; overflow-x: auto; padding: 16px 0 2px; }
.items button { flex-shrink: 0; width: 72px; height: 72px; border-radius: 10px; overflow: hidden; border: 2px solid transparent; padding: 0; background: var(--surface-2); position: relative; }
.items button img { width: 100%; height: 100%; object-fit: cover; }
.items button span { position: absolute; left: 4px; top: 4px; background: rgba(0,0,0,.75); color: #fff; font-size: 11px; padding: 0 5px; border-radius: 5px; }
.items button.on { border-color: var(--accent); }

.opt-grid { display: grid; gap: 14px; margin-top: 20px; }
.opt-block { border: 1px solid var(--border); border-radius: 14px; padding: 14px; }
.opt-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.opt-title h3 { display: flex; align-items: center; gap: 8px; font-size: 17px; margin: 0; }
.opt-title h3 svg { color: var(--accent); width: 18px; height: 18px; }

.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--surface-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }
.seg.wide { display: flex; width: 100%; }
.seg.wide button { flex: 1; padding: 9px 8px; font-size: 14px; display: flex; flex-direction: column; align-items: center; line-height: 1.3; }
.seg.wide small { font-weight: 500; font-size: 11.5px; color: var(--muted); }

.rows { display: grid; gap: 6px; }
.row { display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 12px; border-radius: 10px; background: var(--surface-2); }
.row .q { font-weight: 700; min-width: 64px; }
.row .hd { font-size: 10.5px; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 1px 6px; border-radius: 5px; margin-left: 6px; vertical-align: 2px; }
.row .meta { flex: 1; color: var(--muted); font-size: 14px; }
.row .primary { padding: 7px 14px; font-size: 14px; }

.audio-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.audio-row label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 500; }

/* ---------- Jobs ---------- */
.job .job-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.job h3 { margin: 0; font-size: 17px; display: flex; align-items: center; gap: 10px; }
.job .stage { font-size: 14px; color: var(--muted); margin: 10px 0 8px; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.bar { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar > div { height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .5s ease; }
.bar.indet > div { width: 30% !important; animation: indet 1.2s ease-in-out infinite; }
@keyframes indet { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
.done-box { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.done-icon { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--success-soft); color: var(--success); flex-shrink: 0; }
.done-text { flex: 1; min-width: 180px; }
.done-text strong { display: block; overflow-wrap: anywhere; }
.done-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.saved { display: inline-block; font-weight: 700; color: var(--success); background: var(--success-soft); padding: 1px 8px; border-radius: 6px; font-size: 13px; }

/* ---------- Dropzone + settings ---------- */
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px; padding: 32px 16px; border: 2px dashed var(--border-strong); border-radius: 14px; cursor: pointer; transition: border-color .15s, background .15s; }
.drop svg { width: 34px; height: 34px; color: var(--accent); margin-bottom: 4px; }
.drop span { font-size: 13.5px; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop.has-file { border-style: solid; border-color: var(--accent); }

.settings { display: grid; gap: 16px; margin-top: 18px; }
.field { display: grid; gap: 6px; min-width: 0; }
.label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field select { width: 100%; padding: 10px 12px; }
.target-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.num { display: flex; align-items: center; background: var(--surface-2); border: 1.5px solid var(--border); border-radius: 10px; padding-right: 12px; }
.num:focus-within { border-color: var(--accent); }
.num input { border: 0; width: 100px; background: none; font-weight: 700; font-size: 16px; }
.num span { color: var(--muted); font-weight: 600; font-size: 14px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 5px 11px; font-size: 13px; color: var(--muted); }
.chips button:hover, .chips button.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.list-head h3 { margin: 0; font-size: 17px; }
.list-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.img-list { display: grid; gap: 8px; }
.img-item { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 12px; background: var(--surface-2); }
.img-item img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; background: var(--border); flex-shrink: 0; }
.img-item .info { flex: 1; min-width: 0; }
.img-item .name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.img-item .sizes { font-size: 13px; color: var(--muted); }
.img-item .err { color: var(--danger); }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.7); backdrop-filter: blur(4px); z-index: 60; display: grid; place-items: center; padding: 16px; }
.modal { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 26px; box-shadow: var(--shadow); position: relative; }
.modal h2 { margin: 12px 0 6px; font-size: 26px; }
.modal p { margin: 0 0 16px; color: var(--muted); font-size: 15px; }
.modal .close { position: absolute; top: 12px; right: 12px; }
.modal input { width: 100%; padding: 12px 14px; font-size: 16px; }
.modal .code-input { letter-spacing: .5em; text-align: center; font-size: 24px; font-weight: 700; font-family: var(--font-brand); }
.modal form { display: grid; gap: 12px; }
.modal .fine { font-size: 12.5px; color: var(--faint); margin-top: 14px; }
.perks { display: grid; gap: 6px; margin: 0 0 16px; padding: 12px 14px; background: var(--surface-2); border-radius: 12px; font-size: 14px; color: var(--muted); }
.perks div::before { content: "•"; color: var(--accent); margin-right: 8px; font-weight: 900; }

/* ---------- Features & footer ---------- */
.features { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 56px; }
.feat { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; }
.feat h4 { margin: 0 0 4px; font-size: 17px; }
.feat p { margin: 0; color: var(--muted); font-size: 13.5px; }
.footer { text-align: center; font-size: 13.5px; padding-top: 36px; padding-bottom: 40px; color: var(--muted); }
.footer p { margin: 6px auto; max-width: 680px; }
.footer .wordmark { font-size: 22px; display: inline-block; margin-bottom: 6px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: 14px; z-index: 80; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .features { grid-template-columns: 1fr 1fr; }
  .brand .tag { display: none; }
}
@media (max-width: 680px) {
  .topbar-inner { gap: 8px; height: 58px; }
  .brand .wordmark { display: none; }
  .brand .mark { display: inline-flex; }
  .nav { margin-left: 0; }
  .nav a { padding: 7px 9px; font-size: 14px; }
  .pill.credits-pill .lbl { display: none; }
  .acct-btn .who { display: none; }
  .menu { left: 16px; right: 16px; width: auto; }
  .hero { padding-top: 30px; }
  .lead { font-size: 15.5px; }
  .tab { padding: 8px 12px; font-size: 14px; }
  .tab svg { display: none; }
  .urlbar { flex-wrap: wrap; padding: 8px; }
  .urlbar-icon { display: none; }
  .urlbar input { flex-basis: 100%; padding: 8px; }
  .urlbar .ghost { flex: 0 0 auto; }
  .urlbar .primary { flex: 1; }
  .media-head { flex-direction: column; }
  .thumb, .sk-thumb { width: 100%; }
  .skeleton { flex-direction: column; }
  .field-row { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  .features { grid-template-columns: 1fr; }
  .row .meta { font-size: 13px; }
  .seg.wide button { font-size: 13px; padding: 8px 4px; }
}
@media (max-width: 380px) {
  .nav a { padding: 6px 7px; font-size: 13px; }
  .top-right .pill { padding: 5px 8px; }
}

.quota-line { font-size: 13.5px; text-align: center; margin: 10px 0 0; min-height: 1.4em; }
.quota-line a { color: var(--accent); font-weight: 600; }

/* ---------- Writing tools ---------- */
.w-options { display: block; margin-top: 0; padding: 16px 20px; }
.w-options .opt { display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: flex-end; }
.opt-note { margin: 0; font-size: 14px; }
.workspace { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; align-items: stretch; }
.workspace .card { margin-top: 0; }
.pane { display: flex; flex-direction: column; min-width: 0; padding: 0; overflow: hidden; }
.pane-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px 12px 18px; border-bottom: 1px solid var(--border); min-height: 60px; flex-wrap: wrap; }
.pane-head h3 { margin: 0; font-size: 18px; }
.pane-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.upload-btn { cursor: pointer; }
.upload-btn svg { width: 16px; height: 16px; }
.pane-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px 12px 18px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.drop-overlay { position: relative; flex: 1; display: flex; }
.drop-overlay.over::after { content: "Drop your Word, PDF or text file"; position: absolute; inset: 8px; border: 2px dashed var(--accent); border-radius: 12px; background: rgba(10,10,10,.9); display: grid; place-items: center; color: var(--accent); font-weight: 600; }
#w-input { flex: 1; width: 100%; min-height: 420px; border: 0; border-radius: 0; background: transparent; resize: vertical; padding: 16px 18px; font-size: 16px; line-height: 1.7; }
#w-input:focus { box-shadow: none; }
.pane .quota-line { margin: 0 0 12px; padding: 0 14px; }

.out { flex: 1; min-height: 420px; max-height: 70vh; overflow-y: auto; padding: 16px 18px; font-size: 16px; line-height: 1.75; outline: none; overflow-wrap: anywhere; }
.out p { margin: 0 0 1em; }
.out .empty { color: var(--faint); font-size: 15px; display: grid; place-items: center; text-align: center; min-height: 380px; padding: 0 20px; }
.out .w { cursor: pointer; border-radius: 4px; }
.out .w:hover { background: var(--surface-3); }
mark { color: inherit; border-radius: 4px; padding: 0 1px; }
mark.chg { background: rgba(245,166,35,.2); box-shadow: inset 0 -2px 0 rgba(245,166,35,.65); }
mark.edited { background: var(--info-soft); box-shadow: inset 0 -2px 0 rgba(96,165,250,.7); }
.hl-off mark.chg, .hl-off mark.edited { background: none; box-shadow: none; }
.out .w.active { outline: 2px solid var(--accent); outline-offset: 1px; }
.out-progress { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; padding: 10px 0 0; }
.legend { display: flex; gap: 10px; font-size: 12.5px; color: var(--muted); }
.foot-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.switch { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); cursor: pointer; user-select: none; margin-right: 4px; }
.switch input { display: none; }
.switch span { width: 32px; height: 18px; border-radius: 999px; background: var(--surface-3); position: relative; transition: background .15s; }
.switch span::after { content: ""; position: absolute; left: 2px; top: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.switch input:checked + span { background: var(--accent-soft); }
.switch input:checked + span::after { transform: translateX(14px); background: var(--accent); }

.dl-wrap { position: relative; }
.dl-menu { top: 42px; right: 0; width: 180px; }

/* Suggestion popover (bottom sheet on phones) */
.pop { position: absolute; z-index: 50; width: 300px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: var(--shadow); padding: 10px; }
.pop-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13.5px; color: var(--muted); padding: 2px 2px 8px 6px; }
.pop-head b { color: var(--text); }
.pop-head .icon-btn { width: 28px; height: 28px; }
.pop-list { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px; min-height: 34px; }
.pop-list button { border: 1px solid var(--border); background: var(--surface-2); border-radius: 8px; padding: 6px 10px; font-size: 14px; }
.pop-list button:hover { border-color: var(--accent); color: var(--accent); }
.pop-list .muted { font-size: 13.5px; padding: 6px; }
.pop-sep { height: 1px; background: var(--border); margin: 8px 0; }
.pop-item { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; padding: 8px; border-radius: 8px; font-size: 14px; text-align: left; color: var(--text); }
.pop-item:hover { background: var(--surface-2); }
.pop-item svg { width: 16px; height: 16px; color: var(--accent); }
.pop-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop-sentences { display: grid; gap: 6px; }
.pop-sentences button { text-align: left; border: 1px solid var(--border); background: var(--surface-2); border-radius: 10px; padding: 8px 10px; font-size: 14px; line-height: 1.45; }
.pop-sentences button:hover { border-color: var(--accent); }

/* AI checker & plagiarism results */
.score-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 16px; }
.gauge { --p: 50; --c: var(--accent); width: 112px; height: 112px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--surface-3) 0); }
.gauge > div { width: 88px; height: 88px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; text-align: center; line-height: 1.05; }
.gauge b { font-family: var(--font-brand); font-size: 28px; }
.gauge small { font-size: 11px; color: var(--muted); }
.score-text h4 { margin: 0 0 4px; font-size: 22px; }
.score-text p { margin: 0; color: var(--muted); font-size: 14px; }
.split-bar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; margin-top: 10px; background: var(--surface-3); width: 220px; max-width: 100%; }
.split-bar .h { background: var(--success); }
.split-bar .a { background: var(--danger); }
.reasons { margin: 0 0 16px; padding-left: 18px; color: var(--muted); font-size: 14.5px; }
.reasons li { margin-bottom: 4px; }
.signals { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-bottom: 16px; }
.signals div { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.signals b { display: block; font-size: 18px; font-family: var(--font-brand); }
.signals span { font-size: 12px; color: var(--muted); }
.sent-ai-high { background: var(--danger-soft); box-shadow: inset 0 -2px 0 rgba(248,113,113,.6); border-radius: 4px; }
.sent-ai-mid { background: var(--accent-soft); border-radius: 4px; }
.sent-match { background: var(--danger-soft); box-shadow: inset 0 -2px 0 rgba(248,113,113,.7); border-radius: 4px; }
.sent-checked { text-decoration: underline dotted var(--faint); text-underline-offset: 4px; }
.analyzed { font-size: 15px; line-height: 1.8; border-top: 1px solid var(--border); padding-top: 14px; }
.analyzed h5 { margin: 0 0 8px; font-size: 13px; color: var(--muted); font-family: Inter, sans-serif; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.sources { display: grid; gap: 8px; margin-bottom: 16px; }
.source { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.source .n { font-family: var(--font-brand); font-weight: 700; color: var(--danger); min-width: 34px; font-size: 18px; }
.source a { color: var(--text); font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.source a:hover { color: var(--accent); }
.source small { display: block; color: var(--muted); overflow-wrap: anywhere; }
.ok-box { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 12px; background: var(--success-soft); color: var(--success); margin-bottom: 16px; font-weight: 600; }

@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
  #w-input { min-height: 260px; }
  .out { min-height: 260px; max-height: none; }
  .out .empty { min-height: 220px; }
}
@media (max-width: 680px) {
  .w-options { padding: 14px; }
  .w-options .opt { gap: 12px; }
  .pop { position: fixed; left: 8px !important; right: 8px; bottom: 8px; top: auto !important; width: auto; max-height: 70vh; overflow-y: auto; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .legend { display: none; }
  .pane-foot .primary { flex: 1; }
  .upload-btn span { display: none; }
  .score-head { gap: 14px; }
}

/* ---------- Admin ---------- */
.admin { padding-top: 28px; }
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.admin-head h1 { font-size: 40px; margin: 0; }
.view { padding-top: 8px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 16px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; }
.stat b { display: block; font-family: var(--font-brand); font-size: 32px; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 13px; }
.stat.warn { border-color: var(--accent); }
.table-wrap { overflow-x: auto; margin: 0 -4px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover { background: var(--surface-2); }
.tbl input[type=number] { width: 90px; padding: 7px 9px; }
.tag-plan { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--surface-3); color: var(--muted); }
.tag-plan.pro { background: var(--accent-soft); color: var(--accent); }
.tag-plan.banned { background: var(--danger-soft); color: var(--danger); }
.toolbar { display: flex; gap: 10px; justify-content: space-between; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input[type=search] { flex: 1; min-width: 200px; max-width: 360px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form input { min-width: 0; flex: 1; }
.pager { display: flex; gap: 8px; justify-content: center; align-items: center; margin-top: 14px; font-size: 14px; color: var(--muted); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.two-col .card { margin-top: 16px; }
.card h3 { margin-top: 0; font-size: 20px; }
.stack { display: grid; gap: 12px; }
.stack input { width: 100%; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.settings-grid input { width: 100%; }
.save-bar { position: sticky; bottom: 12px; display: flex; align-items: center; justify-content: flex-end; gap: 14px; margin-top: 16px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); }
.modal.wide { max-width: 640px; max-height: calc(100vh - 32px); overflow-y: auto; }
.modal.wide h2 { overflow-wrap: anywhere; padding-right: 40px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0; }
.detail-grid .field input, .detail-grid .field select, .detail-grid .field textarea { width: 100%; }
.detail-grid .full { grid-column: 1 / -1; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.mini-list { max-height: 220px; overflow-y: auto; font-size: 13.5px; }
.mini-list div { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.mini-list .pos { color: var(--success); font-weight: 700; }
.mini-list .neg { color: var(--danger); font-weight: 700; }
.modal-actions { display: flex; gap: 8px; justify-content: space-between; flex-wrap: wrap; margin-top: 16px; }

@media (max-width: 760px) {
  .two-col { grid-template-columns: 1fr; }
  .admin-head h1 { font-size: 32px; }
  .detail-grid { grid-template-columns: 1fr; }
  /* Subscriber table becomes cards */
  .users-tbl thead { display: none; }
  .users-tbl, .users-tbl tbody, .users-tbl tr, .users-tbl td { display: block; width: 100%; }
  .users-tbl tr { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
  .users-tbl td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 10px; }
  .users-tbl td::before { content: attr(data-l); color: var(--muted); font-size: 12.5px; }
  .users-tbl td:first-child { font-weight: 700; overflow-wrap: anywhere; }
  .users-tbl td:first-child::before, .users-tbl td:last-child::before { content: none; }
  .modal-bg { align-items: end; padding: 0; }
  .modal.wide { border-radius: 18px 18px 0 0; max-height: 92vh; }
}

/* Phones: tab bars become a full-width grid so every tab stays visible */
@media (max-width: 680px) {
  .tabs { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; overflow: visible; }
  .tabs.tabs-4 { grid-template-columns: repeat(2, 1fr); }
  .tab { justify-content: center; white-space: normal; text-align: center; line-height: 1.2; padding: 10px 6px; font-size: 13.5px; }
  .admin-head .tabs { grid-template-columns: repeat(2, 1fr); }
}
