:root {
  color-scheme: light;
  --ink: #0b0f14;
  --muted: #5d6976;
  --line: #d9e2ee;
  --surface: #ffffff;
  --panel: #f4f7fb;
  --primary: #075bb8;
  --primary-dark: #033d7e;
  --accent: #f28c28;
  --danger: #a73535;
  --ok: #216e4e;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(135deg, #eef5ff 0%, #ffffff 48%, #fff2e6 100%);
  color: var(--ink);
}

button, input, textarea, select { font: inherit; }
button {
  border: 0;
  border-radius: 8px;
  min-height: 48px;
  padding: 0 22px;
  color: white;
  background: var(--primary);
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(7, 91, 184, 0.18);
}
button:hover { background: var(--primary-dark); }
button:disabled { cursor: wait; opacity: 0.7; }
.danger-button { background: var(--danger); min-height: 38px; padding: 0 14px; box-shadow: none; }
.danger-button:hover { background: #7f2525; }

.app-shell { width: min(1180px, 100%); margin: 0 auto; padding: 28px; }
.issuer-panel {
  min-height: calc(100vh - 56px);
  display: grid;
  grid-template-rows: auto 1fr;
}
.brand-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.school-logo {
  display: block;
  width: min(220px, 52vw);
  max-height: 92px;
  object-fit: contain;
}
.admin-link, .ghost-button {
  background: transparent;
  color: var(--primary-dark);
  border: 1px solid var(--line);
  box-shadow: none;
}
.voucher-machine {
  align-self: center;
  width: min(720px, 100%);
  padding: 8vh 0;
}
.eyebrow {
  margin: 0 0 10px;
  color: var(--primary-dark);
  font-size: 0.86rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
h1, h2, h3 { margin: 0; letter-spacing: 0; }
h1 { font-size: clamp(2.4rem, 8vw, 5.4rem); line-height: 0.95; max-width: 760px; }
h2 { font-size: 2rem; }
h3 { font-size: 1.15rem; margin-bottom: 16px; }
.voucher-form { margin-top: 36px; display: grid; gap: 14px; }
.voucher-form label { color: var(--muted); font-weight: 750; }
.voucher-form input {
  width: 100%;
  min-height: 76px;
  padding: 0 22px;
  border: 2px solid transparent;
  border-radius: 8px;
  background: var(--surface);
  font-size: clamp(1.25rem, 4vw, 2rem);
  box-shadow: 0 12px 34px rgba(11, 15, 20, 0.08);
}
.voucher-form input:focus { outline: none; border-color: var(--accent); }
.voucher-form button { min-height: 76px; font-size: 1.45rem; }
.message {
  min-height: 56px;
  margin-top: 22px;
  font-size: 1.12rem;
  font-weight: 760;
}
.message.ok { color: var(--ok); }
.message.error { color: var(--danger); }
.qr-preview { margin-top: 18px; display: flex; align-items: center; gap: 18px; }
.qr-preview img { width: 144px; height: 144px; border: 10px solid white; border-radius: 8px; box-shadow: 0 14px 28px rgba(11, 15, 20, 0.12); }
.download-link { display: inline-block; margin-top: 8px; color: var(--primary-dark); font-weight: 800; }
.admin-panel {
  margin-top: 28px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,0.88);
  box-shadow: 0 20px 60px rgba(11, 15, 20, 0.12);
}
.admin-head, .toolbar, .login-strip { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.admin-head { justify-content: space-between; margin-bottom: 20px; }
.login-strip { padding: 14px; background: var(--panel); border-radius: 8px; margin-bottom: 18px; }
.login-message { color: var(--danger); font-weight: 800; }
.login-strip input, .login-strip select, .settings-grid input {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: white;
}
.admin-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.metric-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: white;
}
.metric-card span { display: block; color: var(--muted); font-size: 0.92rem; }
.metric-card strong { display: block; margin-top: 8px; font-size: 2rem; }
.admin-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.admin-section {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}
.admin-section.wide { grid-column: 1 / -1; }
textarea {
  width: 100%;
  min-height: 190px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  line-height: 1.45;
}
.file-upload {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--muted);
  font-weight: 800;
}
.file-upload input {
  min-height: 48px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}
.report {
  white-space: pre-wrap;
  padding: 12px;
  min-height: 80px;
  background: #172026;
  color: #f4f8f8;
  border-radius: 8px;
  overflow: auto;
}
.settings-grid { display: grid; gap: 12px; margin-bottom: 16px; }
.settings-grid label { display: grid; gap: 6px; color: var(--muted); font-weight: 750; }
.check-row { grid-template-columns: auto 1fr; align-items: center; color: var(--ink) !important; }
.check-row input { min-height: auto; width: 20px; height: 20px; }
.provider-status { display: grid; grid-template-columns: repeat(3, minmax(160px, 1fr)); gap: 10px; margin-bottom: 14px; }
.status-pill { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: var(--panel); }
.status-pill b { display: block; }
.status-pill span { color: var(--muted); font-size: 0.9rem; }
.table-wrap { max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { position: sticky; top: 0; background: var(--panel); }
.app-footer {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 8px;
  padding: 28px 0 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}
.app-footer span {
  display: inline-flex;
  align-items: center;
  height: 60px;
}
.app-footer img {
  display: block;
  width: auto;
  height: 60px;
  object-fit: contain;
  mix-blend-mode: multiply;
}

@media (max-width: 820px) {
  .app-shell { padding: 18px; }
  .admin-grid, .admin-layout, .provider-status { grid-template-columns: 1fr; }
  .voucher-machine { padding: 56px 0; }
  .school-logo { width: min(180px, 54vw); max-height: 76px; }
}
