/* SpecSnipe — Antigravity Composer Double-Bezel & Ultradesign System */

@font-face {
  font-family: "Google Sans Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 400 700;
  src: url("/static/fonts/google-sans-variable-latin.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Google Sans Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 400 700;
  src: url("/static/fonts/google-sans-variable-latin-ext.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Google Sans Code";
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url("/static/fonts/google-sans-code-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122;
}

@font-face {
  font-family: "Google Sans Code";
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url("/static/fonts/google-sans-code-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+1E00-1E9F, U+2020, U+20A0-20AB;
}

:root {
  --font-sans: "Google Sans Variable", "Outfit", "Inter", sans-serif;
  --font-display: "Google Sans Variable", "Outfit", sans-serif;
  --font-mono: "Google Sans Code", monospace;

  /* Light Mode — Neutral Ivory Canvas + Crisp White Inner Surface */
  --bg-color: #FDFBF7;
  --text-color: #14151A;
  --text-secondary: #525560;
  --text-muted: #767A87;
  --border-color: rgba(15, 16, 22, 0.07);
  --border-strong: rgba(15, 16, 22, 0.14);
  --divider-color: rgba(15, 16, 22, 0.07);
  --card-bg: #FFFFFF;
  --card-outer-bg: rgba(15, 16, 22, 0.04);
  --input-bg: #F8F8FA;
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-blur: 14px;
  --accent: #14151A;
  --sidebar-bg: #F6F5F1;
  --success: #059669;
  --warning: #D97706;
  --danger: #DC2626;
  --row-alt: rgba(15, 16, 22, 0.018);

  /* Spacing Scale (4px base) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --space-16: 64px;
  --space-24: 96px;

  /* Z-Index Layer Map */
  --z-mesh: -10;
  --z-base: 0;
  --z-card: 10;
  --z-sticky: 100;
  --z-sidebar: 200;
  --z-dropdown: 300;
  --z-modal: 400;
  --z-toast: 500;
}

:root.dark,
.theme-dark {
  /* Dark Mode — Pure Obsidian #070708 + Antigravity Composer Surfaces */
  --bg-color: #070708;
  --text-color: #F3F3F6;
  --text-secondary: #9898A3;
  --text-muted: #6C6C77;
  --border-color: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);
  --divider-color: #202025;
  --card-bg: #15151A;
  --card-outer-bg: #0B0B0F;
  --input-bg: #0E0E12;
  --glass-bg: rgba(21, 21, 26, 0.88);
  --glass-blur: 12px;
  --accent: #F3F3F6;
  --sidebar-bg: #0A0A0D;
  --success: #34D399;
  --warning: #FBBF24;
  --danger: #F87171;
  --row-alt: rgba(255, 255, 255, 0.018);
}

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

html {
  background-color: var(--bg-color);
  color: var(--text-color);
  overflow-x: hidden;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background-color 0.2s ease, color 0.2s ease;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  margin: 0;
  letter-spacing: -0.02em;
  color: var(--text-color);
}

p {
  margin: 0;
}

a {
  color: var(--text-color);
  text-decoration: none;
}

code,
.mono-val {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(128, 128, 140, 0.24);
  border-radius: 3px;
}

/* Ambient Layer — Subtle Light Tint Only, Muted Clean in Dark Mode (Zero Olive Mud) */
.mesh-layer {
  position: fixed;
  inset: 0;
  z-index: var(--z-mesh);
  pointer-events: none;
  overflow: hidden;
  user-select: none;
}

.mesh-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(140px);
}

.mesh-orb-1 {
  top: -14%;
  left: 6%;
  width: 46vw;
  height: 46vw;
  max-width: 580px;
  max-height: 580px;
  background: rgba(15, 23, 42, 0.028);
}

.mesh-orb-2 {
  bottom: -16%;
  right: -8%;
  width: 50vw;
  height: 50vw;
  max-width: 620px;
  max-height: 620px;
  background: rgba(37, 99, 235, 0.025);
}

:root.dark .mesh-orb,
.theme-dark .mesh-orb {
  display: none;
}

.paper-noise {
  position: absolute;
  inset: 0;
  opacity: 0.01;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

:root.dark .paper-noise,
.theme-dark .paper-noise {
  display: none;
}

/* Antigravity Composer Double-Bezel Card Geometry */
.card-outer {
  display: flex;
  flex-direction: column;
  padding: 3px;
  border-radius: 22px;
  background: rgba(15, 16, 22, 0.04);
  border: 1px solid rgba(15, 16, 22, 0.07);
  box-shadow: 0 2px 12px rgba(15, 16, 22, 0.035);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
}

.card-outer.hover-lift:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px -8px rgba(15, 16, 22, 0.1);
}

.card-inner {
  flex: 1;
  height: 100%;
  padding: 20px 22px;
  border-radius: 19px;
  background: #FFFFFF;
  border: 1px solid rgba(15, 16, 22, 0.07);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), inset 0 1px 0 #FFFFFF;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

:root.dark .card-outer,
.theme-dark .card-outer {
  padding: 3px;
  border-radius: 22px;
  background: linear-gradient(180deg, #0D0D11 0%, #0A0A0E 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom-color: rgba(255, 255, 255, 0.035);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

:root.dark .card-outer.hover-lift:hover,
.theme-dark .card-outer.hover-lift:hover {
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.62);
}

:root.dark .card-inner,
.theme-dark .card-inner {
  border-radius: 19px;
  background: #15151A;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-top-color: rgba(255, 255, 255, 0.13);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

/* Composer Horizontal Tray Divider (#202025 in Dark Mode) */
.card-tray {
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--divider-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}

/* Application Shell & Persistent Left Sidebar */
.app-shell {
  display: flex;
  min-height: 100dvh;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

.mobile-topbar {
  display: none;
}

.sidebar-backdrop {
  display: none;
}

.app-sidebar {
  width: 244px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100dvh;
  padding: var(--space-4);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--divider-color);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-4);
  z-index: var(--z-sidebar);
  overflow-y: auto;
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 700;
  font-size: 1.04rem;
  letter-spacing: -0.02em;
  color: var(--text-color);
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--bg-color);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.sidebar-section-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0 var(--space-3);
  margin-bottom: var(--space-1);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 9px 12px;
  min-height: 40px;
  border-radius: 11px;
  font-size: 0.865rem;
  font-weight: 500;
  color: var(--text-secondary);
  border: 1px solid transparent;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.nav-item:hover {
  background: rgba(128, 128, 145, 0.08);
  color: var(--text-color);
}

.nav-item.nav-active {
  background: var(--card-bg);
  color: var(--text-color);
  font-weight: 600;
  border-color: var(--divider-color);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

:root.dark .nav-item.nav-active,
.theme-dark .nav-item.nav-active {
  background: #15151A;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.sidebar-bottom {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--divider-color);
}

.sidebar-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.45;
  padding: 0 var(--space-1);
}

.sidebar-meta a {
  color: var(--text-secondary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.sidebar-legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-1);
}

/* Main Workspace Canvas (Clean Obsidian #070708 / Ivory #FDFBF7) */
.app-main {
  flex: 1;
  min-width: 0;
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
}

.workspace-frame {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* Workspace Header Bar */
.view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--divider-color);
}

.view-title-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  max-width: 760px;
}

.view-title {
  font-size: clamp(1.3rem, 2vw, 1.65rem);
  font-weight: 700;
  line-height: 1.2;
}

.view-subtitle {
  font-size: 0.865rem;
  color: var(--text-secondary);
}

.view-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

/* Buttons & Theme Toggle */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-sans);
  font-weight: 600;
  border-radius: 11px;
  padding: 9px 18px;
  min-height: 40px;
  font-size: 0.85rem;
  transition: opacity 0.16s ease, transform 0.14s ease;
  cursor: pointer;
  border: 1px solid transparent;
  background-color: var(--accent);
  color: var(--bg-color);
  white-space: nowrap;
}

.btn-primary:hover:not(:disabled) {
  opacity: 0.9;
}

.btn-primary:active:not(:disabled) {
  transform: scale(0.98) translateY(1px);
}

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

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-sans);
  font-weight: 600;
  border-radius: 11px;
  padding: 9px 16px;
  min-height: 40px;
  font-size: 0.85rem;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease, transform 0.14s ease;
  cursor: pointer;
  border: 1px solid var(--border-strong);
  background-color: var(--input-bg);
  color: var(--text-color);
  white-space: nowrap;
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--text-muted);
}

.btn-secondary:active:not(:disabled) {
  transform: scale(0.98) translateY(1px);
}

.btn-sm {
  padding: 6px 12px;
  min-height: 34px;
  font-size: 0.8rem;
  border-radius: 9px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--divider-color);
  background: var(--card-bg);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.icon-btn:hover {
  color: var(--text-color);
  border-color: var(--border-strong);
}

/* Theme Icon Visibility */
.icon-sun { display: none; }
.icon-moon { display: block; }
:root.dark .icon-sun,
.theme-dark .icon-sun { display: block; }
:root.dark .icon-moon,
.theme-dark .icon-moon { display: none; }

/* Inputs & Labels */
.input-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.input-field {
  display: block;
  width: 100%;
  padding: 9px 13px;
  min-height: 40px;
  border: 1px solid var(--divider-color);
  border-radius: 11px;
  background: var(--input-bg);
  color: var(--text-color);
  font-family: var(--font-sans);
  font-size: 0.865rem;
  transition: border-color 0.16s ease;
}

:root.dark .input-field,
.theme-dark .input-field {
  border-color: #24242B;
}

.input-field::placeholder {
  color: var(--text-muted);
}

.input-field:focus {
  outline: none;
  border-color: var(--text-muted);
}

textarea.input-field {
  min-height: 82px;
  resize: vertical;
}

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-3);
}

.kpi-inner {
  padding: 16px 18px;
  gap: 4px;
}

.kpi-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.kpi-value {
  font-family: var(--font-mono);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-color);
}

.kpi-sub {
  font-size: 0.76rem;
  color: var(--text-muted);
}

/* Filter Workbench Controls */
.filter-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--space-3);
}

.pack-chip-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--divider-color);
}

.chip-group {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  min-height: 34px;
  border-radius: 9999px;
  border: 1px solid var(--divider-color);
  background: var(--input-bg);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

:root.dark .filter-chip,
.theme-dark .filter-chip {
  border-color: #26262E;
}

.filter-chip:hover {
  color: var(--text-color);
  border-color: var(--border-strong);
}

.filter-chip.chip-active {
  background: var(--accent);
  color: var(--bg-color);
  border-color: var(--accent);
}

/* Badges & Chips */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  font-size: 0.68rem;
  font-weight: 600;
  border-radius: 9999px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.badge-success {
  background: rgba(16, 185, 129, 0.13);
  color: var(--success);
}
.badge-success .badge-dot { background: var(--success); }

.badge-warning {
  background: rgba(245, 158, 11, 0.13);
  color: var(--warning);
}
.badge-warning .badge-dot { background: var(--warning); }

.badge-danger {
  background: rgba(239, 68, 68, 0.13);
  color: var(--danger);
}

.badge-neutral {
  background: var(--input-bg);
  color: var(--text-secondary);
  border: 1px solid var(--divider-color);
}

.pack-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* Data Tables */
.data-table-container {
  border-radius: 13px;
  border: 1px solid var(--divider-color);
  overflow-x: auto;
  max-width: 100%;
  background: var(--input-bg);
}

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

.data-table th {
  padding: 10px 14px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  text-align: left;
  background: transparent;
  border-bottom: 1px solid var(--divider-color);
  white-space: nowrap;
}

.data-table th.num,
.data-table td.num {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.data-table td {
  padding: 11px 14px;
  font-size: 0.845rem;
  color: var(--text-color);
  border-bottom: 1px solid var(--divider-color);
  vertical-align: middle;
  background: var(--card-bg);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover td {
  background: var(--input-bg);
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-3);
  border-bottom: 1px solid var(--divider-color);
}

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--divider-color);
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Mobile Radar Cards */
.radar-mobile-list {
  display: none;
  flex-direction: column;
  gap: var(--space-3);
}

.mobile-veh-card {
  padding: var(--space-4);
  border-radius: 14px;
  border: 1px solid var(--divider-color);
  background: var(--input-bg);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.mobile-veh-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.mobile-veh-prices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--divider-color);
}

/* Grid Layouts */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
  align-items: start;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
  align-items: stretch;
}

.form-row-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.field-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* Breakdown List */
.breakdown-list {
  display: flex;
  flex-direction: column;
  margin: var(--space-2) 0;
}

.breakdown-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 9px 0;
  border-bottom: 1px solid var(--divider-color);
  font-size: 0.865rem;
}

.breakdown-total {
  border-bottom: none;
  padding-top: var(--space-3);
  font-size: 1.05rem;
  font-weight: 700;
}

.notice-box {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--divider-color);
  background: var(--input-bg);
  font-size: 0.835rem;
  color: var(--text-secondary);
}

.notice-success {
  border-left: 3px solid var(--success);
}

.notice-warning {
  border-left: 3px solid var(--warning);
}

.notice-danger {
  border-left: 3px solid var(--danger);
}

/* Pricing Tier Typography */
.plan-price {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: var(--space-2) 0;
}

.plan-price span {
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-muted);
}

.feature-list {
  list-style: none;
  padding: 0;
  margin: var(--space-3) 0 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.feature-list li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
}

/* Skeleton Shimmer */
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--card-outer-bg) 25%,
    var(--divider-color) 50%,
    var(--card-outer-bg) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 8px;
}

/* Modal / Dialog System */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-panel {
  width: 100%;
  max-width: 540px;
  max-height: 88dvh;
  overflow-y: auto;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  max-width: 360px;
  min-width: 260px;
  padding: var(--space-3) var(--space-4);
  border-radius: 12px;
  background: var(--card-bg);
  border: 1px solid var(--divider-color);
  border-left: 3px solid var(--success);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
  font-size: 0.84rem;
  color: var(--text-color);
}

.toast.toast-danger {
  border-left-color: var(--danger);
}

/* Responsive Breakpoints */
@media (max-width: 1120px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .filter-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .grid-3,
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .radar-desktop-table {
    display: none;
  }
  .radar-mobile-list {
    display: flex;
  }
}

@media (max-width: 767px) {
  .app-shell {
    flex-direction: column;
  }

  .mobile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2) var(--space-4);
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--divider-color);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
  }

  .mobile-topbar .icon-btn {
    width: 48px;
    height: 48px;
  }

  .sidebar-backdrop.is-open {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    z-index: calc(var(--z-sidebar) - 1);
  }

  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(280px, 84vw);
    height: 100dvh;
    transform: translateX(-104%);
    transition: transform 0.22s ease-out;
    background: var(--sidebar-bg);
  }

  .app-sidebar.is-open {
    transform: translateX(0);
  }

  .nav-item,
  .btn-primary,
  .btn-secondary,
  .filter-chip {
    min-height: 48px;
  }

  .app-main {
    padding: var(--space-4) var(--space-3);
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-grid,
  .form-row-2 {
    grid-template-columns: 1fr;
  }

  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .modal-panel {
    max-width: 100%;
    max-height: 90dvh;
    border-radius: 22px 22px 0 0;
  }

  .toast-container {
    left: var(--space-4);
    right: var(--space-4);
    top: var(--space-4);
  }
}
