/* ============================================================
   Sinergia Abogados · CRM — Sistema de diseño
   ============================================================ */

@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,300;9..144,400;9..144,500;9..144,600&family=Inter:wght@400;450;500;600;700&family=Source+Serif+4:opsz,wght@8..60,400;8..60,500;8..60,600&display=swap");

:root {
  --navy-950: #03172b;
  --navy-900: #04203c;
  --navy-800: #06294c;
  --navy: #053065;
  --navy-600: #0a4a8c;
  --blue: #0f5cad;
  --blue-100: #e9f1fa;
  --blue-050: #f3f8fd;

  --green: #5aa93f;
  --green-600: #478b30;
  --green-100: #edf6e7;
  --orange: #ef8a1d;
  --orange-600: #d9760b;
  --orange-100: #fdf2e4;
  --red: #be443c;
  --red-100: #fbeceb;
  --gold: #b58a3d;
  --gold-100: #f8f1e2;

  --paper: #f4f1ea;
  --paper-deep: #ece7dc;
  --surface: #ffffff;
  --surface-warm: #fdfbf7;

  --ink: #15232f;
  --ink-2: #465563;
  --ink-3: #78838e;
  --ink-4: #a3abb3;

  --line: #e6e1d6;
  --line-soft: #efeae0;
  --line-strong: #d8d1c2;

  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --doc: "Source Serif 4", Georgia, serif;

  --r-xs: 8px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 24px;

  --shadow-xs: 0 1px 2px rgba(4, 32, 60, 0.05);
  --shadow-sm: 0 2px 8px rgba(4, 32, 60, 0.05), 0 1px 2px rgba(4, 32, 60, 0.04);
  --shadow-md: 0 12px 32px rgba(4, 32, 60, 0.09), 0 2px 6px rgba(4, 32, 60, 0.04);
  --shadow-lg: 0 32px 80px rgba(3, 23, 43, 0.22);

  --sidebar-w: 268px;
  --topbar-h: 72px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { font-weight: 500; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
img, svg { display: block; }
ul, ol { margin: 0; padding: 0; list-style: none; }
table { border-collapse: collapse; width: 100%; }
::selection { background: rgba(250, 144, 34, 0.24); }

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: 4px;
}

*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: #cfc8ba; border: 3px solid transparent; background-clip: content-box; border-radius: 99px; }
*::-webkit-scrollbar-thumb:hover { background: #b3ab9c; background-clip: content-box; border: 3px solid transparent; }

.icon { width: 18px; height: 18px; flex: none; }
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 22px; height: 22px; }
.icon-xl { width: 28px; height: 28px; }

/* ---------- Shell ---------- */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 22px 16px 16px;
  color: rgba(255, 255, 255, 0.72);
  background:
    radial-gradient(560px 300px at -10% -5%, rgba(15, 92, 173, 0.55), transparent 70%),
    radial-gradient(420px 280px at 110% 100%, rgba(250, 144, 34, 0.12), transparent 75%),
    linear-gradient(180deg, #062a4f 0%, #041e38 55%, #03182c 100%);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 40;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}
.sidebar::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='.08'/%3E%3C/svg%3E");
}
.sidebar > * { position: relative; z-index: 1; }

.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 0 6px 18px; }
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark {
  width: 44px; height: 44px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  background: #fbf8f1;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28), inset 0 0 0 1px rgba(255, 255, 255, 0.35);
  overflow: hidden;
}
.brand-mark img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.06); }
.brand-text { min-width: 0; line-height: 1.12; }
.brand-text strong {
  display: block;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 19px;
  letter-spacing: 0.01em;
  color: #fff;
}
.brand-text span {
  display: block;
  margin-top: 3px;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: rgba(255, 255, 255, 0.45);
  white-space: nowrap;
}
.sidebar-close { display: none; margin-left: auto; color: rgba(255,255,255,.7); }

.sidebar-office {
  display: flex; align-items: center; gap: 7px;
  margin: 0 4px 20px;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.035);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.55);
}
.sidebar-office .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(107, 190, 76, 0.15); }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-label {
  margin: 18px 10px 7px;
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: rgba(255, 255, 255, 0.32);
}
.nav-label:first-child { margin-top: 0; }
.nav-link {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  min-height: 40px;
  padding: 9px 11px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 450;
  color: rgba(255, 255, 255, 0.68);
  transition: background 0.18s ease, color 0.18s ease;
}
.nav-link .icon { color: rgba(255, 255, 255, 0.48); transition: color 0.18s ease; }
.nav-link:hover { background: rgba(255, 255, 255, 0.055); color: #fff; }
.nav-link:hover .icon { color: rgba(255, 255, 255, 0.85); }
.nav-link.active {
  background: linear-gradient(90deg, rgba(250, 144, 34, 0.18), rgba(250, 144, 34, 0.045));
  color: #fff;
  font-weight: 500;
}
.nav-link.active::before {
  content: "";
  position: absolute; left: 0; top: 9px; bottom: 9px;
  width: 3px; border-radius: 0 3px 3px 0;
  background: var(--orange);
}
.nav-link.active .icon { color: var(--orange); }
.nav-badge {
  margin-left: auto;
  min-width: 20px; height: 20px; padding: 0 6px;
  display: inline-grid; place-items: center;
  border-radius: 99px;
  font-size: 10px; font-weight: 600;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
}
.nav-badge.hot { background: rgba(250, 144, 34, 0.2); color: #ffc27d; }

.sidebar-bottom { margin-top: auto; padding-top: 18px; }
.sidebar-cta {
  display: block;
  padding: 14px;
  border-radius: 13px;
  background: linear-gradient(135deg, rgba(250, 144, 34, 0.18), rgba(250, 144, 34, 0.06));
  border: 1px solid rgba(250, 144, 34, 0.24);
  transition: border-color .2s, transform .2s;
}
.sidebar-cta:hover { border-color: rgba(250, 144, 34, 0.5); transform: translateY(-1px); }
.sidebar-cta-tag { display: flex; align-items: center; gap: 6px; font-size: 9px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; color: #ffae57; }
.sidebar-cta-title { margin-top: 7px; font-family: var(--serif); font-size: 14.5px; color: #fff; line-height: 1.3; }
.sidebar-cta-sub { margin-top: 5px; font-size: 10.5px; color: rgba(255,255,255,.45); line-height: 1.45; }

.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  margin-top: 14px; padding: 10px 6px 2px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar-user .avatar { width: 34px; height: 34px; background: rgba(255,255,255,.12); color: #fff; font-size: 11px; }
.sidebar-user-meta { min-width: 0; line-height: 1.25; }
.sidebar-user-meta strong { display: block; font-size: 11.5px; font-weight: 500; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-meta span { display: block; font-size: 9.5px; color: rgba(255, 255, 255, 0.42); }
.sidebar-user .icon-btn { margin-left: auto; color: rgba(255,255,255,.4); width: 30px; height: 30px; }
.sidebar-user .icon-btn:hover { color: #fff; background: rgba(255,255,255,.08); }

.main { min-width: 0; display: flex; flex-direction: column; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 20px;
  padding: 0 32px;
  background: rgba(244, 241, 234, 0.82);
  backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid rgba(216, 209, 194, 0.65);
}
.crumbs { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.crumbs .icon { width: 13px; height: 13px; color: var(--ink-4); }
.crumbs strong { font-weight: 500; color: var(--ink); }
.topbar-search {
  display: flex; align-items: center; gap: 9px;
  width: min(340px, 30vw);
  height: 38px;
  margin-left: auto;
  padding: 0 13px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink-3);
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.topbar-search:focus-within { background: #fff; border-color: #bcc9d6; box-shadow: 0 0 0 3px rgba(15, 92, 173, 0.08); }
.topbar-search input { width: 100%; border: 0; outline: 0; background: none; font-size: 12.5px; color: var(--ink); }
.topbar-search input::placeholder { color: var(--ink-4); }
.topbar-search kbd {
  font-family: var(--sans); font-size: 9.5px; color: var(--ink-3);
  padding: 2px 5px; border-radius: 4px; border: 1px solid var(--line); background: var(--surface-warm);
}
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.topbar-user { display: flex; align-items: center; gap: 9px; margin-left: 6px; padding-left: 14px; border-left: 1px solid var(--line); }
.topbar-user-meta { line-height: 1.2; }
.topbar-user-meta strong { display: block; font-size: 11.5px; font-weight: 600; }
.topbar-user-meta span { display: block; font-size: 10px; color: var(--ink-3); }
.topbar-user .avatar { width: 34px; height: 34px; }

.icon-btn {
  position: relative;
  width: 36px; height: 36px;
  display: inline-grid; place-items: center;
  border-radius: 9px;
  color: var(--ink-2);
  transition: background .18s, color .18s;
  flex: none;
}
.icon-btn:hover { background: rgba(5, 48, 101, 0.06); color: var(--navy); }
.icon-btn.has-dot::after {
  content: ""; position: absolute; top: 8px; right: 8px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--orange); box-shadow: 0 0 0 2px var(--paper);
}
.only-mobile { display: none; }

/* ---------- Page ---------- */
.page { padding: 30px 32px 64px; width: 100%; max-width: 1560px; margin: 0 auto; flex: 1; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; flex-wrap: wrap; }
.eyebrow {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px;
  font-size: 9.5px; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--orange-600);
}
.eyebrow::before { content: ""; width: 18px; height: 1px; background: var(--orange); }
.eyebrow.plain { color: var(--ink-3); }
.eyebrow.plain::before { background: var(--line-strong); }
.page-title {
  font-family: var(--serif);
  font-size: clamp(26px, 2.4vw, 34px);
  font-weight: 500;
  letter-spacing: -0.018em;
  line-height: 1.1;
  color: var(--navy-950);
}
.page-title em { font-style: italic; color: var(--navy); }
.page-sub { margin-top: 7px; font-size: 13px; color: var(--ink-2); max-width: 640px; }
.head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 40px; padding: 0 15px;
  border-radius: 9px;
  border: 1px solid transparent;
  font-size: 12.5px; font-weight: 550;
  letter-spacing: 0.005em;
  white-space: nowrap;
  transition: transform .15s, background .18s, border-color .18s, box-shadow .18s, color .18s;
}
.btn:active { transform: translateY(1px); }
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: var(--navy); color: #fff; box-shadow: 0 4px 12px rgba(5, 48, 101, 0.18); }
.btn-primary:hover { background: var(--navy-700, #0a417f); box-shadow: 0 6px 16px rgba(5, 48, 101, 0.24); }
.btn-accent { background: var(--orange); color: #fff; box-shadow: 0 4px 12px rgba(239, 138, 29, 0.22); }
.btn-accent:hover { background: var(--orange-600); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink); box-shadow: var(--shadow-xs); }
.btn-ghost:hover { border-color: var(--line-strong); background: var(--surface-warm); }
.btn-quiet { background: transparent; color: var(--ink-2); }
.btn-quiet:hover { background: rgba(5, 48, 101, 0.055); color: var(--navy); }
.btn-success { background: var(--green); color: #fff; box-shadow: 0 4px 12px rgba(90, 169, 63, 0.22); }
.btn-success:hover { background: var(--green-600); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 11.5px; border-radius: 8px; }
.btn-lg { height: 46px; padding: 0 20px; font-size: 13.5px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.link-arrow { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; color: var(--navy); }
.link-arrow .icon { width: 13px; height: 13px; transition: transform .18s; }
.link-arrow:hover .icon { transform: translateX(2px); }
.btn-on-dark { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.18); }
.btn-on-dark:hover { background: rgba(255,255,255,.2); border-color: rgba(255,255,255,.28); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 20px 14px; }
.card-head.stack { align-items: flex-start; }
.card-title { font-family: var(--serif); font-size: 17px; font-weight: 500; letter-spacing: -.01em; color: var(--navy-950); }
.card-sub { margin-top: 3px; font-size: 11.5px; color: var(--ink-3); }
.card-body { padding: 0 20px 20px; }
.card-body.pad { padding: 20px; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 20px; border-top: 1px solid var(--line-soft); background: var(--surface-warm); border-radius: 0 0 var(--r-lg) var(--r-lg); font-size: 11.5px; color: var(--ink-3); flex-wrap: wrap; }
.card-flush .card-body { padding: 0; }
.divider { height: 1px; background: var(--line-soft); }

/* ---------- Layout grids ---------- */
.grid { display: grid; gap: 18px; }
.grid > *, .master-detail > *, .portal-layout > * { min-width: 0; }
.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-main { grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); }
.grid-main-wide { grid-template-columns: minmax(0, 2.1fr) minmax(300px, 1fr); }
.stack { display: flex; flex-direction: column; gap: 18px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--ink-3); }
.small { font-size: 11.5px; }
.tiny { font-size: 10.5px; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }

/* ---------- Stats ---------- */
.stat {
  position: relative;
  padding: 18px 18px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  min-height: 142px;
}
.stat::after {
  content: ""; position: absolute; right: -30px; top: -30px;
  width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle, var(--stat-glow, rgba(15, 92, 173, 0.06)), transparent 68%);
}
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; position: relative; z-index: 1; }
.stat-label { font-size: 10px; font-weight: 600; letter-spacing: 0.11em; text-transform: uppercase; color: var(--ink-3); }
.stat-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; background: var(--blue-100); color: var(--navy); }
.stat-icon.accent { background: var(--orange-100); color: var(--orange-600); }
.stat-icon.green { background: var(--green-100); color: var(--green-600); }
.stat-icon.red { background: var(--red-100); color: var(--red); }
.stat-icon .icon { width: 16px; height: 16px; }
.stat-value { position: relative; z-index: 1; margin-top: 14px; font-family: var(--serif); font-size: 33px; line-height: 1; font-weight: 500; letter-spacing: -0.02em; color: var(--navy-950); }
.stat-value .unit { font-family: var(--sans); font-size: 13px; font-weight: 500; color: var(--ink-3); letter-spacing: 0; }
.stat-meta { position: relative; z-index: 1; display: flex; align-items: center; gap: 6px; margin-top: 10px; padding-right: 62px; font-size: 10.5px; color: var(--ink-3); line-height: 1.4; flex-wrap: wrap; }
.trend { display: inline-flex; align-items: center; gap: 2px; font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 99px; background: var(--green-100); color: var(--green-600); }
.trend.down { background: var(--red-100); color: var(--red); }
.trend .icon { width: 11px; height: 11px; }
.spark { position: absolute; right: 12px; bottom: 13px; width: 68px; height: 24px; opacity: .42; z-index: 0; }

/* ---------- Chips / badges ---------- */
.chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 11px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 11px; font-weight: 500;
  color: var(--ink-2);
  white-space: nowrap;
  transition: all .16s;
}
.chip:hover { border-color: var(--line-strong); color: var(--ink); }
.chip.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip .count { font-size: 10px; opacity: .55; }
.chip.plain { background: transparent; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 9.5px; font-weight: 650;
  letter-spacing: 0.03em;
  background: var(--paper-deep);
  color: var(--ink-2);
  white-space: nowrap;
}
.badge .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.blue { background: var(--blue-100); color: var(--navy-600); }
.badge.green { background: var(--green-100); color: var(--green-600); }
.badge.orange { background: var(--orange-100); color: var(--orange-600); }
.badge.red { background: var(--red-100); color: var(--red); }
.badge.gold { background: var(--gold-100); color: #8a6a2e; }
.badge.navy { background: rgba(5, 48, 101, 0.08); color: var(--navy); }
.badge.outline { background: transparent; border: 1px solid var(--line); color: var(--ink-3); }

.status { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 500; white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ink-4); }
.status.ok::before { background: var(--green); box-shadow: 0 0 0 3px rgba(90, 169, 63, .12); }
.status.warn::before { background: var(--orange); box-shadow: 0 0 0 3px rgba(239, 138, 29, .12); }
.status.danger::before { background: var(--red); box-shadow: 0 0 0 3px rgba(190, 68, 60, .1); }
.status.info::before { background: var(--blue); box-shadow: 0 0 0 3px rgba(15, 92, 173, .1); }
.status.muted::before { background: var(--ink-4); }

/* ---------- Avatars ---------- */
.avatar {
  width: 36px; height: 36px; flex: none;
  display: inline-grid; place-items: center;
  border-radius: 50%;
  background: var(--blue-100);
  color: var(--navy);
  font-size: 11px; font-weight: 650;
  letter-spacing: 0.02em;
  border: 2px solid var(--surface);
}
.avatar.sm { width: 28px; height: 28px; font-size: 9px; }
.avatar.lg { width: 52px; height: 52px; font-size: 15px; }
.avatar.xl { width: 68px; height: 68px; font-size: 20px; border-width: 3px; }
.avatar.green { background: var(--green-100); color: var(--green-600); }
.avatar.orange { background: var(--orange-100); color: var(--orange-600); }
.avatar.gray { background: var(--paper-deep); color: var(--ink-2); }
.avatar.navy { background: var(--navy); color: #fff; border-color: rgba(255,255,255,.2); }
.avatar-group { display: flex; align-items: center; }
.avatar-group .avatar + .avatar { margin-left: -8px; }
.avatar-group .avatar { border-color: var(--surface); }

/* ---------- Tables ---------- */
.table-wrap { width: 100%; overflow-x: auto; }
table.data { font-size: 12px; }
table.data th {
  padding: 9px 10px;
  text-align: left;
  font-size: 9px; font-weight: 650;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-3);
  background: var(--surface-warm);
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}
table.data th:first-child { padding-left: 16px; }
table.data th:last-child { padding-right: 16px; }
table.data td { padding: 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.data td:first-child { padding-left: 16px; }
table.data td:last-child { padding-right: 16px; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background .14s; }
table.data tbody tr:hover { background: #faf8f3; }
table.data tbody tr.clickable { cursor: pointer; }
td .cell-title { font-weight: 550; color: var(--ink); }
td .cell-sub { font-size: 10.5px; color: var(--ink-3); margin-top: 1px; }
.cell-flex { display: flex; align-items: center; gap: 9px; min-width: 0; }
.cell-flex .meta { min-width: 0; }
.cell-flex .meta strong { display: block; font-size: 12.5px; font-weight: 550; line-height: 1.3; }
.cell-flex .meta span { display: block; font-size: 10.5px; color: var(--ink-3); }
.money { font-variant-numeric: tabular-nums; font-weight: 550; white-space: nowrap; }
.money.neg { color: var(--red); }
.money.pos { color: var(--green-600); }
.case-code { font-family: var(--sans); font-size: 10.5px; font-weight: 600; letter-spacing: .02em; color: var(--navy-600); background: var(--blue-050); padding: 3px 7px; border-radius: 5px; white-space: nowrap; }

.toolbar { display: flex; align-items: center; gap: 10px; padding: 13px 20px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.search-inline {
  display: flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface-warm);
  min-width: 210px;
  color: var(--ink-3);
}
.search-inline:focus-within { border-color: #b9c6d4; background: #fff; box-shadow: 0 0 0 3px rgba(15, 92, 173, .07); }
.search-inline input { border: 0; outline: 0; background: none; width: 100%; font-size: 11.5px; }
.search-inline .icon { width: 14px; height: 14px; }
.toolbar-sep { width: 1px; height: 22px; background: var(--line); margin: 0 2px; }
.toolbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.view-toggle { display: inline-flex; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-warm); }
.view-toggle button { width: 28px; height: 26px; display: grid; place-items: center; border-radius: 6px; color: var(--ink-3); }
.view-toggle button.active { background: #fff; color: var(--navy); box-shadow: var(--shadow-xs); }
.view-toggle .icon { width: 14px; height: 14px; }

.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 20px; border-top: 1px solid var(--line-soft); font-size: 11px; color: var(--ink-3); flex-wrap: wrap; }
.pager { display: flex; align-items: center; gap: 3px; }
.pager button { min-width: 28px; height: 28px; padding: 0 7px; border-radius: 6px; font-size: 11px; color: var(--ink-2); }
.pager button:hover { background: var(--paper); }
.pager button.active { background: var(--navy); color: #fff; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field { margin-top: 14px; }
.field label, .label { font-size: 10.5px; font-weight: 600; letter-spacing: .03em; color: var(--ink-2); }
.field .hint { font-size: 10px; color: var(--ink-3); }
.input, .select, .textarea {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-size: 12.5px;
  color: var(--ink);
  transition: border-color .18s, box-shadow .18s;
}
.input::placeholder, .textarea::placeholder { color: var(--ink-4); }
.input:focus, .select:focus, .textarea:focus { outline: 0; border-color: #a9bdd1; box-shadow: 0 0 0 3px rgba(15, 92, 173, .08); }
.textarea { height: auto; min-height: 92px; padding: 10px 12px; resize: vertical; line-height: 1.55; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2378838e' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 32px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row .field + .field { margin-top: 0; }
.input-group { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding-left: 11px; color: var(--ink-3); }
.input-group:focus-within { border-color: #a9bdd1; box-shadow: 0 0 0 3px rgba(15, 92, 173, .08); }
.input-group .icon { width: 15px; height: 15px; }
.input-group input { border: 0; outline: 0; background: none; height: 38px; padding: 0 10px; width: 100%; font-size: 12.5px; }
.searchable { position: relative; }

.switch { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 34px; height: 20px; border-radius: 99px; background: #d7d1c5; transition: background .2s; position: relative; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.16); transition: transform .2s; }
.switch input:checked + .track { background: var(--green); }
.switch input:checked + .track::after { transform: translateX(14px); }
.switch input:focus-visible + .track { outline: 2px solid var(--blue); outline-offset: 2px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.switch-row:last-child { border-bottom: 0; }
.switch-row .meta strong { display: block; font-size: 12px; font-weight: 550; }
.switch-row .meta span { display: block; font-size: 10.5px; color: var(--ink-3); margin-top: 1px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; align-items: center; gap: 24px; border-bottom: 1px solid var(--line); padding: 0 20px; overflow-x: auto; }
.tab {
  position: relative;
  padding: 13px 0 12px;
  font-size: 11.5px; font-weight: 550;
  color: var(--ink-3);
  white-space: nowrap;
  transition: color .16s;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--navy); }
.tab.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px 2px 0 0; background: var(--navy); }
.tab .count { margin-left: 4px; font-size: 9px; padding: 1px 5px; border-radius: 99px; background: var(--paper-deep); color: var(--ink-3); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeUp .28s ease both; }

.segmented { display: inline-flex; padding: 3px; border-radius: 9px; background: var(--paper); border: 1px solid var(--line); gap: 2px; }
.segmented button { height: 30px; padding: 0 12px; border-radius: 6px; font-size: 11px; font-weight: 550; color: var(--ink-3); white-space: nowrap; }
.segmented button.active { background: var(--surface); color: var(--navy); box-shadow: var(--shadow-xs); }

@keyframes fadeUp { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* ---------- Alert bar ---------- */
.alert-bar {
  display: flex; align-items: center; gap: 13px;
  padding: 12px 16px;
  border: 1px solid rgba(239, 138, 29, 0.28);
  border-radius: 12px;
  background: linear-gradient(100deg, #fdf3e5, #fefaf4 65%);
  margin-bottom: 20px;
  font-size: 12px;
}
.alert-bar .alert-icon { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 50%; background: rgba(239, 138, 29, .15); color: var(--orange-600); }
.alert-bar .alert-icon .icon { width: 15px; height: 15px; }
.alert-bar strong { font-weight: 600; color: #7a4a0c; }
.alert-bar span { color: #8a6a45; }
.alert-bar .link-arrow { margin-left: auto; color: #9a5c0c; white-space: nowrap; }

/* ---------- Dashboard specifics ---------- */
.greeting { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 22px; }
.greeting-date { display: flex; align-items: center; gap: 7px; font-size: 10.5px; font-weight: 550; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 9px; }
.greeting-date .icon { width: 13px; height: 13px; color: var(--orange); }

.deadline-list { display: flex; flex-direction: column; }
.deadline {
  display: flex; align-items: center; gap: 13px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line-soft);
  transition: background .15s;
  cursor: pointer;
}
.deadline:last-child { border-bottom: 0; }
.deadline:hover { background: var(--surface-warm); }
.date-block {
  width: 42px; height: 46px; flex: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 9px;
  background: var(--paper);
  border: 1px solid var(--line);
  line-height: 1;
}
.date-block .d { font-family: var(--serif); font-size: 18px; font-weight: 500; color: var(--navy); }
.date-block .m { margin-top: 2px; font-size: 8px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.date-block.urgent { background: var(--orange-100); border-color: rgba(239, 138, 29, .3); }
.date-block.urgent .d, .date-block.urgent .m { color: var(--orange-600); }
.deadline-main { min-width: 0; flex: 1; }
.deadline-main strong { display: block; font-size: 12.5px; font-weight: 550; line-height: 1.35; }
.deadline-main span { display: block; margin-top: 2px; font-size: 10.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deadline-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.deadline-side .time { font-size: 10px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.urgency { font-size: 8.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-4); }
.urgency.hot { color: var(--red); }

.chart-bars { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding: 6px 4px 0; position: relative; }
.chart-bars::before {
  content: ""; position: absolute; inset: 6px 0 22px;
  background: repeating-linear-gradient(to top, transparent 0, transparent 31px, var(--line-soft) 31px, var(--line-soft) 32px);
  background-position: bottom;
}
.bar-col { position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar-pair { display: flex; align-items: flex-end; gap: 3px; width: 100%; height: 100%; justify-content: center; }
.bar { width: 9px; border-radius: 3px 3px 0 0; background: var(--navy); min-height: 4px; opacity: .9; }
.bar.soft { background: #c8d8e8; }
.bar-label { font-size: 9px; color: var(--ink-3); font-weight: 500; letter-spacing: .03em; }
.legend { display: flex; align-items: center; gap: 14px; font-size: 9.5px; color: var(--ink-3); }
.legend span { display: flex; align-items: center; gap: 5px; }
.legend i { width: 7px; height: 7px; border-radius: 2px; background: var(--navy); }
.legend i.soft { background: #c8d8e8; }
.legend i.orange { background: var(--orange); }
.legend i.green { background: var(--green); }
.legend i.red { background: var(--red); }

.donut-wrap { display: flex; align-items: center; gap: 22px; }
.donut { position: relative; width: 132px; height: 132px; flex: none; }
.donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.donut-center strong { font-family: var(--serif); font-size: 21px; font-weight: 500; line-height: 1; color: var(--navy-950); }
.donut-center span { font-size: 8.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); margin-top: 3px; }
.donut-legend { display: flex; flex-direction: column; gap: 9px; font-size: 10.5px; width: 100%; }
.donut-legend .dl { display: flex; align-items: center; gap: 7px; }
.donut-legend .dl i { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.donut-legend .dl span { color: var(--ink-3); }
.donut-legend .dl strong { margin-left: auto; font-weight: 600; font-size: 10.5px; color: var(--ink); font-variant-numeric: tabular-nums; }

.activity { padding: 4px 20px 16px; }
.activity-item { position: relative; display: flex; gap: 11px; padding: 10px 0; }
.activity-item::before { content: ""; position: absolute; left: 13px; top: 38px; bottom: -8px; width: 1px; background: var(--line-soft); }
.activity-item:last-child::before { display: none; }
.activity-dot { width: 27px; height: 27px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--blue-050); color: var(--navy-600); border: 1px solid var(--line-soft); z-index: 1; }
.activity-dot .icon { width: 12px; height: 12px; }
.activity-dot.green { background: var(--green-100); color: var(--green-600); }
.activity-dot.orange { background: var(--orange-100); color: var(--orange-600); }
.activity-body { min-width: 0; }
.activity-body p { font-size: 11.5px; line-height: 1.45; color: var(--ink-2); }
.activity-body p strong { font-weight: 600; color: var(--ink); }
.activity-body time { display: block; margin-top: 2px; font-size: 9.5px; color: var(--ink-4); }

.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 20px 20px; }
.quick-action {
  display: flex; flex-direction: column; align-items: flex-start; gap: 7px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-warm);
  transition: border-color .18s, background .18s, transform .18s;
}
.quick-action:hover { border-color: var(--line-strong); background: #fff; transform: translateY(-1px); }
.quick-action .qi { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 7px; background: var(--blue-100); color: var(--navy); }
.quick-action .qi.orange { background: var(--orange-100); color: var(--orange-600); }
.quick-action .qi.green { background: var(--green-100); color: var(--green-600); }
.quick-action .qi .icon { width: 14px; height: 14px; }
.quick-action strong { font-size: 10.5px; font-weight: 550; color: var(--ink); }

.aging-row { margin-bottom: 14px; }
.aging-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 5px; font-size: 10.5px; color: var(--ink-2); }
.aging-top strong { font-size: 10.5px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.aging-track { height: 7px; border-radius: 99px; background: var(--paper); overflow: hidden; }
.aging-fill { display: block; height: 100%; border-radius: inherit; }

/* ---------- Clientes ---------- */
.client-drawer-head { padding: 26px 26px 20px; background: linear-gradient(135deg, #062b52, #041f3a); color: #fff; position: relative; overflow: hidden; }
.client-drawer-head::after { content: ""; position: absolute; right: -40px; top: -50px; width: 200px; height: 200px; border-radius: 50%; border: 1px solid rgba(255,255,255,.12); box-shadow: 0 0 0 32px rgba(255,255,255,.03), 0 0 0 64px rgba(255,255,255,.02); }
.client-drawer-head .avatar { border-color: rgba(255,255,255,.25); background: rgba(255,255,255,.12); color: #fff; }
.client-drawer-head h2 { font-family: var(--serif); font-size: 21px; font-weight: 500; margin-top: 12px; position: relative; z-index: 1; }
.client-drawer-head p { font-size: 11px; color: rgba(255,255,255,.55); margin-top: 3px; position: relative; z-index: 1; }
.client-drawer-head .chips { margin-top: 11px; position: relative; z-index: 1; }
.client-contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.client-contact { padding: 14px 20px; background: #fff; display: flex; gap: 9px; align-items: flex-start; }
.client-contact .icon { width: 14px; height: 14px; color: var(--ink-4); margin-top: 2px; }
.client-contact span { display: block; font-size: 8.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-4); }
.client-contact strong { display: block; font-size: 11px; font-weight: 550; margin-top: 1px; }

/* ---------- Expedientes ---------- */
.master-detail { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 18px; align-items: start; }
.case-panel { position: sticky; top: calc(var(--topbar-h) + 18px); max-height: calc(100vh - var(--topbar-h) - 40px); display: flex; flex-direction: column; }
.case-panel .toolbar { padding: 12px 14px; flex-wrap: nowrap; }
.case-panel .search-inline { min-width: 0; width: auto; flex: 1; }
.case-list { overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.case-item {
  text-align: left;
  display: block;
  width: 100%;
  padding: 12px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: background .15s, border-color .15s;
}
.case-item:hover { background: var(--surface-warm); }
.case-item.active { background: linear-gradient(100deg, var(--blue-050), #fff); border-color: #d6e3f0; box-shadow: var(--shadow-xs); }
.case-item-top { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; }
.case-item .code { font-size: 9px; font-weight: 700; letter-spacing: .05em; color: var(--navy-600); }
.case-item .chip-mini { margin-left: auto; font-size: 8.5px; font-weight: 650; padding: 2px 6px; border-radius: 99px; background: var(--paper-deep); color: var(--ink-2); }
.chip-mini.amp { background: var(--orange-100); color: var(--orange-600); }
.chip-mini.civ { background: var(--gold-100); color: #8a6a2e; }
.chip-mini.mer { background: var(--blue-100); color: var(--navy-600); }
.chip-mini.adm { background: var(--green-100); color: var(--green-600); }
.chip-mini.lab { background: #f0ecf8; color: #6c4f9c; }
.chip-mini.fam { background: #fbeef2; color: #a84968; }
.case-item strong { display: block; font-size: 11.5px; font-weight: 550; line-height: 1.35; color: var(--ink); }
.case-item .client { display: block; margin-top: 2px; font-size: 10px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.case-item-foot { display: flex; align-items: center; gap: 5px; margin-top: 7px; font-size: 9px; color: var(--ink-3); }
.case-item-foot .icon { width: 10px; height: 10px; }
.case-item-foot .warn { color: var(--red); font-weight: 600; }

.case-cover {
  position: relative;
  padding: 24px;
  border-radius: var(--r-lg);
  color: #fff;
  background:
    radial-gradient(480px 220px at 100% 0%, rgba(15, 92, 173, .55), transparent 70%),
    linear-gradient(135deg, #052d59, #041e38);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.08);
}
.case-cover::after {
  content: "§";
  position: absolute; right: 26px; top: -28px;
  font-family: var(--serif); font-size: 170px; line-height: 1;
  color: rgba(255, 255, 255, 0.045);
  pointer-events: none;
}
.case-cover-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; position: relative; z-index: 1; }
.case-cover .eyebrow { color: #ffb45f; }
.case-cover .eyebrow::before { background: #ffb45f; }
.case-cover h2 { font-family: var(--serif); font-size: clamp(21px, 2vw, 27px); font-weight: 500; line-height: 1.2; letter-spacing: -.01em; max-width: 560px; }
.case-cover .cover-meta { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 14px; position: relative; z-index: 1; }
.case-cover .cover-meta div { font-size: 10.5px; color: rgba(255,255,255,.5); }
.case-cover .cover-meta strong { display: block; margin-top: 2px; font-size: 11.5px; font-weight: 500; color: rgba(255,255,255,.92); }
.case-cover .chips { margin-top: 14px; position: relative; z-index: 1; }
.case-cover .chips .badge { background: rgba(255,255,255,.1); color: rgba(255,255,255,.85); }
.case-cover .chips .badge.orange { background: rgba(239,138,29,.22); color: #ffc27d; }
.case-cover .chips .badge.green { background: rgba(90,169,63,.2); color: #b9e3a6; }

.meta-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line-soft); border: 1px solid var(--line-soft); border-radius: 12px; overflow: hidden; }
.meta-item { background: var(--surface); padding: 13px 15px; }
.meta-item span { display: block; font-size: 8.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-4); }
.meta-item strong { display: block; margin-top: 3px; font-size: 11.5px; font-weight: 550; color: var(--ink); line-height: 1.35; }

.timeline { position: relative; padding: 4px 0; }
.timeline-item { position: relative; padding: 0 0 22px 30px; }
.timeline-item::before { content: ""; position: absolute; left: 7px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.timeline-item:last-child { padding-bottom: 2px; }
.timeline-item:last-child::before { display: none; }
.timeline-dot { position: absolute; left: 0; top: 4px; width: 15px; height: 15px; border-radius: 50%; background: #fff; border: 1px solid var(--line-strong); display: grid; place-items: center; }
.timeline-dot::after { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--ink-4); }
.timeline-item.done .timeline-dot { background: var(--green); border-color: var(--green); }
.timeline-item.done .timeline-dot::after { background: #fff; }
.timeline-item.current .timeline-dot { border-color: var(--orange); background: var(--orange-100); }
.timeline-item.current .timeline-dot::after { background: var(--orange); }
.timeline-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.timeline-head strong { font-size: 12px; font-weight: 600; }
.timeline-head time { font-size: 9.5px; color: var(--ink-3); }
.timeline-body { margin-top: 4px; font-size: 11.5px; color: var(--ink-2); line-height: 1.55; }
.timeline-tags { display: flex; gap: 6px; margin-top: 6px; }
.timeline-tags .badge { font-size: 8.5px; }

.doc-item { display: flex; align-items: center; gap: 11px; padding: 11px 20px; border-bottom: 1px solid var(--line-soft); transition: background .15s; }
.doc-item:last-child { border-bottom: 0; }
.doc-item:hover { background: var(--surface-warm); }
.doc-icon { width: 32px; height: 36px; flex: none; border-radius: 5px; display: grid; place-items: center; background: var(--blue-050); color: var(--navy-600); border: 1px solid #dbe7f3; }
.doc-icon .icon { width: 15px; height: 15px; }
.doc-icon.pdf { background: #fdf0ee; color: #b6453a; border-color: #f2d9d4; }
.doc-item .meta { min-width: 0; flex: 1; }
.doc-item .meta strong { display: block; font-size: 11.5px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-item .meta span { display: block; font-size: 9.5px; color: var(--ink-3); margin-top: 1px; }
.doc-item .doc-actions { display: flex; gap: 2px; opacity: 0; transition: opacity .15s; }
.doc-item:hover .doc-actions { opacity: 1; }
.doc-item .doc-actions .icon-btn { width: 28px; height: 28px; }
.doc-item .doc-actions .icon { width: 14px; height: 14px; }

/* ---------- Expediente: resumen ---------- */
.exp-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(250px, .85fr); gap: 22px; }
.process-list { display: flex; flex-direction: column; }
.process-item { position: relative; display: flex; gap: 12px; padding-bottom: 17px; }
.process-item:last-child { padding-bottom: 0; }
.process-item::before { content: ""; position: absolute; left: 11px; top: 24px; bottom: 0; width: 1px; background: var(--line); }
.process-item:last-child::before { display: none; }
.process-dot { width: 23px; height: 23px; flex: none; border-radius: 50%; border: 1px solid var(--line-strong); display: grid; place-items: center; font-size: 8.5px; font-weight: 650; background: #fff; color: var(--ink-3); z-index: 1; }
.process-dot .icon { width: 11px; height: 11px; }
.process-item.done .process-dot { background: var(--green); border-color: var(--green); color: #fff; }
.process-item.current .process-dot { background: var(--orange-100); border-color: var(--orange); color: var(--orange-600); box-shadow: 0 0 0 4px rgba(239, 138, 29, .09); }
.process-body { min-width: 0; padding-top: 2px; }
.process-body strong { display: block; font-size: 11.5px; font-weight: 550; }
.process-body .pdate { display: inline-flex; align-items: center; gap: 4px; margin-top: 1px; font-size: 9px; color: var(--ink-3); }
.process-body .pdate .icon { width: 9px; height: 9px; }
.process-body p { margin-top: 4px; font-size: 10.5px; color: var(--ink-2); line-height: 1.5; }
.process-item.current .process-body strong { color: var(--orange-600); }

.next-action { padding: 16px; border-radius: 13px; border: 1px solid rgba(239, 138, 29, .3); background: linear-gradient(140deg, #fdf3e4, #fffbf5 70%); }
.next-action .na-kicker { display: flex; align-items: center; gap: 5px; font-size: 8px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; color: var(--orange-600); }
.next-action .na-kicker .icon { width: 11px; height: 11px; }
.next-action h4 { margin-top: 7px; font-family: var(--serif); font-size: 16px; font-weight: 500; line-height: 1.3; color: #4a3113; }
.next-action .na-when { display: flex; align-items: center; gap: 9px; margin-top: 11px; padding-top: 10px; border-top: 1px solid rgba(239, 138, 29, .18); }
.next-action .na-when .date-block { background: #fff; border-color: rgba(239,138,29,.25); width: 38px; height: 40px; }
.next-action .na-when .meta strong { display: block; font-size: 10.5px; font-weight: 600; }
.next-action .na-when .meta span { display: block; font-size: 9px; color: #9a7a50; }
.next-action .na-actions { display: flex; gap: 6px; margin-top: 12px; }
.next-action .na-actions .btn { flex: 1; font-size: 10px; height: 31px; padding: 0 8px; }

.info-list { display: flex; flex-direction: column; }
.info-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: 10.5px; }
.info-row:last-child { border-bottom: 0; }
.info-row span { color: var(--ink-3); }
.info-row strong { text-align: right; font-weight: 550; color: var(--ink); }

.side-card { padding: 16px 18px; }
.side-card h4 { display: flex; align-items: center; gap: 6px; font-size: 9px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 10px; }
.side-card h4 .icon { width: 12px; height: 12px; color: var(--ink-4); }

.person-row { display: flex; align-items: center; gap: 9px; }
.person-row .meta { min-width: 0; }
.person-row .meta strong { display: block; font-size: 11px; font-weight: 550; }
.person-row .meta span { display: block; font-size: 9px; color: var(--ink-3); }

.notif-item { display: flex; gap: 11px; padding: 12px 20px; border-bottom: 1px solid var(--line-soft); }
.notif-item:last-child { border-bottom: 0; }
.notif-item .ni-icon { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--green-100); color: var(--green-600); }
.notif-item .ni-icon .icon { width: 14px; height: 14px; }
.notif-item .meta { min-width: 0; flex: 1; }
.notif-item .meta strong { display: block; font-size: 11px; font-weight: 550; }
.notif-item .meta p { margin-top: 2px; font-size: 10px; color: var(--ink-3); line-height: 1.45; }
.notif-item .meta time { display: block; margin-top: 3px; font-size: 9px; color: var(--ink-4); }

@media (max-width: 1200px) {
  .exp-grid { grid-template-columns: 1fr; }
}

.cal-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 20px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.cal-month { display: flex; align-items: center; gap: 10px; }
.cal-month h3 { font-family: var(--serif); font-size: 19px; font-weight: 500; color: var(--navy-950); text-transform: capitalize; }
.cal-nav { display: flex; gap: 2px; }
.cal-nav .icon-btn { width: 28px; height: 28px; border: 1px solid var(--line); background: #fff; border-radius: 7px; }
.cal-nav .icon-btn .icon { width: 14px; height: 14px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-dow { padding: 9px 6px; text-align: center; font-size: 8.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-4); border-bottom: 1px solid var(--line-soft); }
.cal-day { min-height: 104px; padding: 6px; border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); position: relative; transition: background .14s; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day:hover { background: #fbf9f5; }
.cal-day.out { background: #fbfaf7; }
.cal-day.out .cal-num { color: var(--ink-4); opacity: .6; }
.cal-day.today { background: #fdf7ee; }
.cal-day.today .cal-num { background: var(--navy); color: #fff; }
.cal-day.weekend { background: #faf8f3; }
.cal-num { width: 23px; height: 23px; display: grid; place-items: center; border-radius: 50%; font-size: 10.5px; font-weight: 550; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.cal-events { display: flex; flex-direction: column; gap: 2px; margin-top: 3px; }
.cal-event {
  display: flex; align-items: center; gap: 4px;
  width: 100%; padding: 2px 4px;
  border-radius: 4px;
  font-size: 8.5px; font-weight: 550;
  text-align: left;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: var(--blue-100); color: var(--navy-600);
}
.cal-event::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: currentColor; flex: none; }
.cal-event.orange { background: var(--orange-100); color: var(--orange-600); }
.cal-event.green { background: var(--green-100); color: var(--green-600); }
.cal-event.red { background: var(--red-100); color: var(--red); }
.cal-event.navy { background: rgba(5,48,101,.09); color: var(--navy); }
.cal-event.more { background: transparent; color: var(--ink-3); font-weight: 500; }
.cal-event.more::before { display: none; }
.cal-event:hover { filter: brightness(.96); }

.agenda-item { display: flex; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.agenda-item:last-child { border-bottom: 0; }
.agenda-time { width: 42px; flex: none; font-size: 9.5px; font-weight: 600; color: var(--ink-3); padding-top: 2px; font-variant-numeric: tabular-nums; }
.agenda-bar { width: 3px; border-radius: 3px; background: var(--blue); flex: none; }
.agenda-bar.orange { background: var(--orange); }
.agenda-bar.green { background: var(--green); }
.agenda-bar.red { background: var(--red); }
.agenda-body { min-width: 0; }
.agenda-body strong { display: block; font-size: 11.5px; font-weight: 550; line-height: 1.35; }
.agenda-body > span { display: block; margin-top: 2px; font-size: 10px; color: var(--ink-3); }
.agenda-body .badge { display: inline-flex; margin-top: 5px; }

/* ---------- WhatsApp ---------- */
.wa-phone {
  width: 300px; margin: 0 auto;
  border-radius: 38px;
  background: #0e1a25;
  padding: 9px;
  box-shadow: 0 26px 60px rgba(3, 23, 43, .26), inset 0 0 0 1px rgba(255,255,255,.12);
  position: relative;
}
.wa-screen { border-radius: 30px; overflow: hidden; background: #ece5dd; position: relative; }
.wa-notch { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); width: 92px; height: 20px; background: #0e1a25; border-radius: 99px; z-index: 3; }
.wa-status { display: flex; justify-content: space-between; align-items: center; padding: 9px 18px 4px; font-size: 8.5px; color: #fff; background: #075e54; font-weight: 600; }
.wa-head { display: flex; align-items: center; gap: 9px; padding: 10px 12px 11px; background: #075e54; color: #fff; }
.wa-head .avatar { width: 31px; height: 31px; font-size: 9px; background: rgba(255,255,255,.2); color: #fff; border: 0; }
.wa-head strong { display: block; font-size: 11px; font-weight: 600; }
.wa-head span { display: block; font-size: 8px; color: rgba(255,255,255,.65); }
.wa-head .icon { margin-left: auto; width: 14px; height: 14px; color: rgba(255,255,255,.65); }
.wa-body { padding: 14px 10px 18px; min-height: 400px; background-color: #e9e3d9; background-image: radial-gradient(rgba(5,48,101,.035) 1px, transparent 1px); background-size: 14px 14px; display: flex; flex-direction: column; gap: 8px; }
.wa-day { align-self: center; padding: 3px 9px; border-radius: 5px; background: rgba(255,255,255,.65); font-size: 8px; color: #6b6b6b; box-shadow: 0 1px 1px rgba(0,0,0,.06); }
.wa-bubble { max-width: 86%; padding: 7px 8px 16px; border-radius: 8px; font-size: 10.5px; line-height: 1.45; color: #1f2c34; position: relative; box-shadow: 0 1px 1px rgba(0,0,0,.08); }
.wa-bubble.in { align-self: flex-start; background: #fff; border-top-left-radius: 2px; }
.wa-bubble.out { align-self: flex-end; background: #d9fdd3; border-top-right-radius: 2px; }
.wa-bubble strong { font-weight: 600; }
.wa-bubble .wa-time { position: absolute; right: 7px; bottom: 4px; font-size: 7px; color: rgba(0,0,0,.42); display: flex; align-items: center; gap: 2px; }
.wa-bubble .wa-time .icon { width: 8px; height: 8px; color: #34a3d8; }
.wa-bubble .wa-doc { display: flex; align-items: center; gap: 7px; padding: 6px; border-radius: 5px; background: rgba(0,0,0,.045); margin-bottom: 5px; }
.wa-bubble .wa-doc .icon { width: 16px; height: 16px; color: #b6453a; }
.wa-bubble .wa-doc span { font-size: 8.5px; font-weight: 600; }
.wa-input { display: flex; align-items: center; gap: 7px; padding: 7px 9px 11px; background: #e9e3d9; }
.wa-input .fake { flex: 1; height: 27px; border-radius: 99px; background: #fff; font-size: 8.5px; color: #9aa0a6; display: flex; align-items: center; padding: 0 10px; }
.wa-input .send { width: 27px; height: 27px; border-radius: 50%; background: #075e54; color: #fff; display: grid; place-items: center; }
.wa-input .send .icon { width: 12px; height: 12px; }

.template-card { padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); transition: border-color .18s, box-shadow .18s; }
.template-card:hover { border-color: #cfdae6; box-shadow: var(--shadow-sm); }
.template-card .tc-head { display: flex; align-items: center; gap: 8px; }
.template-card .tc-head .badge { margin-left: auto; }
.template-card strong { display: block; margin-top: 9px; font-size: 12px; font-weight: 600; }
.template-card p { margin-top: 4px; font-size: 10.5px; color: var(--ink-3); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.template-card .tc-foot { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-soft); font-size: 9px; color: var(--ink-4); }
.template-card .tc-foot span { display: flex; align-items: center; gap: 4px; }
.template-card .tc-foot .icon { width: 11px; height: 11px; }
.template-card .tc-foot .link-arrow { margin-left: auto; font-size: 9.5px; }
.template-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 1180px) { .template-grid { grid-template-columns: 1fr; } }

.wa-stat { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.wa-stat:last-child { border-bottom: 0; }
.wa-stat-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--green-100); color: var(--green-600); flex: none; }
.wa-stat-icon .icon { width: 16px; height: 16px; }
.wa-stat .meta { flex: 1; }
.wa-stat .meta strong { display: block; font-size: 11px; font-weight: 550; }
.wa-stat .meta span { display: block; font-size: 9.5px; color: var(--ink-3); }
.wa-stat .val { font-family: var(--serif); font-size: 18px; font-weight: 500; color: var(--navy-950); }

/* ---------- Redactor IA ---------- */
.ai-layout { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 18px; align-items: start; }
.ai-config { position: sticky; top: calc(var(--topbar-h) + 18px); }
.ai-paper-wrap { background: var(--paper-deep); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; }
.doc-paper {
  width: 100%; max-width: 780px; margin: 0 auto;
  background: #fffefb;
  border: 1px solid #e6e0d4;
  box-shadow: 0 18px 50px rgba(4, 32, 60, .12), 0 2px 6px rgba(4, 32, 60, .04);
  padding: 46px clamp(28px, 6vw, 64px) 56px;
  font-family: var(--doc);
  font-size: 13.5px;
  line-height: 1.85;
  color: #26313a;
  min-height: 700px;
  position: relative;
}
.doc-paper::before { content: ""; position: absolute; left: 0; top: 0; width: 100%; height: 3px; background: linear-gradient(90deg, var(--orange) 0 35%, var(--green) 35% 55%, var(--navy) 55% 100%); opacity: .8; }
.doc-letterhead { display: flex; align-items: center; gap: 11px; padding-bottom: 12px; border-bottom: 1px solid #dcd5c7; margin-bottom: 20px; }
.doc-letterhead img { width: 34px; height: 34px; object-fit: contain; }
.doc-letterhead .lh-text strong { display: block; font-family: var(--serif); font-size: 14px; font-weight: 600; letter-spacing: .02em; color: var(--navy); line-height: 1.1; }
.doc-letterhead .lh-text span { display: block; font-family: var(--sans); font-size: 6.5px; letter-spacing: .22em; text-transform: uppercase; color: #7d8894; margin-top: 2px; }
.doc-letterhead .lh-right { margin-left: auto; text-align: right; font-family: var(--sans); font-size: 7px; letter-spacing: .1em; text-transform: uppercase; color: #8c96a1; line-height: 1.5; }
.doc-title { margin: 26px 0 6px; text-align: center; font-family: var(--sans); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--navy); }
.doc-subtitle { text-align: center; font-size: 11.5px; color: #5a6670; margin-bottom: 24px; }
.doc-paper p { margin: 0 0 12px; text-align: justify; }
.doc-paper p.indent { text-indent: 2em; }
.doc-paper .doc-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 24px; font-family: var(--sans); font-size: 9.5px; color: #5a6670; margin: 0 0 22px; padding: 12px 14px; background: #faf8f2; border: 1px solid #ece7dc; }
.doc-paper .doc-meta span strong { color: #26313a; font-weight: 600; }
.doc-paper .doc-heading { margin: 20px 0 7px; font-family: var(--sans); font-size: 9.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--navy); }
.doc-paper .doc-highlight { background: #fdf4e7; box-shadow: 0 0 0 2px #fdf4e7; }
.doc-paper .doc-sign { margin-top: 44px; text-align: center; }
.doc-paper .doc-sign .line { width: 220px; height: 1px; background: #b9b3a7; margin: 0 auto 7px; }
.doc-paper .doc-sign strong { display: block; font-family: var(--sans); font-size: 9.5px; font-weight: 700; letter-spacing: .06em; }
.doc-paper .doc-sign span { display: block; font-family: var(--sans); font-size: 8.5px; color: #7d8894; }
.doc-stamp { position: absolute; right: 42px; bottom: 72px; width: 94px; height: 94px; border: 2px solid rgba(15, 92, 173, .18); border-radius: 50%; display: grid; place-items: center; transform: rotate(-12deg); color: rgba(15, 92, 173, .28); font-family: var(--sans); font-size: 7px; font-weight: 700; letter-spacing: .14em; text-align: center; line-height: 1.6; text-transform: uppercase; }
.doc-actions-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 780px; margin: 14px auto 0; flex-wrap: wrap; }
.doc-actions-bar .left, .doc-actions-bar .right { display: flex; align-items: center; gap: 8px; }
.ai-status { display: flex; align-items: center; gap: 7px; font-size: 10.5px; color: var(--ink-3); }
.ai-status .pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(90,169,63,.14); }
.ai-generating { display: none; padding: 18px 20px; border-top: 1px solid var(--line-soft); background: var(--blue-050); }
.ai-generating.show { display: block; }
.ai-progress { height: 4px; border-radius: 99px; background: #dce8f3; overflow: hidden; }
.ai-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--blue), var(--green)); border-radius: inherit; transition: width .4s ease; }
.ai-steps { display: flex; justify-content: space-between; margin-top: 6px; font-size: 9px; color: var(--ink-3); }
.context-item { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.context-item:last-child { border-bottom: 0; }
.context-item .icon { width: 13px; height: 13px; color: var(--ink-4); }
.context-item span { font-size: 10.5px; color: var(--ink-2); }
.context-item .badge { margin-left: auto; font-size: 8px; }
.ai-suggestion { display: flex; gap: 8px; padding: 9px; border-radius: 8px; background: var(--surface-warm); border: 1px dashed var(--line-strong); font-size: 10px; color: var(--ink-3); line-height: 1.45; }
.ai-suggestion .icon { width: 13px; height: 13px; color: var(--orange); flex: none; margin-top: 1px; }
.ai-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 780px; margin: 0 auto 12px; flex-wrap: wrap; }
.ai-toolbar .row { gap: 6px; }
.ai-doc-meta { display: flex; align-items: center; gap: 8px; font-size: 10px; color: var(--ink-3); }
.ai-doc-meta .pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(90,169,63,.14); }
.source-item { display: flex; align-items: flex-start; gap: 8px; padding: 7px 0; font-size: 10.5px; color: var(--ink-2); border-bottom: 1px solid var(--line-soft); }
.source-item:last-child { border-bottom: 0; }
.source-item input { margin-top: 2px; accent-color: var(--navy); flex: none; }
.source-item .meta { min-width: 0; }
.source-item .meta strong { display: block; font-size: 10.5px; font-weight: 550; }
.source-item .meta span { display: block; font-size: 9px; color: var(--ink-4); }
.source-item .badge { margin-left: auto; font-size: 8px; padding: 2px 6px; }
.generated-flash { animation: generatedFlash 1.2s ease; }
@keyframes generatedFlash { 0% { box-shadow: 0 18px 50px rgba(4,32,60,.12), 0 0 0 0 rgba(90,169,63,.4); } 40% { box-shadow: 0 18px 50px rgba(4,32,60,.12), 0 0 0 6px rgba(90,169,63,.16); } 100% { box-shadow: 0 18px 50px rgba(4,32,60,.12), 0 2px 6px rgba(4,32,60,.04); } }

/* ---------- Drawer / modal ---------- */
.scrim { position: fixed; inset: 0; background: rgba(3, 23, 43, .46); backdrop-filter: blur(3px); z-index: 90; opacity: 0; visibility: hidden; transition: opacity .22s, visibility .22s; }
.scrim.open { opacity: 1; visibility: visible; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(470px, 94vw);
  background: var(--surface); z-index: 100;
  transform: translateX(102%);
  transition: transform .3s cubic-bezier(.22,.7,.3,1);
  display: flex; flex-direction: column;
  box-shadow: -20px 0 60px rgba(3, 23, 43, .18);
}
.drawer.open { transform: none; }
.drawer-body { overflow-y: auto; flex: 1; }
.drawer-close { position: absolute; right: 14px; top: 14px; z-index: 2; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.14); color: #fff; }
.drawer-close .icon { width: 15px; height: 15px; }

.modal { position: fixed; inset: 0; z-index: 110; display: grid; place-items: center; padding: 22px; opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s; }
.modal-scrim { position: absolute; inset: 0; background: rgba(3, 23, 43, .5); backdrop-filter: blur(3px); }
.sidebar-cta-tag .icon { width: 10px; height: 10px; }
.modal.open { opacity: 1; visibility: visible; }
.modal-card {
  position: relative; width: min(560px, 100%);
  max-height: min(88vh, 860px); overflow-y: auto;
  background: var(--surface); border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  transform: translateY(12px) scale(.985);
  transition: transform .25s cubic-bezier(.22,.7,.3,1);
}
.modal.open .modal-card { transform: none; }
.modal-card.wide { width: min(760px, 100%); }
.modal-head { display: flex; align-items: flex-start; gap: 14px; padding: 22px 24px 16px; border-bottom: 1px solid var(--line-soft); }
.modal-head h2 { font-family: var(--serif); font-size: 21px; font-weight: 500; color: var(--navy-950); }
.modal-head p { margin-top: 3px; font-size: 11px; color: var(--ink-3); }
.modal-close { margin-left: auto; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; color: var(--ink-3); }
.modal-close:hover { background: var(--paper); color: var(--ink); }
.modal-body { padding: 20px 24px; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 15px 24px; border-top: 1px solid var(--line-soft); background: var(--surface-warm); border-radius: 0 0 var(--r-xl) var(--r-xl); }
.modal-icon { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 11px; background: var(--blue-100); color: var(--navy); }
.modal-icon.orange { background: var(--orange-100); color: var(--orange-600); }
.modal-icon.green { background: var(--green-100); color: var(--green-600); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 16px);
  z-index: 200;
  display: flex; align-items: center; gap: 9px;
  padding: 11px 16px;
  border-radius: 10px;
  background: var(--navy-950); color: #fff;
  font-size: 12px;
  box-shadow: 0 16px 40px rgba(3, 23, 43, .3);
  opacity: 0; visibility: hidden;
  transition: opacity .22s, transform .22s, visibility .22s;
  max-width: 90vw;
}
.toast.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.toast .icon { width: 15px; height: 15px; color: #8fd27a; flex: none; }

/* ---------- Misc ---------- */
.banner-navy {
  position: relative; overflow: hidden;
  padding: 20px 22px;
  border-radius: var(--r-lg);
  background: radial-gradient(400px 200px at 100% 0%, rgba(15,92,173,.6), transparent 70%), linear-gradient(135deg, #052d59, #041e38);
  color: #fff;
}
.banner-navy::after { content: ""; position: absolute; right: -40px; bottom: -60px; width: 190px; height: 190px; border-radius: 50%; border: 1px solid rgba(255,255,255,.12); box-shadow: 0 0 0 26px rgba(255,255,255,.035), 0 0 0 52px rgba(255,255,255,.02); }
.banner-navy h3 { font-family: var(--serif); font-size: 17px; font-weight: 500; }
.banner-navy p { margin-top: 4px; font-size: 11px; color: rgba(255,255,255,.6); line-height: 1.5; max-width: 300px; }
.banner-navy .btn { margin-top: 12px; }
.notice { display: flex; gap: 10px; padding: 11px 13px; border-radius: 9px; background: var(--blue-050); border: 1px solid #dbe7f3; font-size: 10.5px; color: var(--navy-600); line-height: 1.5; }
.notice .icon { width: 14px; height: 14px; flex: none; margin-top: 1px; }
.notice.warn { background: var(--orange-100); border-color: #f3dcbd; color: #86560f; }
.notice.warn .icon { color: var(--orange-600); }

.empty { padding: 38px 20px; text-align: center; color: var(--ink-3); }
.empty .icon { width: 30px; height: 30px; margin: 0 auto 10px; color: var(--ink-4); }
.empty strong { display: block; font-size: 12px; color: var(--ink); font-weight: 550; }
.empty span { display: block; font-size: 10.5px; margin-top: 3px; }

.stat-row { display: flex; gap: 24px; flex-wrap: wrap; }
.stat-mini strong { display: block; font-family: var(--serif); font-size: 20px; font-weight: 500; color: var(--navy-950); line-height: 1.2; }
.stat-mini span { display: block; font-size: 9px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); margin-top: 2px; }

.hr-label { display: flex; align-items: center; gap: 10px; font-size: 9px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin: 18px 0 10px; }
.hr-label::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.breadcrumb-tabs { display: flex; align-items: center; gap: 7px; font-size: 10px; color: var(--ink-3); margin-bottom: 10px; }
.breadcrumb-tabs a:hover { color: var(--navy); }

.avatar-label { display: flex; align-items: center; gap: 9px; }
.avatar-label strong { display: block; font-size: 11.5px; font-weight: 550; line-height: 1.25; }
.avatar-label span { display: block; font-size: 9.5px; color: var(--ink-3); }

.case-number { font-size: 10px; font-weight: 700; letter-spacing: .05em; color: var(--navy-600); }

/* ---------- Login ---------- */
.login-shell { min-height: 100vh; display: grid; grid-template-columns: 1.02fr .98fr; background: var(--paper); }
.login-brand {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 46px clamp(32px, 5vw, 72px);
  color: #fff;
  background:
    radial-gradient(700px 500px at 15% 0%, rgba(15, 92, 173, 0.6), transparent 65%),
    radial-gradient(500px 400px at 100% 100%, rgba(250, 144, 34, 0.15), transparent 70%),
    linear-gradient(150deg, #062c53 0%, #041f3a 58%, #03182c 100%);
}
.login-brand::before {
  content: ""; position: absolute; right: -180px; top: 50%; transform: translateY(-50%);
  width: 560px; height: 560px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 0 0 72px rgba(255,255,255,.025), 0 0 0 144px rgba(255,255,255,.018), 0 0 0 216px rgba(255,255,255,.012);
}
.login-brand::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .4;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='.07'/%3E%3C/svg%3E");
}
.login-brand > * { position: relative; z-index: 1; }
.login-logo { display: flex; align-items: center; gap: 13px; }
.login-logo .brand-mark { width: 56px; height: 56px; }
.login-logo strong { display: block; font-family: var(--serif); font-size: 23px; font-weight: 500; line-height: 1.1; }
.login-logo span { display: block; margin-top: 3px; font-size: 8.5px; letter-spacing: .2em; text-transform: uppercase; color: rgba(255,255,255,.45); }
.login-hero { margin: auto 0; padding: 48px 0 36px; max-width: 560px; }
.login-hero .eyebrow { color: #ffb45f; }
.login-hero .eyebrow::before { background: #ffb45f; }
.login-hero h1 { font-family: var(--serif); font-size: clamp(34px, 4.2vw, 52px); line-height: 1.08; font-weight: 400; letter-spacing: -.028em; }
.login-hero h1 em { font-style: italic; color: #ffbe70; }
.login-hero p { margin-top: 18px; max-width: 430px; font-size: 13px; line-height: 1.7; color: rgba(255,255,255,.55); }
.login-features { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 24px; margin-top: 38px; }
.login-feature { display: flex; gap: 10px; align-items: flex-start; }
.login-feature .fi { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 8px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.09); color: #ffbe70; }
.login-feature .fi .icon { width: 14px; height: 14px; }
.login-feature strong { display: block; font-size: 11px; font-weight: 550; color: rgba(255,255,255,.9); }
.login-feature span { display: block; font-size: 9.5px; color: rgba(255,255,255,.42); margin-top: 1px; line-height: 1.45; }
.login-foot { display: flex; align-items: center; justify-content: space-between; gap: 20px; font-size: 9.5px; color: rgba(255,255,255,.3); }
.login-foot .secure { display: flex; align-items: center; gap: 6px; }
.login-foot .secure .icon { width: 12px; height: 12px; }

.login-side { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 40px 32px; position: relative; }
.login-card { width: min(420px, 100%); }
.login-card .eyebrow { margin-bottom: 10px; }
.login-card h2 { font-family: var(--serif); font-size: 30px; font-weight: 500; letter-spacing: -.02em; color: var(--navy-950); }
.login-card > p { margin: 7px 0 22px; font-size: 12px; color: var(--ink-2); }
.login-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 3px; background: var(--paper-deep); border-radius: 9px; margin-bottom: 20px; }
.login-switch button { height: 34px; border-radius: 7px; font-size: 11px; font-weight: 550; color: var(--ink-3); transition: all .18s; }
.login-switch button.active { background: #fff; color: var(--navy); box-shadow: var(--shadow-sm); }
.login-form { background: transparent; }
.login-form .field + .field { margin-top: 13px; }
.login-form .field label { font-size: 10.5px; }
.login-form .input { height: 44px; background: #fff; }
.login-form .input-group { height: 44px; background: #fff; }
.login-form .input-group input { height: 42px; }
.pass-toggle { width: 38px; height: 42px; display: grid; place-items: center; color: var(--ink-4); }
.pass-toggle:hover { color: var(--ink-2); }
.login-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 0 18px; }
.check { display: flex; align-items: center; gap: 7px; font-size: 10.5px; color: var(--ink-2); cursor: pointer; }
.check input { width: 14px; height: 14px; accent-color: var(--navy); }
.login-row a { font-size: 10.5px; font-weight: 550; color: var(--navy); }
.login-form .btn-lg { height: 46px; font-size: 12.5px; }
.login-note { display: flex; align-items: flex-start; gap: 7px; margin-top: 16px; padding: 9px 11px; border-radius: 8px; background: #fbf7ee; border: 1px solid #eee5d4; font-size: 9.5px; color: #8a7754; line-height: 1.5; }
.login-note .icon { width: 12px; height: 12px; flex: none; margin-top: 1px; color: var(--orange); }
.login-demo { margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; font-size: 9.5px; color: var(--ink-3); }
.login-demo .avatars { display: flex; }
.login-demo .avatar { width: 25px; height: 25px; font-size: 8px; }
.login-demo .avatar + .avatar { margin-left: -7px; }
.login-demo strong { color: var(--ink-2); font-weight: 600; }

/* ---------- Responsive ---------- */
@media (max-width: 1380px) {
  .page { padding: 26px 26px 56px; }
  .topbar { padding: 0 26px; }
  .ai-layout { grid-template-columns: 310px minmax(0, 1fr); }
}
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main, .grid-main-wide { grid-template-columns: minmax(0, 1fr); }
  .master-detail { grid-template-columns: 290px minmax(0, 1fr); }
  .meta-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ai-layout { grid-template-columns: 300px minmax(0, 1fr); }
  .topbar-search { width: 240px; }
}
@media (max-width: 1024px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 280px;
    transform: translateX(-102%); transition: transform .3s cubic-bezier(.22,.7,.3,1);
    box-shadow: 20px 0 60px rgba(3,23,43,.2);
  }
  .sidebar.open { transform: none; }
  .sidebar-close { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 7px; background: rgba(255,255,255,.08); }
  .only-mobile { display: inline-grid; }
  .master-detail { grid-template-columns: 1fr; }
  .case-panel { position: static; max-height: none; }
  .case-list { max-height: 280px; }
  .ai-layout { grid-template-columns: 1fr; }
  .ai-config { position: static; }
  .sidebar-overlay { position: fixed; inset: 0; background: rgba(3,23,43,.45); backdrop-filter: blur(2px); z-index: 35; opacity: 0; visibility: hidden; transition: .22s; }
  .sidebar-overlay.open { opacity: 1; visibility: visible; }
}
@media (max-width: 860px) {
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .topbar-search { display: none; }
  .topbar { gap: 10px; padding: 0 18px; }
  .topbar-user-meta { display: none; }
  .topbar-user { padding-left: 10px; }
  .page { padding: 22px 18px 48px; }
  .page-head { align-items: flex-start; }
  .page-title { font-size: 27px; }
  .head-actions { width: 100%; }
  .head-actions .btn { flex: 1; }
  .card-head { padding: 16px 16px 12px; }
  .card-body { padding: 0 16px 16px; }
  .doc-paper { padding: 32px 22px 40px; }
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .login-side { min-height: 100vh; padding: 32px 22px; background: radial-gradient(500px 300px at 100% 0%, rgba(15,92,173,.08), transparent 70%), var(--paper); }
}
@media (max-width: 620px) {
  .grid-4 { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .deadline { padding: 11px 14px; gap: 10px; }
  .deadline-side { display: none; }
  .donut-wrap { flex-direction: column; align-items: flex-start; }
  .donut { align-self: center; }
  .client-contact-grid { grid-template-columns: 1fr; }
  .meta-grid { grid-template-columns: 1fr; }
  .cal-day { min-height: 76px; padding: 4px; }
  .cal-event { font-size: 7.5px; padding: 1px 3px; }
  .cal-event span { display: none; }
  .cal-event::before { display: none; }
  .toolbar { padding: 11px 14px; }
  .toolbar-right { margin-left: 0; width: 100%; }
  .stats-4 { grid-template-columns: 1fr 1fr; }
  .login-features { grid-template-columns: 1fr; }
  .doc-actions-bar { flex-direction: column; align-items: stretch; }
  .doc-actions-bar .left, .doc-actions-bar .right { flex-wrap: wrap; }
}

@media print {
  .sidebar, .topbar, .head-actions, .doc-actions-bar, .ai-config, .toast { display: none !important; }
  .app-shell { display: block; }
  .page { padding: 0; }
  .doc-paper-wrap { background: none; border: 0; padding: 0; }
  .doc-paper { box-shadow: none; border: 0; }
}
