/* score_new — Airbnb-inspired theme (Rausch coral, ink black, soft cloud) */

:root {
  /* Airbnb tokens */
  --rausch: #ff385c;
  --rausch-deep: #e00b41;
  --ink: #222222;
  --charcoal: #3f3f3f;
  --ash: #6a6a6a;
  --mute: #929292;
  --stone: #c1c1c1;
  --hairline: #dddddd;
  --cloud: #f7f7f7;
  --canvas: #ffffff;
  --error: #c13515;
  --info: #428bff;

  /* Bootstrap variable overrides (must come BEFORE bootstrap.min.css in markup
     won't actually cascade; we override per-element below) */
  --bs-primary: var(--rausch);
  --bs-primary-rgb: 255, 56, 92;
  --bs-border-radius: 8px;
  --bs-body-font-family: -apple-system, BlinkMacSystemFont, "Airbnb Cereal VF",
    "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--canvas);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Airbnb Cereal VF",
    "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-weight: 500;
  font-size: 16px;
  line-height: 1.25;
  -webkit-font-smoothing: antialiased;
}

body {
  padding-bottom: 72px; /* leave space for the fixed bottom tab bar */
}

a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--rausch); text-decoration: underline; }

h1, .h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: 0; margin: 0 0 .5rem; }
h2, .h2 { font-size: 1.38rem; font-weight: 500; letter-spacing: -0.018em; margin: 1.25rem 0 .5rem; }
h3, .h3 { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.01em; margin: 1rem 0 .5rem; }
.h-page { font-size: 1.5rem; font-weight: 700; letter-spacing: -.01em; }
.text-secondary, .text-secondary-c { color: var(--ash) !important; }
.text-mute { color: var(--mute); }
.text-ink { color: var(--ink); }
.text-rausch { color: var(--rausch) !important; }
small, .small { font-size: .875rem; font-weight: 500; color: var(--ash); }

/* ============= Cards ============= */
.card-canvas {
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 16px;
}
.card-canvas.elev {
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 24px;
  box-shadow: rgba(0,0,0,0.02) 0 0 0 1px, rgba(0,0,0,0.04) 0 2px 6px 0, rgba(0,0,0,0.1) 0 4px 8px 0;
}
.card-cloud {
  background: var(--cloud);
  border-radius: 12px;
  padding: 16px;
}

/* ============= Buttons ============= */
.btn {
  font-weight: 500;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 14px;
  line-height: 1.29;
  border: 1px solid transparent;
  transition: transform .08s ease;
}
.btn:active { transform: scale(.96); }
.btn:focus-visible { box-shadow: 0 0 0 2px var(--ink); outline: none; }

.btn-rausch {
  background: var(--rausch);
  color: #fff;
  border-color: var(--rausch);
}
.btn-rausch:hover, .btn-rausch:focus {
  background: var(--rausch-deep);
  border-color: var(--rausch-deep);
  color: #fff;
}

.btn-ink {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.btn-ink:hover { background: #000; color: #fff; }

.btn-outline {
  background: #fff;
  color: var(--ink);
  border-color: var(--hairline);
}
.btn-outline:hover { border-color: var(--ink); }

.btn-ghost {
  background: transparent;
  color: var(--ink);
}

.btn-circle {
  background: #f2f2f2;
  color: var(--ink);
  width: 40px; height: 40px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: none;
  padding: 0;
}
.btn-circle:hover { background: #eaeaea; }

.btn-pill { border-radius: 999px; padding: 8px 16px; }
.btn-big { padding: 14px 24px; font-size: 16px; border-radius: 8px; }
.btn-block { width: 100%; }

/* ============= Form controls ============= */
.form-control, .form-select {
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
  background: var(--canvas);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.form-control:focus, .form-select:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px var(--ink);
  outline: none;
}
.form-control::placeholder { color: var(--mute); }
.form-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--ash);
  margin-bottom: 6px;
}

/* ============= Top appbar (minimal) ============= */
.appbar {
  background: #fff;
  border-bottom: 1px solid var(--hairline);
  padding: 12px 16px;
  position: sticky; top: 0; z-index: 1020;
  display: flex; align-items: center; gap: 12px;
}
.appbar .brand {
  font-size: 18px; font-weight: 700; color: var(--rausch);
  letter-spacing: -.01em; display: inline-flex; align-items: center; gap: 6px;
}
.appbar .user-chip { color: var(--ash); font-size: 13px; }

/* ============= Bottom tab bar (mobile-first; on desktop it sits centered) ============= */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: #fff;
  border-top: 1px solid var(--hairline);
  display: flex;
  z-index: 1030;
  height: 64px;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.tabbar a {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  padding-top: 6px;
}
.tabbar a i { font-size: 22px; margin-bottom: 2px; color: var(--ink); transition: color .15s ease; }
.tabbar a.active { color: var(--rausch); }
.tabbar a.active i { color: var(--rausch); }
.tabbar a:hover { text-decoration: none; }

/* ============= Auth pages ============= */
.auth-wrap {
  min-height: 100vh; display: flex; flex-direction: column;
  justify-content: center; padding: 24px 16px;
  background: #fff;
}
.auth-card {
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 28px 24px;
  background: #fff;
  max-width: 420px; width: 100%; margin: 0 auto;
  box-shadow: rgba(0,0,0,0.02) 0 0 0 1px, rgba(0,0,0,0.04) 0 2px 6px 0;
}

/* ============= Dashboard cards & charts ============= */
.chart-card {
  background: #fff;
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 10px 0;
  margin-bottom: 16px;
}
.chart-card .card-title {
  font-size: 18px; font-weight: 700; color: var(--ink);
  margin: 0 0 4px;
}
.chart-card .card-sub {
  font-size: 13px; font-weight: 500; color: var(--ash);
  margin: 0 0 12px;
}
.chart-box { height: 340px; width: 100%; margin: 0; padding: 0; }
.chart-box.tall { height: 380px; }

/* ============= Tables ============= */
.ak-table {
  width: 100%;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--hairline);
}
.ak-table table { width: 100%; border-collapse: collapse; margin: 0; }
.ak-table th {
  background: #f7f7f7;
  color: var(--ash);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: .02em;
  text-transform: uppercase;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--hairline);
}
.ak-table td {
  padding: 10px 12px;
  border-top: 1px solid var(--hairline);
  color: var(--ink);
  font-weight: 500;
  font-size: 14px;
  vertical-align: middle;
}
.ak-table tr.total-row td { background: #fff7f8; }
.ak-table input.form-control, .ak-table select.form-select {
  padding: 6px 8px; font-size: 14px; min-width: 70px;
  border-radius: 6px;
}

/* On mobile: collapse the subject entry table to card layout */
@media (max-width: 575.98px) {
  .ak-table.mobile-cards { background: transparent; border: 0; }
  .ak-table.mobile-cards table, .ak-table.mobile-cards tbody, .ak-table.mobile-cards tr, .ak-table.mobile-cards td {
    display: block; width: 100%;
  }
  .ak-table.mobile-cards thead { display: none; }
  .ak-table.mobile-cards tr {
    background: #fff; border: 1px solid var(--hairline);
    border-radius: 12px; margin-bottom: 12px; padding: 12px;
  }
  .ak-table.mobile-cards tr.total-row { border-color: var(--rausch); }
  .ak-table.mobile-cards td {
    display: flex; justify-content: space-between; align-items: center;
    border-top: 0; padding: 6px 0;
  }
  .ak-table.mobile-cards td::before {
    content: attr(data-label); color: var(--ash);
    font-size: 13px; margin-right: 12px; flex-shrink: 0;
  }
  .ak-table.mobile-cards td:first-child {
    font-weight: 700; padding-bottom: 6px;
    border-bottom: 1px dashed var(--hairline); margin-bottom: 6px;
  }
  .ak-table.mobile-cards td:first-child::before { content: ""; }
  .ak-table.mobile-cards input.form-control { max-width: 60%; }

  .chart-box { height: 260px; }
  .chart-box.tall { height: 300px; }
}

/* ============= Schools tabs (on both desktop & mobile) ============= */
.ak-tabs {
  display: flex; gap: 0; border-bottom: 1px solid var(--hairline);
  margin-bottom: 16px; overflow-x: auto;
}
.ak-tabs button {
  background: transparent; border: 0; color: var(--ink);
  padding: 12px 16px; font-weight: 500; font-size: 14px;
  border-bottom: 2px solid transparent; border-radius: 0;
  white-space: nowrap;
}
.ak-tabs button.active { border-bottom-color: var(--ink); font-weight: 700; }

/* ============= Extras ============= */
.kbd {
  display: inline-block; padding: 1px 6px;
  border: 1px solid var(--hairline); border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, monospace; font-size: 12px;
  color: var(--ink); background: #fff;
}
.divider {
  border: 0; border-top: 1px solid var(--hairline); margin: 16px 0;
}

/* Override Bootstrap small badge colors */
.badge.bg-info { background: var(--info) !important; color: #fff; }
.badge.bg-danger { background: var(--error) !important; color: #fff; }

/* Forms grid fallback when Bootstrap is not effective for color (we override) */
.text-error { color: var(--error); }
