:root {
  --bg-main: #050811;
  --bg-card: #0b1020;
  --bg-elevated: #11182b;
  --accent: #00d8ff;
  --accent-soft: rgba(0, 216, 255, 0.12);
  --accent-secondary: #ff7a3c;
  --accent-secondary-soft: rgba(255, 122, 60, 0.14);
  --text-primary: #f7f9ff;
  --text-muted: #8891a7;
  --border-subtle: #1d2640;
  --danger: #ff4b6b;
  --radius-xl: 20px;
  --shadow-soft: 0 18px 40px rgba(0, 0, 0, 0.55);
  --transition-fast: 0.18s ease-out;
}

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

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
  color: var(--text-primary);
  background: radial-gradient(circle at top left, #081028, #02040a 55%);
}

body {
  display: flex;
}

#app {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */

.sidebar {
  background: radial-gradient(circle at top, #0b1224, #050811 65%);
  border-right: 1px solid var(--border-subtle);
  padding: 18px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 999px;
  background: linear-gradient(120deg, #0e162a, rgba(0, 216, 255, 0.1));
  border: 1px solid rgba(0, 216, 255, 0.3);
  box-shadow: 0 0 0 1px rgba(0, 216, 255, 0.15);
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: radial-gradient(circle at 30% 0, #00d8ff, #0051ff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-title {
  font-size: 15px;
  font-weight: 600;
}

.brand-subtitle {
  font-size: 11px;
  color: var(--text-muted);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  border: none;
  background: transparent;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
  transition: background var(--transition-fast), color var(--transition-fast),
    transform var(--transition-fast), box-shadow var(--transition-fast);
}

.nav-icon {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content;
  background: rgba(136, 145, 167, 0.12);
}

.nav-item:hover {
  background: rgba(0, 216, 255, 0.04);
  color: var(--text-primary);
  transform: translateX(2px);
}

.nav-item.active {
  background: linear-gradient(120deg, var(--accent-soft), transparent);
  color: var(--text-primary);
  box-shadow: 0 0 0 1px rgba(0, 216, 255, 0.3);
}

.nav-item.active .nav-icon {
  background: var(--accent-secondary-soft);
}

.sidebar-footer {
  margin-top: auto;
  padding: 10px 10px 4px;
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px dashed var(--border-subtle);
}

.sidebar-version {
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(0, 216, 255, 0.08);
}

/* Main */

.main {
  padding: 18px 22px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.main-header h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0.02em;
}

#page-subtitle {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

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

/* Buttons */

.btn {
  border-radius: 999px;
  border: none;
  padding: 8px 15px;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background var(--transition-fast), color var(--transition-fast),
    transform var(--transition-fast), box-shadow var(--transition-fast),
    border var(--transition-fast);
  font-weight: 500;
}

.btn.primary {
  background: linear-gradient(120deg, var(--accent), var(--accent-secondary));
  color: #050811;
  box-shadow: 0 12px 26px rgba(0, 216, 255, 0.35);
}

.btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 40px rgba(0, 216, 255, 0.45);
}

.btn.ghost {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.btn.ghost:hover {
  border-color: rgba(0, 216, 255, 0.6);
}

/* Cards */

.card {
  background: radial-gradient(circle at top left, #151d38, #050811 55%);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
  padding: 14px 16px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.card-header h2 {
  margin: 0;
  font-size: 16px;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body {
  font-size: 13px;
}

/* Inputs */

input,
select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: rgba(5, 8, 17, 0.9);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: border var(--transition-fast), box-shadow var(--transition-fast),
    background var(--transition-fast), transform var(--transition-fast);
}

input:focus,
select:focus {
  border-color: rgba(0, 216, 255, 0.8);
  box-shadow: 0 0 0 1px rgba(0, 216, 255, 0.3);
  background: #050811;
}

input::placeholder {
  color: #5d6680;
}

/* Table */

.table-wrapper {
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  background: rgba(5, 8, 17, 0.9);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead {
  background: linear-gradient(90deg, #101932, #071020);
}

th,
td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(18, 26, 46, 0.9);
}

th {
  font-weight: 500;
  color: var(--text-muted);
  font-size: 12px;
}

tbody tr:hover {
  background: rgba(0, 216, 255, 0.03);
}

.col-actions {
  width: 140px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
}

.badge.success {
  background: rgba(0, 216, 255, 0.16);
  color: var(--accent);
}

.badge.muted {
  background: rgba(136, 145, 167, 0.16);
  color: var(--text-muted);
}

/* Tabs */

.tab {
  display: none;
}

.tab.active {
  display: block;
}

/* Forms */

.form-group {
  margin-bottom: 10px;
}

.form-group.full {
  grid-column: 1 / -1;
}

.form-group label {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

.help {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--text-muted);
}

.help-list {
  margin: 0;
  padding-left: 20px;
  font-size: 12px;
  color: var(--text-muted);
}

.help-list li {
  margin-bottom: 3px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px 16px;
}

.toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.password-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

/* Switch */

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: rgba(136, 145, 167, 0.4);
  transition: 0.2s;
  border-radius: 999px;
}

.slider::before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 4px;
  bottom: 3px;
  background-color: #050811;
  transition: 0.2s;
  border-radius: 50%;
}

.switch input:checked + .slider {
  background-color: rgba(0, 216, 255, 0.65);
}

.switch input:checked + .slider::before {
  transform: translateX(18px);
}

/* Modal */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 5, 15, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal-backdrop.hidden {
  display: none;
}

.modal {
  width: 480px;
  max-width: 95vw;
  background: radial-gradient(circle at top, #17223e, #050811 60%);
  border-radius: 20px;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
  padding: 14px 16px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  margin: 0;
  font-size: 16px;
}

.icon-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  padding: 4px;
}

.icon-btn:hover {
  color: var(--text-primary);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Status */

.status {
  font-size: 12px;
  margin-top: 4px;
  color: var(--text-muted);
}

.status.ok {
  color: var(--accent);
}

.status.error {
  color: var(--danger);
}

/* Utils */

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

/* Login */

.login-shell {
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: 360px;
  max-width: 95vw;
  background: radial-gradient(circle at top left, #161f3b, #050811 60%);
  border-radius: 20px;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
  padding: 18px 18px 16px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.login-brand .brand-logo {
  width: 32px;
  height: 32px;
}

.login-title {
  margin: 0;
  font-size: 18px;
}

.login-subtitle {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.login-footer {
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

@media (max-width: 840px) {
  #app {
    grid-template-columns: 70px minmax(0, 1fr);
  }

  .brand-text {
    display: none;
  }

  .sidebar-footer {
    display: none;
  }

  .nav-item span:last-child {
    display: none;
  }

  .main-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .main-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

.readonly {
  background: rgba(5, 8, 17, 0.6);
  color: var(--text-muted);
  cursor: default;
}
.readonly::placeholder {
  color: #5d6680;
}
