/* ==========================================================================
   Rampage444 IT — Design Tokens (Emerald #10B981 Brand Accent)
   Default: Deep Obsidian Dark Theme + Light Theme Toggle
   Typography: Onest (Humanist Cyrillic) + JetBrains Mono (Key Codes)
   ========================================================================== */

:root,
:root[data-theme="dark"] {
  color-scheme: dark;

  /* Core Surfaces */
  --bg-canvas: #0c100f;
  --bg-canvas-glow: radial-gradient(ellipse 75% 50% at 50% -6%, rgba(16, 185, 129, 0.14), transparent 70%);
  --bg-sidebar: #101514;
  --bg-topbar: rgba(14, 19, 18, 0.86);
  --bg-surface: #141b19;
  --bg-surface-elevated: #1a2321;
  --bg-surface-hover: #202b28;
  --bg-input: #0e1413;
  --bg-dialog: #131a18;
  --bg-composer-lock: rgba(12, 16, 15, 0.52);
  --shadow-composer: 0 12px 34px rgba(0, 0, 0, 0.28);

  /* Access Card & Active Nav */
  --bg-nav-active: rgba(16, 185, 129, 0.14);
  --nav-active-bar: #10b981;
  --bg-access-card: rgba(16, 185, 129, 0.08);
  --border-access-card: rgba(16, 185, 129, 0.32);
  --bg-access-btn: rgba(16, 185, 129, 0.14);
  --bg-access-btn-hover: rgba(16, 185, 129, 0.24);
  --border-access-btn: rgba(16, 185, 129, 0.42);

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.075);
  --border-strong: rgba(255, 255, 255, 0.14);
  --border-gold: rgba(16, 185, 129, 0.34);
  --border-gold-strong: rgba(52, 211, 153, 0.62);

  /* Brand Accent (Emerald / Mint #10B981) */
  --accent: #10b981;
  --accent-bright: #34d399;
  --accent-hover: #0ea572;
  --accent-soft: rgba(16, 185, 129, 0.14);
  --accent-soft-strong: rgba(16, 185, 129, 0.24);
  --accent-text: #ffffff;
  --accent-on: #ffffff;

  /* Glassmorphism Tokens (crisp multi-stop specular glass without GPU text blur) */
  --glass-bg: linear-gradient(180deg, #25312e 0%, #1a2421 55%, #151d1b 100%);
  --glass-bg-hover: linear-gradient(180deg, #1f3c33 0%, #162e27 100%);
  --glass-primary-bg: linear-gradient(180deg, #16b981 0%, #0e9f6e 55%, #047857 100%);
  --glass-specular: inset 0 1px 0 rgba(255, 255, 255, 0.36), inset 0 -1px 0 rgba(0, 0, 0, 0.2);
  --glass-glow: 0 6px 20px rgba(16, 185, 129, 0.26);
  --glass-glow-hover: 0 8px 26px rgba(16, 185, 129, 0.4);

  /* Text */
  --text-primary: #ffffff;
  --text-heading: #ffffff;
  --text-secondary: #e2ece8;
  --text-muted: #b4c4be;

  /* Semantic Status */
  --status-success: #10b981;
  --status-success-bg: rgba(16, 185, 129, 0.16);
  --status-warning: #f59e0b;
  --status-warning-bg: rgba(245, 158, 11, 0.15);
  --status-danger: #f43f5e;
  --status-danger-bg: rgba(244, 63, 94, 0.15);
  --status-info: #38bdf8;
  --status-info-bg: rgba(56, 189, 248, 0.15);

  /* Typography & Radii */
  --font-sans: "Onest", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-pill: 999px;

  --sidebar-width: 244px;
  --header-height: 64px;
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.62);

  /* Browser UI theming */
  accent-color: var(--accent);
  --scrollbar-track: #0d1211;
  --scrollbar-thumb: #273733;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

:root[data-theme="light"] {
  color-scheme: light;

  --bg-canvas: #f4f8f6;
  --bg-canvas-glow: radial-gradient(ellipse 75% 50% at 50% -6%, rgba(16, 185, 129, 0.13), transparent 72%);
  --bg-sidebar: #ffffff;
  --bg-topbar: rgba(255, 255, 255, 0.9);
  --bg-surface: #ffffff;
  --bg-surface-elevated: #eff6f3;
  --bg-surface-hover: #e4f1eb;
  --bg-input: #f9fcfb;
  --bg-dialog: #ffffff;
  --bg-composer-lock: rgba(255, 255, 255, 0.76);
  --shadow-composer: 0 8px 26px rgba(15, 36, 29, 0.07);

  --bg-nav-active: rgba(16, 185, 129, 0.12);
  --nav-active-bar: #059669;
  --bg-access-card: #ecfdf5;
  --border-access-card: #a7f3d0;
  --bg-access-btn: rgba(255, 255, 255, 0.88);
  --bg-access-btn-hover: #d1fae5;
  --border-access-btn: #6ee7b7;

  --border-subtle: #e2ece8;
  --border-strong: #c8dcd5;
  --border-gold: #86efac;
  --border-gold-strong: #10b981;

  --accent: #10b981;
  --accent-bright: #059669;
  --accent-hover: #059669;
  --accent-soft: rgba(16, 185, 129, 0.12);
  --accent-soft-strong: rgba(16, 185, 129, 0.22);
  --accent-text: #047857;
  --accent-on: #ffffff;

  --glass-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(236, 246, 241, 0.85) 100%);
  --glass-bg-hover: linear-gradient(180deg, rgba(209, 250, 229, 0.95) 0%, rgba(167, 243, 208, 0.65) 100%);
  --glass-primary-bg: linear-gradient(180deg, #1cc78e 0%, #10b981 55%, #059669 100%);
  --glass-specular: inset 0 1px 0 rgba(255, 255, 255, 0.45), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
  --glass-glow: 0 8px 22px rgba(16, 185, 129, 0.25);
  --glass-glow-hover: 0 10px 26px rgba(16, 185, 129, 0.36);

  --text-primary: #0e1c18;
  --text-heading: #081310;
  --text-secondary: #2d423b;
  --text-muted: #586e66;

  --shadow-lg: 0 20px 54px rgba(10, 28, 22, 0.13);
  --scrollbar-track: #eaf1ee;
  --scrollbar-thumb: #b5cbc2;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

@supports not (scrollbar-color: auto) {
  html::-webkit-scrollbar,
  .scroll-area::-webkit-scrollbar {
    width: 10px;
    height: 10px;
  }
  html::-webkit-scrollbar-track,
  .scroll-area::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
  }
  html::-webkit-scrollbar-thumb,
  .scroll-area::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 6px;
  }
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}

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

[hidden] {
  display: none !important;
}

::selection {
  background: var(--accent-soft-strong);
  color: var(--text-primary);
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 2px;
}

/* Native modal dialog scroll containment (Modern Web Guidance) */
dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  background: rgba(6, 10, 9, 0.72);
  backdrop-filter: blur(8px);
  overflow: hidden;
  overscroll-behavior: contain;
}

/* Toast notifications */
.toast-container {
  position: fixed;
  inset-block-end: 20px;
  inset-inline-end: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  max-width: 380px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-dialog);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-gold);
  box-shadow: var(--shadow-lg);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
}

.toast.is-success {
  border-color: rgba(16, 185, 129, 0.6);
}

.toast.is-error {
  border-color: rgba(244, 63, 94, 0.58);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 560px) {
  .toast-container {
    inset-inline: 12px;
    inset-block-end: 14px;
  }

  .toast {
    max-width: 100%;
  }
}
