/* ============================================================================
   FieldServiceOps — site styles
   Tokens come straight from DesignGuide/src/styles/globals.css (the EMS theme):
   green accent, deep-green floating sidebar, 14px base, 0.625rem radius.
   ========================================================================== */

:root {
  --font-size: 14px;
  --font: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;

  --background: #f8faf9;
  --foreground: #1a1a1a;
  --card: #ffffff;
  --card-foreground: #1a1a1a;
  --popover: #ffffff;
  --primary: #22c55e;
  --primary-strong: #16a34a;
  --primary-foreground: #ffffff;
  --secondary: #f1f5f4;
  --muted: #f1f5f4;
  --muted-foreground: #6b7280;
  --accent: #dcfce7;
  --accent-foreground: #166534;
  --destructive: #ef4444;
  --destructive-strong: #dc2626;
  --destructive-foreground: #ffffff;
  --border: #e5e7eb;
  --input-background: #ffffff;
  --ring: #22c55e;

  --chart-1: #22c55e;
  --chart-2: #3b82f6;
  --chart-3: #f59e0b;
  --chart-4: #8b5cf6;
  --chart-5: #ef4444;

  --radius: 0.625rem;
  --radius-sm: calc(var(--radius) - 4px);
  --radius-lg: calc(var(--radius) + 4px);
  --radius-xl: 1.5rem;

  --sidebar: #2c5f4e;
  --sidebar-foreground: #ffffff;
  --sidebar-primary: #7bdc93;
  --sidebar-primary-foreground: #2c5f4e;
  --sidebar-accent: #3a6b5a;
  --sidebar-accent-foreground: #ffffff;
  --sidebar-border: #3a6b5a;

  --tone-good-bg: #dcfce7;   --tone-good-fg: #166534;   --tone-good-dot: #22c55e;
  --tone-info-bg: #dbeafe;   --tone-info-fg: #1e40af;   --tone-info-dot: #3b82f6;
  --tone-warn-bg: #fef3c7;   --tone-warn-fg: #92400e;   --tone-warn-dot: #f59e0b;
  --tone-serious-bg: #fee2e2;--tone-serious-fg: #991b1b;--tone-serious-dot: #ef4444;
  --tone-muted-bg: #f1f5f4;  --tone-muted-fg: #6b7280;  --tone-muted-dot: #9ca3af;
  --tone-neutral-bg: #ede9fe;--tone-neutral-fg: #5b21b6;--tone-neutral-dot: #8b5cf6;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 8px 24px rgba(16, 24, 40, 0.08);
  --shadow-sidebar: 0 25px 50px -12px rgba(44, 95, 78, 0.35);

  --sidebar-w: 248px;
  --gutter: 24px;
}

*, *::before, *::after { box-sizing: border-box; }

html { font-size: var(--font-size); -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--foreground);
  background: var(--background);
  font-feature-settings: "tnum" 1, "cv11" 1;
}

h1, h2, h3, h4 { margin: 0; font-weight: 500; line-height: 1.3; }
h1 { font-size: 1.714rem; }        /* 24px */
h2 { font-size: 1.286rem; }        /* 18px */
h3 { font-size: 1.071rem; }        /* 15px */
p { margin: 0; }
a { color: inherit; text-decoration: none; }
a.link { color: var(--accent-foreground); }
a.link:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------------------------------------------------------------------------
   App shell
   ------------------------------------------------------------------------- */

.shell { display: flex; min-height: 100vh; }

.sidebar-wrap {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: var(--gutter) 0 var(--gutter) var(--gutter);
  flex: 0 0 auto;
}

.sidebar {
  display: flex;
  flex-direction: column;
  width: var(--sidebar-w);
  height: 100%;
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar) 60%, var(--sidebar-accent) 100%);
  color: var(--sidebar-foreground);
  box-shadow: var(--shadow-sidebar);
  border: 1px solid rgba(58, 107, 90, 0.2);
  overflow: hidden;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px 18px;
}

.brand-mark {
  width: 40px; height: 40px;
  flex: 0 0 auto;
  border-radius: 999px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--sidebar-primary), rgba(123, 220, 147, 0.8));
  color: var(--sidebar-primary-foreground);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}

.brand-text { min-width: 0; }
.brand-text strong { display: block; font-weight: 600; font-size: 1.071rem; white-space: nowrap; }
.brand-text span { display: block; font-size: 0.857rem; color: rgba(255, 255, 255, 0.7); white-space: nowrap; }

.sidebar-nav { flex: 1; padding: 6px 12px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.82);
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.nav-link.active {
  background: linear-gradient(135deg, var(--sidebar-primary), rgba(123, 220, 147, 0.85));
  color: var(--sidebar-primary-foreground);
  font-weight: 500;
  box-shadow: 0 8px 20px rgba(123, 220, 147, 0.3);
}
.nav-link .icon { flex: 0 0 auto; }
.nav-link small { display: block; font-size: 0.786rem; opacity: 0.7; font-weight: 400; }

.sidebar-foot {
  padding: 16px 20px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex; align-items: center; gap: 10px;
  font-size: 0.857rem; color: rgba(255, 255, 255, 0.75);
  white-space: nowrap;
}

.live-dot {
  width: 8px; height: 8px; border-radius: 999px;
  background: var(--sidebar-primary);
  box-shadow: 0 0 0 0 rgba(123, 220, 147, 0.6);
  animation: pulse 2s ease-out infinite;
}
.live-dot.off { background: #f59e0b; animation: none; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(123, 220, 147, 0.6); }
  70% { box-shadow: 0 0 0 8px rgba(123, 220, 147, 0); }
  100% { box-shadow: 0 0 0 0 rgba(123, 220, 147, 0); }
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: var(--gutter) var(--gutter) 0;
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--muted-foreground); font-size: 0.929rem; min-width: 0; }
.crumbs a:hover { color: var(--foreground); }
.crumbs .sep { opacity: 0.5; }
.crumbs .current { color: var(--foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.topbar-right { display: flex; align-items: center; gap: 10px; }

.menu-toggle { display: none; }

.content { padding: 20px var(--gutter) var(--gutter); max-width: 1320px; width: 100%; }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-subtitle { color: var(--muted-foreground); margin-top: 4px; max-width: 70ch; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------------------------------------------------------------------------
   Buttons
   ------------------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: var(--secondary);
  color: var(--foreground);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.btn:hover { background: #e6ebe9; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.primary { background: var(--primary); color: var(--primary-foreground); box-shadow: 0 4px 12px rgba(34, 197, 94, 0.25); }
.btn.primary:hover { background: var(--primary-strong); }
.btn.outline { background: var(--card); border-color: var(--border); }
.btn.outline:hover { background: var(--secondary); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--secondary); }
.btn.danger { background: var(--destructive); color: var(--destructive-foreground); }
.btn.danger:hover { background: var(--destructive-strong); }
.btn.danger-outline { background: var(--card); border-color: #fecaca; color: #b91c1c; }
.btn.danger-outline:hover { background: #fef2f2; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 0.929rem; }
.btn.icon-only { width: 36px; padding: 0; }
.btn.icon-only.sm { width: 30px; }

.icon { width: 18px; height: 18px; display: inline-block; vertical-align: middle; flex: 0 0 auto; }
.icon.sm { width: 15px; height: 15px; }
.icon.lg { width: 22px; height: 22px; }

/* ---------------------------------------------------------------------------
   Cards, tables, pills
   ------------------------------------------------------------------------- */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { display: flex; align-items: center; gap: 8px; }
.card-head .count { color: var(--muted-foreground); font-weight: 400; }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { padding: 11px 16px; text-align: left; vertical-align: middle; }
table.data th { font-weight: 500; color: var(--muted-foreground); font-size: 0.929rem; border-bottom: 1px solid var(--border); background: #fbfcfb; }
table.data td { border-bottom: 1px solid var(--border); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr.row-link { cursor: pointer; }
table.data tbody tr.row-link:hover td { background: #f6faf7; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .primary-cell { font-weight: 500; }
table.data .sub { display: block; color: var(--muted-foreground); font-size: 0.929rem; }
table.data .actions { text-align: right; white-space: nowrap; }
table.data.compact th, table.data.compact td { padding: 8px 12px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 10px 2px 8px;
  border-radius: 999px;
  font-size: 0.857rem; font-weight: 500;
  background: var(--tone-neutral-bg); color: var(--tone-neutral-fg);
  white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: var(--tone-neutral-dot); }
.pill.good { background: var(--tone-good-bg); color: var(--tone-good-fg); } .pill.good::before { background: var(--tone-good-dot); }
.pill.info { background: var(--tone-info-bg); color: var(--tone-info-fg); } .pill.info::before { background: var(--tone-info-dot); }
.pill.warn { background: var(--tone-warn-bg); color: var(--tone-warn-fg); } .pill.warn::before { background: var(--tone-warn-dot); }
.pill.serious { background: var(--tone-serious-bg); color: var(--tone-serious-fg); } .pill.serious::before { background: var(--tone-serious-dot); }
.pill.muted { background: var(--tone-muted-bg); color: var(--tone-muted-fg); } .pill.muted::before { background: var(--tone-muted-dot); }
.pill.plain::before { display: none; }

.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; background: var(--secondary); color: var(--muted-foreground); font-size: 0.857rem; margin: 2px 4px 2px 0; }

/* ---------------------------------------------------------------------------
   Search box + pager
   ------------------------------------------------------------------------- */

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }

.search { position: relative; flex: 1 1 320px; max-width: 520px; }
.search input {
  width: 100%; height: 38px;
  padding: 0 36px 0 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--input-background);
  font: inherit; color: inherit;
}
.search input:focus { border-color: var(--ring); box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15); outline: none; }
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted-foreground); }
.search .clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; cursor: pointer; padding: 4px; border-radius: 6px; color: var(--muted-foreground); }
.search .clear:hover { background: var(--secondary); color: var(--foreground); }
.search-hint { margin-top: 6px; font-size: 0.857rem; color: var(--muted-foreground); }
.search-hint code { font-family: inherit; background: var(--secondary); border-radius: 4px; padding: 0 5px; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--border); color: var(--muted-foreground); font-size: 0.929rem; }
.pager .buttons { display: flex; gap: 6px; }

/* ---------------------------------------------------------------------------
   Forms
   ------------------------------------------------------------------------- */

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.form-grid .span-2 { grid-column: span 2; }
.form-section { grid-column: span 2; margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--border); font-weight: 500; color: var(--muted-foreground); font-size: 0.929rem; }
.form-section:first-child { margin-top: 0; padding-top: 0; border-top: 0; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label { font-size: 0.929rem; font-weight: 500; }
.field label .req { color: var(--destructive); margin-left: 2px; }
.field .help { font-size: 0.857rem; color: var(--muted-foreground); }
.field input[type="text"], .field input[type="number"], .field input[type="email"], .field input[type="tel"],
.field input[type="date"], .field input[type="datetime-local"], .field select, .field textarea {
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--input-background);
  font: inherit; color: inherit;
  width: 100%;
}
.field textarea { height: auto; min-height: 84px; padding: 8px 10px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--ring); box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15); outline: none; }
.field input.invalid, .field select.invalid { border-color: var(--destructive); }
.field .validation-message { font-size: 0.857rem; color: #b91c1c; }
.field.check { flex-direction: row; align-items: center; gap: 8px; padding-top: 22px; }
.field.check input { width: 16px; height: 16px; accent-color: var(--primary); }

.form-footer { display: flex; justify-content: flex-end; gap: 8px; padding-top: 18px; margin-top: 18px; border-top: 1px solid var(--border); }
.form-error { background: var(--tone-serious-bg); color: var(--tone-serious-fg); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 14px; font-size: 0.929rem; }

/* ---------------------------------------------------------------------------
   Details page
   ------------------------------------------------------------------------- */

.details-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 20px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 20px; }

dl.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 18px; margin: 0; }
dl.facts dt { color: var(--muted-foreground); }
dl.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
dl.facts .group { grid-column: span 2; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); font-weight: 500; font-size: 0.929rem; color: var(--muted-foreground); }

.title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.title-row .pill { position: relative; top: 1px; }
.meta { color: var(--muted-foreground); font-size: 0.929rem; }

.rel-list { list-style: none; margin: 0; padding: 0; }
.rel-item { display: flex; align-items: center; gap: 14px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.rel-item:last-child { border-bottom: 0; }
.rel-item .rel-main { flex: 1; min-width: 0; }
.rel-item .rel-title { font-weight: 500; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rel-item .rel-title a:hover { text-decoration: underline; }
.rel-item .rel-sub { color: var(--muted-foreground); font-size: 0.929rem; }
.rel-item .rel-props { font-size: 0.929rem; color: var(--muted-foreground); }
.rel-item .rel-actions { display: flex; gap: 4px; }

.empty { padding: 28px 18px; text-align: center; color: var(--muted-foreground); }
.empty strong { display: block; color: var(--foreground); font-weight: 500; margin-bottom: 4px; }
.empty .btn { margin-top: 12px; }

.loading { display: flex; align-items: center; gap: 10px; padding: 24px 18px; color: var(--muted-foreground); }
.spinner { width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 999px; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.error-box { display: flex; gap: 10px; align-items: flex-start; padding: 14px 18px; background: var(--tone-serious-bg); color: var(--tone-serious-fg); border-radius: var(--radius); }
.error-box .icon { flex: 0 0 auto; margin-top: 2px; }

/* ---------------------------------------------------------------------------
   Modal / confirm
   ------------------------------------------------------------------------- */

.modal-backdrop { position: fixed; inset: 0; background: rgba(26, 26, 26, 0.45); display: grid; place-items: center; padding: 20px; z-index: 50; animation: fade 0.12s ease-out; }
.modal { width: min(640px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: var(--card); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); animation: rise 0.16s ease-out; }
.modal.narrow { width: min(460px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Node picker inside the link modal */
.picker { position: relative; }
.picker-results { border: 1px solid var(--border); border-radius: var(--radius); margin-top: 6px; max-height: 220px; overflow: auto; background: var(--card); }
.picker-result { display: flex; justify-content: space-between; gap: 10px; width: 100%; padding: 9px 12px; border: 0; border-bottom: 1px solid var(--border); background: transparent; text-align: left; cursor: pointer; }
.picker-result:last-child { border-bottom: 0; }
.picker-result:hover, .picker-result.selected { background: #f0fdf4; }
.picker-result span { color: var(--muted-foreground); font-size: 0.929rem; white-space: nowrap; }
.picker-chosen { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; border: 1px solid var(--primary); background: #f0fdf4; border-radius: var(--radius); }

/* ---------------------------------------------------------------------------
   Notifications + toasts
   ------------------------------------------------------------------------- */

.bell { position: relative; }
.bell .badge { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--primary); color: #fff; font-size: 0.786rem; font-weight: 600; display: grid; place-items: center; border: 2px solid var(--background); }

.drawer-backdrop { position: fixed; inset: 0; z-index: 40; }
.drawer { position: fixed; top: 16px; right: 16px; bottom: 16px; width: min(400px, calc(100vw - 32px)); background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); z-index: 41; display: flex; flex-direction: column; animation: slide 0.18s ease-out; }
@keyframes slide { from { transform: translateX(12px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.drawer-head h2 { display: flex; align-items: center; gap: 8px; }
.drawer-body { flex: 1; overflow: auto; }
.drawer-foot { padding: 10px 16px; border-top: 1px solid var(--border); font-size: 0.857rem; color: var(--muted-foreground); display: flex; align-items: center; gap: 8px; }

.notif { display: grid; grid-template-columns: 8px 1fr auto; gap: 10px; align-items: start; padding: 11px 16px; border-bottom: 1px solid var(--border); }
.notif:last-child { border-bottom: 0; }
.notif .dot { width: 8px; height: 8px; border-radius: 999px; margin-top: 7px; background: var(--tone-neutral-dot); }
.notif.create .dot { background: var(--tone-good-dot); }
.notif.update .dot { background: var(--tone-info-dot); }
.notif.delete .dot { background: var(--tone-serious-dot); }
.notif .title { font-weight: 500; display: flex; gap: 6px; flex-wrap: wrap; }
.notif .title a:hover { text-decoration: underline; }
.notif .sub { color: var(--muted-foreground); font-size: 0.857rem; }
.notif time { color: var(--muted-foreground); font-size: 0.857rem; white-space: nowrap; font-variant-numeric: tabular-nums; }

.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 60; width: min(360px, calc(100vw - 40px)); }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; background: #1f2937; color: #fff; border-radius: var(--radius); box-shadow: var(--shadow-md); animation: rise 0.16s ease-out; }
.toast .icon { margin-top: 1px; }
.toast.success .icon { color: var(--sidebar-primary); }
.toast.error { background: #7f1d1d; }
.toast.info .icon { color: #93c5fd; }
.toast .msg { flex: 1; }
.toast .close { border: 0; background: transparent; color: rgba(255, 255, 255, 0.7); cursor: pointer; padding: 0; }

/* ---------------------------------------------------------------------------
   Charts + dashboard
   ------------------------------------------------------------------------- */

.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; }
.chart-card .card-body { padding: 12px 18px 18px; }
.chart-canvas { position: relative; height: 260px; }
.chart-canvas.tall { height: 320px; }
.chart-table { margin-top: 10px; }
.chart-table table.data th, .chart-table table.data td { padding: 6px 10px; font-size: 0.929rem; }
.chart-desc { color: var(--muted-foreground); font-size: 0.929rem; margin: 4px 0 10px; }
.chart-toggle { display: flex; gap: 4px; }
.chart-toggle .btn.on { background: var(--accent); color: var(--accent-foreground); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; vertical-align: middle; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { padding: 16px 18px; display: flex; align-items: center; gap: 14px; }
.stat .stat-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent); color: var(--accent-foreground); flex: 0 0 auto; }
.stat .stat-label { color: var(--muted-foreground); font-size: 0.929rem; }
.stat .stat-value { font-size: 1.571rem; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat .stat-value.small { font-size: 1.143rem; }

.home-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 20px; align-items: start; }

.entity-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.entity-tile { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); transition: border-color 0.15s, background 0.15s; }
.entity-tile:hover { border-color: var(--primary); background: #f6fdf8; }
.entity-tile .stat-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--accent); color: var(--accent-foreground); }
.entity-tile strong { display: block; font-weight: 500; }
.entity-tile span { color: var(--muted-foreground); font-size: 0.857rem; }

/* ---------------------------------------------------------------------------
   Responsive
   ------------------------------------------------------------------------- */

@media (max-width: 1100px) {
  .details-grid, .home-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  :root { --gutter: 16px; }
  .sidebar-wrap { position: fixed; z-index: 45; left: 0; top: 0; padding: 12px; transform: translateX(-110%); transition: transform 0.2s ease-out; }
  .sidebar-wrap.open { transform: none; }
  .sidebar-scrim { position: fixed; inset: 0; background: rgba(26, 26, 26, 0.4); z-index: 44; }
  .menu-toggle { display: inline-flex; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2, .form-section { grid-column: span 1; }
  .content { padding-top: 14px; }
  .chart-grid { grid-template-columns: 1fr; }
  dl.facts { grid-template-columns: 1fr; gap: 2px 0; }
  dl.facts dt { margin-top: 8px; font-size: 0.857rem; }
  dl.facts .group { grid-column: span 1; }
}

.demo-notice p { margin-bottom: 12px; }
.demo-notice p:last-child { margin-bottom: 0; }

/* Blazor reconnect UI — keep it in the theme */
#components-reconnect-modal { font-family: var(--font); }
