/* Kolnox Schools. Mobile first, system fonts only (nothing to download). */
:root {
  --brand: #B85C1F;
  --brand-dark: #8f4513;
  --brand-tint: #fbf1ea;
  --brand-line: #edd3c1;
  --ink: #1d1a17;
  --muted: #6b645d;
  --line: #e6e0d8;
  --bg: #f7f5f0;
  --card: #ffffff;
  --ok: #1f7a43;
  --ok-tint: #e7f4ec;
  --warn: #9a6200;
  --warn-tint: #fdf3dd;
  --bad: #b23b3b;
  --bad-tint: #fbeaea;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(29, 26, 23, .06), 0 1px 1px rgba(29, 26, 23, .04);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
a { color: var(--brand-dark); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.boot, .noscript { padding: 3rem 1rem; text-align: center; color: var(--muted); }
.hidden { display: none !important; }

/* ── Buttons & forms ─────────────────────────────────────────────── */
button, .btn {
  font: inherit; font-weight: 600; cursor: pointer;
  border: 1px solid var(--brand); background: var(--brand); color: #fff;
  padding: .6rem 1rem; border-radius: 10px; min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  text-decoration: none;
}
button:hover, .btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
button:disabled { opacity: .6; cursor: progress; }
button.secondary, .btn.secondary { background: #fff; color: var(--brand-dark); border-color: var(--brand-line); }
button.secondary:hover, .btn.secondary:hover { background: var(--brand-tint); }
button.link { background: none; border: none; color: var(--brand-dark); padding: .25rem; min-height: 0; text-decoration: underline; font-weight: 500; }
button.danger { background: #fff; color: var(--bad); border-color: #e7c3c3; }
button.danger:hover { background: var(--bad-tint); }
button.small, .btn.small { padding: .3rem .7rem; min-height: 34px; font-size: .85rem; }

label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .75rem; }
label .hint { display: block; font-weight: 400; color: var(--muted); font-size: .8rem; }
input, select, textarea {
  display: block; width: 100%; margin-top: .3rem;
  font: inherit; color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: 10px; padding: .6rem .7rem; min-height: 44px;
}
input:focus, select:focus, textarea:focus, button:focus-visible, .btn:focus-visible {
  outline: 3px solid rgba(184, 92, 31, .35); outline-offset: 1px; border-color: var(--brand);
}
input[type=file] { padding: .5rem; }
.row { display: grid; gap: .75rem; }
@media (min-width: 560px) { .row.two { grid-template-columns: 1fr 1fr; } .row.three { grid-template-columns: repeat(3, 1fr); } }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .5rem; }
.inline-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; }
.inline-form label { margin: 0; flex: 1 1 180px; }

/* ── Auth ────────────────────────────────────────────────────────── */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem 1rem; }
.auth-card { width: 100%; max-width: 420px; }
.logo { display: flex; align-items: center; gap: .6rem; font-size: 1.25rem; margin-bottom: 1.25rem; }
.logo .mark { width: 36px; height: 36px; border-radius: 9px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; }
.logo b { color: var(--brand); }
.segmented { display: grid; grid-template-columns: 1fr 1fr; background: #ece6de; border-radius: 10px; padding: 3px; margin-bottom: 1rem; }
.segmented button { background: transparent; color: var(--ink); border: 0; min-height: 40px; font-weight: 600; }
.segmented button[aria-pressed=true] { background: #fff; box-shadow: var(--shadow); color: var(--brand-dark); }
.invite-banner { background: var(--brand-tint); border: 1px solid var(--brand-line); border-radius: var(--radius); padding: .9rem 1rem; margin-bottom: 1rem; }
.invite-banner strong { color: var(--brand-dark); }

/* ── App shell ───────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 5;
  background: #1d1a17; color: #fff;
  display: flex; align-items: center; gap: .75rem; padding: .6rem 1rem;
}
.topbar .brand { font-weight: 700; white-space: nowrap; }
.topbar .brand b { color: #f0a46e; }
.topbar .ctx { flex: 1; min-width: 0; font-size: .85rem; opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar button { background: transparent; border-color: rgba(255, 255, 255, .25); color: #fff; min-height: 36px; padding: .3rem .7rem; font-size: .85rem; }
.topbar button:hover { background: rgba(255, 255, 255, .1); }
.tabs { display: flex; gap: .25rem; overflow-x: auto; background: #fff; border-bottom: 1px solid var(--line); padding: 0 .5rem; position: sticky; top: 52px; z-index: 4; }
.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; border-radius: 0; color: var(--muted); padding: .75rem .8rem; min-height: 0; font-weight: 600; white-space: nowrap; }
.tabs button[aria-current=page] { color: var(--brand-dark); border-bottom-color: var(--brand); }
.tabs button:hover { background: var(--brand-tint); }
main { max-width: 960px; margin: 0 auto; padding: 1rem; }
.env-ribbon { background: #2f6db5; color: #fff; text-align: center; font-size: .75rem; padding: .2rem; }

/* ── Cards, lists, tables ────────────────────────────────────────── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.card h2 { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; margin-bottom: 1rem; }
@media (min-width: 700px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem; }
.stat .n { font-size: 1.6rem; font-weight: 700; color: var(--brand-dark); }
.stat .l { font-size: .8rem; color: var(--muted); }
.steps { list-style: none; padding: 0; margin: 0; }
.steps li { display: flex; gap: .75rem; align-items: center; padding: .6rem 0; border-top: 1px solid var(--line); }
.steps li:first-child { border-top: 0; }
.steps .tick { width: 26px; height: 26px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; font-weight: 700; background: #ece6de; color: var(--muted); }
.steps .done .tick { background: var(--ok); color: #fff; }
.steps .grow { flex: 1; }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: .75rem; padding: .7rem .2rem; border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 600; }
.list button.rowlink { background: none; border: 0; color: inherit; text-align: left; padding: 0; min-height: 0; font-weight: inherit; display: block; width: 100%; }
.list button.rowlink:hover .title { color: var(--brand-dark); text-decoration: underline; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; background: #fff; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #faf8f4; font-size: .8rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }

.badge { display: inline-block; font-size: .75rem; font-weight: 700; padding: .15rem .5rem; border-radius: 999px; background: #ece6de; color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-tint); color: var(--ok); }
.badge.warn { background: var(--warn-tint); color: var(--warn); }
.badge.bad { background: var(--bad-tint); color: var(--bad); }
.badge.brand { background: var(--brand-tint); color: var(--brand-dark); }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip { display: inline-flex; align-items: center; gap: .25rem; font-size: .8rem; background: var(--brand-tint); color: var(--brand-dark); border: 1px solid var(--brand-line); border-radius: 999px; padding: .1rem .2rem .1rem .6rem; }
.chip button { background: none; border: 0; color: inherit; min-height: 0; padding: 0 .35rem; font-size: 1rem; line-height: 1; }

.notice { border-radius: 10px; padding: .75rem .9rem; margin-bottom: 1rem; font-size: .9rem; }
.notice.info { background: var(--brand-tint); border: 1px solid var(--brand-line); }
.notice.warn { background: var(--warn-tint); border: 1px solid #f0d9a6; }
.notice.bad { background: var(--bad-tint); border: 1px solid #ecc5c5; }
.notice.ok { background: var(--ok-tint); border: 1px solid #bfe0cb; }
.notes { margin: .2rem 0 0; padding-left: 1rem; font-size: .82rem; }
.notes li.err { color: var(--bad); }
.notes li.wrn { color: var(--warn); }

.share { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.share input { flex: 1 1 240px; margin: 0; font-size: .85rem; }
.empty { text-align: center; color: var(--muted); padding: 1.5rem .5rem; }
.back { margin-bottom: .75rem; }

.portal-grid { display: grid; gap: .75rem; }
.portal-card { display: flex; align-items: center; justify-content: flex-start; gap: .9rem; text-align: left; width: 100%; background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; min-height: 72px; box-shadow: var(--shadow); }
.portal-card:hover { background: var(--brand-tint); border-color: var(--brand-line); }
.portal-card .icon { width: 44px; height: 44px; border-radius: 10px; background: var(--brand-tint); display: grid; place-items: center; font-size: 1.3rem; flex: none; }
.portal-card .t { font-weight: 700; }
.portal-card .s { font-size: .85rem; color: var(--muted); font-weight: 400; }

#toast { position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%); z-index: 50; max-width: calc(100% - 2rem); }
#toast .t { background: #1d1a17; color: #fff; padding: .7rem 1rem; border-radius: 10px; margin-top: .5rem; box-shadow: 0 6px 20px rgba(0, 0, 0, .2); font-size: .9rem; }
#toast .t.bad { background: var(--bad); }
#toast .t.ok { background: var(--ok); }

/* Import review: one card per row, readable on a phone */
.review-list { list-style: none; margin: 0; padding: 0; }
.review-row { padding: .8rem 1rem; margin-bottom: .6rem; }
.review-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .2rem; }
@media (max-width: 420px) { .topbar .brand { display: none; } }
