/* ============================================================
   Road to Home — Operations Platform
   Typography: Inter · Layout: Bootstrap 5 · Custom shell
   ============================================================ */

:root {
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --color-bg: #f8fafc;
  --color-surface: #ffffff;
  --color-border: #e5e7eb;

  --color-text: #0f172a;
  --color-muted: #64748b;
  --color-subtle: #94a3b8;

  --color-sidebar: #22403c;
  --color-sidebar-2: #2e4e4a;
  --color-sidebar-border: rgba(255,255,255,.08);
  --color-sidebar-text: #e5edf7;
  --color-sidebar-muted: #93a4b8;

  --color-primary: #2e4e4a;
  --color-primary-dark: #22403c;
  --color-primary-soft: #e4edeb;
  --color-accent: #4f8078;
  --color-brand-mist: #8fb3ad;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, .08);

  --sidebar-width: 280px;
  --topbar-height: 64px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   APP SHELL
   ============================================================ */

.app-shell {
  min-height: 100vh;
}

.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  min-height: 100vh;
  background: linear-gradient(180deg, var(--color-sidebar), #16302c);
  color: var(--color-sidebar-text);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  z-index: 1000;
}

.app-main {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

.app-topbar {
  height: var(--topbar-height);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 900;
}

.app-content {
  padding: 32px;
}

/* ------ Sidebar ------ */

.sidebar-brand-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--color-sidebar-border);
}

.sidebar-logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--color-accent), var(--color-primary-dark));
  color: white;
  font-size: 20px;
  flex: none;
}

.sidebar-brand {
  color: #ffffff;
  text-decoration: none;
  font-weight: 800;
  font-size: 17px;
  line-height: 1.1;
}

.sidebar-brand:hover {
  color: #ffffff;
}

.sidebar-subtitle {
  color: var(--color-sidebar-muted);
  font-size: 12px;
  margin-top: 2px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 0;
  border-bottom: 1px solid var(--color-sidebar-border);
}

.sidebar-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #e5edf7;
  color: #334155;
  font-weight: 700;
  flex: none;
}

.sidebar-user-name {
  color: #ffffff;
  font-weight: 700;
  font-size: 14px;
}

.sidebar-user-role {
  color: var(--color-sidebar-muted);
  font-size: 12px;
}

.sidebar-section-label {
  margin: 24px 0 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--color-sidebar-muted);
}

.sidebar-nav {
  display: grid;
  gap: 6px;
}

.sidebar-link {
  min-height: 42px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--color-sidebar-text);
  text-decoration: none;
  border-radius: 10px;
  font-weight: 600;
  transition: background .15s ease, color .15s ease;
}

.sidebar-link i {
  color: var(--color-sidebar-muted);
  font-size: 18px;
}

.sidebar-link:hover {
  background: rgba(255,255,255,.07);
  color: #ffffff;
}

.sidebar-link:hover i {
  color: #ffffff;
}

.sidebar-link.active {
  background: linear-gradient(135deg, var(--color-accent), #3d6b62);
  color: #ffffff;
  box-shadow: 0 8px 20px rgba(79, 128, 120, .35);
}

.sidebar-link.active i {
  color: #ffffff;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 24px;
}

.sidebar-collapse-btn {
  border: 0;
  background: transparent;
  color: var(--color-sidebar-text);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  cursor: pointer;
}

/* ------ Topbar ------ */

.topbar-menu-btn,
.topbar-icon-btn {
  border: 1px solid var(--color-border);
  background: #ffffff;
  color: var(--color-text);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.topbar-search {
  max-width: 380px;
  width: 100%;
  margin-left: auto;
  position: relative;
}

.topbar-search i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-muted);
}

.topbar-search input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 0 12px 0 38px;
  outline: none;
  font-family: var(--font-sans);
  font-size: 14px;
}

.topbar-search input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(46, 78, 74, .1);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-icon-btn {
  position: relative;
}

.topbar-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--color-primary);
  color: white;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1;
  padding: 4px 6px;
  font-weight: 700;
}

.topbar-user {
  border: 0;
  background: transparent;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--color-text);
  cursor: pointer;
}

/* ============================================================
   PAGE HEADER
   ============================================================ */

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.page-title {
  font-size: 32px;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -.03em;
  margin: 0;
}

.page-description {
  margin: 8px 0 0;
  color: var(--color-muted);
  font-size: 15px;
}

.page-breadcrumbs {
  font-size: 14px;
  color: var(--color-muted);
  margin-bottom: 12px;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
  border-radius: 10px;
  font-weight: 700;
}

.btn-primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  box-shadow: 0 8px 18px rgba(46, 78, 74, .22);
}

.btn-primary:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
}

.btn-outline-secondary {
  border-color: var(--color-border);
  color: #334155;
  background: #ffffff;
}

.btn-icon {
  border: 0;
  background: transparent;
  color: var(--color-text);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
}

.btn-icon:hover {
  background: #f1f5f9;
}

/* ============================================================
   CARDS
   ============================================================ */

.card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  background: var(--color-surface);
}

/* ============================================================
   SITEWIDE FILTER SYSTEM
   ============================================================ */

.filter-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 24px;
}

.filter-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 20px 8px;
  background: #ffffff;
}

.filter-title {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.filter-title h2 {
  margin: 0;
  font-size: 14px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--color-text);
}

.filter-title p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--color-muted);
}

.filter-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--color-accent), var(--color-primary-dark));
  color: #ffffff;
  flex: none;
  box-shadow: 0 8px 18px rgba(79, 128, 120, .22);
}

.filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  color: var(--color-text);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.filter-toggle:hover {
  color: var(--color-primary);
  text-decoration: none;
}

.filter-card-body {
  padding: 18px 20px 22px;
}

.filter-form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 18px 24px;
  align-items: end;
}

.filter-field,
.filter-toggle-field {
  min-width: 0;
}

.filter-field label,
.toggle-label {
  display: block;
  margin-bottom: 8px;
  color: var(--color-text);
  font-size: 13px;
  font-weight: 700;
}

.form-select,
.form-control {
  min-height: 42px;
  border-radius: 10px;
  border-color: #cbd5e1;
  font-size: 14px;
}

.filter-field .form-select,
.filter-field .form-control {
  width: 100%;
  background-color: #ffffff;
  color: var(--color-text);
  box-shadow: none;
}

.filter-field .form-select:focus,
.filter-field .form-control:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 .2rem rgba(46, 78, 74, .12);
}

.filter-form-actions {
  display: flex;
  gap: 10px;
  align-items: end;
}

.filter-form-actions .btn {
  min-height: 42px;
  padding-inline: 18px;
  white-space: nowrap;
}

/* Active filter chips */

.active-filter-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--color-border);
  background: #f8fafc;
  flex-wrap: wrap;
}

.active-filter-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--color-text);
  font-size: 13px;
  font-weight: 800;
}

.active-filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--color-primary);
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
}

.active-filter-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 8px;
  background: #eef2ff;
  color: #1e293b;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.filter-chip:hover {
  background: #e0e7ff;
  color: #111827;
  text-decoration: none;
}

.filter-chip i {
  color: #64748b;
  font-size: 14px;
}

/* ============================================================
   LIST CARD & TABLES
   ============================================================ */

.list-card {
  overflow: hidden;
}

.list-card-header,
.list-card-footer {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.list-card-header {
  border-bottom: 1px solid var(--color-border);
}

.list-card-footer {
  border-top: 1px solid var(--color-border);
}

.list-actions {
  display: flex;
  gap: 10px;
}

.crm-table {
  font-size: 14px;
}

.crm-table thead th {
  background: #f8fafc;
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  border-bottom: 1px solid var(--color-border);
  padding: 14px 16px;
  white-space: nowrap;
}

.crm-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid #edf2f7;
  vertical-align: middle;
  white-space: nowrap;
}

.crm-table tbody tr:hover {
  background: #f8fafc;
}

.table-primary-link {
  color: var(--color-text);
  font-weight: 700;
  text-decoration: none;
}

.table-primary-link:hover {
  color: var(--color-primary);
}

/* ============================================================
   STATUS BADGES
   ============================================================ */

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.badge-critical,
.badge-danger {
  background: #fee2e2;
  color: #dc2626;
}

.badge-high {
  background: #ffedd5;
  color: #ea580c;
}

.badge-medium {
  background: #fef3c7;
  color: #d97706;
}

.badge-low,
.badge-success {
  background: #dcfce7;
  color: #16a34a;
}

.badge-info {
  background: #dbeafe;
  color: #2563eb;
}

.badge-neutral {
  background: #e5e7eb;
  color: #334155;
}

/* ============================================================
   DROPDOWN ACTION MENU
   ============================================================ */

.action-menu {
  border-radius: 12px;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-md);
  padding: 8px;
}

.action-menu .dropdown-item {
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */

.empty-state {
  text-align: center;
  padding: 56px 24px;
  color: var(--color-muted);
}

.empty-state i {
  font-size: 42px;
  color: #cbd5e1;
  margin-bottom: 16px;
}

.empty-state h3 {
  font-size: 16px;
  color: var(--color-text);
  font-weight: 800;
  margin-bottom: 6px;
}

.empty-state p {
  margin-bottom: 16px;
}

/* Legacy empty class */
.empty {
  color: var(--color-muted);
  font-style: italic;
  padding: 16px 0;
}

/* ============================================================
   ADMIN SECTION HEADER
   ============================================================ */

.admin-section-header {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.admin-section-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--color-accent), var(--color-primary-dark));
  color: #ffffff;
  font-size: 22px;
  flex: none;
}

.admin-section-copy h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
}

.admin-section-copy p {
  margin: 4px 0 0;
  color: var(--color-muted);
}

.admin-section-action {
  margin-left: auto;
}

/* ============================================================
   PRODUCT DASHBOARD: OPERATIONS COMMAND CENTER
   ============================================================ */

.dashboard-page {
  display: grid;
  gap: 24px;
}

.dashboard-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.dashboard-hero h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--color-text);
}

.dashboard-hero p {
  margin: 8px 0 0;
  color: var(--color-muted);
  font-size: 15px;
}

.wave {
  display: inline-block;
}

.dashboard-date {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--color-text);
  text-align: right;
}

.dashboard-date i {
  font-size: 22px;
  color: var(--color-text);
}

.dashboard-date strong {
  display: block;
  font-size: 14px;
}

.dashboard-date span {
  display: block;
  color: var(--color-muted);
  font-size: 13px;
  margin-top: 2px;
}

/* KPI Cards */

.dashboard-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.dashboard-kpi-card {
  min-height: 132px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--color-text);
  text-decoration: none;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.dashboard-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
  color: var(--color-text);
}

.dashboard-kpi-card.urgent {
  border-color: #fb7185;
}

.kpi-icon {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: #ffffff;
  font-size: 26px;
  flex: none;
  box-shadow: 0 14px 28px rgba(15, 23, 42, .12);
}

.kpi-purple {
  background: linear-gradient(135deg, var(--color-accent), var(--color-primary));
}

.kpi-blue {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.kpi-red {
  background: linear-gradient(135deg, #fb7185, #e11d48);
}

.kpi-green {
  background: linear-gradient(135deg, #22c55e, #16a34a);
}

.kpi-copy strong {
  display: block;
  font-size: 30px;
  line-height: 1;
  font-weight: 800;
  color: var(--color-text);
}

.kpi-copy span {
  display: block;
  margin-top: 6px;
  color: var(--color-text);
  font-weight: 800;
  font-size: 15px;
}

.kpi-copy small {
  display: block;
  margin-top: 8px;
  color: var(--color-muted);
  font-size: 13px;
  font-weight: 700;
}

/* Main Dashboard Grid */

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr .9fr;
  gap: 16px;
  align-items: start;
}

.dashboard-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  padding: 20px;
}

.dashboard-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.dashboard-card-header h2 {
  margin: 0;
  font-size: 13px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #334155;
}

.dashboard-card-header h2 span {
  color: var(--color-muted);
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}

.dashboard-card-header p {
  margin: 6px 0 0;
  color: var(--color-muted);
  font-size: 13px;
}

.dashboard-card-link {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 800;
  font-size: 13px;
  white-space: nowrap;
}

.dashboard-card-link:hover {
  color: var(--color-primary-dark);
}

/* Priorities */

.priorities-card {
  grid-column: span 1;
}

.priority-list {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: 14px;
}

.priority-item {
  position: relative;
  display: grid;
  grid-template-columns: 46px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px 14px 14px 18px;
  border-bottom: 1px solid var(--color-border);
  background: #ffffff;
}

.priority-item:last-child {
  border-bottom: 0;
}

.priority-item::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: #cbd5e1;
}

.priority-critical::before {
  background: #ef4444;
}

.priority-warning::before {
  background: #fb923c;
}

.priority-success::before {
  background: #22c55e;
}

.priority-info::before {
  background: #3b82f6;
}

.priority-purple::before {
  background: var(--color-accent);
}

.priority-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 18px;
  background: #f1f5f9;
}

.priority-critical .priority-icon {
  background: #fee2e2;
  color: #dc2626;
}

.priority-warning .priority-icon {
  background: #ffedd5;
  color: #ea580c;
}

.priority-success .priority-icon {
  background: #dcfce7;
  color: #16a34a;
}

.priority-info .priority-icon {
  background: #dbeafe;
  color: #2563eb;
}

.priority-purple .priority-icon {
  background: var(--color-primary-soft);
  color: var(--color-primary-dark);
}

.priority-content strong {
  display: block;
  font-size: 14px;
  font-weight: 800;
  color: var(--color-text);
}

.priority-content span {
  display: block;
  margin-top: 3px;
  color: var(--color-muted);
  font-size: 13px;
}

.priority-meta {
  display: flex;
  align-items: center;
  gap: 16px;
}

.priority-meta span {
  color: var(--color-text);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.priority-action {
  min-width: 78px;
  text-align: center;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.priority-action-critical {
  background: #fee2e2;
  color: #dc2626;
}

.priority-action-warning {
  background: #ffedd5;
  color: #ea580c;
}

.priority-action-success {
  background: #dcfce7;
  color: #16a34a;
}

.priority-action-info {
  background: #dbeafe;
  color: #2563eb;
}

.priority-action-purple {
  background: var(--color-primary-soft);
  color: var(--color-primary-dark);
}

/* Business Health */

.business-health-card {
  grid-column: span 1;
}

.health-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.health-card {
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 16px;
  background: #ffffff;
}

.health-header span {
  display: block;
  color: var(--color-text);
  font-weight: 800;
  font-size: 13px;
}

.health-header strong {
  display: inline-block;
  margin-top: 10px;
  font-size: 28px;
  line-height: 1;
  font-weight: 800;
}

.health-header small {
  margin-left: 10px;
  font-weight: 800;
}

.sparkline {
  height: 56px;
  margin-top: 14px;
  border-radius: 10px;
  overflow: hidden;
  line-height: 0;
}

.sparkline svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* Legacy .sparkline-<color> classes below are superseded by inline,
   data-driven SVGs rendered from the view; kept as harmless fallback. */

.sparkline-purple {
  background:
    linear-gradient(180deg, rgba(79,128,120,.22), rgba(79,128,120,0)),
    url("data:image/svg+xml,%3Csvg width='220' height='70' viewBox='0 0 220 70' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolyline points='0,50 15,42 30,46 45,35 60,38 75,30 90,32 105,26 120,20 135,25 150,14 165,28 180,18 195,22 210,10' fill='none' stroke='%234f8078' stroke-width='4' stroke-linecap='round'/%3E%3C/svg%3E");
}

.sparkline-blue {
  background:
    linear-gradient(180deg, rgba(59,130,246,.20), rgba(59,130,246,0)),
    url("data:image/svg+xml,%3Csvg width='220' height='70' viewBox='0 0 220 70' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolyline points='0,52 15,48 30,40 45,44 60,34 75,31 90,36 105,24 120,20 135,18 150,25 165,14 180,19 195,27 210,30' fill='none' stroke='%233b82f6' stroke-width='4' stroke-linecap='round'/%3E%3C/svg%3E");
}

.sparkline-orange {
  background:
    linear-gradient(180deg, rgba(251,146,60,.20), rgba(251,146,60,0)),
    url("data:image/svg+xml,%3Csvg width='220' height='70' viewBox='0 0 220 70' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolyline points='0,48 15,55 30,44 45,50 60,42 75,36 90,40 105,28 120,24 135,35 150,22 165,20 180,32 195,28 210,36' fill='none' stroke='%23fb923c' stroke-width='4' stroke-linecap='round'/%3E%3C/svg%3E");
}

.sparkline-green {
  background:
    linear-gradient(180deg, rgba(34,197,94,.20), rgba(34,197,94,0)),
    url("data:image/svg+xml,%3Csvg width='220' height='70' viewBox='0 0 220 70' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolyline points='0,58 15,52 30,54 45,47 60,42 75,44 90,36 105,33 120,28 135,18 150,24 165,30 180,20 195,22 210,12' fill='none' stroke='%2322c55e' stroke-width='4' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* Recent Activity */

.recent-activity-card {
  grid-column: span 1;
}

.mini-activity-list {
  display: grid;
  gap: 16px;
}

.mini-activity-item {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 12px;
}

.mini-activity-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 18px;
}

.mini-activity-purple {
  background: var(--color-primary-soft);
  color: var(--color-primary-dark);
}

.mini-activity-blue {
  background: #dbeafe;
  color: #2563eb;
}

.mini-activity-green {
  background: #dcfce7;
  color: #16a34a;
}

.mini-activity-orange {
  background: #ffedd5;
  color: #ea580c;
}

.mini-activity-item strong {
  display: block;
  font-size: 14px;
  font-weight: 800;
}

.mini-activity-item span {
  display: block;
  color: var(--color-muted);
  font-size: 13px;
  margin-top: 2px;
}

.mini-activity-item time {
  color: var(--color-muted);
  font-size: 12px;
  white-space: nowrap;
}

/* Pipeline */

.pipeline-card {
  grid-column: span 2;
}

.pipeline-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
}

.pipeline-column {
  min-height: 230px;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
}

.column-new {
  background: #f5f3ff;
}

.column-contacted {
  background: #fff7ed;
}

.column-qualified {
  background: #eff6ff;
}

.column-nurturing {
  background: #faf5ff;
}

.column-closed {
  background: #ecfdf5;
}

.pipeline-column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.pipeline-column-header strong {
  font-size: 14px;
  font-weight: 800;
}

.pipeline-column-header span {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--color-primary);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.pipeline-items {
  display: grid;
  gap: 8px;
}

.pipeline-items article {
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 10px;
  box-shadow: var(--shadow-sm);
}

.pipeline-items article strong {
  display: block;
  font-size: 13px;
  font-weight: 800;
}

.pipeline-items article span,
.pipeline-items article time {
  display: inline-block;
  margin-top: 4px;
  color: var(--color-muted);
  font-size: 12px;
}

.pipeline-items article time {
  float: right;
}

.pipeline-column > a {
  margin-top: auto;
  padding-top: 12px;
  color: var(--color-primary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 800;
  text-align: right;
}

/* Schedule */

.schedule-card {
  grid-column: span 1;
}

.schedule-list {
  display: grid;
  gap: 10px;
}

.schedule-list article {
  display: grid;
  grid-template-columns: 72px 1fr 20px;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: #ffffff;
}

.schedule-list time {
  color: var(--color-primary);
  font-weight: 800;
  font-size: 13px;
}

.schedule-list strong {
  display: block;
  font-weight: 800;
  font-size: 14px;
}

.schedule-list span {
  display: block;
  color: var(--color-muted);
  font-size: 13px;
}

.schedule-list i {
  color: var(--color-muted);
}

/* Donuts */

.donut-card {
  grid-column: span 1;
}

.donut-wrap {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 18px;
  align-items: center;
}

.donut {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  position: relative;
}

.donut::after {
  content: "";
  position: absolute;
  inset: 26px;
  background: #ffffff;
  border-radius: 50%;
}

.donut-sources {
  background: conic-gradient(#2e4e4a 0 35%, #3b82f6 35% 65%, #22c55e 65% 85%, #fb923c 85% 100%);
}

.donut-priority {
  background: conic-gradient(#ef4444 0 25%, #fb923c 25% 67%, #3b82f6 67% 92%, #22c55e 92% 100%);
}

.legend-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 9px;
}

.legend-list li {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  align-items: center;
  gap: 8px;
  color: var(--color-text);
  font-size: 13px;
  font-weight: 700;
}

.legend-list strong {
  color: var(--color-muted);
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
}

.legend-dot.purple {
  background: var(--color-primary);
}

.legend-dot.blue {
  background: #3b82f6;
}

.legend-dot.teal {
  background: #14b8a6;
}

.legend-dot.green {
  background: #22c55e;
}

.legend-dot.orange {
  background: #fb923c;
}

.legend-dot.red {
  background: #ef4444;
}

/* Quick Actions */

.quick-actions-card {
  grid-column: span 1;
}

.quick-action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.quick-action {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: #ffffff;
  color: var(--color-text);
  text-decoration: none;
  font-weight: 800;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.quick-action:hover {
  transform: translateY(-1px);
  border-color: #cbd5e1;
  box-shadow: var(--shadow-sm);
  color: var(--color-text);
}

.quick-action i {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
}

.quick-purple {
  background: var(--color-primary-soft);
  color: var(--color-primary-dark);
}

.quick-blue {
  background: #dbeafe;
  color: #2563eb;
}

.quick-orange {
  background: #ffedd5;
  color: #ea580c;
}

.quick-green {
  background: #dcfce7;
  color: #16a34a;
}

/* Responsive Dashboard */

@media (max-width: 1399px) {
  .dashboard-grid {
    grid-template-columns: 1fr 1fr;
  }

  .recent-activity-card,
  .schedule-card,
  .quick-actions-card {
    grid-column: span 1;
  }

  .pipeline-card {
    grid-column: span 2;
  }
}

@media (max-width: 1199px) {
  .dashboard-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .pipeline-card,
  .priorities-card,
  .business-health-card,
  .recent-activity-card,
  .schedule-card,
  .donut-card,
  .quick-actions-card {
    grid-column: span 1;
  }

  .pipeline-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .dashboard-hero {
    flex-direction: column;
  }

  .dashboard-date {
    text-align: left;
  }

  .dashboard-kpi-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-kpi-card {
    min-height: auto;
  }

  .priority-item {
    grid-template-columns: 42px 1fr;
  }

  .priority-meta {
    grid-column: 2;
    justify-content: space-between;
  }

  .health-grid {
    grid-template-columns: 1fr;
  }

  .pipeline-board {
    grid-template-columns: 1fr;
  }

  .donut-wrap {
    grid-template-columns: 1fr;
  }

  .quick-action-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   DETAIL VIEW HELPERS
   ============================================================ */

.note-item { padding: 8px 0; border-bottom: 1px solid var(--color-border); }
.note-item:last-child { border-bottom: none; }
.note-meta { font-size: 12px; color: var(--color-muted); margin-bottom: 4px; }

.log-item { padding: 6px 0; border-bottom: 1px solid var(--color-border); font-size: 13px; }
.log-item:last-child { border-bottom: none; }

/* Card section titles (detail views) */
.card-section-title {
  text-transform: uppercase;
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 16px;
}

/* ============================================================
   ACTION CARDS (right-side panels)
   ============================================================ */

.action-card {
  margin-bottom: 16px;
}

.action-card .card-body {
  padding: 18px;
}

.action-card-title,
.section-title {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--color-muted);
  margin-bottom: 16px;
}

.field-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-muted);
  margin-bottom: 6px;
}

.action-card .form-select,
.action-card .form-control {
  border-radius: 10px;
  border-color: #cbd5e1;
  min-height: 42px;
  font-size: 14px;
}

.action-card textarea.form-control {
  min-height: 96px;
}

/* ============================================================
   SITEWIDE ACTIVITY TIMELINE
   ============================================================ */

.content-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-description {
  margin: 6px 0 0;
  color: var(--color-muted);
  font-size: 13px;
}

.activity-timeline {
  display: grid;
  gap: 0;
}

.activity-item {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 12px;
  position: relative;
}

.activity-item:not(:last-child) .activity-marker::after {
  content: "";
  position: absolute;
  left: 9px;
  top: 24px;
  bottom: -2px;
  width: 2px;
  background: #e2e8f0;
}

.activity-marker {
  position: relative;
  display: flex;
  justify-content: center;
  padding-top: 5px;
}

.activity-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--color-primary);
  box-shadow: 0 0 0 4px var(--color-primary-soft);
  z-index: 1;
}

.activity-dot-default {
  background: var(--color-primary);
  box-shadow: 0 0 0 4px var(--color-primary-soft);
}

.activity-dot-system {
  background: #64748b;
  box-shadow: 0 0 0 4px #f1f5f9;
}

.activity-dot-warning,
.activity-dot-escalation {
  background: #f97316;
  box-shadow: 0 0 0 4px #ffedd5;
}

.activity-dot-success {
  background: #22c55e;
  box-shadow: 0 0 0 4px #dcfce7;
}

.activity-dot-danger {
  background: #ef4444;
  box-shadow: 0 0 0 4px #fee2e2;
}

.activity-content {
  padding-bottom: 18px;
  border-bottom: 1px solid #edf2f7;
}

.activity-item:last-child .activity-content {
  border-bottom: 0;
  padding-bottom: 0;
}

.activity-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.activity-title {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  color: var(--color-text);
}

.activity-meta {
  margin: 4px 0 0;
  color: var(--color-muted);
  font-size: 13px;
}

.activity-description {
  margin: 8px 0 0;
  color: var(--color-text);
  font-size: 14px;
}

.activity-change-summary {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-size: 14px;
  font-weight: 600;
}

.activity-fields {
  margin: 12px 0 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
}

.activity-fields div {
  padding: 9px 10px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid var(--color-border);
}

.activity-fields dt {
  margin: 0;
  color: var(--color-muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.activity-fields dd {
  margin: 3px 0 0;
  color: var(--color-text);
  font-size: 13px;
  font-weight: 700;
}

.technical-details {
  margin-top: 12px;
}

.technical-details summary {
  cursor: pointer;
  color: var(--color-muted);
  font-size: 13px;
  font-weight: 700;
}

.technical-details pre {
  margin: 10px 0 0;
  padding: 12px;
  border-radius: 10px;
  background: #0f172a;
  color: #e5e7eb;
  font-size: 12px;
  overflow-x: auto;
}

/* Definition lists */
dt {
  font-weight: 600;
  color: var(--color-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 8px;
}
dd { margin-left: 0; margin-bottom: 4px; }

/* Queue section (work queues) */
.queue-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  margin-bottom: 24px;
}

/* ============================================================
   PAGINATION
   ============================================================ */

.pagination .page-link {
  border-radius: 9px;
  margin: 0 3px;
  color: var(--color-text);
  border-color: var(--color-border);
  font-weight: 700;
}

.pagination .active .page-link {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 991px) {
  .app-sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
  }

  .app-sidebar.sidebar-open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,.3);
  }

  .app-main {
    margin-left: 0;
  }

  .app-content {
    padding: 24px 16px;
  }

  .filter-form {
    grid-template-columns: repeat(3, minmax(160px, 1fr));
  }
}

@media (max-width: 767px) {
  .filter-card-header {
    align-items: center;
  }

  .filter-form {
    grid-template-columns: 1fr;
  }

  .filter-form-actions {
    grid-column: span 1;
    flex-direction: column;
  }

  .filter-form-actions .btn {
    width: 100%;
  }

  .active-filter-row {
    align-items: flex-start;
  }

  .active-filter-row .ms-auto {
    margin-left: 0 !important;
    width: 100%;
  }

  /* Action cards consistent spacing */
  .action-card {
    margin-bottom: 12px;
  }

  .action-card .card-body {
    padding: 14px;
  }

  /* Full-width datetime inputs */
  input[type="datetime-local"] {
    width: 100%;
  }

  /* Badge font-size reduction for header badges */
  .d-flex.align-items-center.gap-2 .badge {
    font-size: 11px;
  }

  /* Note item overflow */
  .note-item {
    overflow-wrap: break-word;
    word-break: break-word;
  }
}

@media (max-width: 575px) {
  .page-header {
    flex-direction: column;
  }

  .list-card-header,
  .list-card-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .activity-header {
    flex-direction: column;
    gap: 8px;
  }

  .activity-fields {
    grid-template-columns: 1fr;
  }
}
