:root {
  --cyan:       #009CDD;
  --cyan-dark:  #007db3;
  --cyan-light: #dff2fc;
  --navy:       #004A75;
  --navy-deep:  #002d47;
  --bg:         #f0f4f8;
  --card:       #ffffff;
  --text:       #1a2635;
  --muted:      #5e7a90;
  --border:     #d0dbe8;
  --radius:     8px;
  --font-head:  'DM Serif Display', Georgia, serif;
  --font-body:  'DM Sans', system-ui, sans-serif;
  --font-mono:  'DM Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 17px;
  line-height: 1.65;
}

/* ── Nav ── */
nav {
  background: var(--navy-deep);
  padding: 0 2rem;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 3px solid var(--cyan);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0,0,0,.25);
}
.nav-brand {
  display: flex;
  align-items: baseline;
  gap: .25rem;
  text-decoration: none;
}
.nav-brand-toeic {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--cyan);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.nav-brand-grader {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 1.2rem;
  color: rgba(255,255,255,.8);
  letter-spacing: .02em;
}
.nav-brand:hover .nav-brand-toeic  { color: #33c0f5; }
.nav-brand:hover .nav-brand-grader { color: white; }

/* ── Layout ── */
main { max-width: 820px; margin: 2.5rem auto; padding: 0 1.5rem; }

/* ── Typography ── */
h1 {
  font-family: var(--font-head);
  font-size: 2rem;
  font-weight: 800;
  color: var(--navy-deep);
  letter-spacing: -.02em;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: .75rem;
}
h1::before {
  content: '';
  display: inline-block;
  width: 5px;
  height: 1.6em;
  background: var(--cyan);
  border-radius: 2px;
  flex-shrink: 0;
}
h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy-deep);
  margin-bottom: .9rem;
}
.section-label {
  font-family: var(--font-mono);
  font-size: .7rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .12em;
  margin-bottom: .5rem;
  display: block;
}

/* ── Cards ── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.75rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.05), 0 8px 24px rgba(0,0,0,.06);
  border: 1px solid var(--border);
  position: relative;
}
.card-step {
  position: absolute;
  top: 0; right: 1.5rem;
  background: var(--navy);
  color: white;
  font-family: var(--font-mono);
  font-size: .7rem;
  font-weight: 500;
  letter-spacing: .1em;
  padding: .2rem .7rem;
  border-radius: 0 0 6px 6px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .7rem 1.6rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s, box-shadow .15s, transform .1s;
  letter-spacing: .01em;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary { background: var(--cyan); color: white; }
.btn-primary:hover { background: var(--cyan-dark); box-shadow: 0 4px 16px rgba(0,156,221,.4); transform: translateY(-1px); }
.btn-danger  { background: #dc2626; color: white; }
.btn-danger:hover  { background: #b91c1c; }
.btn-success { background: #16a34a; color: white; }
.btn-success:hover { background: #15803d; }
.btn-secondary { background: #e4ecf4; color: var(--navy); }
.btn-secondary:hover { background: #d5e2ef; }
.btn-lg { font-size: 1.1rem; padding: .85rem 2rem; }

/* ── Forms ── */
.form-group { margin-bottom: 1.3rem; }

label {
  font-family: var(--font-body);
  font-size: .9rem;
  font-weight: 600;
  color: var(--navy-deep);
  display: block;
  margin-bottom: .4rem;
}

input[type=text], input[type=password], input[type=number], select {
  width: 100%;
  padding: .65rem .9rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: var(--font-body);
  color: var(--text);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
input[type=text]:focus, input[type=password]:focus,
input[type=number]:focus, select:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0,156,221,.15);
}

input[type=file] {
  width: 100%;
  padding: .85rem 1rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  font-size: .95rem;
  font-family: var(--font-body);
  color: var(--muted);
  background: #fafcfe;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
input[type=file]:hover {
  border-color: var(--cyan);
  background: var(--cyan-light);
}
input[type=file]::file-selector-button {
  padding: .35rem .9rem;
  border: none;
  border-radius: 5px;
  background: var(--navy);
  color: white;
  font-size: .9rem;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  margin-right: 1rem;
  transition: background .15s;
}
input[type=file]::file-selector-button:hover { background: var(--cyan); }

/* Field hint text */
.field-hint {
  display: block;
  font-size: .82rem;
  color: var(--muted);
  margin-top: .3rem;
}

/* ── Progress ── */
.progress-bar-bg {
  background: #dce8f4;
  border-radius: 99px;
  height: 10px;
  overflow: hidden;
}
.progress-bar {
  background: linear-gradient(90deg, var(--cyan), #00d4ff);
  border-radius: 99px;
  height: 10px;
  transition: width .5s cubic-bezier(.4,0,.2,1);
}

/* ── Tables ── */
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
thead tr { border-bottom: 2px solid var(--border); }
th {
  padding: .7rem .85rem;
  text-align: left;
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  background: #f4f8fc;
}
td {
  padding: .7rem .85rem;
  border-bottom: 1px solid #eaf0f8;
  color: var(--text);
  vertical-align: middle;
}
tbody tr:hover { background: #f0f6fb; }
tbody tr:last-child td { border-bottom: none; }

/* Score bar helper */
.score-bar-wrap { display: flex; align-items: center; gap: .6rem; }
.score-bar-track {
  flex: 1;
  max-width: 80px;
  height: 6px;
  background: #dce8f4;
  border-radius: 99px;
  overflow: hidden;
}
.score-bar-fill { height: 6px; background: var(--cyan); border-radius: 99px; }
.score-val {
  font-family: var(--font-mono);
  font-size: .9rem;
  font-weight: 600;
  color: var(--navy);
  white-space: nowrap;
}

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: .25rem .7rem;
  border-radius: 99px;
  font-size: .82rem;
  font-weight: 600;
}
.badge-ok   { background: #dcfce7; color: #166534; }
.badge-warn { background: #fef3c7; color: #92400e; }
.badge-err  { background: #fee2e2; color: #991b1b; }

/* ── Alerts ── */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  font-size: .95rem;
  border-left: 4px solid transparent;
  display: flex;
  gap: .75rem;
  align-items: flex-start;
}
.alert-info { background: var(--cyan-light); color: var(--navy-deep); border-color: var(--cyan); }
.alert-warn { background: #fffbeb; color: #78350f; border-color: #f59e0b; }

/* ── Nav links ── */
.nav-link {
  font-size: 1rem;
  font-weight: 600;
  color: #ffffff;
  text-decoration: none;
  padding: .35rem .7rem;
  border-radius: 5px;
  transition: background .15s;
}
.nav-link:hover { background: rgba(255,255,255,.15); }
.nav-link-admin { color: #fde68a; }
.nav-link-admin:hover { background: rgba(253,230,138,.15); }
.nav-link-logout { color: #fca5a5; }
.nav-link-logout:hover { background: rgba(220,38,38,.2); }

/* ── Details/summary (advanced options) ── */
details { margin-top: .5rem; }
details summary {
  font-size: .9rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  padding: .4rem 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: .4rem;
}
details summary::-webkit-details-marker { display: none; }
details summary::before {
  content: '▶';
  font-size: .65rem;
  transition: transform .2s;
  color: var(--cyan);
}
details[open] summary::before { transform: rotate(90deg); }
details summary:hover { color: var(--navy); }

/* ── Upload inline validation ── */
.file-status { margin-top: .4rem; min-height: 1.4rem; font-size: .88rem; }
.file-status-valid   { color: #16a34a; font-weight: 600; }
.file-status-invalid { color: #dc2626; font-weight: 600; }
.file-status-pending { color: var(--muted); font-style: italic; }

@keyframes btn-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(0,156,221,.4); }
  50%      { box-shadow: 0 0 0 8px rgba(0,156,221,0); }
}
.btn-unlocked { animation: btn-pulse .7s ease 1; }

/* ── Review progress bar ── */
.review-progress { margin-bottom: 1.25rem; }
.review-progress-label { font-size: .88rem; color: var(--muted); margin-bottom: .35rem; }
.review-progress-track { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.review-progress-fill  { height: 100%; background: var(--navy); border-radius: 3px; transition: width .3s ease; }

/* ── Review contextual hint banner ── */
.review-hint {
  background: #e8f4fb;
  border-left: 3px solid var(--cyan);
  border-radius: 6px;
  padding: .9rem 1.1rem;
  font-size: .95rem;
  color: var(--navy-deep);
  margin-bottom: 1.25rem;
  line-height: 1.55;
}
