:root {
  --bg-main: #070b12;
  --bg-sidebar: #0b111b;
  --bg-card: rgba(17, 24, 39, 0.72);
  --bg-card-solid: #111827;
  --border: rgba(255, 255, 255, 0.08);
  --text-main: #f4f7fb;
  --text-muted: #9ca3af;
  --green: #22c55e;
  --green-dark: #15803d;
  --green-soft: rgba(34, 197, 94, 0.11);
  --yellow: #eab308;
  --red: #ef4444;
  --blue: #38bdf8;
  --panel: rgba(15, 23, 42, 0.7);
  --panel-strong: rgba(15, 23, 42, 0.9);
  --radius: 16px;
  --sidebar-width: 260px;
  --topbar-height: 72px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(circle at 35% 0%, rgba(34, 197, 94, 0.08), transparent 32%), var(--bg-main);
  color: var(--text-main);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  overflow-x: hidden;
}

html {
  scrollbar-width: thin;
  scrollbar-color: rgba(34, 197, 94, 0.45) rgba(7, 11, 18, 0.82);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(7, 11, 18, 0.8);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(34, 197, 94, 0.62), rgba(56, 189, 248, 0.34));
  border: 2px solid rgba(7, 11, 18, 0.9);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(34, 197, 94, 0.85), rgba(56, 189, 248, 0.48));
}

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

button {
  cursor: pointer;
}

a {
  color: var(--green);
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  background: linear-gradient(180deg, rgba(11, 17, 27, 0.98), rgba(7, 11, 18, 0.96));
  border-right: 1px solid var(--border);
  padding: 18px 12px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overscroll-behavior: contain;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 52px;
  color: var(--green);
  font-size: 23px;
  font-weight: 800;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
  flex: 0 0 auto;
  position: sticky;
  top: 0;
  z-index: 2;
  background: linear-gradient(180deg, rgba(11, 17, 27, 1), rgba(11, 17, 27, 0.92));
}

.brand img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
}

.sidebar-close {
  display: none;
  margin-left: auto;
}

.nav {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  padding: 0 4px 18px 0;
  min-height: 0;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.nav::-webkit-scrollbar,
.topbar-actions::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar,
.card::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

.nav::-webkit-scrollbar-thumb,
.topbar-actions::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb,
.card::-webkit-scrollbar-thumb {
  border-width: 1px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #cbd5e1;
  background: transparent;
  text-align: left;
  transition: 160ms ease;
  width: 100%;
}

.nav-item span {
  display: inline-grid;
  place-items: center;
  width: 28px;
  min-width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.08);
  color: #dbeafe;
  font-size: 10px;
  font-weight: 800;
}

.nav-item:hover,
.nav-item.active {
  color: var(--green);
  background: rgba(148, 163, 184, 0.08);
  border-color: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 28px rgba(34, 197, 94, 0.04);
}

.nav-item:hover span,
.nav-item.active span {
  color: #bbf7d0;
  background: var(--green-soft);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 22px 0 26px;
  background: rgba(7, 11, 18, 0.82);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
  z-index: 20;
  min-width: 0;
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 14px;
}

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

.content {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  padding: calc(var(--topbar-height) + 22px) 22px 26px;
}

.page-shell {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
}

.card {
  background: linear-gradient(145deg, rgba(17, 24, 39, 0.82), rgba(11, 17, 27, 0.76));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.25);
  padding: 18px;
  min-width: 0;
}

.card > p:first-child,
.card > .muted:first-child {
  margin-top: 0;
}

.card h2,
.card h3 {
  margin: 0 0 14px;
}

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

.page-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.grid {
  display: grid;
  gap: 18px;
}

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

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

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

.btn,
.icon-button {
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid var(--border);
  color: var(--text-main);
  background: rgba(15, 23, 42, 0.72);
  padding: 0 16px;
  transition: 160ms ease;
  white-space: nowrap;
}

.btn:disabled,
.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
}

.icon-button {
  width: 38px;
  padding: 0;
}

.btn:hover,
.icon-button:hover {
  transform: translateY(-1px);
  border-color: rgba(34, 197, 94, 0.35);
}

.btn:active,
.icon-button:active {
  transform: translateY(0);
}

.btn-green {
  background: linear-gradient(180deg, #22c55e, #14803a);
  border-color: rgba(34, 197, 94, 0.55);
}

.btn-yellow {
  color: #fef3c7;
  background: rgba(234, 179, 8, 0.12);
  border-color: rgba(234, 179, 8, 0.55);
}

.btn-red {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.58);
}

.btn-blue {
  background: rgba(56, 189, 248, 0.14);
  border-color: rgba(56, 189, 248, 0.42);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.72);
  font-size: 14px;
}

.status-pill i {
  width: 9px;
  height: 9px;
  border-radius: 99px;
  background: var(--red);
  box-shadow: 0 0 18px currentColor;
}

.status-pill.online {
  color: var(--green);
}

.status-pill.online i {
  background: var(--green);
}

.status-pill.offline {
  color: #fca5a5;
}

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

.field {
  display: grid;
  gap: 7px;
}

.field label {
  color: var(--text-muted);
  font-size: 13px;
}

.field input,
.field select,
.field textarea,
.content input:not([type="file"]),
.content select,
.content textarea {
  width: 100%;
  min-height: 40px;
  color: var(--text-main);
  background: rgba(7, 11, 18, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 10px 12px;
  outline: none;
  transition: 160ms ease;
}

.field input::placeholder,
.content input::placeholder,
.field textarea::placeholder,
.content textarea::placeholder {
  color: #64748b;
}

.field select,
.content select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #94a3b8 50%),
    linear-gradient(135deg, #94a3b8 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 18px,
    calc(100% - 13px) 18px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.field select option,
.content select option {
  color: var(--text-main);
  background: #0b111b;
}

.field textarea {
  min-height: 140px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.content input:not([type="file"]):focus,
.content select:focus,
.content textarea:focus {
  border-color: rgba(34, 197, 94, 0.65);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.08);
}

.table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

.table-wrap,
.card > .table {
  display: block;
  width: 100%;
  overflow-x: auto;
}

.table th,
.table td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: 12px 10px;
  text-align: left;
  vertical-align: middle;
}

.table tbody tr {
  transition: 140ms ease;
}

.table tbody tr:hover {
  background: rgba(34, 197, 94, 0.04);
}

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

.table th {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  white-space: nowrap;
}

.table-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.table-actions .btn,
.table td .btn {
  min-height: 32px;
  padding: 0 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 8px;
  border: 1px solid var(--border);
  color: #dbeafe;
  background: rgba(148, 163, 184, 0.08);
  font-size: 12px;
  white-space: nowrap;
}

.badge.green {
  color: var(--green);
  border-color: rgba(34, 197, 94, 0.32);
  background: rgba(34, 197, 94, 0.1);
}

.badge.red {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.1);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.toolbar h2,
.toolbar h3,
.toolbar p {
  margin-top: 0;
}

.toolbar p {
  margin-bottom: 0;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar select,
.toolbar input {
  width: auto;
  min-width: 150px;
}

.warning-box {
  border: 1px solid rgba(234, 179, 8, 0.32);
  background: rgba(234, 179, 8, 0.08);
  color: #fde68a;
  border-radius: 12px;
  padding: 13px 14px;
}

.info-list.compact {
  gap: 9px;
}

.content code {
  color: #dbeafe;
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 6px;
  padding: 2px 6px;
}

.toast-host {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: grid;
  gap: 10px;
  z-index: 50;
}

.toast {
  width: min(360px, calc(100vw - 32px));
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.95);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.34);
}

.toast.success {
  border-color: rgba(34, 197, 94, 0.42);
}

.toast.error {
  border-color: rgba(239, 68, 68, 0.45);
}

.footer {
  max-width: 1440px;
  margin: 28px auto 0;
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 13px;
}

.mobile-menu,
.overlay {
  display: none;
}
