/* ============================================================
   NODUM CORPORATE · M01 Dashboard executiu
   Estil: híbrid Stripe (fred, geomètric) + accent coral Nodum
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700&family=Inter:wght@400;450;500;600&display=swap');

/* ─── TOKENS ─────────────────────────────────────────────── */
:root {
  /* superfícies fredes tipus Stripe */
  --bg:           #FBFBFD;
  --bg-shell:     #F4F5F9;
  --bg-card:      #FFFFFF;
  --bg-sidebar:   #0A0B0F;
  --bg-sidebar-2: #12131A;
  --bg-hover:     #F2F3F8;
  --bg-sunken:    #F7F8FC;

  --border:       #E8EAF0;
  --border-2:     #EEF0F5;
  --border-strong:#DADCE6;

  --ink:          #0D0F1A;
  --ink-2:        #3C4257;
  --ink-3:        #6B7280;
  --ink-4:        #9AA0AE;
  --ink-side:     #C5C8D4;
  --ink-side-dim: rgba(197,200,212,0.45);

  /* accent coral Nodum */
  --coral:        #E8634A;
  --coral-600:    #D64E34;
  --coral-700:    #B83E28;
  --coral-tint:   rgba(232,99,74,0.10);
  --coral-tint-2: rgba(232,99,74,0.06);
  --coral-ring:   rgba(232,99,74,0.30);

  /* estats */
  --green:    #1A8A5A;  --green-tint: rgba(26,138,90,0.10);
  --amber:    #B5820A;  --amber-tint: rgba(181,130,10,0.11);
  --blue:     #3B6FE0;  --blue-tint:  rgba(59,111,224,0.10);
  --violet:   #6457E8;  --violet-tint:rgba(100,87,232,0.10);
  --red:      #D23B2C;  --red-tint:   rgba(210,59,44,0.10);
  --teal:     #0E9384;  --teal-tint:  rgba(14,147,132,0.10);

  --shadow-xs: 0 1px 2px rgba(13,15,26,0.04);
  --shadow-sm: 0 1px 3px rgba(13,15,26,0.06), 0 1px 2px rgba(13,15,26,0.04);
  --shadow-md: 0 4px 16px rgba(13,15,26,0.07), 0 1px 4px rgba(13,15,26,0.05);
  --shadow-lg: 0 18px 48px rgba(13,15,26,0.13), 0 4px 14px rgba(13,15,26,0.07);
  --shadow-pop:0 10px 34px rgba(13,15,26,0.16);

  --r-xs: 6px;  --r-sm: 9px;  --r-md: 13px;  --r-lg: 18px;  --r-xl: 24px;
  --sidebar-w: 244px;
  --topbar-h:  60px;
  --f-display: 'Sora', sans-serif;
  --f-body:    'Inter', sans-serif;
  --ease:      cubic-bezier(0.22, 0.61, 0.36, 1);
  --t:         0.2s var(--ease);
}

/* ─── RESET ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body {
  font-family: var(--f-body);
  background: var(--bg-shell);
  color: var(--ink);
  min-height: 100vh;
  overflow: hidden;
  font-feature-settings: "cv11", "ss01";
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; color: inherit; }
input, select { font-family: inherit; }
ul { list-style: none; }
::selection { background: var(--coral-tint); }

/* ─── APP LAYOUT ─────────────────────────────────────────── */
#app { display: flex; height: 100vh; overflow: hidden; }

/* ════════════════════════════════════════════════════════════
   SIDEBAR
   ════════════════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w); min-width: var(--sidebar-w);
  background: var(--bg-sidebar);
  display: flex; flex-direction: column;
  height: 100vh; overflow: hidden; z-index: 50; flex-shrink: 0;
  background-image: radial-gradient(120% 60% at 0% 0%, rgba(232,99,74,0.10), transparent 60%);
}

.s-logo { padding: 22px 22px 18px; }
.s-logo-mark {
  font-family: var(--f-display); font-size: 21px; font-weight: 700;
  color: #fff; letter-spacing: -0.04em; line-height: 1; display: flex; align-items: center; gap: 1px;
}
.s-logo-mark .dot { color: var(--coral); }
.s-logo-sub {
  font-size: 8.5px; letter-spacing: 0.26em; text-transform: uppercase;
  color: var(--coral); margin-top: 5px; font-weight: 600;
}

/* perfil actiu (selector simulat) */
.s-profile {
  margin: 6px 14px 12px; padding: 11px 12px;
  background: rgba(255,255,255,0.045);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--r-sm);
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; transition: var(--t); position: relative;
}
.s-profile:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.12); }
.s-avatar {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: #fff;
  background: linear-gradient(135deg, var(--coral), var(--coral-700));
}
.s-profile-meta { min-width: 0; flex: 1; }
.s-profile-name { font-size: 12.5px; font-weight: 600; color: #fff; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-profile-role { font-size: 9.5px; color: var(--ink-side-dim); margin-top: 2px; letter-spacing: 0.02em; }
.s-profile .chev { margin-left: auto; flex-shrink: 0; opacity: 0.5; }

/* dropdown de perfils */
.profile-pop {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--bg-sidebar-2);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: var(--r-md); padding: 6px; z-index: 60;
  box-shadow: var(--shadow-pop);
  opacity: 0; transform: translateY(-6px); pointer-events: none; transition: var(--t);
}
.profile-pop.open { opacity: 1; transform: translateY(0); pointer-events: auto; }
.pp-label { font-size: 8.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-side-dim); padding: 8px 10px 5px; }
.pp-item { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: var(--r-xs); cursor: pointer; transition: var(--t); }
.pp-item:hover { background: rgba(255,255,255,0.06); }
.pp-item.active { background: var(--coral-tint); }
.pp-item .s-avatar { width: 26px; height: 26px; font-size: 10px; }
.pp-item-name { font-size: 12px; font-weight: 500; color: #fff; }
.pp-item-desc { font-size: 9.5px; color: var(--ink-side-dim); margin-top: 1px; }

/* nav */
.s-nav { flex: 1; overflow-y: auto; padding: 4px 0 10px; scrollbar-width: none; }
.s-nav::-webkit-scrollbar { display: none; }
.nav-group { margin-bottom: 4px; }
.nav-group-label {
  font-size: 8.5px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-side-dim); padding: 14px 22px 6px; font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 11px; margin: 1px 10px;
  padding: 8px 12px; font-size: 12.5px; font-weight: 450; color: var(--ink-side);
  cursor: pointer; transition: var(--t); border-radius: var(--r-sm); position: relative;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,0.05); }
.nav-item.active { color: #fff; background: rgba(255,255,255,0.07); }
.nav-item.active::before {
  content: ''; position: absolute; left: -10px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: var(--coral);
}
.nav-item.locked { opacity: 0.32; cursor: not-allowed; }
.nav-item.locked:hover { background: none; color: var(--ink-side); }
.nav-icon { width: 17px; height: 17px; opacity: 0.65; flex-shrink: 0; }
.nav-item.active .nav-icon { opacity: 1; }
.nav-badge {
  margin-left: auto; background: var(--coral); color: #fff; font-size: 9px; font-weight: 600;
  padding: 1px 6px; border-radius: 9px; min-width: 17px; text-align: center;
}
.nav-lock { margin-left: auto; opacity: 0.5; }

.s-foot { padding: 12px 18px; border-top: 1px solid rgba(255,255,255,0.06); }
.s-foot-row { display: flex; align-items: center; gap: 8px; font-size: 10px; color: var(--ink-side-dim); }
.s-foot-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-tint); }

/* ════════════════════════════════════════════════════════════
   MAIN
   ════════════════════════════════════════════════════════════ */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

.topbar {
  height: var(--topbar-h); background: rgba(255,255,255,0.86); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border); display: flex; align-items: center;
  padding: 0 30px; gap: 16px; flex-shrink: 0; z-index: 40;
}
.tb-titles { flex: 1; min-width: 0; }
.tb-crumb { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--ink-4); margin-bottom: 2px; }
.tb-crumb .seg { transition: var(--t); }
.tb-crumb .seg.link { cursor: pointer; }
.tb-crumb .seg.link:hover { color: var(--coral); }
.tb-crumb .sep { opacity: 0.5; }
.tb-title { font-family: var(--f-display); font-size: 17px; font-weight: 600; color: var(--ink); letter-spacing: -0.02em; }
.tb-actions { display: flex; align-items: center; gap: 9px; }

/* segment view toggle */
.seg-toggle { display: inline-flex; background: var(--bg-sunken); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 3px; }
.seg-btn {
  padding: 5px 13px; font-size: 11.5px; font-weight: 500; color: var(--ink-3);
  border-radius: 6px; transition: var(--t); white-space: nowrap;
}
.seg-btn.active { background: var(--bg-card); color: var(--ink); box-shadow: var(--shadow-xs); }
.seg-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 15px;
  border-radius: var(--r-sm); font-size: 12px; font-weight: 500; transition: var(--t); white-space: nowrap;
}
.btn-primary { background: var(--coral); color: #fff; box-shadow: var(--shadow-xs); }
.btn-primary:hover { background: var(--coral-600); }
.btn-secondary { background: var(--bg-card); color: var(--ink-2); border: 1px solid var(--border-strong); }
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--ink-4); }
.btn-ghost { color: var(--ink-3); padding: 8px 11px; }
.btn-ghost:hover { background: var(--bg-hover); color: var(--ink); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { filter: brightness(0.94); }
.btn-sm { padding: 6px 11px; font-size: 11px; }

.icon-btn {
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm); color: var(--ink-3); transition: var(--t); position: relative;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--ink); }
.icon-btn .ping { position: absolute; top: 6px; right: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--coral); border: 1.5px solid var(--bg-card); }

.page {
  flex: 1; overflow-y: auto; padding: 26px 30px 60px;
  scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent;
}
.page::-webkit-scrollbar { width: 8px; }
.page::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; border: 2px solid var(--bg-shell); }
.page-inner { max-width: 1320px; margin: 0 auto; }

/* entrada escalonada */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.rise { animation: rise 0.5s var(--ease) both; }

/* ════════════════════════════════════════════════════════════
   PULS · marcador de zona clicable (punt que batega)
   ════════════════════════════════════════════════════════════ */
.clickable { position: relative; cursor: pointer; }
.puls {
  position: absolute !important; top: 13px; right: 13px;
  width: 7px !important; height: 7px !important; min-width: 7px; min-height: 7px;
  z-index: 3; pointer-events: none; display: block; flex: none;
}
.puls::before {
  content: ''; position: absolute; inset: 0; width: 7px; height: 7px; border-radius: 50%; background: var(--coral);
  transform-origin: center; animation: pulsdot 2.6s var(--ease) infinite;
}
.puls::after {
  content: ''; position: absolute; inset: 0; width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid var(--coral-ring);
  transform-origin: center; animation: pulsring 2.6s var(--ease) infinite;
}
@keyframes pulsdot {
  0%,100% { transform: scale(0.7); opacity: 0.5; }
  50%     { transform: scale(1);   opacity: 0.95; }
}
@keyframes pulsring {
  0%   { transform: scale(0.6); opacity: 0.7; }
  70%  { transform: scale(2.0); opacity: 0; }
  100% { transform: scale(2.0); opacity: 0; }
}
.puls.muted::before { background: var(--ink-4); }
.puls.muted::after  { border-color: rgba(154,160,174,0.4); }

/* ════════════════════════════════════════════════════════════
   CARDS
   ════════════════════════════════════════════════════════════ */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t), transform var(--t), border-color var(--t);
}
.card.clickable:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--border-strong); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }
.card-eyebrow { font-size: 10px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-4); }
.card-title { font-family: var(--f-display); font-size: 14px; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; }
.card-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }

/* grids */
.kpi-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 22px; }
.kpi-grid.four { grid-template-columns: repeat(4, 1fr); }
.g { display: grid; gap: 16px; }
.g-2 { grid-template-columns: 1fr 1fr; }
.g-3 { grid-template-columns: 1fr 1fr 1fr; }
.g-12-7-5 { grid-template-columns: 7fr 5fr; }
.g-12-5-7 { grid-template-columns: 5fr 7fr; }
.g-12-8-4 { grid-template-columns: 8fr 4fr; }
.span-2 { grid-column: span 2; }
.mb { margin-bottom: 16px; }
.mb-lg { margin-bottom: 22px; }

@media (max-width: 1080px) {
  .kpi-grid, .kpi-grid.four { grid-template-columns: repeat(2, 1fr); }
  .g-2, .g-3, .g-12-7-5, .g-12-5-7, .g-12-8-4 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
}

/* ── KPI CARD ── */
.kpi {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 16px 17px; position: relative; overflow: hidden; transition: var(--t);
}
.kpi.clickable:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.kpi-accent { position: absolute; left: 0; top: 0; bottom: 0; width: 3px; }
.kpi.coral .kpi-accent { background: var(--coral); }
.kpi.green .kpi-accent { background: var(--green); }
.kpi.blue  .kpi-accent { background: var(--blue); }
.kpi.amber .kpi-accent { background: var(--amber); }
.kpi.violet .kpi-accent{ background: var(--violet); }
.kpi.red   .kpi-accent { background: var(--red); }
.kpi-label { font-size: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-4); display: flex; align-items: center; gap: 6px; }
.kpi-val { font-family: var(--f-display); font-size: 25px; font-weight: 600; color: var(--ink); line-height: 1; margin-top: 9px; letter-spacing: -0.02em; }
.kpi-val .cur { font-size: 15px; font-weight: 500; color: var(--ink-3); margin-left: 2px; }
.kpi-foot { display: flex; align-items: center; gap: 7px; margin-top: 9px; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 7px; }
.delta.up { color: var(--green); background: var(--green-tint); }
.delta.down { color: var(--red); background: var(--red-tint); }
.delta.flat { color: var(--ink-3); background: var(--bg-sunken); }
.kpi-note { font-size: 11px; color: var(--ink-4); }
.spark { margin-top: 11px; height: 30px; width: 100%; }

/* ── SECTION ── */
.sec-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 2px 13px; }
.sec-title { font-family: var(--f-display); font-size: 13.5px; font-weight: 600; color: var(--ink-2); display: flex; align-items: center; gap: 8px; letter-spacing: -0.01em; }
.sec-title .badge-count { background: var(--coral-tint); color: var(--coral-700); font-size: 10px; font-weight: 600; padding: 1px 8px; border-radius: 8px; }
.sec-link { font-size: 11.5px; font-weight: 500; color: var(--ink-3); display: inline-flex; align-items: center; gap: 5px; transition: var(--t); }
.sec-link:hover { color: var(--coral); }

/* ════════════════════════════════════════════════════════════
   DONUT / ALLOCATION
   ════════════════════════════════════════════════════════════ */
.alloc { display: flex; align-items: center; gap: 22px; }
.donut { flex-shrink: 0; position: relative; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.donut-center .v { font-family: var(--f-display); font-size: 20px; font-weight: 600; color: var(--ink); letter-spacing: -0.02em; }
.donut-center .l { font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-4); margin-top: 2px; }
.donut-seg { transition: opacity var(--t), stroke-width var(--t); cursor: pointer; }
.donut-seg:hover { opacity: 0.82; }
.legend { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.legend-row { display: flex; align-items: center; gap: 10px; padding: 7px 9px; border-radius: var(--r-sm); transition: var(--t); cursor: pointer; position: relative; }
.legend-row:hover { background: var(--bg-hover); }
.legend-dot { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.legend-name { font-size: 12.5px; font-weight: 500; color: var(--ink-2); flex: 1; }
.legend-val { font-size: 12.5px; font-weight: 600; color: var(--ink); font-family: var(--f-display); }
.legend-pct { font-size: 10.5px; color: var(--ink-4); width: 38px; text-align: right; }

/* ════════════════════════════════════════════════════════════
   EVOLUTION CHART
   ════════════════════════════════════════════════════════════ */
.range-tabs { display: inline-flex; gap: 2px; background: var(--bg-sunken); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 3px; }
.range-tab { padding: 4px 11px; font-size: 11px; font-weight: 500; color: var(--ink-3); border-radius: 6px; transition: var(--t); }
.range-tab.active { background: var(--bg-card); color: var(--ink); box-shadow: var(--shadow-xs); }
.chart-wrap { position: relative; width: 100%; }
.chart-tip {
  position: absolute; pointer-events: none; background: var(--ink); color: #fff;
  font-size: 11px; padding: 6px 9px; border-radius: 7px; opacity: 0; transition: opacity 0.12s;
  white-space: nowrap; z-index: 5; transform: translate(-50%, -120%); box-shadow: var(--shadow-md);
}
.chart-tip .tv { font-family: var(--f-display); font-weight: 600; }
.chart-tip .tl { color: rgba(255,255,255,0.6); font-size: 10px; }

/* ════════════════════════════════════════════════════════════
   ALERTS
   ════════════════════════════════════════════════════════════ */
.alert-tabs { display: flex; gap: 6px; margin-bottom: 4px; }
.alert-tab { padding: 6px 12px; font-size: 11.5px; font-weight: 500; color: var(--ink-3); border-radius: var(--r-sm); border: 1px solid transparent; transition: var(--t); display: inline-flex; align-items: center; gap: 7px; }
.alert-tab:hover { background: var(--bg-hover); }
.alert-tab.active { background: var(--bg-card); border-color: var(--border); color: var(--ink); box-shadow: var(--shadow-xs); }
.alert-tab .cnt { font-size: 10px; font-weight: 600; padding: 0 6px; border-radius: 7px; background: var(--bg-sunken); }
.alert-tab.active .cnt { background: var(--coral-tint); color: var(--coral-700); }

.alert {
  display: flex; gap: 13px; padding: 14px; border-radius: var(--r-md);
  border: 1px solid var(--border); background: var(--bg-card); transition: var(--t); position: relative;
}
.alert:hover { box-shadow: var(--shadow-sm); border-color: var(--border-strong); }
.alert-stripe { width: 3px; border-radius: 3px; flex-shrink: 0; }
.alert.sev-high .alert-stripe { background: var(--red); }
.alert.sev-med  .alert-stripe { background: var(--amber); }
.alert.sev-low  .alert-stripe { background: var(--blue); }
.alert-ico {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.alert.sev-high .alert-ico { background: var(--red-tint); color: var(--red); }
.alert.sev-med  .alert-ico { background: var(--amber-tint); color: var(--amber); }
.alert.sev-low  .alert-ico { background: var(--blue-tint); color: var(--blue); }
.alert-body { flex: 1; min-width: 0; }
.alert-top { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.alert-title { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.alert-tag { font-size: 9px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; padding: 1px 7px; border-radius: 6px; }
.tag-sales { background: var(--teal-tint); color: var(--teal); }
.tag-risk  { background: var(--violet-tint); color: var(--violet); }
.alert-desc { font-size: 11.5px; color: var(--ink-3); line-height: 1.5; }
.alert-meta { display: flex; align-items: center; gap: 12px; margin-top: 8px; font-size: 10.5px; color: var(--ink-4); }
.alert-meta .m { display: inline-flex; align-items: center; gap: 4px; }
.alert-actions { display: flex; gap: 7px; margin-top: 11px; flex-wrap: wrap; }
.chip-btn {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px; font-size: 11px; font-weight: 500;
  border-radius: var(--r-xs); border: 1px solid var(--border-strong); color: var(--ink-2); background: var(--bg-card); transition: var(--t);
}
.chip-btn:hover { background: var(--bg-hover); border-color: var(--ink-4); }
.chip-btn.approve:hover { background: var(--green-tint); border-color: var(--green); color: var(--green); }
.chip-btn.reject:hover { background: var(--red-tint); border-color: var(--red); color: var(--red); }
.chip-btn.primary { background: var(--coral); color: #fff; border-color: var(--coral); }
.chip-btn.primary:hover { background: var(--coral-600); }
.chip-btn.done { background: var(--green-tint); border-color: transparent; color: var(--green); pointer-events: none; }
.chip-btn.star.on { background: var(--amber-tint); border-color: var(--amber); color: var(--amber); }

/* ════════════════════════════════════════════════════════════
   DECISIONS / OPERATIONS LIST
   ════════════════════════════════════════════════════════════ */
.list { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 13px; padding: 13px 6px;
  border-bottom: 1px solid var(--border-2); transition: var(--t); position: relative;
}
.row:last-child { border-bottom: none; }
.row.clickable:hover { background: var(--bg-hover); border-radius: var(--r-sm); padding-left: 12px; padding-right: 12px; }
.row-ico { width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--bg-sunken); color: var(--ink-3); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-size: 12.5px; font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: 11px; color: var(--ink-4); margin-top: 2px; }
.row-val { font-family: var(--f-display); font-size: 13px; font-weight: 600; color: var(--ink); text-align: right; white-space: nowrap; }
.row-side { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.pill { font-size: 10px; font-weight: 600; padding: 3px 9px; border-radius: 20px; white-space: nowrap; }
.pill-green { background: var(--green-tint); color: var(--green); }
.pill-amber { background: var(--amber-tint); color: var(--amber); }
.pill-blue  { background: var(--blue-tint); color: var(--blue); }
.pill-red   { background: var(--red-tint); color: var(--red); }
.pill-gray  { background: var(--bg-sunken); color: var(--ink-3); }
.pill-coral { background: var(--coral-tint); color: var(--coral-700); }

.progress { height: 6px; background: var(--bg-sunken); border-radius: 4px; overflow: hidden; width: 90px; }
.progress > span { display: block; height: 100%; border-radius: 4px; background: var(--coral); }

/* ════════════════════════════════════════════════════════════
   DRILL-DOWN TREE
   ════════════════════════════════════════════════════════════ */
.drill { display: flex; flex-direction: column; gap: 3px; }
.drill-node { border-radius: var(--r-sm); overflow: hidden; }
.drill-head {
  display: flex; align-items: center; gap: 11px; padding: 12px 13px; cursor: pointer;
  transition: var(--t); border-radius: var(--r-sm); position: relative;
}
.drill-head:hover { background: var(--bg-hover); }
.drill-chev { transition: transform var(--t); flex-shrink: 0; color: var(--ink-4); }
.drill-node.open > .drill-head .drill-chev { transform: rotate(90deg); }
.drill-name { font-size: 12.5px; font-weight: 600; color: var(--ink); flex: 1; }
.drill-bar { width: 120px; height: 6px; border-radius: 4px; background: var(--bg-sunken); overflow: hidden; flex-shrink: 0; }
.drill-bar > span { display: block; height: 100%; border-radius: 4px; }
.drill-val { font-family: var(--f-display); font-size: 12.5px; font-weight: 600; color: var(--ink); width: 80px; text-align: right; }
.drill-pct { font-size: 10.5px; color: var(--ink-4); width: 44px; text-align: right; }
.drill-children { display: none; padding: 2px 0 6px 30px; margin-left: 6px; border-left: 1px solid var(--border); }
.drill-node.open > .drill-children { display: block; animation: rise 0.3s var(--ease) both; }
.drill-leaf {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--r-sm); transition: var(--t); cursor: pointer; position: relative;
}
.drill-leaf:hover { background: var(--bg-hover); }
.drill-leaf .ln { font-size: 12px; font-weight: 500; color: var(--ink-2); flex: 1; }
.drill-leaf .lv { font-family: var(--f-display); font-size: 12px; font-weight: 600; color: var(--ink); }
.drill-leaf .ld { font-size: 11px; font-weight: 600; }

/* ════════════════════════════════════════════════════════════
   FAMILIES TABLE (MFO)
   ════════════════════════════════════════════════════════════ */
.fam-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 1080px) { .fam-grid { grid-template-columns: 1fr; } }
.fam-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-md); padding: 17px; transition: var(--t); position: relative; }
.fam-card.clickable:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.fam-top { display: flex; align-items: center; gap: 11px; margin-bottom: 14px; }
.fam-avatar { width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-weight: 600; color: #fff; font-size: 13px; }
.fam-name { font-family: var(--f-display); font-size: 14px; font-weight: 600; color: var(--ink); }
.fam-tier { font-size: 10.5px; color: var(--ink-4); margin-top: 1px; }
.fam-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.fam-metric .l { font-size: 9.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-4); }
.fam-metric .v { font-family: var(--f-display); font-size: 15px; font-weight: 600; color: var(--ink); margin-top: 2px; }

/* ════════════════════════════════════════════════════════════
   SIDE PANEL
   ════════════════════════════════════════════════════════════ */
.panel-scrim { position: fixed; inset: 0; background: rgba(13,15,26,0.34); backdrop-filter: blur(2px); opacity: 0; pointer-events: none; transition: opacity var(--t); z-index: 90; }
.panel-scrim.open { opacity: 1; pointer-events: auto; }
.panel {
  position: fixed; top: 0; right: 0; height: 100vh; width: 460px; max-width: 92vw;
  background: var(--bg-card); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg);
  transform: translateX(100%); transition: transform 0.32s var(--ease); z-index: 91;
  display: flex; flex-direction: column;
}
.panel.open { transform: translateX(0); }
.panel-head { padding: 22px 24px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: flex-start; gap: 12px; }
.panel-head-main { flex: 1; min-width: 0; }
.panel-eyebrow { font-size: 10px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--coral); margin-bottom: 5px; }
.panel-title { font-family: var(--f-display); font-size: 19px; font-weight: 600; color: var(--ink); letter-spacing: -0.02em; line-height: 1.2; }
.panel-sub { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.panel-close { width: 32px; height: 32px; border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center; color: var(--ink-3); transition: var(--t); flex-shrink: 0; }
.panel-close:hover { background: var(--bg-hover); color: var(--ink); }
.panel-body { flex: 1; overflow-y: auto; padding: 22px 24px; scrollbar-width: thin; }
.panel-foot { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 9px; background: var(--bg-sunken); }
.panel-foot .btn { flex: 1; justify-content: center; }

.kv { display: flex; flex-direction: column; gap: 1px; margin-bottom: 18px; }
.kv-row { display: flex; align-items: center; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--border-2); }
.kv-row:last-child { border-bottom: none; }
.kv-k { font-size: 12px; color: var(--ink-3); }
.kv-v { font-size: 12.5px; font-weight: 600; color: var(--ink); font-family: var(--f-display); }
.panel-block { margin-bottom: 22px; }
.panel-block-title { font-size: 10.5px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-4); margin-bottom: 11px; }

.mini-stat-row { display: flex; gap: 12px; margin-bottom: 20px; }
.mini-stat { flex: 1; background: var(--bg-sunken); border: 1px solid var(--border-2); border-radius: var(--r-md); padding: 13px 14px; }
.mini-stat .l { font-size: 9.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-4); }
.mini-stat .v { font-family: var(--f-display); font-size: 18px; font-weight: 600; color: var(--ink); margin-top: 4px; }

/* ════════════════════════════════════════════════════════════
   SIGNATURE FLOW (modal)
   ════════════════════════════════════════════════════════════ */
.modal-scrim { position: fixed; inset: 0; background: rgba(13,15,26,0.45); backdrop-filter: blur(3px); opacity: 0; pointer-events: none; transition: var(--t); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal-scrim.open { opacity: 1; pointer-events: auto; }
.modal { background: var(--bg-card); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); width: 540px; max-width: 100%; max-height: 90vh; overflow: hidden; display: flex; flex-direction: column; transform: scale(0.96) translateY(8px); transition: transform 0.28s var(--ease); }
.modal-scrim.open .modal { transform: scale(1) translateY(0); }
.modal-head { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.modal-brand { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.modal-brand .esign-logo { width: 24px; height: 24px; border-radius: 7px; background: linear-gradient(135deg, var(--coral), var(--coral-700)); display: flex; align-items: center; justify-content: center; color: #fff; }
.modal-body { padding: 22px 24px; overflow-y: auto; }
.modal-foot { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; background: var(--bg-sunken); }

.doc-preview { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg-sunken); padding: 22px; margin-bottom: 20px; position: relative; }
.doc-preview::before { content: 'ESBORRANY'; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%) rotate(-18deg); font-family: var(--f-display); font-size: 46px; font-weight: 700; color: rgba(13,15,26,0.04); letter-spacing: 0.1em; pointer-events: none; }
.doc-line { height: 8px; border-radius: 4px; background: var(--border); margin-bottom: 9px; }
.doc-line.t { height: 12px; width: 55%; background: var(--border-strong); margin-bottom: 16px; }
.doc-line.s { width: 80%; } .doc-line.m { width: 95%; } .doc-line.x { width: 40%; }

.sign-steps { display: flex; gap: 0; margin-bottom: 20px; }
.sign-step { flex: 1; text-align: center; position: relative; }
.sign-step::after { content: ''; position: absolute; top: 11px; left: 50%; width: 100%; height: 2px; background: var(--border); z-index: 0; }
.sign-step:last-child::after { display: none; }
.sign-dot { width: 24px; height: 24px; border-radius: 50%; background: var(--bg-card); border: 2px solid var(--border-strong); display: flex; align-items: center; justify-content: center; margin: 0 auto 6px; position: relative; z-index: 1; font-size: 11px; font-weight: 600; color: var(--ink-4); transition: var(--t); }
.sign-step.active .sign-dot { background: var(--coral); border-color: var(--coral); color: #fff; }
.sign-step.done .sign-dot { background: var(--green); border-color: var(--green); color: #fff; }
.sign-step.done::after { background: var(--green); }
.sign-step-label { font-size: 10px; color: var(--ink-4); font-weight: 500; }
.sign-step.active .sign-step-label { color: var(--ink); }

.sign-pad { border: 1.5px dashed var(--border-strong); border-radius: var(--r-md); height: 130px; display: flex; align-items: center; justify-content: center; cursor: crosshair; transition: var(--t); position: relative; overflow: hidden; background: var(--bg-card); }
.sign-pad:hover { border-color: var(--coral); }
.sign-pad.signed { border-style: solid; border-color: var(--green); }
.sign-pad-hint { font-size: 12px; color: var(--ink-4); }
.sign-script { font-family: var(--f-display); font-size: 30px; color: var(--ink); font-style: italic; font-weight: 500; opacity: 0; transition: opacity 0.4s; }
.sign-pad.signed .sign-script { opacity: 1; }
.sign-pad.signed .sign-pad-hint { display: none; }

.consent { display: flex; gap: 10px; align-items: flex-start; padding: 13px; background: var(--bg-sunken); border-radius: var(--r-md); margin-top: 16px; }
.consent input { margin-top: 2px; accent-color: var(--coral); width: 15px; height: 15px; }
.consent label { font-size: 11.5px; color: var(--ink-3); line-height: 1.5; }

.sign-success { text-align: center; padding: 18px 0; }
.sign-check { width: 64px; height: 64px; border-radius: 50%; background: var(--green-tint); display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; animation: pop 0.5s var(--ease) both; }
@keyframes pop { 0% { transform: scale(0); } 70% { transform: scale(1.1); } 100% { transform: scale(1); } }
.sign-success h3 { font-family: var(--f-display); font-size: 19px; font-weight: 600; margin-bottom: 7px; }
.sign-success p { font-size: 12.5px; color: var(--ink-3); }
.sign-receipt { margin-top: 18px; text-align: left; background: var(--bg-sunken); border-radius: var(--r-md); padding: 14px 16px; font-size: 11.5px; }
.sign-receipt .rr { display: flex; justify-content: space-between; padding: 5px 0; color: var(--ink-3); }
.sign-receipt .rr b { color: var(--ink); font-weight: 600; }

/* ════════════════════════════════════════════════════════════
   TOAST
   ════════════════════════════════════════════════════════════ */
.toast-wrap { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.toast {
  display: flex; align-items: center; gap: 11px; background: var(--ink); color: #fff;
  padding: 12px 18px; border-radius: var(--r-md); font-size: 12.5px; font-weight: 500;
  box-shadow: var(--shadow-lg); animation: toastIn 0.35s var(--ease) both;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
.toast.out { animation: toastOut 0.3s var(--ease) both; }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px) scale(0.97); } }
.toast-ico { width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.toast.ok .toast-ico { background: var(--green); }
.toast.warn .toast-ico { background: var(--amber); }
.toast.info .toast-ico { background: var(--coral); }

/* ── empty / restricted state ── */
.restricted { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 50px 20px; text-align: center; color: var(--ink-4); }
.restricted-ico { width: 52px; height: 52px; border-radius: 14px; background: var(--bg-sunken); display: flex; align-items: center; justify-content: center; margin-bottom: 14px; color: var(--ink-4); }
.restricted h4 { font-family: var(--f-display); font-size: 14px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.restricted p { font-size: 12px; max-width: 320px; line-height: 1.5; }

.tooltip-soft { font-size: 11px; color: var(--ink-4); }
.hr { height: 1px; background: var(--border); margin: 20px 0; border: none; }
