:root {
  --bg: #07101e;
  --bg-soft: #091426;
  --sidebar: #091426;
  --topbar: rgba(7, 16, 30, 0.92);
  --panel: #0d1a2d;
  --panel-2: #11223a;
  --panel-3: #142943;
  --input: #0a1729;
  --line: #203653;
  --line-soft: rgba(129, 163, 207, 0.14);
  --line-strong: #345174;
  --text: #f5f8ff;
  --text-strong: #ffffff;
  --muted: #89a1be;
  --muted-2: #5f7897;
  --accent: #9b5cff;
  --accent-2: #7447ef;
  --accent-soft: rgba(155, 92, 255, 0.14);
  --success: #23dda3;
  --success-soft: rgba(35, 221, 163, 0.1);
  --danger: #ff5f7d;
  --danger-soft: rgba(255, 95, 125, 0.1);
  --warning: #f6bd5b;
  --warning-soft: rgba(246, 189, 91, 0.1);
  --info: #5ec8ff;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.28);
  --sidebar-width: 216px;
  font-family: Inter, "Segoe UI Variable", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f3f6fb;
  --bg-soft: #edf2f8;
  --sidebar: #ffffff;
  --topbar: rgba(255, 255, 255, 0.92);
  --panel: #ffffff;
  --panel-2: #f6f9fd;
  --panel-3: #edf3fa;
  --input: #ffffff;
  --line: #d8e2ee;
  --line-soft: rgba(45, 73, 108, 0.1);
  --line-strong: #bdcad9;
  --text: #13253d;
  --text-strong: #07172e;
  --muted: #647a95;
  --muted-2: #8b9db2;
  --accent: #8f49f5;
  --accent-2: #7138d2;
  --accent-soft: rgba(143, 73, 245, 0.09);
  --success: #04b982;
  --success-soft: rgba(4, 185, 130, 0.08);
  --danger: #ef4768;
  --danger-soft: rgba(239, 71, 104, 0.08);
  --warning: #d99016;
  --warning-soft: rgba(217, 144, 22, 0.09);
  --info: #238ec8;
  --shadow: 0 18px 50px rgba(35, 61, 96, 0.12);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
html { background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button { color: inherit; }
button, input, select { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 75%, white);
  outline-offset: 2px;
}
.hidden { display: none !important; }
svg { display: block; }

/* Login */
.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(420px, 0.92fr);
  background: var(--bg);
}
.login-art {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 48px 58px;
  background:
    radial-gradient(circle at 74% 30%, rgba(129, 82, 255, 0.24), transparent 32%),
    radial-gradient(circle at 25% 88%, rgba(39, 196, 255, 0.1), transparent 30%),
    linear-gradient(145deg, #07101e 0%, #0d1c34 100%);
  border-right: 1px solid var(--line);
}
.login-art::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.23;
  background-image:
    linear-gradient(rgba(145, 174, 215, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(145, 174, 215, 0.12) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to right, #000, transparent 88%);
}
.login-brand, .login-message { position: relative; z-index: 2; }
.login-brand { display: flex; align-items: center; gap: 13px; letter-spacing: 0.18em; font-size: 10px; color: #9ab0cd; }
.brand-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 11px;
  background: linear-gradient(145deg, #65d8ff, #8a55ff 65%, #af52ff);
  color: #fff;
  display: inline-grid;
  place-items: center;
  font-weight: 900;
  font-size: 12px;
  letter-spacing: -0.06em;
  box-shadow: 0 10px 30px rgba(119, 73, 239, 0.28);
}
.login-message { margin: auto 0 6vh; max-width: 650px; }
.eyebrow { font-size: 9px; letter-spacing: 0.18em; font-weight: 800; color: var(--accent); }
.login-art .eyebrow { color: #71d7ff; }
.login-message h1 { margin: 18px 0; color: #fff; font-size: clamp(48px, 5.7vw, 82px); line-height: 0.96; letter-spacing: -0.06em; }
.login-message p { max-width: 540px; color: #91a7c4; line-height: 1.75; font-size: 15px; }
.orbit { position: absolute; border: 1px solid rgba(133, 92, 255, 0.22); border-radius: 50%; }
.orbit-a { width: 540px; height: 540px; right: -160px; top: -90px; }
.orbit-b { width: 350px; height: 350px; right: -35px; top: 12px; border-style: dashed; }
.login-panel { display: grid; place-items: center; padding: 42px; background: var(--bg); }
.login-card { width: min(100%, 410px); }
.login-card h2 { margin: 10px 0 7px; color: var(--text-strong); font-size: 30px; line-height: 1.15; letter-spacing: -0.035em; }
.login-card > p { color: var(--muted); line-height: 1.65; margin: 0 0 26px; }
.login-card label, .form-grid label { display: grid; gap: 8px; margin: 15px 0; color: var(--text); font-size: 11px; font-weight: 700; }
.mobile-brand { display: none; }

/* Inputs and controls */
input, select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input);
  color: var(--text-strong);
  padding: 0 12px;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}
input::placeholder { color: var(--muted-2); }
input:hover, select:hover { border-color: var(--line-strong); }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="checkbox"] { width: 15px; height: 15px; min-height: 0; padding: 0; accent-color: var(--accent); }
.form-error { min-height: 18px; color: var(--danger) !important; font-size: 11px; }

/* Shell */
.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  height: 100vh;
  padding: 14px 10px 12px;
  display: flex;
  flex-direction: column;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  z-index: 30;
}
.brand { display: flex; gap: 10px; align-items: center; min-height: 42px; padding: 0 4px 12px; }
.brand .brand-mark { width: 34px; height: 34px; border-radius: 9px; font-size: 10px; }
.brand div { display: grid; gap: 1px; min-width: 0; }
.brand b { color: var(--text-strong); font-size: 12px; letter-spacing: -0.01em; white-space: nowrap; }
.brand small, .connection-pill small, .user-chip small { color: var(--muted); font-size: 9px; }
.session-card { min-height: 56px; margin: 0 0 12px; padding: 9px 10px; display: grid; grid-template-columns: 8px 1fr; gap: 8px; align-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.session-card > div { min-width: 0; display: grid; line-height: 1.15; }
.session-card div > span { color: var(--muted-2); font-size: 7px; font-weight: 800; letter-spacing: 0.12em; }
.session-card b { color: var(--text-strong); font-size: 10px; margin-top: 2px; }
.session-card small { color: var(--muted); font-size: 8px; }
.nav-section-label { padding: 3px 10px 7px; color: var(--muted-2); font-size: 7px; font-weight: 800; letter-spacing: 0.14em; }
.sidebar nav { display: grid; gap: 3px; }
.nav-item {
  position: relative;
  width: 100%;
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 0 10px;
  display: grid;
  grid-template-columns: 20px 1fr auto;
  gap: 9px;
  align-items: center;
  text-align: left;
  cursor: pointer;
  font-size: 11px;
  font-weight: 650;
  transition: color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}
.nav-item:hover { color: var(--text-strong); background: var(--panel-2); }
.nav-item.active { color: #fff; background: linear-gradient(100deg, var(--accent-2), var(--accent)); box-shadow: 0 9px 24px rgba(111, 61, 221, 0.22); }
.nav-icon { display: grid; place-items: center; }
.nav-icon svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav-icon svg rect { fill: none; }
.nav-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: grid; place-items: center; background: var(--danger); color: #fff; font-size: 8px; }
.sidebar-footer { margin-top: auto; display: grid; gap: 9px; }
.connection-pill {
  padding: 10px;
  border-radius: 9px;
  background: var(--panel);
  border: 1px solid var(--line);
  display: grid;
  grid-template-columns: 8px 1fr;
  gap: 8px;
  align-items: center;
}
.connection-pill div { display: grid; gap: 1px; min-width: 0; }
.connection-pill b { color: var(--text-strong); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 10px currentColor; }
.status-dot.online { background: var(--success); }
.logout-button { min-height: 36px; padding: 0 10px; background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-size: 10px; font-weight: 700; }
.logout-button:hover { color: var(--text-strong); background: var(--panel); }
.sidebar-note { color: var(--muted-2); font-size: 8px; text-align: center; letter-spacing: 0.02em; }

.main { grid-column: 2; min-width: 0; }
.topbar {
  height: 52px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: var(--topbar);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 7px; }
.user-chip { display: flex; align-items: center; gap: 8px; padding-left: 10px; margin-left: 2px; border-left: 1px solid var(--line); }
.user-chip > span { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(145deg, var(--accent-2), var(--accent)); color: #fff; font-size: 11px; font-weight: 800; }
.user-chip div { display: grid; line-height: 1.2; }
.user-chip b { color: var(--text-strong); font-size: 10px; }
.menu-button { display: none !important; }
.clock-chip { min-width: 58px; height: 26px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); color: var(--muted); font-size: 8px; font-variant-numeric: tabular-nums; }
.topbar .connection-pill { min-width: 150px; min-height: 27px; padding: 4px 8px; grid-template-columns: 7px 1fr; border-radius: 9px; }
.topbar .connection-pill b { font-size: 8px; }
.topbar .connection-pill small { font-size: 7px; }
.topbar .status-dot { width: 6px; height: 6px; }
.topbar .logout-button { min-height: 28px; padding: 0 10px; font-size: 8px; }
.page-heading { min-height: 78px; padding: 18px 24px 15px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.page-heading h1 { margin: 0; color: var(--text-strong); font-size: 18px; line-height: 1.2; letter-spacing: -0.035em; }
.page-heading p { margin: 3px 0 0; color: var(--muted); font-size: 9px; }
.view-container { width: 100%; padding: 0 24px 24px; max-width: 1800px; margin: 0 auto; }

/* Buttons */
.button {
  border: 1px solid transparent;
  border-radius: 8px;
  min-height: 36px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 750;
  white-space: nowrap;
  transition: transform 0.14s ease, opacity 0.14s ease, border-color 0.14s ease, background 0.14s ease;
}
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.button.primary { background: linear-gradient(100deg, var(--accent-2), var(--accent)); color: #fff; box-shadow: 0 7px 20px rgba(115, 63, 225, 0.18); }
.button.secondary { background: var(--panel-2); color: var(--text); border-color: var(--line); }
.button.secondary:hover { border-color: var(--line-strong); background: var(--panel-3); }
.button.danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 32%, transparent); }
.button.wide { width: 100%; justify-content: space-between; padding: 0 15px; min-height: 44px; }
.button.small { min-height: 30px; padding: 0 9px; font-size: 9px; }
.button-icon svg, .theme-button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-button { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); cursor: pointer; }
.icon-button:hover { border-color: var(--line-strong); background: var(--panel-3); }
.theme-button .theme-sun { display: none; }
:root[data-theme="light"] .theme-button .theme-sun { display: block; }
:root[data-theme="light"] .theme-button .theme-moon { display: none; }
.loading .button-icon { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Dashboard */
.summary-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.summary-item { min-height: 64px; padding: 10px 12px; display: grid; grid-template-columns: 7px 1fr; gap: 9px; align-items: center; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); }
.summary-item > div { min-width: 0; display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; align-items: center; column-gap: 8px; }
.summary-item div > span { color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: 0.07em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.summary-item strong { grid-column: 2; grid-row: 1 / 3; color: var(--text-strong); font-size: 22px; line-height: 1; font-weight: 800; font-variant-numeric: tabular-nums; }
.summary-item small { color: var(--muted-2); font-size: 8px; }
.summary-dot { width: 6px; height: 28px; border-radius: 4px; background: var(--accent); }
.summary-item.blue .summary-dot { background: var(--info); }
.summary-item.amber .summary-dot { background: var(--warning); }
.summary-item.red .summary-dot { background: var(--danger); }
.overview-table { margin-top: 10px; }
.risk-table { min-width: 760px; }
.risk-table th:nth-child(1), .risk-table td:nth-child(1) { width: 145px; }
.risk-table th:nth-child(2), .risk-table td:nth-child(2) { width: 260px; }
.risk-table th:last-child, .risk-table td:last-child { width: 90px; }
.risk-table td:nth-child(3) { color: var(--muted); }
.risk-table td b { color: var(--text-strong); }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat-card {
  min-height: 118px;
  padding: 16px;
  border-radius: 11px;
  background: var(--panel);
  border: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}
.stat-card::after { content: ""; position: absolute; width: 74px; height: 74px; border-radius: 50%; right: -39px; top: -39px; border: 1px solid var(--line-strong); opacity: 0.5; }
.stat-card.highlight { background: var(--panel); border-color: var(--line); box-shadow: inset 3px 0 0 var(--accent); }
.stat-card.highlight .stat-label { color: var(--accent); }
.stat-card.highlight .stat-foot { color: var(--muted); }
.stat-label { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: 0.1em; }
.stat-value { color: var(--text-strong); font-size: 34px; line-height: 1; font-weight: 800; letter-spacing: -0.045em; margin: 15px 0 9px; font-variant-numeric: tabular-nums; }
.stat-card.highlight .stat-value { color: var(--text-strong); }
.stat-foot { color: var(--muted); font-size: 9px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.45fr); gap: 12px; margin-top: 12px; }
.panel { border: 1px solid var(--line); border-radius: 11px; background: var(--panel); overflow: hidden; }
.panel-header { min-height: 58px; padding: 13px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.panel-header h2 { margin: 0; color: var(--text-strong); font-size: 13px; letter-spacing: -0.01em; }
.panel-header p { margin: 3px 0 0; color: var(--muted); font-size: 9px; }
.panel-body { padding: 15px; }
.alert-list { display: grid; gap: 8px; }
.alert-item { padding: 11px; border-radius: 8px; border: 1px solid var(--line); display: grid; grid-template-columns: 5px 1fr auto; gap: 10px; align-items: start; background: var(--panel-2); }
.alert-line { width: 3px; min-height: 36px; border-radius: 3px; background: var(--info); }
.alert-item.warning .alert-line { background: var(--warning); }
.alert-item.critical .alert-line { background: var(--danger); }
.alert-item h3 { color: var(--text-strong); font-size: 10px; margin: 0 0 4px; }
.alert-item p { margin: 0; color: var(--muted); line-height: 1.5; font-size: 9px; }
.alert-item time { color: var(--muted-2); font-size: 8px; white-space: nowrap; }
.quick-actions { display: grid; gap: 8px; }
.quick-action { width: 100%; min-height: 58px; display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); border-radius: 8px; padding: 11px 12px; cursor: pointer; text-align: left; }
.quick-action:hover { border-color: var(--line-strong); background: var(--panel-3); }
.quick-action b { color: var(--text-strong); font-size: 10px; }
.quick-action small { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; }
.quick-action > span { color: var(--accent); }

/* Filters and tables */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.toolbar-group { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.search-input { min-width: 280px; }
.toolbar select { width: auto; min-width: 145px; }
.selection-bar { margin-bottom: 10px; padding: 9px 11px; border-radius: 8px; border: 1px solid color-mix(in srgb, var(--accent) 34%, transparent); background: var(--accent-soft); display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 10px; }
.selection-bar b { color: var(--accent); }
.table-wrap { overflow: auto; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
table { width: 100%; border-collapse: collapse; min-width: 900px; font-variant-numeric: tabular-nums; }
thead { background: var(--panel-2); }
th { height: 40px; text-align: left; color: var(--muted-2); font-size: 8px; font-weight: 800; letter-spacing: 0.1em; padding: 0 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { height: 57px; padding: 9px 12px; border-bottom: 1px solid var(--line); color: var(--text); font-size: 10px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--panel-2); }
.domain-cell { display: grid; gap: 3px; }
.domain-cell b { color: var(--text-strong); font-size: 11px; }
.domain-cell small, .ns-stack small { color: var(--muted); font-size: 9px; }
.ns-stack { display: grid; gap: 2px; max-width: 230px; }
.badge { display: inline-flex; align-items: center; gap: 4px; min-height: 21px; padding: 0 7px; border-radius: 11px; border: 1px solid var(--line); color: var(--muted); background: var(--panel-2); font-size: 8px; font-weight: 800; white-space: nowrap; }
.badge.success { color: var(--success); background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 25%, transparent); }
.badge.warning { color: var(--warning); background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 25%, transparent); }
.badge.danger { color: var(--danger); background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.expiry { display: grid; gap: 4px; }
.expiry strong { color: var(--text-strong); font-size: 10px; }
.expiry small.badge { width: max-content; }
.switch { position: relative; width: 34px; height: 19px; border: 0; border-radius: 10px; background: var(--line-strong); cursor: pointer; }
.switch::after { content: ""; position: absolute; width: 13px; height: 13px; left: 3px; top: 3px; border-radius: 50%; background: var(--muted-2); transition: transform 0.18s ease, background 0.18s ease; }
.switch.on { background: color-mix(in srgb, var(--success) 35%, var(--panel)); }
.switch.on::after { transform: translateX(15px); background: var(--success); }
.pagination { display: flex; justify-content: space-between; align-items: center; padding: 11px 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 9px; }

/* States and settings */
.empty-state { min-height: 250px; display: grid; place-items: center; text-align: center; padding: 26px; }
.empty-state > div { max-width: 420px; }
.empty-icon { width: 46px; height: 46px; margin: 0 auto 14px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 18px; border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent); }
.empty-state h3 { margin: 0 0 6px; color: var(--text-strong); font-size: 13px; }
.empty-state p { margin: 0 0 16px; color: var(--muted); line-height: 1.6; font-size: 10px; }
.skeleton { height: 12px; border-radius: 5px; background: linear-gradient(90deg, var(--panel-2), var(--panel-3), var(--panel-2)); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.form-grid .full { grid-column: 1 / -1; }
.input-help { color: var(--muted); font-size: 9px; line-height: 1.5; font-weight: 400; }
.security-card { padding: 15px; display: grid; gap: 14px; }
.security-card h3 { margin: 0; color: var(--text-strong); font-size: 11px; }
.security-card ul { margin: 0; padding-left: 17px; color: var(--muted); font-size: 9px; line-height: 1.8; }
.connection-summary { padding: 12px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line); }
.connection-summary dl { margin: 0; display: grid; gap: 9px; }
.connection-summary div { display: flex; justify-content: space-between; gap: 12px; }
.connection-summary dt { color: var(--muted); font-size: 9px; }
.connection-summary dd { margin: 0; color: var(--text-strong); font-size: 9px; font-weight: 700; text-align: right; }

/* Modals and feedback */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(2, 8, 18, 0.72); backdrop-filter: blur(8px); }
.modal { width: min(100%, 580px); max-height: min(86vh, 800px); overflow: auto; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--panel); box-shadow: var(--shadow); }
.modal-header { padding: 15px 16px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.modal-header h2 { margin: 4px 0 0; color: var(--text-strong); font-size: 16px; }
.modal-body { padding: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 17px; }
.quote-list { display: grid; gap: 6px; margin: 12px 0; }
.quote-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line); font-size: 10px; }
.quote-row span { color: var(--muted); }
.warning-box { padding: 11px; border-radius: 8px; color: var(--warning); background: var(--warning-soft); border: 1px solid color-mix(in srgb, var(--warning) 25%, transparent); font-size: 9px; line-height: 1.6; }
.result-list { display: grid; gap: 7px; }
.result-row { padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 10px; }
.toast-region { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: grid; gap: 8px; }
.toast { width: min(350px, calc(100vw - 32px)); padding: 11px 13px; border-radius: 9px; background: var(--panel-3); border: 1px solid var(--line-strong); box-shadow: var(--shadow); color: var(--text-strong); font-size: 10px; animation: toastIn 0.22s ease; }
.toast.error { border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.toast.success { border-color: color-mix(in srgb, var(--success) 45%, transparent); }
@keyframes toastIn { from { opacity: 0; transform: translateY(7px); } }

@media (max-width: 1150px) {
  .stats-grid, .summary-strip { grid-template-columns: 1fr 1fr; }
  .dashboard-grid, .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .login-panel { min-height: 100vh; padding: 25px; }
  .mobile-brand { display: flex; gap: 9px; align-items: center; margin-bottom: 36px; }
  .mobile-brand .brand-mark { width: 34px; height: 34px; }
  .app-shell { grid-template-columns: 1fr; }
  .main { grid-column: 1; }
  .sidebar { transform: translateX(-102%); transition: transform 0.22s ease; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .menu-button { display: grid !important; }
  .topbar { height: 52px; padding: 0 11px; }
  .topbar .connection-pill, .clock-chip, .user-chip div { display: none; }
  .user-chip { padding-left: 0; border: 0; }
  .page-heading { min-height: 70px; padding: 14px 13px 12px; }
  .page-heading h1 { font-size: 16px; }
  .page-heading p { max-width: 230px; }
  .view-container { padding: 0 13px 32px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
}

@media (max-width: 560px) {
  .stats-grid, .summary-strip { grid-template-columns: 1fr 1fr; gap: 8px; }
  .summary-item { min-height: 72px; grid-template-columns: 5px 1fr; padding: 9px; }
  .summary-item > div { grid-template-columns: 1fr; grid-template-rows: auto; }
  .summary-item strong { grid-column: 1; grid-row: auto; margin: 4px 0 2px; font-size: 20px; }
  .stat-card { min-height: 105px; padding: 13px; }
  .stat-value { font-size: 29px; margin: 13px 0 7px; }
  .dashboard-grid { gap: 10px; margin-top: 10px; }
  .toolbar, .toolbar-group { align-items: stretch; }
  .toolbar-group, .search-input, .toolbar select { width: 100%; min-width: 0; }
  .selection-bar { align-items: flex-start; flex-direction: column; }
  .selection-bar .toolbar-group { display: grid; grid-template-columns: 1fr 1fr; }
  .pagination { flex-wrap: wrap; gap: 9px; }
  .modal-backdrop { padding: 10px; }
  .modal-actions { flex-wrap: wrap; }
  .modal-actions .button { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
