:root {
  --primary: #2563eb;
  --primary-dark: #1e3a8a;
  --primary-light: #eff6ff;
  --text: #0f172a;
  --text-muted: #64748b;
  --bg: #f8fafc;
  --white: #ffffff;
  --border: #e2e8f0;
  --success: #16a34a;
  --success-bg: #f0fdf4;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 20px 40px -12px rgba(15, 23, 42, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(248, 250, 252, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 16px;
  text-decoration: none;
  color: var(--text);
}

.brand-badge {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
  display: block;
}

.brand small {
  display: block;
  font-weight: 500;
  font-size: 11px;
  color: var(--text-muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  padding: 11px 20px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-dark {
  background: var(--primary-dark);
  color: #fff;
}

.btn-outline {
  background: #fff;
  color: var(--text);
  border-color: var(--border);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 7px 14px;
  font-size: 13px;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Hero */
.hero {
  padding: 72px 0 56px;
  background:
    radial-gradient(circle at 15% 20%, rgba(37, 99, 235, 0.10), transparent 45%),
    radial-gradient(circle at 85% 0%, rgba(30, 58, 138, 0.10), transparent 40%);
}

.hero-inner {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 48px;
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary-light);
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 20px;
}

.hero h1 {
  font-size: 46px;
  line-height: 1.1;
  font-weight: 800;
  margin: 0 0 18px;
  letter-spacing: -0.02em;
}

.hero p.lead {
  font-size: 18px;
  color: var(--text-muted);
  margin: 0 0 28px;
  max-width: 46ch;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.hero-stats {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
}

.hero-stat b {
  display: block;
  font-size: 22px;
  font-weight: 800;
  color: var(--primary-dark);
}

.hero-stat span {
  font-size: 13px;
  color: var(--text-muted);
}

/* Voucher card visual */
.voucher-card {
  background: linear-gradient(160deg, var(--primary-dark), var(--primary) 70%);
  border-radius: 22px;
  padding: 32px;
  color: #fff;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.voucher-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 90% 10%, rgba(255, 255, 255, 0.18), transparent 55%);
}

.voucher-card .tag {
  display: inline-block;
  background: rgba(255, 255, 255, 0.16);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 16px;
}

.voucher-card h3 {
  font-size: 26px;
  margin: 0 0 8px;
}

.voucher-card p {
  opacity: 0.92;
  margin: 0 0 24px;
  font-size: 14px;
}

.voucher-progress {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
  margin-bottom: 10px;
}

.voucher-progress-fill {
  height: 100%;
  background: #fff;
  border-radius: 999px;
  transition: width 0.4s ease;
}

.voucher-progress-label {
  font-size: 13px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
}

/* Sections */
.section {
  padding: 64px 0;
}

.section-head {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 40px;
}

.section-head h2 {
  font-size: 32px;
  font-weight: 800;
  margin: 0 0 12px;
  letter-spacing: -0.01em;
}

.section-head p {
  color: var(--text-muted);
  font-size: 16px;
  margin: 0;
}

.grid {
  display: grid;
  gap: 20px;
}

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 16px;
  font-weight: 800;
}

.card h3 {
  margin: 0 0 8px;
  font-size: 17px;
}

.card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
}

.step {
  position: relative;
  padding-left: 52px;
}

.step-num {
  position: absolute;
  left: 0;
  top: 0;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--primary-dark);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}

/* Units band */
.unidades-band {
  background: var(--primary-dark);
  color: #fff;
  padding: 48px 0;
}

.unidades-band .section-head h2,
.unidades-band .section-head p {
  color: #fff;
}

.unidades-band .section-head p {
  opacity: 0.85;
}

.unidade-chip {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  padding: 20px;
}

.unidade-chip b {
  display: block;
  font-size: 15px;
  margin-bottom: 4px;
}

.unidade-chip span {
  font-size: 13px;
  opacity: 0.8;
}

/* Consulta status */
.consulta-card {
  max-width: 560px;
  margin: 0 auto;
}

.form-row {
  display: flex;
  gap: 10px;
}

.form-row input {
  flex: 1;
}

/* Forms */
.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.field .hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="password"],
select {
  width: 100%;
  padding: 11px 14px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  font-family: inherit;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}

.alert-error {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: #fecaca;
}

.alert-success {
  background: var(--success-bg);
  color: var(--success);
  border-color: #bbf7d0;
}

.alert-warning {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: #fde68a;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}

.badge-pending {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge-done {
  background: var(--success-bg);
  color: var(--success);
}

.badge-none {
  background: #f1f5f9;
  color: var(--text-muted);
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}

/* Auth layout (login/painel) */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
  box-shadow: var(--shadow-lg);
}

.auth-card .brand {
  justify-content: center;
  margin-bottom: 24px;
}

.auth-card h1 {
  font-size: 20px;
  text-align: center;
  margin: 0 0 6px;
}

.auth-card p.sub {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  margin: 0 0 24px;
}

/* App shell (painel escola / loja) */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.app-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
}

.admin-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
}

.admin-nav-link {
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  transition: background-color 180ms ease, color 180ms ease;
}

.admin-nav-link:hover {
  color: var(--text);
}

.admin-nav-link.active {
  background: var(--primary);
  color: #fff;
}

.app-header .who {
  text-align: right;
}

.app-header .who b {
  display: block;
  font-size: 14px;
}

.app-header .who span {
  font-size: 12px;
  color: var(--text-muted);
}

.app-main {
  flex: 1;
  padding: 32px 24px;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
}

.panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.panel-title h2 {
  font-size: 17px;
  margin: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

th,
td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

tbody tr:hover {
  background: var(--bg);
}

.table-wrap {
  overflow-x: auto;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.search-box {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}

.search-box input {
  max-width: 320px;
}

/* Signature pad */
.sig-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  touch-action: none;
}

.sig-wrap canvas {
  width: 100%;
  height: 180px;
  display: block;
  cursor: crosshair;
  border-radius: var(--radius-sm);
}

.photo-preview {
  width: 100%;
  max-width: 260px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-top: 10px;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
  z-index: 50;
}

.modal {
  background: #fff;
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
}

.modal-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.modal-title h3 {
  margin: 0;
  font-size: 17px;
}

.close-btn {
  border: none;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
}

.detail-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 20px;
  margin-bottom: 18px;
  font-size: 14px;
}

.detail-list dt {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.detail-list dd {
  margin: 0;
  font-weight: 600;
}

.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

@media (max-width: 900px) {
  .hero-inner {
    grid-template-columns: 1fr;
  }

  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }

  .detail-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .hero h1 {
    font-size: 32px;
  }

  .grid-4,
  .grid-3,
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .app-header .who {
    display: none;
  }

  .form-row {
    flex-direction: column;
  }
}
