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

:root {
  --bg:     #0f1117;
  --bg2:    #1a1d27;
  --bg3:    #22263a;
  --border: #2e3248;
  --text:   #e8eaf0;
  --text2:  #8b90a8;
  --accent: #4f8ef7;
  --accent-dim: #1e3a6e;
  --green:  #34d399;
  --red:    #f87171;
  --yellow: #fbbf24;
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

.hidden { display: none !important; }

/* ── Header ── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.01em;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius);
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s, background .15s;
  white-space: nowrap;
  font-family: var(--font);
  text-decoration: none;
  min-height: 44px;
}
.btn:hover  { opacity: .85; }
.btn:active { opacity: .65; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-ghost   { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-danger  { background: var(--red); color: #fff; }
.btn-full    { width: 100%; }

.btn-sm { padding: 6px 12px; font-size: 13px; min-height: 34px; }

/* ── Cards ── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

/* ── Forms ── */
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: .04em;
}

input[type="text"],
input[type="date"],
select,
textarea {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 16px;
  padding: 12px 14px;
  width: 100%;
  font-family: var(--font);
  transition: border-color .15s;
  min-height: 48px;
  appearance: none;
  -webkit-appearance: none;
}
input[type="date"] { cursor: pointer; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}
input::placeholder { color: var(--text2); }

/* ── Toast ── */
#toast {
  position: fixed;
  bottom: max(24px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  white-space: nowrap;
  z-index: 999;
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
  max-width: calc(100vw - 32px);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { border-color: var(--red); color: var(--red); }
#toast.success { border-color: var(--green); color: var(--green); }

/* ── Modal ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 400px;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
}
.modal h2 { font-size: 18px; margin-bottom: 16px; }
.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}
.modal-actions .btn-ghost { margin-left: auto; }

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

/* ── Misc ── */
.text-muted { color: var(--text2); }
.text-sm    { font-size: 13px; }
.text-xs    { font-size: 11px; }
