/* ==========================================================================
   Luxury Dark & Champagne Minimalist — design system
   All colour literals live here in :root. Nothing below re-declares a hex.
   ========================================================================== */

:root{
  /* --- brand surfaces --- */
  --surface:      #12161f;
  --card:         #1a202c;

  /* --- accents --- */
  --gold:         #e4c278;
  --business:     #4a90e2;
  --personal:     #50c878;

  /* --- derived neutrals --- */
  --ink:          #f2f4f8;
  --muted:        #97a1b4;
  --faint:        #6a7488;
  --line:         rgba(228,194,120,.14);
  --line-soft:    rgba(255,255,255,.06);
  --card-2:       #212938;
  --danger:       #e2725b;

  /* --- task status accents (Sprint 3) --- */
  --waiting:      #f0a92e;         /* ממתין ללקוח — the one status that shouts */
  --progress:     #7aa7e8;

  --gold-soft:    rgba(228,194,120,.12);
  --gold-edge:    rgba(228,194,120,.32);
  --business-soft:rgba(74,144,226,.14);
  --personal-soft:rgba(80,200,120,.14);
  --danger-soft:  rgba(226,114,91,.14);
  --waiting-soft: rgba(240,169,46,.16);
  --waiting-edge: rgba(240,169,46,.45);
  --waiting-glow: 0 0 0 3px rgba(240,169,46,.10);
  --progress-soft:rgba(122,167,232,.14);
  --muted-soft:   rgba(151,161,180,.12);

  /* --- client CRM edges (Sprint 4) --- */
  --personal-edge:rgba(80,200,120,.42);
  --business-edge:rgba(74,144,226,.42);
  --danger-edge:  rgba(226,114,91,.45);
  --danger-glow:  0 0 0 3px rgba(226,114,91,.10);

  /* --- geometry --- */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 26px;
  --tap: 44px;

  --shadow:    0 18px 40px rgba(0,0,0,.45);
  --shadow-sm: 0 8px 20px rgba(0,0,0,.32);
  --glow-gold: 0 10px 22px rgba(228,194,120,.28);
  --glow-fab:  0 14px 30px rgba(228,194,120,.24);
  --bar-bg:    rgba(18,22,31,.94);
  --scrim:     rgba(6,8,13,.62);

  --rail-w: 244px;
  --drawer-w: 460px;              /* client file — full-width sheet on mobile */
  --bar-h: 68px;
  --hour-h: 56px;                 /* day-view hour row — mirrors HOUR_PX in app.js */
  --safe-b: env(safe-area-inset-bottom, 0px);

  --ff: "Assistant", "Rubik", "Heebo", "Segoe UI", system-ui, -apple-system, sans-serif;
}

*,*::before,*::after{ box-sizing:border-box; }

html,body{
  margin:0; padding:0;
  max-width:100%;
  overflow-x:hidden;              /* zero horizontal scroll, mandated */
}

body{
  font-family:var(--ff);
  background:var(--surface);
  color:var(--ink);
  -webkit-text-size-adjust:100%;
  -webkit-font-smoothing:antialiased;
}

h1,h2,h3,p{ margin:0; }
button{ font-family:inherit; color:inherit; cursor:pointer; }

/* every control clears the 44x44 touch floor */
button, .tap{ min-height:var(--tap); min-width:var(--tap); }

::selection{ background:var(--gold-soft); }

/* ==========================================================================
   Shell
   ========================================================================== */

.app{ display:flex; min-height:100vh; width:100%; }

.main{
  flex:1 1 auto;
  min-width:0;                                    /* prevents flex overflow */
  padding:0 16px calc(var(--bar-h) + var(--safe-b) + 96px);
}

/* ---------- desktop side rail (hidden on mobile) ---------- */
.rail{ display:none; }

.rail-brand{
  display:flex; align-items:center; gap:10px;
  padding:22px 18px 26px;
}
.rail-mark{
  width:38px; height:38px; border-radius:12px;
  display:grid; place-items:center;
  background:var(--gold-soft); border:1px solid var(--gold-edge);
  color:var(--gold); font-weight:800; font-size:18px;
}
.rail-name{ font-weight:700; letter-spacing:.2px; }

.rail-nav{ display:flex; flex-direction:column; gap:6px; padding:0 12px; }

.rail-item{
  display:flex; align-items:center; gap:12px;
  padding:12px 14px;
  background:transparent; border:1px solid transparent;
  border-radius:var(--r-md);
  color:var(--muted); font-size:15px; font-weight:600;
  text-align:start;
  transition:background .18s, color .18s, border-color .18s;
}
.rail-item .ico{ font-size:17px; width:22px; text-align:center; }
.rail-item:hover{ color:var(--ink); background:var(--line-soft); }
.rail-item.is-active{
  color:var(--gold);
  background:var(--gold-soft);
  border-color:var(--gold-edge);
}
.rail-add{
  margin:10px 0;
  color:var(--surface); background:var(--gold);
  border-color:var(--gold); font-weight:800;
  justify-content:center;
}
.rail-add:hover{ color:var(--surface); background:var(--gold); filter:brightness(1.06); }

.rail-user{
  margin-top:auto;
  display:flex; align-items:center; gap:10px;
  padding:16px 18px;
  border-top:1px solid var(--line-soft);
}
.rail-user-meta{ display:flex; flex-direction:column; line-height:1.35; }
.rail-user-meta b{ font-size:14px; }
.rail-user-meta small{ color:var(--faint); font-size:12px; }

.avatar{
  width:38px; height:38px; flex:0 0 38px;
  border-radius:50%;
  display:grid; place-items:center;
  background:var(--card-2); border:1px solid var(--gold-edge);
  color:var(--gold); font-weight:700;
}
.avatar-sm{ width:36px; height:36px; flex-basis:36px; font-size:14px; }

/* ==========================================================================
   Top bar
   ========================================================================== */

.topbar{
  position:sticky; top:0; z-index:20;
  padding:18px 0 12px;
  background:linear-gradient(var(--surface) 76%, transparent);
}
.topbar-row{ display:flex; align-items:center; justify-content:space-between; gap:10px; }
.topbar-title{ min-width:0; flex:1 1 auto; }
.topbar-title h1{ font-size:22px; font-weight:800; letter-spacing:-.2px; }
.topbar-sub{ color:var(--faint); font-size:13px; margin-top:2px; }
.topbar-avatar{ flex:0 0 auto; }

/* ---------- push notification toggle ---------- */
.push-btn{
  flex:0 0 auto;
  display:inline-flex; align-items:center; gap:7px;
  margin-inline-start:auto;
  padding:0 13px; height:38px; min-height:38px;
  background:var(--card-2); border:1px solid var(--line-soft);
  border-radius:999px;
  color:var(--muted); font-size:12.5px; font-weight:700; white-space:nowrap;
  transition:color .18s, background .18s, border-color .18s;
}
.push-btn:hover{ color:var(--ink); border-color:var(--gold-edge); }
.push-ico{ font-size:14px; line-height:1; }

/* permission granted and reminders armed */
.push-btn.is-on{
  color:var(--gold); background:var(--gold-soft); border-color:var(--gold-edge);
}
/* blocked at the OS/browser level — nothing the app can do */
.push-btn.is-blocked{
  color:var(--danger); background:var(--danger-soft); border-color:var(--danger-soft);
  cursor:not-allowed;
}
/* browser has no Notification support — never rendered */
.push-btn[hidden]{ display:none; }

/* ---------- cloud sync status (Sprint 5) ----------
   Three honest states, colour never the sole carrier: the glyph and the
   Hebrew label say the same thing the tint does.                          */
.sync-btn{
  flex:0 0 auto;
  display:inline-flex; align-items:center; gap:7px;
  padding:0 13px; height:38px; min-height:38px;
  background:var(--card-2); border:1px solid var(--line-soft);
  border-radius:999px;
  color:var(--muted); font-size:12.5px; font-weight:700; white-space:nowrap;
  transition:color .18s, background .18s, border-color .18s;
}
.sync-ico{ font-size:11px; line-height:1; }

/* 🟢 queue empty, the cloud has everything */
.sync-btn.is-synced{
  color:var(--personal); background:var(--personal-soft); border-color:var(--personal-edge);
}
/* 🟡 mutations are waiting in the outbox */
.sync-btn.is-pending{
  color:var(--waiting); background:var(--waiting-soft); border-color:var(--waiting-edge);
}
/* 🔴 no network, or no cloud configured — the app still works, locally */
.sync-btn.is-offline{
  color:var(--danger); background:var(--danger-soft); border-color:var(--danger-edge);
}

@media (prefers-reduced-motion: no-preference){
  .sync-btn.is-pending .sync-ico{ animation:sync-pulse 1.8s ease-in-out infinite; }
}
@keyframes sync-pulse{ 0%,100%{ opacity:1; } 50%{ opacity:.35; } }

/* ---------- Google Calendar connection (Sprint 6) ----------
   Same pill as its two neighbours, so the top bar reads as one control strip.
   The glyph carries the identity, the label carries the state — colour is
   never the only signal.                                                    */
.gcal-btn{
  flex:0 0 auto;
  display:inline-flex; align-items:center; gap:7px;
  padding:0 13px; height:38px; min-height:38px;
  background:var(--card-2); border:1px solid var(--line-soft);
  border-radius:999px;
  color:var(--muted); font-size:12.5px; font-weight:700; white-space:nowrap;
  transition:color .18s, background .18s, border-color .18s;
}
.gcal-btn:hover{ color:var(--ink); border-color:var(--gold-edge); }
.gcal-ico{ font-size:14px; line-height:1; }

/* connected — tapping now runs a two-way cycle */
.gcal-btn.is-on{
  color:var(--gold); background:var(--gold-soft); border-color:var(--gold-edge);
}
/* a cycle is in flight */
.gcal-btn.is-busy{
  color:var(--waiting); background:var(--waiting-soft); border-color:var(--waiting-edge);
}
/* the deployment carries no Google credentials — nothing to connect to */
.gcal-btn.is-na{
  color:var(--faint); background:var(--card-2); border-color:var(--line-soft);
  cursor:not-allowed;
}

/* "סונכרן לאחרונה מול גוגל: HH:MM" */
.gcal-sync{
  display:flex; align-items:center; gap:8px;
  margin-top:8px;
  color:var(--faint); font-size:12px;
}
.gcal-sync[hidden]{ display:none; }
.gcal-unlink{
  padding:2px 8px;
  background:transparent; border:1px solid var(--line-soft); border-radius:999px;
  color:var(--faint); font-size:11px; font-weight:700;
}
.gcal-unlink:hover{ color:var(--danger); border-color:var(--danger-edge); }
.gcal-unlink[hidden]{ display:none; }

@media (prefers-reduced-motion: no-preference){
  .gcal-btn.is-busy .gcal-ico{ animation:sync-pulse 1.8s ease-in-out infinite; }
}

@media (max-width:420px){
  .push-label{ display:none; }
  .push-btn{ padding:0; width:38px; min-width:38px; justify-content:center; }
  .sync-label{ display:none; }
  .sync-btn{ padding:0; width:38px; min-width:38px; justify-content:center; }
  .gcal-label{ display:none; }
  .gcal-btn{ padding:0; width:38px; min-width:38px; justify-content:center; }
}

/* ---------- segmented control (global category filter) ---------- */
.segmented{
  display:flex; gap:4px;
  margin-top:14px; padding:4px;
  background:var(--card); border:1px solid var(--line-soft);
  border-radius:var(--r-lg);
}
.seg{
  flex:1 1 0; min-width:0;
  padding:9px 8px;
  background:transparent; border:0; border-radius:var(--r-md);
  color:var(--muted); font-size:14px; font-weight:700;
  transition:background .18s, color .18s;
}
.seg:hover{ color:var(--ink); }
.seg.is-active{ background:var(--gold-soft); color:var(--gold); }
.segmented-cat{ margin-top:8px; }
.segmented-cat .seg[data-cat="personal"].is-active{ background:var(--personal-soft); color:var(--personal); }
.segmented-cat .seg[data-cat="business"].is-active{ background:var(--business-soft); color:var(--business); }

/* ==========================================================================
   Views & generic blocks
   ========================================================================== */

.view{ display:none; }
.view.is-active{ display:block; animation:rise .26s ease both; }

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

.card{
  background:var(--card);
  border:1px solid var(--line-soft);
  border-radius:var(--r-lg);
}

.block{ margin-top:22px; }
.block-head{
  display:flex; align-items:baseline; justify-content:space-between; gap:10px;
  margin:0 4px 10px;
}
.block-head h2{ font-size:16px; font-weight:800; }
.block-meta{ color:var(--faint); font-size:12.5px; }

.scroll-tail{ height:24px; }

/* ==========================================================================
   1. Smart summary
   ========================================================================== */

.summary{
  margin-top:6px; padding:20px 18px;
  background:
    radial-gradient(120% 140% at 100% 0%, var(--gold-soft), transparent 60%),
    var(--card);
  border-color:var(--line);
}
.summary-greet{ font-size:20px; font-weight:800; color:var(--gold); }
.summary-line{ margin-top:8px; font-size:15px; line-height:1.7; color:var(--ink); }
.summary-chips{ display:flex; flex-wrap:wrap; gap:8px; margin-top:14px; }

.chip{
  display:inline-flex; align-items:center; gap:6px;
  padding:6px 11px; border-radius:999px;
  background:var(--card-2); border:1px solid var(--line-soft);
  font-size:12.5px; font-weight:700; color:var(--muted);
}
.chip b{ color:var(--ink); }

/* category tag — colour AND text, never colour alone */
.tag{
  display:inline-flex; align-items:center; gap:5px;
  padding:3px 9px; border-radius:999px;
  font-size:11.5px; font-weight:700; white-space:nowrap;
}
.tag::before{ content:""; width:6px; height:6px; border-radius:50%; background:currentColor; }
.tag-personal{ color:var(--personal); background:var(--personal-soft); }
.tag-business{ color:var(--business); background:var(--business-soft); }

/* ==========================================================================
   4. Attention cards
   ========================================================================== */

.attention{
  display:grid; grid-template-columns:repeat(auto-fit,minmax(118px,1fr)); gap:10px;
  margin-top:12px;
}
.att{
  display:flex; flex-direction:column; align-items:flex-start; gap:2px;
  padding:14px;
  background:var(--card); border:1px solid var(--line-soft);
  border-radius:var(--r-md);
  text-align:start;
  transition:transform .16s, border-color .16s;
}
.att:hover{ transform:translateY(-2px); }
.att-num{ font-size:26px; font-weight:800; line-height:1.1; }
.att-label{ font-size:12.5px; color:var(--muted); font-weight:600; }
.att-hint{ font-size:11.5px; color:var(--faint); }
.att.is-hot{ border-color:var(--danger-soft); background:linear-gradient(var(--danger-soft), transparent), var(--card); }
.att.is-hot .att-num{ color:var(--danger); }
.att.is-warn{ border-color:var(--gold-edge); }
.att.is-warn .att-num{ color:var(--gold); }
.att.is-wait{ border-color:var(--waiting-edge); background:linear-gradient(var(--waiting-soft), transparent), var(--card); }
.att.is-wait .att-num{ color:var(--waiting); }
.att.is-calm .att-num{ color:var(--personal); }

/* ==========================================================================
   2. Timeline
   ========================================================================== */

.timeline{ padding:6px 0; overflow:hidden; }

.tl-row{
  display:grid; grid-template-columns:62px 1fr;
  gap:10px; align-items:stretch;
  padding:0 14px;
  border-bottom:1px solid var(--line-soft);
}
.tl-row:last-child{ border-bottom:0; }
.tl-row.is-now{ background:var(--gold-soft); }

.tl-hour{
  padding:10px 0;
  color:var(--faint); font-size:12.5px; font-weight:700;
  font-variant-numeric:tabular-nums;
  border-inline-start:1px solid var(--line-soft);
  padding-inline-start:10px;
}
.tl-row.is-now .tl-hour{ color:var(--gold); }

.tl-slot{ padding:8px 0; min-height:38px; display:flex; flex-direction:column; gap:6px; }
.tl-empty{ height:0; }

.ev{
  display:flex; align-items:center; gap:10px;
  padding:10px 12px;
  background:var(--card-2); border:1px solid var(--line-soft);
  border-radius:var(--r-sm);
  border-inline-start:3px solid var(--gold);
}
.ev-personal{ border-inline-start-color:var(--personal); }
.ev-business{ border-inline-start-color:var(--business); }
.ev-body{ min-width:0; flex:1 1 auto; }
.ev-title{ font-size:14px; font-weight:700; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.ev-meta{ font-size:12px; color:var(--faint); margin-top:2px; }

/* ==========================================================================
   3. To-do today  /  generic rows
   ========================================================================== */

.todo, #tasksList, #listsList, #notesList{ padding:6px 4px; }

.row{
  display:flex; align-items:center; gap:12px;
  padding:12px 14px;
  border-bottom:1px solid var(--line-soft);
}
.row:last-child{ border-bottom:0; }
.row-body{ flex:1 1 auto; min-width:0; }
.row-title{ font-size:14.5px; font-weight:650; line-height:1.4; }
.row-meta{ margin-top:3px; font-size:12px; color:var(--faint); display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.row.is-done .row-title{ color:var(--faint); text-decoration:line-through; }
.row.is-late .row-title{ color:var(--danger); }

.check{
  flex:0 0 auto;
  width:26px; height:26px; min-width:26px; min-height:26px;
  border-radius:50%;
  background:transparent; border:1.5px solid var(--faint);
  color:var(--surface); font-size:14px; line-height:1;
  display:grid; place-items:center;
  transition:background .16s, border-color .16s;
}
.check-tap{
  /* 44x44 hit area around a 26px dot */
  display:grid; place-items:center;
  width:var(--tap); height:var(--tap); min-width:var(--tap);
  background:transparent; border:0; padding:0;
}
.row.is-done .check{ background:var(--personal); border-color:var(--personal); }

.empty{
  padding:26px 16px; text-align:center;
  color:var(--faint); font-size:13.5px; line-height:1.7;
}
.empty b{ display:block; color:var(--muted); font-size:14.5px; margin-bottom:4px; }

/* ==========================================================================
   Tasks engine · smart lists · quick notes   (Sprint 3)
   ========================================================================== */

/* ---------- quick sub-tabs above the tasks list ---------- */
.task-tabs{ margin-top:14px; }
.task-tabs .seg{ padding:9px 4px; font-size:13px; }
.seg-count{
  display:inline-block; margin-inline-start:4px;
  font-size:11px; font-weight:800; color:var(--faint);
  font-variant-numeric:tabular-nums;
}
.task-tabs .seg.is-active .seg-count{ color:var(--gold); }

/* ---------- status / priority badges ---------- */
.badge{
  display:inline-flex; align-items:center; gap:5px;
  padding:3px 9px; border-radius:999px;
  border:1px solid transparent;
  font-size:11.5px; font-weight:700; white-space:nowrap;
  background:var(--muted-soft); color:var(--muted);
}
/* the status chip is a control, not a label — it must stay tappable */
.badge-btn{
  min-height:32px; min-width:0;
  padding:0 12px;
  transition:filter .16s, border-color .16s;
}
.badge-btn:hover{ filter:brightness(1.14); }

.st-new{ background:var(--muted-soft); color:var(--muted); }
.st-todo{ background:var(--gold-soft); color:var(--gold); }
.st-progress{ background:var(--progress-soft); color:var(--progress); }
.st-done{ background:var(--personal-soft); color:var(--personal); }
.st-cancelled{ background:var(--muted-soft); color:var(--faint); text-decoration:line-through; }

/* ממתין ללקוח — mandated distinct badge: colour, border and a soft halo */
.st-waiting{
  background:var(--waiting-soft); color:var(--waiting);
  border-color:var(--waiting-edge);
  box-shadow:var(--waiting-glow);
}
.st-waiting::before{ content:"⏳"; font-size:10.5px; }

.pr-high{ background:var(--danger-soft); color:var(--danger); }
.pr-medium{ background:var(--gold-soft); color:var(--gold); }
.pr-low{ background:var(--muted-soft); color:var(--faint); }

.badge.dated{ background:var(--business-soft); color:var(--business); }
.badge.timeless,
.badge.pinned{ background:var(--gold-soft); color:var(--gold); }

/* the whole row gets a quiet rail when the ball is in the client's court */
.row.is-waiting{
  border-inline-start:3px solid var(--waiting);
  border-radius:var(--r-sm);
  background:linear-gradient(to left, var(--waiting-soft), transparent 42%);
}
.row.is-cancelled .row-title{ color:var(--faint); text-decoration:line-through; }

/* ---------- "הפעולה הבאה" ---------- */
.next-action{
  display:flex; align-items:center; gap:8px; flex-wrap:wrap;
  margin-top:7px; padding:7px 10px;
  background:var(--gold-soft); border:1px solid var(--gold-edge);
  border-radius:var(--r-sm);
  font-size:12.5px; font-weight:650; color:var(--ink); line-height:1.5;
}
.next-action span{
  font-size:10.5px; font-weight:800; letter-spacing:.3px;
  color:var(--gold); text-transform:uppercase;
}

/* ---------- checklist: sub-tasks and smart-list items ---------- */
.checklist{ margin-top:9px; }

.prog{ display:flex; align-items:center; gap:9px; margin-bottom:7px; }
.prog-track{
  flex:1 1 auto; min-width:0; height:7px;
  border-radius:999px; overflow:hidden;
  background:var(--muted-soft);
}
.prog-fill{
  display:block; height:100%;
  border-radius:999px;
  background:linear-gradient(to left, var(--gold), var(--personal));
  transition:inline-size .3s ease;
}
.prog-num{
  flex:0 0 auto;
  font-size:11.5px; font-weight:800; color:var(--muted);
  font-variant-numeric:tabular-nums;
}

.cl-item{
  display:flex; align-items:center; gap:9px; width:100%;
  min-height:38px; padding:5px 8px;
  background:transparent; border:0; border-radius:var(--r-sm);
  text-align:start; color:var(--ink);
  transition:background .16s;
}
.cl-item:hover{ background:var(--line-soft); }
.cl-box{
  flex:0 0 auto;
  width:20px; height:20px;
  display:grid; place-items:center;
  border-radius:6px;
  border:1.5px solid var(--faint);
  color:var(--surface); font-size:12px; line-height:1;
  transition:background .16s, border-color .16s;
}
.cl-title{ font-size:13px; font-weight:600; line-height:1.45; }
.cl-item.is-done .cl-box{ background:var(--personal); border-color:var(--personal); }
.cl-item.is-done .cl-title{ color:var(--faint); text-decoration:line-through; }

.row.list.is-complete .row-title{ color:var(--personal); }

/* ---------- quick notes ---------- */
.row.note{ align-items:flex-start; }
.row.note.is-pinned{
  border-inline-start:3px solid var(--gold);
  border-radius:var(--r-sm);
  background:linear-gradient(to left, var(--gold-soft), transparent 42%);
}
.note-body{
  margin-top:6px;
  font-size:13px; line-height:1.65; color:var(--muted);
  white-space:pre-wrap; word-break:break-word;
}
.quick-acts{ display:flex; flex-wrap:wrap; gap:7px; margin-top:9px; }
.mini{
  min-height:34px; min-width:0;
  padding:0 11px;
  background:var(--card-2); border:1px solid var(--line-soft);
  border-radius:999px;
  color:var(--muted); font-size:12px; font-weight:700; white-space:nowrap;
  transition:color .16s, border-color .16s;
}
.mini:hover{ color:var(--gold); border-color:var(--gold-edge); }

/* day grouping in the calendar view */
.day-group{ margin-bottom:14px; }
.day-head{
  display:flex; align-items:baseline; justify-content:space-between;
  margin:0 4px 8px;
  font-size:13.5px; font-weight:700; color:var(--muted);
}
.day-head .day-count{ color:var(--faint); font-size:12px; font-weight:600; }

/* ==========================================================================
   Calendar engine — day / week / month / agenda
   Geometry note: --hour-h must stay in sync with HOUR_PX in app.js, the
   day-view block layout is positioned in pixels against this row height.
   ========================================================================== */

.cal-views{ margin-top:14px; }
.cal-views .seg{ padding:9px 4px; font-size:13.5px; }

.cal-nav{
  display:flex; align-items:center; gap:8px;
  margin:14px 2px 12px;
}
.cal-arrow{
  flex:0 0 auto;
  width:var(--tap); height:var(--tap);
  display:grid; place-items:center;
  background:var(--card); border:1px solid var(--line-soft);
  border-radius:var(--r-md);
  color:var(--muted); font-size:20px; line-height:1;
  transition:color .18s, border-color .18s;
}
.cal-arrow:hover{ color:var(--gold); border-color:var(--gold-edge); }

.cal-range{ flex:1 1 auto; min-width:0; text-align:center; }
.cal-range b{ display:block; font-size:15px; font-weight:800; }

.cal-today{
  flex:0 0 auto;
  padding:0 14px; height:var(--tap);
  background:var(--gold-soft); border:1px solid var(--gold-edge);
  border-radius:var(--r-md);
  color:var(--gold); font-size:13px; font-weight:800;
}
.cal-today:hover{ filter:brightness(1.08); }

/* horizontal swipe navigates periods; vertical scroll stays native */
.cal-stage{ touch-action:pan-y; }

.cal-legend{
  display:flex; gap:8px; justify-content:center;
  margin-top:10px;
}

/* ---------- month grid ---------- */
.cal-month{
  padding:8px;
  background:var(--card); border:1px solid var(--line-soft);
  border-radius:var(--r-lg);
}
.cal-dow{
  display:grid; grid-template-columns:repeat(7,1fr); gap:4px;
  margin-bottom:6px;
}
.cal-dow span{ text-align:center; font-size:11.5px; font-weight:800; color:var(--faint); }

.cal-grid{ display:grid; grid-template-columns:repeat(7,1fr); gap:4px; }

.cal-cell{
  display:flex; flex-direction:column; align-items:center; gap:4px;
  min-width:0;                        /* 7 columns must survive a 320px screen */
  min-height:60px; padding:7px 2px;
  background:transparent; border:1px solid transparent;
  border-radius:var(--r-sm);
  transition:background .16s, border-color .16s;
}
.cal-cell:hover{ background:var(--line-soft); border-color:var(--gold-edge); }
.cal-num{ font-size:13.5px; font-weight:700; font-variant-numeric:tabular-nums; }
.cal-cell.is-out{ opacity:.42; }
.cal-cell.is-today{ background:var(--gold-soft); border-color:var(--gold-edge); }
.cal-cell.is-today .cal-num{ color:var(--gold); }

.cal-dots{ display:flex; flex-wrap:wrap; justify-content:center; gap:3px; min-height:6px; }
.dot{ display:block; width:6px; height:6px; border-radius:50%; }
.dot-personal{ background:var(--personal); }
.dot-business{ background:var(--business); }
.cal-more{ font-size:10px; font-weight:800; color:var(--faint); }

/* ---------- week grid ---------- */
.cal-week{
  background:var(--card); border:1px solid var(--line-soft);
  border-radius:var(--r-lg); overflow:hidden;
}
.wk-head, .wk-body{ display:grid; grid-template-columns:34px repeat(7,1fr); }
.wk-head{ border-bottom:1px solid var(--line-soft); }
.wk-head span{
  padding:7px 0; text-align:center;
  font-size:11px; font-weight:700; color:var(--faint); line-height:1.5;
}
.wk-head .is-today{ color:var(--gold); }

.wk-hour{
  display:grid; place-items:center;
  font-size:10.5px; font-weight:700; color:var(--faint);
  font-variant-numeric:tabular-nums;
  border-inline-end:1px solid var(--line-soft);
}
.wk-cell{
  display:flex; flex-direction:column; gap:2px;
  min-width:0; min-height:var(--tap);
  padding:3px 2px;
  background:transparent;
  border:0;
  border-bottom:1px solid var(--line-soft);
  border-inline-end:1px solid var(--line-soft);
}
.wk-cell:hover{ background:var(--line-soft); }
.wk-cell.is-today{ background:var(--gold-soft); }
.wk-allday .wk-cell{ min-height:34px; }

.wk-chip{
  display:block; max-width:100%;
  padding:2px 5px; border-radius:6px;
  font-size:10.5px; font-weight:700; line-height:1.5;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.wk-personal{ color:var(--personal); background:var(--personal-soft); }
.wk-business{ color:var(--business); background:var(--business-soft); }

/* ---------- day timeline (00:00 → 23:59) ---------- */
.cal-day{
  padding:8px 10px;
  background:var(--card); border:1px solid var(--line-soft);
  border-radius:var(--r-lg);
}
.dv-untimed{
  display:flex; flex-wrap:wrap; gap:6px;
  padding:4px 2px 10px;
  border-bottom:1px solid var(--line-soft);
}
.dv-grid{ display:grid; grid-template-columns:52px 1fr; margin-top:8px; }
.dv-hours{ display:flex; flex-direction:column; }
.dv-hour{
  height:var(--hour-h); flex:0 0 var(--hour-h);
  font-size:11.5px; font-weight:700; color:var(--faint);
  font-variant-numeric:tabular-nums;
}
.dv-canvas{
  position:relative; min-width:0;
  border-inline-start:1px solid var(--line-soft);
}
.dv-slot{
  display:block; width:100%;
  height:var(--hour-h); min-height:var(--hour-h);
  padding:0; background:transparent;
  border:0; border-bottom:1px solid var(--line-soft);
}
.dv-slot:hover{ background:var(--line-soft); }

.dv-block{
  position:absolute; z-index:2;
  overflow:hidden;
  padding:5px 8px;
  background:var(--card-2); border:1px solid var(--line-soft);
  border-radius:var(--r-sm);
  border-inline-start:3px solid var(--gold);
  box-shadow:var(--shadow-sm);
}
.dv-block b{ display:block; font-size:12.5px; font-weight:700; line-height:1.4;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.dv-block span{ display:block; font-size:11px; color:var(--faint); }
.dv-personal{ border-inline-start-color:var(--personal); }
.dv-business{ border-inline-start-color:var(--business); }

.dv-now{
  position:absolute; inset-inline:0; z-index:3;
  height:0;
  border-top:2px solid var(--danger);
  pointer-events:none;
}
.dv-now::before{
  content:""; position:absolute; top:-5px; inset-inline-start:0;
  width:9px; height:9px; border-radius:50%;
  background:var(--danger);
}

/* ==========================================================================
   Bottom navigation (mobile)
   ========================================================================== */

.tabbar{
  position:fixed; inset-inline:0; bottom:0; z-index:40;
  display:flex; align-items:flex-end; justify-content:space-around;
  height:calc(var(--bar-h) + var(--safe-b));
  padding-bottom:var(--safe-b);
  background:var(--bar-bg);
  backdrop-filter:blur(14px);
  border-top:1px solid var(--line-soft);
}
.tab{
  flex:1 1 0; min-width:0;
  height:var(--bar-h);
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px;
  background:transparent; border:0;
  color:var(--faint);
  transition:color .18s;
}
.tab .ico{ font-size:18px; line-height:1; }
.tab-label{ font-size:11px; font-weight:700; }
.tab.is-active{ color:var(--gold); }

.tab-add{ color:var(--gold); }
.tab-add-btn{
  width:46px; height:46px; margin-top:-20px;
  border-radius:50%;
  display:grid; place-items:center;
  background:var(--gold); color:var(--surface);
  font-size:24px; font-weight:700; line-height:1;
  box-shadow:var(--glow-gold);
}

/* ==========================================================================
   Master Add floating CTA
   ========================================================================== */

.fab{
  position:fixed; z-index:35;
  bottom:calc(var(--bar-h) + var(--safe-b) + 16px);
  inset-inline-start:50%; transform:translateX(50%);
  padding:0 22px; height:48px;
  border:0; border-radius:999px;
  background:var(--gold); color:var(--surface);
  font-size:15px; font-weight:800; white-space:nowrap;
  box-shadow:var(--glow-fab);
  transition:transform .18s, filter .18s;
}
.fab:hover{ filter:brightness(1.06); }
.fab:active{ transform:translateX(50%) scale(.97); }

/* ==========================================================================
   Bottom sheets
   ========================================================================== */

.backdrop{
  position:fixed; inset:0; z-index:50;
  background:var(--scrim);
  backdrop-filter:blur(3px);
  animation:fade .2s ease both;
}
@keyframes fade{ from{opacity:0} to{opacity:1} }

.sheet{
  position:fixed; z-index:60;
  inset-inline:0; bottom:0;
  max-height:88vh; overflow-y:auto;
  padding:8px 18px calc(18px + var(--safe-b));
  background:var(--card);
  border-top:1px solid var(--line);
  border-radius:var(--r-xl) var(--r-xl) 0 0;
  box-shadow:var(--shadow);
  animation:slideUp .26s cubic-bezier(.2,.8,.25,1) both;
}
@keyframes slideUp{ from{ transform:translateY(100%); } to{ transform:none; } }

.sheet-grab{
  width:42px; height:4px; margin:4px auto 10px;
  border-radius:999px; background:var(--line-soft);
}
.sheet-head{
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  margin-bottom:14px;
}
.sheet-head h2{ font-size:18px; font-weight:800; }
.sheet-x{
  background:transparent; border:0; color:var(--faint); font-size:16px;
  border-radius:50%;
}
.sheet-x:hover{ color:var(--ink); }
.sheet-tail{ height:6px; }

.type-grid{ display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.type-btn{
  display:flex; align-items:center; gap:12px;
  padding:16px 14px;
  background:var(--card-2); border:1px solid var(--line-soft);
  border-radius:var(--r-md);
  font-size:14.5px; font-weight:700; text-align:start;
  transition:border-color .18s, transform .16s, background .18s;
}
.type-btn:hover{ border-color:var(--gold-edge); transform:translateY(-2px); }
.type-btn:first-child{ grid-column:1 / -1; }
.type-ico{
  width:34px; height:34px; flex:0 0 34px;
  display:grid; place-items:center;
  border-radius:10px;
  background:var(--gold-soft); color:var(--gold); font-size:16px;
}

/* ---------- form ---------- */
.field{ margin-bottom:14px; }
.field-label{
  display:block; margin-bottom:6px;
  font-size:12.5px; font-weight:700; color:var(--muted);
}
.field-row{ display:flex; gap:10px; }
.field-row > .field{ flex:1 1 0; min-width:0; }

.input, .textarea, .select{
  width:100%; max-width:100%;
  padding:12px 14px;
  min-height:var(--tap);
  background:var(--surface);
  border:1px solid var(--line-soft);
  border-radius:var(--r-md);
  color:var(--ink);
  font-family:inherit;
  font-size:16px;                 /* iOS auto-zoom lock — do not lower */
  outline:none;
  transition:border-color .18s;
}
.input:focus, .textarea:focus, .select:focus{ border-color:var(--gold-edge); }
.input::placeholder, .textarea::placeholder{ color:var(--faint); }
.textarea{ min-height:92px; resize:vertical; line-height:1.6; }

.sheet-actions{ display:flex; gap:10px; margin-top:18px; }
.btn{
  flex:1 1 0;
  padding:0 18px; height:var(--tap);
  border-radius:var(--r-md); border:1px solid transparent;
  font-size:15px; font-weight:800;
  transition:filter .18s, background .18s;
}
.btn-gold{ background:var(--gold); color:var(--surface); }
.btn-gold:hover{ filter:brightness(1.06); }
.btn-ghost{ background:transparent; border-color:var(--line-soft); color:var(--muted); }
.btn-ghost:hover{ color:var(--ink); background:var(--line-soft); }

/* ==========================================================================
   Toast
   ========================================================================== */

.toast{
  position:fixed; z-index:80;
  bottom:calc(var(--bar-h) + var(--safe-b) + 74px);
  inset-inline-start:50%; transform:translateX(50%);
  max-width:calc(100vw - 40px);
  padding:11px 18px;
  background:var(--card-2); border:1px solid var(--gold-edge);
  border-radius:999px;
  color:var(--ink); font-size:13.5px; font-weight:700;
  box-shadow:var(--shadow-sm);
  animation:rise .2s ease both;
}

/* ==========================================================================
   Client CRM · client drawer · Next-Action alert engine   (Sprint 4)
   ========================================================================== */

/* ---------- pipeline sub-tabs (5 stages wrap onto 2 rows on a phone) ---------- */
.client-tabs{ margin-top:14px; flex-wrap:wrap; }
.client-tabs .seg{ flex:1 1 30%; padding:9px 4px; font-size:12.5px; }
.client-tabs .seg.is-active .seg-count{ color:var(--gold); }

/* ---------- client status badges — colour AND the Hebrew stage name ---------- */
.cst-lead{        background:var(--gold-soft);     color:var(--gold); }
.cst-contacted{   background:var(--progress-soft); color:var(--progress); }
.cst-interested{  background:var(--personal-soft); color:var(--personal); }
.cst-quoted{      background:var(--business-soft); color:var(--business); border-color:var(--business-edge); }
.cst-awaiting{    background:var(--waiting-soft);  color:var(--waiting);  border-color:var(--waiting-edge); }
.cst-meeting{     background:var(--gold-soft);     color:var(--gold);     border-color:var(--gold-edge); }
.cst-won{         background:var(--personal-soft); color:var(--personal); border-color:var(--personal-edge); }
.cst-irrelevant{  background:var(--muted-soft);    color:var(--faint); }
.cst-past{        background:var(--muted-soft);    color:var(--muted); }

/* the mandated alert badge — the loudest thing on a client card */
.badge.no-action{
  background:var(--danger-soft); color:var(--danger);
  border-color:var(--danger-edge);
  box-shadow:var(--danger-glow);
}

/* ---------- client card list ---------- */
.client-cards{ display:flex; flex-direction:column; gap:12px; }

.cl-card{
  display:flex; flex-direction:column;
  background:var(--card); border:1px solid var(--line-soft);
  border-radius:var(--r-lg);
  border-inline-start:3px solid var(--line-soft);
  overflow:hidden;
  transition:border-color .18s, transform .16s;
}
.cl-card:hover{ transform:translateY(-2px); border-color:var(--gold-edge); }

/* the stage is carried by the card rail too, never by the badge alone */
.cst-row-lead{        border-inline-start-color:var(--gold); }
.cst-row-contacted{   border-inline-start-color:var(--progress); }
.cst-row-interested{  border-inline-start-color:var(--personal); }
.cst-row-quoted{      border-inline-start-color:var(--business); }
.cst-row-awaiting{    border-inline-start-color:var(--waiting); }
.cst-row-meeting{     border-inline-start-color:var(--gold); }
.cst-row-won{         border-inline-start-color:var(--personal); }
.cst-row-irrelevant,
.cst-row-past{        border-inline-start-color:var(--faint); }

.cl-card.is-missing{ border-color:var(--danger-edge); }

/* the whole identity block is one tap target that opens the file */
.cl-open{
  display:flex; flex-direction:column; align-items:flex-start; gap:7px;
  width:100%; padding:15px 16px 13px;
  background:transparent; border:0;
  text-align:start; color:var(--ink);
}
.cl-name{ font-size:16px; font-weight:800; line-height:1.3; }
.cl-badges{ display:flex; flex-wrap:wrap; gap:7px; }
.cl-contact{
  font-size:12.5px; color:var(--muted); direction:ltr; text-align:start;
  font-variant-numeric:tabular-nums;
  overflow:hidden; text-overflow:ellipsis; max-width:100%; white-space:nowrap;
}
.cl-interest{ font-size:12.5px; color:var(--faint); line-height:1.5; }
.cl-quiet{ font-size:12px; color:var(--faint); font-style:italic; }
.cl-open .next-action{ width:100%; }

.cl-acts{
  display:flex; align-items:center; gap:8px; flex-wrap:wrap;
  padding:0 12px 12px;
}

/* ---------- direct call / WhatsApp ---------- */
.qa{
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
  min-height:var(--tap); padding:0 15px;
  border-radius:999px;
  background:var(--card-2); border:1px solid var(--line-soft);
  color:var(--ink); font-size:13px; font-weight:700; white-space:nowrap;
  text-decoration:none;
  transition:border-color .16s, color .16s, background .16s;
}
.qa-mini{ min-height:38px; padding:0 13px; font-size:12.5px; }
.qa-call:hover{ color:var(--business); border-color:var(--business-edge); }
.qa-wa:hover{ color:var(--personal); border-color:var(--personal-edge); }
.qa.is-off{ color:var(--faint); background:transparent; cursor:default; }
.cl-acts .sheet-x{ margin-inline-start:auto; }

/* ==========================================================================
   Client drawer (תיק לקוח) — slide-over, mobile-first
   ========================================================================== */

.drawer{
  position:fixed; z-index:55;
  inset-inline:0; bottom:0;
  max-height:92vh; overflow-y:auto;
  padding:8px 16px calc(18px + var(--safe-b));
  background:var(--card);
  border-top:1px solid var(--line);
  border-radius:var(--r-xl) var(--r-xl) 0 0;
  box-shadow:var(--shadow);
  animation:slideUp .26s cubic-bezier(.2,.8,.25,1) both;
}
.drawer[hidden]{ display:none; }

.drawer-head{
  display:flex; align-items:flex-start; justify-content:space-between; gap:12px;
  margin-bottom:12px;
}
.drawer-id{ min-width:0; }
.drawer-id h2{ font-size:20px; font-weight:800; line-height:1.3; }
.drawer-sub{ margin-top:4px; font-size:12.5px; color:var(--faint); line-height:1.5; }

.drawer-acts{ display:flex; align-items:center; flex-wrap:wrap; gap:8px; }

/* six tabs never fit a phone row — they scroll, the page never does */
.drawer-tabs{
  margin-top:14px;
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
  scrollbar-width:none;
}
.drawer-tabs::-webkit-scrollbar{ display:none; }
.drawer-tabs .seg{ flex:0 0 auto; padding:9px 14px; font-size:13px; }

.drawer-body{ margin-top:14px; }

.dr-card{
  padding:14px;
  background:var(--surface); border:1px solid var(--line-soft);
  border-radius:var(--r-md);
}
.dr-card + .dr-card{ margin-top:12px; }
.dr-group{ margin-bottom:14px; }
.dr-add{ margin-bottom:12px; }

/* ---------- overview: status picker + next-action editor ---------- */
.dr-status{ margin-bottom:14px; }

.dr-next{
  margin-bottom:16px; padding:12px;
  background:var(--gold-soft); border:1px solid var(--gold-edge);
  border-radius:var(--r-md);
}
.dr-next.is-missing{
  background:var(--danger-soft); border-color:var(--danger-edge);
}
.dr-next .badge{ margin-bottom:8px; }
.dr-next-row{ display:flex; gap:8px; margin-top:8px; }
.dr-next-row .input{ flex:1 1 auto; min-width:0; }
.dr-next-row .btn{ flex:0 0 auto; width:auto; padding:0 20px; }

/* ---------- overview: the fact sheet ---------- */
.dr-facts{ margin:0; display:flex; flex-direction:column; }
.dr-fact{
  display:flex; align-items:baseline; justify-content:space-between; gap:14px;
  padding:9px 0;
  border-bottom:1px solid var(--line-soft);
}
.dr-fact:last-child{ border-bottom:0; }
.dr-fact dt{ flex:0 0 auto; font-size:12.5px; font-weight:700; color:var(--faint); }
.dr-fact dd{
  margin:0; min-width:0;
  font-size:13.5px; font-weight:650; color:var(--ink);
  text-align:end; word-break:break-word;
}

/* ---------- notes composer + history timeline ---------- */
.dr-compose .textarea{ min-height:80px; margin-bottom:10px; }
.dr-compose .btn{ width:100%; }

.dr-log{
  display:flex; align-items:flex-start; gap:10px;
  padding:11px 2px;
  border-bottom:1px solid var(--line-soft);
}
.dr-log:last-child{ border-bottom:0; }
.dr-log-body{ flex:1 1 auto; min-width:0; }
.dr-log-ico{
  flex:0 0 auto;
  width:26px; height:26px;
  display:grid; place-items:center;
  border-radius:50%;
  background:var(--muted-soft); color:var(--muted); font-size:12px;
}
.dr-log-when{
  font-size:11.5px; font-weight:700; color:var(--faint);
  font-variant-numeric:tabular-nums;
}
.dr-log-text{ margin-top:3px; font-size:13.5px; line-height:1.55; color:var(--ink); }
.dr-log .note-body{ margin-top:4px; }

/* the timeline reads its own kinds at a glance */
.dr-log.dr-status  .dr-log-ico{ background:var(--progress-soft); color:var(--progress); }
.dr-log.dr-action  .dr-log-ico{ background:var(--gold-soft);     color:var(--gold); }
.dr-log.dr-contact .dr-log-ico{ background:var(--business-soft); color:var(--business); }
.dr-log.dr-created .dr-log-ico{ background:var(--personal-soft); color:var(--personal); }
.dr-log.dr-link    .dr-log-ico{ background:var(--waiting-soft);  color:var(--waiting); }

/* ==========================================================================
   Desktop
   ========================================================================== */

@media (min-width:900px){
  .app{ max-width:1180px; margin-inline:auto; }

  .rail{
    display:flex; flex-direction:column;
    position:sticky; top:0;
    width:var(--rail-w); flex:0 0 var(--rail-w);
    height:100vh;
    border-inline-start:0;
    border-inline-end:1px solid var(--line-soft);
  }

  .main{ padding:0 28px 80px; }
  .tabbar{ display:none; }
  .topbar-avatar{ display:none; }

  .fab{
    inset-inline-start:auto; inset-inline-end:34px;
    bottom:34px; transform:none;
    height:52px; font-size:16px;
  }
  .fab:active{ transform:scale(.97); }

  .toast{ bottom:104px; }

  .attention{ grid-template-columns:repeat(4,1fr); gap:14px; margin-top:16px; }

  /* the client file becomes a real side panel instead of a bottom sheet */
  .drawer{
    inset-inline:auto 0; top:0; bottom:0;
    width:var(--drawer-w); max-width:92vw; max-height:none;
    padding:18px 22px 40px;
    border-radius:0;
    border-top:0; border-inline-start:1px solid var(--line);
    animation:slideIn .26s cubic-bezier(.2,.8,.25,1) both;
  }
  @keyframes slideIn{ from{ transform:translateX(-100%); } to{ transform:none; } }

  .client-cards{ display:grid; grid-template-columns:repeat(2,1fr); gap:14px; }
  .client-tabs .seg{ flex:1 1 0; font-size:13.5px; }

  /* calendar gets the extra room a desktop canvas offers */
  .cal-cell{ min-height:92px; padding:10px 4px; }
  .cal-num{ font-size:15px; }
  .cal-dow span{ font-size:12.5px; }
  .wk-head, .wk-body{ grid-template-columns:52px repeat(7,1fr); }
  .wk-cell{ min-height:54px; }
  .wk-chip{ font-size:11.5px; }
  .cal-range b{ font-size:17px; }

  .summary{ padding:26px 24px; }
  .summary-greet{ font-size:24px; }
  .summary-line{ font-size:16px; }

  .sheet{
    inset-inline:auto; inset-inline-end:34px;
    bottom:34px; width:440px;
    border-radius:var(--r-xl);
    border:1px solid var(--line);
  }
  @keyframes slideUp{ from{ transform:translateY(24px); opacity:0; } to{ transform:none; opacity:1; } }
}

@media (prefers-reduced-motion:reduce){
  *{ animation-duration:.01ms !important; transition-duration:.01ms !important; }
}
