/* =====================================================================
   Desktop UI layer — Command Center dashboard
   ---------------------------------------------------------------------
   A purely presentational layer added on top of the existing app. Every
   rule here is scoped to the new dashboard view ([data-view="dashboard"])
   or to the desktop navigation rail, so it cannot affect any other screen.
   It introduces no new data, IDs, permissions or behaviour — it only lays
   out information that the app already reads through its existing APIs.
   Loaded after styles.css so the shared design tokens (--blue, --grad …)
   are already defined.
   ===================================================================== */

/* Give the new view its own nav-rail icon (the rail itself is desktop-only). */
@media (min-width:1025px) {
  .tab[data-tab="dashboard"]::before { content:"🏠"; }
}

/* ---- Hero band ---- */
.dash-hero {
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:26px 28px;
  margin:0 0 22px;
  border-radius:24px;
  color:#fff;
  background:var(--grad);
  box-shadow:0 18px 40px #2563eb33;
}
.dash-hero h1 { margin:0; font-size:26px; color:#fff; letter-spacing:-.4px; }
.dash-hero-sub { margin:6px 0 0; color:#eaf0ff; font-weight:600; line-height:1.4; }
.dash-hero-cta {
  border:0;
  border-radius:999px;
  padding:12px 20px;
  font-weight:800;
  color:var(--blue);
  background:#fff;
  box-shadow:0 8px 20px #0b1f3a26;
  transition:transform .15s ease, box-shadow .2s ease;
}
.dash-hero-cta:hover { transform:translateY(-2px); box-shadow:0 12px 26px #0b1f3a33; }

/* ---- KPI tiles ---- */
.dash-kpis {
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:14px;
  margin:0 0 22px;
}
.dash-kpi {
  display:flex;
  align-items:center;
  gap:14px;
  text-align:left;
  padding:18px;
  border:1px solid var(--line);
  border-radius:20px;
  background:var(--card);
  box-shadow:0 8px 22px #00000008;
  transition:transform .14s ease, box-shadow .2s ease, border-color .2s ease;
}
.dash-kpi:hover { transform:translateY(-3px); box-shadow:0 16px 32px #2563eb1f; border-color:#c9d8f0; }
.dash-kpi-ico {
  flex:0 0 auto;
  width:48px; height:48px;
  display:grid; place-items:center;
  font-size:24px;
  border-radius:15px;
  background:#eef4ff;
}
.dash-kpi-body { display:flex; flex-direction:column; min-width:0; }
.dash-kpi-num { font-size:28px; font-weight:900; line-height:1.05; }
.dash-kpi-label { font-size:13px; font-weight:700; color:var(--muted); }
.dash-kpi-blue   .dash-kpi-ico { background:#e7f1ff; } .dash-kpi-blue   .dash-kpi-num { color:var(--blue); }
.dash-kpi-green  .dash-kpi-ico { background:#e7f8ee; } .dash-kpi-green  .dash-kpi-num { color:var(--green); }
.dash-kpi-orange .dash-kpi-ico { background:#fef3e2; } .dash-kpi-orange .dash-kpi-num { color:#d97706; }
.dash-kpi-violet .dash-kpi-ico { background:#f1e9ff; } .dash-kpi-violet .dash-kpi-num { color:var(--violet); }

/* ---- Panel grid ---- */
.dash-grid {
  display:grid;
  grid-template-columns:1fr;
  gap:18px;
}
.dash-panel { margin:0; }
/* The embedded calendar lives directly on the Dashboard, below the summary
   cards. It reuses the existing calendar (cal-*) styling untouched. */
.dash-calendar { margin-top:22px; scroll-margin-top:16px; }
.dash-panel-head {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin:0 0 12px;
}
.dash-panel-head h3 { margin:0; font-size:17px; }
.dash-link {
  border:0;
  background:transparent;
  color:var(--blue);
  font-weight:800;
  font-size:13px;
  padding:4px 6px;
  border-radius:10px;
}
.dash-link:hover { background:#eef4ff; }

/* ---- Lists (schedule, activity, roster, snapshot) ---- */
.dash-list { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; }
.dash-row, .dash-member {
  display:flex;
  align-items:center;
  gap:13px;
  padding:11px 2px;
  border-top:1px solid var(--line);
}
.dash-list > :first-child { border-top:0; }
.dash-row-ico {
  flex:0 0 auto;
  width:38px; height:38px;
  display:grid; place-items:center;
  font-size:19px;
  border-radius:12px;
  background:#f1f6ff;
}
.dash-row-main { display:flex; flex-direction:column; min-width:0; }
.dash-row-title {
  font-weight:700;
  font-size:14px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.dash-row-sub { font-size:12.5px; color:var(--muted); margin-top:2px; }
.dash-empty {
  padding:18px 4px;
  color:var(--muted);
  font-size:13.5px;
  line-height:1.5;
}
.dash-avatar {
  flex:0 0 auto;
  width:38px; height:38px;
  display:grid; place-items:center;
  font-weight:900; font-size:13px;
  color:#fff;
  border-radius:50%;
  background:var(--grad);
}

/* ---- Quick-jump bar ---- */
.dash-quickbar {
  display:grid;
  grid-template-columns:repeat(3, 1fr);
  gap:10px;
  margin-top:16px;
}
.dash-quick {
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:6px;
  padding:14px 8px;
  border:1px solid var(--line);
  border-radius:16px;
  background:#f8fbff;
  font-weight:800;
  font-size:12.5px;
  color:var(--ink);
  transition:transform .14s ease, border-color .2s ease, background .2s ease;
}
.dash-quick:hover { transform:translateY(-2px); border-color:var(--blue); background:#fff; color:var(--blue); }
.dash-quick-ico { font-size:22px; }

/* ---- Phone refinements ---- */
@media (max-width:560px) {
  .dash-kpis { grid-template-columns:1fr 1fr; gap:10px; }
  .dash-kpi { padding:14px; gap:11px; }
  .dash-kpi-ico { width:42px; height:42px; font-size:21px; }
  .dash-kpi-num { font-size:23px; }
  .dash-hero { padding:22px; }
  .dash-hero h1 { font-size:22px; }
}

/* ---- Desktop: wide command-center layout ---- */
@media (min-width:1025px) {
  .page[data-view="dashboard"] { max-width:1320px; }

  .dash-kpis { grid-template-columns:repeat(6, minmax(0, 1fr)); gap:16px; }
  .dash-kpi { flex-direction:column; align-items:flex-start; gap:12px; }

  /* The simplified Home is a single, centered column — a focused work
     dashboard rather than a wide command center. */
  .dash-grid { grid-template-columns:1fr; gap:22px; max-width:720px; }

  .dash-hero { padding:30px 34px; }
  .dash-hero h1 { font-size:30px; }
}

/* Extra-wide desktops: let the KPI row breathe a little more. */
@media (min-width:1500px) {
  .dash-kpis { gap:20px; }
}

/* ======================================================================
   PHASE 8 — Sidebar slide-out (mobile), contact workflow tabs, dashboard
   Quick Stats / Reminders / My Tasks cards, install + notification prompts,
   and the per-device notification controls. All additive and scoped so the
   existing desktop sidebar, tile bar and bottom nav are untouched.
   ====================================================================== */

/* Hamburger + slide-out drawer are mobile-only; hidden on desktop where the
   real sidebar already shows. */
.nav-hamburger { display:none; }
.side-drawer, .side-drawer-backdrop { display:none; }

@media (max-width:1024px) {
  .nav-hamburger {
    display:inline-flex; align-items:center; justify-content:center;
    width:42px; height:42px; margin-right:6px; flex:0 0 auto;
    font-size:20px; line-height:1; border:none; border-radius:12px;
    background:rgba(37,99,235,0.10); color:#1d4ed8; cursor:pointer;
  }
  .nav-hamburger:active { transform:scale(0.96); }

  .side-drawer-backdrop {
    display:block; position:fixed; inset:0; z-index:60;
    background:rgba(15,23,42,0.45); opacity:0; pointer-events:none;
    transition:opacity .2s ease;
  }
  .side-drawer {
    display:flex; flex-direction:column; position:fixed; top:0; bottom:0; left:0;
    z-index:61; width:82%; max-width:320px; background:#fff;
    box-shadow:2px 0 24px rgba(15,23,42,0.18);
    transform:translateX(-100%); transition:transform .24s ease;
    overflow-y:auto; padding-bottom:24px;
  }
  body.drawer-open .side-drawer { transform:translateX(0); }
  body.drawer-open .side-drawer-backdrop { opacity:1; pointer-events:auto; }

  .side-drawer-head {
    display:flex; align-items:center; justify-content:space-between;
    padding:18px 18px 12px; position:sticky; top:0; background:#fff;
    border-bottom:1px solid #eef2f7;
  }
  .side-drawer-title { font-weight:700; font-size:18px; color:#0f172a; }
  .side-drawer-close {
    width:34px; height:34px; border:none; border-radius:10px; cursor:pointer;
    background:#f1f5f9; color:#475569; font-size:16px;
  }
  .side-drawer-nav { display:flex; flex-direction:column; padding:10px; gap:4px; }
  .drawer-item {
    display:flex; align-items:center; gap:12px; width:100%;
    padding:13px 14px; border:none; border-radius:12px; cursor:pointer;
    background:transparent; color:#1e293b; font-size:15px; font-weight:600; text-align:left;
  }
  .drawer-item .drawer-ico { font-size:18px; width:24px; text-align:center; }
  .drawer-item.active { background:#2563eb; color:#fff; }
  .drawer-item:not(.active):active { background:#eff6ff; }
  .drawer-item .tab-count {
    margin-left:auto; background:#ef4444; color:#fff; border-radius:999px;
    font-size:11px; font-weight:700; padding:1px 7px;
  }
}

/* ---- Contact workflow tabs: a compact, horizontally scrollable pill row ---- */
.contacts-workflow-tabs {
  display:flex; flex-wrap:nowrap; gap:8px; overflow-x:auto;
  -webkit-overflow-scrolling:touch; padding-bottom:6px; margin-top:4px;
}
.contacts-workflow-tabs::-webkit-scrollbar { height:6px; }
.contacts-workflow-tabs::-webkit-scrollbar-thumb { background:#dbe3ee; border-radius:999px; }
.contacts-workflow-tabs .wf-tab {
  flex:0 0 auto; white-space:nowrap; font-size:13px; padding:8px 14px;
  border-radius:999px;
}

/* ---- Dashboard: hero stack, My Tasks tiles, when-labels, footer links ---- */
/* Hero stacks the greeting, date and tagline with the CTA beneath. */
.dash-hero-text { display:flex; flex-direction:column; align-items:flex-start; gap:2px; }
.dash-hero-date { margin:8px 0 0; color:#eaf0ff; font-weight:700; }
.dash-hero .dash-hero-sub { margin:2px 0 0; }
.dash-hero-cta { margin-top:16px; }
.dash-hero-art { font-size:54px; line-height:1; opacity:.9; }

/* My Tasks: a responsive grid of clickable count tiles. */
.dash-tiles { display:grid; grid-template-columns:repeat(2, minmax(0,1fr)); gap:12px; }
@media (min-width:560px) { .dash-tiles { grid-template-columns:repeat(3, minmax(0,1fr)); } }
.dash-tile {
  display:flex; align-items:center; gap:12px; text-align:left; cursor:pointer; width:100%;
  padding:14px; border:1px solid var(--line); border-radius:16px; background:#f8fafc;
  transition:transform .14s ease, box-shadow .2s ease, border-color .2s ease;
}
.dash-tile:hover { transform:translateY(-2px); box-shadow:0 12px 24px #2563eb14; border-color:#c9d8f0; }
.dash-tile:active { transform:translateY(0); }
.dash-tile-ico {
  flex:0 0 auto; width:40px; height:40px; border-radius:12px;
  display:grid; place-items:center; font-size:20px; background:#eef2ff;
}
.dash-tile-body { display:flex; flex-direction:column; min-width:0; }
.dash-tile-label { font-size:13px; font-weight:700; color:var(--muted); }
.dash-tile-num { font-size:26px; font-weight:900; line-height:1.1; color:var(--ink); }
.dash-tile-blue   .dash-tile-ico { background:#e7f1ff; } .dash-tile-blue   .dash-tile-num { color:var(--blue); }
.dash-tile-green  .dash-tile-ico { background:#e7f8ee; } .dash-tile-green  .dash-tile-num { color:var(--green); }
.dash-tile-orange .dash-tile-ico { background:#fef3e2; } .dash-tile-orange .dash-tile-num { color:#d97706; }
.dash-tile-violet .dash-tile-ico { background:#f1e9ff; } .dash-tile-violet .dash-tile-num { color:var(--violet); }

/* Schedule & reminder rows: a right-aligned, colour-coded when label. */
.dash-when { margin-left:auto; flex:0 0 auto; font-size:13px; font-weight:800; color:var(--muted); }
.dash-when.overdue  { color:#b91c1c; }
.dash-when.today    { color:#d97706; }
.dash-when.tomorrow { color:var(--blue); }

/* In-card footer action ("See full schedule" / "See all reminders"). */
.dash-foot-link {
  display:block; width:100%; margin-top:12px; padding:10px; border:0;
  background:transparent; color:var(--blue); font-weight:800; font-size:14px;
  border-radius:12px; cursor:pointer;
}
.dash-foot-link:hover { background:#eef4ff; }

/* ---- Install / Enable-notifications login prompt ---- */
.install-prompt { position:relative; }
.install-prompt-close {
  position:absolute; top:10px; right:10px; width:30px; height:30px;
  border:none; border-radius:8px; background:#f1f5f9; color:#475569;
  font-size:14px; cursor:pointer;
}

/* ---- Notification Settings: per-device controls ---- */
.notif-device-actions { display:flex; flex-wrap:wrap; gap:10px; margin:10px 0; }
.notif-device-actions button { flex:1 1 auto; }
.notif-daily-time {
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  margin-top:6px; font-weight:600; color:#334155;
}
.notif-daily-time input { max-width:160px; }
