/* ============================================================
   Raawiy — component layer (admin + public site)
   Depends on tokens.css. No Bootstrap.
   ============================================================ */

/* ══════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════ */
.wbtn {
  font-family: var(--font-body); font-weight: 600; font-size: 14px;
  border-radius: var(--r-pill); padding: 10px 18px; cursor: pointer;
  border: 1px solid transparent; display: inline-flex; align-items: center;
  gap: 8px; white-space: nowrap; line-height: 1; text-decoration: none;
  transition: transform .1s ease, background .12s ease, box-shadow .12s ease, border-color .12s, color .12s;
}
.wbtn:active { transform: translateY(1px); }
.wbtn:disabled, .wbtn.is-disabled { opacity: .5; pointer-events: none; }
.wbtn-primary { background: var(--gold); color: #1C1407; box-shadow: 0 3px 12px rgba(184,150,46,0.30); }
.wbtn-primary:hover { background: var(--gold-deep); color: #fff; }
.wbtn-ghost { background: transparent; color: var(--gold-acc); border-color: var(--gold-line); }
.wbtn-ghost:hover { background: var(--gold-soft); color: var(--gold-acc); }
.wbtn-subtle { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.wbtn-subtle:hover { background: var(--surface-3); color: var(--ink); }
.wbtn-danger { background: var(--error-soft); color: var(--error); border-color: transparent; }
.wbtn-danger:hover { background: var(--error); color: #fff; }
.wbtn-success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.wbtn-success:hover { background: var(--success); color: #fff; }
.wbtn-navy { background: var(--navy-chrome); color: var(--on-navy); }
.wbtn-navy:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.25); color: var(--on-navy); }
.wbtn-sm { font-size: 12.5px; padding: 7px 13px; }
.wbtn-xs { font-size: 11.5px; padding: 5px 10px; gap: 5px; }
.wbtn-lg { font-size: 16px; padding: 14px 26px; }
.wbtn-icon { padding: 9px; border-radius: var(--r-sm); }
.wbtn-icon.wbtn-sm { padding: 7px; }
.wbtn-block { width: 100%; justify-content: center; }

/* ══════════════════════════════════════════════════════════
   SURFACES
   ══════════════════════════════════════════════════════════ */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px; }
.card-flush { padding: 0; overflow: hidden; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 15px 20px; border-bottom: 1px solid var(--line);
}
.card-head h3, .card-title { font-family: var(--font-display); font-size: 18px; font-weight: 700; line-height: 1.1; }
.card-body { padding: 20px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: center; }
.hairline { height: 1px; background: var(--line); border: none; margin: 0; }
.surface-2 { background: var(--surface-2); }

/* ══════════════════════════════════════════════════════════
   CHIPS / BADGES / DOTS
   ══════════════════════════════════════════════════════════ */
.chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: var(--r-pill); background: var(--surface-2);
  color: var(--ink-mid); border: 1px solid var(--line); white-space: nowrap; line-height: 1.3;
}
.chip-gold { background: var(--gold-soft); color: var(--gold-acc); border-color: var(--gold-line); }
.chip-sm { font-size: 11px; padding: 3px 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; display: inline-block; }

.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: var(--r-pill); white-space: nowrap; line-height: 1.3;
  background: var(--gold-soft); color: var(--gold-acc);
}
.badge .dot { width: 6px; height: 6px; background: currentColor; }
.badge-gold { background: var(--gold-soft); color: var(--gold-acc); }
.badge-navy { background: var(--surface-2); color: var(--ink-mid); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-error { background: var(--error-soft); color: var(--error); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-plain { background: transparent; color: var(--ink-soft); }

/* ══════════════════════════════════════════════════════════
   FORMS
   ══════════════════════════════════════════════════════════ */
.fld {
  width: 100%; font-family: var(--font-body); font-size: 14px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  padding: 10px 12px; transition: border-color .12s, box-shadow .12s;
}
.fld:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.fld::placeholder { color: var(--ink-soft); }
.fld[disabled], .fld[readonly] { background: var(--surface-2); color: var(--ink-soft); cursor: not-allowed; }
textarea.fld { resize: vertical; min-height: 90px; font-family: var(--font-body); line-height: 1.6; }
select.fld {
  cursor: pointer; appearance: none; padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236E6446' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
[data-theme="dark"] select.fld {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23948DA2' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
}
.fld-w-auto { width: auto; }
.fld-lbl { font-size: 12px; font-weight: 600; color: var(--ink-mid); margin-bottom: 6px; display: block; letter-spacing: 0.01em; }
.fld-hint { font-size: 12px; color: var(--ink-soft); margin-top: 5px; display: block; line-height: 1.45; }
.fld-err { font-size: 12px; color: var(--error); margin-top: 5px; display: block; font-weight: 500; }
.fld-group { margin-bottom: 16px; }
.fld-check { display: inline-flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--ink-mid); cursor: pointer; }
.fld-check input[type="checkbox"], .fld-check input[type="radio"], input[type="checkbox"], input[type="radio"] { accent-color: var(--gold); cursor: pointer; }
.fld-file {
  border: 1.5px dashed var(--line-strong); border-radius: var(--r-md); padding: 24px;
  text-align: center; background: var(--surface-2); cursor: pointer; transition: border-color .12s, background .12s;
}
.fld-file:hover { border-color: var(--gold); background: var(--gold-soft); }
.fld-icon-wrap { position: relative; }
.fld-icon-wrap .fld { padding-left: 34px; }
.fld-icon-wrap > .fa-solid, .fld-icon-wrap > i {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  font-size: 13px; color: var(--ink-soft); pointer-events: none;
}

/* toggle switch */
.toggle {
  width: 40px; height: 23px; border-radius: 99px; background: var(--surface-3);
  position: relative; transition: background .15s; flex-shrink: 0; border: none;
  cursor: pointer; padding: 0; display: inline-block;
}
.toggle::after {
  content: ''; position: absolute; top: 2.5px; left: 2.5px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.toggle.on { background: var(--gold); }
.toggle.on::after { left: 20px; }

/* segmented control */
.segmented {
  display: inline-flex; align-items: center; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--r-pill); padding: 3px; gap: 0;
}
.segmented > a, .segmented > button {
  padding: 6px 14px; border-radius: 99px; font-size: 13px; font-weight: 500;
  color: var(--ink-mid); background: transparent; border: none; cursor: pointer;
  transition: background .12s, color .12s; text-decoration: none; white-space: nowrap;
}
.segmented > a.on, .segmented > button.on { background: var(--gold); color: #1C1407; font-weight: 700; }

/* tag picker (topics, genres) */
.tag-picker { position: relative; }
.tag-pills { display: flex; flex-wrap: wrap; gap: 6px; min-height: 30px; margin-bottom: 8px; }
.tag-pill {
  display: inline-flex; align-items: center; gap: 6px; background: var(--gold-soft);
  color: var(--gold-acc); border: 1px solid var(--gold-line); border-radius: var(--r-pill);
  padding: 4px 8px 4px 12px; font-size: 12.5px; font-weight: 600;
}
.tag-pill button { background: none; border: none; cursor: pointer; color: inherit; padding: 0 2px; line-height: 1; font-size: 15px; opacity: .6; }
.tag-pill button:hover { opacity: 1; }
.tag-input-wrap { position: relative; }
.tag-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-sm); box-shadow: var(--shadow-md);
  z-index: 200; max-height: 220px; overflow-y: auto; display: none;
}
.tag-dropdown.open { display: block; }
.tag-option { padding: 9px 14px; font-size: 13.5px; cursor: pointer; color: var(--ink); }
.tag-option:hover, .tag-option.active { background: var(--surface-2); }
.tag-create { color: var(--gold-acc); font-style: italic; }

/* ══════════════════════════════════════════════════════════
   TABLES
   ══════════════════════════════════════════════════════════ */
.tbl-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-sm); overflow: hidden; }
.tbl-scroll { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
  text-align: left; font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-soft); padding: 11px 16px;
  border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface);
}
.tbl td { padding: 13px 16px; border-bottom: 1px solid var(--line-soft); color: var(--ink); vertical-align: middle; }
.tbl tbody tr { transition: background .1s; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .right { text-align: right; }
.tbl .nowrap { white-space: nowrap; }
.tbl-empty { text-align: center; color: var(--ink-soft); padding: 34px 16px; }
.tbl a { color: var(--ink); font-weight: 600; }
.tbl a:hover { color: var(--gold-acc); }
.tbl .row-actions { display: flex; gap: 6px; justify-content: flex-end; white-space: nowrap; }

/* ══════════════════════════════════════════════════════════
   ADMIN LAYOUT
   ══════════════════════════════════════════════════════════ */
.rw-layout { display: flex; height: 100vh; overflow: hidden; }

.rw-sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: var(--navy-chrome);
  height: 100%; position: relative; overflow: hidden; display: flex; flex-direction: column;
}
.rw-sidebar-pattern { position: absolute; inset: 0; opacity: 0.05; pointer-events: none; }
.rw-sidebar-brand { padding: 20px 20px 14px; position: relative; display: block; }
.rw-sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 16px 16px; position: relative; display: flex; flex-direction: column; gap: 20px; }
.rw-sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-color: transparent; }
.rw-nav-group { display: flex; flex-direction: column; gap: 3px; }
.rw-nav-group-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--on-navy-soft); padding: 4px 14px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--r-sm);
  color: var(--on-navy-soft); font-size: 14px; font-weight: 500; cursor: pointer;
  transition: background .12s, color .12s; position: relative; text-decoration: none;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: var(--on-navy); }
.nav-item.on { background: rgba(212,178,74,0.14); color: var(--gold-bright); font-weight: 600; }
.nav-item.on::before {
  content: ''; position: absolute; left: -14px; top: 8px; bottom: 8px;
  width: 3px; border-radius: 99px; background: var(--gold-bright);
}
.nav-item .nav-ico { width: 18px; text-align: center; flex-shrink: 0; font-size: 16px; }
.nav-item .nav-badge {
  margin-left: auto; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 1px 7px;
  background: rgba(212,178,74,0.2); color: var(--gold-bright);
}
.nav-item .nav-badge.alert { background: var(--error); color: #fff; }
.rw-sidebar-foot {
  display: flex; align-items: center; padding: 14px 18px; gap: 11px;
  border-top: 1px solid var(--on-navy-line); position: relative;
}
.rw-sidebar-foot .who { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.rw-sidebar-foot .who-name { font-size: 13.5px; font-weight: 600; color: var(--on-navy); }
.rw-sidebar-foot .who-role { font-size: 11.5px; color: var(--on-navy-soft); }
.rw-sidebar-foot .logout {
  background: none; border: none; cursor: pointer; color: var(--on-navy-soft);
  padding: 6px; border-radius: 8px; transition: background .12s, color .12s; font-size: 14px;
}
.rw-sidebar-foot .logout:hover { background: rgba(255,255,255,0.07); color: var(--on-navy); }

.rw-main { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; }

.rw-topbar {
  height: var(--topbar-h); flex-shrink: 0; border-bottom: 1px solid var(--line);
  background: var(--surface); padding: 0 26px; display: flex; align-items: center;
  justify-content: space-between; gap: 16px; position: sticky; top: 0; z-index: 30;
}
.rw-topbar-title { font-family: var(--font-display); font-size: 19px; font-weight: 700; line-height: 1.1; }
.rw-topbar-crumb { font-size: 12px; color: var(--ink-soft); }
.rw-topbar-crumb a { color: var(--ink-soft); }
.rw-topbar-crumb a:hover { color: var(--gold-acc); }
.rw-topbar-search { position: relative; width: 260px; }
.rw-topbar-search .fld { height: 40px; background: var(--surface-2); padding-left: 34px; }
.rw-icon-btn {
  background: var(--surface-2); color: var(--ink); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 9px; cursor: pointer; position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .12s; font-size: 16px; line-height: 1; width: 38px; height: 38px;
}
.rw-icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.rw-icon-btn .pip {
  position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--error); border: 1.5px solid var(--surface-2);
}
.rw-menu-btn { display: none; }

.rw-content { flex: 1; overflow-y: auto; padding: 26px 30px 60px; }

/* ══════════════════════════════════════════════════════════
   PAGE FURNITURE
   ══════════════════════════════════════════════════════════ */
.page-head {
  display: flex; justify-content: space-between; gap: 16px; margin-bottom: 22px;
  align-items: flex-start; flex-wrap: wrap;
}
.page-head-left { display: flex; gap: 12px; min-width: 0; }
.page-head h1, .page-title { font-family: var(--font-display); font-size: 27px; font-weight: 700; line-height: 1.05; }
.page-head .count {
  align-self: center; font-size: 13px; font-weight: 700; color: var(--gold-acc);
  background: var(--gold-soft); padding: 2px 11px; border-radius: 99px;
}
.page-head-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.page-sub { font-size: 14px; color: var(--ink-soft); margin-top: 4px; }

.section-head {
  display: flex; justify-content: space-between; gap: 16px; margin-bottom: 14px; align-items: flex-end;
}
.section-head h2, .section-head h3 { font-family: var(--font-display); font-size: 20px; font-weight: 700; line-height: 1.1; }
.section-sub { font-size: 12.5px; color: var(--ink-soft); }

.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.toolbar-search { position: relative; flex: 1; min-width: 220px; max-width: 380px; }
/* selects in a filter bar size to their content rather than stretching */
.fld-auto { width: auto; min-width: 140px; }

/* small centred figure, as used in the design's detail drawers */
.mini-stat {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 14px 10px; border-radius: var(--r-sm); background: var(--surface-2); text-align: center;
}
.mini-stat .n { font-family: var(--font-display); font-size: 18px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.mini-stat .l { font-size: 11px; color: var(--ink-soft); }

/* the message itself, set apart from the metadata around it */
.quote-block {
  border-left: 3px solid var(--gold); background: var(--surface-2);
  padding: 15px 18px; border-radius: 0 var(--r-sm) var(--r-sm) 0;
}

/* push notification preview: the lock screen behind a frosted banner */
.push-stage {
  border-radius: 22px; padding: 16px; min-height: 190px;
  background: linear-gradient(160deg, #2B2B40, #14141F);
}
.push-card { background: rgba(255,255,255,0.14); backdrop-filter: blur(8px); border-radius: 15px; padding: 12px; }

/* floating save bar: shared by the transcript and chapter editors */
.floating-save {
  position: sticky; bottom: -60px; margin: 20px -30px -60px;
  background: var(--surface); border-top: 1px solid var(--line);
  box-shadow: 0 -4px 20px rgba(0,0,0,.08); padding: 12px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  z-index: 42; flex-wrap: wrap;
}
.unsaved-indicator { font-size: 13px; color: var(--ink-soft); display: flex; align-items: center; gap: 7px; }
.unsaved-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); display: none; }
.unsaved-dot.visible { display: inline-block; }

/* ranked list rows: leaderboards, search logs, activity */
.rank-row { padding: 9px 0; align-items: center; }
.rank-row.ruled { border-bottom: 1px solid var(--line-soft); }
.rank-row .rank { font-size: 13px; font-weight: 700; color: var(--ink-soft); width: 16px; flex-shrink: 0; }

.notif-row { transition: box-shadow .12s, border-color .12s; }
.notif-row:hover { box-shadow: var(--shadow-md); }

/* role card in Team & roles: the coloured edge carries the role identity */
.role-card { text-decoration: none; transition: border-color .12s, box-shadow .12s, transform .1s; }
.role-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.role-card.on { box-shadow: 0 0 0 2px var(--gold-line), var(--shadow-sm); }

/* tabs */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs a, .tabs button {
  padding: 11px 4px; margin-right: 18px; font-size: 14px; font-weight: 500;
  color: var(--ink-soft); border: none; background: none; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none;
}
.tabs a:hover, .tabs button:hover { color: var(--ink); }
.tabs a.on, .tabs button.on { font-weight: 700; color: var(--ink); border-bottom-color: var(--gold); }
.tabs .tab-count { margin-left: 7px; font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.tabs a.on .tab-count, .tabs button.on .tab-count { color: var(--gold-acc); }

/* key/value */
.kv { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.kv-label { font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); }
.kv-value { font-size: 14.5px; color: var(--ink); font-weight: 500; word-break: break-word; }

/* stat card */
.stat-card { display: flex; flex-direction: column; gap: 10px; }
.stat-card .stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat-card .stat-label { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); letter-spacing: 0.02em; }
.stat-card .stat-ico {
  width: 30px; height: 30px; border-radius: 9px; background: var(--gold-soft); color: var(--gold-acc);
  display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0;
}
.stat-card .stat-ico.live { background: var(--error-soft); color: var(--error); }
.stat-card .stat-value { font-family: var(--font-display); font-size: 34px; font-weight: 700; line-height: 0.95; font-variant-numeric: tabular-nums; }
.stat-card .stat-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat-card .stat-delta { display: flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.stat-card .stat-delta.up { color: var(--success); }
.stat-card .stat-delta.down { color: var(--error); }
.stat-card .stat-delta.live { color: var(--error); }

/* attention tiles */
.tile {
  padding: 15px 16px; display: flex; gap: 13px; align-items: center;
  text-decoration: none; color: inherit; transition: border-color .12s, box-shadow .12s;
}
a.tile:hover { border-color: var(--gold-line); box-shadow: var(--shadow-md); }
.tile-ico {
  width: 42px; height: 42px; border-radius: 11px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 17px;
}
.tile-n { font-family: var(--font-display); font-size: 22px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.tile-label { font-size: 12.5px; color: var(--ink-soft); line-height: 1.2; }

/* tonal icon squares */
.ico-sq { display: inline-flex; align-items: center; justify-content: center; border-radius: 11px; flex-shrink: 0; }
.ico-sq-sm { width: 32px; height: 32px; border-radius: 9px; font-size: 13px; }
.ico-sq-md { width: 42px; height: 42px; font-size: 17px; }
.ico-sq-lg { width: 46px; height: 46px; border-radius: 13px; font-size: 19px; }
.tone-gold { background: var(--gold-soft); color: var(--gold-acc); }
.tone-success { background: var(--success-soft); color: var(--success); }
.tone-warning { background: var(--warning-soft); color: var(--warning); }
.tone-error { background: var(--error-soft); color: var(--error); }
.tone-info { background: var(--info-soft); color: var(--info); }
.tone-navy { background: var(--surface-2); color: var(--ink-mid); }

/* progress */
.progress { height: 7px; background: var(--surface-3); border-radius: 99px; overflow: hidden; flex: 1; }
.progress > span { display: block; height: 100%; background: var(--gold); border-radius: 99px; }

/* monogram + avatar */
.monogram {
  border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden; background: var(--navy-chrome);
}
.monogram .ini { color: var(--gold-bright); line-height: 1; user-select: none; }
.monogram.ring { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--gold-line); }
/* The photo sits over the initial disc, so a broken image reveals the monogram
   underneath rather than a dead <img>. */
.monogram img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar {
  border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  color: var(--gold-bright); font-weight: 700; letter-spacing: 0.02em;
}

/* empty state */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 54px 20px; text-align: center; gap: 10px; }
.empty-mark { position: relative; margin-bottom: 4px; display: flex; align-items: center; justify-content: center; }
.empty-mark > i { position: absolute; font-size: 22px; color: var(--gold-acc); }
.empty h4 { font-family: var(--font-display); font-size: 19px; font-weight: 600; }
.empty p { font-size: 13.5px; color: var(--ink-soft); max-width: 340px; }

/* alerts / django messages */
.alert {
  display: flex; align-items: flex-start; gap: 11px; padding: 13px 16px; border-radius: var(--r-sm);
  font-size: 14px; margin-bottom: 16px; border: 1px solid transparent; line-height: 1.5;
}
.alert i { margin-top: 2px; flex-shrink: 0; }
.alert-success { background: var(--success-soft); color: var(--success); border-color: rgba(45,125,70,0.22); }
.alert-error { background: var(--error-soft); color: var(--error); border-color: rgba(192,57,43,0.22); }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: rgba(183,122,31,0.24); }
.alert-info { background: var(--info-soft); color: var(--info); border-color: rgba(47,109,176,0.22); }

/* pagination */
.pager {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 18px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-soft); flex-wrap: wrap;
}
.pager-links { display: flex; gap: 6px; align-items: center; }
.pager-btn {
  min-width: 32px; height: 32px; padding: 0 9px; border-radius: var(--r-xs);
  display: inline-flex; align-items: center; justify-content: center; font-size: 13px;
  font-weight: 600; color: var(--ink-mid); background: var(--surface-2);
  border: 1px solid var(--line); text-decoration: none; transition: background .12s;
}
.pager-btn:hover { background: var(--surface-3); color: var(--ink); }
.pager-btn.on { background: var(--gold); color: #1C1407; border-color: var(--gold); }

/* ══════════════════════════════════════════════════════════
   DRAWER / MODAL
   ══════════════════════════════════════════════════════════ */
.scrim {
  position: fixed; inset: 0; z-index: 200; background: var(--scrim);
  display: flex; animation: rwFade .2s ease both;
}
.scrim[hidden] { display: none; }
.scrim.to-end { justify-content: flex-end; }
.scrim.to-center { align-items: center; justify-content: center; padding: 24px; }

.drawer {
  width: 560px; max-width: 94vw; height: 100%; background: var(--bg);
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  animation: rwSlide .3s cubic-bezier(.16,1,.3,1) both;
}
.drawer-head, .modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 18px 22px; border-bottom: 1px solid var(--line);
}
.drawer-head h3, .modal-head h3 { font-family: var(--font-display); font-size: 21px; font-weight: 700; line-height: 1.15; }
.drawer-body { flex: 1; overflow-y: auto; padding: 22px; }
.drawer-foot, .modal-foot {
  display: flex; gap: 10px; align-items: center; padding: 14px 22px;
  border-top: 1px solid var(--line); background: var(--surface); flex-wrap: wrap;
}
.modal {
  width: 460px; max-width: 96vw; max-height: 90vh; background: var(--bg);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg); overflow: hidden;
  display: flex; flex-direction: column; animation: rwRise .3s cubic-bezier(.16,1,.3,1) both;
}
.modal-head { border-bottom: 1px solid var(--line); align-items: center; }
.modal-head h3 { font-size: 20px; }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-foot { justify-content: flex-end; background: transparent; }
.modal-wide { width: 640px; }
.close-x { background: none; border: none; cursor: pointer; color: var(--ink-soft); font-size: 18px; padding: 4px; line-height: 1; }
.close-x:hover { color: var(--ink); }

/* ══════════════════════════════════════════════════════════
   KANBAN (transcription jobs board)
   ══════════════════════════════════════════════════════════ */
.board { display: flex; gap: 14px; align-items: flex-start; overflow-x: auto; padding-bottom: 6px; }
.board-col { min-width: 244px; flex: 1; display: flex; flex-direction: column; gap: 10px; }
.board-col-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px; }
.board-col-head .t { font-size: 13px; font-weight: 700; }
.board-col-head .n { font-size: 12px; color: var(--ink-soft); font-weight: 600; }
.board-col-body { display: flex; flex-direction: column; gap: 10px; background: var(--surface-2); border-radius: 14px; padding: 10px; min-height: 90px; }
.board-card { padding: 13px; cursor: pointer; display: block; text-decoration: none; color: inherit; }
.board-card:hover { border-color: var(--gold-line); }
.board-empty { text-align: center; padding: 14px 0; font-size: 12px; color: var(--ink-soft); }

/* ══════════════════════════════════════════════════════════
   GRID UTILITIES
   ══════════════════════════════════════════════════════════ */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid-auto-sm { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid-auto-lg { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
/* minmax(0, …) rather than a bare fr: a grid item's default min-width is auto,
   so one long unbreakable string (an uploaded filename, a URL) would otherwise
   push its column wider and squeeze the other one. */
.grid-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
.grid-main-wide { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); align-items: start; }
.grid-side { grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); align-items: start; }

/* Long filenames inside file widgets wrap instead of overflowing the card. */
.fld a, .fld-help, .card-body .fld { overflow-wrap: anywhere; }
.gap-4 { gap: 16px; } .gap-5 { gap: 20px; } .gap-6 { gap: 24px; }

/* ══════════════════════════════════════════════════════════
   PUBLIC SITE
   ══════════════════════════════════════════════════════════ */
/* The decorative khatam and the tilted phone are wider than the page on small
   screens; clip them rather than letting the page scroll sideways. */
.site-wrap { min-height: 100vh; display: flex; flex-direction: column; overflow-x: hidden; }
.site-inner { max-width: var(--site-max); margin: 0 auto; padding-left: 28px; padding-right: 28px; width: 100%; }
.site-section { padding-top: 34px; padding-bottom: 34px; position: relative; overflow: hidden; }
.site-section-tint { background: var(--bg-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

.site-nav {
  position: sticky; top: 0; z-index: 60; background: transparent;
  border-bottom: 1px solid transparent; transition: background .2s, border-color .2s, backdrop-filter .2s;
}
.site-nav.scrolled {
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); border-bottom-color: var(--line);
}
.site-nav-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 15px 28px; max-width: var(--site-max); margin: 0 auto; }
.site-nav-links { display: flex; gap: 4px; align-items: center; }
.site-nav-links a {
  padding: 8px 14px; font-size: 14px; font-weight: 500; color: var(--ink-mid);
  border-radius: 99px; transition: color .12s;
}
.site-nav-links a:hover { color: var(--ink); }
.site-nav-admin { font-size: 13.5px; font-weight: 600; color: var(--ink-mid); padding: 8px 12px; }
.site-nav-admin:hover { color: var(--ink); }

/* Mobile menu: the burger and its panel only exist below the breakpoint. */
.site-nav-burger {
  display: none; width: 40px; height: 40px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  cursor: pointer; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0;
}
.site-nav-panel {
  display: none; flex-direction: column; gap: 2px; padding: 8px 20px 18px;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.site-nav-panel a {
  padding: 11px 4px; font-size: 15px; font-weight: 500; color: var(--ink-mid);
}
.site-nav-panel a:hover { color: var(--ink); }
.site-nav-panel .wbtn { margin-top: 10px; justify-content: center; color: #1C1407; }

.site-h1 { font-family: var(--font-display); font-size: clamp(38px, 5vw, 66px); font-weight: 700; line-height: 1.03; text-wrap: balance; }
.site-h2 { font-family: var(--font-display); font-size: clamp(30px, 4vw, 46px); font-weight: 700; line-height: 1.08; text-wrap: balance; }
.site-lead { font-size: 18px; color: var(--ink-mid); line-height: 1.62; }
.site-body { font-size: 17px; color: var(--ink-mid); line-height: 1.6; }

.store-btn {
  display: inline-flex; align-items: center; gap: 11px; padding: 11px 18px;
  border-radius: var(--r-md); cursor: pointer; border: 1px solid transparent;
  background: var(--navy-chrome); color: var(--on-navy); text-decoration: none;
  transition: transform .1s, box-shadow .12s;
}
.store-btn:hover { box-shadow: var(--shadow-md); color: var(--on-navy); }
.store-btn:active { transform: translateY(1px); }
.store-btn.on-dark { background: var(--on-navy); color: #14141F; }
.store-btn.on-dark:hover { color: #14141F; }
.store-btn i { font-size: 24px; }
.store-btn .lines { display: flex; flex-direction: column; line-height: 1.15; align-items: flex-start; }
/* Both lines stay on one line each; the button shrinks instead of the text wrapping. */
.store-btn .lines .top { font-size: 10.5px; opacity: 0.72; letter-spacing: 0.04em; white-space: nowrap; }
.store-btn .lines .bot { font-size: 16px; font-weight: 700; font-family: var(--font-display); white-space: nowrap; }

.site-stat { display: flex; flex-direction: column; gap: 2px; }
.site-stat .v { font-family: var(--font-display); font-size: 30px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.site-stat .l { font-size: 12.5px; color: var(--ink-soft); font-weight: 500; }
.on-navy .site-stat .v { color: var(--on-navy); }
.on-navy .site-stat .l { color: var(--on-navy-soft); }

.faq-item { overflow: hidden; }
.faq-q {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 15px 18px; background: none; border: none; cursor: pointer; text-align: left;
  font-size: 15px; font-weight: 600; color: var(--ink); font-family: var(--font-body);
}
.faq-a { padding: 0 18px 16px; font-size: 14px; color: var(--ink-mid); line-height: 1.6; }
.faq-item[data-open="false"] .faq-a { display: none; }

.site-footer { background: var(--navy-chrome); color: var(--on-navy); position: relative; overflow: hidden; margin-top: auto; }
.site-footer a { color: var(--on-navy); opacity: 0.82; font-size: 14px; }
.site-footer a:hover { opacity: 1; color: var(--gold-bright); }
.site-footer-cols { display: grid; grid-template-columns: 1.6fr auto; gap: 40px; justify-content: space-between; }
.site-footer-col-title { font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--on-navy-soft); margin-bottom: 4px; }
.social-btn {
  width: 38px; height: 38px; border-radius: 10px; background: rgba(255,255,255,0.06);
  display: inline-flex; align-items: center; justify-content: center; font-size: 16px;
  color: var(--on-navy); transition: background .12s;
}
.social-btn:hover { background: rgba(255,255,255,0.12); color: var(--gold-bright); }

/* ── landing sections ──
   These live in CSS rather than inline style attributes so the media queries
   below can actually override them. */
.hero-section {
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 62%);
}
.hero-khatam { position: absolute; top: -140px; right: -110px; opacity: .9; pointer-events: none; }
.hero-grid {
  display: grid; grid-template-columns: 1.15fr .85fr; gap: 40px; align-items: center;
  padding-top: 78px; padding-bottom: 70px; position: relative;
}
.hero-phone { position: relative; }

.float-card {
  position: absolute; padding: 11px 14px; display: flex; gap: 10px; align-items: center;
  box-shadow: var(--shadow-lg); animation: rwRise .7s .2s both;
}
.float-card-tl { top: 28px; left: -34px; }
.float-card-br { bottom: 40px; right: -30px; animation-delay: .35s; }

.live-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; align-items: start; }
.mission-section { max-width: 940px; margin: 0 auto; padding: 42px 28px; text-align: center; position: relative; }
.support-grid { display: grid; grid-template-columns: .9fr 1.1fr; gap: 56px; align-items: start; }
.download-inner { max-width: 760px; margin: 0 auto; padding: 50px 28px; text-align: center; position: relative; }

/* phone mock */
.phone-wrap { width: 300px; flex-shrink: 0; transform-origin: center; }
.phone-frame { border-radius: 42px; background: #0C0C15; padding: 11px; box-shadow: 0 40px 90px rgba(30,22,6,0.34), 0 12px 30px rgba(30,22,6,0.22); }
.phone-screen { border-radius: 32px; overflow: hidden; background: var(--bg); height: 600px; position: relative; }
/* The screen is a picture of the app, so it keeps the parchment palette even
   when the surrounding page is on a dark panel. */
.phone-screen[data-theme="light"] { color: var(--ink); }

/* on-navy panels reuse dark tokens */
.on-navy { color: var(--on-navy); }
.on-navy h1, .on-navy h2, .on-navy h3 { color: var(--on-navy); }
.on-navy .site-lead, .on-navy .site-body, .on-navy p { color: var(--on-navy-soft); }

/* ══════════════════════════════════════════════════════════
   LOGIN
   ══════════════════════════════════════════════════════════ */
.login-wrap { height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.login-aside {
  background: linear-gradient(155deg, #1C1A2E 0%, #0C0C15 100%); position: relative;
  overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 48px;
}
.login-form-side { display: flex; align-items: center; justify-content: center; padding: 40px; background: var(--bg); overflow-y: auto; }
.login-form { width: 100%; max-width: 360px; display: flex; flex-direction: column; }
.login-brand { display: none; margin-bottom: 26px; }

/* ══════════════════════════════════════════════════════════
   MISC
   ══════════════════════════════════════════════════════════ */
.muted { color: var(--ink-soft); }
.mid { color: var(--ink-mid); }
.gold { color: var(--gold-acc); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.fw6 { font-weight: 600; }
.fw7 { font-weight: 700; }
.mb0 { margin-bottom: 0; } .mb2 { margin-bottom: 8px; } .mb3 { margin-bottom: 12px; }
.mb4 { margin-bottom: 16px; } .mb5 { margin-bottom: 20px; } .mb6 { margin-bottom: 24px; }
.mt2 { margin-top: 8px; } .mt3 { margin-top: 12px; } .mt4 { margin-top: 16px; } .mt5 { margin-top: 20px; }
.speak-ring { position: absolute; inset: -3px; border-radius: 50%; border: 2px solid var(--success); }

/* audio player */
.player-bar {
  display: flex; align-items: center; gap: 16px; padding: 20px;
  background: var(--navy-chrome); border: none; border-radius: var(--r-md);
}
.player-btn {
  width: 52px; height: 52px; border-radius: 50%; background: var(--gold); color: #1C1407;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  border: none; cursor: pointer; font-size: 18px;
}
.player-track { height: 5px; background: rgba(212,178,74,0.22); border-radius: 9px; overflow: hidden; }
.player-track > span { display: block; height: 100%; background: var(--gold); border-radius: 9px; }

/* transcript reading view */
.transcript-block { display: flex; gap: 12px; align-items: flex-start; }
.transcript-t { font-variant-numeric: tabular-nums; font-size: 12px; color: var(--gold-acc); font-weight: 700; min-width: 46px; }
.transcript-x { font-size: 14px; line-height: 1.6; color: var(--ink-mid); font-family: var(--font-read); }
.transcript-x.on { color: var(--ink); background: var(--gold-soft); border-radius: 4px; padding: 1px 5px; }

/* book spine */
.spine {
  display: flex; flex-direction: column; border-radius: 3px 6px 6px 3px;
  padding: 8px; justify-content: space-between; flex-shrink: 0;
  border-left: 3px solid rgba(212,178,74,0.4);
}
.spine .t { font-family: var(--font-display); font-size: 10px; font-weight: 700; color: var(--gold-bright); line-height: 1.1; }

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════ */
@media (max-width: 1200px) {
  .grid-main, .grid-main-wide, .grid-side { grid-template-columns: minmax(0, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-footer-cols { gap: 32px; }
}
/* legal documents (privacy policy) */
.legal-hero { background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 100%); border-bottom: 1px solid var(--line); padding: 72px 0 52px; }
.legal-body { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 48px; align-items: start; padding-top: 52px; padding-bottom: 88px; }
.legal-toc { position: sticky; top: 88px; }
.legal-toc ol { list-style: none; margin: 12px 0 0; padding: 0; counter-reset: toc; display: flex; flex-direction: column; gap: 9px; }
.legal-toc li { counter-increment: toc; font-size: 13px; line-height: 1.35; }
.legal-toc li::before { content: counter(toc) ". "; color: var(--gold-acc); font-weight: 700; font-variant-numeric: tabular-nums; }
.legal-toc a { color: var(--ink-mid); }
.legal-toc a:hover { color: var(--gold-acc); }
.legal-prose { max-width: 720px; font-size: 15.5px; line-height: 1.75; color: var(--ink-mid); }
.legal-prose h2 { font-family: var(--font-display); font-size: 28px; font-weight: 700; line-height: 1.15; color: var(--ink); margin: 44px 0 14px; scroll-margin-top: 42px; }
.legal-prose h2:first-child { margin-top: 0; }
.legal-prose h3 { font-family: var(--font-display); font-size: 20px; font-weight: 700; color: var(--ink); margin: 28px 0 8px; }
.legal-prose p { margin: 0 0 14px; }
.legal-prose ul { margin: 0 0 16px; padding-left: 20px; display: flex; flex-direction: column; gap: 7px; }
.legal-prose li::marker { color: var(--gold-acc); }
.legal-prose strong { color: var(--ink); font-weight: 700; }
.legal-prose a { color: var(--gold-acc); text-decoration: underline; text-underline-offset: 2px; }

@media (max-width: 1024px) {
  .rw-topbar-search { display: none; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login-wrap { grid-template-columns: 1fr; }
  .login-aside { display: none; }
  .login-brand { display: flex; }
  .legal-body { grid-template-columns: 1fr; gap: 28px; }
  .legal-toc { position: static; }

  /* Hero stacks: copy first, phone below and centred. The floating proof cards
     would hang off the viewport at this width, so pull them inside. */
  .hero-grid { grid-template-columns: 1fr; gap: 48px; padding-top: 56px; padding-bottom: 56px; }
  .hero-copy { align-items: center; text-align: center; }
  .hero-copy .site-lead { max-width: 560px; }
  .hero-copy .row { justify-content: center; }
  /* The hero column is now full width, so negative insets would push these
     past the viewport edge. Tuck them just inside instead. */
  .float-card-tl { left: 8px; }
  .float-card-br { right: 8px; }
  .live-grid, .support-grid { grid-template-columns: 1fr; gap: 28px; }
  .hero-khatam { right: -220px; }
}
@media (max-width: 860px) {
  .rw-menu-btn { display: inline-flex; }
  .rw-sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 120;
    transform: translateX(-100%); transition: transform .22s cubic-bezier(.16,1,.3,1);
    box-shadow: var(--shadow-lg);
  }
  .rw-sidebar.open { transform: none; }
  .rw-sidebar-scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 110; }
  .rw-content { padding: 20px 18px 60px; }
  .rw-topbar { padding: 0 18px; }
  .grid, .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .site-section { padding-top: 56px; padding-bottom: 56px; }
  .site-inner { padding-left: 20px; padding-right: 20px; }
  .page-head { gap: 12px; }
  .drawer { width: 100%; }

  /* Public site goes to the burger menu. */
  .site-nav-links, .site-nav-cta { display: none; }
  .site-nav-burger { display: inline-flex; }
  .site-nav-inner { padding: 12px 20px; }
  .site-nav-panel.open { display: flex; }
  .site-footer-cols { grid-template-columns: 1fr; gap: 28px; }

  .mission-section { padding: 64px 20px; }
  .download-inner { padding: 64px 20px; }
  .hero-khatam { display: none; }
}
@media (max-width: 560px) {
  .grid-auto, .grid-auto-sm { grid-template-columns: 1fr; }
  .page-head h1, .page-title { font-size: 23px; }

  /* Below this the 300px phone plus its floating cards cannot fit, so the
     cards move under the mock and the frame scales to the viewport. */
  .float-card { position: static; animation: none; width: 100%; max-width: 300px; }
  .hero-phone { gap: 14px; }
  .phone-wrap { transform: none !important; width: min(300px, 88vw); }
  .phone-screen { height: min(600px, 176vw); }
  .site-h1 { font-size: clamp(30px, 8.5vw, 40px); }
  .site-h2 { font-size: clamp(25px, 7.5vw, 34px); }
  .site-lead { font-size: 16px; }
  .site-body { font-size: 15.5px; }
  .store-btn { padding: 10px 14px; gap: 9px; }
  .store-btn i { font-size: 21px; }
  .store-btn .lines .bot { font-size: 15px; }
  .site-stat .v { font-size: 26px; }
}

@media print {
  .rw-sidebar, .rw-topbar, .page-head-actions, .toolbar { display: none !important; }
  .rw-content { overflow: visible; padding: 0; }
  .rw-layout { height: auto; display: block; }
}
