/* ============================================================
   KPHRI — Admin Panel Styles
   admin.css
   ============================================================ */

/* ─── Layout ─────────────────────────────────────────────── */
body { overflow-x: hidden; background: var(--bg); }

.admin-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* ─── Sidebar ────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: #2D1052;
  height: 100vh;
  position: fixed;
  left: 0; top: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform var(--t-slow);
  box-shadow: 4px 0 24px rgba(74,14,114,0.25);
}

/* Sidebar Logo */
.sidebar-logo {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.sidebar-logo-icon {
  width: 42px;
  height: 42px;
  background: rgba(255,202,40,0.2);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  border: 1px solid rgba(255,202,40,0.3);
}

.sidebar-logo-text { overflow: hidden; }
.sidebar-logo-title {
  font-size: 0.9375rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
  white-space: nowrap;
}
.sidebar-logo-sub {
  font-size: 0.625rem;
  color: rgba(255,255,255,0.55);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Sidebar Nav */
.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0;
  overflow-y: auto;
}

.nav-section-title {
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.35);
  padding: 1rem 1.25rem 0.375rem;
  font-weight: 700;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.6875rem 1rem;
  margin: 2px 0.5rem;
  border-radius: 10px;
  color: rgba(255,255,255,0.7);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--t-base);
  position: relative;
  border: 1px solid transparent;
  white-space: nowrap;
}

.nav-item > span:not(.nav-icon):not(.nav-badge) {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.nav-item:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
  transform: translateX(2px);
}

.nav-item.active {
  background: rgba(255,202,40,0.18);
  color: var(--yellow);
  border-color: rgba(255,202,40,0.3);
}

.nav-item.active .nav-icon { color: var(--yellow); }

.nav-item .nav-icon {
  font-size: 18px;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.nav-item .nav-badge {
  margin-left: auto;
  background: var(--primary);
  color: #FFFFFF;
  font-size: 0.6875rem;
  font-weight: 800;
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(255,111,32,0.45);
  line-height: 1;
  text-align: center;
  box-sizing: border-box;
}

/* Sidebar User */
.sidebar-user {
  padding: 1rem 1.125rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255,202,40,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--yellow);
  flex-shrink: 0;
  border: 1px solid rgba(255,202,40,0.3);
}

.sidebar-user-info { overflow: hidden; flex: 1; }
.sidebar-user-name {
  font-size: 0.8125rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 0.625rem;
  color: rgba(255,255,255,0.45);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ─── Main Content ───────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
  transition: margin-left var(--t-slow);
  width: calc(100% - var(--sidebar-w));
}

/* ─── Topbar ─────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  box-shadow: 0 2px 12px rgba(26,20,40,0.04);
  gap: 1rem;
}

.topbar-left { display: flex; align-items: center; gap: 0.875rem; }

.hamburger-btn {
  display: none;
  width: 38px; height: 38px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
}

.topbar-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}
.topbar-breadcrumb {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.topbar-actions { display: flex; align-items: center; gap: 0.75rem; }

.notif-btn {
  position: relative;
  width: 38px; height: 38px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  cursor: pointer;
  transition: all var(--t-base);
}
.notif-btn:hover { background: var(--purple-50); border-color: var(--purple-200); }

.notif-count {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--error);
  color: white;
  font-size: 0.6rem;
  font-weight: 800;
  min-width: 17px;
  height: 17px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 1px solid var(--surface);
}

.admin-avatar {
  width: 36px; height: 36px;
  border-radius: var(--r-md);
  background: var(--purple-800);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  color: white;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(106,27,154,0.2);
}

/* ─── Content Area ───────────────────────────────────────── */
.content-area {
  padding: 1.5rem;
  flex: 1;
}

/* ─── Dashboard ──────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 1024px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .kpi-grid { grid-template-columns: 1fr; }
}

.kpi-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 1.25rem 1.5rem;
  border: 1.5px solid var(--purple-200);
  display: flex;
  align-items: flex-start;
  gap: 1.125rem;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 18px rgba(106, 27, 154, 0.05);
}

.kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(106, 27, 154, 0.12);
  border-color: var(--purple-400);
}

.kpi-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.kpi-icon.purple { background: linear-gradient(135deg, #F3E5F5 0%, #E1BEF0 100%); color: var(--purple-800); }
.kpi-icon.orange { background: linear-gradient(135deg, #FFF3EC 0%, #FFE0D1 100%); color: var(--primary); }
.kpi-icon.green  { background: linear-gradient(135deg, #ECFDF5 0%, #A7F3D0 100%); color: #047857; }
.kpi-icon.yellow { background: linear-gradient(135deg, #FFFBEB 0%, #FDE68A 100%); color: #B45309; }

.kpi-info { flex: 1; min-width: 0; }

.kpi-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}

.kpi-value {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-sub {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.kpi-trend {
  font-size: 0.6875rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 0.375rem;
}
.kpi-trend.up   { color: var(--success); }
.kpi-trend.down { color: var(--error); }

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.25rem;
}

.chart-section {
  background: var(--surface);
  border-radius: 16px;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(26,20,40,0.04);
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
}

.chart-title {
  font-size: 0.9375rem;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chart-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.combo-chart-wrapper {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 180px;
  margin-top: 0.875rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.chart-grid-background {
  position: absolute;
  inset: 0 0 28px 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
  z-index: 1;
}

.chart-grid-line {
  border-bottom: 1px dashed rgba(226, 232, 240, 0.9);
  width: 100%;
  position: relative;
}

.grid-y-val {
  position: absolute;
  right: 0;
  top: -10px;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--surface);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  z-index: 5;
}

.chart-svg-overlay {
  position: absolute;
  inset: 0 0 28px 0;
  width: 100%;
  height: calc(100% - 28px);
  pointer-events: none;
  z-index: 3;
  overflow: visible;
}

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 0.875rem;
  height: 100%;
  min-height: 160px;
  padding: 0.5rem 0.5rem 0;
  border-bottom: 1.5px solid var(--border);
  position: relative;
  z-index: 2;
}

.bar-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  position: relative;
}

.bar-track {
  width: 100%;
  max-width: 38px;
  height: calc(100% - 28px);
  background: var(--surface-2, rgba(243, 244, 246, 0.6));
  border-radius: 8px 8px 2px 2px;
  display: flex;
  align-items: flex-end;
  position: relative;
}

.bar-fill {
  width: 100%;
  border-radius: 8px 8px 2px 2px;
  background: linear-gradient(180deg, #7C3AED 0%, #4C1D95 100%);
  min-height: 8px;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  cursor: pointer;
}

.bar-fill:hover {
  filter: brightness(1.15);
  box-shadow: 0 6px 16px rgba(124, 58, 237, 0.35);
  z-index: 10;
}

.bar-fill.primary {
  background: linear-gradient(180deg, #FF6F20 0%, #FF8A3D 100%);
  box-shadow: 0 4px 12px rgba(255, 111, 32, 0.25);
}

.bar-fill.primary:hover {
  background: linear-gradient(180deg, #FF8A3D 0%, #FF5500 100%);
  box-shadow: 0 8px 20px rgba(255, 111, 32, 0.4);
}

/* Floating Tooltip */
.bar-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: #1A1428;
  color: #FFFFFF;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 8px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  z-index: 30;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.bar-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 5px;
  border-style: solid;
  border-color: #1A1428 transparent transparent transparent;
}

.bar-fill:hover .bar-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.bar-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-align: center;
  font-weight: 700;
  margin-top: 8px;
}

/* ── Modern Distribution Progress Lists ── */
.distribution-list {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  margin-top: 1rem;
}

.distribution-item {
  background: var(--surface-2, #F8FAFC);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.625rem 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.distribution-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8125rem;
}

.distribution-label {
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.distribution-val {
  font-weight: 800;
  color: var(--text-primary);
}

.distribution-track {
  height: 6px;
  background: var(--border-light, #E2E8F0);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.distribution-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ─── Data Table Card ────────────────────────────────────── */
.data-card {
  background: var(--surface);
  border-radius: 16px;
  border: 1.5px solid var(--purple-200);
  box-shadow: 0 4px 20px rgba(106,27,154,0.05);
  overflow: hidden;
}

.data-card .table-wrapper {
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
}

.admin-table th, .table th {
  border-radius: 0 !important;
}

.data-card-header {
  padding: 1.125rem 1.5rem;
  border-bottom: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  background: var(--surface);
}

.data-card-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.data-card-tools { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }

.search-box {
  display: flex;
  align-items: center;
  background: var(--bg-2);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: all var(--t-base);
}

.search-box:focus-within {
  border-color: var(--purple-600);
  box-shadow: 0 0 0 3px rgba(106,27,154,0.12);
  background: var(--surface);
}

.search-box input {
  border: none;
  background: transparent;
  padding: 0.5rem 0.875rem 0.5rem 0.5rem;
  font-size: 0.8125rem;
  width: 220px;
  color: var(--text-primary);
}
.search-box input::placeholder { color: var(--text-muted); }
.search-box-icon {
  padding: 0.5rem 0.625rem;
  color: var(--purple-800);
  font-size: 15px;
  flex-shrink: 0;
}

/* Table */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.admin-table th {
  padding: 0.8125rem 1.125rem;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--purple-900);
  background: #F8F6FC;
  border-bottom: 1.5px solid var(--border);
  white-space: nowrap;
}

.admin-table th i {
  color: var(--purple-800);
  margin-right: 4px;
}

.admin-table td {
  padding: 0.8125rem 1.125rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.8125rem;
  color: var(--text-primary);
  vertical-align: middle;
  line-height: 1.4;
}

.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:nth-child(even) td { background: #FAF9FC; }
.admin-table tr:hover td { background: rgba(106, 27, 154, 0.045) !important; }

/* Table Actions */
.table-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.table-actions .btn-sm {
  padding: 0.3rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--r-md);
}

.vendor-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.vendor-logo-sm {
  width: 34px; height: 34px;
  border-radius: 8px;
  background: var(--purple-100);
  color: var(--purple-800);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  flex-shrink: 0;
}

.vendor-name { font-weight: 700; font-size: 0.8125rem; color: var(--text-primary); }
.vendor-email { font-size: 0.7rem; color: var(--text-muted); }

/* ─── Finance Cards ──────────────────────────────────────── */
.finance-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.finance-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 1.5rem;
  border: 1.5px solid var(--purple-200);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 18px rgba(106, 27, 154, 0.05);
  transition: all 0.3s ease;
}

.finance-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(106, 27, 154, 0.12);
  border-color: var(--purple-400);
}

.finance-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 5px;
}

.finance-card.purple::before { background: linear-gradient(90deg, #2D1052, #6A1B9A); }
.finance-card.orange::before { background: linear-gradient(90deg, #FF6F20, #FFCA28); }
.finance-card.green::before  { background: linear-gradient(90deg, #10B981, #047857); }

/* ─── Notification List ──────────────────────────────────── */
.notif-list { display: flex; flex-direction: column; gap: 0.75rem; }

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.125rem 1.25rem;
  background: var(--surface);
  border-radius: 16px;
  border: 1.5px solid var(--purple-200);
  transition: all var(--t-base);
  box-shadow: var(--shadow-xs);
}

.notif-item.unread { border-left: 4px solid var(--purple-800); background: var(--purple-50); }
.notif-item:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }

.notif-icon {
  width: 44px; height: 44px;
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.notif-body { flex: 1; }
.notif-title { font-weight: 700; font-size: 0.875rem; margin-bottom: 0.25rem; color: var(--text-primary); }
.notif-msg   { font-size: 0.8125rem; color: var(--text-secondary); line-height: 1.5; }
.notif-time  { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.375rem; font-weight: 500; }

/* ─── Settings ───────────────────────────────────────────── */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.settings-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 1.5rem;
  border: 1.5px solid var(--purple-200);
  box-shadow: 0 4px 18px rgba(106, 27, 154, 0.05);
}

.settings-card-title {
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-primary);
  padding-bottom: 0.875rem;
  border-bottom: 1px solid var(--border);
}

/* ─── Order Detail Modal ─────────────────────────────────── */
.order-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  gap: 1rem;
}

.order-items-list { display: flex; flex-direction: column; gap: 0.75rem; }

.order-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.875rem;
  background: var(--surface-2);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
}

.order-item-icon {
  width: 44px; height: 44px;
  border-radius: var(--r-md);
  background: var(--purple-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

/* ─── Report Charts ──────────────────────────────────────── */
.report-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.top-list { display: flex; flex-direction: column; gap: 0.625rem; }
.top-list-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--surface-2);
  border-radius: var(--r-lg);
  font-size: 0.8125rem;
  border: 1px solid var(--border);
}

.top-list-rank {
  width: 26px; height: 26px;
  border-radius: var(--r-full);
  background: var(--purple-800);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 800;
  flex-shrink: 0;
}
.top-list-rank.gold   { background: var(--yellow-dark); }
.top-list-rank.silver { background: #9CA3AF; }
.top-list-rank.bronze { background: #B45309; }

/* ─── Mobile Responsive ──────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26,20,40,0.6);
  z-index: 150;
  backdrop-filter: blur(3px);
}

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

@media (max-width: 900px) {
  .finance-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay.open {
    display: block;
  }
  .main-content {
    margin-left: 0;
    width: 100%;
  }
  .hamburger-btn {
    display: flex;
  }
  .topbar { padding: 0 1rem; }
  .content-area { padding: 1rem; }
  .kpi-grid { grid-template-columns: 1fr; }
  .data-card-tools { width: 100%; }
  .search-box input { width: 100%; }
  .search-box { flex: 1; }
}

@media (max-width: 480px) {
  .topbar-actions .btn { display: none; }
}

/* ─── Global Topbar Search & Live Status ────────────────── */
.topbar-center {
  flex: 1;
  max-width: 480px;
  margin: 0 1.5rem;
}

.topbar-search-box {
  position: relative;
  width: 100%;
}

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

.topbar-search-box input {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  padding: 0.5rem 2.5rem 0.5rem 2.25rem;
  font-size: 0.8125rem;
  color: var(--text-primary);
  transition: all var(--t-base);
}

.topbar-search-box input:focus {
  background: var(--surface);
  border-color: var(--purple-500);
  box-shadow: 0 0 0 3px rgba(106,27,154,0.1);
  outline: none;
}

.search-shortcut {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  pointer-events: none;
}

.global-search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  max-height: 340px;
  overflow-y: auto;
  z-index: 500;
  padding: 0.5rem;
}

.global-search-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background var(--t-base);
}

.global-search-item:hover {
  background: var(--purple-50);
}

.system-status-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(46,204,113,0.1);
  border: 1px solid rgba(46,204,113,0.25);
  padding: 0.375rem 0.75rem;
  border-radius: var(--r-full);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--success);
}

.status-pulse-dot {
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(46,204,113,0.4);
  animation: pulseGreen 2s infinite;
}

@keyframes pulseGreen {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(46,204,113,0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(46,204,113,0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(46,204,113,0); }
}

@media (max-width: 900px) {
  .topbar-center { display: none; }
  .system-status-pill { display: none; }
}
