/* Sandesh News AI — design system v2 (docs/DESIGN.md, live reference /styleguide).
   Brand red + white, neutral gray scale; no other hues except tiny status dots. */
@font-face { font-family: "Noto Sans Gujarati"; src: url("../fonts/NotoSansGujarati.ttf") format("truetype"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Noto Serif Gujarati"; src: url("../fonts/NotoSerifGujarati.ttf") format("truetype"); font-weight: 100 900; font-display: swap; }

:root {
  --red: #C8102E; --red-700: #A30D25; --red-50: #FDF1F3; --red-100: #F9DCE1;
  --white: #FFFFFF;
  --gray-50: #F8F9FA; --gray-100: #F1F3F5; --gray-200: #E5E7EB; --gray-300: #D1D5DB; --gray-400: #9CA3AF;
  --gray-500: #6B7280; --gray-600: #4B5563; --gray-700: #374151; --gray-800: #1F2937; --gray-900: #111827;
  --ok: #1E8E3E; --warn: #B7791F;
  --radius: 6px; --radius-lg: 8px;
  --shadow: 0 8px 24px rgba(17, 24, 39, .12), 0 2px 6px rgba(17, 24, 39, .06);
  --sidebar: 232px;
  /* legacy aliases (older templates) */
  --ink: var(--gray-900); --ink-60: var(--gray-600); --red-08: var(--red-50); --red-20: var(--gray-200);
}

* { box-sizing: border-box; }
html, body { margin: 0; color: var(--gray-900); background: var(--gray-50); }
body { font: 14px/1.55 "Noto Sans Gujarati", system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, .h1 { font-size: 22px; line-height: 1.3; font-weight: 600; margin: 0; color: var(--gray-900); }
h2, .h2, .section-title { font-size: 17px; line-height: 1.4; font-weight: 600; margin: 24px 0 8px; color: var(--gray-800); }
h3, .h3 { font-size: 15px; font-weight: 600; margin: 0 0 8px; color: var(--gray-800); }
p { margin: 0 0 12px; }
code, .mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }
code { background: var(--gray-100); border-radius: 4px; padding: 1px 5px; }
pre { margin: 0; }
hr { border: 0; border-top: 1px solid var(--gray-200); margin: 24px 0; }
.meta { font-size: 13px; color: var(--gray-600); }
.help { font-size: 12px; color: var(--gray-500); }
.nums { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.muted { color: var(--gray-500); }
.ok { font-size: 13px; color: var(--gray-800); }
.error { color: var(--red); margin: 0; }
.flag { font-size: 12px; color: var(--red); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Gujarati content */
.gu-article { font-family: "Noto Serif Gujarati", serif; font-size: 17px; line-height: 1.8; color: var(--gray-900); }
.gu-headline { font-family: "Noto Serif Gujarati", serif; font-weight: 700; font-size: 26px; line-height: 1.35; }
textarea[lang="gu"], .gu-text { font-family: "Noto Serif Gujarati", serif; font-size: 16px; line-height: 1.75; }

/* icons */
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.icon-sm { width: 14px; height: 14px; vertical-align: -2px; }
.icon-lg { width: 40px; height: 40px; stroke-width: 1.5; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar-col { background: var(--white); border-right: 1px solid var(--gray-200); }
.sidebar { display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 18px 20px 14px; font-weight: 700; font-size: 18px; color: var(--red); }
.brand-mark { width: 28px; height: 28px; border-radius: 7px; background: var(--red); color: var(--white); display: grid; place-items: center; font-size: 15px; }
.nav-group { padding: 6px 12px 10px; }
.nav-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--gray-500); padding: 8px 10px 4px; }
.nav-group ul { list-style: none; margin: 0; padding: 0; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius); color: var(--gray-700);
  font-size: 14px; position: relative; }
.nav-item:hover { background: var(--gray-100); text-decoration: none; }
.nav-item.active { background: var(--red-50); color: var(--red); font-weight: 600; }
.nav-item.active::before { content: ""; position: absolute; left: -12px; top: 6px; bottom: 6px; width: 3px; border-radius: 0 3px 3px 0; background: var(--red); }
.nav-item.disabled { color: var(--gray-400); cursor: default; }
.nav-item.disabled:hover { background: none; }
.nav-foot { margin-top: auto; padding: 12px 20px 16px; font-size: 12px; color: var(--gray-500); border-top: 1px solid var(--gray-200); }

.main { min-width: 0; display: flex; flex-direction: column; overflow-x: clip; }
.topbar { height: 52px; background: var(--white); border-bottom: 1px solid var(--gray-200); display: flex; align-items: center;
  gap: 12px; padding: 0 24px; position: sticky; top: 0; z-index: 20; }
.menu-btn { flex: none; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--gray-500); min-width: 0; overflow: hidden; white-space: nowrap; }
.crumbs a { color: var(--gray-600); }
.crumbs .sep { color: var(--gray-300); }
.crumbs .here { color: var(--gray-900); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.usermenu { margin-left: auto; position: relative; }
.usermenu summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 8px; border-radius: var(--radius); font-size: 13px; color: var(--gray-700); }
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu summary:hover { background: var(--gray-100); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--gray-800); color: var(--white); display: grid; place-items: center; font-size: 12px; font-weight: 600; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); min-width: 200px; padding: 6px; z-index: 30; }
.menu .menu-head { padding: 8px 10px; font-size: 12px; color: var(--gray-500); border-bottom: 1px solid var(--gray-100); margin-bottom: 4px; }
.menu a, .menu button { display: flex; gap: 8px; align-items: center; width: 100%; padding: 7px 10px; border-radius: var(--radius); color: var(--gray-800);
  background: none; border: 0; font: inherit; font-size: 13px; cursor: pointer; text-align: left; }
.menu a:hover, .menu button:hover { background: var(--gray-100); text-decoration: none; }

.page { padding: 24px 32px 48px; max-width: 1360px; width: 100%; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.page-head .desc { margin: 4px 0 0; color: var(--gray-600); font-size: 14px; max-width: 760px; }
.page-head .actions { display: flex; gap: 8px; flex: none; align-items: center; }
.content { min-width: 0; }

/* ☰ (base.html): >= 1280 px collapses the sidebar (html.nav-collapsed, remembered); below, the sidebar is an overlay
   (html.nav-open) above everything, the ad page's Tools drawer included */
@media (min-width: 1280px) {
  html.nav-collapsed .shell { grid-template-columns: minmax(0, 1fr); }
  html.nav-collapsed .sidebar-col { display: none; }
}
@media (max-width: 1279.98px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar-col { position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar); z-index: 50; transform: translateX(-100%); transition: transform .15s; box-shadow: var(--shadow); }
  html.nav-open .sidebar-col { transform: none; }
  .nav-backdrop:not([hidden]) { position: fixed; inset: 0; z-index: 49; background: rgba(17, 24, 39, .4); pointer-events: none; }
}
.nav-backdrop[hidden] { display: none; }
/* while an overlay is open, a click on an iframe reaches the page (it closes the overlay, D176) */
html.nav-open iframe, html.ad-drawer-open #ad-frame { pointer-events: none; }
@media (max-width: 900px) {
  .page { padding: 16px; }
  .page-head { flex-direction: column; }
}

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: var(--radius);
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; border: 1px solid transparent; white-space: nowrap; text-decoration: none !important;
  transition: background .1s, border-color .1s; }
.btn-primary { background: var(--red); color: var(--white); border-color: var(--red); }
.btn-primary:hover { background: var(--red-700); border-color: var(--red-700); }
.btn-secondary { background: var(--white); color: var(--gray-800); border-color: var(--gray-300); }
.btn-secondary:hover { background: var(--gray-100); }
.btn-ghost { background: transparent; color: var(--gray-700); }
.btn-ghost:hover { background: var(--gray-100); }
.btn-danger { background: var(--white); color: var(--red); border-color: var(--red-100); }
.btn-danger:hover { background: var(--red-50); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn-icon { width: 36px; padding: 0; }
.btn-sm.btn-icon { width: 28px; }
.btn[disabled], .btn.disabled { opacity: .5; cursor: not-allowed; }
.htmx-request.btn, .btn.htmx-request { opacity: .7; cursor: progress; }
button.link { background: none; border: 0; padding: 0; color: var(--red); font: inherit; cursor: pointer; text-align: left; }
button.link.error { color: var(--red); }
.btn-row, .bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.bar { justify-content: space-between; margin: 16px 0; }

/* ---------- forms ---------- */
input, select, textarea { font: inherit; font-size: 14px; color: var(--gray-900); background: var(--white); border: 1px solid var(--gray-300);
  border-radius: var(--radius); padding: 7px 10px; width: 100%; transition: border-color .1s, box-shadow .1s; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select { height: 36px; }
input[type=file] { padding: 6px; }
input::placeholder, textarea::placeholder { color: var(--gray-400); }
input:hover, select:hover, textarea:hover { border-color: var(--gray-400); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px var(--red-100); }
input[readonly], input:disabled, select:disabled, textarea:disabled { background: var(--gray-100); color: var(--gray-500); }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; accent-color: var(--red); margin: 0; flex: none; }
textarea { line-height: 1.6; resize: vertical; }
label, .label { font-size: 13px; font-weight: 600; color: var(--gray-700); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field .help { font-weight: 400; }
.field.invalid input, .field.invalid textarea, .field.invalid select, input.attention { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-100); }
.field-error { font-size: 12px; color: var(--red); }
.check, label.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 400; color: var(--gray-800); cursor: pointer; }
.check input { width: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack > label:not(.check) { display: flex; flex-direction: column; gap: 6px; }
.filters, .toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 16px; }
.filters label:not(.check), .toolbar label:not(.check) { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.filters select, .toolbar select { width: auto; min-width: 140px; }
.filters input:not([type=checkbox]), .toolbar input:not([type=checkbox]) { width: auto; min-width: 120px; }
.search { position: relative; }
.search .icon { position: absolute; left: 10px; top: 9px; color: var(--gray-400); }
.search input { padding-left: 34px; min-width: 240px; }
.save-state { font-size: 12px; color: var(--gray-500); }

/* ---------- cards, grids ---------- */
.card { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius-lg); padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h2, .card-head h3 { margin: 0; }
.card + .card { margin-top: 16px; }
.card.pad-0 { padding: 0; overflow: hidden; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 1100px) { .split { grid-template-columns: 1fr; } }
.section { margin-top: 28px; }

/* ---------- tables ---------- */
.table-wrap, .table-scroll { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius-lg); overflow: auto; max-height: 75vh; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--white); }
.table-wrap .table, .table-scroll .table { margin: 0; }
:not(.table-wrap):not(.table-scroll) > .table { border: 1px solid var(--gray-200); border-radius: var(--radius-lg); margin: 12px 0; overflow: hidden; }
.table th { position: sticky; top: 0; z-index: 2; background: var(--gray-50); text-align: left; font-size: 12px; font-weight: 600; color: var(--gray-600);
  padding: 10px 12px; border-bottom: 1px solid var(--gray-200); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--gray-100); vertical-align: top; color: var(--gray-800); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--gray-50); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr.verified td { color: var(--gray-500); }
.table td a { color: var(--gray-900); font-weight: 500; }
.table td a:hover { color: var(--red); }
.table tr.selected td { background: var(--red-50); }
.stats td { white-space: unset; }
.pagination, .pager { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 12px 0; font-size: 13px; color: var(--gray-600); }
.pagination a, .pager a { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px; padding: 0 8px; border: 1px solid var(--gray-300);
  border-radius: var(--radius); color: var(--gray-700); background: var(--white); }
.pagination a.active, .pager a.active { border-color: var(--red); color: var(--red); background: var(--red-50); }

/* ---------- chips, badges, tabs ---------- */
.chip, .badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 500;
  background: var(--gray-100); color: var(--gray-700); border: 1px solid var(--gray-200); white-space: nowrap; vertical-align: 1px; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--gray-400); }
.chip.no-dot::before, .badge::before { display: none; }
.chip-ok::before { background: var(--ok); }
.chip-warn::before { background: var(--warn); }
.chip-error, .badge-error { background: var(--red-50); color: var(--red); border-color: var(--red-100); }
.chip-error::before { background: var(--red); }
/* long error messages wrap inside the chip instead of running on (one line: same 22 px pill as before) */
.chip-error { height: auto; min-height: 22px; max-width: 100%; padding: 2px 9px; line-height: 16px; border-radius: 11px;
  white-space: normal; overflow-wrap: anywhere; }
.chip-error::before { flex: none; align-self: flex-start; margin-top: 4.5px; }
.chip-brand, .badge-approved { background: var(--red-50); color: var(--red); border-color: var(--red-100); }
.chip-brand::before { background: var(--red); }
.count { display: inline-grid; place-items: center; min-width: 20px; height: 18px; padding: 0 6px; border-radius: 999px; font-size: 11px; font-weight: 600;
  background: var(--gray-200); color: var(--gray-700); }
.count.red { background: var(--red); color: var(--white); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--gray-200); margin-bottom: 20px; }
.tabs a { display: inline-flex; align-items: center; gap: 6px; padding: 10px 12px; color: var(--gray-600); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; }
.tabs a:hover { color: var(--gray-900); text-decoration: none; }
.tabs a.active { color: var(--red); border-bottom-color: var(--red); }

/* ---------- feedback ---------- */
.toast { position: fixed; top: 64px; right: 20px; z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.toast-msg { background: var(--white); border: 1px solid var(--gray-200); border-left: 3px solid var(--gray-800); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 10px 14px; font-size: 13px; min-width: 240px; max-width: 380px; animation: toast-hide 4s forwards; }
.toast-error { border-left-color: var(--red); color: var(--red); }
@keyframes toast-hide { 0%, 85% { opacity: 1; } 100% { opacity: 0; visibility: hidden; } }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-lg); border: 1px solid var(--gray-200); background: var(--white); margin-bottom: 16px; font-size: 13px; }
.alert .icon { margin-top: 1px; }
.alert-error { border-color: var(--red-100); background: var(--red-50); color: var(--gray-900); }
.alert-error .icon { color: var(--red); }
.alert-warn { border-color: var(--gray-300); background: var(--gray-50); color: var(--gray-900); }
.alert-warn .icon { color: var(--warn); }
.alert-info .icon { color: var(--gray-500); }
.alert-ok .icon { color: var(--ok); }
.htmx-request::before { content: ""; position: fixed; top: 0; left: 0; right: 0; height: 2px; background: var(--red); z-index: 100; }

/* tooltip: <span class="tip" tabindex="0" data-tip="…">?</span> */
.tip { position: relative; display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--gray-300);
  color: var(--gray-500); font-size: 10px; font-weight: 700; cursor: help; vertical-align: 2px; margin-left: 4px; background: var(--white); line-height: 1; }
.tip:hover, .tip:focus { border-color: var(--gray-600); color: var(--gray-800); outline: none; }
.tip::after { content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); width: max-content; max-width: 280px;
  background: var(--gray-900); color: var(--white); font-size: 12px; font-weight: 400; line-height: 1.5; padding: 8px 10px; border-radius: 6px;
  white-space: normal; text-align: left; pointer-events: none; z-index: 50; display: none; }
.tip:hover::after, .tip:focus::after { display: block; }

/* modal (native <dialog>) */
dialog.modal { border: 0; border-radius: var(--radius-lg); padding: 0; width: min(480px, 92vw); box-shadow: var(--shadow); }
dialog.modal::backdrop { background: rgba(17, 24, 39, .4); }
.modal-body { padding: 20px 24px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 24px; background: var(--gray-50); border-top: 1px solid var(--gray-200); }

/* empty state */
.empty { text-align: center; padding: 40px 24px; color: var(--gray-500); background: var(--white); border: 1px dashed var(--gray-300); border-radius: var(--radius-lg); }
.empty .icon-lg { color: var(--gray-400); margin-bottom: 8px; }
.empty h3 { margin: 4px 0; color: var(--gray-800); }
.empty p { margin: 4px auto 14px; max-width: 460px; font-size: 13px; }

/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 14px; }
.tile { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius-lg); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; color: inherit; }
a.tile:hover { border-color: var(--gray-300); text-decoration: none; box-shadow: 0 1px 3px rgba(17,24,39,.06); }
.tile-label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--gray-600); font-weight: 500; }
.tile-label .icon { width: 16px; height: 16px; color: var(--gray-400); }
.tile-value { font-size: 28px; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; color: var(--gray-900); }
.tile-meta { font-size: 12px; color: var(--gray-500); }

/* progress */
.progress { display: flex; flex-direction: column; gap: 4px; }
.progress-top { display: flex; justify-content: space-between; font-size: 12px; color: var(--gray-600); }
.bar-track { height: 6px; background: var(--gray-200); border-radius: 3px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--red); border-radius: 3px; }
.bar-fill.neutral { background: var(--gray-700); }
.progress-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-bottom: 16px; }
.progress-item { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius-lg); padding: 10px 14px; }
.progress-head { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; margin-bottom: 6px; }

/* stepper */
.stepper { display: flex; gap: 0; list-style: none; padding: 0; margin: 0; counter-reset: step; }
.stepper li { flex: 1; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--gray-500); counter-increment: step; }
.stepper li::before { content: counter(step); width: 24px; height: 24px; flex: none; border-radius: 50%; border: 2px solid var(--gray-300); display: grid; place-items: center; font-size: 12px; font-weight: 600; background: var(--white); }
.stepper li::after { content: ""; flex: 1; height: 2px; background: var(--gray-200); margin-right: 8px; }
.stepper li:last-child::after { display: none; }
.stepper li.done { color: var(--gray-800); }
.stepper li.done::before { content: "✓"; background: var(--red); border-color: var(--red); color: var(--white); }
.stepper li.done::after { background: var(--red); }
.stepper li.current { color: var(--gray-900); font-weight: 600; }
.stepper li.current::before { border-color: var(--red); color: var(--red); }

/* activity list */
.activity { list-style: none; margin: 0; padding: 0; }
.activity li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--gray-100); font-size: 13px; }
.activity li:last-child { border-bottom: 0; }
.activity .icon { color: var(--gray-400); margin-top: 2px; }
.activity a { color: var(--gray-800); }
.activity a:hover { color: var(--red); }
.activity time { margin-left: auto; color: var(--gray-500); white-space: nowrap; font-size: 12px; }
.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.quick a { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--gray-200); border-radius: var(--radius-lg); background: var(--white); color: var(--gray-800); }
.quick a:hover { border-color: var(--red-100); background: var(--red-50); text-decoration: none; }
.quick .icon { color: var(--red); margin-top: 2px; }
.quick strong { display: block; font-size: 14px; }
.quick span { font-size: 12px; color: var(--gray-500); }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--gray-50); }
.login form { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; background: var(--white); border: 1px solid var(--gray-200); border-radius: 12px; padding: 32px; }
.login label { display: flex; flex-direction: column; gap: 6px; }
.login .brand { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 700; color: var(--red); margin-bottom: 8px; }

/* ---------- page-specific ---------- */
/* fonts: glyph review */
.glyph-input { font-size: 20px; max-width: 140px; }
.crop { max-width: 360px; max-height: 90px; border: 1px solid var(--gray-200); border-radius: 4px; background: var(--white); }
.result { font-size: 18px; margin: 0; }
.examples { min-width: 220px; }
.example { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.example img { max-height: 30px; max-width: 160px; border: 1px solid var(--gray-200); }
.diff { font-size: 15px; margin-top: 4px; }
mark { background: var(--red-50); color: var(--red); border-bottom: 1px solid var(--red); padding: 0 1px; }
mark.gap { font-size: 12px; }
.judge { display: flex; gap: 6px; margin: 6px 0; }
.btn.chosen { background: var(--red-50); border-color: var(--red); color: var(--red); }
kbd { font-family: ui-monospace, Consolas, monospace; font-size: 12px; border: 1px solid var(--gray-300); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: var(--white); }

/* rules markdown / digest / prompt */
textarea.md-text { font-family: "Noto Sans Gujarati", ui-monospace, monospace; font-size: 14px; line-height: 1.65; min-height: 60vh; }
.md-preview { max-height: 70vh; overflow: auto; font-size: 15px; }
.md-preview h1 { font-size: 20px; } .md-preview h2 { font-size: 17px; color: var(--red); } .md-preview h3 { font-size: 15px; }
.md-original { white-space: pre-wrap; font-size: 13px; max-height: 50vh; overflow: auto; background: var(--gray-50); padding: 12px; border-radius: var(--radius); }
.diff-view { font-family: "Noto Sans Gujarati", system-ui, sans-serif; font-size: 13px; white-space: pre-wrap; line-height: 1.6; max-height: 70vh; overflow: auto; }
.diff-view span { padding: 1px 8px; }
.diff-view .add { display: block; background: #EEF7F0; box-shadow: inset 3px 0 var(--ok); }
.diff-view .del { display: block; color: var(--red); background: var(--red-50); box-shadow: inset 3px 0 var(--red); text-decoration: line-through; }
.diff-view .hunk { display: block; color: var(--gray-500); }
.prompt-text { white-space: pre-wrap; font-size: 14px; line-height: 1.7; max-height: 75vh; overflow: auto; }
.rules-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 20px; align-items: start; }
.setnav { display: flex; flex-direction: column; gap: 2px; }
.setnav a { display: flex; justify-content: space-between; align-items: center; padding: 7px 10px; border-radius: var(--radius); color: var(--gray-700); }
.setnav a:hover { background: var(--gray-100); text-decoration: none; }
.setnav a.active { background: var(--red-50); color: var(--red); font-weight: 600; }
@media (max-width: 1000px) { .rules-layout { grid-template-columns: 1fr; } }
.rules-table tr.inactive td, .rules-table tr.dim td { color: var(--gray-400); }
.rules-table tr.dragging td { background: var(--red-50); }
.rules-table .drag { cursor: grab; color: var(--gray-400); user-select: none; width: 28px; }

/* slots table */
.slots-table td { padding: 6px 8px; vertical-align: top; }
.slots-table tr.inactive td { color: var(--gray-400); }
.slots-table tr.inactive input { color: var(--gray-400); }
.slots-table tr.needs-review td:first-child { box-shadow: inset 3px 0 var(--red); }
.cell-input { width: 140px; height: 32px !important; padding: 4px 8px; }
.cell-num { width: 72px; }
.cell-wide { width: 220px; }
.real { font-size: 11px; margin-top: 3px; color: var(--gray-500); }
.row-actions { white-space: nowrap; }
.add-slot { margin-top: 16px; }

/* ePaper */
.overlay-legend { display: flex; flex-wrap: wrap; gap: 12px; margin: 8px 0 12px; font-size: 13px; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.overlay-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.overlay-page svg { width: 100%; height: auto; border: 1px solid var(--gray-200); border-radius: var(--radius); background: var(--white); }
.overlay-page a.art:hover rect.regions, .overlay-page a.art.hover rect.regions { stroke-width: 7; }
.overlay-page a.flagged-seg rect.regions { stroke-dasharray: 10 6; }
.overlay-list { font-size: 13px; max-height: 85vh; overflow: auto; padding: 12px 12px 12px 32px; margin: 0; background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius-lg); }
.overlay-list li { margin-bottom: 10px; }
@media (max-width: 1100px) { .overlay-wrap { grid-template-columns: 1fr; } }
.article-crop { max-width: 100%; border: 1px solid var(--gray-200); border-radius: var(--radius); background: var(--white); }
.article-review textarea { font-size: 16px; }
.ad-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-top: 12px; }
.ad-card { margin: 0; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.ad-card img { width: 100%; height: 220px; object-fit: contain; background: var(--gray-50); border-radius: var(--radius); }

/* styleguide */
.sg-section { margin-bottom: 32px; }
.sg-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.swatch-tile { border: 1px solid var(--gray-200); border-radius: var(--radius); overflow: hidden; font-size: 11px; background: var(--white); }
.swatch-tile div { height: 44px; }
.swatch-tile span { display: block; padding: 6px 8px; color: var(--gray-600); }

/* table search (client side) */
tr.filtered-out { display: none; }
.table-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 8px; font-size: 12px; color: var(--gray-500); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; font-size: 13px; margin: 0; }
.kv dt { color: var(--gray-500); } .kv dd { margin: 0; color: var(--gray-800); }
.overlay-list a { color: var(--gray-900); font-weight: 500; }
.overlay-list a:hover { color: var(--red); }

/* ---- Ads editor (Phase 3b) ---- */
.ad-bar { display: flex; flex-wrap: wrap; gap: 12px 28px; align-items: flex-start; }
.ad-bar-item { display: flex; flex-direction: column; gap: 2px; min-width: 120px; }
.ad-bar-approve { margin-left: auto; align-items: flex-end; max-width: 360px; text-align: right; }
.ad-editor { display: grid; grid-template-columns: minmax(240px, 0.9fr) minmax(340px, 1.25fr) minmax(300px, auto); gap: 16px; align-items: start; }
@media (max-width: 1280px) { .ad-editor { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .ad-preview { grid-column: 1 / -1; } }
@media (max-width: 900px) { .ad-editor { grid-template-columns: 1fr; } }
.ad-source, .ad-preview { position: sticky; top: 72px; }
.ad-source { max-height: calc(100vh - 88px); overflow-y: auto; }
@media (max-width: 1280px) { .ad-source, .ad-preview { position: static; } }
.src-page { position: relative; border: 1px solid var(--gray-200); border-radius: 6px; overflow: hidden; margin-top: 8px; }
.src-page img { display: block; width: 100%; height: auto; }
.src-region { position: absolute; border: 2px dashed var(--gray-500); background: rgba(17, 24, 39, 0.06); }
.src-region span { position: absolute; top: 0; left: 0; background: var(--gray-700); color: #fff; font-size: 11px; padding: 1px 5px; border-bottom-right-radius: 4px; }
.src-region.included { border-color: var(--red); background: rgba(200, 16, 46, 0.06); }
.src-region.included span { background: var(--red); }
.src-page.drawing { cursor: zoom-in; }
.src-page.drawing img { user-select: none; -webkit-user-drag: none; }
.area-box { position: absolute; border: 2px solid var(--red); background: rgba(200, 16, 46, 0.08); pointer-events: none; }
.area-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.area-tools .btn.active { border-color: var(--red); color: var(--red); background: var(--red-50); }
.area-tools .help { margin: 0; }
.area-result { margin-top: 8px; padding: 10px 12px; border: 1px solid var(--gray-200); border-radius: 6px; background: var(--gray-50); font-size: 13px; }
.area-result.error { border-color: var(--red-100); background: var(--red-50); }
.area-text { white-space: pre-wrap; font-size: 15px; margin-top: 4px; }
.area-result.warn { border-color: #f3d27a; background: #fffbeb; }
.area-warn { font-weight: 600; margin-top: 8px; }
.area-result .btn { margin-top: 6px; }
.read-steps { list-style: none; margin: 0 auto 12px; padding: 0; max-width: 420px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.read-steps li { color: var(--gray-500); padding-left: 22px; position: relative; }
.read-steps li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--gray-300); }
.read-steps li.done { color: var(--gray-700); }
.read-steps li.done::before { background: var(--ok); }
.read-steps li.now { color: var(--gray-900); font-weight: 600; }
.read-steps li.now::before { background: var(--red); }
.read-report, .read-again { border-top: 1px solid var(--gray-200); padding-top: 10px; }
.read-report > summary, .read-again > summary { cursor: pointer; font-weight: 600; font-size: 13px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.rr-facts { display: grid; grid-template-columns: 1fr; gap: 2px; margin: 10px 0 0; font-size: 13px; }
.rr-facts dt { color: var(--gray-600); font-size: 12px; margin-top: 6px; }
.rr-facts dd { margin: 0; }
.rr-cands { margin-top: 4px; overflow-x: auto; }
.rr-cands summary { cursor: pointer; }
.table-mini { border-collapse: collapse; font-size: 12px; margin-top: 4px; }
.table-mini th, .table-mini td { padding: 2px 8px 2px 0; text-align: left; border-bottom: 1px solid var(--gray-100); }
.table-mini tr.best td { font-weight: 600; }
.rr-pages { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.region-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.region-list li { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; border-top: 1px solid var(--gray-100); padding-top: 8px; }
.ad-field { margin-bottom: 14px; }
.ad-field-label { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; color: var(--gray-700); margin-bottom: 4px; }
.hl { position: relative; background: var(--white); border-radius: 6px; }
.hl-back, .hl textarea { font-family: "Noto Serif Gujarati", serif; font-size: 16px; line-height: 1.75; letter-spacing: 0; padding: 7px 11px; }
.hl-back { position: absolute; inset: 0; border: 1px solid transparent; white-space: pre-wrap; overflow-wrap: break-word; word-break: normal;
  color: transparent; overflow: hidden; pointer-events: none; }
.hl-back mark { color: transparent; background: #ffe08a; border-radius: 2px; box-shadow: 0 0 0 1px #e0b000; }
.hl-back mark.ins { background: none; box-shadow: none; border-left: 3px solid #b7791f; }
.hl textarea { position: relative; display: block; width: 100%; background: transparent; resize: none; overflow: hidden; min-height: 38px; }
.hl.stale .hl-back mark { visibility: hidden; }
.ad-field.has-open .hl textarea { border-color: #e0b000; }
.hl-item { margin-top: 6px; padding: 8px 10px; background: #fffbeb; border: 1px solid #f3e1a0; border-radius: 6px; font-size: 13px; }
.hl-what { display: flex; align-items: center; gap: 6px; color: var(--gray-700); }
.hl-ctx { font-family: "Noto Serif Gujarati", serif; font-size: 15px; margin: 4px 0 6px; }
.hl-ctx mark { background: #ffe08a; padding: 0 2px; }
.hl-choice { height: auto; min-height: 28px; padding-top: 3px; padding-bottom: 3px; }
.hl-choice [lang="gu"] { font-family: "Noto Serif Gujarati", serif; font-size: 14px; }
.adv-block { border: 1px solid var(--gray-200); border-radius: 8px; padding: 8px 12px 12px; margin: 0; }
.adv-block legend { font-size: 12px; font-weight: 600; color: var(--gray-600); padding: 0 4px; }
.seg { display: inline-flex; border: 1px solid var(--gray-300); border-radius: 6px; overflow: hidden; align-self: flex-start; }
.seg label { padding: 6px 14px; cursor: pointer; font-size: 13px; text-transform: capitalize; }
.seg label + label { border-left: 1px solid var(--gray-300); }
.seg label.on { background: var(--red-50); color: var(--red); font-weight: 600; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.ad-measure { display: flex; gap: 20px; margin: 12px 0 8px; }
.ad-measure > div { display: flex; flex-direction: column; }
.ad-frame-wrap { background: var(--gray-100); border: 1px solid var(--gray-200); border-radius: 6px; padding: 12px; overflow: auto; max-height: 78vh; margin-top: 8px; }
#ad-frame { border: 0; background: #fff; display: block; width: 330px; height: 400px; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.tpl-sample { width: 100%; height: 70vh; border: 1px solid var(--gray-200); border-radius: 6px; }
.cmp-img { display: block; max-width: 100%; height: auto; border: 1px solid var(--gray-200); }
.cmp-out { max-width: 480px; }
.cmp-table del { background: var(--red-50); color: var(--red); }
.cmp-table ins { background: #e6f4ea; text-decoration: underline; }

.ad-left { display: flex; flex-direction: column; gap: 0; }
.ad-left .ad-source { position: static; }
.confirm-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 70vh; overflow: auto; }
.confirm-list li { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; border-top: 1px solid var(--gray-100); }
.confirm-list li.done .confirm-what { opacity: .6; }
.confirm-what { flex: 1; min-width: 0; }
.confirm-word { font-family: "Noto Serif Gujarati", serif; font-size: 16px; }
.confirm-btn { flex: none; min-width: 104px; }
.hint-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.hint-chip { display: inline-flex; border: 1px dotted #b7791f; border-radius: 999px; overflow: hidden; }
.hint-chip button { border: 0; background: #fffbeb; font: inherit; font-size: 13px; padding: 2px 8px; cursor: pointer; }
.hint-chip .hint-word { font-family: "Noto Serif Gujarati", serif; }
.hint-chip .hint-ok { border-left: 1px dotted #b7791f; color: var(--gray-600); }
.hint-chip button:hover { background: #ffe08a; }
.hl-back mark.hint { background: none; box-shadow: none; border-bottom: 2px dotted #b7791f; border-radius: 0; }
.crop-dialog { border: 0; border-radius: 8px; padding: 16px 20px; max-width: min(1100px, 94vw); box-shadow: var(--shadow); }
.crop-dialog::backdrop { background: rgba(17, 24, 39, .4); }
.crop-dialog img { display: block; max-width: 100%; height: auto; border: 1px solid var(--gray-200); }

/* ---- Generate + article editor (Phase 5-6) ---- */
.gen-form { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
@media (max-width: 1000px) { .gen-form { grid-template-columns: 1fr; } }
.gen-form textarea#points { font-family: "Noto Serif Gujarati", serif; font-size: 16px; line-height: 1.8; min-height: 300px; }
.slot-targets { font-size: 13px; color: var(--gray-600); background: var(--gray-50); border-radius: 6px; padding: 8px 10px; }
.btn-block { width: 100%; justify-content: center; }
.art-editor { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .art-editor { grid-template-columns: 1fr; } }
.art-main { display: flex; flex-direction: column; gap: 16px; }
.art-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 72px; max-height: calc(100vh - 90px); overflow: auto; }
@media (max-width: 1100px) { .art-side { position: static; max-height: none; } }
.art-main .card + .card, .art-side .card + .card { margin-top: 0; }
.part-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.part-head h3 { margin: 0; font-size: 15px; }
.part-head .regen { margin-left: auto; }
.options { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.opt { display: flex; align-items: flex-start; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.opt:hover { background: var(--gray-50); }
.opt input { margin-top: 6px; accent-color: var(--red); }
.opt:has(input:checked) { background: var(--red-50); }
.opt-text { flex: 1; font-family: "Noto Serif Gujarati", serif; font-size: 16px; line-height: 1.6; }
.heading-input { width: 100%; font-family: "Noto Serif Gujarati", serif; font-size: 17px; }
.heading-input.hl-input { font-size: 22px; font-weight: 700; height: auto; padding: 8px 12px; }
.art-text { width: 100%; resize: vertical; overflow: hidden; min-height: 120px; }
.art-text[readonly], .heading-input[readonly] { background: var(--white); color: var(--gray-900); }
.flash { box-shadow: 0 0 0 3px #ffe08a !important; border-color: #e0b000 !important; }
.issues { list-style: none; margin: 8px 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.issues li { display: flex; flex-direction: column; gap: 2px; }
.issue { display: flex; gap: 8px; align-items: flex-start; text-align: left; background: none; border: 1px solid var(--gray-200); border-radius: 6px; padding: 6px 8px; font: inherit; font-size: 13px; cursor: pointer; }
.issue:hover { background: var(--gray-50); }
.issue.sev-error { border-color: var(--red-100); }
.issue q { font-family: "Noto Serif Gujarati", serif; }
.facts { display: grid; grid-template-columns: 90px 1fr; gap: 6px 10px; margin: 0; font-size: 13px; }
.facts dt { color: var(--gray-500); } .facts dd { margin: 0; }
.pre-wrap { white-space: pre-wrap; }
.gen-status { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--white); border: 1px solid var(--gray-200); border-left: 3px solid var(--red); border-radius: 8px; font-size: 14px; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--gray-200); border-top-color: var(--red); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.gen-log { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.skeleton-line { font-style: italic; }
.cmp .gu-article { font-size: 15px; }
.gen-status[hidden], .card[hidden] { display: none; }

/* ---------- costs (/costs) ---------- */
.card-head.pad { padding: 14px 16px 0; }
.cost-chart { width: 100%; height: 240px; display: block; }
.cost-chart .grid { stroke: var(--gray-200); stroke-width: 1; }
.cost-chart .axis { font-size: 10px; fill: var(--gray-500); font-variant-numeric: tabular-nums; }
.cost-chart rect:hover { opacity: .8; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 10px 0 0; padding: 0; font-size: 12px; color: var(--gray-600); }
.legend li { display: flex; align-items: center; gap: 6px; }
.legend .swatch { width: 10px; height: 10px; border-radius: 2px; border: 1px solid var(--gray-300); }

/* ---------- /generate: live sources ---------- */
.live-box { border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 10px 12px; background: var(--gray-50); }
.live-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.live-item { background: var(--white); border: 1px solid var(--gray-200); border-radius: 6px; padding: 8px 10px; }
.live-item.weak { opacity: .75; }
.live-item .check { align-items: flex-start; gap: 8px; }
.live-item .check > span { display: flex; flex-direction: column; gap: 2px; }
.live-snippet { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- article editor: print preview, chat, versions (D125) ---------- */
.view-toggle { display: flex; gap: 4px; margin: 0 0 12px; border-bottom: 1px solid var(--gray-200); }
.view-toggle .tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 12px; font: inherit; font-size: 14px; color: var(--gray-600); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.view-toggle .tab.active { color: var(--red); border-bottom-color: var(--red); font-weight: 600; }
.print-card { overflow: hidden; }
.print-stage { background: var(--gray-100); border-radius: 6px; padding: 12px; overflow: hidden; }
.print-page { width: var(--w); background: #fff; padding: 0; transform-origin: top left; box-shadow: 0 1px 3px rgba(17,24,39,.12);
  font-family: "Noto Serif Gujarati", serif; color: #111; }
.print-page .pp-cap { font-size: var(--cap); line-height: 1.15; font-weight: 600; color: var(--red-700); padding: 0.1cm 0.1cm 0; }
.print-page .pp-headline { font-size: var(--hl); line-height: 1.12; font-weight: 700; margin: 0.05cm 0.1cm 0.1cm; }
.print-page .pp-sub { font-size: var(--sub); line-height: 1.25; font-weight: 600; color: #333; padding: 0 0.1cm 0.15cm; border-bottom: 0.4pt solid #999; margin-bottom: 0.15cm; }
.print-page .pp-cols { column-count: var(--cols); column-gap: var(--gutter); column-rule: 0.3pt solid #bbb; padding: 0 0.1cm 0.2cm; }
.print-page .pp-intro { font-size: var(--intro); line-height: 1.32; font-weight: 700; text-align: justify; margin: 0 0 0.12cm; hyphens: auto; }
.print-page .pp-body p { font-size: var(--body); line-height: 1.3; text-align: justify; margin: 0 0 0.1cm; text-indent: 0.35cm; hyphens: auto; }
.print-page .pp-headline:empty, .print-page .pp-cap:empty, .print-page .pp-sub:empty { display: none; }
.chat-log { display: flex; flex-direction: column; gap: 10px; }
.chat-msg { border-radius: 8px; padding: 10px 12px; border: 1px solid var(--gray-200); }
.chat-user { background: var(--gray-50); align-self: flex-end; max-width: 85%; }
.chat-ai { background: var(--white); }
.chat-who { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--gray-600); margin-bottom: 4px; }
.chat-exp { font-size: 14px; }
.chat-question { background: #fffbeb; border: 1px solid var(--gray-300); border-radius: 6px; padding: 8px 10px; font-weight: 600; display: flex; gap: 6px; align-items: center; }
.chat-part { border-top: 1px solid var(--gray-200); padding-top: 8px; margin-top: 8px; }
.chat-part.accepted { opacity: .7; } .chat-part.rejected { opacity: .5; }
.chat-part-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.chat-opt { display: flex; gap: 8px; align-items: baseline; margin: 2px 0; }
.diff del { background: var(--red-50); color: var(--red); text-decoration: line-through; }
.diff ins { background: #e6f4ea; text-decoration: underline; }
.diff.gu-article { font-size: 15px; white-space: pre-wrap; }
.chat-send { display: flex; gap: 8px; align-items: flex-end; margin-top: 12px; }
.chat-send textarea { flex: 1; }
.versions { margin: 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.version-diff { border-top: 1px solid var(--gray-200); margin-top: 8px; padding-top: 8px; }
.live-title { display: flex; align-items: baseline; gap: 8px; justify-content: space-between; }
.live-title .chip { flex: none; }
.live-box > .toolbar label.help { display: inline-flex; align-items: center; gap: 6px; flex-direction: row; }
.live-box > .toolbar label.help select { width: auto; }

/* Ad preview editor (MEMORY D127) */
.ad-preview { position: static; }
.pv-grid { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; align-items: center; margin-top: 8px; }
.pv-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pv-num { width: 88px; }
.pv-tools { border: 1px solid var(--gray-200); border-radius: 8px; padding: 10px; margin: 8px 0; display: flex; flex-direction: column; gap: 8px; background: var(--gray-50); }
.pv-sep { width: 1px; align-self: stretch; background: var(--gray-300); margin: 0 4px; }
.pv-steps { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 12px; }
.pv-step { display: flex; align-items: center; gap: 4px; font-size: 13px; }
.pv-step > span:first-child { flex: 1; color: var(--gray-600); }
.pv-step strong { min-width: 44px; text-align: center; font-size: 13px; }
.pv-step strong.ok { color: var(--red); }
.pv-global { margin: 8px 0; }
.pv-global summary { cursor: pointer; font-size: 13px; color: var(--gray-700); font-weight: 600; padding: 4px 0; }
.pv-global > .pv-steps, .pv-global > .btn, .pv-global > .help { margin-top: 8px; }
.ad-frame-wrap { position: relative; display: inline-block; }
.pv-drag { display: flex; justify-content: center; align-items: center; height: 14px; cursor: ns-resize; background: var(--gray-100);
  border: 1px solid var(--gray-300); border-top: 0; border-radius: 0 0 6px 6px; color: var(--gray-600); }
.pv-drag:hover, .pv-drag:focus { background: var(--red-50); color: var(--red); outline: none; }
.pv-edit { margin-top: 12px; }
.pv-edit textarea { width: 100%; font-family: "Noto Serif Gujarati", serif; font-size: 15px; line-height: 1.7; }
.pv-versions { list-style: none; padding: 0; margin: 4px 0 0; max-height: 220px; overflow: auto; }
.pv-versions li { display: flex; gap: 8px; align-items: center; padding: 3px 0; border-bottom: 1px solid var(--gray-100); }
.pv-versions li .help { flex: 1; margin: 0; }

[hidden] { display: none !important; }

/* spelling hints under an ad field (advice only, D131): dotted gray, suggestions as small buttons */
.spell-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.spell-chip { display: inline-flex; align-items: center; border: 1px dotted var(--gray-400); border-radius: 999px; overflow: hidden; }
.spell-chip .spell-word { font-family: "Noto Serif Gujarati", serif; font-size: 13px; padding: 2px 8px; text-decoration: underline dotted var(--gray-500); }
.spell-chip button { border: 0; border-left: 1px dotted var(--gray-400); background: var(--white); font: inherit; font-size: 13px; padding: 2px 8px; cursor: pointer; }
.spell-chip .spell-sug { font-family: "Noto Serif Gujarati", serif; color: var(--gray-800); }
.spell-chip button:hover { background: var(--gray-100); }

/* text-frame editor (MEMORY D133): tools + Character / Paragraph panels above the preview */
.pv-toolbar { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin: 10px 0 4px; font-size: 13px; }
.pv-toolbar .seg label { display: inline-flex; align-items: center; gap: 4px; text-transform: none; }
.pv-selrow { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.pr-units { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.pr-unit { font-size: 20px; min-width: 52px; justify-content: center; }
.pr-word { font-size: 18px; }
.pv-panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; margin: 8px 0; }
.pv-panel { border: 1px solid var(--gray-200); border-radius: 8px; padding: 8px 10px 10px; margin: 0; background: var(--gray-50);
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; align-items: center; font-size: 13px; }
.pv-panel legend { font-weight: 600; color: var(--gray-800); padding: 0 4px; }
.pv-panel[disabled] { opacity: 0.55; }
.pv-panel label { display: flex; align-items: center; gap: 4px; color: var(--gray-600); }
.pv-panel input[type=number] { width: 64px; height: 28px; padding: 2px 6px; }
.pv-panel select { height: 28px; padding: 2px 6px; flex: 1; min-width: 0; }
.pv-panel .pv-wide { grid-column: 1 / -1; }
.pv-panel .btn.on { background: var(--red-50); color: var(--red); border-color: var(--red-100); }
.pv-bg-row { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-top: 6px; width: 100%; }
.pv-bg-btn { display: inline-flex; align-items: center; gap: 5px; padding: 2px 7px; font-size: 11px; height: 26px; }
.pv-swatch { display: inline-block; width: 11px; height: 11px; border-radius: 2px; border: 1px solid var(--gray-400); flex-shrink: 0; }
.pv-color-pick { display: inline-flex; align-items: center; cursor: pointer; position: relative; margin-left: 2px; }
.pv-color-pick input[type="color"] { position: absolute; opacity: 0; width: 26px; height: 26px; cursor: pointer; top: 0; left: 0; }
.pv-swatch-custom { display: inline-grid; place-items: center; width: 26px; height: 26px; border: 1px solid var(--gray-300); border-radius: 4px; background: #fff; font-size: 12px; }
.pv-swatch-custom.on { border-color: var(--red); box-shadow: 0 0 0 1px var(--red); }
.pv-all { font-size: 10px; margin-left: 2px; }
.pv-just table { border-collapse: collapse; margin: 4px 0; }
.pv-just th { font-weight: 400; color: var(--gray-600); text-align: left; padding: 2px 6px 2px 0; font-size: 12px; }
.pv-just td { padding: 2px 4px; }
.pv-just input[type=number] { width: 58px; }
#ad-frame { border: 0; display: block; }
.role-help { margin: 6px 0 0; padding-left: 18px; }
.role-help li { margin: 2px 0; }
/* digital articles (D146) */
.dg-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .dg-grid { grid-template-columns: 1fr; } }
.dg-main, .dg-side { display: flex; flex-direction: column; gap: 12px; }
.dg-side { position: sticky; top: 12px; }
.dg-field { padding: 14px 16px; }
.dg-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.dg-head label, .dg-head .h3 { margin: 0; }
.dg-count { font-size: 12px; color: var(--gray-500); margin-left: auto; }
.dg-count.over { color: var(--red); font-weight: 600; }
.dg-tools { display: flex; gap: 4px; }
.dg-field input:not([type=file]):not([type=checkbox]), .dg-field textarea { width: 100%; font-size: 16px; }
#in-title { font-size: 20px; font-weight: 600; }
.dg-rich { min-height: 280px; border: 1px solid var(--gray-300); border-radius: 6px; padding: 10px 14px; background: #fff; }
.dg-rich:focus { outline: 2px solid var(--red); outline-offset: 1px; }
.dg-rich h2 { font-size: 21px; } .dg-rich h3 { font-size: 18px; }
.dg-rich blockquote { border-left: 4px solid var(--red-100); margin: 8px 0; padding: 2px 12px; color: var(--gray-700); }
.dg-rich img { max-width: 100%; height: auto; }
.dg-rt-bar { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.dg-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.dg-hint { flex: 1; min-width: 200px; font-size: 13px; height: 30px !important; }
.dg-orig { background: var(--gray-50); border-radius: 6px; padding: 8px; margin-top: 4px; }
.dg-hints { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.dg-addtag { cursor: pointer; border: 0; }
.warn-text { color: var(--gray-800); margin: 4px 0 0; }
.dg-catform { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dg-out { display: flex; flex-wrap: wrap; gap: 6px; }
.dg-img { margin: 0 0 12px; } .dg-img img { max-width: 100%; height: auto; border-radius: 6px; border: 1px solid var(--gray-200); }
.dg-imgform { display: grid; gap: 6px; margin-top: 6px; }
.dg-up { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.dg-source { max-height: 280px; overflow: auto; white-space: pre-wrap; font-size: 14px; background: var(--gray-50); border-radius: 6px; padding: 8px; }
.dg-dupes { padding-left: 18px; } .dg-dupes li { margin: 4px 0; }
.btn.done { border-color: var(--ok, #1E8E3E); }
.dg-new textarea { width: 100%; font-size: 15px; }
.req { color: var(--red); }
.progress-track { height: 6px; background: var(--gray-200); border-radius: 3px; overflow: hidden; }
.progress-fill.indeterminate { height: 100%; width: 40%; background: var(--red); animation: dg-ind 1.2s infinite ease-in-out; }
@keyframes dg-ind { from { margin-left: -40%; } to { margin-left: 100%; } }
/* digital: post preview, Google result, CMS handoff (D147) */
.error-text { color: var(--red); margin: 4px 0 0; }
.dg-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.dg-cms-state { margin-top: 10px; border-top: 1px solid var(--gray-200); padding-top: 8px; }
.serp { max-width: 640px; font-family: Arial, "Noto Sans Gujarati", sans-serif; padding: 4px 0 8px; }
.serp-site { display: flex; gap: 10px; align-items: center; }
.serp-fav { width: 26px; height: 26px; border-radius: 50%; background: var(--red-50); color: var(--red); display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.serp-name { font-size: 14px; color: #202124; } .serp-url { font-size: 12px; color: #4d5156; }
.serp-title { font-size: 20px; line-height: 1.3; color: #1a0dab; margin: 6px 0 3px; }
.serp-desc { font-size: 14px; line-height: 1.58; color: #4d5156; }
.dg-pv-tools { margin: 16px 0 8px; display: flex; gap: 8px; align-items: center; }
.dg-pv-stage { background: var(--gray-100); border: 1px solid var(--gray-200); border-radius: 8px; padding: 16px; overflow-x: auto; }
.dg-pv-frame { display: block; margin: 0 auto; border: 1px solid var(--gray-300); background: #fff; min-height: 600px; }
.dg-pv-frame.desktop { width: 1200px; } .dg-pv-frame.mobile { width: 390px; }
@media (max-width: 900px) { .dg-pv-frame.desktop { width: 100%; } }
.dg-send { background: var(--gray-50); display: grid; place-items: center; min-height: 100vh; margin: 0; padding: 16px; }
.dg-send main { max-width: 520px; }

/* Large crop window (crop_popup.js, D152): ~90 % of the screen, full screen on small laptops */
.crop-pop { width: 90vw; height: 90vh; max-width: none; max-height: none; padding: 0; border: 0; border-radius: 8px; box-shadow: var(--shadow);
  display: none; flex-direction: column; overflow: hidden; background: var(--white); }
.crop-pop[open] { display: flex; }
.crop-pop::backdrop { background: rgba(17, 24, 39, .55); }
@media (max-width: 1366px), (max-height: 800px) { .crop-pop { width: 100vw; height: 100vh; border-radius: 0; } }
.cp-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 10px 16px; border-bottom: 1px solid var(--gray-200); }
.cp-title { font-size: 15px; }
.cp-size { color: var(--gray-700); font-size: 13px; min-width: 200px; }
.cp-tools { display: flex; align-items: center; gap: 4px; }
.cp-tools [data-z="in"], .cp-tools [data-z="out"] { width: 32px; font-size: 18px; justify-content: center; }
.cp-zoom { min-width: 52px; text-align: center; font-size: 13px; }
.cp-actions { display: flex; gap: 8px; margin-left: auto; }
.cp-view { position: relative; flex: 1; overflow: hidden; background: var(--gray-100); cursor: crosshair; touch-action: none; outline: none; user-select: none; }
.cp-view.can-pan { cursor: grab; }
.cp-view.panning { cursor: grabbing; }
.cp-img { position: absolute; left: 0; top: 0; transform-origin: 0 0; max-width: none; image-rendering: auto; pointer-events: none; }
.cp-view.loading .cp-img, .cp-view.loading .cp-box { visibility: hidden; }
.cp-loading { display: none; position: absolute; inset: 0; align-items: center; justify-content: center; color: var(--gray-600); }
.cp-view.loading .cp-loading { display: flex; }
.cp-box { position: absolute; border: 2px solid var(--red); box-shadow: 0 0 0 9999px rgba(17, 24, 39, .35); cursor: move; }
.cp-h { position: absolute; width: 16px; height: 16px; margin: -9px 0 0 -9px; background: var(--white); border: 2px solid var(--red); border-radius: 3px; }
.cp-h::after { content: ""; position: absolute; inset: -6px; }  /* a 28 px grab area */
.cp-h[data-h="nw"] { left: 0; top: 0; cursor: nwse-resize; } .cp-h[data-h="n"] { left: 50%; top: 0; cursor: ns-resize; }
.cp-h[data-h="ne"] { left: 100%; top: 0; cursor: nesw-resize; } .cp-h[data-h="e"] { left: 100%; top: 50%; cursor: ew-resize; }
.cp-h[data-h="se"] { left: 100%; top: 100%; cursor: nwse-resize; } .cp-h[data-h="s"] { left: 50%; top: 100%; cursor: ns-resize; }
.cp-h[data-h="sw"] { left: 0; top: 100%; cursor: nesw-resize; } .cp-h[data-h="w"] { left: 0; top: 50%; cursor: ew-resize; }
.cp-hint { margin: 0; padding: 8px 16px; border-top: 1px solid var(--gray-200); }
.cp-msg { font-size: 13px; font-weight: 600; color: var(--red); }
.cp-viewmode .cp-view { cursor: grab; }
.cp-viewmode .cp-box { cursor: grab; box-shadow: 0 0 0 9999px rgba(17, 24, 39, .18); border-width: 3px; }
.cp-viewmode .cp-h { display: none; }

/* Article print editor (articles/print.html, D153) */
.ap-editor { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
.ap-side { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 72px; max-height: calc(100vh - 88px); overflow: auto; }
.ap-side .card { padding: 12px 14px; }
.ap-side label { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 13px; }
.ap-side label.check { gap: 6px; }
.ap-side input[type=number] { width: 72px; }
.ap-status { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.ap-main .ap-stage { overflow: auto; background: var(--gray-200); max-height: calc(100vh - 220px); padding: 8px; }
.ap-main .ap-stage iframe { border: 0; display: block; background: transparent; }
@media (max-width: 1100px) { .ap-editor { grid-template-columns: 1fr; } .ap-side { position: static; max-height: none; } }

/* Ad editor: the print preview is the working area (D154): a narrow left column (text panel, client input, cards), the
   preview takes the rest and is never squeezed */
.ad-editor.ad-editor-wide { grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); }
@media (max-width: 1100px) { .ad-editor.ad-editor-wide { grid-template-columns: 1fr; } }
.ad-editor-wide .ad-preview { grid-column: auto; min-width: 0; }
details.ad-fields > summary { cursor: pointer; list-style: none; }
details.ad-fields > summary::-webkit-details-marker { display: none; }
details.ad-fields .ad-text-chev { transition: transform .15s; }
details.ad-fields[open] .ad-text-chev { transform: rotate(90deg); }
details.ad-fields:not([open]) { padding-bottom: 12px; }
.ad-editor-wide .ad-left { gap: 12px; }
.ad-editor-wide .ad-frame-wrap { display: block; overflow: auto; max-height: calc(100vh - 140px); }  /* block: Fit uses the card's width */
.ap-colors { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 8px; }
.ap-colors input[type=color] { width: 28px; height: 22px; padding: 0; border: 1px solid var(--gray-300); border-radius: 4px; }

/* Ad job page: two columns (UI only). Left = tools + collapsible panels, scrolls by itself; right = the print preview,
   sticky and as large as the space allows. Under 1280 px the left column is a drawer (button "Tools & panels"). */
.ad-editor.ad-ws { grid-template-columns: minmax(340px, 420px) minmax(0, 1fr); gap: 16px; align-items: start; }
.ad-ws .ad-left { position: sticky; top: 64px; max-height: calc(100vh - 76px); overflow-y: auto; overscroll-behavior: contain;
  gap: 12px; padding-right: 4px; scrollbar-gutter: stable; }
.ad-ws .ad-left > .section { margin-top: 0; }
.ad-ws .ad-preview { position: sticky; top: 64px; height: calc(100vh - 76px); display: flex; flex-direction: column; min-width: 0; }
.ad-ws .ad-preview > .card-head { flex: none; }
.ad-ws .ad-frame-wrap { display: block; flex: 1 1 auto; min-height: 0; max-height: none; overflow: auto; }
.ad-ws .pv-help { flex: none; margin: 8px 0 0; }
.ad-ws .pv-help summary { cursor: pointer; }
.ad-ws .pv-zoom { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--gray-700); }
.ad-ws .ad-tools .pv-toolbar { flex-wrap: wrap; }
.ad-ws .ad-tools .pv-panels { grid-template-columns: 1fr; }
.ad-ws .ad-tools .pv-grid { margin-top: 12px; }
.ad-drawer-btn, .ad-drawer-backdrop { display: none; }
/* collapsible panels: the header opens / closes; collapsed = header only (title, ▸, the count / warning chip) */
.ad-ws .panel-head { cursor: pointer; user-select: none; border-radius: 6px; }
.ad-ws .panel-head:hover h3 { color: var(--red); }
.ad-ws .panel-head:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.ad-ws .panel-chev { display: inline-block; width: 1em; color: var(--gray-500); }
.ad-ws .panel-chev::before { content: "▾"; }
.ad-ws .collapsed .panel-chev::before { content: "▸"; }
.ad-ws .card.collapsed > :not(.card-head) { display: none !important; }
.ad-ws .card.collapsed > .card-head { margin-bottom: 0; }
.ad-ws .card-head .chip-warn { background: #fffbeb; border: 1px solid #f5d48a; color: #92400e; }
.ad-ws details.ad-fields > summary .chip { margin-left: auto; }
@media (max-width: 1279.98px) {
  .ad-editor.ad-ws { grid-template-columns: minmax(0, 1fr); }
  .ad-ws .ad-left { position: fixed; z-index: 40; top: 52px; left: 0; bottom: 0; width: min(440px, 92vw); max-height: none;
    background: var(--gray-50); padding: 16px; box-shadow: var(--shadow); transform: translateX(-102%); transition: transform .18s; }
  .ad-ws .ad-left.open { transform: none; }
  .ad-ws .ad-drawer-backdrop:not([hidden]) { display: block; position: fixed; inset: 52px 0 0 0; z-index: 39; background: rgba(17, 24, 39, .4);
    pointer-events: none; }  /* dims only: the click goes through (Export works with the drawer open, D176) */
  .ad-ws .ad-drawer-btn { display: inline-flex; }
}
.ad-ws .ad-source { position: static; max-height: none; overflow: visible; }

/* Bhasha Bharati typing (D159): the switch in the top bar + the paste offer */
.typing-switch { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.typing-switch + .usermenu { margin-left: 0; }
.typing-badge { height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--gray-300); background: var(--white);
  font: inherit; font-size: 12px; font-weight: 600; color: var(--gray-700); cursor: pointer; white-space: nowrap; }
.typing-badge.on { background: var(--red-50); border-color: var(--red-100); color: var(--red); }
.typing-badge:disabled { cursor: default; color: var(--gray-500); }
.typing-badge:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.typing-switch select { height: 28px; font-size: 12px; padding: 0 6px; max-width: 190px; }
@media (max-width: 700px) { .typing-switch select { display: none; } }
.typing-offer { position: fixed; z-index: 60; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; align-items: center;
  gap: 10px; background: var(--white); border: 1px solid var(--gray-200); border-left: 3px solid var(--gray-800);
  border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 10px 14px; font-size: 13px; }
.typing-offer[hidden] { display: none; }
.kb-codes { display: flex; flex-wrap: wrap; gap: 4px; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.kb-codes span { border: 1px solid var(--gray-200); border-radius: 4px; padding: 2px 5px; background: var(--gray-50); }
.kb-codes b { font-weight: 600; margin-right: 4px; }
.tt-list { display: flex; flex-wrap: wrap; gap: 6px; max-height: 420px; overflow: auto; }
.tt-list .chip { text-decoration: none; }
.tt-list .tt-cur { outline: 2px solid var(--red); }
.kb-results td.gu { font-family: "Noto Serif Gujarati", serif; font-size: 16px; }
.kb-results tr.best { background: var(--red-50); }
