/* TMK CRM — Component Library */

/* ── Layout ─────────────────────────────── */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  transition: width var(--t-slow);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo img {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.sidebar-logo-text {
  display: flex;
  flex-direction: column;
}

.sidebar-logo-text .brand-name {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.sidebar-logo-text .brand-sub {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 500;
  color: var(--primary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-section {
  padding: 20px 12px 4px;
}

.sidebar-section-label {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sidebar-text-header);
  padding: 0 8px;
  margin-bottom: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--t), color var(--t);
  border-left: 2px solid transparent;
  color: var(--sidebar-text);
  font-family: var(--font-ui);
  font-size: 13.5px;
  font-weight: 500;
  user-select: none;
  margin-bottom: 1px;
  position: relative;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.nav-item.active {
  background: var(--sidebar-active-bg);
  border-left-color: var(--sidebar-active-border);
  color: var(--sidebar-text-active);
}

.nav-item svg { flex-shrink: 0; opacity: 0.85; }
.nav-item.active svg { opacity: 1; }

.nav-badge {
  margin-left: auto;
  background: var(--primary);
  color: var(--deep-teal);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  font-family: var(--font-ui);
}

.nav-badge.danger { background: var(--danger); color: #fff; }
.nav-badge.warning { background: var(--warning); color: #fff; }

.sidebar-footer {
  margin-top: auto;
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--t);
}
.user-chip:hover { background: var(--sidebar-hover); }

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--teal));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  color: var(--deep-teal);
  flex-shrink: 0;
}

.user-info .user-name {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  line-height: 1.2;
}

.user-info .user-role {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--sidebar-text);
}

/* ── Main area ───────────────────────────── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 32px;
  height: 64px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.topbar-title {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

.topbar-search {
  position: relative;
  width: 280px;
}

.topbar-search input {
  padding-left: 38px;
  height: 38px;
  font-size: 14px;
  border-radius: 99px;
  background: var(--surface);
}

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

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

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  transition: background var(--t), color var(--t);
  position: relative;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.notif-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  border: 2px solid var(--white);
}

.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
}

/* ── Buttons ─────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--t);
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: var(--deep-teal);
}
.btn-primary:hover { background: var(--primary-dark); color: #fff; }

.btn-secondary {
  background: var(--white);
  color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); background: var(--info-light); }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: #d4622f; }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: none;
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-sm { padding: 6px 14px; font-size: 12.5px; }
.btn-lg { padding: 13px 28px; font-size: 15px; }
.btn-icon { padding: 10px; border-radius: var(--radius-sm); }

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Cards ───────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.card-body { padding: 24px; }
.card-body-sm { padding: 16px 24px; }
.card-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

/* ── Stat Cards ──────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: box-shadow var(--t), transform var(--t);
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon.cyan  { background: var(--info-light);    color: var(--primary); }
.stat-icon.green { background: var(--success-light);  color: var(--success); }
.stat-icon.orange{ background: var(--warning-light);  color: var(--warning); }
.stat-icon.red   { background: var(--danger-light);   color: var(--danger); }
.stat-icon.teal  { background: rgba(8,129,161,0.1);   color: var(--teal); }

.stat-body { flex: 1; min-width: 0; }
.stat-value {
  font-family: var(--font-ui);
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-label {
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--text-2);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.stat-change {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  margin-top: 6px;
}
.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ── Badges ──────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 600;
  font-family: var(--font-ui);
  white-space: nowrap;
}
.badge-cyan    { background: var(--info-light);    color: var(--primary-dark); }
.badge-green   { background: var(--success-light); color: #177028; }
.badge-orange  { background: var(--warning-light); color: #b06010; }
.badge-red     { background: var(--danger-light);  color: #b54420; }
.badge-gray    { background: var(--surface-2);     color: var(--text-2); }
.badge-teal    { background: rgba(8,129,161,0.12); color: var(--teal); }
.badge-dark    { background: var(--deep-teal);     color: var(--primary); }

/* Job status badges */
.status-new        { background: #e8f4ff; color: #1a6bb5; }
.status-scheduled  { background: var(--info-light); color: var(--primary-dark); }
.status-inprogress { background: var(--warning-light); color: #b06010; }
.status-completed  { background: var(--success-light); color: #177028; }
.status-invoiced   { background: rgba(8,129,161,0.12); color: var(--teal); }
.status-paid       { background: var(--success-light); color: #177028; }
.status-overdue    { background: var(--danger-light); color: #b54420; }
.status-cancelled  { background: var(--surface-2); color: var(--text-2); }

/* Priority badges */
.priority-emergency { background: #fff0f0; color: #c0392b; border: 1px solid #fcc; }
.priority-high      { background: var(--danger-light); color: var(--danger); }
.priority-normal    { background: var(--info-light); color: var(--primary-dark); }
.priority-low       { background: var(--surface-2); color: var(--text-3); }

/* Customer segment badges */
.seg-champion    { background: #fef8e6; color: #9a6b00; }
.seg-atrisk      { background: var(--danger-light); color: #b54420; }
.seg-new         { background: var(--info-light); color: var(--primary-dark); }
.seg-vip         { background: linear-gradient(135deg, #f5e6ff, #e6f0ff); color: #5a3f99; border: 1px solid #c8b0ee; }
.seg-regular     { background: var(--success-light); color: #177028; }

/* ── Tables ──────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  background: var(--white);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  background: var(--surface);
  padding: 12px 16px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: background var(--t);
}
thead th:hover { background: var(--surface-2); color: var(--text); }

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--t);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(28,193,237,0.04); }

tbody td {
  padding: 13px 16px;
  font-size: 14px;
  color: var(--text);
  vertical-align: middle;
}

.td-muted { color: var(--text-2); font-size: 13px; }

/* ── Forms ───────────────────────────────── */
.form-group { margin-bottom: 20px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  font-family: var(--font-ui);
}
.form-label .required { color: var(--danger); margin-left: 2px; }

.form-hint {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 5px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }

.input-icon-wrap { position: relative; }
.input-icon-wrap input { padding-left: 40px; }
.input-icon-wrap .input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
}

.select-wrap { position: relative; }
.select-wrap select { appearance: none; padding-right: 36px; cursor: pointer; }
.select-wrap::after {
  content: '';
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 0; height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid var(--text-3);
  pointer-events: none;
}

/* ── Modals ──────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2,46,59,0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.15s ease;
}

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.2s ease;
}
.modal-lg { max-width: 800px; }
.modal-xl { max-width: 1000px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--white);
  z-index: 1;
}
.modal-title {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
}
.modal-body { padding: 28px; }
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 20px 28px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Tabs ────────────────────────────────── */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
}

.tab {
  padding: 10px 20px;
  font-family: var(--font-ui);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color var(--t), border-color var(--t);
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Progress / Health Bars ──────────────── */
.health-bar-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.health-bar {
  flex: 1;
  height: 6px;
  background: var(--surface-2);
  border-radius: 99px;
  overflow: hidden;
}
.health-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.6s ease;
}
.health-score { font-family: var(--font-ui); font-size: 13px; font-weight: 700; width: 30px; text-align: right; }

/* ── Avatar ──────────────────────────────── */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--teal));
  color: var(--deep-teal);
}
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 48px; height: 48px; font-size: 16px; }

/* ── Alerts ──────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  border-left: 4px solid;
  font-size: 14px;
  margin-bottom: 16px;
}
.alert-info    { background: var(--info-light);    border-color: var(--primary);  color: var(--primary-dark); }
.alert-success { background: var(--success-light); border-color: var(--success);  color: #177028; }
.alert-warning { background: var(--warning-light); border-color: var(--warning);  color: #8a5a00; }
.alert-danger  { background: var(--danger-light);  border-color: var(--danger);   color: #b54420; }

/* ── Kanban ──────────────────────────────── */
.kanban-board {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 16px;
  align-items: flex-start;
}

.kanban-col {
  min-width: 280px;
  max-width: 280px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.kanban-col-header .col-count {
  background: var(--surface-2);
  color: var(--text-2);
  border-radius: 99px;
  padding: 2px 8px;
  font-size: 11px;
}

.kanban-cards { padding: 12px; display: flex; flex-direction: column; gap: 10px; }

.kanban-card {
  background: var(--white);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  cursor: grab;
  transition: box-shadow var(--t), transform var(--t);
}
.kanban-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }

.kanban-card-title { font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.kanban-card-meta { font-size: 12px; color: var(--text-2); }
.kanban-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }

/* ── Calendar / Schedule ─────────────────── */
.cal-grid {
  display: grid;
  grid-template-columns: 60px repeat(5, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--white);
}

.cal-header {
  background: var(--surface);
  padding: 12px;
  text-align: center;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  border-bottom: 2px solid var(--border);
  border-right: 1px solid var(--border);
  color: var(--text-2);
}

.cal-time-cell {
  padding: 8px;
  text-align: right;
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--font-ui);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.cal-day-cell {
  min-height: 60px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 4px;
  position: relative;
}

.cal-event {
  background: var(--info-light);
  border-left: 3px solid var(--primary);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 11px;
  font-family: var(--font-ui);
  font-weight: 600;
  color: var(--primary-dark);
  cursor: pointer;
  margin-bottom: 2px;
  transition: opacity var(--t);
}
.cal-event:hover { opacity: 0.8; }
.cal-event.maintenance { background: var(--success-light); border-color: var(--success); color: #177028; }
.cal-event.emergency   { background: var(--danger-light);  border-color: var(--danger);  color: #b54420; }
.cal-event.install     { background: var(--warning-light); border-color: var(--warning); color: #8a5a00; }

/* ── Page header ─────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}

.page-header-left h1 {
  font-size: 26px;
  color: var(--text);
  margin-bottom: 4px;
}

.page-header-left .page-sub {
  font-size: 14px;
  color: var(--text-2);
}

.page-header-right { display: flex; gap: 10px; flex-shrink: 0; }

/* ── Filter bar ──────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-bar .search-box {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.filter-bar .search-box input { padding-left: 38px; height: 38px; font-size: 14px; }
.filter-bar .search-box .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
}

.filter-bar select { height: 38px; width: auto; min-width: 130px; font-size: 13.5px; }

/* ── Notification toast ──────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--deep-teal);
  color: #fff;
  padding: 14px 18px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  min-width: 280px;
  animation: slideUp 0.2s ease;
  border-left: 4px solid var(--primary);
}
.toast.success { border-color: var(--success); }
.toast.error   { border-color: var(--danger); }
.toast.warning { border-color: var(--warning); }

/* ── Responsive ──────────────────────────── */
@media (max-width: 1024px) {
  .sidebar { width: 220px; min-width: 220px; }
  .page-content { padding: 20px; }
  .topbar { padding: 0 20px; }
  .form-row-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .sidebar { position: fixed; left: -260px; height: 100%; z-index: 200; transition: left var(--t-slow); }
  .sidebar.open { left: 0; }
  .main { margin-left: 0; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .topbar-search { display: none; }
}

/* ── Misc ────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 20px 0; }

.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-3);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 { font-family: var(--font-ui); font-size: 16px; color: var(--text-2); margin-bottom: 8px; }
.empty-state p  { font-size: 14px; }

.section-title {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
  margin-bottom: 14px;
}

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-auto { margin-top: auto; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11.5px; }
.text-muted { color: var(--text-2); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Timeline ────────────────────────────── */
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item {
  display: flex;
  gap: 14px;
  padding-bottom: 20px;
  position: relative;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: 16px;
  top: 32px;
  bottom: 0;
  width: 2px;
  background: var(--border);
}
.timeline-item:last-child::before { display: none; }
.timeline-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--info-light);
  border: 2px solid var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--primary);
  position: relative;
  z-index: 1;
}
.timeline-content { flex: 1; padding-top: 4px; }
.timeline-title { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.timeline-meta  { font-size: 12px; color: var(--text-2); }

/* ── Rating stars ────────────────────────── */
.stars { display: flex; gap: 2px; }
.star { color: #fbbf24; font-size: 16px; }
.star.empty { color: var(--border-dark); }

/* ── Gradient header ─────────────────────── */
.gradient-header {
  background: linear-gradient(135deg, var(--deep-teal), var(--teal));
  border-radius: var(--radius);
  padding: 28px 32px;
  color: #fff;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
.gradient-header::after {
  content: '';
  position: absolute;
  right: -40px;
  top: -40px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(28,193,237,0.15);
}
.gradient-header::before {
  content: '';
  position: absolute;
  right: 80px;
  bottom: -60px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
}
.gradient-header h1, .gradient-header h2 { font-family: var(--font-heading); color: #fff; position: relative; z-index: 1; }
.gradient-header p  { color: rgba(255,255,255,0.75); font-size: 15px; position: relative; z-index: 1; margin-top: 6px; }

/* ── Dropdown ────────────────────────────── */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  z-index: 500;
  overflow: hidden;
  animation: slideUp 0.15s ease;
  display: none;
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 13.5px;
  color: var(--text);
  cursor: pointer;
  transition: background var(--t);
  font-family: var(--font-ui);
}
.dropdown-item:hover { background: var(--surface); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ── QR Code placeholder ─────────────────── */
.qr-box {
  width: 100px;
  height: 100px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  color: var(--text-3);
  font-size: 11px;
  text-align: center;
  font-family: var(--font-ui);
}

/* ── Chart container ─────────────────────── */
.chart-container {
  position: relative;
  height: 260px;
  padding: 4px 0;
}

/* ── Load shedding widget ────────────────── */
.loadshed-widget {
  background: var(--warning-light);
  border: 1px solid var(--warning);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
}
.loadshed-widget .ls-icon { font-size: 20px; }
.loadshed-widget .ls-text { flex: 1; }
.loadshed-widget .ls-title { font-weight: 700; color: #8a5a00; font-family: var(--font-ui); }
.loadshed-widget .ls-sub   { color: #b37a00; font-size: 12px; }
.loadshed-widget .ls-stage {
  background: var(--warning); color: #fff;
  border-radius: 6px; padding: 4px 12px;
  font-family: var(--font-ui); font-weight: 700; font-size: 13px;
}

/* ── Sidebar live indicator ──────────────── */
.live-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(32,176,56,0.4);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(32,176,56,0.4); }
  70%  { box-shadow: 0 0 0 6px rgba(32,176,56,0); }
  100% { box-shadow: 0 0 0 0 rgba(32,176,56,0); }
}
