/* MOBILE-FIRST RESPONSIVE FORM */
:root {
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #111827;
  --muted: #64748b;
  --accent: #fbbf24;
  --accent-soft: rgba(251, 191, 36, 0.15);
  --brand-navy: #0f172a;
  --brand-navy-light: #1e293b;
  --border: #e2e8f0;
  --border-input: #d1d5db;
  --shadow: 0 20px 60px rgba(15, 23, 42, 0.12);
  --shadow-soft: 0 4px 24px rgba(15, 23, 42, 0.06);
  --radius-lg: 16px;
  --radius-xl: 20px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  background: #f1f5f9;
  color: var(--text);
  overflow-x: hidden;
}

.page-shell {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 16px 16px 24px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}

/* HERO SECTION */
.page-hero {
  width: 100%;
  padding: 24px 20px 28px;
  background:
    radial-gradient(circle at 100% 0%, rgba(251, 191, 36, 0.12) 0%, transparent 42%),
    linear-gradient(160deg, var(--brand-navy) 0%, #162032 55%, var(--brand-navy-light) 100%);
  color: white;
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow-soft);
}

.page-hero::before {
  content: none;
}

.hero-inner {
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
  z-index: 1;
}

.hero-left {
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
  z-index: 1;
}

.brand-block {
  display: flex;
  align-items: center;
}

.brand-logo {
  width: auto;
  max-width: min(220px, 100%);
  height: auto;
  max-height: 52px;
  object-fit: contain;
  display: block;
}

.brand-mark {
  display: none;
}

.hero-divider {
  height: 1px;
  background: linear-gradient(90deg, rgba(251, 191, 36, 0.55) 0%, rgba(255, 255, 255, 0.12) 35%, rgba(255, 255, 255, 0.08) 100%);
}

.hero-copy-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 38rem;
}

.hero-eyebrow {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero-copy-block h1 {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.hero-copy {
  margin: 4px 0 0 0;
  font-size: 0.9rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.82);
  max-width: 36rem;
}

.hero-right {
  display: none !important;
}

.date-label {
  display: none !important;
}

.date-controls {
  display: none !important;
}

.date-controls label {
  display: flex;
}

.date-controls input {
  width: 100%;
  min-height: 42px;
  border-radius: 10px;
  border: 2px solid rgba(255,255,255,0.6);
  padding: 10px 8px;
  background: rgba(255,255,255,0.25);
  color: #0f172a;
  font-weight: 700;
  text-align: center;
  font-size: 0.95rem;
}

.date-controls input::placeholder {
  color: rgba(15,23,42,0.6);
}

.date-controls span {
  color: rgba(255,255,255,0.85);
  font-size: 1rem;
  text-align: center;
}

/* FORM CARD */
.form-card {
  width: 100%;
  max-width: 100%;
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 22px 18px;
  margin: -18px auto 0;
  position: relative;
  z-index: 2;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.section-block {
  margin-bottom: 28px;
}

.section-block:last-of-type {
  margin-bottom: 12px;
}

.section-head {
  margin-bottom: 4px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.section-head h2 {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand-navy);
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-head h2::before {
  content: "";
  width: 3px;
  height: 1rem;
  border-radius: 999px;
  background: var(--accent);
  flex-shrink: 0;
}

.section-head p {
  margin: 8px 0 0 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.875rem;
}

/* FORM GRID - SINGLE COLUMN BY DEFAULT */
.form-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
  margin-top: 12px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-group span {
  font-size: 0.85rem;
  font-weight: 700;
  color: #334155;
}

.field-group input,
.field-group textarea {
  width: 100%;
  min-height: 46px;
  border-radius: 10px;
  border: 1px solid var(--border-input);
  background: var(--surface-soft);
  padding: 11px 12px;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  max-width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field-group input::placeholder {
  color: #cbd5e1;
}

.field-group input:focus,
.field-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.radio-group .radio-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 6px;
}

.radio-row label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #334155;
  font-size: 0.92rem;
  cursor: pointer;
}

.radio-row input {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* POLICY CHECKBOXES - SINGLE COLUMN */
.policy-checkbox-grid {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.policy-checkbox {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  align-items: start;
  padding: 14px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.policy-checkbox:has(input:checked) {
  border-color: rgba(251, 191, 36, 0.45);
  background: #fffbeb;
}

.policy-checkbox input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  cursor: pointer;
  flex-shrink: 0;
}

.policy-checkbox span {
  color: #334155;
  font-size: 0.9rem;
  line-height: 1.5;
  font-weight: 400;
}

.policy-checkbox a {
  color: #0f172a;
  text-decoration: none;
  font-weight: 700;
}

.policy-checkbox a:active {
  text-decoration: underline;
}

/* BUTTONS - MOBILE FIRST */
.actions-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 20px 0 16px 0;
}

button {
  border: none;
  cursor: pointer;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 0.92rem;
  font-weight: 700;
  transition: opacity 0.2s ease;
  min-height: 46px;
  width: 100%;
}

button.primary {
  background: var(--brand-navy);
  color: white;
}

button.primary:hover {
  background: #1e293b;
}

button.primary:active {
  opacity: 0.92;
}

button.secondary {
  background: #f8fafc;
  color: #334155;
  border: 1px solid #cbd5e1;
}

button.secondary:active {
  opacity: 0.85;
}

.signature-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 16px;
}

.signature-block {
  min-height: 70px;
  border-bottom: 2px solid #cbd5e1;
  display: flex;
  align-items: flex-end;
  padding-bottom: 6px;
  color: #475569;
  font-weight: 700;
  font-size: 0.8rem;
}

.academy-footer {
  width: 100%;
  max-width: 100%;
  margin: 20px auto 0;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.academy-footer .footer-contact {
  word-break: break-word;
}

.academy-footer p {
  margin: 0 0 6px 0;
}

.academy-footer p:last-child {
  margin-bottom: 0;
}

.toast {
  position: fixed;
  bottom: max(14px, env(safe-area-inset-bottom));
  left: 12px;
  right: 12px;
  background: #16a34a;
  color: white;
  border-radius: 10px;
  padding: 10px 14px;
  box-shadow: 0 8px 20px rgba(22, 163, 74, 0.3);
  transform: translateY(20px);
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  font-size: 0.85rem;
  max-width: calc(100vw - 24px);
  text-align: center;
  z-index: 1000;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.hidden {
  display: none;
}

.toast.error {
  background: #dc2626;
  box-shadow: 0 8px 20px rgba(220, 38, 38, 0.3);
}

.admin-shell {
  padding: 12px;
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
  max-width: 1400px;
  margin: 0 auto;
}

.admin-hero {
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 100% 0%, rgba(251, 191, 36, 0.1) 0%, transparent 42%),
    linear-gradient(160deg, var(--brand-navy) 0%, #162032 55%, var(--brand-navy-light) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow-soft);
}

.admin-hero::before {
  display: none;
}

.admin-hero .hero-copy-block h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.admin-hero .hero-copy {
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.9rem;
  max-width: 42rem;
}

.admin-card {
  margin-top: -18px;
  position: relative;
  z-index: 2;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.admin-toolbar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 18px;
}

.admin-key-field {
  max-width: 360px;
}

.admin-actions {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
}

.admin-actions button,
.admin-actions .link-button {
  width: 100%;
  min-height: 46px;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.admin-status {
  margin: 0 0 16px 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.admin-status.error {
  color: #dc2626;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
}

.table-scroll-hint {
  display: none;
  margin: 0 0 10px 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.submissions-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1800px;
  font-size: 0.85rem;
}

.submissions-table th,
.submissions-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  vertical-align: top;
}

.submissions-table th {
  background: var(--surface-soft);
  font-weight: 700;
  white-space: nowrap;
}

.submissions-table tr:last-child td {
  border-bottom: none;
}

.submissions-table .empty-row td {
  text-align: center;
  color: var(--muted);
  padding: 24px;
}

button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

/* SMALL PHONES - stack side-by-side buttons only when wide enough */
@media (min-width: 480px) {
  .actions-row {
    grid-template-columns: 1fr 1fr;
  }

  .toast {
    left: auto;
    right: max(14px, env(safe-area-inset-right));
    text-align: left;
    max-width: min(420px, calc(100vw - 28px));
  }
}

/* ADMIN MOBILE - card layout instead of wide table */
@media (max-width: 767px) {
  .admin-hero {
    border-radius: var(--radius-xl);
    padding: 24px 20px 28px;
  }

  .admin-card {
    width: 100%;
    margin-top: -18px;
  }

  .admin-key-field {
    max-width: none;
    width: 100%;
  }

  .table-wrap {
    overflow-x: visible;
    border: none;
    background: transparent;
    border-radius: 0;
  }

  .submissions-table {
    min-width: 0;
    font-size: 0.88rem;
  }

  .submissions-table thead {
    display: none;
  }

  .submissions-table tbody tr:not(.empty-row) {
    display: block;
    margin-bottom: 14px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
    overflow: hidden;
  }

  .submissions-table tbody tr:not(.empty-row) td {
    display: grid;
    grid-template-columns: minmax(108px, 42%) 1fr;
    gap: 8px 12px;
    align-items: start;
    padding: 10px 14px;
    border-bottom: 1px solid #f1f5f9;
    word-break: break-word;
  }

  .submissions-table tbody tr:not(.empty-row) td::before {
    content: attr(data-label);
    font-weight: 700;
    color: #64748b;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.4;
  }

  .submissions-table tbody tr:not(.empty-row) td:last-child {
    border-bottom: none;
  }

  .submissions-table .empty-row {
    display: block;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    background: var(--surface-soft);
  }

  .submissions-table .empty-row td {
    display: block;
    border-bottom: none;
    padding: 24px 16px;
  }
}

/* TABLET - 640px+ */
@media (min-width: 640px) {
  .page-shell {
    padding: 24px;
  }

  .page-hero {
    padding: 32px 36px 40px;
    border-radius: 24px;
  }

  .hero-copy-block h1 {
    font-size: 2rem;
  }

  .form-card {
    border-radius: 24px;
    padding: 32px;
    margin-top: -28px;
  }

  .field-group input,
  .field-group textarea {
    font-size: 0.95rem;
  }

  /* FORM GRID - 2 COLUMNS ON TABLET+ */
  .form-grid {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }

  .field-group.full-span {
    grid-column: span 2;
  }

  .actions-row {
    grid-template-columns: auto auto;
    justify-content: flex-end;
    gap: 12px;
  }

  button {
    padding: 12px 24px;
    width: auto;
    min-height: 44px;
  }

  .signature-row {
    grid-template-columns: 1fr 1fr;
    gap: 18px;
  }

  .academy-footer {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    margin-top: 24px;
  }

  .academy-footer p {
    margin: 0;
    font-size: 0.85rem;
  }

  .admin-shell {
    padding: 24px;
  }

  .admin-hero {
    border-radius: 20px;
    padding: 32px 36px 40px;
  }

  .admin-card {
    border-radius: 20px;
    padding: 28px;
    margin-top: -28px;
  }
}

/* ADMIN TABLET+ */
@media (min-width: 768px) {
  .admin-toolbar {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
  }

  .admin-actions {
    flex-direction: row;
    width: auto;
    justify-content: flex-end;
  }

  .admin-actions button,
  .admin-actions .link-button {
    width: auto;
  }

  .table-scroll-hint {
    display: block;
  }
}

/* DESKTOP - 1024px+ */
@media (min-width: 1024px) {
  .page-shell {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
  }

  .page-hero {
    padding: 36px 40px 44px;
    border-radius: 28px;
  }

  .hero-copy-block h1 {
    font-size: 2.15rem;
  }

  .form-card {
    padding: 36px;
    margin-top: -32px;
  }

  .admin-shell {
    max-width: 1400px;
    padding: 32px 24px;
  }

  .admin-hero .hero-copy-block h1 {
    font-size: 1.85rem;
  }

  .admin-card {
    margin-top: -32px;
  }

  .submissions-table {
    font-size: 0.875rem;
  }

  .submissions-table th,
  .submissions-table td {
    padding: 12px 14px;
  }
}
