:root {
  --navy-950: #081426;
  --navy-900: #0d1b30;
  --navy-850: #11233d;
  --navy-800: #162b49;
  --navy-700: #1d3a61;
  --gold: #c9a24a;
  --gold-strong: #b1852b;
  --gold-soft: #faf3df;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f8;
  --border: #e3e9f2;
  --border-strong: #cfd9e8;
  --text: #14213a;
  --text-soft: #33425c;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --green: #15803d;
  --green-soft: #dcfce7;
  --red: #b91c1c;
  --red-soft: #fee2e2;
  --amber: #b45309;
  --amber-soft: #fef3c7;
  --blue: #1d4ed8;
  --blue-soft: #dbeafe;
  --shadow-xs: 0 1px 2px rgba(15, 32, 56, .05);
  --shadow-sm: 0 2px 8px rgba(15, 32, 56, .06);
  --shadow: 0 10px 30px rgba(15, 32, 56, .09);
  --shadow-lg: 0 24px 60px rgba(8, 20, 38, .22);
  --radius-sm: 9px;
  --radius: 14px;
  --radius-lg: 20px;
  --sidebar-w: 272px;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-head: 'Manrope', var(--font-body);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5 { font-family: var(--font-head); margin: 0; letter-spacing: -.02em; color: var(--text); }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
img { max-width: 100%; }
::selection { background: var(--gold); color: var(--navy-950); }

.icon { width: 20px; height: 20px; flex-shrink: 0; }
.icon.chev { width: 16px; height: 16px; }

/* ---------- Layout ---------- */
.app-body { background: var(--bg); }
.app-shell { min-height: 100vh; }
.app-main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.page {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px 34px 64px;
  flex: 1;
}
.page-narrow { max-width: 1020px; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background:
    radial-gradient(circle at 15% 0%, rgba(201, 162, 74, .18), transparent 42%),
    radial-gradient(circle at 100% 100%, rgba(29, 58, 97, .55), transparent 55%),
    linear-gradient(180deg, var(--navy-900), var(--navy-950));
  color: #e8eef8;
  display: flex;
  flex-direction: column;
  padding: 22px 18px 18px;
  z-index: 60;
  border-right: 1px solid rgba(255, 255, 255, .05);
}
.sidebar-brand { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 2px 4px 22px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 46px; height: 46px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 13px;
  background: linear-gradient(145deg, #dcb96a, #b1852b);
  color: var(--navy-950);
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -.5px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 6px 16px rgba(0,0,0,.25);
}
.brand-mark span { font-size: 13px; margin-left: 1px; opacity: .8; }
.brand-mark-lg { width: 56px; height: 56px; border-radius: 16px; font-size: 23px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-family: var(--font-head); font-size: 16px; letter-spacing: .2px; }
.brand-text small { color: #93a4bc; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; margin-top: 3px; }
.sidebar-close { display: none; background: transparent; border: 0; color: #9fb0c8; padding: 6px; cursor: pointer; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 4px 0; }
.nav-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: #7488a5;
  margin: 20px 12px 8px;
  font-weight: 700;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px;
  border-radius: 10px;
  color: #c3d0e2;
  font-weight: 500;
  font-size: 13.5px;
  margin-bottom: 3px;
  position: relative;
  transition: background .16s, color .16s;
}
.nav-item .icon { color: #8ea3c0; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.is-active {
  background: linear-gradient(90deg, rgba(201,162,74,.2), rgba(201,162,74,.04));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(201,162,74,.22);
}
.nav-item.is-active::before {
  content: ""; position: absolute; left: -18px; top: 9px; bottom: 9px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--gold);
}
.nav-item.is-active .icon { color: var(--gold); }

.sidebar-foot { border-top: 1px solid rgba(255,255,255,.08); padding-top: 14px; }
.sidebar-help {
  display: flex; gap: 10px; align-items: center;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 11px; padding: 10px 11px; margin-bottom: 12px;
}
.sidebar-help-icon { width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; background: rgba(201,162,74,.14); color: var(--gold); }
.sidebar-help-icon .icon { width: 17px; height: 17px; }
.sidebar-help strong { display: block; font-size: 12px; }
.sidebar-help span { display: block; font-size: 10.5px; color: #8fa2bd; }
.sidebar-user { display: flex; align-items: center; gap: 10px; }
.sidebar-user-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sidebar-user-info strong { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-info span { font-size: 10.5px; color: #8fa2bd; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logout-form { display: flex; }
.icon-btn-dark { color: #9fb0c8; }
.icon-btn-dark:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-overlay { display: none; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  height: 78px;
  padding: 0 34px;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.menu-btn { display: none; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 9px; cursor: pointer; color: var(--text-soft); }
.topbar-title h1 { font-size: 19px; font-weight: 700; }
.topbar-title p { font-size: 11.5px; color: var(--muted); margin-top: 2px; text-transform: capitalize; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 12px;
  height: 40px;
  width: 300px;
  color: var(--muted-2);
  transition: border-color .16s, box-shadow .16s, width .2s;
}
.topbar-search:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,162,74,.16); background: #fff; }
.topbar-search .icon { width: 17px; height: 17px; }
.topbar-search input { border: 0; outline: 0; background: transparent; width: 100%; font-size: 13px; color: var(--text); }
.topbar-search input::placeholder { color: var(--muted-2); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  transition: background .16s, border-color .16s, color .16s;
  position: relative;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--border-strong); color: var(--text); }
.icon-btn .icon { width: 18px; height: 18px; }
.notif-dot {
  position: absolute; top: -5px; right: -5px;
  min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 9px; background: var(--red); color: #fff;
  font-size: 9.5px; font-weight: 700; display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff;
}
.user-chip {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 12px;
  padding: 5px 10px 5px 6px;
  cursor: pointer;
  list-style: none;
  transition: border-color .16s, background .16s;
}
.user-chip::-webkit-details-marker, .dropdown summary::-webkit-details-marker, details summary::-webkit-details-marker { display: none; }
.user-chip:hover { background: var(--surface-2); border-color: var(--border-strong); }
.user-chip-text { display: flex; flex-direction: column; line-height: 1.25; max-width: 150px; }
.user-chip-text strong { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip-text small { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .chev { color: var(--muted-2); margin-left: 2px; }

/* ---------- Avatars ---------- */
.avatar {
  width: 40px; height: 40px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, var(--navy-800), var(--navy-700));
  color: #fff; font-weight: 700; font-size: 13px; letter-spacing: .02em;
  flex-shrink: 0;
}
.avatar-sm { width: 34px; height: 34px; border-radius: 10px; font-size: 11.5px; }
.avatar-lg { width: 64px; height: 64px; border-radius: 18px; font-size: 20px; }

/* ---------- Dropdowns ---------- */
.dropdown { position: relative; }
.dropdown-panel {
  position: absolute; right: 0; top: calc(100% + 10px);
  width: 350px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 70;
  animation: drop .16s ease-out;
}
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.dropdown-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.dropdown-head strong { font-family: var(--font-head); font-size: 13.5px; }
.dropdown-empty { padding: 20px 16px; color: var(--muted); font-size: 12.5px; }
.dropdown-link {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 16px; font-size: 12.5px; font-weight: 500;
  color: var(--text-soft); border-top: 1px solid var(--border);
  background: none; border-left: 0; border-right: 0; border-bottom: 0; width: 100%; text-align: left; cursor: pointer;
}
.dropdown-link .icon { width: 16px; height: 16px; color: var(--muted); }
.dropdown-link:hover { background: var(--surface-2); color: var(--text); }
.dropdown-link.is-danger { color: var(--red); }
.dropdown-link.is-danger .icon { color: var(--red); }
.user-panel-head { display: flex; gap: 12px; align-items: center; padding: 16px; }
.user-panel-head div { display: flex; flex-direction: column; min-width: 0; }
.user-panel-head strong { font-size: 13px; }
.user-panel-head small { font-size: 11.5px; color: var(--muted); }
.alert-list { list-style: none; margin: 0; padding: 6px 0; max-height: 350px; overflow-y: auto; }
.alert-list a { display: flex; gap: 10px; padding: 10px 16px; }
.alert-list a:hover { background: var(--surface-2); }
.alert-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.alert-dot.is-danger { background: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }
.alert-dot.is-warning { background: var(--amber); box-shadow: 0 0 0 4px var(--amber-soft); }
.alert-info { display: flex; flex-direction: column; min-width: 0; }
.alert-info strong { font-size: 12.5px; }
.alert-info small { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.alert-info em { font-style: normal; font-size: 11px; color: var(--red); font-weight: 600; margin-top: 2px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .12s, background .16s, border-color .16s, box-shadow .16s, color .16s;
}
.btn .icon { width: 17px; height: 17px; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: none; }
.btn-primary { background: linear-gradient(180deg, var(--navy-800), var(--navy-900)); color: #fff; border-color: var(--navy-900); box-shadow: 0 6px 16px rgba(13,27,48,.16); }
.btn-primary:hover { background: var(--navy-700); }
.btn-gold { background: linear-gradient(180deg, #d8b35c, var(--gold-strong)); color: #231a06; border-color: #a97f26; box-shadow: 0 6px 16px rgba(177,133,43,.24); }
.btn-gold:hover { filter: brightness(1.04); }
.btn-ghost { background: var(--surface); border-color: var(--border-strong); color: var(--text-soft); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-success { background: linear-gradient(180deg, #1a9a4b, #14753a); color: #fff; border-color: #11632f; }
.btn-danger { background: #fff; border-color: #f0b4b4; color: var(--red); }
.btn-danger:hover { background: var(--red-soft); }
.btn-warning { background: #fff; border-color: #f2cf8a; color: var(--amber); }
.btn-warning:hover { background: var(--amber-soft); }
.btn-sm { padding: 7px 11px; font-size: 12px; border-radius: 8px; }
.btn-sm .icon { width: 15px; height: 15px; }
.btn-lg { padding: 13px 20px; font-size: 14px; border-radius: 11px; }
.btn-block { width: 100%; }
.link { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--navy-700); }
.link .icon { width: 15px; height: 15px; transition: transform .16s; }
.link:hover { color: var(--gold-strong); }
.link:hover .icon { transform: translateX(2px); }
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 12.5px; font-weight: 600; margin-bottom: 14px; }
.back-link:hover { color: var(--text); }
.back-link .icon { width: 15px; height: 15px; }

/* ---------- Page hero / headings ---------- */
.eyebrow { display: inline-block; font-size: 10.5px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--gold-strong); margin-bottom: 6px; }
.page-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.page-hero h2 { font-size: 29px; font-weight: 800; letter-spacing: -.03em; }
.page-hero p { color: var(--muted); font-size: 13.5px; margin-top: 7px; max-width: 680px; }
.page-hero.compact { margin-bottom: 20px; }
.page-hero.compact h2 { font-size: 25px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.page-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.page-topline .back-link { margin-bottom: 12px; }
.page-topline-actions { display: flex; gap: 8px; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  padding: 20px;
  margin-bottom: 22px;
}
.card:last-child { margin-bottom: 0; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.card-head h3 { font-size: 17px; font-weight: 700; }
.card-head .eyebrow { margin-bottom: 3px; }
.card-inline { padding: 18px 20px; }
.head-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.grid { display: grid; gap: 22px; margin-bottom: 22px; }
.grid > .card { margin-bottom: 0; }
.grid-2-1 { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-top { align-items: start; }
.stack { display: flex; flex-direction: column; gap: 22px; }
.stack > .card { margin-bottom: 0; }

/* ---------- Stats ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card {
  position: relative;
  display: flex; flex-direction: column; gap: 3px;
  padding: 16px 16px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
a.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.stat-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--blue); }
.stat-card::after { content: ""; position: absolute; right: -30px; top: -30px; width: 90px; height: 90px; border-radius: 50%; background: currentColor; opacity: .05; }
.stat-icon { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: 4px; background: var(--blue-soft); color: var(--blue); }
.stat-icon .icon { width: 18px; height: 18px; }
.stat-value { font-family: var(--font-head); font-size: 29px; font-weight: 800; line-height: 1.1; letter-spacing: -.04em; }
.stat-label { font-size: 12px; font-weight: 600; color: var(--text-soft); }
.stat-foot { font-size: 10.5px; color: var(--muted-2); }
.stat-card-blue { color: var(--blue); }
.stat-card-gold { color: #a67c1f; } .stat-card-gold::before { background: var(--gold); } .stat-card-gold .stat-icon { background: var(--gold-soft); color: var(--gold-strong); }
.stat-card-green { color: var(--green); } .stat-card-green::before { background: var(--green); } .stat-card-green .stat-icon { background: var(--green-soft); color: var(--green); }
.stat-card-red { color: var(--red); } .stat-card-red::before { background: var(--red); } .stat-card-red .stat-icon { background: var(--red-soft); color: var(--red); }
.stat-card-amber { color: var(--amber); } .stat-card-amber::before { background: #d97706; } .stat-card-amber .stat-icon { background: var(--amber-soft); color: var(--amber); }
.stat-card-dark { color: var(--navy-800); } .stat-card-dark::before { background: var(--navy-800); } .stat-card-dark .stat-icon { background: #e2e8f0; color: var(--navy-800); }
.stat-card .stat-value, .stat-card .stat-label { color: var(--text); }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 9px;
  border-radius: 20px;
  font-size: 11px; font-weight: 700;
  white-space: nowrap;
  background: var(--surface-3); color: var(--text-soft);
  border: 1px solid transparent;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge .icon { width: 13px; height: 13px; }
.badge-xs { padding: 2px 7px; font-size: 10px; }
.badge-success { background: var(--green-soft); color: #166534; border-color: #bbf7d0; }
.badge-danger { background: var(--red-soft); color: #991b1b; border-color: #fecaca; }
.badge-danger-soft { background: #fff1f2; color: #9f1239; border-color: #fecdd3; }
.badge-warning { background: var(--amber-soft); color: #92400e; border-color: #fde68a; }
.badge-info { background: var(--blue-soft); color: #1e40af; border-color: #bfdbfe; }
.badge-neutral { background: var(--surface-3); color: var(--muted); border-color: #e2e8f0; }
.badge-gold { background: var(--gold-soft); color: #8a6416; border-color: #f0dfb2; }
.badge-dark { background: var(--navy-800); color: #fff; border-color: var(--navy-800); }

/* ---------- Alerts / banners ---------- */
.alert { display: flex; align-items: flex-start; gap: 10px; padding: 13px 15px; border-radius: 11px; margin-bottom: 18px; font-size: 13px; font-weight: 500; border: 1px solid; }
.alert .icon { width: 18px; height: 18px; margin-top: 1px; }
.alert-danger { background: var(--red-soft); border-color: #fecaca; color: #991b1b; }
.inline-warning, .inline-info {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  padding: 10px 12px; border-radius: 9px; font-size: 12px; margin-top: 14px;
}
.inline-warning { background: var(--amber-soft); color: #92400e; border: 1px solid #fde68a; }
.inline-info { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.inline-warning .icon, .inline-info .icon { width: 16px; height: 16px; }
.inline-warning a { font-weight: 700; color: #92400e; text-decoration: underline; }
.info-banner { display: flex; align-items: flex-start; gap: 10px; padding: 13px 15px; border-radius: 11px; background: var(--gold-soft); border: 1px solid #eeddb0; color: #6f5416; font-size: 12.5px; margin: 18px 0 0; }
.info-banner .icon { width: 18px; height: 18px; margin-top: 1px; }
.text-danger { color: var(--red) !important; }
.text-muted { color: var(--muted); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.table th {
  text-align: left; padding: 9px 12px;
  font-size: 10px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted-2); font-weight: 700; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td { padding: 13px 12px; border-bottom: 1px solid #eef2f8; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table-hover tbody tr { transition: background .14s; }
.table-hover tbody tr:hover { background: #fbfcfe; }
.table-compact td { padding: 10px 10px; }
.table-compact th { padding: 8px 10px; white-space: normal; line-height: 1.25; }
.row-muted { opacity: .58; }
.cell-title { display: block; font-weight: 600; color: var(--text); font-size: 12.5px; line-height: 1.35; }
a.cell-title:hover { color: var(--navy-700); text-decoration: underline; text-underline-offset: 2px; }
.cell-sub { display: block; font-size: 10.5px; color: var(--muted-2); margin-top: 2px; }
.cell-action { text-align: right; }
.nowrap { white-space: nowrap; }
.cell-actions { display: flex; gap: 4px; justify-content: flex-end; }
.cell-actions form { display: inline-flex; }
.cell-actions .icon-btn { width: 32px; height: 32px; border-radius: 8px; }
.cell-actions .icon-btn .icon { width: 15px; height: 15px; }
.badge + .badge { margin-left: 4px; }
td .badge + .badge { margin-left: 0; }
td > .badge { margin: 2px 3px 2px 0; }

.mini-progress { height: 5px; background: #e8edf5; border-radius: 4px; overflow: hidden; width: 84px; margin-bottom: 3px; }
.mini-progress span { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--gold), #d8b35c); }
.bar-track { height: 6px; background: #e8edf5; border-radius: 4px; overflow: hidden; margin-top: 5px; }
.bar-fill { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--navy-700), #3b6ba5); }

/* ---------- Filter bar ---------- */
.filter-card { padding: 14px; margin-bottom: 22px; }
.filter-bar { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.filter-search {
  flex: 1 1 260px; display: flex; align-items: center; gap: 8px;
  height: 42px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2);
  color: var(--muted-2);
}
.filter-search:focus-within { border-color: var(--gold); background: #fff; box-shadow: 0 0 0 3px rgba(201,162,74,.14); }
.filter-search .icon { width: 17px; height: 17px; }
.filter-search input { border: 0; outline: 0; background: transparent; width: 100%; font-size: 12.5px; }
.filter-field { display: flex; flex-direction: column; gap: 4px; min-width: 130px; }
.filter-field > span { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted-2); }
.filter-field select, .filter-field input { height: 42px; border: 1px solid var(--border); border-radius: 10px; padding: 0 10px; background: var(--surface); font-size: 12.5px; outline: 0; }
.filter-field select:focus, .filter-field input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,162,74,.14); }
.filter-actions { display: flex; gap: 8px; }

.summary-strip { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.summary-chip { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; font-size: 11.5px; color: var(--muted); }
.summary-chip strong { font-size: 16px; font-family: var(--font-head); color: var(--text); }
.summary-chip.is-green strong { color: var(--green); }
.summary-chip.is-red strong { color: var(--red); }
.summary-chip.is-dark strong { color: var(--navy-800); }

/* ---------- Forms ---------- */
.form-card { padding: 0; overflow: hidden; }
.form-section { padding: 22px 24px; border-bottom: 1px solid var(--border); }
.form-section-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.form-section-head h3 { font-size: 16px; }
.form-section-head p { font-size: 12px; color: var(--muted); margin-top: 2px; }
.form-step { width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--gold-soft); color: var(--gold-strong); font-weight: 800; font-family: var(--font-head); font-size: 13px; border: 1px solid #eeddb0; }
.form-step .icon { width: 15px; height: 15px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 11.5px; font-weight: 700; color: var(--text-soft); }
.field > span b { color: var(--red); }
.field-full { grid-column: 1 / -1; }
.field small { font-size: 10.5px; color: var(--muted-2); line-height: 1.4; }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--surface);
  outline: 0;
  font-size: 13px;
  transition: border-color .16s, box-shadow .16s;
}
.field textarea { resize: vertical; min-height: 80px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,162,74,.16); }
.field input[readonly], .field input:disabled, .field select:disabled { background: var(--surface-2); color: var(--muted); }
.field-check { justify-content: flex-start; }
.input-wrap { display: flex; align-items: center; gap: 9px; border: 1px solid var(--border-strong); border-radius: 11px; padding: 0 12px; background: var(--surface); transition: border-color .16s, box-shadow .16s; }
.input-wrap:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,162,74,.16); }
.input-wrap .icon { width: 18px; height: 18px; color: var(--muted-2); }
.input-wrap input { border: 0; box-shadow: none; padding: 11px 0; background: transparent; }
.input-wrap input:focus { box-shadow: none; }
.form-stack { display: flex; flex-direction: column; gap: 12px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 18px 24px; background: var(--surface-2); border-top: 1px solid var(--border); }
.form-card > .info-banner { margin: 18px 24px 0; }
.form-card > .form-actions { margin-top: 0; }
.check-row { display: flex; align-items: flex-start; gap: 9px; font-size: 12.5px; color: var(--text-soft); cursor: pointer; line-height: 1.4; }
.check-row input { width: 17px; height: 17px; margin-top: 1px; accent-color: var(--gold-strong); }
.inline-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inline-form input[type="text"] { height: 38px; border: 1px solid var(--border); border-radius: 9px; padding: 0 11px; font-size: 12.5px; min-width: 220px; outline: 0; }
.inline-form input[type="text"]:focus { border-color: var(--gold); }
.inline-form select { height: 38px; border: 1px solid var(--border); border-radius: 9px; padding: 0 9px; font-size: 12.5px; background: var(--surface); outline: 0; }
.inline-label { font-size: 11px; font-weight: 700; color: var(--muted); }
.inline-details { margin-top: 12px; }
.inline-details summary { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--navy-700); cursor: pointer; list-style: none; }
.inline-details summary::-webkit-details-marker { display: none; }
.inline-details summary .icon { width: 15px; height: 15px; }
.inline-details[open] summary { margin-bottom: 10px; }

/* ---------- Dashboard-specific ---------- */
.alert-cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.alert-card { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); }
.alert-card.is-danger { background: linear-gradient(90deg, #fff7f7, #fff); border-color: #fbd5d5; }
.alert-card.is-warning { background: linear-gradient(90deg, #fffdf4, #fff); border-color: #f4e3b6; }
.alert-card-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--surface-3); color: var(--muted); flex-shrink: 0; }
.alert-card.is-danger .alert-card-icon { background: var(--red-soft); color: var(--red); }
.alert-card.is-warning .alert-card-icon { background: var(--amber-soft); color: var(--amber); }
.alert-card-icon .icon { width: 18px; height: 18px; }
.alert-card-body { flex: 1; min-width: 0; }
.alert-card-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.alert-card-title a { font-size: 12.5px; font-weight: 700; }
.alert-card-title a:hover { text-decoration: underline; }
.alert-card-meta { display: block; font-size: 10.5px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.alert-card-due { text-align: right; flex-shrink: 0; }
.alert-card-due strong { display: block; font-size: 11px; color: var(--red); }
.alert-card.is-warning .alert-card-due strong { color: var(--amber); }
.alert-card.is-neutral .alert-card-due strong { color: var(--muted); }
.alert-card-due span { font-size: 10px; color: var(--muted-2); }
.bar-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 15px; }
.bar-head { display: flex; justify-content: space-between; font-size: 12px; gap: 10px; }
.bar-head span { color: var(--text-soft); font-weight: 500; }
.bar-head strong { font-family: var(--font-head); }
.bar-foot { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted-2); margin-top: 4px; }
.firma-strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 2px; }
.firma-chip { flex: 0 0 220px; border: 1px solid var(--border); border-radius: 11px; padding: 11px 13px; display: flex; flex-direction: column; gap: 2px; background: var(--surface-2); }
.firma-chip:hover { border-color: var(--gold); background: var(--gold-soft); }
.firma-date { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--amber); font-weight: 700; }
.firma-date .icon { width: 14px; height: 14px; }
.firma-chip strong { font-size: 12.5px; }
.firma-chip > span:last-child { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Empty states ---------- */
.empty-state { text-align: center; padding: 40px 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-state.compact { padding: 26px 16px; }
.empty-icon { width: 52px; height: 52px; border-radius: 16px; display: flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--muted-2); border: 1px solid var(--border); margin-bottom: 4px; }
.empty-icon .icon { width: 24px; height: 24px; }
.empty-state strong { font-family: var(--font-head); font-size: 15px; }
.empty-state p { font-size: 12.5px; color: var(--muted); max-width: 380px; }
.empty-state .btn { margin-top: 8px; }

/* ---------- Expediente hero ---------- */
.exp-hero {
  position: relative;
  background:
    radial-gradient(circle at 100% 0%, rgba(201,162,74,.16), transparent 38%),
    linear-gradient(135deg, var(--navy-900), var(--navy-800) 55%, #1d3657);
  color: #eaf0f9;
  border-radius: var(--radius-lg);
  padding: 24px 26px 20px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.exp-hero::after { content: ""; position: absolute; right: -60px; bottom: -90px; width: 260px; height: 260px; border-radius: 50%; border: 1px solid rgba(201,162,74,.18); }
.exp-hero-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; position: relative; z-index: 1; }
.exp-kicker { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.exp-hero .badge-neutral { background: rgba(255,255,255,.08); color: #dbe5f2; border-color: rgba(255,255,255,.12); }
.exp-hero .badge-gold { background: rgba(201,162,74,.2); color: #f0d99a; border-color: rgba(201,162,74,.35); }
.exp-hero-title h2 { font-size: 30px; font-weight: 800; color: #fff; letter-spacing: -.03em; }
.exp-client { font-size: 14px; color: #c8d5e7; margin-top: 4px; }
.exp-client span { color: #7f95b3; margin: 0 4px; }
.exp-hero-progress { display: flex; flex-direction: column; align-items: center; gap: 6px; flex-shrink: 0; }
.exp-hero-progress small { font-size: 10px; color: #a9bcd6; text-align: center; }
.circular { width: 74px; height: 74px; border-radius: 50%; background: conic-gradient(var(--gold) calc(var(--value) * 1%), rgba(255,255,255,.14) 0); display: flex; align-items: center; justify-content: center; position: relative; }
.circular::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--navy-900); }
.circular span { position: relative; z-index: 1; font-family: var(--font-head); font-weight: 800; font-size: 16px; color: #fff; }
.exp-meta-grid { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap: 14px; margin-top: 22px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.1); position: relative; z-index: 1; }
.exp-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.exp-meta > span { font-size: 9.5px; text-transform: uppercase; letter-spacing: .1em; color: #8297b4; font-weight: 700; }
.exp-meta strong { font-size: 12.5px; color: #eef3fa; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exp-meta small { font-size: 10px; color: #a9bcd6; }
.exp-progress-line { display: flex; align-items: center; gap: 12px; margin-top: 18px; position: relative; z-index: 1; }
.exp-progress-bar { flex: 1; height: 6px; background: rgba(255,255,255,.14); border-radius: 4px; overflow: hidden; }
.exp-progress-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), #e2c071); border-radius: 4px; }
.exp-progress-caption { font-size: 10.5px; color: #b7c7dc; white-space: nowrap; max-width: 45%; overflow: hidden; text-overflow: ellipsis; }
.exp-danger-zone { margin-top: 14px; position: relative; z-index: 1; }
.exp-danger-zone summary { font-size: 11px; color: #9db0c9; cursor: pointer; width: fit-content; }
.exp-danger-zone[open] summary { margin-bottom: 8px; }

/* ---------- Legal alerts ---------- */
.legal-alerts { display: flex; flex-direction: column; gap: 10px; margin-bottom: 22px; }
.legal-banner { display: flex; align-items: center; gap: 13px; padding: 12px 16px; border-radius: 12px; border: 1px solid; }
.legal-banner.is-danger { background: #fff5f5; border-color: #f7c9c9; }
.legal-banner.is-warning { background: #fffaf0; border-color: #f3dda8; }
.legal-banner.is-success { background: #f3fbf6; border-color: #bfe8cd; }
.legal-icon { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--red-soft); color: var(--red); flex-shrink: 0; }
.legal-banner.is-warning .legal-icon { background: var(--amber-soft); color: var(--amber); }
.legal-banner.is-success .legal-icon { background: var(--green-soft); color: var(--green); }
.legal-icon .icon { width: 19px; height: 19px; }
.legal-banner > div { flex: 1; }
.legal-banner strong { font-size: 12.5px; display: block; }
.legal-banner p { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* ---------- Stepper ---------- */
.stepper-card { padding-bottom: 16px; }
.stepper-controls { display: flex; gap: 6px; }
.stepper-controls .icon-btn { width: 34px; height: 34px; background: var(--surface-2); }
.stepper-controls .icon-btn .icon { width: 16px; height: 16px; }
.stepper-viewport { overflow-x: auto; scroll-behavior: smooth; scrollbar-width: thin; }
.stepper-viewport::-webkit-scrollbar { height: 6px; }
.stepper-viewport::-webkit-scrollbar-thumb { background: #d7e0ec; border-radius: 4px; }
.stepper { display: flex; list-style: none; margin: 0; padding: 6px 2px 10px; min-width: max-content; }
.step { position: relative; flex: 0 0 172px; padding: 0 9px; text-align: center; }
.step-line { position: absolute; top: 18px; left: 0; right: 0; height: 3px; background: #e5ebf3; z-index: 0; }
.step:first-child .step-line { left: 50%; }
.step:last-child .step-line { right: 50%; }
.step.is-done .step-line { background: #9ed4b0; }
.step-marker { position: relative; z-index: 1; width: 38px; height: 38px; margin: 0 auto 11px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--surface); border: 2px solid #dce4ef; color: var(--muted-2); font-weight: 800; font-family: var(--font-head); font-size: 13px; }
.step-marker .icon { width: 18px; height: 18px; }
.step.is-done .step-marker { background: var(--green); border-color: var(--green); color: #fff; }
.step.is-current .step-marker { background: linear-gradient(145deg, #dcb96a, var(--gold-strong)); border-color: #a97f26; color: var(--navy-950); box-shadow: 0 0 0 5px rgba(201,162,74,.18); animation: pulseGold 2.4s infinite; }
.step.is-late .step-marker { background: var(--red); border-color: var(--red); color: #fff; }
.step.is-soon .step-marker { background: var(--amber); border-color: var(--amber); color: #fff; }
@keyframes pulseGold { 0%,100% { box-shadow: 0 0 0 4px rgba(201,162,74,.16); } 50% { box-shadow: 0 0 0 8px rgba(201,162,74,.08); } }
.step-card { background: var(--surface); border: 1px solid transparent; border-radius: 11px; padding: 9px 7px; min-height: 96px; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.step.is-current .step-card { background: var(--gold-soft); border-color: #eeddb0; }
.step-status { font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--muted-2); }
.step.is-done .step-status { color: var(--green); }
.step.is-current .step-status { color: var(--gold-strong); }
.step.is-late .step-status { color: var(--red); }
.step.is-soon .step-status { color: var(--amber); }
.step-name { font-size: 11.5px; font-weight: 600; line-height: 1.25; color: var(--text-soft); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.step.is-current .step-name { color: var(--text); }
.step-meta { display: inline-flex; align-items: center; gap: 3px; font-size: 9.5px; color: var(--muted-2); }
.step-meta .icon { width: 11px; height: 11px; }
.step-due { font-size: 9.5px; font-weight: 700; color: var(--amber); }
.step.is-late .step-due { color: var(--red); }

/* ---------- Stage focus ---------- */
.stage-focus { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.stage-focus-head { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.stage-focus-head h3 { font-size: 20px; margin-bottom: 8px; }
.stage-focus-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.stage-focus-due { text-align: right; flex-shrink: 0; background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; padding: 9px 13px; }
.stage-focus-due small { display: block; font-size: 9.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted-2); font-weight: 700; }
.stage-focus-due strong { display: block; font-size: 13px; margin-top: 2px; }
.stage-focus-due span { display: block; font-size: 10.5px; color: var(--muted); }
.stage-focus-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; padding: 15px 0 2px; }
.stage-focus-grid > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stage-focus-grid span { font-size: 9.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted-2); font-weight: 700; }
.stage-focus-grid strong { font-size: 12px; font-weight: 600; color: var(--text-soft); overflow-wrap: anywhere; }
.stage-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; padding-top: 15px; border-top: 1px dashed var(--border); }
.stage-tools { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.big-check { width: 58px; height: 58px; border-radius: 18px; background: var(--green-soft); color: var(--green); display: flex; align-items: center; justify-content: center; }
.big-check .icon { width: 30px; height: 30px; }

/* ---------- Stage list ---------- */
.stage-list { display: flex; flex-direction: column; gap: 7px; }
.stage-row { border: 1px solid var(--border); border-radius: 11px; overflow: hidden; background: var(--surface); }
.stage-row.is-current { border-color: #e5cf94; background: #fffdf7; }
.stage-row > summary { display: flex; align-items: center; gap: 12px; padding: 11px 13px; cursor: pointer; list-style: none; }
.stage-row > summary::-webkit-details-marker { display: none; }
.stage-num { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--surface-3); color: var(--muted); font-weight: 800; font-size: 12px; flex-shrink: 0; font-family: var(--font-head); }
.stage-num.is-done { background: var(--green); color: #fff; }
.stage-num.is-current { background: var(--gold); color: var(--navy-950); }
.stage-num .icon { width: 15px; height: 15px; }
.stage-summary-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.stage-summary-main strong { font-size: 12.5px; font-weight: 600; }
.stage-summary-main small { font-size: 10.5px; color: var(--muted); }
.stage-summary-meta { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.stage-summary-date { width: 112px; text-align: right; font-size: 10.5px; color: var(--muted); flex-shrink: 0; }
.stage-chevron { color: var(--muted-2); transition: transform .18s; display: flex; }
.stage-chevron .icon { width: 16px; height: 16px; }
.stage-row[open] .stage-chevron { transform: rotate(180deg); }
.stage-row-body { padding: 0 13px 14px 55px; }
.stage-row-facts { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; padding: 11px 0; border-top: 1px solid var(--border); }
.stage-row-facts div { display: flex; flex-direction: column; gap: 1px; }
.stage-row-facts span { font-size: 9px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted-2); font-weight: 700; }
.stage-row-facts strong { font-size: 11.5px; font-weight: 600; color: var(--text-soft); }
.stage-note { font-size: 11.5px; color: var(--text-soft); background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; margin: 6px 0; display: flex; gap: 7px; align-items: flex-start; }
.stage-note .icon { width: 14px; height: 14px; color: var(--muted); margin-top: 1px; }

/* ---------- Requisitos / Firma / Activity ---------- */
.req-progress { height: 6px; border-radius: 4px; background: var(--surface-3); overflow: hidden; margin-bottom: 12px; }
.req-progress span { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--gold), #d8b35c); }
.req-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.req-list li { border-bottom: 1px solid #eef2f8; }
.req-list li:last-child { border-bottom: 0; }
.req-toggle { display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 9px 2px; background: none; border: 0; text-align: left; cursor: pointer; }
.req-toggle:hover .req-text { color: var(--text); }
.req-box { width: 19px; height: 19px; border-radius: 5px; border: 1.6px solid var(--border-strong); display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 1px; background: var(--surface); color: #fff; transition: background .15s, border-color .15s; }
.req-box .icon { width: 13px; height: 13px; }
.req-list li.is-done .req-box { background: var(--green); border-color: var(--green); }
.req-text { font-size: 12px; color: var(--text-soft); line-height: 1.35; }
.req-text small { display: block; font-size: 10px; color: var(--muted-2); margin-top: 1px; }
.req-list li.is-done .req-text { color: var(--muted); text-decoration: line-through; text-decoration-color: #c8d2e0; }
.firma-summary { display: flex; gap: 12px; align-items: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; padding: 12px; margin-bottom: 14px; }
.firma-summary-icon { width: 40px; height: 40px; border-radius: 11px; background: var(--gold-soft); color: var(--gold-strong); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.firma-summary-icon .icon { width: 20px; height: 20px; }
.firma-summary strong { display: block; font-size: 12.5px; }
.firma-summary span { display: block; font-size: 10.5px; color: var(--muted); }
.firma-rule { display: flex; gap: 8px; font-size: 11px; color: var(--muted); background: #fbf7ea; border: 1px solid #f0e3bd; border-radius: 9px; padding: 9px 11px; margin-bottom: 13px; line-height: 1.4; }
.firma-rule .icon { width: 15px; height: 15px; color: var(--gold-strong); flex-shrink: 0; margin-top: 1px; }
.firma-rule b { color: #6f5416; }
.activity-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.activity-list li { display: flex; gap: 11px; padding: 9px 0; border-bottom: 1px solid #eef2f8; }
.activity-list li:last-child { border-bottom: 0; }
.activity-icon { width: 30px; height: 30px; border-radius: 9px; background: var(--surface-3); color: var(--muted); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.activity-icon .icon { width: 15px; height: 15px; }
.activity-etapa_completada { background: var(--green-soft); color: var(--green); }
.activity-firma { background: var(--gold-soft); color: var(--gold-strong); }
.activity-creacion { background: var(--blue-soft); color: var(--blue); }
.activity-requisito { background: #eef2ff; color: #4338ca; }
.activity-body { min-width: 0; }
.activity-body p { font-size: 12px; color: var(--text-soft); }
.activity-body span { font-size: 10px; color: var(--muted-2); }

/* ---------- Usuarios / perfiles ---------- */
.perfil-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin-bottom: 22px; }
.perfil-card { display: flex; gap: 11px; padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.perfil-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--gold-soft); color: var(--gold-strong); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.perfil-icon .icon { width: 17px; height: 17px; }
.perfil-card strong { display: block; font-size: 12px; }
.perfil-card p { font-size: 10.5px; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.user-cell { display: flex; align-items: center; gap: 10px; }
.profile-card { padding: 0; overflow: hidden; }
.profile-head { display: flex; align-items: center; gap: 16px; padding: 24px; background: linear-gradient(135deg, var(--navy-900), var(--navy-800)); color: #fff; }
.profile-head h3 { color: #fff; font-size: 20px; }
.profile-head p { color: #b8c7db; font-size: 12px; margin-bottom: 7px; }
.profile-head .badge { background: rgba(201,162,74,.2); color: #f0d99a; border-color: rgba(201,162,74,.32); }
.profile-facts { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; padding: 20px 24px; }
.profile-facts div { display: flex; flex-direction: column; gap: 2px; }
.profile-facts span { font-size: 9.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted-2); font-weight: 700; }
.profile-facts strong { font-size: 12.5px; }

/* ---------- Login ---------- */
.auth-body { min-height: 100vh; background: var(--navy-950); }
.auth-shell { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr); min-height: 100vh; }
.auth-brand {
  position: relative;
  background:
    radial-gradient(circle at 18% 12%, rgba(201,162,74,.2), transparent 38%),
    radial-gradient(circle at 90% 90%, rgba(37,77,130,.6), transparent 55%),
    linear-gradient(150deg, var(--navy-900), var(--navy-950) 70%);
  color: #eaf0f9;
  padding: 42px 52px;
  display: flex; flex-direction: column; justify-content: space-between;
  overflow: hidden;
}
.auth-brand::after { content: ""; position: absolute; right: -120px; bottom: -160px; width: 460px; height: 460px; border-radius: 50%; border: 1px solid rgba(201,162,74,.15); box-shadow: 0 0 0 50px rgba(201,162,74,.03), 0 0 0 100px rgba(201,162,74,.02); }
.auth-brand-top { display: flex; align-items: center; gap: 14px; position: relative; z-index: 1; }
.auth-brand-top strong { display: block; font-family: var(--font-head); font-size: 18px; }
.auth-brand-top small { display: block; color: #93a4bc; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; }
.auth-brand-main { position: relative; z-index: 1; max-width: 560px; }
.auth-eyebrow { display: inline-block; font-size: 10.5px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); margin-bottom: 14px; }
.auth-brand-main h1 { font-size: 42px; line-height: 1.08; font-weight: 800; letter-spacing: -.035em; color: #fff; margin-bottom: 16px; }
.auth-brand-main > p { font-size: 14px; line-height: 1.65; color: #b7c7dc; max-width: 500px; }
.auth-features { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; margin-top: 30px; }
.auth-features > div { display: flex; align-items: center; gap: 9px; font-size: 12px; color: #d5e0ee; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.07); border-radius: 10px; padding: 10px 12px; }
.auth-features .icon { width: 18px; height: 18px; color: var(--gold); }
.auth-brand-foot { position: relative; z-index: 1; }
.auth-contact { display: flex; flex-direction: column; gap: 7px; font-size: 11.5px; color: #a9bcd6; margin-bottom: 12px; }
.auth-contact span { display: flex; gap: 8px; align-items: flex-start; line-height: 1.45; }
.auth-contact .icon { width: 15px; height: 15px; color: #8297b4; flex-shrink: 0; margin-top: 1px; }
.auth-legal { font-size: 10.5px; color: #7186a3; border-top: 1px solid rgba(255,255,255,.09); padding-top: 12px; }
.auth-form-side { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 20px; padding: 40px; background: #f7f9fc; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 34px 32px; }
.auth-card-head { text-align: center; margin-bottom: 22px; }
.auth-card-icon { width: 52px; height: 52px; border-radius: 16px; background: var(--gold-soft); color: var(--gold-strong); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 12px; border: 1px solid #efdfb5; }
.auth-card-icon .icon { width: 24px; height: 24px; }
.auth-card-head h2 { font-size: 23px; font-weight: 800; }
.auth-card-head p { font-size: 12px; color: var(--muted); margin-top: 5px; }
.auth-card .form-stack { gap: 14px; }
.auth-note { display: flex; gap: 7px; align-items: flex-start; font-size: 10.5px; color: var(--muted-2); margin-top: 18px; line-height: 1.45; }
.auth-note .icon { width: 14px; height: 14px; margin-top: 1px; flex-shrink: 0; }
.auth-copy { font-size: 10.5px; color: var(--muted-2); }

/* ---------- Redirect ---------- */
.redirect-body { display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 50% 0%, #1b3355, var(--navy-950) 60%); }
.redirect-card { display: flex; flex-direction: column; align-items: center; gap: 8px; background: var(--surface); border-radius: var(--radius-lg); padding: 38px 46px; box-shadow: var(--shadow-lg); text-align: center; }
.redirect-card .brand-mark { margin-bottom: 10px; }
.redirect-card h1 { font-size: 20px; margin-top: 8px; }
.redirect-card p { font-size: 12.5px; color: var(--muted); }
.redirect-spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--gold-strong); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Error ---------- */
.error-body { display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 50% 0%, #1b3355, var(--navy-950) 60%); padding: 30px; }
.error-card { width: 100%; max-width: 460px; background: var(--surface); border-radius: var(--radius-lg); padding: 38px 34px; text-align: center; box-shadow: var(--shadow-lg); }
.error-code { display: inline-flex; align-items: center; justify-content: center; width: 66px; height: 66px; border-radius: 20px; background: var(--red-soft); color: var(--red); font-family: var(--font-head); font-size: 22px; font-weight: 800; margin-bottom: 14px; }
.error-card h1 { font-size: 22px; margin-bottom: 8px; }
.error-card p { font-size: 13px; color: var(--muted); }
.error-actions { display: flex; gap: 10px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }

/* ---------- Toasts ---------- */
.toast {
  position: fixed; right: 24px; bottom: 24px; z-index: 120;
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--blue);
  border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: 13px 14px; min-width: 280px; max-width: 420px;
  animation: toastIn .25s ease-out;
}
.toast-success { border-left-color: var(--green); }
.toast-error { border-left-color: var(--red); }
.toast-warning { border-left-color: var(--amber); }
.toast-icon { color: var(--blue); display: flex; margin-top: 1px; }
.toast-success .toast-icon { color: var(--green); }
.toast-error .toast-icon { color: var(--red); }
.toast-warning .toast-icon { color: var(--amber); }
.toast-icon .icon { width: 19px; height: 19px; }
.toast-text { flex: 1; font-size: 12.5px; font-weight: 500; color: var(--text-soft); }
.toast-close { background: none; border: 0; color: var(--muted-2); cursor: pointer; padding: 0; display: flex; }
.toast-close .icon { width: 15px; height: 15px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Misc ---------- */
.mt-0 { margin-top: 0; }
.hidden { display: none !important; }

/* ---------- Responsive ---------- */
@media (max-width: 1240px) {
  .stat-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .exp-meta-grid { grid-template-columns: repeat(3, minmax(0,1fr)); row-gap: 16px; }
  .perfil-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .topbar-search { width: 240px; }
}
@media (max-width: 1080px) {
  .grid-2-1, .grid-2 { grid-template-columns: minmax(0,1fr); }
  .perfil-card p { display: none; }
  .stage-focus-grid, .stage-row-facts, .profile-facts { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 980px) {
  .app-main { margin-left: 0; }
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  body.sidebar-open .sidebar { transform: none; }
  .sidebar-close { display: flex; }
  .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(8,20,38,.5); z-index: 55; backdrop-filter: blur(2px); }
  body.sidebar-open .sidebar-overlay { display: block; }
  .menu-btn { display: inline-flex; }
  .topbar-search { display: none; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-form-side { min-height: 100vh; background: radial-gradient(circle at 50% 0%, #1b3355, var(--navy-950) 65%); }
  .auth-card { box-shadow: var(--shadow-lg); }
  .auth-copy { color: #8195b1; }
}
@media (max-width: 760px) {
  .page { padding: 18px 16px 50px; }
  .topbar { padding: 0 16px; height: 68px; }
  .topbar-title h1 { font-size: 16px; }
  .topbar-title p { display: none; }
  .user-chip-text { display: none; }
  .user-chip { padding: 4px; border: 0; background: transparent; }
  .user-chip .chev { display: none; }
  .page-hero { flex-direction: column; align-items: flex-start; gap: 14px; }
  .page-hero h2 { font-size: 23px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
  .stat-value { font-size: 24px; }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-field { min-width: 0; }
  .filter-search { flex-basis: auto; }
  .filter-actions { justify-content: flex-end; }
  .stage-summary-meta { display: none; }
  .stage-summary-date { width: auto; }
  .stage-row-body { padding-left: 13px; }
  .stage-focus-head { flex-direction: column; }
  .stage-focus-due { text-align: left; width: 100%; }
  .exp-hero { padding: 20px 18px; }
  .exp-hero-head { flex-direction: column-reverse; align-items: flex-start; }
  .exp-hero-progress { flex-direction: row; align-self: flex-end; }
  .exp-hero-title h2 { font-size: 23px; }
  .exp-meta-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .exp-progress-caption { max-width: 55%; }
  .stage-row-facts, .profile-facts, .stage-focus-grid { grid-template-columns: 1fr 1fr; }
  .form-section { padding: 18px 16px; }
  .form-actions { padding: 14px 16px; flex-direction: column-reverse; }
  .form-actions .btn { width: 100%; }
  .perfil-grid { grid-template-columns: 1fr; }
  .perfil-card p { display: block; }
  .dropdown-panel { position: fixed; left: 12px; right: 12px; top: 74px; width: auto; }
  .auth-form-side { padding: 20px; }
  .auth-card { padding: 26px 20px; }
  .toast { left: 16px; right: 16px; bottom: 16px; max-width: none; }
  .legal-banner { align-items: flex-start; }
}

/* ---------- Print ---------- */
@media print {
  body { background: #fff; }
  .sidebar, .topbar, .sidebar-overlay, .toast, .hero-actions, .page-topline-actions,
  .filter-card, .stepper-controls, .stage-actions, .stage-tools, .exp-danger-zone,
  .inline-details, .firma-summary + form, .req-toggle form, .btn { display: none !important; }
  .app-main { margin-left: 0; }
  .page { padding: 0; max-width: none; }
  .card, .exp-hero, .legal-banner { box-shadow: none; break-inside: avoid; }
  .exp-hero { background: #0d1b30 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .grid-2-1, .grid-2 { grid-template-columns: 1fr; }
  .badge { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
