:root {
  --bg:          #edf2f7;
  --sidebar:     #4a6080;
  --sidebar-h:   #5a7299;
  --sidebar-act: #6b87b0;
  --sidebar-txt: #e8edf5;
  --card:        #ffffff;
  --primary:     #5b85b8;
  --primary-h:   #4a74a7;
  --text:        #2d3748;
  --muted:       #718096;
  --border:      #e2e8f0;
  --success:     #48bb78;
  --danger:      #e05555;
  --warning:     #e88c30;
}

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

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

/* ── LOGIN ────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #c8d8ed 0%, #dde7f3 50%, #e8f0f9 100%);
}
.login-card {
  background: var(--card);
  border-radius: 12px;
  padding: 40px;
  width: 360px;
  box-shadow: 0 4px 24px rgba(74,96,128,.18);
}
.login-logo {
  text-align: center;
  margin-bottom: 28px;
}
.login-logo h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--sidebar);
}
.login-logo p { color: var(--muted); font-size: 13px; margin-top: 4px; }

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

.sidebar {
  width: 220px;
  min-height: 100vh;
  background: var(--sidebar);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0;
  bottom: 0;
}
.sidebar-logo {
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-logo span {
  display: block;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .3px;
}
.sidebar-logo small { color: var(--sidebar-txt); font-size: 11px; opacity: .75; }

.nav-section { padding: 10px 0 4px; }
.nav-label {
  padding: 4px 16px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: rgba(255,255,255,.45);
  font-weight: 600;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 16px;
  color: var(--sidebar-txt);
  cursor: pointer;
  border-radius: 0;
  transition: background .15s;
  user-select: none;
}
.nav-item:hover { background: var(--sidebar-h); }
.nav-item.active { background: var(--sidebar-act); color: #fff; font-weight: 600; }
.nav-item svg { flex-shrink: 0; opacity: .85; }

.sidebar-footer {
  margin-top: auto;
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.1);
}
.user-info { color: var(--sidebar-txt); font-size: 12px; }
.user-info strong { display: block; color: #fff; font-size: 13px; }
.btn-logout {
  margin-top: 8px;
  width: 100%;
  padding: 7px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 6px;
  color: var(--sidebar-txt);
  cursor: pointer;
  font-size: 12px;
  transition: background .15s;
}
.btn-logout:hover { background: rgba(255,255,255,.2); }

/* ── MAIN CONTENT ─────────────────────────────── */
.main { margin-left: 220px; flex: 1; display: flex; flex-direction: column; }

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar h2 { font-size: 17px; font-weight: 600; color: var(--text); }
.breadcrumb { font-size: 12px; color: var(--muted); margin-top: 2px; }
.breadcrumb span { cursor: pointer; color: var(--primary); }
.breadcrumb span:hover { text-decoration: underline; }

.content { padding: 24px; }

/* ── CARDS & TABLES ───────────────────────────── */
.card {
  background: var(--card);
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header h3 { font-size: 15px; font-weight: 600; }
.card-body { padding: 0; }

table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 10px 14px;
  background: #f7fafc;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--muted);
  white-space: nowrap;
}
tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f7fafc; }

/* ── BUTTONS ──────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 7px;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background .15s, opacity .15s;
  white-space: nowrap;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-h); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { background: #3da868; }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled)  { background: #c94a4a; }
.btn-secondary { background: #e2e8f0; color: var(--text); }
.btn-secondary:hover:not(:disabled) { background: #cbd5e0; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 5px 8px; }

/* ── FORMS ────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 5px;
}
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 13px;
  color: var(--text);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(91,133,184,.15);
}
.form-control[readonly] {
  background: #eef1f6;
  color: #6b7a90;
  cursor: default;
  border-color: #d4dae4;
}
.form-control[readonly]:focus {
  border-color: #d4dae4;
  box-shadow: none;
}
.form-row { display: grid; gap: 12px; }
.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }

/* ── MODAL ────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(30,40,60,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal {
  background: var(--card);
  border-radius: 12px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 40px rgba(0,0,0,.2);
}
.modal-sm { max-width: 420px; }
.modal-md { max-width: 600px; }
.modal-lg { max-width: 860px; }
.modal-header {
  padding: 18px 24px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h4 { font-size: 16px; font-weight: 600; }
.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ── BADGES ───────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.badge-success { background: #c6f6d5; color: #276749; }
.badge-warning { background: #feebc8; color: #7b3e00; }
.badge-danger  { background: #fed7d7; color: #9b2c2c; }
.badge-info    { background: #bee3f8; color: #2a69ac; }
.badge-muted   { background: #e2e8f0; color: #4a5568; }

/* ── ALERTS ───────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
}
.alert-danger  { background: #fff5f5; border: 1px solid #feb2b2; color: #9b2c2c; }
.alert-success { background: #f0fff4; border: 1px solid #9ae6b4; color: #276749; }

/* ── MISC ─────────────────────────────────────── */
.text-muted { color: var(--muted); }
.text-right { text-align: right; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.gap-2 { display: flex; gap: 8px; }
.flex-center { display: flex; align-items: center; }
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}
.empty-state p { margin-top: 8px; font-size: 13px; }
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
[x-cloak] { display: none !important; }
