:root {
  --bg: #0a0a0b;
  --sidebar: #0d0d0f;
  --panel: #151517;
  --panel-2: #1b1b1e;
  --panel-3: #202024;
  --border: #262629;
  --border-soft: #1e1e21;
  --text: #ededee;
  --muted: #8a8a91;
  --muted-2: #5d5d64;
  --accent: #34d39e;
  --accent-strong: #2bbf8c;
  --accent-soft: rgba(52, 211, 158, 0.12);
  --accent-text: #06140f;
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.14);
  --warning: #fbbf24;
  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.88em;
  background: var(--panel-3);
  padding: 1px 5px;
  border-radius: 4px;
  color: #cdd3cf;
}

/* ===================== LAYOUT ===================== */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ===================== SIDEBAR ===================== */
.sidebar {
  width: 248px;
  flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 18px;
}
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #1f8f6c);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #04140e;
}
.brand-name {
  font-weight: 650;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-section {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-2);
  padding: 14px 10px 6px;
  font-weight: 600;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  width: 100%;
  font-family: inherit;
  transition: background 0.12s, color 0.12s;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.sidebar-bottom { margin-top: auto; padding-top: 12px; }
.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 11px;
}
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 650;
  text-transform: uppercase;
  flex-shrink: 0;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; flex: 1; }
.user-meta span { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta small { color: var(--muted-2); font-size: 11px; }
.icon-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { background: var(--panel-3); color: var(--danger); }

/* ===================== MAIN ===================== */
.main {
  flex: 1;
  overflow-y: auto;
  padding: 28px 36px;
}
.tab-content { display: none; max-width: 1080px; margin: 0 auto; }
.tab-content.active { display: block; animation: fade 0.18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.page-header h1 { margin: 0; font-size: 22px; font-weight: 680; letter-spacing: -0.02em; }
.page-sub { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; }
.page-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ===================== CARDS ===================== */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 18px;
  overflow: hidden;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-soft);
}
.card-head h2 { margin: 0; font-size: 14px; font-weight: 620; display: flex; align-items: center; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); display: inline-block; }

.hint-card {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.hint-card svg { width: 18px; height: 18px; color: var(--accent); flex-shrink: 0; margin-top: 1px; }
.hint-card strong { color: var(--text); }

/* ===================== BUTTONS ===================== */
.btn {
  border: 1px solid transparent;
  padding: 8px 15px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, border-color 0.12s, opacity 0.12s;
  white-space: nowrap;
}
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost { background: var(--panel-2); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--panel-3); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.btn-danger:hover { background: rgba(248, 113, 113, 0.22); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ===================== TABLE ===================== */
.card { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 12px 18px; white-space: nowrap; }
th {
  color: var(--muted-2);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border-soft);
}
tbody tr { border-bottom: 1px solid var(--border-soft); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover td { background: var(--panel-2); }
td strong { font-weight: 600; }

.actions { display: flex; gap: 6px; justify-content: flex-end; }
.notes-cell { white-space: normal; max-width: 240px; color: var(--muted); font-size: 12.5px; }

.tag {
  display: inline-block;
  padding: 3px 9px;
  background: var(--panel-3);
  border-radius: 20px;
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 500;
}
.tag.success { color: var(--accent); background: var(--accent-soft); }
.tag.warning { color: var(--warning); background: rgba(251, 191, 36, 0.12); }
.tag.muted { opacity: 0.7; }

.empty-state { padding: 36px !important; text-align: center; color: var(--muted-2); }

/* ===================== FORMS ===================== */
label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; font-weight: 500; }
input[type="text"], input[type="password"], input[type="number"], select, textarea {
  width: 100%;
  padding: 9px 11px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: inherit;
  transition: border-color 0.12s, box-shadow 0.12s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { min-height: 70px; resize: vertical; }

.form-hint { color: var(--muted); font-size: 12px; line-height: 1.55; margin: 6px 0 0; }

/* ===================== CONFIG OUTPUT ===================== */
pre.config-output {
  margin: 0;
  background: var(--bg);
  padding: 16px 18px;
  overflow: auto;
  font-size: 12px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  line-height: 1.55;
  color: #b9c2bd;
  max-height: 420px;
}

/* ===================== MODAL ===================== */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 24px;
}
.modal-bg.hidden { display: none; }
.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.modal h2 { margin: 0 0 18px; font-size: 17px; font-weight: 650; }
.modal .row { margin-bottom: 14px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > div { flex: 1; min-width: 150px; }
.checkbox { display: flex; align-items: center; gap: 8px; }
.checkbox input { width: auto; }
.checkbox label { margin: 0; }
.modal-buttons { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

/* ===================== TOAST ===================== */
.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-text);
  font-size: 13.5px;
  font-weight: 600;
  z-index: 200;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s, transform 0.25s;
  max-width: 460px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}
.toast.visible { opacity: 1; transform: none; }
.toast.error { background: var(--danger); color: #fff; }
.toast.warning { background: var(--warning); color: #1a1400; }

/* ===================== LOGIN ===================== */
.login-wrap {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px;
}
.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 34px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
}
.login-brand {
  display: flex; align-items: center; gap: 10px; justify-content: center;
  margin-bottom: 26px;
}
.login-brand .brand-mark { width: 34px; height: 34px; }
.login-card h1 { margin: 0; font-size: 19px; font-weight: 650; }
.login-card .row { margin-bottom: 15px; }
.login-card .btn { width: 100%; padding: 11px; font-size: 14.5px; justify-content: center; }
.login-error {
  background: var(--danger-soft);
  border: 1px solid rgba(248, 113, 113, 0.4);
  color: var(--danger);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}
.login-error.visible { display: block; }

/* ===================== SCROLLBAR ===================== */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2a2a2e; border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #36363b; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 760px) {
  .sidebar { width: 64px; padding: 14px 8px; }
  .brand-name, .nav-item span, .nav-section, .user-meta { display: none; }
  .nav-item { justify-content: center; }
  .user-card { justify-content: center; padding: 8px; }
  .main { padding: 20px 16px; }
  .page-header { flex-direction: column; }
}
