/* ============================================================
   SheriaPal design layer — loaded after the inline styles.
   Typography: Source Serif 4 (headings, the "law report" voice)
               Public Sans (interface and reading text)
   Icons: Lucide line icons via inline sprite (partials/icons.php)
   ============================================================ */

@font-face {
  font-family: "Public Sans";
  src: url("fonts/public-sans-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("fonts/source-serif-4-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 900; font-style: normal; font-display: swap;
}

:root {
  --font-ui: "Public Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
}

/* Base type */
*, input, button, select, textarea { font-family: var(--font-ui); }
body { font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
h1, h2, h3, .lp-logo, .logo, .ch-name, .modal h2, .sit-title, .lp-hero h1 {
  font-family: var(--font-serif);
  letter-spacing: -0.01em;
}
h1 { font-weight: 650; }
h2, h3 { font-weight: 600; }
.lp-logo, .logo { font-weight: 700; letter-spacing: -0.02em; }

/* ── Icons ─────────────────────────────────────────────── */
svg.ic {
  width: 1.15em; height: 1.15em;
  stroke: currentColor; fill: none; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -0.2em; flex-shrink: 0;
}
.nav-btn .icon svg.ic { width: 18px; height: 18px; }
button svg.ic + *, a svg.ic + * { margin-left: 0; }
.lp-btn svg.ic, .auth-btn svg.ic { margin-right: 6px; }

/* ── Hero: plain words, no eyebrow ─────────────────────── */
.lp-badge { display: none; }
.lp-hero h1 { font-size: clamp(2.4rem, 5.5vw, 4.2rem); line-height: 1.05; max-width: 18ch; margin-left: auto; margin-right: auto; }
.lp-hero h1 span { color: inherit; background: none; -webkit-text-fill-color: currentColor; }
.lp-hero-text { max-width: 58ch; margin-left: auto; margin-right: auto; font-size: 1.1rem; }
.lp-hero-langs { margin-top: 18px; font-size: 0.9rem; color: var(--text3); }

/* ── Chat: header and bubbles ──────────────────────────── */
.ch-status { font-size: 12px; }
.msg.bot .bubble { line-height: 1.6; }
.msg .bubble strong { font-weight: 650; }
.msg-actions button { display: inline-flex; align-items: center; justify-content: center; }
.msg-actions button svg.ic { width: 15px; height: 15px; }
.msg-actions button.active { color: var(--gold); }

/* Answer → action buttons under each stored reply */
.answer-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.answer-actions button {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 999px; cursor: pointer;
  font-size: 13px; font-weight: 600;
  background: transparent; color: var(--text); border: 1px solid var(--border);
}
.answer-actions button:hover { border-color: var(--gold); color: var(--gold); }
.answer-actions button.primary { background: var(--gold); border-color: var(--gold); color: var(--bg); }
.answer-actions button.primary:hover { filter: brightness(1.08); color: var(--bg); }

/* ── Situation tiles: the front door of the chat ───────── */
.situations { padding: 8px 24px 20px; max-width: 760px; }
.situations h2 { font-size: 1.6rem; margin: 6px 0 4px; color: var(--text); }
.situations > p { color: var(--text2); margin-bottom: 16px; font-size: 0.95rem; }
.sit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.sit {
  display: flex; gap: 12px; align-items: flex-start; text-align: left;
  padding: 14px; border-radius: 12px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
}
.sit:hover { border-color: var(--gold); }
.sit:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.sit .sit-icon {
  width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0;
  background: var(--surface2); color: var(--gold);
}
.sit .sit-icon svg.ic { width: 19px; height: 19px; }
.sit-title { font-size: 1.02rem; font-weight: 600; line-height: 1.25; display: block; }
.sit-desc { font-size: 0.84rem; color: var(--text2); display: block; margin-top: 2px; }
.situations .sit-other { margin-top: 12px; font-size: 0.88rem; color: var(--text3); }

/* ── Urgent help banner ────────────────────────────────── */
.urgent-banner {
  display: none; margin: 0 24px 10px; padding: 12px 14px; border-radius: 10px;
  background: var(--red-bg); color: var(--text); border: 1px solid var(--red);
  font-size: 14px; line-height: 1.45;
}
.urgent-banner.show { display: flex; gap: 10px; align-items: flex-start; }
.urgent-banner svg.ic { color: var(--red); width: 20px; height: 20px; margin-top: 1px; }
.urgent-banner a { color: inherit; font-weight: 700; text-decoration: underline; }
.urgent-banner .ub-close { margin-left: auto; background: none; border: none; color: var(--text2); cursor: pointer; padding: 2px; }

/* ── In-page dialogs (replace browser prompt/alert/confirm) ── */
.ui-dialog-overlay {
  position: fixed; inset: 0; z-index: 400; display: none;
  align-items: center; justify-content: center; padding: 16px;
  background: rgba(0, 0, 0, .55);
}
.ui-dialog-overlay.open { display: flex; }
.ui-dialog {
  width: 100%; max-width: 420px; border-radius: 14px; padding: 22px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .35);
}
.ui-dialog h3 { font-size: 1.2rem; margin-bottom: 8px; }
.ui-dialog p { color: var(--text2); font-size: 14px; margin-bottom: 14px; }
.ui-dialog input, .ui-dialog textarea {
  width: 100%; padding: 10px 12px; border-radius: 8px; font-size: 14px; margin-bottom: 14px;
  background: var(--bg); color: var(--text); border: 1px solid var(--border);
}
.ui-dialog textarea { min-height: 80px; resize: vertical; }
.ui-dialog .ui-err { color: var(--red); font-size: 13px; margin: -8px 0 10px; display: none; }
.ui-dialog .ui-actions { display: flex; justify-content: flex-end; gap: 8px; }
.ui-dialog .ui-actions button {
  padding: 9px 16px; border-radius: 8px; font-weight: 600; font-size: 14px; cursor: pointer;
  border: 1px solid var(--border); background: transparent; color: var(--text);
}
.ui-dialog .ui-actions button.ok { background: var(--gold); border-color: var(--gold); color: var(--bg); }
.ui-dialog .ui-actions button.danger { background: var(--red); border-color: var(--red); color: #fff; }

/* Legal-aid sheet */
.aid-list { list-style: none; margin: 0 0 14px; padding: 0; }
.aid-list li { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.aid-list li:last-child { border-bottom: none; }
.aid-list strong { display: block; color: var(--text); }
.aid-list span { color: var(--text2); }

@media (max-width: 640px) {
  .situations { padding: 4px 14px 16px; }
  .situations h2 { font-size: 1.35rem; }
  .sit-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .sit { flex-direction: column; gap: 8px; padding: 12px; }
  .sit-desc { display: none; }
  .urgent-banner { margin: 0 12px 8px; }
}

/* Quieter chrome: sentence-case labels instead of tracked capitals */
.sch-header, .sidebar-brand .tagline { text-transform: none; letter-spacing: 0; }
.sch-header { font-size: 12px; }
.sidebar-brand .tagline { font-family: var(--font-serif); font-style: italic; font-size: 13px; }
@media (max-width: 640px) {
  .sit { padding: 10px 12px; }
  .sit .sit-icon { width: 30px; height: 30px; }
}

/* ── Hero images: two photos framing the headline, fading into the page ── */
.hero-art {
  position: absolute; bottom: 0; pointer-events: none; user-select: none;
  height: auto; object-fit: cover;
}
.hero-art-left {
  left: 0; width: min(36vw, 560px);
  -webkit-mask-image: linear-gradient(to right, #000 30%, transparent 92%), linear-gradient(to top, #000 45%, transparent 100%);
  -webkit-mask-composite: source-in;
          mask-image: linear-gradient(to right, #000 30%, transparent 92%), linear-gradient(to top, #000 45%, transparent 100%);
          mask-composite: intersect;
}
.hero-art-right {
  right: 0; width: min(32vw, 470px);
  -webkit-mask-image: linear-gradient(to left, #000 40%, transparent 95%), linear-gradient(to top, #000 55%, transparent 100%);
  -webkit-mask-composite: source-in;
          mask-image: linear-gradient(to left, #000 40%, transparent 95%), linear-gradient(to top, #000 55%, transparent 100%);
          mask-composite: intersect;
}
[data-theme="dark"] .hero-art, :root:not([data-theme]) .hero-art { opacity: .8; }
.lp-hero-content { z-index: 1; }

/* Phones: one image, quietly behind the bottom of the hero */
@media (max-width: 760px) {
  .hero-art-left { display: none; }
  .hero-art-right {
    width: 100%; height: 45vh; object-position: center 35%; opacity: .28;
    -webkit-mask-image: linear-gradient(to top, #000 30%, transparent);
            mask-image: linear-gradient(to top, #000 30%, transparent);
  }
}

/* Tighter hero: no full-screen height, headline sits higher */
.lp-hero { min-height: clamp(560px, 78vh, 720px); padding: 96px 24px 72px; }
.hero-art-right { max-height: 94%; object-position: center bottom; }
@media (max-width: 760px) { .lp-hero { min-height: 0; padding: 92px 20px 56px; } }
@media (max-width: 760px) { .hero-art-right { height: 55%; opacity: .16; } }

/* ── Directory: tags, fee, next free time ──────────────── */
.adv-tag { font-family: var(--font-ui); font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px; vertical-align: middle; white-space: nowrap; }
.adv-tag.verified { color: var(--green); background: var(--green-bg); }
.adv-tag.demo { color: var(--text2); background: var(--surface2); border: 1px dashed var(--text3); }
.adv-tag svg.ic { width: 12px; height: 12px; }
.adv-next { font-size: 13px; color: var(--text2); margin: 10px 0 8px; display: flex; align-items: center; gap: 6px; }
.adv-next strong { color: var(--text); }

/* ── Booking: fee, demo note, slot picker ──────────────── */
.bk-fee, .bk-demo {
  display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 1.5;
  padding: 10px 12px; border-radius: 10px; margin: 6px 0 14px;
}
.bk-fee { background: var(--surface2); color: var(--text2); }
.bk-fee strong { color: var(--text); }
.bk-demo { background: var(--surface2); color: var(--text2); border: 1px dashed var(--text3); }
.bk-fee svg.ic, .bk-demo svg.ic { width: 18px; height: 18px; margin-top: 1px; color: var(--gold); }
.bk-tz { font-weight: 400; color: var(--text3); font-size: 12px; }
.slot-days { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.slot-day {
  flex: 0 0 auto; width: 62px; padding: 8px 4px; border-radius: 10px; cursor: pointer; text-align: center;
  background: var(--surface); border: 1px solid var(--border); color: var(--text); display: flex; flex-direction: column; gap: 1px;
}
.slot-day span { font-size: 11px; color: var(--text3); }
.slot-day strong { font-size: 17px; font-family: var(--font-serif); }
.slot-day small { font-size: 10px; color: var(--text3); }
.slot-day:disabled { opacity: .45; cursor: not-allowed; }
.slot-day.on, .slot-time.on { border-color: var(--gold); background: var(--gold); color: var(--bg); }
.slot-day.on span, .slot-day.on small { color: var(--bg); }
.slot-times { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; }
.slot-time {
  padding: 8px 0; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
}
.slot-time:hover, .slot-day:not(:disabled):hover { border-color: var(--gold); }
.slot-empty { font-size: 13px; color: var(--text3); }
#bkSubmit:disabled { opacity: .5; cursor: not-allowed; }

/* ── Advocate hours editor ─────────────────────────────── */
.hours-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 14px; flex-wrap: wrap; }
.hours-row label { width: 130px; display: flex; gap: 6px; align-items: center; }
.hours-row input[type=time] { padding: 6px 8px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); color: var(--text); }
.hours-row input[type=time]:disabled { opacity: .4; }

/* ── Document Atelier ──────────────────────────────────── */
.docs-wrap { max-width: 760px; padding: 24px; margin: 0 auto; overflow-y: auto; height: 100%; }
.docs-intro h2 { font-size: 1.6rem; margin-bottom: 4px; }
.docs-intro p { color: var(--text2); margin-bottom: 16px; font-size: .95rem; max-width: 62ch; }
.docs-back { display: inline-flex; align-items: center; gap: 4px; background: none; border: none; color: var(--text2); cursor: pointer; font-size: 13px; margin-bottom: 10px; padding: 0; }
.docs-back svg.ic { transform: rotate(180deg); }
.docs-form .opt { font-weight: 400; color: var(--text3); }
.doc-result { margin-top: 20px; }
.doc-result textarea {
  width: 100%; padding: 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-family: var(--font-serif); font-size: 15px; line-height: 1.6; resize: vertical;
}
@media (max-width: 640px) { .docs-wrap { padding: 14px; } .hours-row label { width: 100%; } }

/* Forms outside modals (Document Atelier, hours) */
.docs-form .form-group { margin-bottom: 14px; }
.docs-form .form-group label { display: block; font-size: 13px; color: var(--text2); margin-bottom: 4px; font-weight: 500; }
.docs-form input, .docs-form textarea {
  width: 100%; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 14px; outline: none;
}
.docs-form textarea { resize: vertical; min-height: 90px; }
.docs-form input:focus, .docs-form textarea:focus { border-color: var(--gold); }
.docs-form .btn-primary, #hoursSave {
  display: inline-flex; align-items: center; gap: 6px; padding: 11px 18px; border: none; border-radius: 8px;
  background: var(--gold); color: var(--bg); font-weight: 700; font-size: 14px; cursor: pointer;
}
.docs-form .btn-primary:disabled { opacity: .6; cursor: wait; }

/* ── Sources under answers ─────────────────────────────── */
.msg-sources { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; font-size: 12px; }
.msg-sources .ms-label { color: var(--text3); margin-right: 2px; }
.ms-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; cursor: pointer;
  background: var(--surface2); border: 1px solid var(--border); color: var(--text); font-size: 12px; font-weight: 600;
}
.ms-chip:hover { border-color: var(--gold); color: var(--gold); }
.ms-chip svg.ic { width: 13px; height: 13px; }
.msg-sources.none { color: var(--text3); gap: 5px; }
.msg-sources.none svg.ic { width: 13px; height: 13px; }
.src-part { font-size: 12px !important; color: var(--text3) !important; margin-bottom: 6px !important; }
.src-body { white-space: pre-wrap; font-family: var(--font-serif); font-size: 14.5px; line-height: 1.6; max-height: 50vh; overflow: auto; margin-bottom: 12px; color: var(--text); }
.src-meta { font-size: 12px !important; }
.ui-dialog:has(.src-body) { max-width: 640px; }

/* ── Admin: library form ───────────────────────────────── */
.lib-form { margin-bottom: 20px; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.lib-grid label, .lib-text { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text2); }
.lib-text { margin-top: 10px; }
.lib-grid input, .lib-text textarea {
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 13px;
}
.lib-text textarea { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }

/* Library upload */
.lib-grid select { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 13px; }
.lf-hint { font-size: 13px; color: var(--text2); margin: 10px 0; }
.lib-drop {
  display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 10px; font-size: 13px; line-height: 1.5;
  border: 1.5px dashed var(--border); background: var(--surface2); color: var(--text);
}
.lib-drop.over { border-color: var(--gold); }
.lib-drop > svg.ic { width: 26px; height: 26px; color: var(--gold); }
.lib-drop > div { flex: 1; }
.lib-pick { cursor: pointer; white-space: nowrap; }

/* ── Booking cards (v1.5) ──────────────────────────────── */
.booking-list { display: flex; flex-direction: column; gap: 10px; }
.booking-card { align-items: flex-start !important; }
.booking-card .bc-status {
  display: inline-flex; align-items: center; gap: 5px; text-transform: none !important; letter-spacing: 0 !important;
  font-size: 12px !important; font-weight: 600 !important; padding: 5px 10px !important; border-radius: 999px !important; white-space: nowrap; min-width: 0;
}
.booking-card .bc-status svg.ic { width: 14px; height: 14px; }
.booking-card .bc-status.pending   { background: #fef3c7 !important; color: #92400e !important; }
.booking-card .bc-status.approved  { background: #dcfce7 !important; color: #166534 !important; }
.booking-card .bc-status.live      { background: #166534 !important; color: #ffffff !important; }
.booking-card .bc-status.completed { background: #e0e7ff !important; color: #3730a3 !important; }
.booking-card .bc-status.cancelled { background: #f3f4f6 !important; color: #6b7280 !important; }
.booking-card.bc-cancelled { opacity: .78; }
.booking-card .bc-info h4 { font-size: 15px !important; }
.booking-card .bc-meta { gap: 6px 16px !important; margin-top: 6px !important; }
.booking-card .bc-meta span { display: inline-flex; align-items: center; gap: 5px; }
.booking-card .bc-meta em { color: var(--gold); font-style: normal; font-weight: 600; margin-left: 4px; }
.booking-card .bc-meta a { color: inherit; }
.bc-stars { color: var(--gold); font-size: 13px; }
.bc-note { margin-top: 8px; font-size: 13px; color: var(--text2); font-style: italic; }
.bc-sub { margin-top: 6px; font-size: 12.5px; color: var(--text3); }
.booking-card .bc-actions { flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.booking-card .bc-actions button, .booking-card .bc-actions a.join-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px !important; font-size: 13px !important;
  border-radius: 8px !important; font-weight: 600; text-decoration: none; cursor: pointer;
}
.booking-card .bc-actions a.join-btn { background: #166534; color: #fff; }
.booking-card .bc-actions a.join-btn:hover { filter: brightness(1.1); text-decoration: none; }
.booking-card .bc-actions svg.ic { width: 15px; height: 15px; }
@media (max-width: 640px) {
  .booking-card .bc-actions { justify-content: flex-start !important; }
  .booking-card .bc-meta { flex-direction: column; }
}

/* ── Admin panel (v1.5) ────────────────────────────────── */
.admin-stat .as-label { text-transform: none !important; letter-spacing: 0 !important; font-size: 13px !important; }
.admin-tabs { gap: 2px !important; }
.admin-tabs button { display: inline-flex; align-items: center; gap: 6px; }
#adminPanel { min-width: 0; }
.admin-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px 22px; margin-bottom: 16px;
}
.admin-card h3 { display: flex; align-items: center; gap: 8px; font-size: 1.1rem; margin: 0 0 6px; }
.admin-form { max-width: 720px; }
.admin-help { font-size: 13px; color: var(--text2); margin: 0 0 14px; line-height: 1.5; }
.admin-hint { font-size: 13px; color: var(--text2); background: var(--surface2); border-radius: 8px; padding: 10px 12px; margin: 12px 0; line-height: 1.5; }
.admin-hint code, .admin-help code { font-size: 12px; background: var(--surface); padding: 1px 5px; border-radius: 4px; word-break: break-all; }
.af-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px 16px; }
.af-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--text2); font-weight: 500; }
.af-grid small { font-size: 12px; color: var(--text3); font-weight: 400; }
.af-grid input, .af-grid select, .af-actions input {
  padding: 9px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font-size: 14px; width: 100%;
}
.af-grid input:focus, .af-grid select:focus, .af-actions input:focus { outline: none; border-color: var(--gold); }
.af-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; align-items: center; }
.af-actions input { flex: 1; min-width: 200px; width: auto; }
.admin-container .btn-primary, .admin-container .btn-secondary, .admin-container .btn-sm, .admin-container .btn-danger {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 8px; font-weight: 600; cursor: pointer; line-height: 1.2;
}
.admin-container .btn-primary { background: var(--gold); color: var(--bg); border: 1px solid var(--gold); padding: 9px 16px; font-size: 14px; }
.admin-container .btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); padding: 9px 16px; font-size: 14px; }
.admin-container .btn-secondary:hover { border-color: var(--gold); }
.btn-sm { background: var(--surface); color: var(--text); border: 1px solid var(--border) !important; padding: 6px 11px !important; font-size: 12.5px !important; border-radius: 7px !important; }
.btn-sm.gold { background: var(--gold); color: var(--bg); border-color: var(--gold) !important; }
.btn-sm:disabled { opacity: .55; cursor: default; }
.admin-container .btn-danger { padding: 6px 11px; font-size: 12.5px; border-radius: 7px; }
.admin-container svg.ic { width: 15px; height: 15px; }
.admin-grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.admin-grid2 .admin-card { margin-bottom: 0; }
table.kv { width: 100%; border-collapse: collapse; font-size: 14px; margin: 6px 0; }
table.kv td { padding: 6px 0; vertical-align: top; border-bottom: 1px solid var(--border); }
table.kv td:first-child { color: var(--text3); width: 42%; padding-right: 12px; }
.admin-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
.admin-scroll .admin-table { margin: 0; }
.em-err { font-size: 12px; color: var(--red); margin-top: 2px; max-width: 360px; }
.em-log { font-size: 11px; background: var(--surface2); padding: 8px; border-radius: 6px; white-space: pre-wrap; max-height: 220px; overflow: auto; }
.admin-table { width: 100%; }
@media (max-width: 640px) { .admin-container { padding: 14px !important; } .admin-card { padding: 16px; } }
