/* RMETI portal — one small stylesheet.
   Identity: cool slate + a single warm copper accent (electrical conductor). */

:root {
  --paper:    #f6f7f9;
  --surface:  #ffffff;
  --ink:      #16202b;
  --muted:    #5b6776;
  --line:     #e3e7ec;
  --line-2:   #eef1f4;

  --accent:   #c2410c;   /* burnt copper */
  --accent-d: #9a330a;
  --steel:    #1f2a37;   /* header bar */

  --ok:       #15803d;
  --ok-bg:    #ecfdf3;
  --ok-line:  #abefc6;
  --bad:      #b42318;
  --bad-bg:   #fef3f2;
  --bad-line: #fecdc9;

  --radius:   10px;
  --shadow:   0 1px 2px rgba(16, 32, 43, .06), 0 1px 1px rgba(16, 32, 43, .04);
  --maxw:     880px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.55;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: .85rem 1.25rem;
  background: var(--steel);
  color: #fff;
  border-bottom: 3px solid var(--accent);
}
.brand { display: flex; align-items: center; gap: .65rem; text-decoration: none; color: #fff; }
.brand-mark { color: var(--accent); flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: 1.15rem; letter-spacing: .14em; }
.brand-text small { color: #aeb8c4; font-size: .72rem; letter-spacing: .02em; }

.site-nav { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.site-nav a { color: #d7dde4; text-decoration: none; font-size: .92rem; }
.site-nav a:hover { color: #fff; }
.nav-user { color: #aeb8c4; font-size: .85rem; }
.nav-cta {
  background: var(--accent);
  color: #fff !important;
  padding: .4rem .8rem;
  border-radius: 7px;
  font-weight: 600;
}
.nav-cta:hover { background: var(--accent-d); }

/* ── Layout ──────────────────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
  flex: 1 0 auto;
}
.site-footer {
  flex: none;
  text-align: center;
  color: var(--muted);
  font-size: .82rem;
  padding: 1.5rem;
  border-top: 1px solid var(--line);
}

h1 { font-size: 1.85rem; letter-spacing: -.02em; line-height: 1.15; margin: 0 0 .5rem; }
h2 { font-size: 1.2rem; letter-spacing: -.01em; margin: 0 0 .8rem; }
h3 { font-size: 1rem; margin: 1.2rem 0 .6rem; }
.subtitle { color: var(--muted); margin: 0 0 1.5rem; }

/* ── Hero (home) ─────────────────────────────────────────────────────────── */
.hero {
  padding: 1rem 0 2rem;
  border-left: 3px solid var(--accent);
  padding-left: 1.25rem;
  margin-bottom: 2.5rem;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: .16em;
  font-size: .72rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 .8rem;
}
.hero h1 { font-size: 2.3rem; }
.lede { color: var(--muted); font-size: 1.05rem; max-width: 46ch; margin: 1rem 0 1.6rem; }
.actions { display: flex; gap: .75rem; flex-wrap: wrap; }

.cards-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.feature h3 { margin-top: 0; }
.feature p { color: var(--muted); margin: 0; font-size: .92rem; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}
.card.narrow, .card.center { max-width: 480px; }
.card.center { margin-left: auto; margin-right: auto; text-align: center; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form { display: flex; flex-direction: column; gap: 1rem; max-width: 520px; }
.form label { display: flex; flex-direction: column; gap: .35rem; font-weight: 600; font-size: .9rem; }
.form input, .form select {
  font: inherit;
  font-weight: 400;
  padding: .6rem .7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
.form input:focus, .form select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
.form input:disabled { background: var(--line-2); color: var(--muted); }
.hint { font-weight: 400; color: var(--muted); font-size: .8rem; }
.form-links { margin-top: 1rem; font-size: .92rem; }
.form-links a { color: var(--accent); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: .6rem 1.1rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  text-align: center;
}
.btn:hover { border-color: #cfd6dd; background: #fbfcfd; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-d); border-color: var(--accent-d); }
.btn-ghost { background: transparent; }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger:hover { background: #97150c; border-color: #97150c; }
.btn-sm { padding: .35rem .7rem; font-size: .85rem; }

/* ── Flash ───────────────────────────────────────────────────────────────── */
.flash {
  border: 1px solid;
  border-radius: 8px;
  padding: .75rem 1rem;
  margin-bottom: 1.5rem;
  font-size: .92rem;
}
.flash-success { background: var(--ok-bg);  border-color: var(--ok-line);  color: var(--ok); }
.flash-error   { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad); }

/* ── Tables / data ───────────────────────────────────────────────────────── */
.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
.data th, .data td { text-align: left; padding: .55rem .65rem; border-bottom: 1px solid var(--line-2); }
.data th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.data tr:last-child td { border-bottom: 0; }

.facts { display: flex; flex-wrap: wrap; gap: 1.5rem 2.5rem; margin: 0; }
.facts dt { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; }
.facts dd { margin: .15rem 0 0; font-weight: 600; }

.pill { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.pill-ok { background: var(--ok-bg); color: var(--ok); }
.tag {
  display: inline-block; padding: .05rem .45rem; border-radius: 5px;
  background: var(--line-2); color: var(--muted); font-size: .72rem;
}
.muted { color: var(--muted); }
.small { font-size: .8rem; }
.empty { color: var(--muted); font-style: italic; }

/* ── Instructor dashboard ────────────────────────────────────────────────── */
.student-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.inline { display: inline; margin: 0; }

details.tool {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .5rem .85rem;
  margin: .6rem 0;
  background: #fcfcfd;
}
details.tool summary { cursor: pointer; font-weight: 600; font-size: .9rem; }
details.tool[open] summary { margin-bottom: .8rem; }
.form.inset { max-width: none; }

.grade-list { list-style: none; margin: .4rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.grade-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: .4rem .9rem;
  padding: .6rem .7rem; border: 1px solid var(--line-2); border-radius: 8px; background: #fcfcfd;
}
.grade-row.editable { background: #fff; border-color: var(--line); }
.grade-edit { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; margin: 0; flex: 1; }
.grade-edit input { font: inherit; padding: .35rem .5rem; border: 1px solid var(--line); border-radius: 6px; }
.grade-edit input[name="module_name"] { flex: 1 1 12rem; }
.grade-edit input[name="grade"] { width: 5rem; }
.grade-edit input[name="hours_attended"] { width: 6rem; }
.grade-cell { font-size: .9rem; }

.danger-zone { border-color: var(--bad-line); }
.danger-zone h3 { color: var(--bad); margin-top: 0; }

/* ── Success page ────────────────────────────────────────────────────────── */
.success-card { max-width: 520px; margin: 2rem auto; text-align: center; }
.success-mark {
  width: 76px; height: 76px; margin: 0 auto 1rem;
  display: grid; place-items: center;
  border-radius: 50%; background: var(--ok-bg); color: var(--ok);
}
.amount { color: var(--muted); }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .cards-3 { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.8rem; }
  h1 { font-size: 1.55rem; }
  .grade-edit input[name="module_name"] { flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
