/* ── Variables ──────────────────────────────────────────────── */
:root {
  --bg:       #0f172a;
  --surface:  #1e293b;
  --surface2: #263248;
  --border:   #334155;
  --text:     #f1f5f9;
  --muted:    #94a3b8;
  --primary:  #16a34a;
  --primary-d:#15803d;
  --blue:     #3b82f6;
  --amber:    #f59e0b;
  --red:      #ef4444;
  --r:        8px;
  --r-lg:     12px;
  --shadow:   0 4px 24px rgba(0,0,0,.4);
}

.hidden { display: none !important; }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Montserrat', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}
input, select, textarea, button { font-family: inherit; font-size: inherit; }
a { color: var(--primary); text-decoration: none; }
button { cursor: pointer; border: none; background: none; color: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; }

#app { display: flex; min-height: 100vh; }

/* ── Login ──────────────────────────────────────────────────── */
#login-screen {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.brand { font-size: 24px; font-weight: 700; color: var(--primary); }
.login-logo p { color: var(--muted); margin-top: 6px; }

/* ── Forms ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.form-control {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text);
}
.form-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.form-check { display: flex; align-items: center; gap: 8px; cursor: pointer; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  padding: 10px 18px;
  border-radius: var(--r);
  font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background .15s;
}
.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover   { background: var(--primary-d); }
.btn-secondary { background: var(--surface2); color: var(--text); }
.btn-secondary:hover { background: var(--border); }
.btn-danger    { background: var(--red); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ── Sidebar ────────────────────────────────────────────────── */
#sidebar {
  width: 240px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 20px 12px;
  min-height: 100vh;
}
.sidebar-logo { padding: 0 8px 20px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.nav-section { font-size: 11px; text-transform: uppercase; color: var(--muted); padding: 12px 12px 6px; letter-spacing: .5px; }
.nav-item {
  display: block; width: 100%;
  text-align: left;
  padding: 9px 12px;
  border-radius: var(--r);
  color: var(--text);
  font-weight: 500;
  margin-bottom: 2px;
}
.nav-item:hover { background: var(--surface2); }
.nav-item.active { background: var(--primary); color: #fff; }

.sidebar-footer { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); }
.sidebar-user { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 6px; border-radius: var(--r); }
.sidebar-user:hover { background: var(--surface2); }
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff;
}

/* ── Content ────────────────────────────────────────────────── */
#content { flex: 1; padding: 28px; overflow: auto; }
.section-view { display: none; }
.section-view.active { display: block; }
h1 { font-size: 22px; margin-bottom: 18px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
}

/* ── Tables ─────────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
.table tbody tr:hover { background: var(--surface2); }

/* ── Modal ──────────────────────────────────────────────────── */
#modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
}
#modal-box {
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  width: 95%; max-width: 560px;
  max-height: 90vh; overflow: auto;
  box-shadow: var(--shadow);
}
#modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
#modal-body   { padding: 20px; }
#modal-footer { padding: 12px 20px; border-top: 1px solid var(--border); text-align: right; display: flex; justify-content: flex-end; gap: 8px; }

/* ── Toast ──────────────────────────────────────────────────── */
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
  box-shadow: var(--shadow);
  min-width: 260px;
}
.toast.success { border-left: 4px solid var(--primary); }
.toast.error   { border-left: 4px solid var(--red); }
.toast.warning { border-left: 4px solid var(--amber); }

/* ── Update banner ──────────────────────────────────────────── */
#update-banner {
  position: fixed; top: 0; left: 0; right: 0;
  background: var(--amber); color: #1f2937;
  padding: 10px 18px; text-align: center;
  font-weight: 500; font-size: 13px;
  z-index: 80; cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
#update-banner:hover { background: #fbbf24; }
