/* ============================================================
   Teacher portal — warm, refined, professional
   Inspired by classroom self-assessment rubrics
   ============================================================ */

:root {
  --bg:        #f7f3ea;
  --surface:   #fdfbf5;
  --line:      #e3dccb;
  --ink:       #1f2326;
  --ink-soft:  #6a6258;
  --accent:    #1d4a4a;     /* deep teal */
  --accent-2:  #c8551f;     /* warm orange */
  --warn:      #b34238;
  --good:      #2f7a4f;

  --radius:    12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(31,35,38,0.04);
  --shadow:    0 4px 16px rgba(31,35,38,0.06);

  --font-display: 'Fraunces', 'Georgia', serif;
  --font-body:    'Manrope', system-ui, -apple-system, sans-serif;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.55;
}

/* ---------- Header ---------- */
.t-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.t-header .brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--accent);
  text-decoration: none;
}

.t-header .brand small {
  display: inline-block;
  margin-left: 4px;
  font-family: var(--font-body);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
  font-weight: 600;
}

.t-header nav {
  display: flex;
  gap: 24px;
  align-items: center;
}

.t-header nav a {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  transition: color 0.15s;
}

.t-header nav a:hover, .t-header nav a.active {
  color: var(--accent);
}

.t-header .user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  color: var(--ink-soft);
}

/* ---------- Layout ---------- */
.t-main {
  max-width: 1100px;
  margin: 32px auto;
  padding: 0 24px;
}

.t-page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.t-page-head h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 36px;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.t-page-head .sub {
  margin-top: 6px;
  color: var(--ink-soft);
  font-size: 15px;
}

.t-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-soft);
  text-decoration: none;
  margin-bottom: 8px;
}
.t-back:hover { color: var(--accent); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.card + .card { margin-top: 20px; }

.card h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 22px;
  margin-bottom: 4px;
}

.card .card-sub {
  color: var(--ink-soft);
  font-size: 14px;
  margin-bottom: 20px;
}

/* ---------- Forms ---------- */
.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="number"],
.field textarea,
.field select {
  width: 100%;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 15px;
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(29,74,74,0.1);
}

.field textarea { min-height: 90px; resize: vertical; font-family: inherit; }

.field .help {
  margin-top: 6px;
  font-size: 12px;
  color: var(--ink-soft);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform 0.05s, background 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: #163a3a; }

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}
.btn-secondary:hover { border-color: var(--ink-soft); }

.btn-danger {
  background: transparent;
  color: var(--warn);
  border-color: transparent;
  padding: 6px 10px;
  font-size: 13px;
}
.btn-danger:hover { background: rgba(179,66,56,0.08); }

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

/* ---------- Tables ---------- */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th {
  text-align: left;
  font-weight: 600;
  color: var(--ink-soft);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: rgba(0,0,0,0.015); }

/* ---------- Badges & status ---------- */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-draft { background: #efe7d3; color: #7a6422; }
.badge-published { background: #d8ecde; color: #1f5a37; }
.badge-done { background: var(--accent); color: #fff; }
.badge-pending { background: var(--bg); color: var(--ink-soft); border: 1px solid var(--line); }

/* ---------- Form builder (questions/options dynamic rows) ---------- */
.builder-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 10px;
}

.builder-row .row-num {
  flex: 0 0 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
}

.builder-row .row-input { flex: 1; }
.builder-row .row-input input,
.builder-row .row-input textarea {
  width: 100%;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
}

.builder-row .row-input textarea { min-height: 50px; resize: vertical; }

.builder-row .row-icon {
  flex: 0 0 130px;
}

.builder-row .row-actions {
  display: flex;
  gap: 4px;
  flex: 0 0 auto;
}

.builder-row .icon-btn {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: var(--ink-soft);
  font-size: 16px;
}
.builder-row .icon-btn:hover { background: var(--surface); color: var(--ink); }
.builder-row .icon-btn.danger:hover { color: var(--warn); }

.builder-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
}

.builder-section h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 22px;
  margin-bottom: 4px;
}
.builder-section .section-sub {
  color: var(--ink-soft);
  font-size: 13px;
  margin-bottom: 16px;
}

.builder-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 8px 14px;
  background: transparent;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--ink-soft);
  font-weight: 500;
}
.builder-add:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Login screen ---------- */
.t-auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.t-auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow);
}

.t-auth-card .brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 28px;
  color: var(--accent);
  text-align: center;
  margin-bottom: 4px;
}

.t-auth-card .auth-sub {
  text-align: center;
  color: var(--ink-soft);
  font-size: 14px;
  margin-bottom: 28px;
}

.t-auth-card .btn { width: 100%; padding: 12px 20px; }

/* ---------- QR card ---------- */
.qr-display {
  display: flex;
  gap: 32px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.qr-display .qr-box {
  background: #fff;
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  display: inline-block;
}

.qr-display .qr-info { flex: 1; min-width: 220px; }

.qr-display .qr-url {
  display: block;
  word-break: break-all;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 12px;
  color: var(--ink);
  margin: 8px 0 14px;
}

/* ---------- Stats / report ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.stat .stat-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  font-weight: 600;
}
.stat .stat-value {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 500;
  color: var(--accent);
  margin-top: 4px;
}

.q-report {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  margin-top: 18px;
}
.q-report:first-child { border-top: none; padding-top: 0; margin-top: 0; }

.q-report .q-text {
  font-weight: 600;
  margin-bottom: 12px;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 13px;
}
.bar-row .bar-label { flex: 0 0 120px; color: var(--ink-soft); }
.bar-row .bar-track {
  flex: 1;
  height: 22px;
  background: var(--bg);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}
.bar-row .bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 6px;
  transition: width 0.4s;
}
.bar-row .bar-count {
  flex: 0 0 60px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .t-page-head h1 { font-size: 28px; }
  .t-header { padding: 12px 16px; }
  .t-main { padding: 0 16px; margin: 20px auto; }
  .builder-row { flex-wrap: wrap; }
  .builder-row .row-icon { flex: 1 1 100%; }
}
