/* ============================================================
   KAIVALA · CRUZ DE ANKH — DESIGN SYSTEM
   Estética: místico-profissional. Preto profundo + dourado.
   Signature element: o glifo Ankh como indicador de progresso
   no Workspace (o "trabalho sagrado" se completa passo a passo).
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500;600;700&family=Work+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  /* Cor */
  --bg: #0A0906;
  --bg-elevated: #14120D;
  --bg-elevated-2: #1D1A12;
  --bg-elevated-3: #262117;
  --gold: #C9A15C;
  --gold-bright: #E8C77E;
  --gold-dim: #8B6D3F;
  --text: #EDE6D6;
  --text-muted: #A79A80;
  --text-faint: #6E6553;
  --line: #2A2620;
  --line-bright: #3C3627;
  --danger: #B15C50;
  --success: #7C9473;

  /* Tipografia */
  --font-display: 'Cinzel', serif;
  --font-body: 'Work Sans', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  /* Layout */
  --app-max-width: 480px;
  --radius-sm: 4px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --tab-bar-h: 72px;
  --header-h: 60px;
  --bg-outer: #050403;
  --bg-rgb: 10,9,6;

  color-scheme: dark;
}

/* ---------- Tema claro (opcional, activado por el usuario) ---------- */
html[data-theme="light"] {
  --bg: #F7F3EB;
  --bg-elevated: #FFFFFF;
  --bg-elevated-2: #F1EAD9;
  --bg-elevated-3: #EAE0C8;
  --gold: #B8863E;
  --gold-bright: #96682A;
  --gold-dim: #C9A876;
  --text: #241F16;
  --text-muted: #6B5F49;
  --text-faint: #9C917C;
  --line: #E4DAC5;
  --line-bright: #D3C6A8;
  --success: #4F7247;
  --danger: #A8443A;
  --bg-outer: #E4DCC8;
  --bg-rgb: 247,243,235;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- App shell ---------- */

#app {
  max-width: var(--app-max-width);
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  background:
    radial-gradient(ellipse 120% 60% at 50% 0%, rgba(201,161,92,0.06), transparent 60%),
    var(--bg);
  display: flex;
  flex-direction: column;
}

@media (min-width: 481px) {
  body {
    background: var(--bg-outer);
  }
  #app {
    box-shadow: 0 0 80px rgba(0,0,0,0.6);
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }
}

.view {
  display: none;
  flex: 1;
  flex-direction: column;
  padding-bottom: calc(var(--tab-bar-h) + 16px);
  animation: fadeIn 0.25s ease;
}
.view.active { display: flex; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Header ---------- */

.app-header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: rgba(var(--bg-rgb), 0.92);
  backdrop-filter: blur(8px);
  z-index: 20;
}

.app-header .back-btn {
  background: none;
  border: none;
  color: var(--gold);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  margin-left: -8px;
}

.app-header h1 {
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  margin: 0;
  font-weight: 600;
}

.header-spacer { width: 28px; }

.theme-quick-toggle {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--gold);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.theme-quick-toggle .icon-moon { display: none; }
html[data-theme="light"] .theme-quick-toggle .icon-sun { display: none; }
html[data-theme="light"] .theme-quick-toggle .icon-moon { display: block; }

.dash-header-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.dash-header-logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
  flex-shrink: 0;
}

/* ---------- Content padding wrapper ---------- */

.view-content {
  padding: 20px 20px 8px;
  flex: 1;
}

/* ---------- Visor de PDF interno ---------- */

#view-pdf-viewer {
  overscroll-behavior: contain;
}

.pdf-viewer-toolbar {
  flex-shrink: 0;
  display: flex;
  border-bottom: 1px solid var(--line);
  background: var(--bg-elevated);
}
.pdf-toolbar-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px;
  background: none;
  border: none;
  border-right: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 10.5px;
  font-family: var(--font-body);
  cursor: pointer;
}
.pdf-toolbar-btn:last-child { border-right: none; }
.pdf-toolbar-btn:active { background: var(--bg-elevated-2); color: var(--gold-bright); }
.pdf-toolbar-btn svg { color: var(--gold); }

.pdf-viewer-body {
  flex: 1;
  position: relative;
  min-height: 0;
  overscroll-behavior: contain;
}
#pdf-viewer-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
  -webkit-overflow-scrolling: touch;
}
.pdf-viewer-fallback {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-elevated);
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--text-muted);
}
.pdf-viewer-fallback a {
  color: var(--gold-bright);
  font-weight: 600;
  text-decoration: none;
}

/* ---------- Typography helpers ---------- */

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin: 0 0 6px;
}

h2.section-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
  margin: 0 0 4px;
}

p.section-sub {
  color: var(--text-muted);
  font-size: 13.5px;
  line-height: 1.5;
  margin: 0 0 20px;
}

/* ---------- Ankh glyph (signature element) ---------- */

.ankh-mark {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: -0.15em;
}

/* ---------- Cards ---------- */

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 14px;
}

.card-tappable {
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.card-tappable:hover, .card-tappable:focus-visible {
  border-color: var(--gold-dim);
  background: var(--bg-elevated-2);
}
.card-tappable:active {
  transform: scale(0.995);
}

/* ---------- Buttons ---------- */

.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  border-radius: var(--radius-sm);
  padding: 13px 20px;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  letter-spacing: 0.01em;
  transition: transform 0.1s ease, opacity 0.15s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  color: #17130A;
  width: 100%;
}
.btn-primary:hover { opacity: 0.92; }

.btn-secondary {
  background: transparent;
  border: 1px solid var(--line-bright);
  color: var(--text);
  width: 100%;
}
.btn-secondary:hover { border-color: var(--gold-dim); }

.btn-ghost {
  background: transparent;
  border: none;
  color: var(--gold);
  padding: 8px 4px;
}

.btn-danger {
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
  width: 100%;
}

.btn-block-row { display: flex; gap: 10px; }
.btn-block-row .btn { flex: 1; }

/* ---------- Form elements ---------- */

.field {
  margin-bottom: 16px;
}
.field label {
  display: block;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}
.field input[type="text"],
.field input[type="date"],
.field input[type="time"],
.field textarea,
.field select {
  width: 100%;
  background: var(--bg-elevated-2);
  border: 1px solid var(--line-bright);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 12px 12px;
  font-family: var(--font-body);
  font-size: 14px;
}
.field textarea { min-height: 90px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--gold);
}

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.checklist-item:last-child { border-bottom: none; }
.checklist-item input[type="checkbox"] {
  margin-top: 2px;
  width: 18px;
  height: 18px;
  accent-color: var(--gold);
  flex-shrink: 0;
}
.checklist-item .label {
  font-size: 14px;
  line-height: 1.4;
}
.checklist-item .label small {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 2px;
}

/* ---------- Tags / badges ---------- */

.tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gold-dim);
  border: 1px solid var(--line-bright);
  border-radius: 100px;
  padding: 3px 9px;
  margin: 0 6px 6px 0;
}
.tag.active-tag {
  color: var(--gold-bright);
  border-color: var(--gold);
}

/* ---------- Bottom tab bar ---------- */

.tab-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--app-max-width);
  height: var(--tab-bar-h);
  background: rgba(var(--bg-rgb), 0.96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  display: flex;
  z-index: 30;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.tab-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-faint);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-family: var(--font-body);
  font-size: 10.5px;
  letter-spacing: 0.02em;
  cursor: pointer;
  padding: 8px 0 4px;
}
.tab-btn svg { width: 21px; height: 21px; stroke: var(--text-faint); transition: stroke 0.15s; }
.tab-btn.active { color: var(--gold-bright); }
.tab-btn.active svg { stroke: var(--gold-bright); }

/* ---------- Splash ---------- */

#view-splash {
  position: fixed;
  inset: 0;
  max-width: var(--app-max-width);
  margin: 0 auto;
  z-index: 100;
  background: var(--bg);
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
}
#view-splash .splash-logo {
  width: 168px;
  height: 168px;
  margin-bottom: 22px;
  filter: drop-shadow(0 0 28px rgba(201,161,92,0.22));
  animation: splashIn 0.7s cubic-bezier(0.16,1,0.3,1);
}
@keyframes splashIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}
#view-splash .splash-tagline {
  color: var(--text-muted);
  font-size: 12.5px;
  letter-spacing: 0.05em;
  margin: 0;
  font-family: var(--font-mono);
  text-transform: uppercase;
}
#view-splash .tap-hint {
  position: absolute;
  bottom: 60px;
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  animation: pulseHint 2s ease-in-out infinite;
}
@keyframes pulseHint { 0%,100%{opacity:0.4} 50%{opacity:1} }

/* ---------- Login / Suscripción inactiva ---------- */

.login-view {
  position: fixed;
  inset: 0;
  max-width: var(--app-max-width);
  margin: 0 auto;
  z-index: 90;
  background: var(--bg);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  padding-bottom: 24px;
}
.login-view.active { display: flex; }

.login-wrap {
  width: 100%;
  max-width: 320px;
  text-align: center;
}
.login-logo {
  width: 84px;
  height: 84px;
  margin-bottom: 18px;
  filter: drop-shadow(0 0 20px rgba(201,161,92,0.18));
}
.login-title {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--text);
  margin: 0 0 6px;
}
.login-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 28px;
  line-height: 1.5;
}
.login-view .field { text-align: left; }
.login-error {
  color: var(--danger);
  font-size: 12.5px;
  margin: -6px 0 14px;
  line-height: 1.4;
}
.login-hint {
  margin-top: 18px;
  font-size: 11.5px;
  color: var(--text-faint);
  line-height: 1.5;
}

/* ---------- Dashboard ---------- */

.dash-hero {
  padding: 4px 0 18px;
}
.dash-hero .eyebrow { margin-bottom: 8px; }
.dash-hero h2 {
  font-family: var(--font-display);
  font-size: 24px;
  margin: 0;
  line-height: 1.25;
}

.stat-row {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}
.stat-box {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 12px;
  text-align: center;
}
.stat-box .num {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--gold-bright);
  display: block;
}
.stat-box .lbl {
  font-size: 10.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.theme-toggle-row {
  display: flex;
  gap: 12px;
  margin-bottom: 22px;
}
.theme-toggle-option {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line-bright);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text-muted);
}
.theme-toggle-option.active {
  border-color: var(--gold);
  color: var(--gold-bright);
  background: rgba(201,161,92,0.08);
}
.theme-swatch {
  width: 100%;
  height: 44px;
  border-radius: 6px;
  border: 1px solid var(--line-bright);
}
.theme-swatch-dark { background: linear-gradient(135deg, #0A0906, #1D1A12); }
.theme-swatch-light { background: linear-gradient(135deg, #F7F3EB, #EAE0C8); }

.install-banner {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius-md);
  padding: 14px 34px 14px 14px;
  margin-bottom: 16px;
}
.install-banner-icon { font-size: 22px; line-height: 1; flex-shrink: 0; }
.install-banner-text { flex: 1; min-width: 0; }
.install-banner-title { font-size: 13.5px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.install-banner-desc { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.install-banner-desc strong { color: var(--gold-bright); font-weight: 600; }
.install-banner-action {
  flex-shrink: 0;
  align-self: center;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  color: #17130A;
  border: none;
  font-weight: 700;
  font-size: 12.5px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.install-banner-close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
}

.continue-card {
  background: linear-gradient(135deg, rgba(201,161,92,0.14), rgba(201,161,92,0.02));
  border: 1px solid var(--gold-dim);
}
.continue-card .eyebrow { color: var(--gold-bright); }

.section-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 22px 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 6px;
}
.quick-action {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px 12px;
  text-align: left;
  cursor: pointer;
  color: var(--text);
}
.quick-action .qa-icon { color: var(--gold); margin-bottom: 8px; }
.quick-action .qa-icon svg { width: 22px; height: 22px; }
.quick-action .qa-label { font-size: 13px; font-weight: 600; }

.mini-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.mini-list-item:last-child { border-bottom: none; }
.mini-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg-elevated-3);
  border: 1px solid var(--line-bright);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--gold);
  flex-shrink: 0;
}
.mini-list-item .mi-text { flex: 1; min-width: 0; }
.mini-list-item .mi-title { font-size: 13.5px; font-weight: 500; }
.mini-list-item .mi-sub { font-size: 11.5px; color: var(--text-muted); }

/* ---------- Workspace stepper (ankh progress) ---------- */

.ankh-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 0 24px;
}
.ankh-stepper .step-track {
  width: 44px;
  height: 44px;
  position: relative;
}
.ankh-stepper .step-track svg .glow { stroke: var(--line-bright); transition: stroke 0.3s ease; }
.ankh-stepper .step-track.done svg .glow,
.ankh-stepper .step-track.current svg .glow { stroke: var(--gold); }
.ankh-stepper .step-track .step-num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
}
.ankh-stepper .step-track.done .step-num,
.ankh-stepper .step-track.current .step-num { color: var(--gold-bright); }
.ankh-stepper .step-line {
  width: 18px;
  height: 1px;
  background: var(--line-bright);
}
.ankh-stepper .step-line.done { background: var(--gold-dim); }

.mandatory-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(177,92,80,0.10);
  border: 1px solid rgba(177,92,80,0.45);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text);
}
.mandatory-banner .mandatory-icon {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}
.mandatory-banner strong {
  color: var(--gold-bright);
}

.blindaje-progress-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 8px;
  transition: color 0.2s ease;
}
.blindaje-progress-label.complete {
  color: var(--success);
}

.step-caption {
  text-align: center;
  margin-bottom: 20px;
}
.step-caption .cur-label {
  font-family: var(--font-display);
  font-size: 17px;
  color: var(--text);
}
.step-caption .cur-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* protocol pick */
.protocol-pick {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 10px;
  cursor: pointer;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.protocol-pick.recommended {
  border-color: var(--gold);
  background: rgba(201,161,92,0.06);
}
.protocol-pick.selected {
  border-color: var(--gold-bright);
  background: rgba(201,161,92,0.12);
}
.protocol-pick .pn {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--gold-dim);
  flex-shrink: 0;
  padding-top: 2px;
}
.protocol-pick .pt { font-size: 13.5px; font-weight: 600; margin-bottom: 3px; }
.protocol-pick .pd { font-size: 12px; color: var(--text-muted); line-height: 1.4; }
.recommended-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--gold-bright);
  border: 1px solid var(--gold-dim);
  border-radius: 100px;
  padding: 2px 7px;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* empty state */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}
.empty-state .es-icon { color: var(--gold-dim); margin-bottom: 14px; }
.empty-state .es-icon svg { width: 40px; height: 40px; }
.empty-state h3 {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--text);
  margin: 0 0 6px;
}
.empty-state p { font-size: 13px; line-height: 1.5; margin: 0 0 18px; }

/* library grid */
.lib-cat-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 16px;
  scrollbar-width: none;
}
.lib-cat-row::-webkit-scrollbar { display: none; }
.lib-cat-chip {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.03em;
  padding: 7px 14px;
  border-radius: 100px;
  border: 1px solid var(--line-bright);
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
}
.lib-cat-chip.active {
  border-color: var(--gold);
  color: var(--gold-bright);
  background: rgba(201,161,92,0.08);
}

.lib-item {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.lib-item:last-child { border-bottom: none; }
.lib-cover {
  width: 52px;
  height: 68px;
  border-radius: 4px;
  background: linear-gradient(160deg, var(--bg-elevated-3), var(--bg-elevated));
  border: 1px solid var(--line-bright);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-dim);
  overflow: hidden;
}
.lib-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.lib-cover svg { width: 20px; height: 20px; }
.lib-info { flex: 1; min-width: 0; }
.lib-info .li-title { font-size: 14px; font-weight: 600; margin-bottom: 3px; }
.lib-info .li-desc { font-size: 12px; color: var(--text-muted); line-height: 1.4; margin-bottom: 6px; }
.lib-info .li-fav {
  float: right;
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 2px;
}
.lib-info .li-fav.is-fav { color: var(--gold-bright); }

/* client detail timeline */
.timeline-entry {
  border-left: 2px solid var(--line-bright);
  padding: 2px 0 18px 18px;
  position: relative;
}
.timeline-entry::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
}
.timeline-entry .te-date {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--gold-dim);
  margin-bottom: 4px;
}
.timeline-entry .te-protocol { font-size: 13.5px; font-weight: 600; margin-bottom: 4px; }
.timeline-entry .te-notes { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }

/* search */
.search-input-wrap {
  position: sticky;
  top: var(--header-h);
  background: var(--bg);
  padding: 14px 20px 10px;
  z-index: 15;
}
.search-input-wrap input {
  width: 100%;
  background: var(--bg-elevated-2);
  border: 1px solid var(--line-bright);
  color: var(--text);
  border-radius: 100px;
  padding: 11px 16px;
  font-size: 14px;
}
.search-input-wrap input:focus { outline: none; border-color: var(--gold); }

/* profile */
.profile-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0 22px;
}
.profile-avatar {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--bg-elevated-3);
  border: 1px solid var(--gold-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
}
.profile-avatar svg { width: 26px; height: 26px; }
.profile-head .ph-name { font-family: var(--font-display); font-size: 17px; }
.profile-head .ph-role { font-size: 12px; color: var(--text-muted); }

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.list-row:last-child { border-bottom: none; }
.list-row .lr-label { font-size: 14px; }
.list-row .lr-label small { display: block; color: var(--text-muted); font-size: 11.5px; margin-top: 2px; }
.list-row .lr-chevron { color: var(--text-faint); }

.toast {
  position: fixed;
  bottom: calc(var(--tab-bar-h) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-elevated-3);
  border: 1px solid var(--gold-dim);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 100px;
  font-size: 13px;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  white-space: nowrap;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.divider-line {
  height: 1px;
  background: var(--line);
  margin: 18px 0;
  border: none;
}

.scroll-lock { overflow: hidden; }
