:root {
  --bg: #0a0a0f;
  --bg-card: rgba(255, 255, 255, 0.03);
  --border: rgba(255, 255, 255, 0.08);
  --primary: #fc9a0a;
  --primary-dark: #d97e00;
  --primary-glow: rgba(252, 154, 10, 0.28);
  --accent: #10b981;
  --danger: #ef4444;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter', system-ui, sans-serif; }

body {
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─── Auth Overlay ────────────────────────────────── */
.auth-overlay {
  position: fixed; inset: 0;
  background: rgba(10, 10, 15, 0.97);
  backdrop-filter: blur(20px);
  z-index: 999;
  display: flex; align-items: center; justify-content: center;
}

.auth-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(252, 154, 10, 0.2);
  border-radius: 20px;
  padding: 2.5rem;
  width: 100%; max-width: 460px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 40px var(--primary-glow);
  text-align: center;
}

.auth-logo {
  width: 90px; height: 90px;
  object-fit: contain;
  margin-bottom: 1rem;
  filter: drop-shadow(0 0 14px var(--primary-glow));
  animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { filter: drop-shadow(0 0 10px var(--primary-glow)); }
  50%       { filter: drop-shadow(0 0 22px rgba(252,154,10,0.5)); }
}

.auth-header h2 { font-size: 1.8rem; font-weight: 700; margin-bottom: 0.4rem; }
.auth-header p  { color: var(--text-muted); font-size: 0.88rem; margin-bottom: 2rem; }

.auth-form { display: flex; flex-direction: column; gap: 1rem; text-align: left; }
.auth-form label { font-size: 0.8rem; font-weight: 500; color: var(--text-muted); }
.auth-form input {
  width: 100%; padding: 0.75rem 1rem;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border);
  border-radius: 8px; color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  outline: none; font-size: 0.85rem;
}
.auth-form input:focus { border-color: var(--primary); box-shadow: 0 0 10px var(--primary-glow); }
.auth-hint { font-size: 0.73rem; color: var(--text-muted); text-align: center; }

/* ─── App Layout ──────────────────────────────────── */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 265px; flex-shrink: 0;
  background: rgba(252, 154, 10, 0.03);
  border-right: 1px solid rgba(252, 154, 10, 0.12);
  padding: 1.25rem 1rem;
  display: flex; flex-direction: column;
}

.brand { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1.25rem; padding-bottom: 0.85rem; border-bottom: 1px solid var(--border); }
.brand-logo { width: 36px; height: 36px; object-fit: contain; filter: drop-shadow(0 0 6px var(--primary-glow)); }
.brand-title { font-size: 1.1rem; font-weight: 700; letter-spacing: 0.06em; color: var(--primary); }
.brand-badge {
  font-size: 0.65rem; margin-top: 2px;
  background: rgba(252, 154, 10, 0.15);
  color: var(--primary); padding: 1px 6px; border-radius: 4px; display: inline-block;
}


/* ─── Sanctuary Panel ──────────────────────────────── */
.sanct-panel {
  background: rgba(0,0,0,0.28);
  border: 1px solid rgba(252,154,10,0.18);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  margin-bottom: 1.1rem;
}

.sanct-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.sanct-panel-title {
  font-size: 0.68rem;
  text-transform: uppercase;
  color: var(--primary);
  font-weight: 700;
  letter-spacing: 0.07em;
}

.sanct-add-btn {
  width: 22px; height: 22px;
  background: rgba(252,154,10,0.12);
  border: 1px solid rgba(252,154,10,0.3);
  border-radius: 5px;
  color: var(--primary);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
.sanct-add-btn:hover { background: rgba(252,154,10,0.28); }

.sanct-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  max-height: 180px;
  overflow-y: auto;
}

.sanct-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.38rem 0.55rem;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid transparent;
  font-size: 0.8rem;
  color: var(--text-muted);
  min-width: 0;
}

.sanct-item:hover { background: rgba(255,255,255,0.04); color: var(--text); }

.sanct-item.active {
  background: rgba(252,154,10,0.1);
  border-color: rgba(252,154,10,0.3);
  color: var(--primary);
}

.sanct-item-icon { font-size: 0.75rem; flex-shrink: 0; }

.sanct-item-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.sanct-item-default {
  font-size: 0.62rem;
  background: rgba(252,154,10,0.12);
  color: var(--primary);
  padding: 1px 5px;
  border-radius: 4px;
  flex-shrink: 0;
  font-weight: 600;
}

.sanct-item-actions {
  display: none;
  gap: 0.25rem;
  flex-shrink: 0;
}

.sanct-item:hover .sanct-item-actions { display: flex; }

.sanct-action-btn {
  width: 20px; height: 20px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  font-size: 0.65rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: all 0.12s;
}
.sanct-action-btn:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.sanct-action-btn.delete:hover { background: rgba(239,68,68,0.2); border-color: rgba(239,68,68,0.4); color: #ef4444; }



.nav-menu { display: flex; flex-direction: column; gap: 0.35rem; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.65rem 0.85rem;
  background: transparent; border: 1px solid transparent;
  border-radius: 8px; color: var(--text-muted);
  font-size: 0.875rem; font-weight: 500; cursor: pointer;
  transition: all 0.18s ease; text-align: left; width: 100%;
}
.nav-item:hover { background: rgba(252,154,10,0.07); color: var(--text); border-color: rgba(252,154,10,0.15); }
.nav-item.active { background: rgba(252,154,10,0.12); border-color: rgba(252,154,10,0.35); color: var(--primary); }
.nav-icon { font-size: 1rem; }

.sidebar-footer { border-top: 1px solid var(--border); padding-top: 0.85rem; display: flex; flex-direction: column; gap: 0.6rem; }
.status-indicator { display: flex; align-items: center; gap: 0.5rem; font-size: 0.78rem; color: var(--text-muted); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 7px var(--accent); }

/* ─── Main Content ────────────────────────────────── */
.main-content { flex: 1; padding: 1.75rem 2rem; display: flex; flex-direction: column; gap: 1.25rem; overflow-y: auto; }

.topbar { display: flex; justify-content: space-between; align-items: flex-start; }
.topbar-info h1 { font-size: 1.4rem; font-weight: 700; }
.topbar-info p  { color: var(--text-muted); font-size: 0.82rem; margin-top: 0.2rem; }

/* ─── Tab Panels ──────────────────────────────────── */
.tab-panel { display: none; flex-direction: column; gap: 1.25rem; }
.tab-panel.active { display: flex; }

/* ─── Sub-tabs (Pyralis) ──────────────────────────── */
.sub-tabs { display: flex; gap: 0.5rem; }
.sub-tab {
  padding: 0.45rem 1rem; border-radius: 6px; font-size: 0.82rem; font-weight: 500;
  background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  color: var(--text-muted); cursor: pointer; transition: all 0.15s;
}
.sub-tab:hover { background: rgba(252,154,10,0.07); color: var(--text); }
.sub-tab.active { background: rgba(252,154,10,0.14); border-color: rgba(252,154,10,0.4); color: var(--primary); }

.sub-panel { display: none; }
.sub-panel.active { display: block; }
.sub-panel.hidden { display: none; }

/* ─── Cards ───────────────────────────────────────── */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px; padding: 1.4rem;
}
.glass-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.4rem; }

/* ─── Action Bar ──────────────────────────────────── */
.action-bar { display: flex; align-items: center; gap: 0.85rem; }
.spacer { flex: 1; }

.badge {
  background: rgba(255,255,255,0.05); padding: 0.2rem 0.7rem;
  border-radius: 20px; font-size: 0.78rem; color: var(--text-muted);
}

/* ─── Buttons ─────────────────────────────────────── */
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #0a0a0f; border: none;
  padding: 0.55rem 1.15rem; border-radius: 8px;
  font-weight: 700; font-size: 0.83rem; cursor: pointer;
  transition: all 0.18s ease;
}
.btn-primary:hover { opacity: 0.88; box-shadow: 0 0 18px var(--primary-glow); }

.btn-secondary {
  background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  color: var(--text); padding: 0.55rem 1.15rem; border-radius: 8px;
  font-weight: 500; font-size: 0.83rem; cursor: pointer; transition: all 0.15s;
}
.btn-secondary:hover { background: rgba(255,255,255,0.09); }

.btn-danger { background: linear-gradient(135deg, #ef4444, #b91c1c); color: #fff; }
.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.73rem; }

/* ─── Tables ──────────────────────────────────────── */
.table-container { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.83rem; }
.data-table th, .data-table td { padding: 0.75rem 0.9rem; border-bottom: 1px solid var(--border); }
.data-table th { color: var(--text-muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
.data-table tbody tr:hover { background: rgba(255,255,255,0.02); }

/* ─── Forms ───────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.85rem; }
.form-group label { font-size: 0.78rem; color: var(--text-muted); font-weight: 500; }
.form-group input,
.form-group select,
.form-group textarea {
  padding: 0.6rem 0.8rem;
  background: rgba(0,0,0,0.4); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); font-size: 0.83rem;
  font-family: inherit; outline: none; transition: border-color 0.15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--primary); box-shadow: 0 0 8px var(--primary-glow); }
.form-group textarea { resize: vertical; min-height: 90px; font-family: 'JetBrains Mono', monospace; font-size: 0.78rem; }

/* Checkboxes List in Modals */
.roles-checkbox-list {
  display: flex; flex-direction: column; gap: 0.4rem;
  max-height: 140px; overflow-y: auto;
  padding: 0.6rem; background: rgba(0,0,0,0.3);
  border: 1px solid var(--border); border-radius: 6px;
}
.checkbox-label {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.82rem; cursor: pointer; color: var(--text);
}
.checkbox-label input[type="checkbox"] {
  accent-color: var(--primary); width: 15px; height: 15px;
}

.code-preview {
  background: rgba(0,0,0,0.55); border: 1px solid var(--border);
  border-radius: 8px; padding: 1rem;
  font-family: 'JetBrains Mono', monospace; font-size: 0.78rem;
  color: #fcd28b; word-break: break-all; white-space: pre-wrap;
  margin-top: 0.85rem; max-height: 260px; overflow-y: auto;
  min-height: 48px;
}

/* ─── Result Box (IAM eval) ───────────────────────── */
.result-box {
  display: flex; align-items: center; gap: 1rem;
  margin-top: 1rem; padding: 0.85rem 1rem;
  border-radius: 8px; background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
}
.result-badge {
  font-size: 0.75rem; font-weight: 700; padding: 0.25rem 0.65rem;
  border-radius: 6px; background: var(--accent); color: #fff;
  letter-spacing: 0.06em;
}

/* ─── Grids ───────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.85rem; }

/* ─── Modals ──────────────────────────────────────── */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.82); backdrop-filter: blur(10px);
  z-index: 1000; display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
}
.modal.active { opacity: 1; pointer-events: auto; }
.modal-card {
  background: #111118; border: 1px solid rgba(252,154,10,0.2);
  border-radius: 14px; padding: 2rem; width: 100%; max-width: 520px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.6), 0 0 30px var(--primary-glow);
}
.modal-card h3 { margin-bottom: 1.25rem; font-size: 1rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.65rem; margin-top: 1.25rem; }

/* ─── Utilities ───────────────────────────────────── */
.hidden  { display: none !important; }
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }
code { font-family: 'JetBrains Mono', monospace; font-size: 0.78rem; color: var(--primary); }
