/* ============================================================
   DIABLO AI PLATFORM — V4 SHARED STYLESHEET
   ============================================================ */

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

/* ── CSS Custom Properties ── */
:root {
  --color-primary: #000000;
  --color-accent: #0088FF;
  --color-accent-light: #E8F4FF;
  --color-bg: #FFFFFF;
  --color-bg-alt: #F5F5F5;
  --color-bg-hover: #F0F0F0;
  --color-text: #1A1A1A;
  --color-text-secondary: #666666;
  --color-text-tertiary: #999999;
  --color-border: #E5E5E5;
  --color-success: #22C55E;
  --color-warning: #F59E0B;
  --color-error: #EF4444;
  --color-success-bg: #F0FDF4;
  --color-warning-bg: #FFFBEB;
  --color-error-bg: #FEF2F2;
  --sidebar-width: 72px;
  --topbar-height: 56px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-pill: 20px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: var(--font);
  color: var(--color-text);
  background: var(--color-bg-alt);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font-family: var(--font); cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: var(--font); }
ul, ol { list-style: none; }
img { max-width: 100%; }

/* ── Top Bar ── */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-height);
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  padding: 0 16px 0 0;
  z-index: 100;
  gap: 16px;
}
.topbar-logo {
  display: flex;
  align-items: center;
  gap: 0;
  min-width: auto;
  width: auto;
  justify-content: flex-start;
  flex-shrink: 0;
  padding-left: 16px;
}
.topbar-logo .logo-img {
  height: auto;
  width: 192px;
  object-fit: contain;
}
.topbar-divider {
  width: 1px;
  height: 24px;
  background: var(--color-border);
  flex-shrink: 0;
}
.topbar-dealer {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
}
.topbar-search {
  flex: 1;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}
.topbar-search input {
  width: 100%;
  height: 36px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  padding: 0 16px 0 40px;
  font-size: 13px;
  background: var(--color-bg-alt);
  color: var(--color-text);
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}
.topbar-search input:focus {
  border-color: var(--color-accent);
  background: var(--color-bg);
}
.topbar-search .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-tertiary);
  width: 16px; height: 16px;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.topbar-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  transition: background 0.15s, color 0.15s;
  position: relative;
}
.topbar-btn:hover {
  background: var(--color-bg-alt);
  color: var(--color-text);
}
.topbar-btn svg { width: 20px; height: 20px; }
.topbar-btn.ai-dispatch {
  background: var(--color-accent);
  color: white;
  border-radius: var(--radius-pill);
  width: auto;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 600;
  gap: 6px;
}
.topbar-btn.ai-dispatch:hover { background: #0077E6; }
.lang-toggle {
  width: 28px; height: 28px;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
  border: 1.5px solid var(--color-border);
  transition: border-color 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lang-toggle:hover {
  border-color: var(--color-text-tertiary);
}
.lang-toggle img,
.lang-toggle svg {
  width: 28px;
  height: 28px;
  display: block;
}
.topbar-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--color-accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  margin-left: 4px;
  cursor: pointer;
}
.notification-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: var(--color-error);
  border-radius: 50%;
  border: 2px solid var(--color-bg);
}

/* ── Sidebar ── */
.sidebar {
  position: fixed;
  top: var(--topbar-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--color-bg);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  z-index: 90;
  overflow: visible;
}
.sidebar::-webkit-scrollbar { width: 0; }
.sidebar-nav {
  padding: 8px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-divider {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text-tertiary);
  text-align: center;
  padding: 12px 0 4px;
  margin: 4px 10px 0;
  border-top: 1px solid var(--color-border);
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 4px;
  gap: 3px;
  border-radius: var(--radius-md);
  margin: 0 6px;
  color: var(--color-text-secondary);
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
  text-decoration: none;
  position: relative;
}
.nav-item:hover {
  background: #E2E8F0;
  color: var(--color-text);
}
.nav-item.active {
  background: var(--color-accent-light);
  color: var(--color-accent);
}
.nav-item svg { width: 22px; height: 22px; stroke-width: 1.5; }
.nav-item .nav-label {
  font-size: 9px;
  font-weight: 500;
  text-align: center;
  line-height: 1.1;
  max-width: 56px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-bottom {
  margin-top: auto;
  padding: 8px 0 12px;
}

/* ── Flyout Menus ── */
.flyout-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 89;
}
.flyout-overlay.open { display: block; }

/* Hover-triggered flyouts for pinned nav items */
.nav-item[data-flyout] { position: relative; }
.nav-item[data-flyout]:hover > .flyout-hover {
  display: block;
}
.flyout-hover {
  display: none;
  position: absolute;
  left: 100%;
  top: -8px;
  padding-left: 8px; /* bridge gap so hover doesn't break */
  z-index: 95;
}
/* Bottom flyouts (Customize) open upward */
.sidebar-bottom .flyout-hover {
  top: auto;
  bottom: -8px;
}

/* All Apps flyout: open upward */
.nav-item[data-nav-id="all-apps"] > .flyout-hover {
  top: auto;
  bottom: -8px;
}

.flyout-hover .flyout-inner {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 12px 0;
  min-width: 200px;
}

.flyout {
  display: none;
  position: fixed;
  left: var(--sidebar-width);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 12px 0;
  min-width: 200px;
  z-index: 95;
}
.flyout.open { display: block; }
.flyout-header {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-tertiary);
  padding: 4px 16px 8px;
}
.flyout-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--color-text);
  cursor: pointer;
  transition: background 0.15s;
}
.flyout-item:hover { background: var(--color-bg-alt); }
.flyout-item svg { width: 14px; height: 14px; color: var(--color-text-tertiary); }
.flyout-sub {
  display: none;
  position: absolute;
  left: 100%;
  top: 0;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 12px 0;
  min-width: 200px;
}
.flyout-group { position: relative; }
.flyout-group:hover .flyout-sub { display: block; }

/* ── Main Content Area ── */
.main {
  margin-left: var(--sidebar-width);
  margin-top: var(--topbar-height);
  height: calc(100vh - var(--topbar-height));
  overflow-y: auto;
  padding: 24px;
}

/* ── Page Header ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text);
}
.page-header-sub {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-top: 2px;
}
.page-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: background 0.15s, box-shadow 0.15s;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary {
  background: var(--color-accent);
  color: white;
}
.btn-primary:hover { background: #0077E6; }
.btn-secondary {
  background: var(--color-bg);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}
.btn-secondary:hover { background: var(--color-bg-alt); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon {
  width: 32px; height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text-secondary);
}
.btn-icon:hover { background: var(--color-bg-alt); color: var(--color-text); }

/* ── Cards ── */
.card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}
.card-subtitle {
  font-size: 12px;
  color: var(--color-text-secondary);
}

/* ── Stat Cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.stat-card .stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 8px;
}
.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1;
}
.stat-card .stat-change {
  font-size: 12px;
  font-weight: 500;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.stat-change.up { color: var(--color-success); }
.stat-change.down { color: var(--color-error); }
.stat-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}
.stat-icon svg { width: 20px; height: 20px; }
.stat-icon.blue { background: var(--color-accent-light); color: var(--color-accent); }
.stat-icon.green { background: var(--color-success-bg); color: var(--color-success); }
.stat-icon.yellow { background: var(--color-warning-bg); color: var(--color-warning); }
.stat-icon.red { background: var(--color-error-bg); color: var(--color-error); }

/* ── Tables ── */
.table-wrap {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  gap: 12px;
}
.table-search {
  position: relative;
}
.table-search input {
  height: 32px;
  width: 240px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0 12px 0 32px;
  font-size: 13px;
  outline: none;
}
.table-search input:focus { border-color: var(--color-accent); }
.table-search svg {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px;
  color: var(--color-text-tertiary);
}
.table-filters {
  display: flex;
  gap: 8px;
  align-items: center;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-tertiary);
  background: var(--color-bg-alt);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
th:hover { color: var(--color-text-secondary); }
td {
  padding: 12px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--color-bg-alt); }
.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  font-size: 12px;
  color: var(--color-text-secondary);
  border-top: 1px solid var(--color-border);
}

/* ── Badges & Status ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  border-radius: 100px;
  white-space: nowrap;
}
.badge-blue { background: var(--color-accent-light); color: var(--color-accent); }
.badge-green { background: var(--color-success-bg); color: #16A34A; }
.badge-yellow { background: var(--color-warning-bg); color: #D97706; }
.badge-red { background: var(--color-error-bg); color: var(--color-error); }
.badge-gray { background: #F3F4F6; color: var(--color-text-secondary); }

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}
.status-dot.active { background: var(--color-success); }
.status-dot.warning { background: var(--color-warning); }
.status-dot.error { background: var(--color-error); }
.status-dot.inactive { background: var(--color-text-tertiary); }

/* ── Progress bar ── */
.progress-bar {
  height: 6px;
  background: var(--color-border);
  border-radius: 3px;
  overflow: hidden;
}
.progress-bar .fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s;
}
.progress-bar .fill.blue { background: var(--color-accent); }
.progress-bar .fill.green { background: var(--color-success); }

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 20px;
}
.tab {
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--color-text); }
.tab.active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

/* ── Grid Layouts ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.grid-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: 16px; }

/* ── Form Elements ── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: 6px;
}
.form-input {
  width: 100%;
  height: 36px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}
.form-input:focus { border-color: var(--color-accent); }
select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--color-text-secondary);
}
.empty-state svg { width: 48px; height: 48px; color: var(--color-border); margin-bottom: 16px; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--color-text); margin-bottom: 8px; }
.empty-state p { font-size: 13px; max-width: 320px; margin: 0 auto; }

/* ── Avatar ── */
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
}
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.avatar.lg { width: 40px; height: 40px; font-size: 14px; }

/* ── Tooltip ── */
[data-tooltip] { position: relative; }
[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-left: 8px;
  background: var(--color-text);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  white-space: nowrap;
  z-index: 100;
  pointer-events: none;
}

/* ── Charts placeholder ── */
.chart-placeholder {
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, var(--color-bg-alt) 0%, var(--color-bg) 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-tertiary);
  font-size: 13px;
  border: 1px dashed var(--color-border);
}

/* ── Activity Feed ── */
.activity-list { display: flex; flex-direction: column; }
.activity-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}
.activity-content { flex: 1; }
.activity-text { font-size: 13px; color: var(--color-text); }
.activity-text strong { font-weight: 600; }
.activity-time { font-size: 11px; color: var(--color-text-tertiary); margin-top: 2px; }

/* ── Scrollbar ── */
.main::-webkit-scrollbar { width: 6px; }
.main::-webkit-scrollbar-track { background: transparent; }
.main::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 3px; }
.main::-webkit-scrollbar-thumb:hover { background: var(--color-text-tertiary); }

/* ── Calendar / Time blocks ── */
.time-block {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  align-items: flex-start;
}
.time-label {
  font-size: 12px;
  color: var(--color-text-tertiary);
  width: 60px;
  text-align: right;
  flex-shrink: 0;
  padding-top: 4px;
}
.time-event {
  flex: 1;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--color-accent);
  background: var(--color-accent-light);
  font-size: 13px;
}
.time-event.green { border-left-color: var(--color-success); background: var(--color-success-bg); }
.time-event.yellow { border-left-color: var(--color-warning); background: var(--color-warning-bg); }
.time-event.red { border-left-color: var(--color-error); background: var(--color-error-bg); }
.time-event .event-title { font-weight: 600; }
.time-event .event-detail { font-size: 12px; color: var(--color-text-secondary); margin-top: 2px; }

/* ── Dashboard: AI Follow-Up Ticker ── */
.dash-ticker {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.ticker-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text);
  white-space: nowrap;
}
.ticker-stats {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  font-size: 12px;
  color: var(--color-text-secondary);
  flex-wrap: wrap;
}
.ticker-stats strong { color: var(--color-text); font-weight: 600; }
.ticker-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.ticker-badge.on { background: var(--color-success-bg); color: var(--color-success); }
.ticker-divider {
  width: 1px;
  height: 14px;
  background: var(--color-border);
}
.ticker-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-accent);
  white-space: nowrap;
}
.ticker-link:hover { text-decoration: underline; }

/* ── Dashboard: KPI Cards ── */
.dash-kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.kpi-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.kpi-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-secondary);
  margin-bottom: 8px;
}
.kpi-value-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.kpi-big {
  font-size: 48px;
  font-weight: 800;
  color: var(--color-text);
  line-height: 1;
}
.kpi-target {
  font-size: 16px;
  font-weight: 400;
  color: var(--color-text-tertiary);
}
.kpi-meta {
  font-size: 12px;
  font-weight: 500;
}
.kpi-meta.up { color: var(--color-success); }
.kpi-meta.down { color: var(--color-error); }
.kpi-sentiment {
  font-size: 11px;
  color: var(--color-text-tertiary);
  margin-top: 2px;
}
.kpi-sentiment.success { color: var(--color-success); }

/* ── Dashboard: Opportunities by Alert ── */
.dash-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-secondary);
  margin-bottom: 10px;
}
.opp-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}
.opp-card {
  border-radius: var(--radius-lg);
  padding: 12px 8px;
  text-align: center;
  color: #fff;
  position: relative;
}
.opp-letter {
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 10px;
  font-weight: 700;
  opacity: 0.7;
  text-transform: uppercase;
}
.opp-num {
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
}
.opp-label {
  font-size: 10px;
  font-weight: 500;
  opacity: 0.85;
}
.opp-total {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-bottom: 24px;
}
.opp-total strong { color: var(--color-text); }

/* ── Dashboard: Bottom 3-Column Grid ── */
.dash-bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}
.dash-right-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Dashboard: Needs Action ── */
.action-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.action-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--color-border);
}
.action-item:last-child { border-bottom: none; }
.action-bar {
  width: 3px;
  height: 36px;
  border-radius: 2px;
  flex-shrink: 0;
}
.action-bar.green { background: var(--color-success); }
.action-bar.yellow { background: var(--color-warning); }
.action-bar.red { background: var(--color-error); }
.action-content { flex: 1; min-width: 0; }
.action-title { font-size: 13px; font-weight: 600; color: var(--color-text); }
.action-sub { font-size: 11px; color: var(--color-text-tertiary); margin-top: 2px; }
.action-check { flex-shrink: 0; }

/* ── Dashboard: Approvals ── */
.approval-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.approval-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--color-border);
}
.approval-item:last-child { border-bottom: none; }
.approval-item .approval-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
  vertical-align: middle;
}
.approval-title { font-size: 13px; font-weight: 600; color: var(--color-text); display: inline; }
.approval-sub { font-size: 11px; color: var(--color-text-tertiary); margin-top: 4px; }
.approval-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

/* ── Dashboard: Work Orders ── */
.wo-list {
  display: flex;
  flex-direction: column;
}
.wo-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 13px;
}
.wo-item:last-child { border-bottom: none; }
.wo-name { color: var(--color-text); font-weight: 500; }
.wo-viewall {
  display: block;
  text-align: right;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-accent);
  margin-top: 8px;
}
.wo-viewall:hover { text-decoration: underline; }

/* ── Dashboard: Fast Reports ── */
.fast-reports {
  display: flex;
  flex-direction: column;
}
.fr-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  font-size: 13px;
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border);
}
.fr-item:last-child { border-bottom: none; }
.fr-item:hover { color: var(--color-accent); }
.fr-item svg { flex-shrink: 0; color: var(--color-text-tertiary); }

/* ── Dashboard V2 Refinements ── */
.dash-ticker.v2 {
  background: #F0F7FF;
  border-color: #D0E3FF;
  border-left: 3px solid var(--color-accent);
}
.ticker-dot {
  color: var(--color-text-tertiary);
  font-size: 10px;
  user-select: none;
}
.kpi-bar {
  margin: 14px 0 10px;
  height: 8px;
}
.kpi-sentiment.warm { color: #D97706; }
.btn-approve {
  background: var(--color-success);
  color: #fff;
}
.btn-approve:hover { background: #16A34A; }

/* ── Responsive ── */
@media (max-width: 1200px) {
  .opp-grid { grid-template-columns: repeat(5, 1fr); }
  .dash-bottom-grid { grid-template-columns: 1fr 1fr; }
  .dash-right-stack { grid-column: span 2; flex-direction: row; }
  .dash-right-stack .card { flex: 1; }
}
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .dash-kpis { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .sidebar { width: 56px; }
  .main { margin-left: 56px; padding: 16px; }
  .nav-item .nav-label { display: none; }
  .stats-grid { grid-template-columns: 1fr; }
  .grid-2, .grid-3, .grid-4, .grid-2-1, .grid-1-2 { grid-template-columns: 1fr; }
  .dash-kpis { grid-template-columns: 1fr; }
  .opp-grid { grid-template-columns: repeat(3, 1fr); }
  .dash-bottom-grid { grid-template-columns: 1fr; }
  .dash-right-stack { grid-column: span 1; flex-direction: column; }
  .dash-ticker { flex-wrap: wrap; }
}
