:root {
  color-scheme: dark;
  --bg: #070b16;
  --panel: rgba(16, 23, 42, 0.86);
  --panel-2: rgba(22, 32, 56, 0.9);
  --line: rgba(148, 163, 184, 0.16);
  --text: #eef4ff;
  --muted: #94a3b8;
  --soft: #cbd5e1;
  --accent: #42f5b3;
  --accent-2: #4f7cff;
  --danger: #fb7185;
  --warn: #fbbf24;
  --ok: #34d399;
  --radius: 22px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 18% -10%, rgba(79, 124, 255, 0.34), transparent 32rem),
    radial-gradient(circle at 90% 5%, rgba(66, 245, 179, 0.18), transparent 26rem),
    linear-gradient(180deg, #080d1b 0%, #070b16 52%, #050711 100%);
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.48; }

.app-shell { display: grid; min-height: 100vh; }
.sidebar {
  position: fixed;
  z-index: 20;
  inset: auto 0 0 0;
  padding: 10px max(12px, env(safe-area-inset-left)) max(10px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-right));
  background: rgba(7, 11, 22, 0.82);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(18px);
}
.brand { display: none; }
.nav {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(72px, 1fr);
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }
.nav-btn {
  min-height: 58px;
  border: 1px solid transparent;
  border-radius: 18px;
  padding: 8px 10px;
  color: var(--muted);
  background: transparent;
  display: grid;
  place-items: center;
  gap: 3px;
  white-space: nowrap;
}
.nav-btn span:first-child { font-size: 20px; line-height: 1; }
.nav-btn span:last-child { font-size: 12px; font-weight: 700; }
.nav-btn.active {
  color: var(--text);
  border-color: rgba(66, 245, 179, 0.28);
  background: linear-gradient(135deg, rgba(66, 245, 179, 0.16), rgba(79, 124, 255, 0.12));
}
.nav-btn.locked { opacity: 0.46; }

.main-wrap { min-width: 0; padding-bottom: 92px; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: max(18px, env(safe-area-inset-top)) 18px 12px;
  background: linear-gradient(180deg, rgba(7, 11, 22, 0.96), rgba(7, 11, 22, 0.72));
  backdrop-filter: blur(16px);
}
.eyebrow { margin: 0 0 4px; color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(28px, 8vw, 42px); line-height: 1; letter-spacing: -0.05em; }
.content { display: grid; gap: 16px; padding: 10px 18px 20px; }

.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: 1fr; }
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.card.soft { background: rgba(15, 23, 42, 0.62); box-shadow: none; }
.card-head { display: flex; align-items: start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card h2 { margin: 0; font-size: 19px; letter-spacing: -0.03em; }
.card h3 { margin-bottom: 6px; font-size: 16px; }
.muted { color: var(--muted); }
.stat-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat { padding: 14px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255, 255, 255, 0.035); }
.stat b { display: block; font-size: 24px; letter-spacing: -0.04em; }
.stat span { color: var(--muted); font-size: 12px; font-weight: 700; }

.list { display: grid; gap: 10px; }
.item {
  display: grid;
  gap: 8px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.035);
}
.item-top { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.item-title { margin: 0; font-size: 15px; font-weight: 850; }
.meta { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; color: var(--muted); font-size: 12px; }
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--soft);
  background: rgba(148, 163, 184, 0.09);
  font-size: 12px;
  font-weight: 800;
}
.badge.ok { color: #9ff6d3; background: rgba(52, 211, 153, 0.12); border-color: rgba(52, 211, 153, 0.22); }
.badge.warn { color: #fde68a; background: rgba(251, 191, 36, 0.12); border-color: rgba(251, 191, 36, 0.22); }
.badge.danger { color: #fecdd3; background: rgba(251, 113, 133, 0.12); border-color: rgba(251, 113, 133, 0.22); }

.quick-form { display: grid; gap: 10px; }
.input, .select, .textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 13px;
  color: var(--text);
  background: rgba(4, 9, 20, 0.72);
  outline: none;
}
.textarea { min-height: 92px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: rgba(66, 245, 179, 0.55); box-shadow: 0 0 0 3px rgba(66, 245, 179, 0.1); }

.primary-btn, .ghost-btn, .mini-btn, .icon-btn {
  min-height: 46px;
  border-radius: 16px;
  border: 1px solid var(--line);
  padding: 10px 14px;
  color: var(--text);
  font-weight: 850;
}
.primary-btn { border: 0; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #06111d; }
.ghost-btn { background: rgba(255, 255, 255, 0.055); }
.mini-btn { min-height: 34px; padding: 7px 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.06); font-size: 12px; }
.icon-btn { width: 42px; min-height: 42px; padding: 0; border-radius: 14px; background: rgba(255, 255, 255, 0.06); font-size: 24px; line-height: 1; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.empty { padding: 22px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 18px; }
.modal { width: min(560px, calc(100vw - 22px)); border: 0; padding: 0; color: var(--text); background: transparent; }
.modal::backdrop { background: rgba(0, 0, 0, 0.62); backdrop-filter: blur(6px); }
.modal-card { padding: 16px; border: 1px solid var(--line); border-radius: 24px; background: #0b1020; box-shadow: var(--shadow); }
.modal-head, .modal-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 14px; padding: 0; }
.modal-head h2 { margin: 0; }
.form-grid { display: grid; gap: 10px; }
.field label { display: block; margin-bottom: 6px; color: var(--soft); font-size: 12px; font-weight: 800; }
.toast {
  position: fixed;
  z-index: 50;
  left: 18px;
  right: 18px;
  bottom: calc(88px + env(safe-area-inset-bottom));
  padding: 12px 14px;
  border: 1px solid rgba(66, 245, 179, 0.26);
  border-radius: 16px;
  color: var(--text);
  background: rgba(10, 16, 31, 0.94);
  transform: translateY(18px);
  opacity: 0;
  pointer-events: none;
  transition: 0.18s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }

@media (min-width: 860px) {
  .app-shell { grid-template-columns: 270px 1fr; }
  .sidebar { inset: 0 auto 0 0; width: 270px; padding: 22px 16px; border-top: 0; border-right: 1px solid var(--line); }
  .brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; padding: 8px; }
  .brand-mark { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 16px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #06111d; font-weight: 950; }
  .brand strong, .brand span { display: block; }
  .brand span { color: var(--muted); font-size: 13px; }
  .nav { grid-auto-flow: row; grid-auto-columns: auto; overflow: visible; }
  .nav-btn { grid-template-columns: 26px 1fr; place-items: center start; min-height: 48px; }
  .main-wrap { padding-bottom: 0; }
  .topbar { padding: 28px 34px 14px; }
  .content { padding: 16px 34px 34px; }
  .grid.two { grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr); }
  .stat-row { grid-template-columns: repeat(4, 1fr); }
  .toast { left: auto; right: 26px; bottom: 26px; width: min(380px, calc(100vw - 52px)); }
}
