@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Merriweather:wght@700&display=swap");

:root {
  color-scheme: light;
  --primary: #0f2747;
  --primary-hover: #13345f;
  --primary-soft: #eaf0f7;
  --again: #c56a2d;
  --again-hover: #a95621;
  --again-soft: #f8ece3;
  --success: #2f7d57;
  --success-soft: #eaf6ef;
  --alert: #b54708;
  --alert-soft: #fff3e8;
  --error: #b42318;
  --error-soft: #feeceb;
  --background: #f7f5f2;
  --surface: #ffffff;
  --surface-dark: #0b1220;
  --border: #d9dee7;
  --border-strong: #b8c2d1;
  --text: #172033;
  --text-muted: #5b6474;
  --text-inverse: #f8fafc;
  --link: #163e73;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-md: 0 6px 16px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .10);
  --shadow-xl: 0 20px 48px rgba(16, 24, 40, .14);
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background: var(--background);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background:
    linear-gradient(180deg, #fbfaf8 0, var(--background) 360px),
    var(--background);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p { margin-top: 0; }

h1 {
  margin-bottom: 16px;
  font-family: "Merriweather", Georgia, serif;
  font-size: clamp(32px, 4.5vw, 48px);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 10px;
  font-size: clamp(22px, 2.6vw, 30px);
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 18px;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: 0;
}

h4 {
  margin-bottom: 8px;
  font-size: 16px;
  line-height: 1.35;
  font-weight: 700;
}

button, input, textarea, select { font: inherit; }

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 64px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 58px;
  margin-bottom: 22px;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-logo {
  display: block;
  width: 184px;
  max-width: 54vw;
  height: auto;
}

.brand-lockup span {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  border-left: 1px solid var(--border);
  padding-left: 14px;
  color: var(--primary);
  font-size: 14px;
  font-weight: 800;
}

.topnav {
  display: flex;
  gap: 8px;
  align-items: center;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 430px);
  gap: 28px;
  align-items: center;
  padding: 36px;
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(15, 39, 71, .98), rgba(11, 18, 32, .98));
  color: var(--text-inverse);
  box-shadow: var(--shadow-xl);
}

.admin-hero {
  grid-template-columns: minmax(0, 1fr) auto;
  margin-bottom: 20px;
}

.hero-copy {
  max-width: 620px;
}

.hero-panel h1,
.hero-panel h2 {
  color: #fff;
}

.hero-lead {
  max-width: 720px;
  margin-bottom: 0;
  color: #cbd5e1;
  font-size: 18px;
  line-height: 1.55;
}

.eyebrow {
  display: inline-flex;
  width: fit-content;
  min-height: 28px;
  align-items: center;
  border-radius: 999px;
  padding: 5px 11px;
  margin-bottom: 14px;
  background: var(--again-soft);
  color: var(--again);
  font-size: 12px;
  line-height: 16px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.hero-panel .eyebrow {
  background: rgba(197, 106, 45, .16);
  color: #f4bd91;
}

.muted, .hint {
  color: var(--text-muted);
  margin-bottom: 0;
}

.hint {
  font-size: 13px;
}

.panel, .card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.panel {
  padding: 24px;
  margin: 18px 0;
}

.login-card {
  margin: 0;
  color: var(--text);
}

.login-card h2 {
  color: var(--primary);
}

.login-card .eyebrow {
  background: var(--again-soft);
  color: var(--again);
}

.login-card .grid-form {
  grid-template-columns: 1fr 1fr;
}

.login-card .grid-form button {
  grid-column: 1 / -1;
  width: 100%;
}

.panel.compact {
  display: grid;
  gap: 14px;
}

.status-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 18px 0 4px;
}

.status-panel > div {
  min-height: 92px;
  display: grid;
  align-content: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.status-panel span {
  color: var(--again);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.status-panel strong {
  color: var(--primary);
  font-size: 17px;
  line-height: 1.25;
}

.hub-cta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 20px;
  margin: 18px 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.admin-cta { margin-top: 0; }

.hub-copy {
  display: grid;
  gap: 4px;
}

.hub-copy h2 {
  margin-bottom: 0;
}

.hub-copy p:last-child {
  color: var(--text-muted);
  margin-bottom: 0;
}

.student-strip, .section-head, .dialog-actions, .actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.student-strip {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--primary-soft);
  padding: 14px 16px;
  margin-bottom: 16px;
}

.section-head {
  margin-bottom: 16px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 14px;
}

.stack {
  display: grid;
  gap: 12px;
}

.card {
  padding: 18px;
  display: grid;
  gap: 10px;
}

.card.locked {
  opacity: .72;
  box-shadow: var(--shadow-sm);
}

.card.wide { width: 100%; }

.grid-form {
  display: grid;
  grid-template-columns: minmax(220px, 1.15fr) minmax(180px, .85fr) auto;
  gap: 12px;
  align-items: end;
}

.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

input, textarea, select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 11px 12px;
  background: #fff;
  color: var(--text);
  outline: none;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(15, 39, 71, .14);
}

textarea {
  resize: vertical;
  font-family: "Inter", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

button, .button, .hub-button, .ghost {
  appearance: none;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

button, .button, .hub-button {
  background: var(--again);
  color: #fff;
  box-shadow: 0 10px 18px rgba(197, 106, 45, .18);
}

button:hover, .button:hover, .hub-button:hover {
  background: var(--again-hover);
}

.ghost {
  background: #fff;
  color: var(--primary);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.ghost:hover {
  background: var(--primary-soft);
}

.hub-button {
  white-space: nowrap;
}

.small-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.small-actions button {
  min-height: 38px;
  padding: 8px 11px;
}

.pill {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid rgba(197, 106, 45, .28);
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--again-soft);
  color: var(--alert);
  font-size: 12px;
  font-weight: 800;
}

.score {
  font-size: 34px;
  line-height: 1;
  color: var(--again);
  font-weight: 800;
}

.verdict {
  font-weight: 800;
  color: var(--success);
}

.fgv-mirror {
  display: grid;
  gap: 14px;
  margin-top: 6px;
}

.fgv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fbfaf8;
}

.fgv-header h4 {
  margin-bottom: 0;
  color: var(--primary);
}

.fgv-header .eyebrow {
  margin-bottom: 6px;
}

.verdict.approved {
  min-height: 32px;
  border-radius: 999px;
  padding: 6px 12px;
  background: var(--success-soft);
  color: var(--success);
}

.verdict.reproved {
  min-height: 32px;
  border-radius: 999px;
  padding: 6px 12px;
  background: var(--error-soft);
  color: var(--error);
}

.fgv-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.fgv-summary,
.fgv-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
  font-size: 14px;
}

.fgv-summary th,
.fgv-summary td,
.fgv-table th,
.fgv-table td {
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.fgv-summary th,
.fgv-table th {
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.fgv-summary tr:last-child td,
.fgv-table tr:last-child td {
  border-bottom: 0;
}

.fgv-table td:nth-child(2),
.fgv-table td:nth-child(3),
.fgv-table td:nth-child(4) {
  white-space: nowrap;
}

.fgv-table small,
.appeal-card small {
  display: block;
  margin-top: 5px;
  color: var(--text-muted);
  line-height: 1.45;
}

.feedback-box,
.appeal-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px 14px;
  background: #fbfaf8;
}

.feedback-box p:last-child,
.feedback-box ul:last-child,
.appeal-card p:last-child {
  margin-bottom: 0;
}

.feedback-box ul {
  padding-left: 18px;
}

.appeals {
  display: grid;
  gap: 10px;
}

.error { color: var(--error); }
.hidden { display: none !important; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 20;
  width: min(560px, calc(100% - 24px));
  transform: translateX(-50%);
  border-radius: 12px;
  padding: 13px 16px;
  background: var(--surface-dark);
  color: #fff;
  box-shadow: var(--shadow-xl);
  font-weight: 700;
}

.support-log {
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fbfaf8;
  padding: 12px;
}

.support-log:empty::before {
  content: "Descreva o problema. A resposta aparece aqui.";
  color: var(--text-muted);
}

dialog {
  width: min(700px, calc(100% - 24px));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0;
  background: var(--surface);
  box-shadow: var(--shadow-xl);
}

dialog::backdrop { background: rgba(11, 18, 32, .62); }
dialog form { padding: 24px; display: grid; gap: 14px; }

.reader-body {
  background: #f4efe8;
}

.reader {
  width: min(780px, calc(100% - 30px));
  margin: 0 auto;
  padding: 18px 0 70px;
}

.reader-nav {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 0;
  background: rgba(244, 239, 232, .92);
  backdrop-filter: blur(12px);
}

#readerContent {
  border: 1px solid #dfd4bf;
  border-radius: 12px;
  padding: 34px;
  background: #fffdf8;
  box-shadow: var(--shadow-md);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.75;
}

#readerContent h1 {
  font-family: "Merriweather", Georgia, serif;
  font-size: 34px;
  line-height: 1.18;
}

#readerContent h2 {
  margin-top: 32px;
  font-size: 24px;
}

@media (max-width: 900px) {
  .hero-panel,
  .admin-hero {
    grid-template-columns: 1fr;
    padding: 28px;
  }

  .grid-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  body { font-size: 15px; }
  .shell { width: min(100% - 24px, 1120px); padding-top: 14px; }
  .topbar { align-items: flex-start; }
  .brand-logo { width: 148px; max-width: 46vw; }
  .brand-lockup { gap: 10px; }
  .brand-lockup span { padding-left: 10px; font-size: 13px; }
  .topnav { flex-wrap: wrap; justify-content: flex-end; }
  .topnav .ghost { min-height: 38px; padding: 8px 11px; }
  .hero-panel { padding: 24px 18px; border-radius: 16px; }
  .hero-lead { font-size: 16px; }
  .status-panel,
  .two,
  .hub-cta {
    grid-template-columns: 1fr;
  }
  .student-strip,
  .section-head,
  .dialog-actions,
  .actions,
  .fgv-header {
    align-items: stretch;
    flex-direction: column;
  }
  .hub-button, .actions > *, .grid-form button { width: 100%; }
  .panel { padding: 18px; }
  .small-actions { width: 100%; }
  .small-actions button { width: 100%; }
  .fgv-summary, .fgv-table { font-size: 13px; }
  #readerContent { padding: 22px; font-size: 17px; }
}
