/* ===== Garne CRM — design tokens ===== */
:root{
  --paper:#FFFFFF;
  --sky:#F2F6FC;
  --sky-deep:#E6EEFB;
  --sky-line:#E2E8F3;
  --ink:#0B1626;
  --ink-soft:#33415A;
  --ink-invert:#0B1626; /* always-dark surface (tooltips/toasts) — deliberately NOT overridden in dark theme, since white text on it must stay readable in both themes */
  --slate:#5C6B85;
  --slate-2:#8592AA;
  --visa:#1E43D6;
  --visa-ink:#15308F;
  --visa-soft:#EAF0FD;
  --stamp:#D64526;
  --stamp-soft:#FCEAE4;
  --good:#1B8A5A;
  --good-soft:#E6F5EE;
  --amber:#B7791F;
  --amber-soft:#FCF3DF;
  --radius-lg:18px;
  --radius-md:12px;
  --radius-sm:8px;
  --shadow-card:0 1px 2px rgba(11,22,38,.04), 0 1px 1px rgba(11,22,38,.03);
  --shadow-pop:0 12px 32px rgba(11,22,38,.14), 0 2px 8px rgba(11,22,38,.08);
  --font-display:'Space Grotesk', 'Inter', sans-serif;
  --font-body:'Inter', sans-serif;
  --font-mono:'IBM Plex Mono', monospace;
  --slogan:#E4E9F2;
}

/* Dark theme — same token names, dark values, toggled via [data-theme="dark"] on <html>
   (see setTheme() in store.js). Every component already reads colors through var(--token),
   so this single block re-themes the whole app with no per-component changes needed. */
:root[data-theme="dark"]{
  --paper:#141A24;
  --sky:#1B222E;
  --sky-deep:#222A38;
  --sky-line:#2B3444;
  --ink:#ECF1F8;
  --ink-soft:#B9C3D6;
  --slate:#8B96AC;
  --slate-2:#6B7690;
  --visa:#5578F0;
  --visa-ink:#AFC0FA;
  --visa-soft:#1E2A47;
  --stamp:#E8593A;
  --stamp-soft:#3A2420;
  --good:#33B37B;
  --good-soft:#1B3428;
  --amber:#D99A3D;
  --amber-soft:#3A2E14;
  --shadow-card:0 1px 2px rgba(0,0,0,.3), 0 1px 1px rgba(0,0,0,.2);
  --shadow-pop:0 12px 32px rgba(0,0,0,.45), 0 2px 8px rgba(0,0,0,.3);
  --slogan:#232C3B;
}

*{box-sizing:border-box;}
html,body{margin:0;padding:0;}
svg{width:1em; height:1em; flex-shrink:0; display:inline-block;}
body{
  background:var(--paper);
  color:var(--ink);
  font-family:var(--font-body);
  -webkit-font-smoothing:antialiased;
  font-size:14px;
  line-height:1.5;
}
h1,h2,h3,h4{font-family:var(--font-display); color:var(--ink); margin:0; letter-spacing:-0.01em;}
::selection{background:var(--visa-soft); color:var(--visa-ink);}
a{color:inherit;}
button{font-family:inherit;}

::-webkit-scrollbar{width:10px; height:10px;}
::-webkit-scrollbar-track{background:transparent;}
::-webkit-scrollbar-thumb{background:var(--sky-line); border-radius:8px; border:2px solid var(--paper);}
::-webkit-scrollbar-thumb:hover{background:var(--slate-2);}

.mono{font-family:var(--font-mono);}

/* ===== App shell ===== */
.shell{display:flex; height:100vh; overflow:hidden;}

.rail{
  width:76px;
  background:var(--paper);
  border-right:1px solid var(--sky-line);
  display:flex; flex-direction:column; align-items:center;
  padding:18px 0 14px;
  flex-shrink:0;
  z-index:20;
}
.rail-logo{
  width:40px; height:40px; border-radius:12px;
  background:linear-gradient(135deg, var(--visa), var(--visa-ink));
  display:flex; align-items:center; justify-content:center;
  color:white; font-family:var(--font-display); font-weight:700; font-size:15px;
  margin-bottom:22px;
  box-shadow:0 4px 10px rgba(30,67,214,.25);
}
.rail-logo svg{width:23px; height:23px;}
.rail-nav{display:flex; flex-direction:column; gap:4px; flex:1; width:100%; align-items:center;}
.rail-item{
  width:52px; height:52px; border-radius:14px;
  display:flex; align-items:center; justify-content:center;
  color:var(--slate); cursor:pointer; position:relative;
  transition:background .15s ease, color .15s ease;
  border:none; background:none;
}
.rail-item svg{width:22px; height:22px; stroke-width:2.3;}
.rail-item:hover{background:var(--sky); color:var(--ink);}
.rail-item.active{background:var(--visa-soft); color:var(--visa);}
.rail-item .dot{
  position:absolute; top:9px; right:10px;
  width:8px; height:8px; border-radius:50%;
  background:var(--stamp); border:2px solid var(--paper);
}
.rail-tip{
  position:fixed; left:70px; background:var(--ink-invert); color:white;
  font-size:12px; padding:6px 10px; border-radius:8px; white-space:nowrap;
  pointer-events:none; z-index:100; font-weight:500;
  box-shadow:var(--shadow-pop);
}

.main{flex:1; display:flex; flex-direction:column; min-width:0; background:var(--sky); }

.topbar{
  height:64px; flex-shrink:0; background:var(--paper); border-bottom:1px solid var(--sky-line);
  display:flex; align-items:center; gap:16px; padding:0 24px;
}
.search-box{
  flex:1; max-width:420px; height:38px; background:var(--sky); border-radius:10px;
  display:flex; align-items:center; gap:8px; padding:0 12px; color:var(--slate-2);
}
/* The search box draws its own pill, so the input inside it stays bare. Written with the same
   :not() chain as the element-level control rule further down, because that rule counts four
   attribute selectors and would otherwise out-specify a plain `.search-box input`. */
.search-box input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]){
  border:none; background:none; outline:none; box-shadow:none; padding:0; border-radius:0;
  font-size:13.5px; color:var(--ink); width:100%; font-family:var(--font-body);
}
.search-box svg{width:16px; height:16px; flex-shrink:0;}

.topbar-spacer{flex:1;}
/* The line the firm sells with, sitting in the empty stretch of the top bar. It takes the place
   of the old spacer, so it also does the spacer's job of pushing the controls to the right.
   Deliberately barely-there: it should register once and then stop being noticed, so it is
   drawn a shade off the bar itself rather than in any real colour. Hidden on narrow screens,
   where that stretch belongs to the search box and the controls. */
.topbar-slogan{
  flex:1; min-width:0; text-align:center; padding:18px 12px;
  font-family:var(--font-display); font-weight:700; font-size:19px; line-height:1;
  letter-spacing:.02em; color:var(--slogan);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  user-select:none; pointer-events:none;
}
@media (max-width:1240px){ .topbar-slogan{font-size:15px; padding:18px 8px;} }
@media (max-width:1000px){ .topbar-slogan{display:none;} .topbar .search-box{flex:1;} }

.role-switch{
  display:flex; align-items:center; gap:6px; background:var(--sky); border-radius:10px; padding:4px; font-size:12.5px;
}
.role-switch button{
  border:none; background:none; padding:6px 10px; border-radius:7px; cursor:pointer; color:var(--slate); font-weight:600;
  font-family:var(--font-body);
}
.role-switch button.active{background:var(--paper); color:var(--visa); box-shadow:var(--shadow-card);}

.icon-btn{
  width:38px; height:38px; border-radius:10px; border:none; background:var(--sky);
  display:flex; align-items:center; justify-content:center; color:var(--ink-soft); cursor:pointer; position:relative;
  transition:background .15s, transform .1s ease;
}
.icon-btn:hover{background:var(--sky-deep);}
.icon-btn:active{transform:scale(.92);}
.icon-btn svg{width:17px; height:17px;}
.badge-count{
  position:absolute; top:-4px; right:-4px; min-width:17px; height:17px; border-radius:9px;
  background:var(--stamp); color:white; font-size:10px; font-weight:700; display:flex; align-items:center; justify-content:center;
  padding:0 4px; border:2px solid var(--paper); font-family:var(--font-body);
}
/* An unanswered question pulses until it's dealt with — a static count reads the same as the
   ordinary "you have new tasks" badge and gets tuned out. */
.badge-count--ask{animation:badge-pulse 1.6s ease-in-out infinite;}
/* Deploy notice. Deliberately a dismissible strip and not a blocking overlay: shipping a fix
   must not stop 55 people mid-sentence, so the tab just offers the reload. */
.update-bar{
  position:fixed; left:50%; transform:translateX(-50%); bottom:18px; z-index:80;
  display:flex; align-items:center; gap:12px; padding:10px 12px 10px 16px;
  background:var(--paper); border:1px solid var(--sky-line); border-radius:14px;
  box-shadow:0 14px 38px rgba(20,30,60,.16);
}
.update-bar-text{font-size:13px; font-weight:600; color:var(--ink);}
.update-bar-ic{display:flex; color:var(--visa);}
.update-bar-ic svg{width:17px; height:17px;}
@keyframes badge-pulse{0%,100%{transform:scale(1);}50%{transform:scale(1.22);}}

.avatar{
  width:41px; height:41px; border-radius:12px; background:var(--visa-soft); color:var(--visa-ink);
  display:flex; align-items:center; justify-content:center; font-weight:700; font-size:15px; font-family:var(--font-display);
  flex-shrink:0;
}
.avatar.sm{width:30px; height:30px; font-size:12px; border-radius:8px;}

/* Presence dot. Sits on the avatar rather than beside the name so it reads at a glance in a
   list, the way it does in a messenger. The ring is the page background, not white — otherwise
   it draws a white halo in dark theme. */
.avatar-wrap{position:relative; display:inline-flex; flex-shrink:0;}

/* Avatar crop viewport. The square is the visible area; everything outside is dimmed so it is
   obvious what will be kept. */
.crop-stage{
  position:relative; overflow:hidden; border-radius:16px; background:var(--sky-deep);
  cursor:grab; touch-action:none; user-select:none; flex-shrink:0;
}
.crop-stage:active{cursor:grabbing;}
.crop-stage img{position:absolute; left:0; top:0; max-width:none; pointer-events:none; display:block;}
.crop-mask{
  position:absolute; inset:0; pointer-events:none; border-radius:16px;
  box-shadow:inset 0 0 0 2px rgba(255,255,255,.85), inset 0 0 0 3px rgba(11,22,38,.12);
}

.online-dot{
  position:absolute; left:-2px; bottom:-2px; width:11px; height:11px; border-radius:99px;
  background:#22C55E; border:2px solid var(--paper); box-shadow:0 0 0 1px rgba(11,22,38,.06);
}
.avatar-wrap .avatar.sm + .online-dot{width:9px; height:9px; border-width:1.5px;}
.avatar-wrap .avatar.lg + .online-dot{width:14px; height:14px;}

.avatar.lg{width:64px; height:64px; font-size:21px; border-radius:16px;}

.user-chip{display:flex; align-items:center; gap:10px; cursor:pointer; padding:4px 6px 4px 4px; border-radius:10px;}
.user-chip:hover{background:var(--sky);}
.user-chip .name{font-size:13px; font-weight:600; color:var(--ink);}
.user-chip .role{font-size:11.5px; color:var(--slate);}

.view{flex:1; overflow-y:auto; padding:28px 32px 60px;}

/* ===== Page header ===== */
.page-head{margin-bottom:24px;}
.page-head h1{font-size:24px; font-weight:700;}
.page-head p{color:var(--slate); font-size:13.5px; margin-top:4px;}
.eyebrow{
  font-size:11px; font-weight:700; letter-spacing:.08em; text-transform:uppercase; color:var(--visa);
  margin-bottom:6px; display:block;
}

/* ===== Cards / surfaces ===== */
.card{
  background:var(--paper); border:1px solid var(--sky-line); border-radius:var(--radius-lg);
  box-shadow:var(--shadow-card);
}
.pad-lg{padding:24px;}
.pad-md{padding:18px;}

/* ===== Stat tiles ===== */
.stat-grid{display:grid; grid-template-columns:repeat(4,1fr); gap:14px; margin-bottom:24px;}
.stat-tile{
  background:var(--paper); border:1px solid var(--sky-line); border-radius:var(--radius-lg);
  padding:18px 20px; display:flex; flex-direction:column; gap:10px; transition:border-color .15s, box-shadow .15s, transform .15s;
}
.stat-tile[style*="cursor:pointer"]:hover{border-color:var(--visa); box-shadow:var(--shadow-card); transform:translateY(-1px);}
.stat-tile .top{display:flex; align-items:center; justify-content:space-between;}
.stat-tile .icon{width:34px; height:34px; border-radius:10px; display:flex; align-items:center; justify-content:center;}
.stat-tile .icon svg{width:17px; height:17px;}
.stat-tile .num{font-family:var(--font-display); font-size:30px; font-weight:700; line-height:1;}
.stat-tile .label{color:var(--slate); font-size:12.5px; font-weight:500;}
.stat-tile .trend{font-size:11.5px; font-weight:600; padding:2px 7px; border-radius:6px;}

/* ===== Stamp rail — signature component ===== */
.stamp-rail{display:flex; align-items:flex-start; overflow-x:auto; overflow-y:hidden; padding-bottom:2px;}
.stamp-node{display:flex; flex-direction:column; align-items:center; position:relative; flex:1 1 0; min-width:72px;}
.stamp-ring{
  width:34px; height:34px; border-radius:50%; display:flex; align-items:center; justify-content:center;
  border:2px solid var(--sky-line); background:var(--paper); color:var(--slate-2); font-size:12px; font-weight:700;
  font-family:var(--font-mono); flex-shrink:0; z-index:2; transition:all .2s;
}
.stamp-node.done .stamp-ring{
  border-color:var(--visa); background:var(--visa); color:white;
  box-shadow:0 0 0 3px var(--visa-soft);
}
.stamp-node.current .stamp-ring{
  border:2.5px solid var(--stamp); background:var(--stamp-soft); color:var(--stamp);
  box-shadow:0 0 0 4px var(--stamp-soft);
  transform:rotate(-6deg);
}
.stamp-node .line{
  position:absolute; top:17px; left:50%; width:100%; height:2px; background:var(--sky-line); z-index:1;
}
.stamp-node.done .line{background:var(--visa);}
.stamp-node:last-child .line{display:none;}
.stamp-label{margin-top:8px; font-size:10.5px; text-align:center; color:var(--slate); font-weight:600; white-space:nowrap; line-height:1.25; padding:0 2px;}
.stamp-node.current .stamp-label{color:var(--stamp);}
.stamp-node.done .stamp-label{color:var(--ink-soft);}

/* compact inline stamp rail for headers */
.stamp-rail.compact .stamp-ring{width:24px; height:24px; font-size:10px;}
.stamp-rail.compact .stamp-node{min-width:26px;}
.stamp-rail.compact .stamp-node .line{top:11px;}
.stamp-rail.compact .stamp-label{display:none;}

/* ===== Buttons ===== */
.btn{
  display:inline-flex; align-items:center; gap:7px; font-weight:600; font-size:13px; border-radius:10px;
  padding:9px 15px; cursor:pointer; border:1px solid transparent; font-family:var(--font-body); transition:all .12s;
  white-space:nowrap;
}
.btn:active:not(:disabled){transform:scale(.97);}
.btn svg{width:15px; height:15px;}
.btn-primary{background:var(--visa); color:white;}
.btn-primary:hover{background:var(--visa-ink);}
.btn-ghost{background:var(--sky); color:var(--ink-soft);}
.btn-ghost:hover{background:var(--sky-deep);}
.btn-outline{background:var(--paper); color:var(--ink-soft); border-color:var(--sky-line);}
.btn-outline:hover{border-color:var(--slate-2);}
.btn-danger{background:var(--stamp-soft); color:var(--stamp);}
.btn-danger:hover{filter:brightness(.93);}
/* A secondary action that still reads as an action: the tinted fill alone was pale enough next to
   a primary button to look disabled, so it keeps a faint border of its own colour. */
.btn-soft{background:var(--visa-soft); color:var(--visa); border-color:color-mix(in srgb, var(--visa) 22%, transparent);}
.btn-soft:hover{filter:brightness(.96);}
.btn-sm{padding:6px 11px; font-size:12px; border-radius:8px;}
.btn:disabled{opacity:.45; cursor:not-allowed;}

/* ===== Callouts — short inline notes that need to read as a note, not as body text ===== */
.callout{
  font-size:12px; line-height:1.5; padding:9px 12px; border-radius:10px;
  border:1px solid transparent; color:var(--ink-soft); background:var(--sky);
}
.callout-amber{background:var(--amber-soft); border-color:var(--amber); color:var(--amber);}
.callout-visa{background:var(--visa-soft); border-color:transparent; color:var(--visa-ink);}
.callout-stamp{background:var(--stamp-soft); border-color:transparent; color:var(--stamp);}
.callout-good{background:var(--good-soft); border-color:transparent; color:var(--good);}

/* ===== Badges / pills ===== */
.pill{display:inline-flex; align-items:center; gap:5px; font-size:11px; font-weight:700; padding:3px 9px; border-radius:99px; letter-spacing:.02em; white-space:nowrap;}
.pill svg{width:11px; height:11px; flex-shrink:0;}
.pill-visa{background:var(--visa-soft); color:var(--visa-ink);}
.pill-good{background:var(--good-soft); color:var(--good);}
.pill-amber{background:var(--amber-soft); color:var(--amber);}
.pill-stamp{background:var(--stamp-soft); color:var(--stamp);}
.pill-slate{background:var(--sky); color:var(--slate);}
.pill-test{background:transparent; color:var(--slate-2); border:1px solid var(--sky-line); font-size:9px; font-weight:600; padding:1px 6px;}

/* ===== Kanban ===== */
.kanban-wrap{position:relative;}
/* macOS hides scrollbars until you scroll, and a plain mouse wheel doesn't scroll sideways —
   so the board needs a visible track and buttons, or the right-hand stages are unreachable. */
.kanban{display:flex; gap:16px; overflow-x:auto; padding-bottom:10px; align-items:flex-start; scroll-behavior:smooth;}
.kanban::-webkit-scrollbar{height:10px;}
.kanban::-webkit-scrollbar-track{background:var(--sky); border-radius:6px;}
.kanban::-webkit-scrollbar-thumb{background:var(--sky-line); border-radius:6px;}
.kanban::-webkit-scrollbar-thumb:hover{background:var(--slate);}
.kanban-nav{
  position:sticky; position:absolute; top:120px; z-index:20;
  width:34px; height:34px; border-radius:50%; border:1px solid var(--sky-line);
  background:var(--paper); box-shadow:var(--shadow-pop); cursor:pointer;
  display:flex; align-items:center; justify-content:center; color:var(--ink-soft);
}
.kanban-nav:hover{color:var(--visa); border-color:var(--visa);}
.kanban-nav svg{width:16px; height:16px;}
.kanban-nav--left{left:6px;}
.kanban-nav--right{right:6px;}
.kanban-col{
  width:272px; flex-shrink:0; background:var(--sky); border-radius:var(--radius-lg); padding:12px; border:1px solid var(--sky-line);
}
.kanban-col-head{padding:6px 6px 12px; display:flex; align-items:center; gap:10px;}
.kanban-col-head .stamp-ring{width:28px; height:28px; font-size:11px;}
.kanban-col-title{font-size:12.5px; font-weight:700; color:var(--ink-soft); flex:1; line-height:1.25;}
.kanban-col-count{font-family:var(--font-mono); font-size:11px; color:var(--slate); background:var(--paper); border-radius:6px; padding:2px 6px; border:1px solid var(--sky-line);}
.kanban-list{min-height:40px; display:flex; flex-direction:column; gap:10px;}
.kanban-card{
  background:var(--paper); border:1px solid var(--sky-line); border-radius:var(--radius-md); padding:13px 14px;
  cursor:grab; box-shadow:var(--shadow-card); transition:box-shadow .15s, transform .15s;
}
.kanban-card:hover{box-shadow:var(--shadow-pop); transform:translateY(-1px);}
.kanban-card.sortable-ghost{opacity:.35;}
.kanban-card.sortable-drag{box-shadow:var(--shadow-pop); cursor:grabbing;}
.kanban-card-top{display:flex; align-items:center; gap:8px; margin-bottom:9px;}
.kanban-card-name{font-weight:600; font-size:13px; flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.kanban-card-meta{display:flex; align-items:center; justify-content:space-between; margin-top:10px;}
.kanban-card-assignees{display:flex;}
.kanban-card-assignees .avatar{margin-left:-6px; border:2px solid var(--paper); box-shadow:0 0 0 1px rgba(11,22,38,.06);}
.kanban-card-assignees .avatar:first-child{margin-left:0;}

/* ===== Tabs ===== */
.tabbar{display:flex; gap:4px; border-bottom:1px solid var(--sky-line); margin-bottom:22px; overflow-x:auto;}
.tab{
  /* Inactive tabs used to be the same washed-out grey as disabled text, so «Огляд», «Доказова
     база» and the rest read as unavailable rather than clickable. */
  padding:11px 4px; margin-right:13px; font-size:12.5px; font-weight:600; color:var(--ink); cursor:pointer;
  border:none; border-bottom:2.5px solid transparent; white-space:nowrap; display:flex; align-items:center; gap:5px;
  transition:color .15s ease, border-color .15s ease;
  /* .tab is used on both <div> and <button>; without this reset the button variants render with
     the browser's own grey chrome and stop looking like tabs at all. */
  background:none; font-family:inherit; line-height:1.2;
}
.tab:hover{color:var(--visa);}
.tab.active{color:var(--visa); border-color:var(--visa);}
.tab .lock{width:12px; height:12px; opacity:.5;}
/* Marks a tab whose panel already holds content, so it is visible without switching to it. */
.tab-dot{width:6px; height:6px; border-radius:99px; background:var(--good); flex-shrink:0;}

/* ===== Tables / rows ===== */
.row-list{display:flex; flex-direction:column;}
.row-item{display:flex; align-items:center; gap:14px; padding:13px 4px; border-bottom:1px solid var(--sky-line); border-radius:8px; transition:background .12s ease;}
.row-item:last-child{border-bottom:none;}
.row-item[style*="cursor:pointer"]:hover{background:var(--sky);}

/* ===== Data table (list view) ===== */
.data-table{width:100%; border-collapse:collapse; font-size:12.5px;}
.data-table th{text-align:left; padding:10px 14px; font-size:10.5px; font-weight:700; text-transform:uppercase; letter-spacing:.05em; color:var(--slate); border-bottom:1px solid var(--sky-line); white-space:nowrap;}
.data-table td{padding:12px 14px; border-bottom:1px solid var(--sky-line); vertical-align:middle;}
.data-table tbody tr{cursor:pointer; transition:background .12s;}
.data-table tbody tr:hover{background:var(--sky);}
.data-table tbody tr:last-child td{border-bottom:none;}
.deadline-chip{display:inline-flex; align-items:center; gap:5px; font-size:11.5px; font-weight:700; padding:3px 10px; border-radius:99px; white-space:nowrap;}
.stack-avatars{display:flex; align-items:center;}
.stack-avatars .avatar{margin-left:-8px; border:2px solid var(--paper); box-shadow:0 0 0 1px rgba(11,22,38,.06);}
.stack-avatars .avatar:first-child{margin-left:0;}

/* ===== Empty states ===== */
.empty{text-align:center; padding:50px 20px; color:var(--slate);}
.empty svg{width:38px; height:38px; color:var(--slate-2); margin-bottom:12px;}
.empty h3{font-size:14.5px; color:var(--ink-soft); margin-bottom:5px;}
.empty p{font-size:12.5px;}

/* ===== Notification popover ===== */
.pop{
  position:absolute; top:52px; right:0; width:360px; background:var(--paper); border-radius:var(--radius-lg);
  box-shadow:var(--shadow-pop); border:1px solid var(--sky-line); z-index:200; overflow:hidden;
  transform-origin:top right; animation:popdown .14s cubic-bezier(.16,1,.3,1);
}
@keyframes popdown{from{transform:scale(.95) translateY(-4px); opacity:0;} to{transform:scale(1) translateY(0); opacity:1;}}
.pop-head{padding:14px 16px; border-bottom:1px solid var(--sky-line); font-weight:700; font-size:13.5px; display:flex; justify-content:space-between; align-items:center;}
.pop-list{max-height:400px; overflow-y:auto;}
.pop-item{padding:12px 16px; display:flex; gap:11px; border-bottom:1px solid var(--sky-line); cursor:pointer;}
.pop-item:hover{background:var(--sky);}
.pop-item .dot-icon{width:32px; height:32px; border-radius:9px; display:flex; align-items:center; justify-content:center; flex-shrink:0;}
.pop-item .dot-icon svg{width:15px; height:15px;}
.pop-item .txt{font-size:12.5px; line-height:1.4;}
.pop-item .txt b{font-weight:700;}
.pop-item .time{font-size:11px; color:var(--slate-2); margin-top:3px;}
.pop-item.unread{background:var(--visa-soft)}
.pop-item.unread:hover{background:var(--sky-deep)}

/* ===== Modal / drawer ===== */
.overlay{position:fixed; inset:0; background:rgba(11,22,38,.42); z-index:300; display:flex; align-items:center; justify-content:center; backdrop-filter:blur(2px); animation:overlayin .16s ease;}
@keyframes overlayin{from{opacity:0;} to{opacity:1;}}
.drawer{position:fixed; top:0; right:0; bottom:0; width:66.6667vw; max-width:1100px; min-width:480px; background:var(--paper); z-index:301; box-shadow:var(--shadow-pop); display:flex; flex-direction:column; animation:slidein .22s cubic-bezier(.16,1,.3,1);}
@keyframes slidein{from{transform:translateX(24px); opacity:0;} to{transform:translateX(0); opacity:1;}}
.modal{width:480px; max-width:92vw; background:var(--paper); border-radius:var(--radius-lg); box-shadow:var(--shadow-pop); animation:popin .16s cubic-bezier(.16,1,.3,1);}
/* The document preview popup. A class rather than inline sizing, so the phone breakpoint below
   can widen it — an inline width beats any max-width a media query could set. */
.modal-preview{width:70vw; max-width:70vw; height:70vh; display:flex; flex-direction:column;}
@keyframes popin{from{transform:scale(.96); opacity:0;} to{transform:scale(1); opacity:1;}}
.drawer-head{padding:20px 22px; border-bottom:1px solid var(--sky-line); display:flex; align-items:center; justify-content:space-between;}
.drawer-body{padding:22px; overflow-y:auto; flex:1;}
.drawer-foot{padding:16px 22px; border-top:1px solid var(--sky-line); display:flex; gap:10px; justify-content:flex-end;}

.field{margin-bottom:16px;}
.field label{display:block; font-size:12.5px; font-weight:600; color:var(--ink-soft); margin-bottom:6px;}

/* Controls are styled at the element level, not only inside .field. Half the app's inputs live in
   plain flex rows next to a button, and when the styling was scoped to .field those rendered as
   raw browser widgets — the reason parts of the UI looked unfinished. .field now only owns
   spacing and labels. */
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]),
select, textarea{
  width:100%; border:1px solid var(--sky-line); background:var(--sky); border-radius:10px; padding:10px 12px;
  font-size:13.5px; font-family:var(--font-body); color:var(--ink); outline:none;
  transition:border-color .12s, background .12s, box-shadow .12s;
}
/* A select sitting inline — the stage picker next to a client's name, a period picker in a card
   header — has to be as wide as the option it shows, not as wide as its container. Full width is
   right only inside a .field, where it lines up with the inputs above and below it. */
select{width:auto; max-width:100%;}
.field select{width:100%;}
input[type="checkbox"], input[type="radio"]{width:auto; flex-shrink:0; accent-color:var(--visa);}
/* background-COLOR, not the shorthand: the shorthand would wipe the select chevron on focus. */
input:focus, select:focus, textarea:focus{border-color:var(--visa); background-color:var(--paper); box-shadow:0 0 0 3px var(--visa-soft);}
input::placeholder, textarea::placeholder{color:var(--slate-2);}
input:disabled, select:disabled, textarea:disabled{opacity:.55; cursor:not-allowed;}
/* No blanket min-height: a textarea that asks for rows="2" is a one-line note, and forcing it to
   70px made every short field in the criterion drawer and the brief look bloated. The floor stays
   only where the markup gives no rows hint at all. */
textarea{resize:vertical; line-height:1.55;}
textarea:not([rows]){min-height:70px;}
.field textarea:not([rows]){min-height:70px;}
/* Native select chrome differs wildly between macOS and Windows; one drawn chevron keeps the
   control the same height and shape as the inputs beside it. */
select:not([multiple]){
  appearance:none; -webkit-appearance:none; padding-right:32px; cursor:pointer;
  background-image:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHZpZXdCb3g9JzAgMCAyNCAyNCcgZmlsbD0nbm9uZScgc3Ryb2tlPScjNUM2Qjg1JyBzdHJva2Utd2lkdGg9JzIuNCcgc3Ryb2tlLWxpbmVjYXA9J3JvdW5kJyBzdHJva2UtbGluZWpvaW49J3JvdW5kJz48cGF0aCBkPSdNNiA5bDYgNiA2LTYnLz48L3N2Zz4=");
  background-repeat:no-repeat; background-position:right 10px center; background-size:14px;
}
:root[data-theme="dark"] select:not([multiple]){
  background-image:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHZpZXdCb3g9JzAgMCAyNCAyNCcgZmlsbD0nbm9uZScgc3Ryb2tlPScjOEI5NkFDJyBzdHJva2Utd2lkdGg9JzIuNCcgc3Ryb2tlLWxpbmVjYXA9J3JvdW5kJyBzdHJva2UtbGluZWpvaW49J3JvdW5kJz48cGF0aCBkPSdNNiA5bDYgNiA2LTYnLz48L3N2Zz4=");
}

/* ===== Evidence cards ===== */
.evidence-grid{display:grid; grid-template-columns:repeat(2,1fr); gap:12px;}
.evidence-card{border:1px solid var(--sky-line); border-radius:var(--radius-md); padding:14px 16px; display:flex; gap:12px; align-items:flex-start; transition:background .15s, border-color .15s;}
.evidence-card .ic{width:36px; height:36px; border-radius:10px; background:var(--sky); display:flex; align-items:center; justify-content:center; flex-shrink:0;}
.evidence-card .ic svg{width:17px; height:17px; color:var(--slate);}
.evidence-card.filled{background:var(--good-soft); border-color:var(--good);}
.evidence-card.filled .ic{background:var(--paper);}
.evidence-card.filled .ic svg{color:var(--good);}
.evidence-card.not-planned{opacity:.5; filter:grayscale(.6);}
.evidence-card h4{font-size:13px; font-weight:700; margin-bottom:3px;}
.evidence-card p{font-size:11.5px; color:var(--slate);}
.evidence-links{display:flex; flex-wrap:wrap; gap:6px; margin-top:8px;}
.link-chip{display:inline-flex; align-items:center; gap:5px; background:var(--sky); border-radius:7px; padding:4px 9px; font-size:11px; font-weight:600; color:var(--ink-soft); max-width:100%; min-width:0;}
.link-chip svg{width:11px; height:11px;}
/* File names coming from Drive run to 200 characters. Without this a single one stretches its
   card past the grid and pushes the whole column off-screen. The full name stays available in
   the tooltip. */
.link-chip > span:first-child{overflow:hidden; text-overflow:ellipsis; white-space:nowrap; min-width:0; display:inline-block; max-width:46ch; vertical-align:bottom;}
.link-chip > span:first-child svg{vertical-align:-1px; margin-right:4px;}

/* ===== File tiles — Finder-style icon view for exhibits ===== */
.file-grid{display:grid; grid-template-columns:repeat(auto-fill, minmax(104px, 1fr)); gap:12px;}
.file-tile{cursor:pointer; min-width:0;}
.file-tile-thumb{
  position:relative; aspect-ratio:3/4; border:1px solid var(--sky-line); border-radius:10px;
  background:var(--paper); overflow:hidden; display:flex; align-items:center; justify-content:center;
  box-shadow:var(--shadow-card); transition:border-color .12s, transform .12s, box-shadow .12s;
}
.file-tile:hover .file-tile-thumb{border-color:var(--visa); transform:translateY(-1px); box-shadow:var(--shadow-pop);}
.file-tile-thumb img{width:100%; height:100%; object-fit:cover; object-position:top center; display:block;}
.file-tile-skel{
  width:100%; height:100%;
  background:linear-gradient(90deg, var(--sky) 25%, var(--sky-deep) 37%, var(--sky) 63%);
  background-size:400% 100%; animation:shimmer 1.3s ease infinite;
}
.file-tile-generic{display:flex; flex-direction:column; align-items:center; gap:6px; color:var(--slate-2);}
.file-tile-generic svg{width:26px; height:26px;}
.file-tile-ext{
  font-family:var(--font-mono); font-size:9.5px; font-weight:500; text-transform:uppercase;
  letter-spacing:.06em; background:var(--sky); color:var(--ink-soft); padding:1px 6px; border-radius:4px;
}
/* The exhibit number is the thing people cite in the petition, so it stays readable over any
   thumbnail rather than sitting in the caption where a long file name would push it out. */
.file-tile-exhibit{
  position:absolute; left:5px; top:5px; z-index:2; min-width:18px; height:18px; padding:0 5px;
  border-radius:5px; background:rgba(11,22,38,.72); color:#fff;
  font-family:var(--font-mono); font-size:10px; font-weight:500;
  display:flex; align-items:center; justify-content:center;
}
.file-tile-remove{
  position:absolute; right:4px; top:4px; z-index:2; width:20px; height:20px; border-radius:6px;
  border:none; background:rgba(11,22,38,.55); color:#fff; cursor:pointer;
  display:flex; align-items:center; justify-content:center; opacity:0; transition:opacity .12s;
}
.file-tile-remove svg{width:11px; height:11px;}
.file-tile:hover .file-tile-remove{opacity:1;}
.file-tile-remove:hover{background:var(--stamp);}
.file-tile-name{
  margin-top:6px; font-size:11px; line-height:1.35; color:var(--ink-soft); text-align:center;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;
  word-break:break-word;
}

/* ===== Skeleton / loading ===== */
.skel{background:linear-gradient(90deg, var(--sky) 25%, var(--sky-deep) 37%, var(--sky) 63%); background-size:400% 100%; animation:shimmer 1.3s ease infinite; border-radius:8px;}
@keyframes shimmer{0%{background-position:100% 0;} 100%{background-position:0 0;}}

/* ===== Toast ===== */
.toast-wrap{position:fixed; bottom:22px; right:22px; z-index:500; display:flex; flex-direction:column; gap:8px;}
.toast{background:var(--ink-invert); color:white; padding:12px 16px; border-radius:11px; font-size:13px; font-weight:500; box-shadow:var(--shadow-pop); display:flex; align-items:center; gap:9px; animation:toastin .2s ease;}
.toast svg{width:15px; height:15px; color:#8FE3B8; flex-shrink:0;}
@keyframes toastin{from{transform:translateY(8px); opacity:0;} to{transform:translateY(0); opacity:1;}}

/* ===== Task/reply popup ===== */
.popup-wrap{position:fixed; bottom:106px; right:22px; z-index:600; display:flex; flex-direction:column; gap:12px; max-width:360px; pointer-events:none;}
.task-popup{
  position:relative; overflow:hidden; pointer-events:auto; cursor:pointer;
  display:flex; align-items:flex-start; gap:12px;
  background:var(--ink-invert); color:white; border-radius:16px; padding:14px 16px;
  box-shadow:0 16px 40px rgba(0,0,0,.35), 0 2px 10px rgba(0,0,0,.25);
  border:1px solid rgba(255,255,255,.08);
  animation:popupin .32s cubic-bezier(.2,.9,.3,1.3);
  transition:transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.task-popup:hover{transform:translateY(-2px); border-color:rgba(255,255,255,.18); box-shadow:0 20px 48px rgba(0,0,0,.42), 0 2px 10px rgba(0,0,0,.3);}
.task-popup:hover .task-popup-glow{opacity:1;}
.task-popup-glow{
  position:absolute; inset:0; pointer-events:none; opacity:.55; transition:opacity .2s ease;
  background:radial-gradient(120px 90px at -10% -10%, rgba(85,120,240,.35), transparent 70%);
}
.task-popup--task_reply .task-popup-glow{background:radial-gradient(120px 90px at -10% -10%, rgba(66,201,140,.35), transparent 70%);}
.task-popup-ic{
  position:relative; z-index:1; flex-shrink:0; width:38px; height:38px; border-radius:11px;
  display:flex; align-items:center; justify-content:center;
  background:rgba(85,120,240,.18); color:#8FA6FF;
}
.task-popup-ic svg{width:19px; height:19px;}
.task-popup--task_reply .task-popup-ic{background:rgba(66,201,140,.18); color:#8FE3B8;}
/* A question addressed to you blocks a colleague until you answer, so it reads as urgent and
   (see pushTaskPopup) stays on screen until dismissed instead of fading after a few seconds. */
.task-popup--task_question .task-popup-glow{background:radial-gradient(120px 90px at -10% -10%, rgba(231,76,76,.38), transparent 70%);}
.task-popup--task_question .task-popup-ic{background:rgba(231,76,76,.20); color:#FF9C9C;}
.task-popup--task_question{border-color:rgba(231,76,76,.45);}
.task-popup-body{position:relative; z-index:1; flex:1; min-width:0;}
.task-popup-title{font-size:12px; font-weight:700; letter-spacing:.02em; text-transform:uppercase; color:rgba(255,255,255,.55); margin-bottom:3px;}
.task-popup-text{font-size:13.5px; font-weight:500; line-height:1.4; color:white; word-break:break-word;}
.task-popup-x{
  position:relative; z-index:1; flex-shrink:0; width:22px; height:22px; border-radius:7px; border:none;
  display:flex; align-items:center; justify-content:center; background:transparent; color:rgba(255,255,255,.4);
  cursor:pointer; transition:background .15s ease, color .15s ease;
}
.task-popup-x:hover{background:rgba(255,255,255,.12); color:white;}
.task-popup-x svg{width:13px; height:13px;}
@keyframes popupin{from{transform:translateX(24px) scale(.96); opacity:0;} to{transform:translateX(0) scale(1); opacity:1;}}
@media (max-width:640px){.popup-wrap{right:12px; left:12px; max-width:none;}}

/* ===== misc ===== */
.divider{height:1px; background:var(--sky-line); margin:18px 0;}
.hint{font-size:11.5px; color:var(--slate-2);}
/* Client card: slightly larger, darker secondary text for readability. */
.client-card-view .hint{font-size:13px; color:var(--ink);}
.client-card-view .section-title{font-size:14.5px;}
.section-title{font-size:13.5px; font-weight:700; margin-bottom:12px; color:var(--ink);}
.flex-between{display:flex; align-items:center; justify-content:space-between;}
/* One line of text that shrinks and truncates instead of pushing its neighbours out of the card.
   Used wherever the text is user data (a folder name, a client name, a file name) and therefore
   has no length anyone controls. */
.ellipsis-row{min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.ellipsis-row svg{vertical-align:-2px; margin-right:6px;}
.locked-panel{display:flex; flex-direction:column; align-items:center; justify-content:center; padding:60px 20px; color:var(--slate); text-align:center;}
.locked-panel svg{width:32px; height:32px; margin-bottom:10px; color:var(--slate-2);}

@media (max-width: 980px){
  .stat-grid{grid-template-columns:repeat(2,1fr);}
  .evidence-grid{grid-template-columns:1fr;}
}

/* Phones. This matters most for the client dashboard, which clients open on their phone from a
   link. The drawer's min-width of 480px is wider than the screen there, so the page scrolled
   sideways and the close button sat off the edge. */
@media (max-width: 640px){
  .drawer{width:100vw; min-width:0; max-width:100vw;}
  .drawer-head, .drawer-foot{padding:14px 16px;}
  .drawer-body{padding:16px;}
  .drawer-foot{flex-wrap:wrap;}
  .drawer-foot .btn{flex:1 1 auto; justify-content:center;}
  .modal{width:100%; max-width:calc(100vw - 24px);}
  .modal-preview{width:calc(100vw - 16px); max-width:calc(100vw - 16px); height:88vh;}
  .stat-grid{grid-template-columns:1fr;}
  .share-screen{padding:20px 12px;}
  .evidence-card{padding:12px;}
  .tabbar{gap:0;}
  .tab{margin-right:10px; font-size:12px;}
}

/* ===== Login screen ===== */
.login-screen{min-height:100vh; display:flex; align-items:center; justify-content:center; background:var(--sky); padding:20px;}
.login-card{width:100%; max-width:380px; background:var(--paper); border:1px solid var(--sky-line); border-radius:var(--radius-lg); box-shadow:var(--shadow-pop); padding:36px 32px; text-align:center;}
.login-title{font-family:var(--font-display); font-size:22px; font-weight:700; margin-bottom:4px;}
.login-sub{font-size:12.5px; color:var(--slate); margin-bottom:24px;}
.login-card .field{text-align:left; margin-bottom:14px;}
.login-error{color:var(--stamp); font-size:12px; font-weight:600; text-align:left; margin-top:-4px; margin-bottom:10px;}

/* ===== Client-facing share view ===== */
.share-screen{min-height:100vh; background:var(--sky); padding:40px 20px;}
.share-wrap{max-width:640px; margin:0 auto;}
.share-progress-track{height:12px; background:var(--sky-deep); border-radius:99px; overflow:hidden; margin:14px 0 6px;}
.share-progress-fill{height:100%; background:linear-gradient(90deg, var(--visa), var(--good)); border-radius:99px; transition:width .4s ease;}

/* ===== Client brief quiz (ClientView.js) — dedicated sky-blue palette, always light: this
   page is shown to anonymous clients, not staff, so it doesn't follow the app's dark toggle. ===== */
.brief-shell{min-height:100vh; background:linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 50%, #f8fafc 100%); padding-bottom:40px;}
.brief-header{background:rgba(255,255,255,.95); backdrop-filter:blur(12px); border-bottom:1px solid #e2e8f0; padding:16px 20px; position:sticky; top:0; z-index:20; box-shadow:0 2px 12px rgba(0,0,0,.06);}
.brief-header-inner{max-width:640px; margin:0 auto;}
.brief-header-top{display:flex; align-items:center; gap:10px; margin-bottom:12px;}
.brief-eyebrow{font-size:11px; color:#94a3b8; font-weight:700; letter-spacing:.1em; text-transform:uppercase;}
.brief-title{font-size:16px; font-weight:800; color:#1e293b;}
.brief-progress-wrap{display:flex; align-items:center; gap:12px;}
.brief-progress-track{flex:1; height:6px; background:#e2e8f0; border-radius:99px; overflow:hidden;}
.brief-progress-fill{height:100%; background:linear-gradient(90deg, #0ea5e9, #0284c7); border-radius:99px; transition:width .4s ease;}
.brief-progress-pct{font-size:12px; font-weight:700; color:#0ea5e9; min-width:36px; text-align:right;}
.brief-body{max-width:640px; margin:0 auto; padding:28px 20px 0;}
.brief-intro{font-size:12.5px; color:#64748b; margin-bottom:16px; text-align:center;}
.brief-card{background:#fff; border-radius:24px; padding:28px; box-shadow:0 2px 16px rgba(0,0,0,.05);}
.brief-section-title{font-size:13px; font-weight:800; color:#64748b; letter-spacing:.04em; text-transform:uppercase; display:flex; align-items:center; gap:10px;}
.brief-section-title::before{content:''; display:inline-block; width:4px; height:16px; border-radius:99px; background:linear-gradient(180deg, #0ea5e9, #0284c7); flex-shrink:0;}
.brief-question{font-size:17px; font-weight:700; line-height:1.45; color:#1e293b; white-space:pre-line; margin-top:18px;}
.brief-hint{font-size:13px; color:#64748b; line-height:1.55; white-space:pre-line; margin-top:12px; background:#f0f9ff; border:1px solid #e0f2fe; border-radius:12px; padding:12px 14px;}
.brief-textarea{width:100%; margin-top:18px; padding:14px 16px; border-radius:12px; border:1.5px solid #e2e8f0; background:#fff; color:#1e293b; font-size:14px; font-family:inherit; line-height:1.5; outline:none; resize:vertical; transition:border-color .15s, box-shadow .15s;}
.brief-textarea:focus{border-color:#0ea5e9; box-shadow:0 0 0 3px rgba(14,165,233,.12);}
.brief-textarea:disabled{background:#f1f5f9; color:#94a3b8; cursor:not-allowed;}
.brief-nav{display:flex; justify-content:space-between; align-items:center; gap:10px; margin-top:22px;}
.brief-btn-next{padding:13px 26px; background:linear-gradient(135deg, #0ea5e9, #0284c7); color:#fff; border:none; border-radius:14px; font-size:14px; font-weight:800; cursor:pointer; box-shadow:0 8px 20px rgba(14,165,233,.35); font-family:inherit; transition:transform .15s, box-shadow .15s;}
.brief-btn-next:hover{transform:translateY(-1px); box-shadow:0 10px 24px rgba(14,165,233,.4);}
.brief-btn-back{padding:13px 22px; background:#fff; color:#64748b; border:2px solid #e2e8f0; border-radius:14px; font-size:14px; font-weight:700; cursor:pointer; font-family:inherit;}
.brief-btn-back:hover{background:#f8fafc;}
.brief-btn-back:disabled{opacity:.4; cursor:not-allowed;}
.brief-cta{background:#fff; border-radius:20px; padding:22px 24px; box-shadow:0 2px 16px rgba(14,165,233,.1); border:1px solid #e0f2fe;}
.brief-cta-btn{padding:11px 20px; background:linear-gradient(135deg, #0ea5e9, #0284c7); color:#fff; border:none; border-radius:12px; font-size:13.5px; font-weight:700; cursor:pointer; white-space:nowrap; font-family:inherit; box-shadow:0 6px 16px rgba(14,165,233,.3);}
.brief-success{display:flex; align-items:center; justify-content:center; min-height:70vh; padding:20px;}
.brief-success-card{background:#fff; border-radius:28px; padding:48px 36px; max-width:420px; width:100%; text-align:center; box-shadow:0 20px 60px rgba(14,165,233,.15);}
.brief-success-icon{font-size:52px; margin-bottom:14px;}
.brief-success-card h2{font-size:20px; font-weight:800; color:#1e293b; margin-bottom:8px;}
.brief-success-card p{color:#64748b; font-size:13.5px; margin-bottom:0;}
.brief-na{display:flex; align-items:center; gap:9px; margin-top:16px; padding:10px 14px; background:#f8fafc; border:1px solid #e2e8f0; border-radius:10px; font-size:13.5px; color:#475569; cursor:pointer; user-select:none;}
.brief-na input{width:16px; height:16px; accent-color:#0ea5e9; flex-shrink:0; cursor:pointer;}
.brief-jump-link{background:none; border:none; color:#0284c7; font-size:12.5px; font-weight:700; cursor:pointer; font-family:inherit; padding:6px 4px; white-space:nowrap;}
.brief-jump-link:hover{text-decoration:underline;}
.brief-review-item{display:flex; align-items:flex-start; gap:14px; padding:16px 0; border-bottom:1px solid #e2e8f0;}
.brief-review-item:last-child{border-bottom:none;}
.brief-review-q{font-weight:700; font-size:13.5px; color:#1e293b; white-space:pre-line;}
.brief-review-a{margin-top:5px; font-size:13px; color:#475569; white-space:pre-line;}
.brief-review-a.empty{color:#94a3b8; font-style:italic;}
.brief-review-edit{flex-shrink:0; padding:7px 14px; background:#fff; border:1.5px solid #e2e8f0; border-radius:9px; font-size:12.5px; font-weight:700; color:#0284c7; cursor:pointer; font-family:inherit; white-space:nowrap;}
.brief-review-edit:hover{border-color:#0ea5e9; background:#f0f9ff;}

/* ===== Loading — hourglass ===== */
.hourglass-wrap{display:flex; flex-direction:column; align-items:center; justify-content:center; gap:14px;}
.hourglass-wrap .hourglass-label{font-size:12.5px; color:var(--slate); letter-spacing:.02em;}
.hourglass-loader{font-size:40px; line-height:1; animation:hourglassFlip 1.8s ease-in-out infinite;}
.hourglass-loader.sm{font-size:22px;}
@keyframes hourglassFlip{
  0%, 100%{ transform:rotate(0deg); }
  50%{ transform:rotate(180deg); }
}
.maintenance-overlay{position:fixed; inset:0; z-index:9999; display:flex; align-items:center; justify-content:center; background:rgba(11,22,38,.45); backdrop-filter:blur(6px); -webkit-backdrop-filter:blur(6px); text-align:center; padding:20px;}
.maintenance-overlay .hourglass-wrap{background:var(--paper); padding:36px 40px; border-radius:var(--radius-lg); box-shadow:var(--shadow-pop); max-width:340px;}
.maintenance-overlay .hourglass-label{font-size:13.5px; font-weight:600; color:var(--ink-soft); line-height:1.5;}

/* ── Тижневий пульс: гейт ─────────────────────────────────────────────────────────────────── */
/* Everything behind the gate is blurred and made inert, so the only thing that can be done is
   answer. The blur lives on the shell rather than on the overlay's backdrop-filter because the
   shell scrolls: a backdrop filter would re-sample on every frame of a scroll that cannot happen
   anyway, and inert already removes the shell from tab order and pointer events. */
.shell--gated{filter:blur(7px) saturate(.85); pointer-events:none; user-select:none;}
.gate{position:fixed; inset:0; z-index:400; display:flex; align-items:center; justify-content:center;
      padding:24px; background:rgba(11,22,38,.34); animation:overlayin .2s ease; overflow-y:auto;}
.gate-card{width:560px; max-width:100%; background:var(--paper); border-radius:var(--radius-lg);
           box-shadow:var(--shadow-pop); padding:30px 32px; animation:popin .22s cubic-bezier(.16,1,.3,1);
           margin:auto;}
.gate-badge{display:inline-block; font-size:11px; font-weight:700; letter-spacing:.06em; text-transform:uppercase;
            color:var(--visa); background:var(--visa-soft); border-radius:999px; padding:5px 11px; margin-bottom:14px;}
.gate-title{font-family:var(--font-display,inherit); font-size:22px; font-weight:700; line-height:1.25;
            color:var(--ink); margin:0 0 8px; text-wrap:balance;}
.gate-sub{font-size:13px; line-height:1.55; color:var(--slate); margin:0 0 22px;}
.gate-q{margin-bottom:18px;}
.gate-q-head{display:flex; align-items:baseline; justify-content:space-between; gap:12px; margin-bottom:8px;}
.gate-q-head label{font-size:13.5px; font-weight:600; color:var(--ink); margin:0;}
.gate-score{font-family:var(--font-mono,monospace); font-weight:700; font-size:13.5px; font-variant-numeric:tabular-nums; flex-shrink:0;}
.gate-q input[type=range]{width:100%; accent-color:var(--visa);}
/* Until it is moved, a slider must not look like it already holds an answer. */
.gate-q input[type=range].untouched{accent-color:var(--slate-2); opacity:.7;}
.gate-scale{display:flex; justify-content:space-between; font-size:10.5px; color:var(--slate-2); margin-top:2px;}
.gate-idea{margin-top:22px;}
.gate-idea textarea{min-height:60px;}
.gate-foot{display:flex; align-items:center; justify-content:space-between; gap:14px;
           border-top:1px solid var(--sky-line); padding-top:16px; margin-top:6px;}
.gate-card--thanks{text-align:center; padding:48px 32px;}
.gate-thanks-ic{color:var(--good); margin-bottom:12px;}
.gate-thanks-ic svg{width:44px; height:44px;}
@media (max-width:560px){ .gate-card{padding:22px 18px;} .gate-title{font-size:19px;} }

/* ── Баги ─────────────────────────────────────────────────────────────────────────────────── */
.bug-row{display:flex; gap:16px; align-items:flex-start; padding:14px 0; border-bottom:1px solid var(--sky-line);}
.bug-row:last-child{border-bottom:none;}
.bug-row-main{flex:1; min-width:0;}
.bug-row-head{display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-bottom:6px;}
.bug-row-text{font-size:13.5px; line-height:1.5; color:var(--ink); white-space:pre-wrap; overflow-wrap:anywhere;}
.bug-answer{margin-top:8px; font-size:12.5px; line-height:1.5; color:var(--ink-soft);
            background:var(--sky); border-radius:8px; padding:8px 10px;}
.bug-row-actions{display:flex; gap:6px; flex-wrap:wrap; justify-content:flex-end; max-width:340px; flex-shrink:0;}
@media (max-width:720px){ .bug-row{flex-direction:column; gap:10px;} .bug-row-actions{max-width:none; justify-content:flex-start;} }

/* ── Ідеї команди ─────────────────────────────────────────────────────────────────────────── */
.idea-card{border:1px solid var(--sky-line); border-radius:10px; padding:12px 14px; background:var(--sky);}
.idea-card + .idea-card{margin-top:8px;}
.idea-text{font-size:13.5px; line-height:1.55; color:var(--ink); white-space:pre-wrap; overflow-wrap:anywhere;}
.idea-meta{font-size:11.5px; color:var(--slate-2); margin-top:6px;}

/* ── Мобільна версія ──────────────────────────────────────────────────────────────────────── */
/* Deliberately minimal: the dashboard only. Everything else in this CRM is a wide table or a
   two-column drawer, and a half-working client card on a 390 px screen is worse than saying so. */
.mobile-note{display:flex; gap:12px; align-items:flex-start; background:var(--visa-soft);
             border:1px solid var(--sky-line); border-radius:12px; padding:14px 16px; margin-bottom:16px;}
.mobile-note-ic{color:var(--visa); flex-shrink:0; margin-top:1px;}
.mobile-note-ic svg{width:20px; height:20px;}
.mobile-note b{display:block; font-size:13.5px; color:var(--ink); margin-bottom:4px;}
.mobile-note p{font-size:12.5px; line-height:1.5; color:var(--slate); margin:0;}
/* The dashboard's own multi-column blocks. These used to be inline grid-template-columns, which
   no media query could override — inline styles win over any stylesheet rule. As classes they
   collapse on a narrow screen instead of squeezing four numbers into 90 px each. */
.dash-grid{display:grid; gap:16px;}
.dash-grid-2{grid-template-columns:1fr 1fr;}
.dash-grid-wide{grid-template-columns:1.3fr 1fr;}
.dash-grid-4{grid-template-columns:repeat(4,1fr); gap:14px;}

@media (max-width:900px){
  .dash-grid-wide{grid-template-columns:1fr 1fr;}
}
@media (max-width:720px){
  /* Nothing on a phone may scroll the page sideways. A single wide element — a table, a long
     unbroken word, a grid that did not collapse — otherwise drags the whole layout with it, and
     every tap lands slightly off. Anything genuinely wide has to scroll inside its own box. */
  html, body{overflow-x:hidden; max-width:100%;}
  .shell{flex-direction:column; overflow-x:hidden; max-width:100vw;}
  .view{overflow-x:hidden;}
  .card, .stat-tile{min-width:0; max-width:100%;}
  .main{width:100%; min-width:0; max-width:100vw; overflow-x:hidden;}
  .view{padding:12px;}
  .topbar{padding:10px 12px; gap:8px;}
  .topbar-slogan{display:none;}
  .search-box{display:none;}
  /* Two columns, not one: a phone screen fits two figures side by side comfortably, and a
     single column turns eight numbers into a page of scrolling. */
  .stat-grid{grid-template-columns:repeat(2,1fr) !important;}
  .dash-grid-2, .dash-grid-wide{grid-template-columns:1fr;}
  .dash-grid-4{grid-template-columns:1fr 1fr;}
  .page-head{margin-bottom:12px;}
  .page-head h1{font-size:19px;}
  .page-head p{font-size:12.5px;}
  .card.pad-lg{padding:14px;}
  .card{margin-bottom:12px !important;}
  /* A stat tile is a 34 px icon square, one number and one caption, in 18 px of padding — laid
     out for a wide screen where four of them fill a row. Stacked two-up on a phone the same tile
     becomes a mostly-empty 100 px box, and five of them eat the whole screen before the first
     real card. On a phone the icon moves beside the number instead of above it. */
  .stat-grid{gap:8px; margin-bottom:14px;}
  .stat-tile{padding:11px 12px; gap:4px;}
  .stat-tile .icon{width:26px; height:26px; border-radius:8px;}
  .stat-tile .icon svg{width:14px; height:14px;}
  .stat-tile .num{font-size:21px;}
  .stat-tile .label{font-size:11px; line-height:1.25;}
  .stat-tile .trend{font-size:10.5px; padding:1px 5px;}
  .num{font-size:22px !important;}
  .section-title{font-size:13px;}
  /* Header rows built as flex with a control on the right wrap instead of overflowing. */
  .flex-between{flex-wrap:wrap;}
  .user-chip .name, .user-chip .role{display:none;}
  .avatar.lg{width:44px; height:44px; font-size:18px;}
}
@media (max-width:340px){
  .dash-grid-4{grid-template-columns:1fr;}
  .stat-grid{grid-template-columns:1fr !important;}
}

/* A Word or text file shown as its own opening lines — the closest thing to a page image that
   does not require rendering the whole document. Deliberately small and tight: this is a hint at
   the content, not something to read from a 150 px tile. */
.file-tile-text{
  position:absolute; inset:0; padding:26px 9px 10px; overflow:hidden;
  background:#fff; color:#2A3446;
  font-size:6.5px; line-height:1.5; white-space:pre-wrap; overflow-wrap:anywhere;
  font-family:var(--font-body); text-align:left;
  /* Fades out at the bottom instead of cutting a line in half. */
  -webkit-mask-image:linear-gradient(to bottom, #000 62%, transparent 100%);
  mask-image:linear-gradient(to bottom, #000 62%, transparent 100%);
}

/* ── Зарплати ─────────────────────────────────────────────────────────────────────────────── */
.period-nav{display:flex; align-items:center; gap:4px; border:1px solid var(--sky-line);
            border-radius:10px; padding:2px 4px; background:var(--paper);}
.period-nav-label{font-size:12.5px; font-weight:600; color:var(--ink); min-width:118px; text-align:center;}

.dep-grid{display:grid; grid-template-columns:repeat(auto-fill, minmax(220px, 1fr)); gap:10px;}
.dep-tile{display:flex; flex-direction:column; align-items:flex-start; gap:4px; text-align:left;
          border:1px solid var(--sky-line); background:var(--paper); border-radius:12px;
          padding:14px 16px; cursor:pointer; transition:border-color .12s, background .12s;}
.dep-tile:hover{border-color:var(--visa); background:var(--visa-soft);}
.dep-tile-name{font-weight:600; font-size:13.5px; color:var(--ink);}

.payroll-grand{display:flex; align-items:baseline; justify-content:space-between; gap:12px;
               border-top:1px solid var(--sky-line); margin-top:14px; padding-top:14px;
               font-size:13.5px; color:var(--slate);}
.payroll-grand b{font-family:var(--font-mono,monospace); font-size:19px; color:var(--ink);
                 font-variant-numeric:tabular-nums;}
.payroll-grand b + b{margin-left:14px;}

/* The table is the one place here that can genuinely be wider than the page — a department with
   six formula components plus name, total and status. It scrolls inside its own box so the page
   itself never scrolls sideways. */
.table-scroll{overflow-x:auto; margin:0 -4px; padding:0 4px;}
.payroll-table{width:100%; border-collapse:collapse; font-size:13px;}
.payroll-table th{text-align:left; font-size:11px; font-weight:700; letter-spacing:.04em;
                  text-transform:uppercase; color:var(--slate-2); padding:0 10px 8px;
                  border-bottom:1px solid var(--sky-line); white-space:nowrap;}
.payroll-table td{padding:10px; border-bottom:1px solid var(--sky-line); vertical-align:middle;}
.payroll-table tbody tr:hover{background:var(--sky);}
.payroll-table tfoot td{border-bottom:none; border-top:2px solid var(--sky-line); padding-top:12px;}
.payroll-table .ta-right{text-align:right;}
.payroll-table .mono{font-family:var(--font-mono,monospace); font-variant-numeric:tabular-nums;}
/* An uncalculated row is a preview, not a result — it must not read as money owed. */
.payroll-table tr.is-draft td{opacity:.62;}
.payroll-table td.is-manual{cursor:pointer; position:relative;}
.payroll-table td.is-manual:hover{background:var(--visa-soft);}
.cell-edit{opacity:0; margin-left:6px; vertical-align:middle; color:var(--visa);}
.cell-edit svg{width:13px; height:13px;}
.payroll-table td.is-manual:hover .cell-edit{opacity:1;}

.comp-row{border:1px solid var(--sky-line); border-radius:12px; padding:12px; margin-bottom:10px;
          background:var(--sky);}
.comp-row-head{display:flex; gap:8px; align-items:center; margin-bottom:10px;}
.comp-row-body{display:flex; gap:12px; align-items:flex-start; flex-wrap:wrap;}

.calc-line{display:flex; align-items:flex-start; justify-content:space-between; gap:14px;
           padding:10px 0; border-bottom:1px solid var(--sky-line);}
.calc-total{display:flex; align-items:baseline; justify-content:space-between; gap:14px;
            padding:16px 0 20px; font-size:13.5px; color:var(--slate);}
.calc-total b{font-family:var(--font-mono,monospace); font-size:28px; color:var(--ink);
              font-variant-numeric:tabular-nums;}
.client-chips{display:flex; flex-wrap:wrap; gap:6px;}
.chip{font-size:12px; background:var(--sky); border:1px solid var(--sky-line);
      border-radius:999px; padding:4px 10px; color:var(--ink-soft);}

/* The client name is editable, but the card is read a hundred times for every time it is
   renamed — so the affordance only appears on hover instead of sitting there permanently. */
.name-edit-ic{opacity:0; margin-left:8px; vertical-align:middle; color:var(--slate-2); transition:opacity .12s;}
.name-edit-ic svg{width:14px; height:14px;}
h1:hover .name-edit-ic{opacity:1;}
