:root {
  --forest: #063021;
  --forest-2: #0a3a2a;
  --emerald: #0b6848;
  --emerald-2: #0e7c56;
  --gold: #c6a13d;
  --gold-soft: #f3e6bd;
  --cream: #fefdf6;
  --mist: #eaf3ef;
  --ink: #242b27;
  --muted: #5b6b63;
  --line: #d9e4de;
  --white: #ffffff;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --warning: #9a5b00;
  --warning-soft: #fff4d6;
  --success: #0b6848;
  --success-soft: #e4f4ec;
  --shadow: 0 10px 30px rgba(6, 48, 33, 0.08);
  --shadow-sm: 0 2px 10px rgba(6, 48, 33, 0.06);
  --radius: 14px;
  --radius-sm: 10px;
  --font-body: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-head: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--cream);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5 { font-family: var(--font-head); color: var(--forest); line-height: 1.2; margin: 0 0 0.5rem; }
h1 { font-size: clamp(1.6rem, 3vw, 2.3rem); }
h2 { font-size: clamp(1.3rem, 2.4vw, 1.7rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1rem; }
a { color: var(--emerald); text-decoration: none; }
a:hover { text-decoration: underline; }
small { color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }

.container { width: min(1180px, 100% - 2rem); margin-inline: auto; }
.main { padding: 2rem 0 4rem; }

/* Header */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 40;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.9rem 0; }
.brand { display: inline-flex; align-items: center; gap: 0.7rem; color: var(--forest); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--emerald), var(--forest));
  color: var(--gold); font-family: var(--font-head); font-weight: 700; letter-spacing: 0.5px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-family: var(--font-head); font-size: 0.98rem; }
.brand-text small { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--emerald); }
.header-user { display: flex; align-items: center; gap: 0.75rem; }
.user-name { font-size: 0.9rem; color: var(--muted); }
.user-name::before { content: ""; }

.site-footer { border-top: 1px solid var(--line); background: var(--white); padding: 1.25rem 0; color: var(--muted); font-size: 0.85rem; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  border: 1px solid transparent; border-radius: 999px;
  padding: 0.65rem 1.2rem; font-family: var(--font-body); font-size: 0.92rem; font-weight: 600;
  cursor: pointer; transition: transform 0.05s ease, background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  text-decoration: none; line-height: 1.2;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--emerald); color: #fff; }
.btn-primary:hover { background: var(--emerald-2); }
.btn-gold { background: var(--gold); color: var(--forest); }
.btn-gold:hover { background: #d4b155; }
.btn-outline { background: transparent; border-color: var(--line); color: var(--forest); }
.btn-outline:hover { border-color: var(--emerald); color: var(--emerald); }
.btn-ghost { background: transparent; color: var(--emerald); border-color: transparent; }
.btn-ghost:hover { background: var(--mist); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #9a1c13; }
.btn-danger-outline { background: transparent; border-color: #e7b6b1; color: var(--danger); }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.82rem; }
.btn-lg { padding: 0.85rem 1.6rem; font-size: 1rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* Cards */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-header { padding: 1.1rem 1.3rem; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.card-body { padding: 1.3rem; }
.card-footer { padding: 1rem 1.3rem; border-top: 1px solid var(--line); background: #fbfdfb; border-radius: 0 0 var(--radius) var(--radius); }
.card + .card { margin-top: 1.2rem; }

.grid { display: grid; gap: 1.2rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.stat { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow-sm); }
.stat-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 0.35rem; }
.stat-value { font-family: var(--font-head); font-size: 1.9rem; font-weight: 700; color: var(--forest); line-height: 1; }
.stat-value.gold { color: #8a6a12; }
.stat-hint { font-size: 0.8rem; color: var(--muted); margin-top: 0.35rem; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.74rem; font-weight: 600; letter-spacing: 0.02em; white-space: nowrap; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--mist); color: var(--emerald); }
.badge-gold { background: var(--gold-soft); color: #7a5c0c; }
.badge-neutral { background: #eef1ef; color: #4a5a52; }

/* Forms */
.form-group { margin-bottom: 1.05rem; }
label { display: block; font-size: 0.88rem; font-weight: 600; margin-bottom: 0.35rem; color: var(--forest); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="datetime-local"], input[type="file"], select, textarea {
  width: 100%; padding: 0.7rem 0.85rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 0.95rem; color: var(--ink); background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
textarea { resize: vertical; min-height: 120px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--emerald); box-shadow: 0 0 0 3px rgba(11, 104, 72, 0.12); }
.help { font-size: 0.8rem; color: var(--muted); margin-top: 0.3rem; }
.error-text { font-size: 0.82rem; color: var(--danger); margin-top: 0.3rem; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.checkbox { display: flex; align-items: flex-start; gap: 0.55rem; font-weight: 500; font-size: 0.9rem; color: var(--ink); }
.checkbox input { width: 18px; height: 18px; margin-top: 0.15rem; accent-color: var(--emerald); }
.inline-actions { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.filter-bar { display: flex; gap: 0.7rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: 1.1rem; }
.filter-bar .form-group { margin: 0; }
.filter-bar input, .filter-bar select { min-width: 180px; }

/* Alerts */
.alert { border-radius: var(--radius-sm); padding: 0.85rem 1rem; margin-bottom: 1.1rem; font-size: 0.9rem; border: 1px solid transparent; }
.alert-success { background: var(--success-soft); color: #075236; border-color: #bfe3d2; }
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: #f1c9c5; }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: #f0dca4; }
.alert-info { background: var(--mist); color: #0a5a3e; border-color: #cbe4d8; }
.alert ul { margin: 0.4rem 0 0; padding-left: 1.1rem; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.88rem; min-width: 720px; }
table.data thead th { text-align: left; background: #f4f8f5; color: var(--forest); font-weight: 600; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
table.data tbody td { padding: 0.7rem 0.9rem; border-bottom: 1px solid #edf3ef; vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: #fbfdfb; }
.table-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.row-winner { background: #fffaeb !important; }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 1rem; font-size: 0.85rem; color: var(--muted); }
.pagination-links { display: flex; gap: 0.25rem; flex-wrap: wrap; }
.page-link { display: inline-flex; min-width: 34px; height: 34px; align-items: center; justify-content: center; padding: 0 0.5rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--forest); }
.page-link:hover { border-color: var(--emerald); text-decoration: none; }
.page-link.active { background: var(--emerald); border-color: var(--emerald); color: #fff; }
.page-link.disabled { opacity: 0.45; pointer-events: none; }

/* Auth */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: var(--cream); }
.auth-aside { background: linear-gradient(155deg, var(--forest), #0a4634 55%, var(--emerald)); color: #fff; padding: clamp(2rem, 5vw, 4rem); display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-aside::after { content: ""; position: absolute; right: -120px; top: -120px; width: 340px; height: 340px; border-radius: 50%; background: rgba(198, 161, 61, 0.16); }
.auth-aside::before { content: ""; position: absolute; left: -80px; bottom: -140px; width: 300px; height: 300px; border-radius: 50%; background: rgba(255, 255, 255, 0.06); }
.auth-aside h1 { color: #fff; font-size: clamp(1.7rem, 3.4vw, 2.6rem); margin-bottom: 0.8rem; }
.auth-aside p { color: #d6e8df; max-width: 34ch; }
.auth-kicker { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); font-weight: 600; margin-bottom: 1.2rem; }
.auth-points { list-style: none; margin: 1.4rem 0 0; padding: 0; display: grid; gap: 0.7rem; }
.auth-points li { display: flex; gap: 0.6rem; align-items: flex-start; color: #e6f1eb; font-size: 0.92rem; }
.auth-points li::before { content: "✓"; color: var(--gold); font-weight: 700; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 2rem; }
.auth-card { width: min(430px, 100%); }
.auth-card .brand { margin-bottom: 1.5rem; }
.auth-card h2 { margin-bottom: 0.3rem; }
.auth-card .sub { color: var(--muted); margin-bottom: 1.4rem; font-size: 0.92rem; }
.auth-footer { margin-top: 1.4rem; font-size: 0.8rem; color: var(--muted); }

/* Participant flow */
.hero-card { background: linear-gradient(140deg, var(--forest), var(--emerald)); color: #fff; border-radius: var(--radius); padding: clamp(1.5rem, 4vw, 2.6rem); position: relative; overflow: hidden; box-shadow: var(--shadow); }
.hero-card h1, .hero-card h2 { color: #fff; }
.hero-card p { color: #d9ece3; }
.hero-card .badge { background: rgba(255,255,255,0.14); color: #fff; }
.hero-meta { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 1rem; }
.hero-meta span { background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.18); padding: 0.35rem 0.7rem; border-radius: 999px; font-size: 0.78rem; }
.gold-rule { height: 4px; width: 64px; background: var(--gold); border-radius: 999px; margin: 0 0 1rem; }

.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.8rem; margin: 1.2rem 0; }
.step { background: #f6faf7; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0.9rem; font-size: 0.85rem; }
.step strong { display: block; color: var(--forest); font-family: var(--font-head); font-size: 0.9rem; margin-bottom: 0.15rem; }

.question-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.question-head { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; padding: 0.9rem 1.2rem; background: #f4f8f5; border-bottom: 1px solid var(--line); }
.question-number { display: inline-flex; align-items: center; gap: 0.55rem; font-family: var(--font-head); font-weight: 600; color: var(--forest); }
.qn { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--emerald); color: #fff; font-size: 0.85rem; }
.question-body { padding: 1.2rem; }
.question-text { font-size: 1.02rem; color: var(--ink); margin-bottom: 1rem; white-space: pre-wrap; }
.answer-area { min-height: 190px; font-size: 0.95rem; line-height: 1.6; }
.counter { font-size: 0.76rem; color: var(--muted); }
.counter.warn { color: var(--warning); }

.submit-bar { position: sticky; bottom: 0; background: rgba(254, 253, 246, 0.96); backdrop-filter: blur(6px); border-top: 1px solid var(--line); padding: 0.9rem 0; margin-top: 1.4rem; }
.submit-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.draft-status { font-size: 0.8rem; color: var(--muted); min-height: 1.2em; }

.success-card { text-align: center; padding: clamp(1.8rem, 5vw, 3rem); }
.success-icon { width: 74px; height: 74px; border-radius: 50%; background: var(--success-soft); color: var(--emerald); display: grid; place-items: center; font-size: 2rem; margin: 0 auto 1rem; }
.reference { display: inline-block; background: var(--forest); color: var(--gold); font-family: var(--font-head); letter-spacing: 0.12em; padding: 0.6rem 1rem; border-radius: 10px; font-size: 1.05rem; margin: 0.5rem 0 1rem; }

/* Admin shell */
.admin-shell { min-height: 100vh; display: grid; grid-template-columns: 250px 1fr; background: #f5f8f6; }
.sidebar { background: var(--forest); color: #d9e8e1; padding: 1.1rem 0.9rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { color: #fff; margin-bottom: 1.3rem; padding: 0 0.4rem; }
.sidebar .brand-text small { color: var(--gold); }
.sidebar-nav { display: grid; gap: 0.25rem; }
.sidebar-nav a { display: flex; align-items: center; gap: 0.6rem; padding: 0.62rem 0.75rem; border-radius: 9px; color: #cfe3da; font-size: 0.89rem; font-weight: 500; }
.sidebar-nav a:hover { background: rgba(255,255,255,0.08); color: #fff; text-decoration: none; }
.sidebar-nav a.active { background: var(--emerald); color: #fff; }
.sidebar-nav .nav-ico { width: 20px; text-align: center; opacity: 0.9; }
.sidebar-section { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.14em; color: #7fa596; padding: 0.9rem 0.75rem 0.35rem; }
.sidebar-footer { margin-top: 1.5rem; padding: 0.9rem 0.5rem 0; border-top: 1px solid rgba(255,255,255,0.1); font-size: 0.78rem; color: #9fbdaf; }

.admin-main { min-width: 0; display: flex; flex-direction: column; }
.admin-topbar { background: #fff; border-bottom: 1px solid var(--line); padding: 0.8rem 1.3rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; position: sticky; top: 0; z-index: 30; }
.admin-topbar h1 { font-size: 1.15rem; margin: 0; }
.admin-topbar .crumb { font-size: 0.78rem; color: var(--muted); }
.admin-content { padding: 1.4rem; flex: 1; }
.sidebar-toggle { display: none; background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 0.45rem 0.6rem; font-size: 1rem; cursor: pointer; color: var(--forest); }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.page-head h2 { margin-bottom: 0.15rem; }
.page-head p { color: var(--muted); font-size: 0.88rem; margin: 0; }

.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty-state strong { display: block; color: var(--forest); font-family: var(--font-head); margin-bottom: 0.3rem; }

.meta-list { display: grid; gap: 0.55rem; font-size: 0.9rem; }
.meta-list div { display: flex; justify-content: space-between; gap: 1rem; padding-bottom: 0.5rem; border-bottom: 1px dashed var(--line); min-width: 0; }
.meta-list dt, .meta-list .k { color: var(--muted); }
.meta-list .v { font-weight: 600; color: var(--forest); text-align: right; overflow-wrap: anywhere; }

.answer-box { background: #fbfdfb; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1rem; white-space: pre-wrap; font-size: 0.94rem; }
.guide-box { background: var(--gold-soft); border: 1px solid #e6d39a; border-radius: var(--radius-sm); padding: 0.9rem 1rem; font-size: 0.88rem; color: #5e4708; white-space: pre-wrap; }
.mark-grid { display: grid; grid-template-columns: 140px 1fr; gap: 0.7rem; align-items: start; }
.mark-grid .form-group { margin-bottom: 0; }

.print-only { display: none; }

@media (max-width: 1024px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 60; width: 260px; transform: translateX(-105%); transition: transform 0.2s ease; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: inline-flex; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .auth-main { min-height: 100vh; padding: 1.4rem; }
}

@media (max-width: 720px) {
  .grid-2, .grid-3, .grid-4, .form-row, .steps { grid-template-columns: 1fr; }
  .header-user .user-name { display: none; }
  .main { padding: 1.2rem 0 3rem; }
  .card-body { padding: 1rem; }
  .admin-content { padding: 1rem; }
  .mark-grid { grid-template-columns: 1fr; }
  .submit-inner { flex-direction: column; align-items: stretch; }
  .submit-inner .btn { width: 100%; }
  .question-body { padding: 1rem; }
}

@media print {
  .site-header, .site-footer, .sidebar, .admin-topbar, .btn, .no-print { display: none !important; }
  .admin-shell { display: block; }
  .print-only { display: block; }
  body { background: #fff; }
}

/* Timed question */
.timer-card {
  background: linear-gradient(140deg, #ffffff, #f4f8f5);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
  box-shadow: var(--shadow-sm);
}
.timer-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 0.25rem; }
.timer-value { font-family: var(--font-head); font-size: clamp(2.1rem, 6vw, 3.2rem); font-weight: 700; line-height: 1; color: var(--forest); transition: color 0.2s ease; }
.timer-value.danger { color: var(--danger); }
.timer-track { height: 9px; border-radius: 999px; background: #e2ece6; overflow: hidden; margin: 0.85rem 0 0.5rem; }
.timer-fill { height: 100%; width: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--emerald), var(--gold)); transition: width 0.2s linear; }
.timer-fill.danger { background: var(--danger); }
.timer-hint { font-size: 0.78rem; color: var(--muted); }

/* Schedule countdown */
.schedule-countdown {
  border: 1px solid var(--line);
  border-left: 4px solid var(--muted);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 0.8rem 1rem;
  margin-bottom: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.schedule-countdown-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted); }
.schedule-countdown-value { font-family: var(--font-head); font-size: 1.55rem; font-weight: 700; line-height: 1.15; color: var(--forest); font-variant-numeric: tabular-nums; }
.schedule-countdown-target { font-size: 0.78rem; color: var(--muted); }
.schedule-countdown-opening { border-left-color: var(--gold); }
.schedule-countdown-closing, .schedule-countdown-open { border-left-color: var(--emerald); }
.schedule-countdown-closed { border-left-color: var(--danger); background: #fffafa; }
.schedule-countdown-pending { border-left-color: var(--line); background: #fbfdfb; }

/* Official brand logo */
.brand-mark-image { width: 42px; height: 42px; border-radius: 10px; object-fit: contain; display: block; }
.auth-brand { display: flex; flex-direction: column; align-items: flex-start; gap: 0.45rem; margin-bottom: 1.4rem; }
.auth-logo { display: block; width: min(170px, 62%); height: auto; object-fit: contain; }
.auth-brand-text { font-family: var(--font-head); font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--emerald); }
.auth-aside-logo { width: 74px; height: 74px; object-fit: contain; margin-bottom: 1rem; display: block; background: #fffdf7; padding: 6px; border-radius: 14px; box-sizing: border-box; }

/* Waiting / GET READY page */
.waiting-page { min-height: 100vh; background: radial-gradient(circle at 50% 0%, #eef7f2 0, var(--cream) 48%, #fff 100%); display: flex; flex-direction: column; }
.waiting-topbar { width: min(1180px, 100% - 2rem); margin-inline: auto; padding: 1rem 0; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.waiting-topbar .brand { color: var(--forest); }
.waiting-main { flex: 1; display: grid; place-items: center; padding: 1rem 1rem 3rem; }
.waiting-card { width: min(780px, 100%); background: rgba(255,255,255,0.96); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); padding: clamp(1.6rem, 5vw, 3.2rem); text-align: center; position: relative; overflow: hidden; }
.waiting-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 6px; background: linear-gradient(90deg, var(--emerald), var(--gold)); }
.waiting-logo { width: min(190px, 58%); height: auto; margin: 0 auto 1.1rem; display: block; object-fit: contain; }
.waiting-kicker { display: inline-block; font-family: var(--font-head); font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--emerald); margin-bottom: 0.5rem; }
.waiting-title { font-size: clamp(2rem, 6vw, 3.4rem); letter-spacing: 0.01em; color: var(--forest); margin-bottom: 0.45rem; }
.waiting-subtitle { font-family: var(--font-head); font-weight: 600; color: var(--emerald); font-size: clamp(1rem, 2.4vw, 1.25rem); margin-bottom: 0.9rem; }
.waiting-message { color: var(--muted); max-width: 62ch; margin: 0 auto 1.3rem; }
.waiting-badge { display: inline-flex; align-items: center; gap: 0.4rem; background: var(--gold-soft); color: #6b520c; border: 1px solid #e7d59a; padding: 0.35rem 0.8rem; border-radius: 999px; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.04em; }
.waiting-note { font-size: 0.86rem; color: var(--muted); margin-top: 1rem; }
.waiting-footer { text-align: center; color: var(--muted); font-size: 0.8rem; padding: 1rem; }

/* Virtual ticket links */
.ticket-inline-link {
  color: var(--emerald);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.ticket-inline-link:hover { color: var(--forest); }
.ticket-button-row { margin: 0.95rem auto 0; text-align: center; }

/* Countdown blocks */
.schedule-countdown-card { margin: 1.4rem auto 0.4rem; }
.countdown-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.7rem; margin: 1.2rem auto 0; max-width: 620px; }
.countdown-unit { background: linear-gradient(160deg, var(--forest), var(--emerald)); color: #fff; border-radius: 14px; padding: 1rem 0.45rem 0.8rem; box-shadow: 0 8px 18px rgba(6, 48, 33, 0.12); }
.countdown-number { display: block; font-family: var(--font-head); font-size: clamp(2rem, 5.6vw, 2.9rem); font-weight: 700; line-height: 1; color: #fff; font-variant-numeric: tabular-nums; }
.countdown-label { display: block; font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: #d9ece3; margin-top: 0.4rem; }
.countdown-caption { margin-top: 1.1rem; font-size: 0.88rem; color: var(--muted); }
.countdown-target { display: block; margin-top: 0.25rem; font-family: var(--font-head); font-weight: 600; color: var(--emerald); font-size: 0.95rem; }
.countdown-pending { background: #f7faf8; border: 1px dashed var(--line); border-radius: 14px; padding: 1.1rem; color: var(--muted); }
.countdown-closed { background: #fff8f7; border: 1px solid #f0d4d0; border-radius: 14px; padding: 1rem; color: var(--danger); }

/* Compact closing countdown on the exam page */
.closing-countdown { display: inline-flex; align-items: center; gap: 0.55rem; flex-wrap: wrap; background: var(--mist); border: 1px solid #cfe3d9; color: #0a5a3e; border-radius: 999px; padding: 0.45rem 0.9rem; font-size: 0.82rem; }
.closing-countdown strong { font-family: var(--font-head); font-weight: 700; font-size: 1rem; letter-spacing: 0.04em; font-variant-numeric: tabular-nums; }
.closing-countdown.closed { background: var(--danger-soft); border-color: #f1c9c5; color: var(--danger); }

/* Waiting page responsive */
@media (max-width: 720px) {
  .countdown-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.55rem; }
  .waiting-card { border-radius: 18px; }
  .waiting-logo { width: min(150px, 52%); }
  .auth-logo { width: min(150px, 70%); }
  .ticket-button-row { margin-top: 0.85rem; }
}

.success-logo { display: block; width: min(120px, 34%); height: auto; margin: 0 auto 0.9rem; object-fit: contain; }

[data-brand-gesture] { touch-action: manipulation; user-select: none; -webkit-user-select: none; }


/* Mobile touch, readability and table cards */
@media (max-width: 860px) {
  input[type="text"], input[type="email"], input[type="password"], input[type="number"],
  input[type="datetime-local"], select, textarea, input[type="file"] {
    font-size: 16px;
  }
  input[type="text"], input[type="email"], input[type="password"], input[type="number"],
  input[type="datetime-local"], select {
    min-height: 44px;
  }
  .btn, .btn-sm { min-height: 44px; }
  .page-link { min-width: 44px; height: 44px; }
  .sidebar-toggle { width: 44px; height: 44px; padding: 0; font-size: 1.15rem; flex: 0 0 44px; }
  .sidebar-nav a { min-height: 44px; }
  .checkbox { min-height: 44px; align-items: center; }
  .checkbox input { width: 20px; height: 20px; flex: 0 0 20px; }
  .answer-area { font-size: 16px; }
  summary { min-height: 44px; display: flex; align-items: center; }
}

@media (max-width: 720px) {
  .table-wrap {
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
  }
  table.data {
    min-width: 0;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
  }
  table.data thead { display: none; }
  table.data tbody { display: block; }
  table.data tbody tr {
    display: block;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 0.8rem;
    padding: 0.2rem 0.9rem;
  }
  table.data tbody tr:last-child { margin-bottom: 0; }
  table.data tbody tr:hover { background: #fff; }
  table.data tbody td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    width: auto;
    border: 0;
    border-bottom: 1px dashed var(--line);
    padding: 0.6rem 0;
    text-align: right;
    overflow-wrap: anywhere;
  }
  table.data tbody td:last-child { border-bottom: 0; }
  table.data tbody td::before {
    content: attr(data-label);
    flex: 0 0 38%;
    text-align: left;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    padding-top: 0.15rem;
  }
  table.data tbody td > * { min-width: 0; }
  table.data tbody td form { min-width: 0 !important; }
  table.data tbody td .table-actions { justify-content: flex-end; margin-left: auto; }
  table.data tbody td[data-label="Actions"] { display: block; text-align: left; }
  table.data tbody td[data-label="Actions"]::before { display: block; flex: none; margin-bottom: 0.45rem; }
  table.data tbody td[data-label="Actions"] > div { width: 100%; }
  table.data tbody td[data-label="Actions"] .table-actions { justify-content: flex-start; margin-left: 0; }
  table.data tbody td[data-label="Actions"] details { width: 100%; }
  table.data tbody td[data-label="Actions"] details form { width: 100%; }
  table.data tbody td:empty { display: none; }
}

.auth-brand picture, .waiting-card picture, .success-card picture { display: block; }
