/* ============================================================
   Kostantinopel API Client — standalone web client styles
   No build step. Theme-aware (light/dark).
   ============================================================ */

:root {
  --font: "Public Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;

  --bg: #f2f4fb;
  --bg-grid: rgba(79, 70, 229, 0.045);
  --surface: #ffffff;
  --surface-2: #f7f8fd;
  --surface-3: #eef1f9;
  --surface-glass: rgba(255, 255, 255, 0.82);
  --border: #e3e6f0;
  --border-strong: #cfd5e6;
  --text: #161a2c;
  --text-soft: #454c63;
  --muted: #7a8199;
  --brand: #4f46e5;
  --brand-strong: #4338ca;
  --brand-soft: #ecebfe;
  --accent: #0ea5e9;
  --violet: #7c3aed;
  --green: #15803d;
  --green-soft: #e6f7ed;
  --amber: #b45309;
  --amber-soft: #fdf2e2;
  --red: #dc2626;
  --red-soft: #fdecec;
  --blue: #2563eb;
  --blue-soft: #e9efff;
  --cyan: #0e7490;
  --cyan-soft: #e3f6fb;
  --slate: #5b657e;
  --slate-soft: #eef1f7;

  --sidebar-w: 270px;
  --topbar-h: 78px;
  --radius-lg: 20px;
  --radius: 15px;
  --radius-sm: 10px;
  --radius-xs: 8px;

  --shadow-xs: 0 1px 2px rgba(22, 26, 44, 0.05);
  --shadow-sm: 0 1px 2px rgba(22, 26, 44, 0.04), 0 8px 24px rgba(22, 26, 44, 0.05);
  --shadow-md: 0 14px 40px rgba(22, 26, 44, 0.1);
  --shadow-lg: 0 28px 80px rgba(10, 13, 30, 0.28);
  --ring: 0 0 0 3px rgba(79, 70, 229, 0.18);
}

[data-theme="dark"] {
  --bg: #0c0f1d;
  --bg-grid: rgba(124, 58, 237, 0.08);
  --surface: #151a2c;
  --surface-2: #1a2036;
  --surface-3: #202741;
  --surface-glass: rgba(21, 26, 44, 0.82);
  --border: #252c46;
  --border-strong: #333d5f;
  --text: #eef1fb;
  --text-soft: #b9c0d8;
  --muted: #8c94b0;
  --brand: #8b84ff;
  --brand-strong: #a5a0ff;
  --brand-soft: #262a52;
  --green: #4ade80;
  --green-soft: #14342a;
  --amber: #fbbf24;
  --amber-soft: #3a2c14;
  --red: #f87171;
  --red-soft: #3d1b20;
  --blue: #7ab0ff;
  --blue-soft: #172747;
  --cyan: #67e8f9;
  --cyan-soft: #12333d;
  --slate: #a8b0c8;
  --slate-soft: #232a42;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35), 0 10px 28px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 18px 50px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 30px 90px rgba(0, 0, 0, 0.65);
  --ring: 0 0 0 3px rgba(139, 132, 255, 0.25);
}

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

html,
body {
  min-height: 100%;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 8% -10%, rgba(79, 70, 229, 0.12), transparent 38rem),
    radial-gradient(circle at 100% 0%, rgba(14, 165, 233, 0.09), transparent 34rem),
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: auto, auto, 32px 32px, 32px 32px;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

button {
  cursor: pointer;
}

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

a:hover {
  text-decoration: underline;
}

h1, h2, h3, h4, h5, p {
  margin: 0;
}

ul, ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

::selection {
  background: rgba(79, 70, 229, 0.22);
}

:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.icon {
  display: inline-block;
  flex: none;
  vertical-align: -0.16em;
}

.mono {
  font-family: var(--mono);
  font-size: 0.92em;
  letter-spacing: -0.01em;
}

.muted {
  color: var(--muted);
}

.soft {
  color: var(--text-soft);
}

.nowrap {
  white-space: nowrap;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.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;
}

.hidden {
  display: none !important;
}

.spin {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fade-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pop-in {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes slide-left {
  from { transform: translateX(24px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes shimmer {
  0% { background-position: -480px 0; }
  100% { background-position: 480px 0; }
}

/* ---------- Boot splash ---------- */

.boot {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  background: var(--bg);
  transition: opacity 0.35s ease, visibility 0.35s;
}

.boot.is-gone {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.boot__mark {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 20px;
  color: #fff;
  background: linear-gradient(145deg, #4f46e5, #7c3aed 60%, #0ea5e9);
  box-shadow: 0 18px 40px rgba(79, 70, 229, 0.35);
}

.boot__text {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-soft);
}

.boot__bar {
  position: relative;
  width: 132px;
  height: 4px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--surface-3);
}

.boot__bar span {
  position: absolute;
  inset: 0;
  width: 45%;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, var(--brand), transparent);
  animation: boot-slide 1.1s ease-in-out infinite;
}

@keyframes boot-slide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}

/* ---------- Auth / login ---------- */

.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
}

.auth__visual {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
  padding: 46px clamp(28px, 5vw, 72px);
  color: #eef1ff;
  background:
    radial-gradient(900px 520px at 8% 0%, rgba(124, 58, 237, 0.55), transparent 62%),
    radial-gradient(680px 480px at 100% 100%, rgba(14, 165, 233, 0.35), transparent 60%),
    linear-gradient(160deg, #191d3a 0%, #12162b 55%, #0c0f1f 100%);
}

.auth__visual::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.055) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 30% 20%, #000 20%, transparent 78%);
  pointer-events: none;
}

.auth__visual::after {
  content: "";
  position: absolute;
  right: -110px;
  bottom: -140px;
  width: 380px;
  height: 380px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 0 0 42px rgba(255, 255, 255, 0.035), 0 0 0 90px rgba(255, 255, 255, 0.02);
  pointer-events: none;
}

.auth__top,
.auth__center,
.auth__bottom {
  position: relative;
  z-index: 1;
}

.auth__brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.auth__logo {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(145deg, #6366f1, #8b5cf6 55%, #22d3ee);
  box-shadow: 0 12px 28px rgba(99, 102, 241, 0.4);
}

.auth__brand small {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #a8b0d8;
}

.auth__headline {
  max-width: 520px;
  font-size: clamp(30px, 3.5vw, 46px);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.auth__headline em {
  font-style: normal;
  background: linear-gradient(120deg, #a5b4fc, #67e8f9);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.auth__lead {
  max-width: 460px;
  margin-top: 14px;
  color: #b7bedf;
  font-size: 15px;
}

.auth__features {
  display: grid;
  gap: 12px;
  margin-top: 30px;
  max-width: 470px;
}

.auth__feature {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 13px 15px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.045);
  backdrop-filter: blur(6px);
}

.auth__feature .icon {
  margin-top: 2px;
  color: #93c5fd;
}

.auth__feature strong {
  display: block;
  font-size: 13px;
  color: #f4f6ff;
}

.auth__feature span {
  display: block;
  font-size: 12px;
  color: #a9b1d4;
}

.auth__snippet {
  max-width: 470px;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(6, 9, 22, 0.55);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.75;
  color: #b9c4ec;
  overflow: hidden;
}

.auth__snippet b { color: #86efac; font-weight: 600; }
.auth__snippet i { color: #93c5fd; font-style: normal; }
.auth__snippet u { color: #fcd34d; text-decoration: none; }

.auth__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: #98a1c6;
  font-size: 11.5px;
}

.auth__meta span {
  padding: 5px 9px;
  border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.auth__panel {
  display: grid;
  place-items: center;
  padding: 40px 24px;
}

.auth__card {
  width: min(420px, 100%);
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  animation: pop-in 0.4s ease both;
}

.auth__card-head {
  margin-bottom: 22px;
}

.auth__card-head h1 {
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -0.025em;
}

.auth__card-head p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.auth__mobile-brand {
  display: none;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.auth__demo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.demo-btn {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 12px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-soft);
  text-align: left;
  font-size: 11.5px;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.demo-btn strong {
  font-size: 12px;
  color: var(--text);
}

.demo-btn:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.auth__advanced {
  margin-top: 16px;
  border-top: 1px dashed var(--border);
  padding-top: 3px;
}

.auth__advanced summary {
  cursor: pointer;
  padding: 8px 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.auth__advanced summary:hover {
  color: var(--text);
}

.auth__note {
  margin-top: 18px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11.5px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.auth__note .icon {
  margin-top: 1px;
  color: var(--brand);
}

/* ---------- Shell ---------- */

.app-root {
  min-height: 100vh;
}

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 20px 16px 18px;
  color: #dce2f7;
  background:
    radial-gradient(500px 300px at 0% 0%, rgba(124, 58, 237, 0.35), transparent 70%),
    linear-gradient(180deg, #1a1f3d 0%, #131731 48%, #0e1125 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px 22px;
  color: #fff;
}

.sidebar__brand .auth__logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
}

.sidebar__brand strong {
  display: block;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.sidebar__brand small {
  display: block;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: #8f99c4;
}

.nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 0 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.nav__label {
  padding: 16px 12px 7px;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #7b86b3;
}

.nav__item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  margin: 2px 0;
  border-radius: 11px;
  color: #c3cbe8;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}

.nav__item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  text-decoration: none;
}

.nav__item.is-active {
  color: #fff;
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.38), rgba(99, 102, 241, 0.12));
  box-shadow: inset 0 0 0 1px rgba(129, 140, 248, 0.25);
}

.nav__item.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 3px;
  background: linear-gradient(180deg, #a5b4fc, #67e8f9);
}

.nav__item .icon {
  color: #8e99c8;
}

.nav__item.is-active .icon {
  color: #c7d2fe;
}

.nav__badge {
  margin-left: auto;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.12);
  font-family: var(--mono);
  font-size: 10px;
  text-align: center;
  color: #dbe2ff;
}

.sidebar__footer {
  padding: 12px 10px 2px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.api-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: #99a3c8;
}

.api-status__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.14);
  flex: none;
}

.api-status__dot.is-down {
  background: #f87171;
  box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.15);
}

.api-status a {
  display: block;
  margin-top: 5px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: #c7d2fe;
  word-break: break-all;
}

.api-status a:hover {
  color: #fff;
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: var(--topbar-h);
  padding: 14px clamp(18px, 3vw, 34px);
  border-bottom: 1px solid var(--border);
  background: var(--surface-glass);
  backdrop-filter: blur(14px);
}

.topbar__left {
  min-width: 0;
  flex: 1;
}

.topbar__eyebrow {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.topbar__eyebrow .icon {
  color: var(--brand);
}

.topbar__title {
  margin-top: 2px;
  font-size: clamp(18px, 2.1vw, 23px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.topbar__subtitle {
  margin-top: 2px;
  max-width: 720px;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  color: var(--text-soft);
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.15s;
}

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

.icon-btn:active {
  transform: scale(0.96);
}

.icon-btn__dot {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 99px;
  border: 2px solid var(--surface);
  background: var(--brand);
  color: #fff;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  line-height: 13px;
  text-align: center;
}

.sidebar-toggle {
  display: none;
}

.user-menu {
  position: relative;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: var(--surface);
  transition: border-color 0.15s, background 0.15s;
}

.user-chip:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--brand), var(--violet));
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.avatar--sm {
  width: 26px;
  height: 26px;
  font-size: 9.5px;
}

.user-chip__text {
  min-width: 0;
  text-align: left;
  line-height: 1.25;
}

.user-chip__text strong {
  display: block;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11.5px;
  font-weight: 700;
}

.user-chip__text span {
  display: block;
  font-size: 9.5px;
  color: var(--muted);
}

.dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 60;
  width: 236px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  animation: fade-rise 0.16s ease both;
}

.dropdown__head {
  padding: 10px 10px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 5px;
}

.dropdown__head strong {
  display: block;
  font-size: 12.5px;
}

.dropdown__head span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  word-break: break-all;
}

.dropdown__item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--text-soft);
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
}

.dropdown__item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.dropdown__item.is-danger {
  color: var(--red);
}

.dropdown__item.is-danger:hover {
  background: var(--red-soft);
}

.content {
  flex: 1;
  padding: clamp(18px, 2.6vw, 32px);
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
}

.view-enter {
  animation: fade-rise 0.28s ease both;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 18px;
}

.page-head h2 {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.page-head p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12.5px;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s, transform 0.1s;
}

.btn:hover {
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled,
.btn.is-busy {
  opacity: 0.62;
  pointer-events: none;
}

.btn--primary {
  background: linear-gradient(145deg, var(--brand), var(--brand-strong));
  color: #fff;
  box-shadow: 0 8px 18px rgba(79, 70, 229, 0.26);
}

.btn--primary:hover {
  box-shadow: 0 10px 24px rgba(79, 70, 229, 0.34);
  filter: brightness(1.04);
}

.btn--soft {
  background: var(--brand-soft);
  color: var(--brand-strong);
  border-color: transparent;
}

.btn--soft:hover {
  background: var(--brand-soft);
  filter: brightness(0.97);
}

.btn--ghost {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text-soft);
}

.btn--ghost:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--text);
}

.btn--danger {
  background: var(--red);
  color: #fff;
}

.btn--danger:hover {
  filter: brightness(1.06);
}

.btn--danger-soft {
  background: var(--red-soft);
  color: var(--red);
}

.btn--sm {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 11.5px;
}

.btn--block {
  width: 100%;
}

.btn--icon {
  width: 36px;
  height: 36px;
  padding: 0;
}

.btn__spinner {
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: flex-end;
}

.row-btn {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.row-btn:hover {
  background: var(--surface-3);
  color: var(--text);
  border-color: var(--border);
}

.row-btn.is-danger:hover {
  background: var(--red-soft);
  color: var(--red);
  border-color: transparent;
}

.row-btn.is-accent:hover {
  background: var(--brand-soft);
  color: var(--brand-strong);
  border-color: transparent;
}

/* ---------- Cards / stats ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 17px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.stat-card::after {
  content: "";
  position: absolute;
  right: -38px;
  top: -38px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--tone-soft, var(--brand-soft)), transparent 68%);
  opacity: 0.9;
  pointer-events: none;
}

.stat-card__icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 12px;
  background: var(--tone-soft, var(--brand-soft));
  color: var(--tone, var(--brand));
}

.stat-card__label {
  display: block;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat-card__value {
  display: block;
  margin-top: 2px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.stat-card__value small {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.stat-card__sub {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  color: var(--muted);
}

.tone-indigo { --tone: var(--brand); --tone-soft: var(--brand-soft); }
.tone-green { --tone: var(--green); --tone-soft: var(--green-soft); }
.tone-amber { --tone: var(--amber); --tone-soft: var(--amber-soft); }
.tone-red { --tone: var(--red); --tone-soft: var(--red-soft); }
.tone-blue { --tone: var(--blue); --tone-soft: var(--blue-soft); }
.tone-cyan { --tone: var(--cyan); --tone-soft: var(--cyan-soft); }
.tone-violet { --tone: var(--violet); --tone-soft: #f2ecfe; }
.tone-slate { --tone: var(--slate); --tone-soft: var(--slate-soft); }

[data-theme="dark"] .tone-violet { --tone-soft: #2b2148; }

.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.panel__head h3 {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.panel__head p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11.5px;
}

.panel__body {
  padding: 18px;
}

.panel__body--flush {
  padding: 0;
}

.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.stack {
  display: grid;
  gap: 16px;
}

/* ---------- Dashboard widgets ---------- */

.occupancy-widget {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.ring {
  position: relative;
  width: 148px;
  height: 148px;
  flex: none;
  border-radius: 50%;
  background: conic-gradient(
    var(--green) 0 var(--seg-occupied, 0%),
    var(--amber) var(--seg-occupied, 0%) var(--seg-available, 0%),
    var(--slate) var(--seg-available, 0%) 100%
  );
  display: grid;
  place-items: center;
}

.ring::before {
  content: "";
  position: absolute;
  inset: 13px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border);
}

.ring__center {
  position: relative;
  text-align: center;
  z-index: 1;
}

.ring__center strong {
  display: block;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}

.ring__center span {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.legend {
  display: grid;
  gap: 10px;
  min-width: 150px;
  flex: 1;
}

.legend__row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.legend__dot {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  flex: none;
}

.legend__row strong {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 12px;
}

.bars {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 168px;
  padding-top: 8px;
}

.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  min-width: 0;
  height: 100%;
  justify-content: flex-end;
}

.bar-col__track {
  position: relative;
  width: 100%;
  max-width: 46px;
  height: 100%;
  display: flex;
  align-items: flex-end;
  border-radius: 8px 8px 4px 4px;
  background: var(--surface-2);
  overflow: hidden;
}

.bar-col__fill {
  width: 100%;
  min-height: 3px;
  border-radius: 7px 7px 3px 3px;
  background: linear-gradient(180deg, #818cf8, var(--brand));
  transition: height 0.5s ease;
}

.bar-col:hover .bar-col__fill {
  filter: brightness(1.1);
}

.bar-col__label {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}

.bar-col__value {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--text-soft);
  white-space: nowrap;
}

.progress-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 4px 10px;
  align-items: center;
  padding: 8px 0;
}

.progress-row + .progress-row {
  border-top: 1px dashed var(--border);
}

.progress-row__label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 12px;
  font-weight: 600;
}

.progress-row__label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-row__value {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  text-align: right;
  color: var(--text-soft);
}

.progress {
  grid-column: 1 / -1;
  height: 6px;
  border-radius: 99px;
  background: var(--surface-3);
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--violet));
}

.activity {
  display: grid;
}

.activity__item {
  display: flex;
  gap: 11px;
  padding: 10px 0;
}

.activity__item + .activity__item {
  border-top: 1px dashed var(--border);
}

.activity__icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--text-soft);
}

.activity__body {
  min-width: 0;
  flex: 1;
}

.activity__title {
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 10.5px;
  color: var(--muted);
}

.activity__amount {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-soft);
  white-space: nowrap;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.quick-tile {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-soft);
  font-size: 11.5px;
  font-weight: 700;
  text-align: left;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.quick-tile:hover {
  background: var(--brand-soft);
  border-color: transparent;
  color: var(--brand-strong);
}

.quick-tile .icon {
  color: var(--brand);
}

/* ---------- Toolbar ---------- */

.toolbar {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.toolbar__spacer {
  flex: 1;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 190px;
  max-width: 340px;
}

.search-box .icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.input,
.select,
.textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 12.5px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: var(--muted);
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--ring);
}

.input::placeholder,
.textarea::placeholder {
  color: var(--muted);
}

.input.is-invalid,
.select.is-invalid,
.textarea.is-invalid {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

.search-box .input {
  padding-left: 34px;
  background: var(--surface);
}

.select {
  width: auto;
  min-width: 132px;
  padding-right: 30px;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.select--block {
  width: 100%;
}

.textarea {
  min-height: 92px;
  resize: vertical;
  line-height: 1.6;
}

.field {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.field > label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-soft);
}

.field > label .req {
  color: var(--red);
}

.field__hint {
  font-size: 10.5px;
  color: var(--muted);
}

.field__error {
  font-size: 10.5px;
  color: var(--red);
}

.form-grid {
  display: grid;
  gap: 13px;
}

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

.form-grid .span-2 {
  grid-column: span 2;
}

.form-section {
  margin: 18px 0 10px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.form-section:first-child {
  margin-top: 0;
}

.check {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-soft);
  cursor: pointer;
}

.check input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
}

.form-alert {
  display: flex;
  gap: 9px;
  padding: 11px 12px;
  margin-bottom: 14px;
  border-radius: var(--radius-sm);
  background: var(--red-soft);
  color: var(--red);
  font-size: 12px;
  line-height: 1.5;
}

.form-alert .icon {
  margin-top: 1px;
  flex: none;
}

.form-alert ul {
  margin-top: 4px;
  list-style: disc;
  padding-left: 16px;
  font-size: 11px;
}

.form-note {
  display: flex;
  gap: 8px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
}

.code-inline {
  font-family: var(--mono);
  font-size: 0.92em;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--surface-3);
  color: var(--text-soft);
}

/* ---------- Table ---------- */

.table-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.table-wrap {
  overflow-x: auto;
  scrollbar-width: thin;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.data-table th {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
}

.data-table th.is-right,
.data-table td.is-right {
  text-align: right;
}

.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background 0.12s;
}

.data-table tbody tr:hover {
  background: var(--surface-2);
}

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

.cell-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.cell-main__text {
  min-width: 0;
}

.cell-main__text strong {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-main__text span {
  display: block;
  font-size: 10.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-stack {
  display: grid;
  gap: 1px;
}

.cell-stack strong {
  font-size: 12px;
  font-weight: 600;
}

.cell-stack span {
  font-size: 10.5px;
  color: var(--muted);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.facilities {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  max-width: 220px;
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 11px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11.5px;
}

.pager {
  display: flex;
  align-items: center;
  gap: 5px;
}

.pager button {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  padding: 0 7px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
}

.pager button:hover:not(:disabled) {
  border-color: var(--brand);
  color: var(--brand-strong);
}

.pager button.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.pager button:disabled {
  opacity: 0.45;
  pointer-events: none;
}

.pager__gap {
  padding: 0 2px;
  color: var(--muted);
  font-size: 11px;
}

/* ---------- Badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.35;
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.badge--green { background: var(--green-soft); color: var(--green); }
.badge--amber { background: var(--amber-soft); color: var(--amber); }
.badge--red { background: var(--red-soft); color: var(--red); }
.badge--blue { background: var(--blue-soft); color: var(--blue); }
.badge--cyan { background: var(--cyan-soft); color: var(--cyan); }
.badge--violet { background: #f1ebff; color: var(--violet); }
.badge--slate { background: var(--slate-soft); color: var(--slate); }
.badge--brand { background: var(--brand-soft); color: var(--brand-strong); }

[data-theme="dark"] .badge--violet { background: #2a2147; }

.badge--plain::before {
  display: none;
}

/* ---------- Empty / loading ---------- */

.empty {
  display: grid;
  place-items: center;
  justify-items: center;
  gap: 7px;
  padding: 52px 22px;
  text-align: center;
}

.empty__icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 4px;
  border-radius: 15px;
  background: var(--surface-2);
  color: var(--muted);
}

.empty h3 {
  font-size: 13.5px;
  font-weight: 800;
}

.empty p {
  max-width: 340px;
  color: var(--muted);
  font-size: 12px;
}

.empty .btn {
  margin-top: 8px;
}

.skeleton {
  border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
  background-size: 480px 100%;
  animation: shimmer 1.2s linear infinite;
}

.skeleton-row td {
  padding: 14px;
}

.skeleton-line {
  height: 11px;
  width: 100%;
}

.skeleton-line--sm { width: 45%; }
.skeleton-line--md { width: 70%; }

.loading-block {
  display: grid;
  gap: 10px;
  padding: 20px;
}

.error-block {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 18px;
  border: 1px solid rgba(220, 38, 38, 0.25);
  border-radius: var(--radius);
  background: var(--red-soft);
  color: var(--red);
}

.error-block h3 {
  font-size: 13px;
}

.error-block p {
  margin-top: 2px;
  font-size: 11.5px;
}

.error-block .btn {
  margin-top: 10px;
}

/* ---------- Modal ---------- */

.modal-root {
  position: relative;
  z-index: 120;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(10, 13, 30, 0.52);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.18s ease;
  overflow-y: auto;
}

.modal-overlay.is-open {
  opacity: 1;
}

.modal {
  width: min(620px, 100%);
  max-height: min(90vh, 900px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  transform: translateY(10px) scale(0.985);
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
  margin: auto;
}

.modal-overlay.is-open .modal {
  transform: none;
  opacity: 1;
}

.modal--sm { width: min(430px, 100%); }
.modal--lg { width: min(840px, 100%); }
.modal--xl { width: min(1040px, 100%); }

.modal__head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
}

.modal__head h2 {
  flex: 1;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.modal__head p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11.5px;
}

.modal__close {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--muted);
}

.modal__close:hover {
  background: var(--surface-2);
  color: var(--text);
}

.modal form {
  display: contents;
}

.modal__body {
  padding: 18px 20px;
  overflow-y: auto;
}

.modal__foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.modal__foot--split {
  justify-content: space-between;
}

/* ---------- Drawer ---------- */

.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: rgba(10, 13, 30, 0.4);
  backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s, visibility 0.2s;
}

.drawer-overlay.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 111;
  width: min(460px, 100%);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  transform: translateX(102%);
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.drawer.is-open {
  transform: none;
}

.drawer__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.drawer__head h2 {
  flex: 1;
  font-size: 14px;
  font-weight: 800;
}

.drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
}

.log-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  margin-bottom: 8px;
  overflow: hidden;
}

.log-item__summary {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  background: none;
  text-align: left;
}

.log-item__method {
  display: inline-grid;
  place-items: center;
  min-width: 48px;
  padding: 2px 5px;
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  background: var(--surface-3);
  color: var(--text-soft);
}

.log-item__method[data-method="POST"] { background: var(--green-soft); color: var(--green); }
.log-item__method[data-method="PATCH"] { background: var(--amber-soft); color: var(--amber); }
.log-item__method[data-method="PUT"] { background: var(--amber-soft); color: var(--amber); }
.log-item__method[data-method="DELETE"] { background: var(--red-soft); color: var(--red); }

.log-item__path {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-soft);
}

.log-item__status {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--green);
}

.log-item__status.is-bad {
  color: var(--red);
}

.log-item__meta {
  display: flex;
  justify-content: space-between;
  padding: 0 10px 8px;
  font-size: 9.5px;
  color: var(--muted);
}

.log-item pre,
.code-block {
  margin: 0;
  padding: 10px;
  border-top: 1px solid var(--border);
  background: #0e1222;
  color: #c8d3f5;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.65;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---------- Toasts ---------- */

.toast-root {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 200;
  display: grid;
  gap: 9px;
  width: min(380px, calc(100vw - 36px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 13px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  pointer-events: auto;
  animation: slide-left 0.25s ease both;
}

.toast.is-leaving {
  animation: fade-in 0.2s ease reverse both;
}

.toast--success { border-left-color: var(--green); }
.toast--error { border-left-color: var(--red); }
.toast--warning { border-left-color: var(--amber); }
.toast--info { border-left-color: var(--brand); }

.toast__icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 8px;
  background: var(--surface-2);
}

.toast--success .toast__icon { color: var(--green); background: var(--green-soft); }
.toast--error .toast__icon { color: var(--red); background: var(--red-soft); }
.toast--warning .toast__icon { color: var(--amber); background: var(--amber-soft); }
.toast--info .toast__icon { color: var(--brand); background: var(--brand-soft); }

.toast__body {
  flex: 1;
  min-width: 0;
}

.toast__title {
  font-size: 12px;
  font-weight: 800;
}

.toast__message {
  margin-top: 1px;
  font-size: 11.5px;
  color: var(--text-soft);
  word-break: break-word;
}

.toast__close {
  border: 0;
  background: none;
  color: var(--muted);
  padding: 1px;
  border-radius: 5px;
}

.toast__close:hover {
  color: var(--text);
}

/* ---------- Detail view ---------- */

.detail-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--brand-soft), var(--surface-2));
  border: 1px solid var(--border);
}

.detail-hero__icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: 14px;
  background: var(--surface);
  color: var(--brand);
  box-shadow: var(--shadow-xs);
}

.detail-hero h3 {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.detail-hero p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11.5px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 18px;
  margin-top: 16px;
}

.detail-row {
  display: grid;
  gap: 1px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
  min-width: 0;
}

.detail-row__label {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.detail-row__value {
  font-size: 12.5px;
  color: var(--text);
  overflow-wrap: break-word;
}

.detail-row--wide {
  grid-column: span 2;
}

.detail-list {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.detail-list__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 11.5px;
}

.detail-list__item strong {
  font-family: var(--mono);
  font-size: 10.5px;
}

.detail-list__item span {
  color: var(--muted);
  font-size: 10.5px;
}

.detail-list__item .badge {
  margin-left: auto;
}

.subhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 18px 0 8px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Explorer ---------- */

.explorer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
  gap: 16px;
  align-items: start;
}

.explorer__panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.explorer__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 15px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 800;
}

.explorer__head .icon {
  color: var(--brand);
}

.explorer__body {
  padding: 15px;
}

.request-line {
  display: flex;
  gap: 7px;
}

.request-line .select {
  min-width: 92px;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 11px;
}

.request-line .input {
  font-family: var(--mono);
  font-size: 11.5px;
}

.preset-group {
  margin-top: 16px;
}

.preset-group__label {
  margin-bottom: 6px;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.preset {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 9.5px;
  transition: border-color 0.15s, background 0.15s;
}

.preset:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.preset__method {
  font-weight: 700;
  color: var(--green);
}

.preset__method[data-method="POST"] { color: var(--amber); }
.preset__method[data-method="PATCH"] { color: var(--blue); }
.preset__method[data-method="DELETE"] { color: var(--red); }

.response-console {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #0c1020;
  color: #c8d3f5;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.response-console__bar {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: #10152a;
}

.console-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f87171;
}

.console-dot:nth-child(2) { background: #fbbf24; }
.console-dot:nth-child(3) { background: #4ade80; }

.response-console__title {
  flex: 1;
  font-family: var(--mono);
  font-size: 10.5px;
  color: #8e9ac0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-pill {
  padding: 2px 7px;
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  background: rgba(74, 222, 128, 0.14);
  color: #4ade80;
}

.status-pill.is-bad {
  background: rgba(248, 113, 113, 0.14);
  color: #f87171;
}

.response-console pre {
  margin: 0;
  padding: 14px;
  min-height: 300px;
  max-height: 580px;
  overflow: auto;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  tab-size: 2;
}

.response-console pre .json-key { color: #93c5fd; }
.response-console pre .json-string { color: #86efac; }
.response-console pre .json-number { color: #fcd34d; }
.response-console pre .json-boolean { color: #f0abfc; }
.response-console pre .json-null { color: #94a3b8; }

.response-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 9px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-family: var(--mono);
  font-size: 9.5px;
  color: #8e9ac0;
}

/* ---------- Misc ---------- */

.sidebar-scrim {
  display: none;
}

@media (max-width: 1024px) {
  .sidebar-scrim {
    position: fixed;
    inset: 0;
    z-index: 99;
    display: block;
    background: rgba(10, 13, 30, 0.45);
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.22s, visibility 0.22s;
  }

  .sidebar-scrim.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
}

.divider {
  height: 1px;
  margin: 16px 0;
  background: var(--border);
}

.notice {
  display: flex;
  gap: 9px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-soft);
  font-size: 11.5px;
}

.notice .icon {
  color: var(--brand);
  margin-top: 1px;
  flex: none;
}

.kbd {
  display: inline-block;
  padding: 1px 5px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--muted);
}

.noscript {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
  text-align: center;
  font-weight: 600;
}

/* ---------- Responsive ---------- */

@media (max-width: 1180px) {
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dash-grid,
  .explorer {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 1024px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(290px, 86vw);
    transform: translateX(-102%);
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 100;
    box-shadow: var(--shadow-lg);
  }

  .sidebar.is-open {
    transform: none;
  }

  .sidebar-toggle {
    display: inline-grid;
  }

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

  .auth__visual {
    display: none;
  }

  .auth__mobile-brand {
    display: flex;
  }

  .auth__panel {
    min-height: 100vh;
    padding: 22px;
  }
}

@media (max-width: 720px) {
  .topbar {
    flex-wrap: wrap;
    gap: 10px;
  }

  .topbar__subtitle {
    display: none;
  }

  .user-chip__text {
    display: none;
  }

  .user-chip {
    padding: 4px;
  }

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

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

  .form-grid .span-2,
  .detail-row--wide {
    grid-column: auto;
  }

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

  .toolbar .search-box {
    max-width: none;
    flex-basis: 100%;
  }

  .toolbar .select {
    flex: 1;
  }

  .modal-overlay {
    padding: 10px;
    place-items: end center;
  }

  .modal {
    max-height: 94vh;
    border-radius: 18px;
  }

  .modal__head h2 {
    font-size: 15px;
  }

  .auth__card {
    padding: 24px 20px;
  }

  .table-footer {
    justify-content: center;
  }

  .toast-root {
    left: 12px;
    right: 12px;
    width: auto;
    bottom: 12px;
  }
}

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