/**
 * CRUCIX Dashboard Shell — Light Corporate Theme (R-F2049)
 * White background, defined borders, soft violet brand accent.
 * All component selectors are unchanged from the dark theme — only the
 * visual values (colours, borders, shadows) were re-skinned, so every page
 * that uses the .sc-* classes inherits the light theme automatically.
 */

:root {
  /* Surfaces — warm cream (Claude-like), airy and corporate */
  --sc-bg:      #faf9f5;   /* warm off-white canvas */
  --sc-bg2:     #f2f0e9;   /* alternate warm surface */
  --sc-card:    #ffffff;   /* cards / panels lift gently off the cream */
  --sc-panel:   #faf9f5;   /* sidebar blends seamlessly with the canvas */

  /* Brand + accents (refined violet, used sparingly on warm light) */
  --sc-prime:      #7c3aed;   /* brand violet */
  --sc-prime-dark: #6d28d9;   /* hover/pressed violet */
  --sc-prime-soft: #f1ecfb;   /* soft violet wash (active row / hover bg) */
  --sc-blue:    #2563eb;
  --sc-green:   #16a34a;
  --sc-orange:  #ea580c;
  --sc-red:     #dc2626;

  /* Text — warm neutrals (R-F2197: darker body/muted for more substance/contrast) */
  --sc-heading: #1b1a18;   /* warm near-black headings/values */
  --sc-text:    #33302a;   /* warm dark grey body */
  --sc-muted:   #5f5c55;   /* warm grey secondary */

  /* Lines + states — R-F2197: stronger, defined borders (the hairlines read as
     "fragile" at ~3% contrast on cream). Darkened for solidity + clearer outlines. */
  --sc-border:        #d8d2c4;   /* warm border — defined */
  --sc-border-strong: #c4bdac;   /* warm stronger divider / outlines */
  --sc-hover:         #efece3;   /* warm neutral hover */
  --sc-shadow:        0 1px 2px rgba(40,36,30,0.07), 0 2px 8px rgba(40,36,30,0.08);
  --sc-shadow-lg:     0 14px 38px rgba(40,36,30,0.16);

  --sc-radius:  14px;
  --sidebar-w:  260px;
  --header-h:   64px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'gorditaregular', 'Segoe UI', Roboto, sans-serif;
  background: var(--sc-bg);
  color: var(--sc-text);
  /* R-F2197 — larger, more substantial base type (was unset → small component
     overrides made the whole UI feel thin/fragile). */
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #dcd8cf; border-radius: 6px; border: 2px solid var(--sc-bg); }
::-webkit-scrollbar-thumb:hover { background: #9b968c; }

a { text-decoration: none; }

/* ── App Shell ─────────────────────────────────────────────────── */
.app-shell { display: flex; min-height: 100vh; }

/* ── Sidebar ────────────────────────────────────────────────────── */
#app-sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--sc-panel);
  border-right: 1px solid var(--sc-border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: left 0.28s cubic-bezier(0.4,0,0.2,1);
  overflow-y: auto;
  overflow-x: hidden;
}

/* R-F2049 — collapse is driven by `body.sidebar-collapsed` (set by sidebar.js).
   The old `#app-sidebar.collapsed ~ #app-main` sibling selector never matched
   because the sidebar is wrapped in #sidebar-placeholder — so the main content
   never reclaimed the space. Keying off <body> is structure-independent. */
body.sidebar-collapsed #app-sidebar { left: calc(0px - var(--sidebar-w)); }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  height: var(--header-h);
  border-bottom: 1px solid var(--sc-border);
  flex-shrink: 0;
}

.sidebar-logo-mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, #913BFF, #6d28d9);
  box-shadow: 0 2px 8px rgba(124,58,237,0.30);
  flex-shrink: 0;
}

.sidebar-brand-name {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--sc-heading);
  flex: 1;
}

/* R-F2052 — Claude-style collapse control lives at the TOP of the sidebar.
   Clicking it retracts the menu (body.sidebar-collapsed); the header hamburger
   then appears at the top-left to re-open. */
.sidebar-collapse-btn {
  background: none; border: none;
  color: var(--sc-muted);
  cursor: pointer;
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  border-radius: 7px;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}
.sidebar-collapse-btn:hover { color: var(--sc-heading); background: var(--sc-hover); }

.sidebar-nav { padding: 12px 0; flex: 1; }

.sidebar-section {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--sc-muted);
  padding: 16px 20px 6px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 16px;
  margin: 2px 8px;
  border-radius: 8px;
  color: var(--sc-text);
  font-size: 14px;            /* R-F2197 */
  font-weight: 600;
  transition: all 0.18s;
  position: relative;
}

.sidebar-link i { font-size: 20px; flex-shrink: 0; color: var(--sc-muted); }

.sidebar-link:hover {
  background: var(--sc-hover);
  color: var(--sc-heading);
}
.sidebar-link:hover i { color: var(--sc-prime); }

.sidebar-link.active {
  background: var(--sc-prime-soft);
  color: var(--sc-prime-dark);
  border-left: 3px solid var(--sc-prime);
  border-radius: 0 8px 8px 0;
  margin-left: 8px;
  font-weight: 600;
}

.sidebar-link.active i { color: var(--sc-prime); }

.sidebar-link .badge {
  margin-left: auto;
  background: var(--sc-prime);
  color: #fff;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 700;
}

.sidebar-divider {
  height: 1px;
  background: var(--sc-border);
  margin: 10px 16px;
}

.sidebar-link.aria-link { color: var(--sc-prime-dark); font-weight: 600; }
.sidebar-link.aria-link i { color: var(--sc-prime); }

/* ── Header ──────────────────────────────────────────────────────── */
#app-header {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--header-h);
  background: rgba(250,249,245,0.82);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--sc-border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  z-index: 90;
  transition: left 0.28s cubic-bezier(0.4,0,0.2,1);
}

body.sidebar-collapsed #app-header { left: 0; }

.header-toggle {
  background: none; border: none;
  color: var(--sc-muted);
  cursor: pointer;
  font-size: 20px;
  /* R-F2052 — hidden while the sidebar is open (collapse lives in the sidebar);
     appears at the top-left only when collapsed, as the re-open control. */
  display: none; align-items: center;
  padding: 6px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.header-toggle:hover { color: var(--sc-heading); background: var(--sc-hover); }
body.sidebar-collapsed .header-toggle { display: flex; }

.header-brand {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--sc-muted);
}

.header-spacer { flex: 1; }

.header-actions { display: flex; align-items: center; gap: 6px; }

.header-icon-btn {
  background: none; border: none;
  width: 36px; height: 36px;
  border-radius: 8px;
  color: var(--sc-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  transition: all 0.15s;
}
.header-icon-btn:hover { color: var(--sc-heading); background: var(--sc-hover); }

.nav-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #913BFF, #2563eb);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(124,58,237,0.30);
  letter-spacing: 0.5px;
}

/* User dropdown */
.nav-dropdown {
  position: relative;
}
.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 220px;
  background: var(--sc-card);
  border: 1px solid var(--sc-border);
  border-radius: 12px;
  box-shadow: var(--sc-shadow-lg);
  overflow: hidden;
  z-index: 200;
}
.nav-dropdown-menu.open { display: block; }
.nav-dropdown-user {
  padding: 14px 16px;
  border-bottom: 1px solid var(--sc-border);
}
.nav-dropdown-name { font-size: 14px; font-weight: 600; color: var(--sc-heading); }
.nav-dropdown-role { font-size: 11px; color: var(--sc-muted); margin-top: 2px; }
.nav-dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--sc-text);
  cursor: pointer;
  transition: background 0.15s;
  border: none; background: none; width: 100%; text-align: left;
}
.nav-dropdown-item:hover { background: var(--sc-hover); color: var(--sc-heading); }
.nav-dropdown-item.danger { color: var(--sc-red); }
.nav-dropdown-item.danger:hover { background: rgba(220,38,38,0.08); }
.nav-dropdown-divider { height: 1px; background: var(--sc-border); }

/* ── Main Content ────────────────────────────────────────────────── */
#app-main {
  margin-left: var(--sidebar-w);
  margin-top: var(--header-h);
  min-height: calc(100vh - var(--header-h));
  padding: 28px 28px 60px;
  background: var(--sc-bg);
  transition: margin-left 0.28s cubic-bezier(0.4,0,0.2,1);
}

body.sidebar-collapsed #app-main { margin-left: 0; }

/* ── Cards ───────────────────────────────────────────────────────── */
.sc-card {
  background: var(--sc-card);
  border: 1px solid var(--sc-border-strong);   /* R-F2197 — defined outline */
  border-radius: var(--sc-radius);
  overflow: hidden;
  box-shadow: var(--sc-shadow);
  transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
}
.sc-card:hover { box-shadow: var(--sc-shadow-lg); border-color: var(--sc-border-strong); }

.sc-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--sc-border);
  display: flex; align-items: center; gap: 10px;
}
.sc-card-title {
  font-size: 15.5px; font-weight: 700; color: var(--sc-heading);
  display: flex; align-items: center; gap: 9px; flex: 1;
}
.sc-card-title i { color: var(--sc-prime); font-size: 20px; }
.sc-card-body { padding: 20px; }
.sc-card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--sc-border);
  font-size: 12px; color: var(--sc-muted);
}

/* ── Stat Tiles ──────────────────────────────────────────────────── */
.sc-stat {
  background: var(--sc-card);
  border: 1px solid var(--sc-border-strong);   /* R-F2197 */
  border-radius: var(--sc-radius);
  padding: 22px;
  display: flex; align-items: center; gap: 16px;
  position: relative; overflow: hidden;
  box-shadow: var(--sc-shadow);
  transition: all 0.2s;
}
.sc-stat:hover { transform: translateY(-2px); box-shadow: var(--sc-shadow-lg); }
.sc-stat::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--sc-prime), var(--sc-blue));
}

.sc-stat-icon {
  width: 56px; height: 56px;
  border-radius: 13px;
  background: rgba(124,58,237,0.12);
  color: var(--sc-prime);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; flex-shrink: 0;    /* R-F2197 — bigger, bolder icon */
}
.sc-stat-icon.blue   { background: rgba(37,99,235,0.10);  color: var(--sc-blue); }
.sc-stat-icon.green  { background: rgba(22,163,74,0.10);  color: var(--sc-green); }
.sc-stat-icon.orange { background: rgba(234,88,12,0.10);  color: var(--sc-orange); }
.sc-stat-icon.red    { background: rgba(220,38,38,0.10);  color: var(--sc-red); }

.sc-stat-value { font-size: 32px; font-weight: 800; color: var(--sc-heading); line-height: 1.1; }
.sc-stat-label { font-size: 12.5px; font-weight: 500; color: var(--sc-muted); margin-top: 3px; }

/* ── Buttons ─────────────────────────────────────────────────────── */
.sc-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 28px; border-radius: 9px; border: none;
  font-size: 14.5px; font-weight: 700; cursor: pointer;   /* R-F2197 — bolder */
  transition: all 0.2s; text-decoration: none;
}
.sc-btn-primary { background: var(--sc-prime); color: #fff; box-shadow: 0 1px 2px rgba(124,58,237,0.25); }
.sc-btn-primary:hover { background: var(--sc-prime-dark); box-shadow: 0 4px 14px rgba(124,58,237,0.30); }
.sc-btn-outline { background: #fff; color: var(--sc-text); border: 1px solid var(--sc-border-strong); }
.sc-btn-outline:hover { border-color: var(--sc-prime); color: var(--sc-prime-dark); background: var(--sc-prime-soft); }
.sc-btn-sm { padding: 7px 16px; font-size: 12px; }
.sc-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Badges ──────────────────────────────────────────────────────── */
.sc-badge {
  display: inline-flex; align-items: center;
  padding: 3px 11px; border-radius: 20px;
  font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
}
.sc-badge-prime  { background: rgba(124,58,237,0.12); color: var(--sc-prime-dark); }
.sc-badge-blue   { background: rgba(37,99,235,0.12);  color: #1d4ed8; }
.sc-badge-green  { background: rgba(22,163,74,0.12);  color: #15803d; }
.sc-badge-orange { background: rgba(234,88,12,0.12);  color: #c2410c; }
.sc-badge-red    { background: rgba(220,38,38,0.12);  color: #b91c1c; }
.sc-badge-muted  { background: #f2f0e9; color: var(--sc-muted); }

/* ── Page header ──────────────────────────────────────────────────── */
.sc-page-header { margin-bottom: 28px; }
.sc-page-title {
  font-size: 25px; font-weight: 800; color: var(--sc-heading);   /* R-F2197 */
  display: flex; align-items: center; gap: 11px; margin-bottom: 5px;
  letter-spacing: -0.2px;
}
.sc-page-title i { color: var(--sc-prime); font-size: 27px; }
.sc-page-sub { font-size: 14px; color: var(--sc-muted); }

/* ── Form fields ──────────────────────────────────────────────────── */
.sc-field { margin-bottom: 18px; }
.sc-field label { display: block; font-size: 13.5px; color: var(--sc-text); margin-bottom: 7px; font-weight: 600; }
.sc-field input, .sc-field select, .sc-field textarea {
  width: 100%;
  background: #fff;
  border: 1.5px solid var(--sc-border-strong);   /* R-F2197 — defined field outline */
  border-radius: 9px;
  color: var(--sc-heading);
  padding: 13px 16px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
}
.sc-field input:focus, .sc-field select:focus, .sc-field textarea:focus {
  border-color: var(--sc-prime);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.15);
  background: #fff;
}
.sc-field input::placeholder { color: #9b968c; }
.sc-field select option { background: #fff; color: var(--sc-heading); }
.sc-field-error { font-size: 12px; color: var(--sc-red); margin-top: 4px; }

/* ── Table ────────────────────────────────────────────────────────── */
.sc-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.sc-table th {
  text-align: left;
  padding: 12px 14px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--sc-muted);
  border-bottom: 1.5px solid var(--sc-border-strong);   /* R-F2197 */
  background: #f3f1ea;
}
.sc-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--sc-border);
  color: var(--sc-text);
  vertical-align: middle;
}
.sc-table tbody tr:nth-child(even) td { background: #f7f6f1; }
.sc-table tbody tr:hover td { background: var(--sc-prime-soft); }
/* Rounded, bordered table frame when wrapped in .sc-card / .sc-table-wrap */
.sc-table-wrap { border: 1px solid var(--sc-border); border-radius: var(--sc-radius); overflow: hidden; background: #fff; }
.sc-table-wrap .sc-table th:first-child,
.sc-table-wrap .sc-table td:first-child { padding-left: 18px; }

/* ── Alert ────────────────────────────────────────────────────────── */
.sc-alert {
  padding: 12px 16px; border-radius: 8px; font-size: 13px;
  display: flex; align-items: center; gap: 8px; margin-bottom: 16px;
}
.sc-alert-danger  { background: rgba(220,38,38,0.08); border: 1px solid rgba(220,38,38,0.25); color: #b91c1c; }
.sc-alert-success { background: rgba(22,163,74,0.08); border: 1px solid rgba(22,163,74,0.25); color: #15803d; }
.sc-alert-warning { background: rgba(234,88,12,0.08); border: 1px solid rgba(234,88,12,0.25); color: #c2410c; }
.sc-alert-info    { background: rgba(37,99,235,0.08); border: 1px solid rgba(37,99,235,0.25); color: #1d4ed8; }

/* ── Toast ────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 9999; display: flex; flex-direction: column; gap: 8px;
}
.crucix-toast {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-radius: 10px; font-size: 13px;
  min-width: 260px; max-width: 400px;
  animation: toast-in 0.3s ease;
  box-shadow: var(--sc-shadow-lg);
}
.toast-info    { background: var(--sc-card); border: 1px solid var(--sc-border); color: var(--sc-heading); }
.toast-success { background: #fff; border: 1px solid rgba(22,163,74,0.3); color: #15803d; }
.toast-error   { background: #fff; border: 1px solid rgba(220,38,38,0.3); color: #b91c1c; }
.toast-warning { background: #fff; border: 1px solid rgba(234,88,12,0.3); color: #c2410c; }
.crucix-toast button { background: none; border: none; color: inherit; cursor: pointer; opacity: 0.6; font-size: 16px; }
@keyframes toast-in { from { opacity:0; transform: translateX(20px); } to { opacity:1; transform: translateX(0); } }

/* ── Loading ──────────────────────────────────────────────────────── */
.sc-spinner {
  display: inline-block; width: 20px; height: 20px;
  border: 2px solid rgba(124,58,237,0.25);
  border-top-color: var(--sc-prime);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.sc-loading-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 60px 20px; gap: 16px;
  color: var(--sc-muted); font-size: 14px;
}

/* ── R-F108 (2026-05-09): skeleton shimmer for loading states ────────
   Apply .sc-skeleton to a div to render a placeholder block with
   shimmer animation. Defaults to 18px height; override with inline
   style or extend with .sc-skeleton-line / .sc-skeleton-block. */
.sc-skeleton {
  display: block; width: 100%; height: 18px;
  margin-bottom: 8px; border-radius: 5px;
  background: #e9e6df;
  background-image: linear-gradient(
    90deg,
    #e9e6df 0%,
    #e9e6df 50%,
    #e9e6df 100%
  );
  background-size: 200% 100%;
  animation: sc-shimmer 1.4s ease-in-out infinite;
}
.sc-skeleton-block { height: 60px; border-radius: 8px; }
.sc-skeleton-circle {
  width: 36px; height: 36px; border-radius: 50%;
  display: inline-block; vertical-align: middle;
}
.sc-skeleton-text { height: 12px; max-width: 60%; }
@keyframes sc-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .sc-skeleton { animation: none; }
}

/* ── R-F112 (2026-05-09): print stylesheet ────────────────────────────
   Direct browser-print of any dashboard page should produce something
   readable on paper. The audit-grade PDF route (R-F43) is still the
   primary output for compliance distribution; this is for ad-hoc
   "I just need a paper copy" moments. */
@media print {
  /* Background → white, text → black */
  html, body { background: #fff !important; color: #000 !important; }

  /* Hide chrome — nav, header, sidebar, sidebar-toggle */
  #app-header, #app-sidebar, #sidebar-overlay, #sidebar-toggle,
  .header-toggle, .header-icon-btn, .nav-avatar, .nav-dropdown,
  #alerts-bell, #alerts-popup, .convos-panel, .input-area,
  .chat-titlebar, .ex-search-wrap, .ex-tabs, .ex-rail,
  .dd-pipeline, .dd-toolbar, .dd-act-btn, .sc-btn, button,
  .convos-toggle, .convos-new-btn,
  /* Skeleton placeholders are noise on paper */
  .sc-skeleton, .ex-skel,
  /* Nav-only items in heatmap headers */
  .header-spacer, .header-brand {
    display: none !important;
  }

  /* Main content takes full width — no fixed margin from header */
  #app-main, main, .acct-shell, .dd-shell, .ex-shell, .mc-shell, .st-shell {
    margin-left: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
  }

  /* Cards become flat outlined boxes for print clarity */
  .sc-card, .ex-card, .ex-rail-card, .pricing-card,
  .acct-tier, .acct-usage-card, .dd-table {
    background: transparent !important;
    border: 1px solid #999 !important;
    box-shadow: none !important;
    color: #000 !important;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  /* Headings + table headers force page breaks before */
  h1, h2 { page-break-before: auto; page-break-after: avoid; color: #000 !important; }
  h3, h4 { page-break-after: avoid; color: #000 !important; }
  table { page-break-inside: auto; border-collapse: collapse; }
  thead { display: table-header-group; }
  tr    { page-break-inside: avoid; }
  th, td { border: 1px solid #999 !important; padding: 4px 6px !important; }

  /* URLs visible after the link text — ops want the source on paper */
  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em; color: #555;
  }
  /* Don't expand internal anchors / mailto / tel */
  a[href^="#"]::after, a[href^="mailto:"]::after, a[href^="tel:"]::after { content: ""; }

  /* Text colour everywhere */
  *, *::before, *::after { color: #000 !important; text-shadow: none !important; }
  .text-muted, .sc-page-sub, .acct-usage-label { color: #555 !important; }

  /* @page directive — operator-readable A4 with page numbers */
  @page {
    size: A4;
    margin: 16mm 14mm 18mm 14mm;
    @bottom-center {
      content: "Page " counter(page) " of " counter(pages);
      font-size: 9pt; color: #555;
    }
    @top-right { content: "ARIA — Confidential"; font-size: 8.5pt; color: #555; }
  }
}

/* ── Grid ──────────────────────────────────────────────────────────── */
.sc-grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 20px; }
.sc-grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; }
.sc-grid-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: 20px; }
@media(max-width:1200px){ .sc-grid-4 { grid-template-columns: repeat(2,1fr); } }
@media(max-width:768px){ .sc-grid-4,.sc-grid-3,.sc-grid-2 { grid-template-columns:1fr; } }

/* ── Overlay / modal ───────────────────────────────────────────────── */
.sc-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.45);
  backdrop-filter: blur(3px);
  z-index: 500;
  display: none; align-items: center; justify-content: center;
}
.sc-overlay.open { display: flex; }
.sc-modal {
  background: var(--sc-card);
  border: 1.5px solid var(--sc-border-strong);   /* R-F2197 */
  border-radius: 18px;
  padding: 30px;
  width: 90%; max-width: 480px;
  box-shadow: 0 30px 70px rgba(15,23,42,0.32);
}
.sc-modal-title { font-size: 20px; font-weight: 800; color: var(--sc-heading); margin-bottom: 22px; }

/* ── Rich modal (R-F2199) — shared polished/interactive modal pattern ──────── */
.sc-mod-overlay {
  position: fixed; inset: 0; background: rgba(27,26,24,0.5);
  backdrop-filter: blur(4px); z-index: 1000;
  display: none; align-items: flex-start; justify-content: center;
  overflow-y: auto; padding: 6vh 16px;
}
.sc-mod-overlay.open { display: flex; }
.sc-mod {
  background: var(--sc-card); border: 1.5px solid var(--sc-border-strong);
  border-radius: 18px; width: 100%; max-width: 560px;
  box-shadow: 0 30px 70px rgba(15,23,42,0.32); overflow: hidden;
  animation: sc-mod-in 0.2s ease;
}
@keyframes sc-mod-in { from { opacity:0; transform: translateY(8px) scale(0.99); } to { opacity:1; transform:none; } }
.sc-mod-head { display: flex; align-items: flex-start; gap: 14px; padding: 22px 24px; border-bottom: 1px solid var(--sc-border); }
.sc-mod-ico { width: 46px; height: 46px; border-radius: 13px; flex-shrink: 0; background: rgba(124,58,237,0.12); color: var(--sc-prime); display: flex; align-items: center; justify-content: center; font-size: 23px; }
.sc-mod-head h3 { font-size: 19px; font-weight: 800; color: var(--sc-heading); line-height: 1.25; }
.sc-mod-head p { font-size: 13px; color: var(--sc-muted); margin-top: 3px; }
.sc-mod-x { margin-left: auto; background: var(--sc-hover); border: none; color: var(--sc-muted); width: 34px; height: 34px; border-radius: 9px; font-size: 19px; cursor: pointer; flex-shrink: 0; display:flex; align-items:center; justify-content:center; transition: all .15s; }
.sc-mod-x:hover { color: var(--sc-heading); background: var(--sc-border-strong); }
.sc-mod-body { padding: 22px 24px; display: flex; flex-direction: column; gap: 16px; max-height: 64vh; overflow-y: auto; }
.sc-mod-foot { padding: 16px 24px; border-top: 1px solid var(--sc-border); display: flex; justify-content: flex-end; gap: 10px; background: #faf9f5; flex-wrap: wrap; }
.sc-mod-field { display: flex; flex-direction: column; gap: 7px; }
.sc-mod-field > label { font-size: 13.5px; font-weight: 600; color: var(--sc-text); }
.sc-mod-field label .opt { font-weight: 400; color: var(--sc-muted); }
.sc-mod-field input, .sc-mod-field textarea, .sc-mod-field select {
  width: 100%; background: #fff; border: 1.5px solid var(--sc-border-strong);
  border-radius: 10px; padding: 12px 14px; font-size: 14.5px; color: var(--sc-heading);
  outline: none; font-family: inherit; transition: border-color .15s, box-shadow .15s;
}
.sc-mod-field input:focus, .sc-mod-field textarea:focus, .sc-mod-field select:focus {
  border-color: var(--sc-prime); box-shadow: 0 0 0 3px rgba(124,58,237,0.15);
}
.sc-mod-row { display: flex; gap: 12px; flex-wrap: wrap; }
.sc-mod-row > .sc-mod-field { flex: 1; min-width: 160px; }
.sc-mod-hint { display:flex; align-items:flex-start; gap:9px; font-size:12.5px; color: var(--sc-prime-dark); background: var(--sc-prime-soft); border-radius: 10px; padding: 11px 13px; line-height: 1.5; }
.sc-mod-hint i { margin-top: 1px; font-size: 15px; }
.sc-mod-err { font-size:13px; color: var(--sc-red); background: rgba(220,38,38,0.08); border:1px solid rgba(220,38,38,0.22); border-radius:9px; padding:10px 13px; display:none; }
.sc-mod-err.show { display:block; }
/* segmented control (interactive type chooser) */
.sc-seg { display: inline-flex; background: var(--sc-bg2); border: 1.5px solid var(--sc-border-strong); border-radius: 11px; padding: 3px; gap: 3px; flex-wrap: wrap; }
.sc-seg button { border: none; background: none; padding: 9px 15px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--sc-muted); cursor: pointer; transition: all .15s; display:flex; align-items:center; gap:6px; }
.sc-seg button:hover { color: var(--sc-heading); }
.sc-seg button.active { background: #fff; color: var(--sc-prime-dark); box-shadow: var(--sc-shadow); }
/* option cards (mode chooser) */
.sc-optgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
@media(max-width:520px){ .sc-optgrid { grid-template-columns: 1fr; } }
.sc-optcard { border: 1.5px solid var(--sc-border-strong); border-radius: 12px; padding: 14px; cursor: pointer; transition: all .15s; background: #fff; text-align: left; }
.sc-optcard:hover { border-color: var(--sc-prime); }
.sc-optcard.active { border-color: var(--sc-prime); background: var(--sc-prime-soft); box-shadow: 0 0 0 1px var(--sc-prime); }
.sc-optcard .t { font-size: 14.5px; font-weight: 700; color: var(--sc-heading); display:flex; align-items:center; gap:8px; }
.sc-optcard .d { font-size: 12px; color: var(--sc-muted); margin-top: 5px; line-height: 1.45; }

/* ── Responsive sidebar ───────────────────────────────────────────── */
@media(max-width:1024px){
  #app-sidebar { left: calc(0px - var(--sidebar-w)); box-shadow: var(--sc-shadow-lg); }
  #app-sidebar.mobile-open { left: 0; }
  #app-main { margin-left: 0; }
  #app-header { left: 0; }
  /* On mobile, collapse class must not push the sidebar further off-screen */
  body.sidebar-collapsed #app-main { margin-left: 0; }
  .sidebar-overlay {
    position: fixed; inset: 0; background: rgba(15,23,42,0.4);
    z-index: 99; display: none;
  }
  .sidebar-overlay.show { display: block; }
}

/* ── Status dot ───────────────────────────────────────────────────── */
.status-dot {
  display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; flex-shrink: 0;
}
.status-dot.ok      { background: var(--sc-green); box-shadow: 0 0 0 3px rgba(22,163,74,0.15); }
.status-dot.warn    { background: var(--sc-orange); }
.status-dot.error   { background: var(--sc-red); }
.status-dot.unknown { background: var(--sc-muted); }

/* ── Misc ─────────────────────────────────────────────────────────── */
.text-prime  { color: var(--sc-prime); }
.text-blue   { color: var(--sc-blue); }
.text-green  { color: var(--sc-green); }
.text-orange { color: var(--sc-orange); }
.text-red    { color: var(--sc-red); }
.text-muted  { color: var(--sc-muted) !important; }
.text-white  { color: #fff !important; }
.fw-bold     { font-weight: 700; }
.fw-semibold { font-weight: 600; }
.d-flex      { display: flex; }
.align-center{ align-items: center; }
.gap-8       { gap: 8px; }
.gap-12      { gap: 12px; }
.mt-4        { margin-top: 4px; }
.mt-8        { margin-top: 8px; }
.mt-16       { margin-top: 16px; }
.mt-24       { margin-top: 24px; }
.mb-4        { margin-bottom: 4px; }
.mb-8        { margin-bottom: 8px; }
.mb-16       { margin-bottom: 16px; }
.mb-24       { margin-bottom: 24px; }
.mb-28       { margin-bottom: 28px; }
.ms-auto     { margin-left: auto; }
