/* ═══════════════════════════════════════════════════════
   ms-inline-shell.css — Canonical Verdi shell layout
   for all MotorSync inline-shell pages (dashboard, list
   views, calendar, analytics, config, etc.)
   Single source of truth — edit HERE, not inline.
   ═══════════════════════════════════════════════════════ */

/* ─── DESIGN TOKENS ─── */
:root {
  --verdi-dark: #022326;
  --verdi-mid: #034040;
  --verdi-accent: #035951;
  --verdi-light: #02735E;
  --primary: #02735E;
  --primary-color: #02735E;
  --primary-hover: #035951;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --purple: #8b5cf6;
  --text-1: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;
  /* Aliases used by PlanSync, ProjectSync and other sub-pages */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --border-color: #e2e8f0;
  --table-header-bg: #f8fafc;
  --hover-bg: #f1f5f9;
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --border: #e2e8f0;
  --hover: #f1f5f9;
  --mist: #f1f5f9;
  --sh-sm: 0 1px 2px rgba(0,0,0,0.04);
  --sh-md: 0 4px 12px rgba(0,0,0,0.06);
  --sh-lg: 0 8px 24px rgba(0,0,0,0.08);
  --sidebar-w: 230px;
  --topbar-h: 50px;
  --accent-color: #035951;
  --surface-page-a: #fafafa;
  --surface-page-b: #f7f7f7;
}

/* ─── DARK MODE ─── */
html[data-theme='dark'] {
  --bg-body: #0f172a;
  --bg-card: #1e293b;
  --text-1: #f1f5f9;
  --text-2: #94a3b8;
  --text-3: #64748b;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --border: #334155;
  --border-color: #334155;
  --hover: #1e293b;
  --hover-bg: #1e293b;
  --mist: #1e293b;
  --table-header-bg: #1e293b;
  --primary-color: #10b981;
  --surface-page-a: #1b2538;
  --surface-page-b: #151d2c;
}

/* ─── RESET ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scrollbar-gutter: stable; overflow-y: scroll; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background: var(--bg-body); color: var(--text-1);
  -webkit-font-smoothing: antialiased; line-height: 1.5;
}
a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* ─── TOPBAR — Verdi Aire gradient ─── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--topbar-h);
  background: linear-gradient(135deg, #022326, #034040, #035951, #02735E, #034040, #022326);
  background-size: 300% 300%;
  animation: aire 8s ease infinite;
  border-bottom: none;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px 0 0;
}
.topbar-left { display: flex; align-items: center; height: 100%; }
.topbar-brand {
  width: var(--sidebar-w); height: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 0 18px; border-right: 1px solid rgba(255,255,255,.12);
  font-weight: 700; font-size: 14px; color: #fff;
}
.topbar-brand i { color: rgba(255,255,255,.7); }
.topbar-modules { display: flex; height: 100%; padding: 0 4px; }
.topbar-mod {
  height: 100%; display: flex; align-items: center; gap: 6px;
  padding: 0 14px; font-size: 12.5px; font-weight: 500;
  color: rgba(255,255,255,.55); border-bottom: 2px solid transparent;
  transition: all 0.15s; text-decoration: none;
}
.topbar-mod:hover { color: rgba(255,255,255,.85); }
.topbar-mod.active { color: #fff; border-bottom-color: #04BF8A; font-weight: 600; }
.topbar-mod i { font-size: 11px; }
.topbar-right { display: flex; align-items: center; gap: 6px; }
.topbar-icon {
  width: 32px; height: 32px; border-radius: 6px;
  border: none; background: none; color: rgba(255,255,255,.65); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; transition: all 0.15s; position: relative;
}
.topbar-icon:hover { background: rgba(255,255,255,.1); color: #fff; }
.topbar-icon .dot {
  position: absolute; top: 5px; right: 5px;
  width: 7px; height: 7px; border-radius: 50%;
  background: #ef4444; border: 2px solid rgba(2,35,38,.6);
}
.topbar-logout {
  height: 32px; padding: 0 12px; border-radius: 6px;
  border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.8); font-size: 12px; font-weight: 600;
  cursor: pointer; display: flex; align-items: center; gap: 5px;
  font-family: inherit; transition: all 0.15s;
}
.topbar-logout:hover { border-color: #ef4444; color: #ef4444; background: rgba(239,68,68,.1); }

/* ─── NOTIFICATIONS DROPDOWN ─── */
.notif-wrapper { position: relative; }
.notif-dropdown {
  display: none; position: absolute; top: 42px; right: 0;
  width: 360px; max-height: 460px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--sh-lg); overflow: hidden; z-index: 200;
}
.notif-dropdown.open { display: block; }
.notif-drop-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.notif-drop-head h4 { font-size: 13px; font-weight: 700; color: var(--text-1); }
.notif-drop-head a { font-size: 11px; color: var(--primary); font-weight: 500; }
.notif-drop-head a:hover { text-decoration: underline; }
.notif-list { overflow-y: auto; max-height: 380px; }
.notif-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 16px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background 0.15s;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--hover); }
.notif-item.unread { background: rgba(2,115,94,0.03); }
.notif-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--primary); flex-shrink: 0; margin-top: 5px;
}
.notif-dot.read { background: transparent; }
.notif-body { flex: 1; min-width: 0; }
.notif-title { font-size: 12.5px; font-weight: 600; color: var(--text-1); line-height: 1.3; }
.notif-meta { font-size: 11px; color: var(--text-3); margin-top: 2px; display: flex; align-items: center; gap: 6px; }
.notif-tag {
  font-size: 9.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; padding: 1px 6px; border-radius: 4px;
}
.notif-tag--plan { background: rgba(2,115,94,0.1); color: var(--primary); }
.notif-tag--thread { background: rgba(139,92,246,0.1); color: var(--purple); }
.notif-tag--project { background: rgba(59,130,246,0.1); color: var(--info); }
.notif-tag--client { background: rgba(20,184,166,0.1); color: #0d9488; }
.notif-tag--lead { background: rgba(245,158,11,0.1); color: #b45309; }
/* Alt notification layout (CRM pages) */
.notif-item .ni-icon {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; flex-shrink: 0;
}
.notif-item .ni-text { flex: 1; }
.notif-item .ni-title { font-size: 12px; font-weight: 600; }
.notif-item .ni-desc { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* ─── SIDEBAR ─── */
.sidebar {
  position: fixed; top: var(--topbar-h); left: 0; bottom: 0;
  width: var(--sidebar-w); background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow-y: auto; z-index: 90;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.sb-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.sb-icon-box {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--verdi-light), var(--verdi-accent));
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sb-icon-box i { color: #fff; font-size: 13px; }
.sb-title { font-size: 13px; font-weight: 700; color: var(--text-1); }
.sb-sub { font-size: 10px; color: var(--text-3); }
.sb-nav { flex: 1; padding: 8px; }
.sb-section { margin-bottom: 4px; }
.sb-label {
  padding: 10px 10px 4px; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3);
}
.sb-link {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 6px;
  font-size: 13px; font-weight: 500;
  color: var(--text-2); transition: all 0.15s;
}
.sb-link:hover { background: var(--hover); color: var(--text-1); }
.sb-link.active { background: rgba(2,115,94,0.08); color: var(--primary); font-weight: 600; }
.sb-link i { width: 16px; text-align: center; font-size: 12px; opacity: 0.7; }
.sb-link.active i { opacity: 1; }
.sb-badge {
  margin-left: auto; font-size: 10px; font-weight: 700;
  background: var(--danger); color: #fff;
  padding: 1px 7px; border-radius: 10px; line-height: 16px;
}
.sb-badge--info { background: rgba(59,130,246,0.1); color: var(--info); }
.sb-badge--soon { background: rgba(148,163,184,0.12); color: var(--text-3); font-size: 9px; }
.sb-footer { padding: 10px 12px; border-top: 1px solid var(--border); }
.sb-user {
  display: flex; align-items: center; gap: 9px;
  padding: 8px; border-radius: 6px;
  cursor: pointer; transition: background 0.1s;
}
.sb-user:hover { background: var(--hover); }
.sb-avatar {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--verdi-light), var(--verdi-mid));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 11px; font-weight: 600;
}
.sb-uname { font-size: 12px; font-weight: 600; color: var(--text-1); }
.sb-urole { font-size: 10px; color: var(--text-3); }

/* ─── MAIN CONTENT AREA ─── */
.main {
  margin-left: var(--sidebar-w); margin-top: var(--topbar-h);
  padding: 22px 24px 48px; width: calc(100% - var(--sidebar-w));
  min-height: calc(100vh - var(--topbar-h));
}

/* ─── MOBILE ─── */
.mobile-toggle {
  display: none; width: 36px; height: 36px; border-radius: 6px;
  border: none; background: none; color: var(--text-2); cursor: pointer;
  align-items: center; justify-content: center; font-size: 16px;
}
@media (max-width: 900px) {
  .mobile-toggle { display: flex; }
  .topbar-modules { display: none; }
  .sidebar { transform: translateX(-100%); transition: transform 0.2s; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; width: 100%; }
}

/* ═══════════════════════════════════════════════════════
   COMPONENT / UTILITY STYLES
   (migrated from styles.css — used across all sub-pages)
   ═══════════════════════════════════════════════════════ */

/* ─── ACCESSIBILITY ─── */
a.skip-link {
  position: absolute; top: -40px; left: 0;
  background: var(--primary-color); color: #fff;
  padding: 8px 16px; border-radius: 0 0 8px 0;
  text-decoration: none; z-index: 1000;
}
a.skip-link:focus { top: 0; }
:focus-visible { outline: 2px solid var(--verdi-accent); outline-offset: 2px; }

/* ─── ANIMATIONS ─── */
@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  25%  { background-position: 100% 50%; }
  50%  { background-position: 100% 100%; }
  75%  { background-position: 0% 100%; }
  100% { background-position: 0% 50%; }
}
@keyframes aire {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}

/* ─── PAGE SECTIONS ─── */
.page {
  display: none;
  flex-direction: column;
  gap: 20px;
  background: var(--surface-page-a);
  border-radius: 8px;
  padding: 20px;
  border: 1px solid var(--border-color);
  box-shadow: 0 30px 50px rgba(15, 23, 42, 0.08);
}
.page.active { display: flex; }

.page-header {
  display: flex; justify-content: space-between;
  align-items: center; margin-bottom: 20px;
}
.page-title {
  font-size: 32px; font-weight: 900;
  color: var(--text-primary);
}
.page-subtitle {
  font-size: 16px; color: var(--text-secondary);
}

/* ─── CARDS ─── */
.card {
  background: var(--bg-card); border-radius: 8px;
  padding: 24px; box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  border: 1px solid var(--border-color);
}
.card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px; padding-bottom: 16px;
  border-bottom: 2px solid var(--border-color);
}
.card-title {
  font-size: 20px; font-weight: 800;
  color: var(--text-primary); margin: 0;
}

/* ─── GRID LAYOUTS ─── */
.grid   { display: grid; gap: 24px; width: 100%; }
.grid-2 { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-3 { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-4 { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* ─── TABLES ─── */
.table-wrapper { width: 100%; overflow-x: auto; }
.table-wrapper table { width: 100%; border-collapse: collapse; }
.table-wrapper th,
.table-wrapper td {
  padding: 12px 14px; border-bottom: 1px solid var(--border-color);
  text-align: left;
}
.table-wrapper tr:hover { background: rgba(2, 115, 94, 0.03); }

/* ─── STAT CARDS ─── */
.stat-card {
  background: var(--bg-card); border-radius: 6px;
  padding: 20px; border: 1px solid var(--border-color);
}
.stat-value {
  font-size: 32px; font-weight: 900;
  color: var(--primary-color); margin-bottom: 8px;
}
.stat-label {
  font-size: 13px; color: var(--text-secondary);
  text-transform: uppercase; font-weight: 600;
}
.stat-change {
  font-size: 13px; margin-top: 8px;
  display: flex; align-items: center; gap: 4px;
}
.stat-change.positive { color: #02735E; }
.stat-change.negative { color: #dc2626; }

/* ─── BUTTONS ─── */
.btn {
  padding: 10px 20px; border-radius: 6px; border: none;
  font-size: 14px; font-weight: 700; cursor: pointer;
  transition: all 0.2s; display: inline-flex; align-items: center; gap: 8px;
}
.btn-primary { background: var(--primary-color); color: white; }
.btn-primary:hover { background: var(--verdi-accent); box-shadow: 0 4px 12px rgba(2, 115, 94, 0.3); }
.btn-secondary { background: var(--bg-card); color: var(--text-primary); border: 2px solid var(--border-color); }
.btn-secondary:hover { border-color: var(--primary-color); color: var(--primary-color); }
.btn-outline { background: transparent; border: 2px solid var(--primary-color); color: var(--primary-color); }
.btn-outline:hover { background: rgba(2, 115, 94, 0.06); box-shadow: 0 6px 20px rgba(2, 115, 94, 0.15); }

/* ─── BADGES ─── */
.badge {
  display: inline-flex; align-items: center;
  padding: 4px 10px; border-radius: 6px;
  font-size: 12px; font-weight: 600; text-transform: uppercase;
}

/* ─── MODALS ─── */
/* Hide any .modal-overlay globally to prevent flash of content before JS initialises */
.modal-overlay {
  display: none;
}
.modal-overlay.active,
.modal-overlay.open,
.modal-overlay[aria-hidden="false"],
.modal-overlay[data-open="true"] {
  display: flex;
}
@keyframes opsModalRise {
  from { opacity: 0; transform: translateY(24px) scale(0.98); }
  to   { opacity: 1; transform: translateY(12px) scale(1); }
}
.ops-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.55); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
  padding: 24px; z-index: 7000;
}
.ops-modal-overlay.active,
.ops-modal-overlay[aria-hidden="false"],
.ops-modal-overlay[data-open="true"] { display: flex; }

.ops-modal {
  width: min(560px, 95vw); background: var(--bg-card);
  border-radius: 8px; border: 1px solid var(--border-color);
  box-shadow: 0 35px 70px rgba(15, 23, 42, 0.25);
  display: flex; flex-direction: column; position: relative;
  animation: opsModalRise 0.25s ease; outline: none;
}
.ops-modal-header {
  padding: 24px 28px 12px; display: flex; gap: 14px; align-items: center;
}
.ops-modal-icon {
  width: 56px; height: 56px; border-radius: 8px;
  background: rgba(2, 115, 94, 0.12);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--primary-color); flex-shrink: 0;
}
.ops-modal-title { margin: 0; font-size: 22px; color: var(--text-primary); }
.ops-modal-subtitle {
  margin: 4px 0 0; color: var(--text-secondary);
  font-size: 14px; line-height: 1.4;
}
.ops-modal-body {
  padding: 4px 28px 8px; display: flex; flex-direction: column; gap: 18px;
}
.ops-modal-footer {
  padding: 18px 28px 24px; display: flex; justify-content: flex-end; gap: 12px;
}
.ops-modal-close {
  position: absolute; top: 12px; right: 12px;
  width: 34px; height: 34px; border-radius: 6px; border: none;
  background: rgba(15, 23, 42, 0.06); color: var(--text-secondary);
  cursor: pointer; display: inline-flex; align-items: center;
  justify-content: center; transition: all 0.2s ease;
}
.ops-modal-close:hover { background: rgba(2, 115, 94, 0.12); color: var(--primary-color); }
.ops-modal .form-field,
.ops-modal .form-group { display: flex; flex-direction: column; gap: 8px; }
.ops-modal .form-field label,
.ops-modal .form-group label { font-weight: 700; color: var(--text-primary); font-size: 14px; }
.ops-modal input,
.ops-modal select,
.ops-modal textarea {
  width: 100%; border-radius: 6px; border: 1px solid var(--border-color);
  padding: 12px 14px; font-size: 14px; color: var(--text-primary); background: var(--bg-card);
}
.ops-modal input:focus,
.ops-modal select:focus,
.ops-modal textarea:focus { outline: 2px solid rgba(2, 115, 94, 0.25); border-color: rgba(2, 115, 94, 0.35); }
.ops-modal-actions .btn,
.ops-modal-footer .btn { min-width: 120px; }
.ops-modal-actions .btn-secondary,
.ops-modal-footer .btn-secondary { background: white; border: 1px solid var(--border-color); color: var(--text-secondary); }
.ops-modal-actions .btn-secondary:hover,
.ops-modal-footer .btn-secondary:hover { border-color: rgba(2, 115, 94, 0.4); color: var(--primary-color); }

/* ═══════════════════════════════════════════════════════
   DASHBOARD MODAL — Detail content styles
   ═══════════════════════════════════════════════════════ */
[data-modal] { cursor: pointer; }
.ops-modal-body.dm-scroll { max-height: 55vh; overflow-y: auto; }

/* Detail list */
.dm-list { display: flex; flex-direction: column; gap: 8px; }
.dm-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 8px;
  background: var(--mist); border: 1px solid var(--border);
  transition: background 0.12s;
}
.dm-item:hover { background: var(--hover); }
.dm-icon {
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}
.dm-info { flex: 1; min-width: 0; }
.dm-name { font-weight: 600; font-size: 13px; color: var(--text-1); }
.dm-meta { font-size: 11px; color: var(--text-3); margin-top: 1px; }
.dm-val { font-weight: 700; font-size: 14px; color: var(--text-1); white-space: nowrap; }

/* Mini stat grid */
.dm-mini-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dm-mini {
  padding: 14px; border-radius: 8px; text-align: center;
  background: var(--mist); border: 1px solid var(--border);
}
.dm-mini .v { font-size: 22px; font-weight: 700; color: var(--text-1); }
.dm-mini .l { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* Progress bar */
.dm-bar { width: 100%; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.dm-bar span { display: block; height: 100%; border-radius: 3px; }

/* Section separator */
.dm-section {
  font-size: 11px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 10px 0 4px;
}

/* Module subscription banner */
.dm-sub-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 8px;
  background: linear-gradient(135deg, rgba(2,115,94,0.06), rgba(3,89,81,0.06));
  border: 1px solid rgba(2,115,94,0.12); margin-bottom: 4px;
}
.dm-sub-banner i { color: var(--primary); }
.dm-sub-banner span { font-size: 12px; color: var(--text-2); }
.dm-sub-banner strong { color: var(--primary); }

/* Status dots */
.dm-status-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.dm-status-dot.active { background: #10b981; }
.dm-status-dot.route { background: #3b82f6; }
.dm-status-dot.idle { background: #94a3b8; }
.dm-status-dot.busy { background: #f59e0b; }
