/* ============================================
   AUTOMAIL — Design System
   Primary: #0891B2 (cyan-600)
   Accent palette: cyan, emerald, amber, violet, rose
   All gradients: 135deg
   ============================================ */

/* --- CSS Variables --- */
:root {
  --c-primary: #0891B2;
  --c-primary-light: #22D3EE;
  --c-primary-dark: #0E7490;
  --c-primary-bg: rgba(8,145,178,0.08);

  --c-emerald: #059669;
  --c-emerald-light: #10B981;
  --c-emerald-bg: rgba(5,150,105,0.08);

  --c-amber: #D97706;
  --c-amber-light: #F59E0B;
  --c-amber-bg: rgba(217,119,6,0.08);

  --c-violet: #7C3AED;
  --c-violet-light: #8B5CF6;
  --c-violet-bg: rgba(124,58,237,0.08);

  --c-rose: #E11D48;
  --c-rose-light: #F43F5E;
  --c-rose-bg: rgba(225,29,72,0.08);

  --c-gray: #64748B;
  --c-gray-light: #94A3B8;
  --c-gray-bg: rgba(100,116,139,0.08);

  --c-text: #1E293B;
  --c-text-secondary: #64748B;
  --c-text-muted: #94A3B8;
  --c-border: #E2E8F0;
  --c-border-light: #F1F5F9;
  --c-surface: #FFFFFF;
  --c-bg: #F8FAFC;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.07);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.1);
  --shadow-card: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-card-hover: 0 10px 25px rgba(0,0,0,0.08), 0 4px 10px rgba(0,0,0,0.04);

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

  --font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--c-text);
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: linear-gradient(160deg, #F0F4FF 0%, #E8F4F8 40%, #F0F9FF 100%);
  background-attachment: fixed;
}

/* =============================================
   TOPBAR — Dark, 3-column layout
   ============================================= */
.topbar {
  background: #0B0E14;
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0 2rem;
  height: 58px;
  display: flex;
  align-items: center;
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
}
.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  align-items: center;
}
/* Left: brand */
.topbar-brand {
  display: flex; align-items: center; gap: 0.55rem;
  text-decoration: none; color: #fff; font-weight: 700; font-size: 1.15rem;
  letter-spacing: -0.01em; flex-shrink: 0;
}
.topbar-brand img { width: 34px; height: 34px; filter: drop-shadow(0 0 6px rgba(34,211,238,0.4)); object-fit: contain; }
/* Center: nav — takes remaining space, centered */
.topbar-nav {
  display: flex; align-items: center; justify-content: center;
  flex: 1; gap: 0.25rem; margin: 0 1.5rem;
}
.topbar-nav a {
  text-decoration: none; color: rgba(255,255,255,0.6); font-size: 0.85rem; font-weight: 500;
  padding: 0.4rem 0.9rem; border-radius: 8px;
  transition: color 0.2s ease, background 0.2s ease;
  display: flex; align-items: center; gap: 0.4rem; white-space: nowrap;
}
.topbar-nav a:hover { color: var(--c-primary-light); background: rgba(34,211,238,0.08); }
.topbar-nav a.active { color: var(--c-primary-light); background: rgba(34,211,238,0.12); font-weight: 600; }
.topbar-nav a span { line-height: 1; }
/* Right: user section */
.topbar-user {
  display: flex; align-items: center; gap: 0.6rem; flex-shrink: 0;
}
.topbar-icon-link {
  color: rgba(255,255,255,0.5); text-decoration: none; display: flex;
  align-items: center; padding: 0.4rem; border-radius: 8px;
  transition: color 0.2s, background 0.2s;
}
.topbar-icon-link:hover { color: var(--c-primary-light); background: rgba(34,211,238,0.1); }
.topbar-icon-link svg, .topbar-icon-link i { width: 18px; height: 18px; }
.topbar-user-badge {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.3rem 0.7rem; background: rgba(255,255,255,0.08);
  border-radius: 8px; font-size: 0.82rem; color: rgba(255,255,255,0.85); font-weight: 500;
}
.topbar-user-badge svg, .topbar-user-badge i { width: 15px; height: 15px; color: rgba(255,255,255,0.5); }
.topbar-toggle { display: none; background: none; border: none; color: #fff; font-size: 1.4rem; cursor: pointer; padding: 0.3rem; margin-left: auto; }

/* =============================================
   CONTAINER
   ============================================= */
.container { max-width: 1280px; margin: 0 auto; padding: 1.5rem; }

/* =============================================
   PAGE HEADER
   ============================================= */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 0.75rem; }
.page-header h1 { font-size: 1.45rem; font-weight: 700; color: var(--c-text); margin: 0; }
.page-header h1 small { font-weight: 400; color: var(--c-text-muted); font-size: 0.85rem; margin-left: 0.3rem; }
.page-header-actions { display: flex; gap: 0.5rem; align-items: center; }

/* =============================================
   BREADCRUMB
   ============================================= */
.breadcrumb { display: flex; align-items: center; gap: 0.35rem; font-size: 0.8rem; color: var(--c-text-muted); margin-bottom: 0.75rem; }
.breadcrumb a { color: var(--c-primary); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

/* =============================================
   CARDS
   ============================================= */
.card { background: var(--c-surface); border-radius: var(--radius-md); border: 1px solid var(--c-border); box-shadow: var(--shadow-card); transition: box-shadow 0.2s; }
.card:hover { box-shadow: var(--shadow-md); }
.card-header { padding: 0.9rem 1.25rem; border-bottom: 1px solid var(--c-border-light); font-weight: 600; font-size: 0.9rem; color: var(--c-text); display: flex; align-items: center; gap: 0.5rem; }
.card-body { padding: 1.25rem; }
.card-footer { padding: 0.9rem 1.25rem; border-top: 1px solid var(--c-border-light); }

/* =============================================
   STAT CARDS — Left accent border + gradient bg
   ============================================= */
.stats-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1rem; margin-bottom: 1.5rem; }

.stat-card {
  background: var(--c-surface);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.25rem 1.25rem 1.4rem;
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  transition: transform 0.25s cubic-bezier(.4,0,.2,1), box-shadow 0.25s cubic-bezier(.4,0,.2,1);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--c-border);
  border-left: 4px solid transparent;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  opacity: 0.03;
  pointer-events: none;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-card-hover);
}

/* Per-card accent colors */
.stat-card.blue   { border-left-color: var(--c-primary); }
.stat-card.blue::before { background: linear-gradient(135deg, var(--c-primary-bg), transparent 60%); opacity: 1; }
.stat-card.blue .stat-icon { background: linear-gradient(135deg, #06B6D4, #0891B2); box-shadow: 0 3px 10px rgba(6,182,212,0.3); }

.stat-card.green  { border-left-color: var(--c-emerald); }
.stat-card.green::before { background: linear-gradient(135deg, var(--c-emerald-bg), transparent 60%); opacity: 1; }
.stat-card.green .stat-icon { background: linear-gradient(135deg, #10B981, #059669); box-shadow: 0 3px 10px rgba(16,185,129,0.3); }

.stat-card.red    { border-left-color: var(--c-amber); }
.stat-card.red::before { background: linear-gradient(135deg, var(--c-amber-bg), transparent 60%); opacity: 1; }
.stat-card.red .stat-icon { background: linear-gradient(135deg, #F59E0B, #D97706); box-shadow: 0 3px 10px rgba(245,158,11,0.3); }

.stat-card.amber  { border-left-color: var(--c-violet); }
.stat-card.amber::before { background: linear-gradient(135deg, var(--c-violet-bg), transparent 60%); opacity: 1; }
.stat-card.amber .stat-icon { background: linear-gradient(135deg, #8B5CF6, #7C3AED); box-shadow: 0 3px 10px rgba(139,92,246,0.3); }

.stat-card.purple { border-left-color: var(--c-emerald); }
.stat-card.purple::before { background: linear-gradient(135deg, var(--c-emerald-bg), transparent 60%); opacity: 1; }
.stat-card.purple .stat-icon { background: linear-gradient(135deg, #10B981, #059669); box-shadow: 0 3px 10px rgba(16,185,129,0.3); }

.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.stat-icon svg { width: 22px; height: 22px; color: #fff; }

.stat-info { position: relative; z-index: 1; }
.stat-info h3 { margin: 0; font-size: 1.75rem; font-weight: 700; line-height: 1.2; color: var(--c-text); letter-spacing: -0.02em; }
.stat-info p { margin: 0.15rem 0 0; font-size: 0.78rem; color: var(--c-text-secondary); font-weight: 500; letter-spacing: 0.01em; }

/* =============================================
   BUTTONS
   ============================================= */
.btn {
  display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.5rem 1rem; border-radius: var(--radius-sm);
  font-size: 0.85rem; font-weight: 500; text-decoration: none; border: none; cursor: pointer;
  transition: all 0.2s ease; line-height: 1.4; white-space: nowrap; font-family: inherit;
}
.btn svg { width: 15px; height: 15px; }

.btn-primary {
  background: linear-gradient(135deg, #06B6D4 0%, #0891B2 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(6,182,212,0.3);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #0891B2 0%, #0E7490 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(6,182,212,0.35);
}

.btn-success { background: linear-gradient(135deg, #10B981, #059669); color: #fff; box-shadow: 0 2px 8px rgba(16,185,129,0.25); }
.btn-success:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(16,185,129,0.35); }

.btn-warning { background: linear-gradient(135deg, #F59E0B, #D97706); color: #fff; }
.btn-warning:hover { transform: translateY(-1px); }

.btn-danger { background: linear-gradient(135deg, #EF4444, #DC2626); color: #fff; }
.btn-danger:hover { transform: translateY(-1px); }

.btn-purple { background: linear-gradient(135deg, #8B5CF6, #7C3AED); color: #fff; box-shadow: 0 2px 8px rgba(139,92,246,0.25); }
.btn-purple:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(139,92,246,0.35); }

.btn-ghost { background: rgba(255,255,255,0.85); color: #475569; border: 1px solid var(--c-border); }
.btn-ghost:hover { background: #fff; color: var(--c-text); border-color: #D1D5DB; }

.btn-outline-dark { background: transparent; color: #0B0E14; border: 1.5px solid #0B0E14; }
.btn-outline-dark:hover { background: var(--c-primary-bg); border-color: var(--c-primary); color: var(--c-primary); }

.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.8rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.btn-group { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* =============================================
   TABS
   ============================================= */
.tabs { display: flex; gap: 0.2rem; background: rgba(255,255,255,0.75); padding: 0.25rem; border-radius: 10px; border: 1px solid var(--c-border); margin-bottom: 1.25rem; overflow-x: auto; backdrop-filter: blur(6px); }
.tab { text-decoration: none; color: #6B7280; font-size: 0.8rem; font-weight: 500; padding: 0.45rem 0.9rem; border-radius: 7px; transition: all 0.2s ease; white-space: nowrap; }
.tab:hover { color: #374151; background: rgba(255,255,255,0.8); }
.tab.active { color: #fff; background: linear-gradient(135deg, #06B6D4, #0891B2); box-shadow: 0 2px 8px rgba(6,182,212,0.3); font-weight: 600; }

/* =============================================
   TABLES
   ============================================= */
.table-wrap { background: var(--c-surface); border-radius: var(--radius-md); border: 1px solid var(--c-border); box-shadow: var(--shadow-card); overflow-x: auto; overflow-y: hidden; position: relative; }
.table-wrap::after { content:''; position:absolute; top:0; right:0; bottom:0; width:24px; background:linear-gradient(to right,transparent,rgba(255,255,255,0.8)); pointer-events:none; opacity:0; transition:opacity 0.2s; border-radius:0 var(--radius-md) var(--radius-md) 0; }
.table-wrap.scroll-right::after { opacity:1; }
.table-wrap table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.table-wrap thead { background: linear-gradient(135deg, #F8FAFC 0%, #EFF6FF 100%); border-bottom: 2px solid #DBEAFE; }
.table-wrap th { padding: 0.75rem 1rem; text-align: left; font-weight: 600; color: #6B7280; font-size: 0.73rem; text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
.table-wrap td { padding: 0.75rem 1rem; border-top: 1px solid var(--c-border-light); color: #374155; vertical-align: middle; }
.table-wrap tbody tr { transition: background 0.15s; }
.table-wrap tbody tr:hover { background: #F8FAFC; }
.table-wrap tbody tr:not(:last-child) td { border-bottom: 1px solid var(--c-border-light); }
.table-wrap td.wrap { max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.table-wrap td.td-truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.table-link { color: var(--c-primary); text-decoration: none; font-weight: 500; }
.table-link:hover { text-decoration: underline; }

/* =============================================
   BADGES — Semantic colors
   ============================================= */
.badge { display: inline-flex; align-items: center; gap: 0.2rem; padding: 0.2rem 0.55rem; border-radius: 6px; font-size: 0.72rem; font-weight: 600; line-height: 1.4; white-space: nowrap; }

/* Green/teal = positive/done */
.badge-success  { background: rgba(5,150,105,0.1); color: #065F46; }
/* Yellow/orange = pending/process */
.badge-warning  { background: rgba(217,119,6,0.1); color: #92400E; }
/* Red = negative/cancelled */
.badge-danger   { background: rgba(220,38,38,0.1); color: #991B1B; }
/* Cyan = info/neutral */
.badge-info     { background: rgba(8,145,178,0.1); color: #155E75; }
/* Violet = scheduled/special */
.badge-purple   { background: rgba(124,58,237,0.1); color: #5B21B6; }
/* Gray = cancelled/inactive */
.badge-gray     { background: rgba(100,116,139,0.1); color: #475569; }
.badge-cyan     { background: rgba(8,145,178,0.1); color: #155E75; }
/* Rose = undangan (attention needed) */
.badge-undangan { background: rgba(225,29,72,0.1); color: #9F1239; }

.badge-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.badge-dot.green { background: var(--c-emerald-light); }
.badge-dot.amber { background: var(--c-amber-light); }
.badge-dot.red   { background: var(--c-rose-light); }
.badge-dot.gray  { background: #9CA3AF; }

/* =============================================
   DETAIL GRID
   ============================================= */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.detail-grid > .detail-section { background: var(--c-surface); border-radius: var(--radius-md); border: 1px solid var(--c-border); box-shadow: var(--shadow-card); overflow: hidden; }

.detail-section .section-header {
  padding: 0.85rem 1.25rem;
  background: linear-gradient(135deg, #F8FAFC 0%, #EFF6FF 100%);
  border-bottom: 2px solid var(--c-primary-light);
  font-weight: 600; font-size: 0.9rem; color: var(--c-text);
  display: flex; align-items: center; gap: 0.5rem;
}
.detail-section .section-body { padding: 1.15rem; }
.detail-row { display: flex; justify-content: space-between; padding: 0.45rem 0; border-bottom: 1px solid #F9FAFB; }
.detail-row:last-child { border-bottom: none; }
.detail-row .label { font-size: 0.8rem; color: #9CA3AF; font-weight: 500; }
.detail-row .value { font-size: 0.85rem; color: var(--c-text); font-weight: 500; text-align: right; }

/* =============================================
   BODY PREVIEW
   ============================================= */
.body-preview { max-height: 240px; overflow: auto; background: #F9FAFB; border: 1px solid var(--c-border); border-radius: 8px; padding: 1rem; font-size: 0.8rem; line-height: 1.6; white-space: pre-wrap; word-break: break-word; color: #374155; }

/* =============================================
   EMPTY STATE
   ============================================= */
.empty-state { text-align: center; padding: 2.5rem 1.5rem; color: #9CA3AF; }
.empty-state svg { width: 44px; height: 44px; margin-bottom: 0.5rem; opacity: 0.25; }
.empty-state p { margin: 0.2rem 0; font-size: 0.9rem; }

/* =============================================
   TOAST
   ============================================= */
#toast { position: fixed; bottom: 1.5rem; right: 1.5rem; padding: 0.8rem 1.2rem; border-radius: 10px; color: #fff; font-weight: 600; font-size: 0.85rem; z-index: 999; display: none; box-shadow: 0 6px 20px rgba(0,0,0,0.18); max-width: 380px; }
#toast.success { background: linear-gradient(135deg, #10B981, #059669); }
#toast.error   { background: linear-gradient(135deg, #EF4444, #DC2626); }
#toast.info    { background: linear-gradient(135deg, #06B6D4, #0891B2); }

/* =============================================
   FORMS
   ============================================= */
input[type="text"], input[type="date"], input[type="time"], input[type="email"], textarea, select {
  width: 100%; padding: 0.55rem 0.85rem; border: 1.5px solid var(--c-border); border-radius: 8px;
  font-size: 0.85rem; font-family: inherit; color: var(--c-text); background: #fff; transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(6,182,212,0.12); }
label { display: block; font-size: 0.8rem; font-weight: 500; color: #475569; margin-bottom: 0.3rem; }
.form-group { margin-bottom: 1rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* =============================================
   IFRAME
   ============================================= */
.embed-frame { border: 1.5px solid var(--c-border); border-radius: 10px; width: 100%; height: 450px; background: #F9FAFB; }
.embed-frame-sm { height: 350px; }

/* =============================================
   SEPARATOR
   ============================================= */
hr.section-sep { border: none; border-top: 1.5px solid var(--c-border); margin: 1.5rem 0; }

/* =============================================
   STATUS ROW
   ============================================= */
.status-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.625rem 0.875rem; background: #F8FAFC; border-radius: 8px; margin-bottom: 0.45rem; border: 1px solid var(--c-border); }
.status-row .status-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.status-row .status-dot.on  { background: var(--c-emerald-light); box-shadow: 0 0 6px rgba(16,185,129,0.5); }
.status-row .status-dot.off { background: var(--c-rose-light); box-shadow: 0 0 6px rgba(244,63,94,0.4); }
.status-row .status-dot.na  { background: #9CA3AF; }
.status-row .status-label { font-size: 0.8rem; color: var(--c-text-secondary); font-weight: 500; flex-shrink: 0; min-width: 90px; }
.status-row .status-text { font-size: 0.8rem; color: var(--c-text); font-weight: 500; text-align: right; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-left: auto; }

/* =============================================
   ATTACHMENT CARD
   ============================================= */
.attachment-card { background: linear-gradient(135deg, #F8FAFC, #F1F5F9); border: 1.5px solid var(--c-border); border-radius: 10px; padding: 1rem; margin-bottom: 0.7rem; transition: border-color 0.2s; }
.attachment-card:hover { border-color: #CBD5E1; }
.attachment-card .att-header { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.5rem; }
.attachment-card .att-name { font-weight: 600; font-size: 0.85rem; color: var(--c-text); }
.attachment-card .att-meta { font-size: 0.73rem; color: #9CA3AF; }

/* =============================================
   DASHBOARD SECTIONS
   ============================================= */
.dash-section { background: var(--c-surface); border-radius: var(--radius-md); border: 1px solid var(--c-border); box-shadow: var(--shadow-card); margin-bottom: 1.2rem; }

.dash-section-header {
  padding: 0.85rem 1.5rem;
  background: linear-gradient(135deg, #F8FAFC 0%, #EFF6FF 100%);
  border-bottom: 2px solid var(--c-primary-light);
  font-weight: 600; font-size: 0.9rem; color: var(--c-text);
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
}
.dash-section-header > span { white-space: nowrap; flex-shrink: 0; }
.dash-section-header > div { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.dash-section-header select { width: 140px; flex-shrink: 0; padding: 0.35rem 0.6rem; border: 1.5px solid var(--c-border); border-radius: 8px; font-size: 0.78rem; font-family: inherit; }
.dash-section-header .btn { flex-shrink: 0; white-space: nowrap; }
.dash-section-header a { font-size: 0.8rem; color: var(--c-primary); text-decoration: none; font-weight: 500; }
.dash-section-header a:hover { text-decoration: underline; }

/* Dashboard list items */
.dash-list-item {
  transition: background 0.15s ease;
}
.dash-list-item:hover {
  background: #F8FAFC !important;
}
.dash-list-meta {
  font-size: 0.75rem;
  color: #94A3B8;
  margin-top: 0.15rem;
}
.dash-list-badge {
  flex-shrink: 0;
}
.dash-list-action {
  flex-shrink: 0;
}

/* Mobile: stack list items vertically, wrap meta, button below */
@media (max-width: 768px) {
  .dash-list-item {
    flex-wrap: wrap;
  }
  .dash-list-meta {
    white-space: normal;
    word-break: break-word;
  }
  .dash-list-badge {
    flex-shrink: 0;
  }
  .dash-list-badge .badge {
    font-size: 0.68rem;
  }
  .dash-list-action {
    width: 100%;
    order: 3;
    margin-top: 0.4rem;
  }
  .dash-list-action .btn {
    width: 100%;
    justify-content: center;
    padding: 0.45rem 0.65rem;
    font-size: 0.78rem;
  }
}

/* =============================================
   MONITOR PAGE
   ============================================= */
.monitor-card {
  background: linear-gradient(135deg, #F8FAFC 0%, #F1F5F9 100%);
  border-radius: var(--radius-lg);
  border: 1px solid var(--c-border);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: box-shadow 0.25s, transform 0.25s;
}
.monitor-card:hover { box-shadow: var(--shadow-card-hover); transform: translateY(-2px); }

.monitor-card .card-header {
  background: linear-gradient(135deg, #F8FAFC 0%, #EFF6FF 100%);
  border-bottom: 2px solid var(--c-primary-light);
}

.monitor-card-system {
  position: relative;
}
.monitor-card-system::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--c-primary), var(--c-violet));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 1024px) { .stats-grid { grid-template-columns: repeat(3, 1fr); } .detail-grid { grid-template-columns: 1fr; } }
@media (max-width: 768px) {
  html, body { overflow-x: hidden; max-width: 100%; }
  .topbar { padding: 0 1rem; } .container { padding: 1rem; overflow-x: hidden; } .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-wrap td, .table-wrap th { padding: 0.5rem 0.6rem; font-size: 0.78rem; }
  .account-actions, .user-actions { flex-wrap: nowrap !important; gap: 0.2rem !important; }
  .account-actions .btn, .user-actions .btn { padding: 0.2rem 0.4rem !important; font-size: 0.68rem !important; }
  .topbar-nav {
    display: none; position: absolute; top: 58px; left: 0; right: 0;
    background: #0B0E14; flex-direction: column; padding: 0.5rem 0.75rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3); z-index: 99;
    border-top: 1px solid #1F2937; margin: 0; gap: 0.1rem;
  }
  .topbar-nav.open { display: flex; }
  .topbar-nav a { padding: 0.6rem 0.85rem; width: 100%; border-radius: 8px; }
  .topbar-brand { flex: 0 0 auto; min-width: 0; }
  .topbar-toggle { display: block; margin-left: 0; }
  .topbar-user { gap: 0.5rem; align-items: center; margin-left: auto; }
  .topbar-user-badge span { display: none; }
  .topbar-user-badge { padding: 0.35rem; }
  .topbar-icon-link { padding: 0.45rem; }
  .page-header { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; }
  .page-header h1 { font-size: 1.2rem; }
  .page-header-actions { display: flex; flex-direction: row; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
  .page-header-actions .btn { width: auto; padding: 0.4rem 0.7rem; font-size: 0.78rem; }
  .page-header-actions #auto-sync-indicator { font-size: 0.68rem; padding: 0.3rem 0.5rem; }
  .page-header.btn-row-page { flex-direction: row; align-items: center; justify-content: space-between; }
  .page-header.btn-row-page .page-header-actions { width: auto; flex-direction: row; align-items: center; }
  .page-header.btn-row-page .page-header-actions .btn { width: auto; padding: 0.4rem; }
  .dash-section-header { flex-wrap: wrap; gap: 0.5rem; }
  .dash-section-header > span { width: 100%; }
  .dash-section-header select { width: 100%; }
  .dash-section-header .btn { width: auto; }
  .dash-grid-2 { grid-template-columns: 1fr !important; }
}
@media (max-width: 480px) { .stats-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 0.6rem; } .stat-card { padding: 0.85rem 0.75rem 0.85rem 1rem; } .stat-icon { width: 34px; height: 34px; } .stat-icon svg { width: 16px; height: 16px; } .stat-info h3 { font-size: 1.2rem; } .stat-info p { font-size: 0.7rem; } .topbar-nav a { padding: 0.65rem 1rem; font-size: 0.9rem; } }

/* =============================================
   UTILITIES
   ============================================= */
.text-muted { color: #9CA3AF; } .text-sm { font-size: 0.8rem; } .text-xs { font-size: 0.73rem; }
.font-mono { font-family: var(--font-mono); }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 0.5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.gap-1 { gap: 0.5rem; } .flex { display: flex; } .flex-col { flex-direction: column; }
.items-center { align-items: center; } .justify-between { justify-content: space-between; } .flex-wrap { flex-wrap: wrap; } .w-full { width: 100%; }

/* =============================================
   BTN-ROW — icon-only buttons on mobile
   ============================================= */
@media (max-width: 768px) {
  .btn-row { display: flex; flex-direction: row !important; align-items: center; gap: 0.5rem; width: auto !important; flex-shrink: 0; }
  .btn-row .btn { width: auto !important; padding: 0.5rem !important; justify-content: center !important; }
  .btn-row .btn > *:not(i):not(svg) { display: none; }
  .btn-row .btn i, .btn-row .btn svg { width: 18px; height: 18px; margin: 0; }
  .icon-only-mobile .btn-text { display: none; }
  .icon-only-mobile .btn { padding: 0.55rem !important; gap: 0 !important; justify-content: center !important; min-width: 40px; min-height: 40px; }
  .icon-only-mobile .btn i, .icon-only-mobile .btn svg { width: 18px; height: 18px; }
}

/* =============================================
   TABLE-LINK — "Detail →" links in tables: keep icon inline, never wrap
   ============================================= */
.table-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
