:root,
html[data-theme="dark"] {
  --bg: #000000;
  --bg-elevated: #0c1018;
  --bg-panel: #121821;
  --bg-input: #0a0e14;
  --ink: #f2f6fb;
  --muted: #8b97a8;
  --line: rgba(255, 255, 255, 0.08);
  --cyan: #00aeef;
  --teal: #2ad4a8;
  --lime: #c4df38;
  --brand: linear-gradient(90deg, #00aeef 0%, #2ad4a8 48%, #c4df38 100%);
  --brand-btn: linear-gradient(135deg, #00aeef 0%, #1bc4b0 52%, #b8db3a 100%);
  --danger: #ff5c6c;
  --ok: #5be39a;
  --warn: #f0b429;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  --radius: 14px;
  --font-display: "Sora", "Segoe UI", sans-serif;
  --font-body: "Outfit", "Segoe UI", sans-serif;
  --sidebar-w: 272px;
  --sidebar-bg: linear-gradient(180deg, rgba(12, 16, 24, 0.97), rgba(0, 0, 0, 0.9));
  --toast-bg: rgba(12, 16, 24, 0.96);
  --dialog-scrim: rgba(0, 0, 0, 0.72);
  --login-card-bg: linear-gradient(180deg, rgba(18, 24, 33, 0.94), rgba(10, 14, 20, 0.98));
  --atmosphere:
    radial-gradient(900px 520px at 12% -8%, rgba(0, 174, 239, 0.2), transparent 58%),
    radial-gradient(760px 480px at 92% 8%, rgba(196, 223, 56, 0.12), transparent 55%),
    radial-gradient(700px 500px at 50% 110%, rgba(42, 212, 168, 0.08), transparent 50%),
    linear-gradient(165deg, #000 0%, #05080d 45%, #000 100%);
  --grid-line-a: rgba(0, 174, 239, 0.06);
  --grid-line-b: rgba(196, 223, 56, 0.04);
  --wordmark-filter: drop-shadow(0 0 28px rgba(0, 174, 239, 0.28));
  --brand-on-btn: #041018;
  --ink-soft: #c5ced9;
  --surface-soft: rgba(255, 255, 255, 0.04);
  --surface-mid: rgba(255, 255, 255, 0.03);
  --placeholder: #667486;
  --mono: #a9b6c7;
  --badge-info: #7ad9f5;
  --panel-bg: linear-gradient(180deg, rgba(23, 30, 41, 0.95), rgba(12, 16, 24, 0.98));
  --panel-shadow: none;
  --danger-zone-bg: linear-gradient(180deg, rgba(48, 18, 24, 0.55), rgba(12, 16, 24, 0.98));
  --skeleton: linear-gradient(90deg, rgba(255,255,255,0.04), rgba(255,255,255,0.1), rgba(255,255,255,0.04));
}

html[data-theme="light"] {
  --bg: #f4f8fc;
  --bg-elevated: #ffffff;
  --bg-panel: #ffffff;
  --bg-input: #f0f4f8;
  --ink: #0c1520;
  --muted: #5a6b7d;
  --line: rgba(12, 30, 50, 0.12);
  --cyan: #0090c8;
  --teal: #12a889;
  --lime: #8aaa18;
  --brand: linear-gradient(90deg, #0090c8 0%, #12a889 48%, #8aaa18 100%);
  --brand-btn: linear-gradient(135deg, #00aeef 0%, #1bc4b0 52%, #b8db3a 100%);
  --danger: #d93848;
  --ok: #1a9f5c;
  --warn: #c48912;
  --shadow: 0 18px 40px rgba(20, 40, 70, 0.12);
  --sidebar-bg: linear-gradient(180deg, #ffffff 0%, #f3f7fb 100%);
  --toast-bg: rgba(255, 255, 255, 0.96);
  --dialog-scrim: rgba(15, 30, 50, 0.45);
  --login-card-bg: linear-gradient(180deg, #ffffff, #f7fafc);
  --atmosphere:
    radial-gradient(900px 520px at 12% -8%, rgba(0, 174, 239, 0.16), transparent 58%),
    radial-gradient(760px 480px at 92% 8%, rgba(196, 223, 56, 0.14), transparent 55%),
    radial-gradient(700px 500px at 50% 110%, rgba(42, 212, 168, 0.1), transparent 50%),
    linear-gradient(165deg, #eef5fb 0%, #f7fafc 45%, #eef3f8 100%);
  --grid-line-a: rgba(0, 120, 180, 0.08);
  --grid-line-b: rgba(120, 150, 40, 0.07);
  --wordmark-filter: drop-shadow(0 8px 18px rgba(0, 144, 200, 0.18));
  --brand-on-btn: #041018;
  --ink-soft: #3d4f63;
  --surface-soft: rgba(12, 30, 50, 0.05);
  --surface-mid: rgba(12, 30, 50, 0.04);
  --placeholder: #7a8b9c;
  --mono: #4a5d72;
  --badge-info: #007aa8;
  --panel-bg: linear-gradient(180deg, #ffffff 0%, #f7fafc 100%);
  --panel-shadow: 0 8px 24px rgba(20, 40, 70, 0.07);
  --danger-zone-bg: linear-gradient(180deg, #fff5f6 0%, #ffffff 100%);
  --skeleton: linear-gradient(90deg, rgba(12,30,50,0.04), rgba(12,30,50,0.1), rgba(12,30,50,0.04));
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
}

.skip-link {
  position: fixed;
  top: -4rem;
  left: 1rem;
  z-index: 1000;
  padding: 0.65rem 0.9rem;
  color: var(--brand-on-btn);
  background: var(--brand-btn);
  border-radius: 0 0 0.55rem 0.55rem;
  font-weight: 700;
  transition: top 160ms ease;
}
.skip-link:focus {
  top: 0;
}

/* Class display rules must not override the HTML hidden attribute */
[hidden] {
  display: none !important;
}

body.is-login {
  overflow: hidden;
  height: 100vh;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--atmosphere);
}
.atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.24;
  background-image:
    linear-gradient(var(--grid-line-a) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line-b) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 25%, transparent 78%);
}

.toast-region {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  display: grid;
  gap: 0.55rem;
  width: min(360px, calc(100vw - 2rem));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  padding: 0.75rem 0.95rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--toast-bg);
  box-shadow: var(--shadow);
  font-size: 0.9rem;
  animation: rise 0.25s ease both;
}
.toast.ok { border-color: rgba(91, 227, 154, 0.35); color: var(--ok); }
.toast.danger { border-color: rgba(255, 92, 108, 0.4); color: var(--danger); }
.toast.warn { border-color: rgba(240, 180, 41, 0.4); color: var(--warn); }

.login-shell {
  position: fixed;
  inset: 0;
  z-index: 50;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1.25rem;
  overflow: auto;
  animation: rise 0.7s ease both;
}
.login-stage {
  width: min(460px, 100%);
  display: grid;
  gap: 1.2rem;
  justify-items: center;
}
.login-product {
  width: min(380px, 90%);
  height: auto;
  filter: var(--wordmark-filter);
  animation: floaty 5.5s ease-in-out infinite;
}
.login-card {
  width: 100%;
  padding: 1.85rem 1.7rem 1.6rem;
  border-radius: 20px;
  background: var(--login-card-bg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.login-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: var(--brand);
}
.login-bot {
  width: min(240px, 78%);
  height: auto;
  display: block;
  margin: 0.15rem auto 0.85rem;
}
.lede {
  margin: 0 0 1.25rem;
  color: var(--muted);
  line-height: 1.5;
  text-align: center;
  font-size: 0.95rem;
}
#login-form,
#set-password-form,
#totp-form {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
#login-form[hidden],
#set-password-form[hidden],
#totp-form[hidden] {
  display: none !important;
}
.login-modes[hidden] {
  display: none !important;
}
#login-form button[type="submit"],
#set-password-form button[type="submit"],
#totp-form button[type="submit"] {
  align-self: center;
  min-width: 12.5rem;
  margin-top: 0.35rem;
}
#totp-form {
  gap: 0;
}
#totp-form .login-hint {
  margin: 0 0 1.05rem;
  font-size: 0.9rem;
}
#totp-form .login-field {
  margin-bottom: 0.85rem;
}
#totp-form #totp-back {
  align-self: center;
  margin-top: 0.55rem;
  min-width: auto;
  padding: 0.5rem 1rem;
}
#totp-code {
  width: 100%;
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  min-height: 3.15rem;
  margin-bottom: 0;
  color: var(--ink);
  caret-color: var(--cyan);
  -webkit-text-fill-color: var(--ink);
}
#totp-code::placeholder {
  letter-spacing: 0.18em;
  color: var(--placeholder);
  opacity: 0.7;
}
#totp-code:focus {
  border-color: rgba(0, 174, 239, 0.75);
  box-shadow: 0 0 0 3px rgba(0, 174, 239, 0.18);
}
.login-card.is-2fa .lede {
  margin-bottom: 1.05rem;
}
#totp-form .form-error {
  text-align: center;
  margin-top: 0.65rem;
}
.login-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.35rem;
  text-align: left;
}
.login-field span {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
}
#login-form input[type="password"],
#login-form input[type="text"].is-password-visible,
#set-password-form input[type="password"],
#set-password-form input[type="text"].is-password-visible {
  color: var(--ink);
  caret-color: var(--cyan);
  -webkit-text-fill-color: var(--ink);
  letter-spacing: 0.08em;
  font-size: 1.05rem;
  min-height: 2.75rem;
  margin-bottom: 0;
  padding-right: 2.85rem;
}
#login-form input[name="username"],
#set-password-form input[name="username"] {
  color: var(--ink);
  caret-color: var(--cyan);
  font-size: 1.05rem;
  min-height: 2.75rem;
  margin-bottom: 0;
  letter-spacing: 0;
}
.password-wrap {
  position: relative;
  display: block;
  width: 100%;
}
.password-wrap input {
  width: 100%;
}
button.password-toggle {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  filter: none;
  display: grid;
  place-items: center;
}
button.password-toggle:hover {
  transform: translateY(-50%);
  filter: none;
  color: var(--ink);
  background: rgba(0, 174, 239, 0.12);
}
button.password-toggle svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
button.password-toggle.is-on {
  color: var(--cyan);
}
.login-modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  margin: 0 0 1rem;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-input);
}
button.login-mode {
  margin: 0;
  padding: 0.55rem 0.65rem;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.86rem;
  box-shadow: none;
  filter: none;
  transform: none;
}
button.login-mode:hover {
  transform: none;
  filter: none;
  color: var(--ink);
  background: rgba(0, 174, 239, 0.08);
}
button.login-mode.active {
  background: var(--brand-btn);
  color: #041018;
  font-weight: 700;
}
.login-hint {
  margin: 0 0 0.85rem;
  font-size: 0.86rem;
  text-align: center;
  line-height: 1.45;
}
#set-password-form label {
  margin-bottom: 0.15rem;
}
#set-password-form label span {
  display: block;
  margin-bottom: 0.3rem;
}
#set-password-form .form-error {
  text-align: center;
}

label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--ink-soft);
}
input, select, button, textarea { font: inherit; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 0.75rem 0.9rem;
  background: var(--bg-input);
  color: var(--ink);
  margin-bottom: 0.85rem;
}
input::placeholder, textarea::placeholder { color: var(--placeholder); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: rgba(0, 174, 239, 0.55);
  box-shadow: 0 0 0 3px rgba(0, 174, 239, 0.14);
}

button {
  border: 0;
  border-radius: 11px;
  padding: 0.75rem 1.1rem;
  background: var(--brand-btn);
  color: #041018;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
dialog:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 2px;
}
button:hover { transform: translateY(-1px); filter: brightness(1.06); }
button.ghost, button.logout {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  filter: none;
  font-weight: 600;
}
button.ghost:hover, button.logout:hover {
  border-color: rgba(0, 174, 239, 0.45);
  background: rgba(0, 174, 239, 0.08);
  transform: none;
}
button.compact { padding: 0.45rem 0.75rem; font-size: 0.85rem; }
button.danger {
  background: linear-gradient(135deg, #ff7a86, var(--danger));
  color: #fff;
}
button.nav-btn {
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--muted);
  border-radius: 9px;
  font-weight: 600;
  filter: none;
  border: 1px solid transparent;
  position: relative;
  padding: 0.42rem 0.65rem;
  font-size: 0.9rem;
  line-height: 1.25;
}
button.nav-btn:hover {
  background: var(--surface-soft);
  color: var(--ink);
  transform: none;
  filter: none;
}
button.nav-btn.active {
  background: rgba(0, 174, 239, 0.1);
  color: var(--ink);
  border-color: rgba(0, 174, 239, 0.22);
}
button.nav-btn.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18%;
  bottom: 18%;
  width: 3px;
  border-radius: 999px;
  background: var(--brand);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

.form-error { color: var(--danger); font-size: 0.9rem; text-align: center; }

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  min-height: 100dvh;
  animation: rise 0.45s ease both;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  padding: 0.85rem 0.75rem 0.75rem;
  border-right: 1px solid var(--line);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  overflow: hidden;
  box-sizing: border-box;
}
.sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.12rem;
  padding: 0.1rem 0.3rem 0.55rem;
  border-bottom: 1px solid var(--line);
}
.sidebar-wordmark {
  width: min(142px, 100%);
  height: auto;
}
.sidebar-brand small {
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.25;
}

.nav-groups {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  justify-content: flex-start;
}
.nav-group { display: grid; gap: 0.12rem; }
.nav-label {
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--placeholder);
  padding: 0.05rem 0.65rem 0.18rem;
}

.sidebar-foot {
  margin-top: auto;
  display: grid;
  gap: 0.4rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}
.sidebar-desk { width: 108px; height: auto; opacity: 0.9; }
.sidebar-foot .logout {
  padding: 0.5rem 0.7rem;
  font-size: 0.86rem;
}

@media (max-height: 760px) {
  .sidebar {
    padding: 0.65rem 0.65rem 0.55rem;
    gap: 0.4rem;
  }
  .sidebar-brand {
    padding-bottom: 0.4rem;
  }
  .sidebar-brand small {
    display: none;
  }
  .sidebar-desk {
    display: none;
  }
  .nav-groups {
    gap: 0.3rem;
  }
  .nav-label {
    padding-bottom: 0.08rem;
  }
  button.nav-btn {
    padding: 0.34rem 0.55rem;
    font-size: 0.86rem;
  }
}

@media (max-height: 620px) {
  .nav-label {
    display: none;
  }
  .nav-groups {
    gap: 0.2rem;
  }
  .nav-group {
    gap: 0.08rem;
  }
}

.main { padding: 1.25rem 1.5rem 2.2rem; min-width: 0; }

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1.15rem;
}
.topbar h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.55rem;
  letter-spacing: -0.03em;
  background: var(--brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.topbar p { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.92rem; }
.topbar-right {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: flex-end;
}
.clock { font-size: 0.78rem; }

.operator-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.badge.role-admin {
  background: rgba(88, 101, 242, 0.18);
  color: #8ea1ff;
  border: 1px solid rgba(88, 101, 242, 0.35);
}

.badge.role-ceo {
  background: rgba(155, 89, 182, 0.18);
  color: #c89bff;
  border: 1px solid rgba(155, 89, 182, 0.35);
}

.lang-switch {
  display: inline-flex;
  gap: 0.2rem;
  padding: 0.15rem;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface-mid);
}
.lang-btn {
  padding: 0.3rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  filter: none;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.lang-btn:hover {
  color: var(--ink);
  background: rgba(0, 174, 239, 0.08);
  border-color: rgba(0, 174, 239, 0.25);
  transform: none;
  filter: none;
}
.lang-btn.active {
  color: var(--brand-on-btn);
  background: var(--brand-btn);
  border-color: transparent;
  box-shadow: 0 0 12px rgba(0, 174, 239, 0.25);
}

.theme-switch {
  display: inline-flex;
  gap: 0.2rem;
  padding: 0.15rem;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(127, 140, 160, 0.08);
}
.theme-btn {
  padding: 0.3rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.theme-btn:hover {
  color: var(--ink);
  background: rgba(0, 174, 239, 0.08);
  border-color: rgba(0, 174, 239, 0.25);
  transform: none;
  filter: none;
}
.theme-btn.active {
  color: var(--brand-on-btn);
  background: var(--brand-btn);
  border-color: transparent;
}
.login-card .theme-switch,
.login-card .lang-switch {
  margin-top: 0.85rem;
  justify-content: center;
}
.login-prefs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 0.85rem;
}
.login-prefs .lang-switch,
.login-prefs .theme-switch {
  margin-top: 0;
}

.pills { display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: flex-end; }
.pill {
  border-radius: 9px;
  padding: 0.3rem 0.65rem;
  font-size: 0.74rem;
  font-weight: 600;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  color: var(--muted);
}
.pill.ok { color: var(--ok); border-color: rgba(91, 227, 154, 0.35); background: rgba(91, 227, 154, 0.08); }
.pill.warn { color: var(--warn); border-color: rgba(240, 180, 41, 0.35); background: rgba(240, 180, 41, 0.1); }
.pill.danger { color: var(--danger); border-color: rgba(255, 92, 108, 0.35); background: rgba(255, 92, 108, 0.1); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.grid.two { grid-template-columns: 1.2fr 1fr; }
.grid.split { grid-template-columns: 1fr 1fr; align-items: start; }

.stat, .panel {
  background: var(--panel-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.05rem;
  position: relative;
  color: var(--ink);
  box-shadow: var(--panel-shadow);
}
.stat::after, .panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 174, 239, 0.4), rgba(196, 223, 56, 0.3), transparent);
  opacity: 0.7;
}
html[data-theme="light"] .stat::after,
html[data-theme="light"] .panel::before {
  opacity: 0.55;
}
.stat.clickable { cursor: pointer; transition: border-color 0.15s ease, transform 0.15s ease; }
.stat.clickable:hover {
  border-color: rgba(0, 174, 239, 0.35);
  transform: translateY(-1px);
}
.stat span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 0.3rem;
}
.stat strong {
  font-family: var(--font-display);
  font-size: 1.45rem;
  letter-spacing: -0.03em;
}

.panel h3 {
  margin: 0 0 0.65rem;
  font-family: var(--font-display);
  font-size: 1.02rem;
}
.panel h4 {
  margin: 0.85rem 0 0.4rem;
  font-size: 0.88rem;
  color: var(--ink-soft);
}
.panel p, .muted { color: var(--muted); line-height: 1.5; }
.panel a { color: var(--cyan); }
.panel a:hover { color: var(--lime); }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 0.85rem;
  align-items: center;
}
.toolbar .grow { flex: 1; min-width: 160px; margin-bottom: 0; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.chip {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 600;
  filter: none;
}
.chip:hover { transform: none; filter: none; border-color: rgba(0, 174, 239, 0.4); color: var(--ink); }
.chip.active {
  background: rgba(0, 174, 239, 0.12);
  border-color: rgba(0, 174, 239, 0.4);
  color: var(--ink);
}

.table-wrap {
  overflow: auto;
  max-height: min(62vh, 720px);
  border-radius: 10px;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
th, td {
  text-align: left;
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg-panel);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
tr.clickable { cursor: pointer; }
tr.clickable:hover, tbody tr:hover { background: rgba(0, 174, 239, 0.06); }

.badge {
  display: inline-block;
  padding: 0.12rem 0.45rem;
  border-radius: 7px;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(0, 174, 239, 0.14);
  color: var(--badge-info);
}
.badge.open { background: rgba(91, 227, 154, 0.14); color: var(--ok); }
.badge.closed { background: rgba(139, 151, 168, 0.16); color: var(--muted); }
.badge.danger { background: rgba(255, 92, 108, 0.14); color: var(--danger); }

.list { margin: 0; padding-left: 1.05rem; color: var(--muted); }
.list li { margin: 0.22rem 0; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li {
  position: relative;
  padding: 0.45rem 0 0.45rem 0.95rem;
  border-left: 2px solid rgba(0, 174, 239, 0.25);
  color: var(--muted);
  font-size: 0.86rem;
}
.timeline li::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 0.7rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyan);
}

.danger-zone {
  border-color: rgba(255, 92, 108, 0.35) !important;
  background: var(--danger-zone-bg) !important;
  box-shadow: 0 10px 28px rgba(217, 56, 72, 0.08);
}
.tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}
.tab {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  font-weight: 600;
  filter: none;
}
.tab.active {
  background: rgba(0, 174, 239, 0.12);
  border-color: rgba(0, 174, 239, 0.4);
  color: var(--ink);
}
.tab:hover { transform: none; filter: none; }

.health-grid {
  display: grid;
  gap: 0.45rem;
}
.health-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}
.health-row:last-child { border-bottom: 0; }

.skeleton {
  height: 1rem;
  border-radius: 8px;
  background: var(--skeleton);
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
  margin: 0.55rem 0;
}

dialog {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0;
  width: min(640px, calc(100vw - 2rem));
  box-shadow: var(--shadow);
  background: var(--bg-panel);
  color: var(--ink);
}
dialog::backdrop {
  background: var(--dialog-scrim);
  backdrop-filter: blur(4px);
}
.dialog-head, .dialog-actions, #ticket-dialog-body, .dialog-body-pad { padding: 0.95rem 1.1rem; }
.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
.dialog-head h3 { margin: 0; font-family: var(--font-display); font-size: 1.05rem; }
.dialog-actions {
  display: flex;
  gap: 0.55rem;
  border-top: 1px solid var(--line);
}

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.82rem; color: var(--mono); }
.empty { padding: 1.4rem; color: var(--muted); text-align: center; }

.funding-form label { margin-top: 0.45rem; }
.funding-form textarea,
.funding-form input:not([type="checkbox"]),
.funding-form select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 0.65rem 0.8rem;
  background: var(--bg-input);
  color: var(--ink);
  margin-bottom: 0.3rem;
  font: inherit;
  color-scheme: light dark;
}
.funding-form select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 16px) calc(50% - 3px),
    calc(100% - 11px) calc(50% - 3px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2rem;
  cursor: pointer;
}
.funding-form select:focus {
  outline: none;
  border-color: rgba(0, 174, 239, 0.55);
  box-shadow: 0 0 0 3px rgba(0, 174, 239, 0.15);
}
.funding-form select option {
  background: var(--bg-panel);
  color: var(--ink);
}
.funding-form textarea { resize: vertical; }
.funding-form .check {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 500;
  margin: 0.45rem 0;
  color: var(--ink-soft);
}
.funding-form .check input { width: auto; margin: 0; }

.account-grid {
  display: grid;
  grid-template-columns: minmax(240px, 360px) 1fr;
  gap: 1rem;
  align-items: start;
}
@media (max-width: 900px) {
  .account-grid { grid-template-columns: 1fr; }
}
.security-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.security-status {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  padding: 0.9rem 1rem !important;
}
@media (max-width: 900px) {
  .security-status { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .security-status { grid-template-columns: 1fr; }
}
.security-status-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}
.security-status-label {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 650;
}
.security-status-item strong {
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
}
.security-card h3 { margin-bottom: 0.2rem; }
.security-card > .muted { margin-top: 0; margin-bottom: 0.85rem; }
.security-card-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0.35rem;
}
.security-card-head .muted { margin-bottom: 0; }
.security-alert {
  margin: 0.55rem 0 0.85rem;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 92, 108, 0.4);
  background: rgba(255, 92, 108, 0.1);
  color: var(--ink);
  font-size: 0.88rem;
  line-height: 1.45;
}
.security-alert.soft {
  border-color: rgba(255, 180, 70, 0.4);
  background: rgba(255, 180, 70, 0.1);
}
.text-danger { color: #ff7a8a; }
.twofa-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin-top: 0.35rem;
}
@media (max-width: 800px) {
  .twofa-actions-grid { grid-template-columns: 1fr; }
}
.twofa-action-card {
  padding: 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}
.twofa-action-card h4 {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
}
.twofa-action-card .muted {
  margin: 0 0 0.75rem;
  font-size: 0.84rem;
}
.twofa-action-card.danger-soft {
  border-color: rgba(255, 92, 108, 0.28);
  background: rgba(255, 92, 108, 0.05);
}
.twofa-recovery-card {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(0, 174, 239, 0.35);
  background: rgba(0, 174, 239, 0.08);
}
.sessions-table td:nth-child(4) {
  max-width: 10rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.audit-table td:nth-child(2) {
  font-weight: 600;
}
.account-form {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.account-form label {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.account-form input {
  width: 100%;
  margin: 0;
}
.account-form button[type="submit"] {
  margin-top: 0.25rem;
  align-self: flex-start;
}
.account-form .password-wrap input {
  margin-bottom: 0;
  padding-right: 2.85rem;
}
.twofa-box {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
.twofa-setup {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: start;
  margin: 0.75rem 0;
}
@media (max-width: 700px) {
  .twofa-setup { grid-template-columns: 1fr; }
}
.twofa-qr {
  width: 220px;
  height: 220px;
  border-radius: 12px;
  background: #fff;
  padding: 0.5rem;
  border: 1px solid var(--line);
}
.twofa-secret {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  word-break: break-all;
  color: var(--ink);
  background: var(--bg-input);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
}
.twofa-recovery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.45rem;
  margin: 0.65rem 0 1rem;
}
.twofa-recovery code {
  display: block;
  text-align: center;
  padding: 0.45rem;
  border-radius: 8px;
  background: var(--bg-input);
  border: 1px solid var(--line);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
}

.github-url-row {
  display: flex;
  gap: 0.45rem;
  align-items: center;
}
.github-url-row input { flex: 1; }
.tiny { font-size: 0.78rem; margin: 0.2rem 0 0; }
.github-preview {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin: 0.55rem 0 0.2rem;
  padding: 0.7rem 0.8rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 174, 239, 0.06);
}
.gh-avatar {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--line);
}
.gh-avatar.lg { width: 48px; height: 48px; }
.gh-avatar.placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink-muted, var(--muted, #9aa4b2));
  background: linear-gradient(145deg, var(--surface-soft, #2a3344), var(--bg-input, #1c2433));
  user-select: none;
}
.gh-avatar.placeholder.lg { font-size: 0.95rem; }
.donor-cell {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
}
.donor-cell a { color: var(--cyan); text-decoration: none; }
.donor-cell a:hover { text-decoration: underline; }

.fx-form .fx-row {
  display: grid;
  grid-template-columns: minmax(5rem, 0.9fr) minmax(10rem, 1.35fr) minmax(10rem, 1.35fr) auto;
  gap: 0.65rem;
  align-items: end;
}
.fx-form select {
  min-width: 0;
}
.fx-actions { display: flex; align-items: end; }
.fx-result {
  margin-top: 0.75rem;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(196, 223, 56, 0.06);
}
@media (max-width: 900px) {
  .fx-form .fx-row { grid-template-columns: 1fr 1fr; }
}
button.danger-text {
  color: var(--danger);
  border-color: rgba(255, 92, 108, 0.35);
}
.status-select, select.status-select {
  background: var(--bg-input);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0.35rem 0.5rem;
  margin-bottom: 0;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* —— Tickets ops console —— */
.ticket-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}
.ticket-stat {
  text-align: left;
  background: var(--panel-bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  box-shadow: var(--panel-shadow);
  color: var(--ink);
  filter: none;
  display: grid;
  gap: 0.2rem;
}
.ticket-stat:hover { transform: translateY(-1px); filter: none; border-color: rgba(0, 174, 239, 0.35); }
.ticket-stat.active {
  border-color: rgba(0, 174, 239, 0.45);
  background: rgba(0, 174, 239, 0.08);
}
.ticket-stat-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.ticket-stat strong {
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: -0.03em;
}
.ticket-stat.accent-urgent strong { color: var(--danger); }
.ticket-stat.accent-high strong { color: var(--warn); }

.ticket-panel { padding-top: 0.85rem; }
.ticket-toolbar { align-items: flex-start; }
.ticket-result-bar {
  font-size: 0.78rem;
  margin: 0 0 0.55rem;
}
.ticket-table-wrap { max-height: min(58vh, 680px); }
.ticket-table td { vertical-align: middle; }
.ticket-subject { font-weight: 600; line-height: 1.3; }
.ticket-meta { font-size: 0.76rem; margin-top: 0.15rem; }
.ticket-cat {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 7px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  font-size: 0.74rem;
  text-transform: capitalize;
}
.ticket-row.prio-row-urgent { box-shadow: inset 3px 0 0 var(--danger); }
.ticket-row.prio-row-high { box-shadow: inset 3px 0 0 var(--warn); }

.badge.prio-low { background: rgba(139, 151, 168, 0.16); color: var(--muted); }
.badge.prio-normal { background: rgba(0, 174, 239, 0.14); color: var(--badge-info); }
.badge.prio-high { background: rgba(240, 180, 41, 0.16); color: var(--warn); }
.badge.prio-urgent { background: rgba(255, 92, 108, 0.16); color: var(--danger); }

.chip-prio-urgent.active { border-color: rgba(255, 92, 108, 0.45); color: var(--danger); }
.chip-prio-high.active { border-color: rgba(240, 180, 41, 0.45); color: var(--warn); }

dialog.ticket-dialog-wide {
  width: min(760px, calc(100vw - 2rem));
}
.ticket-detail { display: grid; gap: 1rem; }
.ticket-detail-top {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  justify-content: space-between;
  align-items: flex-end;
}
.ticket-detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}
.ticket-priority-editor {
  display: grid;
  gap: 0.3rem;
  min-width: min(220px, 100%);
}
.ticket-priority-editor label {
  margin: 0;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.priority-select {
  margin: 0;
  width: 100%;
  background: var(--bg-input);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  font-weight: 600;
}
.ticket-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.65rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}
.ticket-meta-grid.compact { padding: 0.55rem 0.75rem; }
.ticket-meta-key {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.2rem;
}
.ticket-meta-val { font-size: 0.92rem; word-break: break-word; }
.ticket-section h4 { margin: 0 0 0.45rem; }
.ticket-description {
  white-space: normal;
  line-height: 1.55;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-input);
}
.ticket-description strong { font-weight: 700; color: var(--ink); }
.ticket-description em { font-style: italic; }
.ticket-description u { text-decoration: underline; }
.ticket-description s { text-decoration: line-through; opacity: 0.85; }
.ticket-description code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.86em;
  padding: 0.1em 0.35em;
  border-radius: 6px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    height: auto;
    overflow: visible;
  }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .nav-groups {
    flex-direction: row;
    flex-wrap: wrap;
    overflow: visible;
  }
  .nav-group { min-width: 140px; flex: 1; }
  button.nav-btn.active::before { display: none; }
  .grid.two, .grid.split { grid-template-columns: 1fr; }
  .sidebar-foot { grid-template-columns: 1fr auto; align-items: center; }
  .sidebar-brand small,
  .sidebar-desk { display: revert; }
  .ticket-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
