/* ── Reset & Base ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }

/* ── Variables ────────────────────────────────────────────────────────── */
:root {
  --bg:        #0f172a;
  --surface:   #1e293b;
  --surface2:  #273449;
  --border:    #334155;
  --accent:    #3b82f6;
  --accent-h:  #2563eb;
  --green:     #22c55e;
  --red:       #ef4444;
  --yellow:    #f59e0b;
  --text:      #f1f5f9;
  --muted:     #94a3b8;
  --radius:    8px;
}

/* ── Utilities ────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.flex   { display: flex; }
.gap-2  { gap: 8px; }

/* ── Scrollbar ────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--radius); border: none;
  font-size: 13px; font-weight: 500; cursor: pointer; transition: all .15s;
}
.btn-primary  { background: var(--accent); color: #fff; }
.btn-primary:hover  { background: var(--accent-h); }
.btn-danger   { background: var(--red); color: #fff; }
.btn-danger:hover   { background: #dc2626; }
.btn-success  { background: var(--green); color: #fff; }
.btn-ghost    { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover    { color: var(--text); border-color: var(--muted); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ── Badge ────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600;
}
.badge-pending   { background: rgba(148,163,184,.2); color: var(--muted); }
.badge-active    { background: rgba(34,197,94,.15); color: var(--green); }
.badge-completed { background: rgba(59,130,246,.15); color: var(--accent); }
.badge-deviated  { background: rgba(239,68,68,.2); color: var(--red); }

/* ── Modals ───────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 16px;
}
.modal-box {
  background: var(--surface); border-radius: 12px; width: 100%; max-width: 500px;
  border: 1px solid var(--border); overflow: hidden;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { color: var(--text); font-size: 16px; }
.modal-close {
  background: none; border: none; color: var(--muted); cursor: pointer; font-size: 18px;
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  border-radius: 4px;
}
.modal-close:hover { background: var(--surface2); color: var(--text); }
.modal-body { padding: 20px; }

/* ── Form ─────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block; font-size: 12px; font-weight: 500;
  color: var(--muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .05em;
}
.form-group .optional { color: var(--border); font-size: 11px; text-transform: none; letter-spacing: 0; }
.form-group input, .form-group select {
  width: 100%; padding: 9px 12px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); font-size: 14px; outline: none; transition: border .15s;
}
.form-group input:focus, .form-group select:focus { border-color: var(--accent); }
.form-group input::placeholder { color: var(--border); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-actions {
  display: flex; justify-content: flex-end; gap: 10px;
  margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border);
}

/* ── Toasts ───────────────────────────────────────────────────────────── */
#toasts {
  position: fixed; bottom: 20px; right: 20px;
  display: flex; flex-direction: column; gap: 8px; z-index: 2000;
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px; border-radius: var(--radius);
  background: var(--surface2); border: 1px solid var(--border);
  min-width: 280px; max-width: 360px;
  animation: slideIn .2s ease; box-shadow: 0 4px 20px rgba(0,0,0,.4);
}
.toast-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.toast-msg  { font-size: 13px; color: var(--text); flex: 1; }
.toast-title { font-weight: 600; margin-bottom: 2px; }
.toast-sub  { color: var(--muted); font-size: 12px; }
.toast-success { border-left: 3px solid var(--green); }
.toast-error   { border-left: 3px solid var(--red); }
.toast-warning { border-left: 3px solid var(--yellow); }
.toast-info    { border-left: 3px solid var(--accent); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
