/* Base styles shared by every page. Track-specific styles go in their own css files. */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1c2330;
  --muted: #5d6778;
  --border: #dde1e7;
  --primary: #2457d6;
  --primary-ink: #ffffff;
  --error: #b42318;
  --error-bg: #fdecea;
  --tip: #9a6700;
  --tip-bg: #fff4d6;
  --ok: #1a7f37;
  --ok-bg: #e7f5ec;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--primary); }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 0.75rem; }
h3 { font-size: 1rem; margin: 1rem 0 0.5rem; }

.topbar { display: flex; align-items: center; gap: 1.5rem; padding: 0.6rem 1.25rem; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.brand { font-weight: 700; color: var(--text); text-decoration: none; white-space: nowrap; }
.nav { display: flex; gap: 0.25rem; flex-wrap: wrap; flex: 1; }
.nav a { padding: 0.35rem 0.6rem; border-radius: 6px; color: var(--muted); text-decoration: none; }
.nav a:hover { background: var(--bg); color: var(--text); }
.nav a.active { background: #e8eefc; color: var(--primary); font-weight: 600; }
.who { display: flex; align-items: center; gap: 0.5rem; color: var(--muted); white-space: nowrap; }
.bell { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 999px; text-decoration: none; font-size: 1.05rem; }
.bell:hover, .bell.active { background: var(--bg); }
.bell-count { position: absolute; top: -2px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--error); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }

.page { max-width: 1200px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }
.page--wide { max-width: none; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.auth-card { max-width: 380px; margin: 4rem auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.75rem; box-shadow: var(--shadow); }

.stack { display: flex; flex-direction: column; gap: 0.85rem; }
.row { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.inline { display: inline; }

label { display: flex; flex-direction: column; gap: 0.3rem; font-weight: 600; }
label.check { flex-direction: row; align-items: center; font-weight: 400; gap: 0.4rem; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=date], select, textarea {
  font: inherit; padding: 0.5rem 0.6rem; border: 1px solid var(--border); border-radius: 6px; background: #fff; color: var(--text); width: 100%;
}
textarea { resize: vertical; min-height: 2.6rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid #b9cbf6; border-color: var(--primary); }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem 1rem; margin: 0; }
legend { font-weight: 600; padding: 0 0.25rem; }

.btn { font: inherit; display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.45rem 0.9rem; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--bg); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: #1c47b3; }
.btn-danger { color: var(--error); border-color: #f1b5ae; }
.btn-link { border: none; background: none; color: var(--primary); padding: 0; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.alert { padding: 0.6rem 0.8rem; border-radius: 6px; margin: 0 0 1rem; }
.alert-error { background: var(--error-bg); color: var(--error); }
.alert-tip { background: var(--tip-bg); color: var(--tip); }
.alert-ok { background: var(--ok-bg); color: var(--ok); }

.badge { display: inline-block; padding: 0.1rem 0.45rem; border-radius: 999px; font-size: 0.78rem; font-weight: 600; background: #eef1f5; color: var(--muted); white-space: nowrap; }
.badge-error { background: var(--error-bg); color: var(--error); }
.badge-tip { background: var(--tip-bg); color: var(--tip); }
.badge-ok { background: var(--ok-bg); color: var(--ok); }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.is-over { color: var(--error); font-weight: 700; }
.is-tip { color: var(--tip); }

table.table { width: 100%; border-collapse: collapse; background: var(--surface); }
table.table th, table.table td { padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
table.table th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.02em; color: var(--muted); }
.table-wrap { overflow-x: auto; }

.toasts { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: 0.5rem; z-index: 100; }
.toast { background: var(--text); color: #fff; padding: 0.6rem 0.9rem; border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,.18); max-width: 420px; }
.toast-error { background: var(--error); }
.toast-ok { background: var(--ok); }
