:root {
  --navy:      #0d1b2a;
  --navy-2:    #142235;
  --navy-3:    #1e3352;
  --amber:     #e8a000;
  --amber-dim: rgba(232,160,0,0.1);
  --green:     #22c55e;
  --red:       #ef4444;
  --danger:    #dc2626;
  --cream:     #f2efe9;
  --surface:   #ffffff;
  --surface-2: #f7f4ef;
  --border:    #e8e4dd;
  --text:      #0d1b2a;
  --text-2:    #4a5568;
  --text-3:    #94a3b8;
  --sidebar-w: 240px;
  --topbar-h:  60px;
  --t:         0.2s ease;
  --radius:    10px;
  --shadow-sm: 0 1px 3px rgba(13,27,42,0.06), 0 2px 8px rgba(13,27,42,0.04);
  --shadow:    0 2px 6px rgba(13,27,42,0.08), 0 8px 20px rgba(13,27,42,0.05);
}

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

body {
  font-family: -apple-system, 'Segoe UI', system-ui, sans-serif;
  background: var(--cream);
  color: var(--text);
  min-height: 100vh;
  display: flex;
}

/* ── SIDEBAR ────────────────────────────────────────── */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--navy);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow: hidden;
}

.sidebar::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
}

.sb-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}

.sb-mark {
  width: 30px; height: 30px;
  background: var(--amber);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  color: var(--navy);
  flex-shrink: 0;
  letter-spacing: -0.03em;
}

.sb-name {
  font-size: 16px;
  font-weight: 700;
  color: rgba(255,255,255,0.88);
  letter-spacing: 0.04em;
}

.sb-nav {
  flex: 1;
  padding: 14px 0;
  position: relative;
  z-index: 1;
  overflow-y: auto;
}

.sb-section {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.22);
  padding: 10px 20px 4px;
  margin-top: 6px;
}

.sb-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  font-size: 13.5px;
  font-weight: 500;
  color: rgba(255,255,255,0.48);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background var(--t), color var(--t), border-color var(--t);
  margin: 1px 0;
  user-select: none;
}

.sb-item:hover {
  background: rgba(255,255,255,0.055);
  color: rgba(255,255,255,0.82);
  text-decoration: none;
}

.sb-item.active {
  background: var(--amber-dim);
  color: var(--amber);
  border-left-color: var(--amber);
  font-weight: 600;
}

.sb-item i { font-size: 16px; flex-shrink: 0; }

.sb-bottom {
  padding: 12px 0 10px;
  border-top: 1px solid rgba(255,255,255,0.06);
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}

/* ── MAIN LAYOUT ────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 50;
  flex-shrink: 0;
}

.env-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px 3px 7px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
}

.env-dot {
  width: 6px; height: 6px;
  background: var(--green);
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(34,197,94,0.2);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-divider { width: 1px; height: 18px; background: var(--border); }

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}

.user-avatar {
  width: 28px; height: 28px;
  background: var(--navy-3);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--amber);
  font-size: 13px;
}

.content { flex: 1; padding: 36px 32px 48px; }

/* ── MOBILE ─────────────────────────────────────────── */
.mob-toggle {
  display: none;
  position: fixed;
  top: 13px; left: 13px;
  z-index: 200;
  width: 36px; height: 36px;
  background: var(--navy);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 17px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.sb-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
}

.sb-overlay.show { display: block; }

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.26s ease; }
  .sidebar.open { transform: translateX(0); }
  .mob-toggle { display: flex; }
  .main { margin-left: 0; }
  .topbar { padding: 0 16px 0 58px; }
  .content { padding: 24px 16px 40px; }
}

/* ── PAGE HEADER (shared) ───────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title { font-size: 24px; font-weight: 800; letter-spacing: -0.03em; color: var(--text); }
.page-sub   { font-size: 13px; color: var(--text-3); margin-top: 2px; }

/* ── PRIMARY BUTTON (shared) ────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  background: var(--navy);
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--t), transform 0.12s;
}

.btn-primary:hover {
  background: var(--navy-3);
  color: #fff;
  text-decoration: none;
  transform: translateY(-1px);
}

/* ── TABLE CARD (shared) ────────────────────────────── */
.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.table-card table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

.table-card thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table-card tbody tr { border-bottom: 1px solid var(--border); transition: background var(--t); }
.table-card tbody tr:last-child { border-bottom: none; }
.table-card tbody tr:hover { background: var(--surface-2); }
.table-card tbody td { padding: 13px 16px; vertical-align: middle; }

.cell-name    { font-weight: 600; color: var(--text); }
.cell-date    { color: var(--text-3); font-size: 12.5px; white-space: nowrap; }
.cell-actions { white-space: nowrap; }
.cell-empty   { text-align: center; padding: 48px 16px; color: var(--text-3); font-size: 14px; }

/* ── ROW ACTION BUTTONS (shared) ────────────────────── */
.btn-edit, .btn-del {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: none;
  border-radius: 5px;
  font-size: 12.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--t), color var(--t);
  text-decoration: none;
}

.btn-edit { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); margin-right: 4px; }
.btn-edit:hover { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn-del  { background: transparent; color: var(--text-3); border: 1px solid transparent; }
.btn-del:hover { background: #fef2f2; color: var(--red); border-color: rgba(239,68,68,0.2); }

/* ── MODAL (shared) ─────────────────────────────────── */
.modal-content { border-radius: var(--radius); border: 1px solid var(--border); }
.modal-header  { border-bottom: 1px solid var(--border); padding: 16px 20px; }
.modal-title   { font-size: 16px; font-weight: 700; color: var(--text); }
.modal-body    { padding: 20px; }
.modal-footer  { border-top: 1px solid var(--border); padding: 14px 20px; }
.btn-close     { opacity: 0.5; }
.btn-close:hover { opacity: 1; }

.form-label    { font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-2); margin-bottom: 6px; }
.form-control, .form-select { border: 1.5px solid var(--border); border-radius: 7px; font-size: 14px; height: 42px; color: var(--text); transition: border-color var(--t); }
.form-control:focus, .form-select:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(13,27,42,0.07); }

.btn-confirm {
  height: 38px;
  padding: 0 18px;
  background: var(--navy);
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--t);
}

.btn-confirm:hover { background: var(--navy-3); }

.btn-confirm-danger       { background: var(--red); }
.btn-confirm-danger:hover { background: #dc2626; }

.btn-cancel {
  height: 38px;
  padding: 0 16px;
  background: transparent;
  color: var(--text-2);
  border: 1.5px solid var(--border);
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: border-color var(--t);
  margin-right: 6px;
}

.btn-cancel:hover { border-color: var(--text-2); }

.modal-error {
  display: none;
  align-items: center;
  gap: 7px;
  background: #fef2f2;
  border: 1px solid rgba(239,68,68,0.2);
  border-left: 3px solid var(--red);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12.5px;
  color: #991b1b;
  font-weight: 500;
  margin-top: 12px;
}

.modal-error.show { display: flex; }

@keyframes spin { to { transform: rotate(360deg); } }
