/* ============ Design tokens ============ */
:root {
  --ink-950: #12181c;
  --ink-900: #1a2228;
  --ink-800: #232e36;
  --ink-700: #324049;
  --ink-600: #4a5a64;
  --ink-500: #657883;
  --ink-400: #8a99a2;
  --ink-300: #b4bfc6;
  --ink-200: #dae1e4;
  --ink-100: #eef2f3;
  --ink-50: #f6f8f8;

  --brand-900: #0f3d3e;
  --brand-800: #155052;
  --brand-700: #1b6567;
  --brand-600: #227d80;
  --brand-100: #e5f3f3;

  --gold-700: #8a5a20;
  --gold-300: #e8c287;
  --gold-100: #faefdc;

  --good: #2a8c5b;
  --warn: #b87a17;
  --bad: #b0413e;

  --font-display: 'Fraunces', ui-serif, Georgia, serif;
  --font-sans: 'Inter', ui-sans-serif, system-ui, sans-serif;

  --shadow-card: 0 1px 2px rgba(18, 24, 28, 0.06), 0 1px 1px rgba(18, 24, 28, 0.04);
  --radius: 0.7rem;
}

* { box-sizing: border-box; }

html { -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  background: var(--ink-50);
  color: var(--ink-900);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); margin: 0; }
p { margin: 0; }

:focus-visible { outline: 2px solid var(--brand-600); outline-offset: 2px; }

a { color: inherit; }

table { border-collapse: collapse; }

/* ============ Layout utilities ============ */
.container { max-width: 56rem; margin: 0 auto; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1 1 0%; }
.hidden { display: none !important; }
.grid { display: grid; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.w-full { width: 100%; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.capitalize { text-transform: capitalize; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.overflow-x-auto { overflow-x: auto; }

@media (min-width: 640px) {
  .sm-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sm-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sm-flex-row { flex-direction: row; }
}
@media (min-width: 1024px) {
  .lg-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ============ Spacing helpers ============ */
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-5 > * + * { margin-top: 1.25rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.375rem; }
.mb-3 { margin-bottom: 0.75rem; }
.ml-auto { margin-left: auto; }

/* ============ Typography ============ */
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.text-ink-400 { color: var(--ink-400); }
.text-ink-500 { color: var(--ink-500); }
.text-ink-600 { color: var(--ink-600); }
.text-ink-700 { color: var(--ink-700); }
.text-ink-800 { color: var(--ink-800); }
.text-ink-900 { color: var(--ink-900); }
.text-brand-700 { color: var(--brand-700); }
.text-good { color: var(--good); }
.text-bad { color: var(--bad); }

/* ============ Components ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  border-radius: 0.5rem; padding: 0.6rem 1rem; font-size: 0.875rem; font-weight: 500;
  border: none; cursor: pointer; transition: background-color 0.15s, opacity 0.15s;
  font-family: inherit;
}
.btn:disabled { opacity: 0.5; pointer-events: none; }
.btn-primary { background: var(--brand-800); color: #fff; }
.btn-primary:hover { background: var(--brand-900); }
.btn-secondary { background: #fff; color: var(--ink-800); border: 1px solid var(--ink-200); }
.btn-secondary:hover { background: var(--ink-50); }
.btn-ghost { background: transparent; color: var(--ink-600); padding: 0.5rem 0.6rem; }
.btn-ghost:hover { background: var(--ink-100); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-danger:hover { opacity: 0.9; }
.btn-sm { padding: 0.4rem 0.75rem; }

.card {
  background: #fff; border-radius: 0.85rem; border: 1px solid var(--ink-100); box-shadow: var(--shadow-card);
}
.card-p { padding: 1.25rem; }

.input {
  width: 100%; border-radius: 0.5rem; border: 1px solid var(--ink-200); background: #fff;
  padding: 0.6rem 0.75rem; font-size: 0.875rem; color: var(--ink-900); font-family: inherit;
}
.input:focus { border-color: var(--brand-600); outline: 2px solid var(--brand-600); outline-offset: 0; }
.input::placeholder { color: var(--ink-400); }
.input.error { border-color: var(--bad); }

.label { display: block; font-size: 0.875rem; font-weight: 500; color: var(--ink-700); margin-bottom: 0.375rem; }
.field-error { margin-top: 0.25rem; font-size: 0.75rem; color: var(--bad); }

.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 0.2rem 0.6rem; font-size: 0.75rem; font-weight: 500; }
.badge-good { background: rgba(42,140,91,0.1); color: var(--good); }
.badge-gold { background: var(--gold-100); color: var(--gold-700); }

.pill-group { display: inline-flex; border-radius: 0.5rem; border: 1px solid var(--ink-200); background: #fff; padding: 0.2rem; }
.pill { border-radius: 0.4rem; padding: 0.4rem 0.9rem; font-size: 0.875rem; font-weight: 500; border: none; background: transparent; color: var(--ink-600); cursor: pointer; font-family: inherit; }
.pill.active { background: var(--brand-800); color: #fff; }

table.data-table { width: 100%; font-size: 0.875rem; }
table.data-table th { text-align: left; color: var(--ink-500); font-weight: 500; padding: 0.75rem 1rem; border-bottom: 1px solid var(--ink-100); }
table.data-table td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--ink-50); }
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tr:hover td { background: rgba(238,242,243,0.6); }

.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 4rem 1.5rem; }
.empty-state .icon { color: var(--ink-300); margin-bottom: 1rem; }
.empty-state h3 { font-size: 1.125rem; font-weight: 600; color: var(--ink-800); }
.empty-state p { margin-top: 0.4rem; max-width: 24rem; font-size: 0.875rem; color: var(--ink-500); }
.empty-state .actions { margin-top: 1.25rem; display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: center; }

/* ============ App shell ============ */
#app { min-height: 100vh; }

.shell-sidebar {
  display: none;
  position: fixed; inset: 0 auto 0 0; width: 16rem; flex-direction: column;
  border-right: 1px solid var(--ink-100); background: #fff; z-index: 10;
}
.shell-sidebar .brand { padding: 1.25rem; border-bottom: 1px solid var(--ink-100); display: flex; align-items: center; gap: 0.65rem; }
.shell-sidebar .brand .name { font-family: var(--font-display); font-size: 1.125rem; font-weight: 600; color: var(--ink-900); line-height: 1.2; }
.shell-sidebar .brand .tag { font-size: 0.68rem; color: var(--ink-400); margin-top: 0.15rem; }
.brand-mark { border-radius: 22%; flex-shrink: 0; display: block; }
.shell-sidebar nav { flex: 1; overflow-y: auto; padding: 1rem 0.75rem; display: flex; flex-direction: column; gap: 0.15rem; }
.shell-sidebar .footer { padding: 1rem; border-top: 1px solid var(--ink-100); font-size: 0.75rem; color: var(--ink-400); }

.nav-link {
  display: flex; align-items: center; gap: 0.75rem; border-radius: 0.5rem; padding: 0.55rem 0.75rem;
  font-size: 0.875rem; color: var(--ink-600); text-decoration: none; cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.nav-link:hover { background: var(--ink-100); transform: translateX(2px); }
.nav-link.active { background: var(--brand-800); color: #fff; animation: navActiveIn var(--dur-base) var(--ease-spring) both; }
.nav-link.active:hover { transform: none; }
.nav-link svg { flex-shrink: 0; transition: transform var(--dur-fast) var(--ease-spring); }
.nav-link:hover svg { transform: scale(1.1); }
@keyframes navActiveIn { from { transform: scale(0.97); } to { transform: scale(1); } }

.shell-main { }
.shell-topbar {
  position: sticky; top: 0; z-index: 8; border-bottom: 1px solid var(--ink-100);
  background: rgba(255,255,255,0.95); backdrop-filter: blur(6px);
}
.shell-topbar-inner { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; }
.search-wrap { position: relative; flex: 1; max-width: 28rem; }
.search-wrap .icon { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); color: var(--ink-400); pointer-events: none; }
.search-wrap input { padding-left: 2.25rem; }
.search-results { position: absolute; margin-top: 0.25rem; width: 100%; background: #fff; border-radius: 0.85rem; border: 1px solid var(--ink-100); box-shadow: var(--shadow-card); padding: 0.35rem; z-index: 20; }
.search-results button { width: 100%; text-align: left; padding: 0.5rem 0.75rem; border-radius: 0.4rem; border: none; background: transparent; cursor: pointer; font-size: 0.875rem; display: flex; justify-content: space-between; font-family: inherit; }
.search-results button:hover { background: var(--ink-50); }
.avatar { height: 2rem; width: 2rem; border-radius: 999px; background: var(--brand-700); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 0.875rem; font-weight: 500; transition: transform var(--dur-fast) var(--ease-spring); }
.avatar-btn:hover .avatar { transform: scale(1.08); }
.brand-mark { transition: transform var(--dur-base) var(--ease-spring); }
.pub-brand:hover .brand-mark, .shell-sidebar .brand:hover .brand-mark { transform: rotate(-6deg) scale(1.06); }

.shell-content { padding: 1.25rem 1rem 6rem; }

.mobile-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; background: #fff; border-top: 1px solid var(--ink-100);
  display: grid; grid-template-columns: repeat(5, 1fr);
}
.mobile-nav .nav-link { flex-direction: column; gap: 0.15rem; padding: 0.55rem 0.25rem; border-radius: 0; font-size: 0.68rem; text-align: center; color: var(--ink-400); }
.mobile-nav .nav-link.active { background: transparent; color: var(--brand-800); }

.drawer-overlay { position: fixed; inset: 0; background: rgba(18,24,28,0.4); z-index: 30; }
.drawer { position: fixed; top: 0; bottom: 0; left: 0; width: 18rem; background: #fff; z-index: 31; padding: 1rem; overflow-y: auto; }

.modal-overlay { position: fixed; inset: 0; background: rgba(18,24,28,0.4); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.modal-panel { position: relative; width: 100%; max-width: 36rem; background: #fff; border-radius: 1rem 1rem 0 0; max-height: 90vh; overflow-y: auto; }
.modal-header { position: sticky; top: 0; background: #fff; border-bottom: 1px solid var(--ink-100); padding: 1rem 1.25rem; display: flex; align-items: center; justify-content: space-between; }
.modal-body { padding: 1.25rem; }
.modal-footer { position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--ink-100); padding: 1rem 1.25rem; display: flex; justify-content: flex-end; gap: 0.75rem; }

.offline-chip { display: inline-flex; align-items: center; gap: 0.35rem; border-radius: 999px; background: var(--gold-100); color: var(--gold-700); font-size: 0.75rem; padding: 0.3rem 0.7rem; }

.tabs { display: flex; gap: 0.25rem; overflow-x: auto; border-bottom: 1px solid var(--ink-100); }
.tab-btn { padding: 0.6rem 0.85rem; font-size: 0.875rem; white-space: nowrap; border: none; background: transparent; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; color: var(--ink-500); font-family: inherit; }
.tab-btn.active { color: var(--brand-800); font-weight: 500; border-bottom-color: var(--brand-700); }

@media (min-width: 1024px) {
  .shell-sidebar { display: flex; }
  .shell-main { padding-left: 16rem; }
  .shell-content { padding: 1.5rem; }
  .mobile-nav, .hamburger { display: none !important; }
}

/* Status pill buttons for attendance */
.status-btn { border-radius: 999px; border: 1px solid var(--ink-200); padding: 0.3rem 0.75rem; font-size: 0.75rem; font-weight: 500; background: #fff; color: var(--ink-400); cursor: pointer; font-family: inherit; }
.status-btn.present.active { background: rgba(42,140,91,0.1); color: var(--good); border-color: rgba(42,140,91,0.3); }
.status-btn.absent.active { background: rgba(176,65,62,0.1); color: var(--bad); border-color: rgba(176,65,62,0.3); }
.status-btn.late.active { background: var(--gold-100); color: var(--gold-700); border-color: var(--gold-300); }
.status-btn.excused.active { background: var(--ink-100); color: var(--ink-600); border-color: var(--ink-300); }

/* Wizard */
.wizard-header { border-bottom: 1px solid var(--ink-100); background: #fff; padding: 1.25rem 1.5rem; }
.wizard-steps { display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; font-size: 0.75rem; color: var(--ink-400); padding: 1rem 1.5rem 0; max-width: 48rem; margin: 0 auto; }
.wizard-steps .done { color: var(--ink-600); }
.wizard-steps .current { color: var(--brand-700); font-weight: 500; }
.type-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0.5rem; }
.type-choice { border-radius: 0.5rem; border: 1px solid var(--ink-200); padding: 0.65rem 0.75rem; font-size: 0.875rem; text-align: left; background: #fff; cursor: pointer; font-family: inherit; }
.type-choice.active { border-color: var(--brand-600); background: var(--brand-100); color: var(--brand-800); }

/* ============ Print ============ */
@media print {
  .shell-sidebar, .shell-topbar, .mobile-nav, .no-print { display: none !important; }
  .shell-main { padding-left: 0 !important; }
  .shell-content { padding: 0 !important; }
  .print-only { display: block !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: none; }
}

/* ============ Public site (landing, login, sign-up) ============ */
.pub { min-height: 100vh; background: #fff; }
.pub-container { max-width: 68rem; margin: 0 auto; padding: 0 1.25rem; }

.pub-header { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,0.96); backdrop-filter: blur(6px); border-bottom: 1px solid var(--ink-100); }
.pub-header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 4rem; }
.pub-brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; font-family: var(--font-display); font-size: 1.1rem; font-weight: 600; color: var(--ink-900); }
.pub-links { display: none; gap: 0.25rem; }
.pub-links button { background: none; border: none; cursor: pointer; font-family: inherit; font-size: 0.9rem; color: var(--ink-600); padding: 0.5rem 0.8rem; border-radius: 0.5rem; }
.pub-links button:hover { background: var(--ink-100); }
.pub-actions { display: flex; gap: 0.5rem; }
.pub-actions a { text-decoration: none; }

.pub-hero { position: relative; overflow: hidden; background: radial-gradient(120% 90% at 80% 0%, #1b3a4a 0%, #12181c 55%, #0d1216 100%); color: #fff; padding: 4rem 0 3.5rem; }
.hero-orbs { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.hero-orb { position: absolute; border-radius: 999px; filter: blur(50px); opacity: 0.55; animation: floatOrb 14s ease-in-out infinite; }
.hero-orb-1 { width: 22rem; height: 22rem; top: -6rem; right: -4rem; background: radial-gradient(circle, rgba(124, 211, 232, 0.55), transparent 70%); animation-duration: 16s; }
.hero-orb-2 { width: 16rem; height: 16rem; bottom: -5rem; left: 8%; background: radial-gradient(circle, rgba(34, 125, 128, 0.5), transparent 70%); animation-duration: 20s; animation-delay: -4s; }
.hero-orb-3 { width: 12rem; height: 12rem; top: 30%; left: 35%; background: radial-gradient(circle, rgba(201, 162, 39, 0.28), transparent 70%); animation-duration: 18s; animation-delay: -9s; }
.hero-content { position: relative; z-index: 1; }
.hero-in { opacity: 0; animation: fadeInUp var(--dur-slow) var(--ease-out) both; }
.pub-eyebrow { font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--brand-300, #93cbcc); margin-bottom: 0.9rem; }
.pub-hero h1 { font-size: 2.1rem; line-height: 1.15; font-weight: 600; max-width: 40rem; }
.pub-hero h1 span { color: #7fd0e8; }
.pub-lead { margin-top: 1rem; max-width: 36rem; color: #c9d4da; font-size: 1.05rem; line-height: 1.55; }
.pub-cta { margin-top: 1.75rem; display: flex; flex-wrap: wrap; gap: 0.75rem; }
.pub-cta a { text-decoration: none; }
.btn-hero-secondary { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,0.35); }
.btn-hero-secondary:hover { background: rgba(255,255,255,0.1); }
.pub-highlights { list-style: none; margin: 2rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; font-size: 0.85rem; color: #aebcc4; }
.pub-highlights li::before { content: '✓'; color: #7fd0e8; margin-right: 0.4rem; }

.pub-section { padding: 3.5rem 0; }
.pub-alt { background: var(--ink-50); }
.pub-section h2, .pub-band h2 { font-size: 1.6rem; font-weight: 600; }
.pub-section-lead { margin-top: 0.5rem; color: var(--ink-500); max-width: 40rem; }
.pub-soon, .pub-note { margin-top: 1.5rem; font-size: 0.85rem; color: var(--ink-500); }

.feature-grid { margin-top: 2rem; display: grid; grid-template-columns: 1fr; gap: 1rem; }
.feature-card { border: 1px solid var(--ink-100); border-radius: 0.9rem; padding: 1.25rem; background: #fff; box-shadow: var(--shadow-card); }
.feature-icon { width: 2.6rem; height: 2.6rem; border-radius: 0.65rem; background: var(--brand-100); color: var(--brand-700); display: flex; align-items: center; justify-content: center; margin-bottom: 0.8rem; }
.feature-card h3 { font-size: 1.05rem; font-weight: 600; }
.feature-card p { margin-top: 0.35rem; font-size: 0.9rem; color: var(--ink-600); line-height: 1.5; }

.steps-grid { margin-top: 2rem; display: grid; grid-template-columns: 1fr; gap: 1rem; }
.step { background: #fff; border: 1px solid var(--ink-100); border-radius: 0.9rem; padding: 1.25rem; }
.step span { display: inline-flex; width: 2rem; height: 2rem; border-radius: 999px; background: var(--brand-800); color: #fff; align-items: center; justify-content: center; font-weight: 600; margin-bottom: 0.6rem; }
.step h3 { font-size: 1.05rem; font-weight: 600; }
.step p { margin-top: 0.35rem; font-size: 0.9rem; color: var(--ink-600); line-height: 1.5; }

.chip-row { margin-top: 1.5rem; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip { border: 1px solid var(--ink-200); background: #fff; color: var(--ink-700); border-radius: 999px; padding: 0.45rem 0.95rem; font-size: 0.875rem; cursor: pointer; font-family: inherit; }
.chip.active { background: var(--brand-800); border-color: var(--brand-800); color: #fff; }
.plan-group { margin-top: 2rem; }
.plan-group h3 { font-size: 1.2rem; font-weight: 600; }
.plan-group-blurb { margin-top: 0.25rem; font-size: 0.9rem; color: var(--ink-500); }
.plan-grid { margin-top: 1rem; display: grid; grid-template-columns: 1fr; gap: 1rem; }
.plan-card { position: relative; border: 1px solid var(--ink-200); border-radius: 1rem; padding: 1.4rem; background: #fff; display: flex; flex-direction: column; gap: 0.6rem; }
.plan-card.popular { border-color: var(--brand-600); box-shadow: 0 0 0 1px var(--brand-600); }
.plan-flag { position: absolute; top: -0.7rem; right: 1rem; background: var(--brand-800); color: #fff; font-size: 0.72rem; font-weight: 600; padding: 0.2rem 0.65rem; border-radius: 999px; }
.plan-card h4 { font-family: var(--font-display); font-size: 1.1rem; font-weight: 600; margin: 0; }
.plan-pop { color: var(--ink-500); font-size: 0.875rem; }
.plan-onboarding { display: flex; flex-direction: column; margin: 0.4rem 0; }
.plan-onboarding strong { font-size: 1.5rem; font-family: var(--font-display); }
.plan-onboarding span { font-size: 0.8rem; color: var(--ink-500); }
.plan-fees { list-style: none; margin: 0 0 0.6rem; padding: 0; border-top: 1px solid var(--ink-100); }
.plan-fees li { display: flex; justify-content: space-between; gap: 0.75rem; padding: 0.55rem 0; border-bottom: 1px solid var(--ink-100); font-size: 0.85rem; color: var(--ink-600); }
.plan-fees strong { color: var(--ink-900); white-space: nowrap; }
.plan-card .btn { text-decoration: none; margin-top: auto; }

.pub-band { background: var(--brand-900); color: #fff; text-align: center; padding: 3rem 0; }
.pub-band .btn { margin-top: 1.25rem; text-decoration: none; }
.pub-footer { padding: 2rem 0; background: var(--ink-950); color: #aebcc4; font-size: 0.875rem; }
.pub-footnote { font-size: 0.78rem; color: var(--ink-400); margin-top: 0.4rem; }
.pub-footer .pub-footnote { color: #80909a; }

.auth-wrap { padding-top: 2.5rem; padding-bottom: 3rem; max-width: 40rem; }
.auth-card { background: #fff; border: 1px solid var(--ink-100); border-radius: 1rem; box-shadow: var(--shadow-card); padding: 1.6rem; margin-bottom: 1rem; }
.auth-card h1 { font-size: 1.5rem; font-weight: 600; }
.auth-sub { margin: 0.35rem 0 1.25rem; color: var(--ink-500); font-size: 0.9rem; }
.auth-switch { font-size: 0.875rem; color: var(--ink-500); text-align: center; }
.auth-switch a { color: var(--brand-700); font-weight: 500; }
.plan-summary { margin-top: 0.6rem; font-size: 0.85rem; color: var(--ink-600); background: var(--ink-50); border-radius: 0.5rem; padding: 0.6rem 0.75rem; }
.notice { display: flex; gap: 0.6rem; align-items: flex-start; background: var(--gold-100); border: 1px solid var(--gold-300); border-radius: 0.6rem; padding: 0.7rem 0.85rem; font-size: 0.85rem; color: var(--ink-800); }

.account-wrap { position: relative; }
.account-menu { position: absolute; right: 0; top: calc(100% + 0.4rem); width: 15rem; background: #fff; border: 1px solid var(--ink-100); border-radius: 0.8rem; box-shadow: 0 8px 24px rgba(18,24,28,0.12); padding: 0.4rem; z-index: 25; }
.account-menu .who { padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--ink-100); margin-bottom: 0.3rem; }
.account-menu .who p:first-child { font-weight: 600; font-size: 0.9rem; }
.account-menu .who p { font-size: 0.78rem; color: var(--ink-500); word-break: break-all; }
.account-menu button { width: 100%; text-align: left; background: none; border: none; cursor: pointer; padding: 0.55rem 0.75rem; border-radius: 0.5rem; font-family: inherit; font-size: 0.875rem; color: var(--ink-700); }
.account-menu button:hover { background: var(--ink-50); }
.avatar-btn { background: none; border: none; padding: 0; cursor: pointer; border-radius: 999px; }

@media (min-width: 640px) {
  .pub-hero h1 { font-size: 2.8rem; }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .steps-grid { grid-template-columns: repeat(3, 1fr); }
  .plan-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
  .pub-links { display: flex; }
  .feature-grid { grid-template-columns: repeat(3, 1fr); }
  .plan-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ============ Platform administration + invoices ============ */
.badge-muted { background: var(--ink-100); color: var(--ink-600); }
.badge-bad { background: rgba(176,65,62,0.1); color: var(--bad); }
.stat-num { margin-top: 0.4rem; font-family: var(--font-display); font-size: 1.875rem; font-weight: 600; }
.admin-shell { min-height: 100vh; background: var(--ink-50); }
.admin-header { background: var(--ink-950); color: #fff; }
.admin-header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 4rem; }
.admin-title { font-family: var(--font-display); font-weight: 600; line-height: 1.1; }
.admin-sub { font-size: 0.72rem; color: #8fa1ab; }
.admin-who { font-size: 0.85rem; color: #c9d4da; display: none; }
@media (min-width: 640px) { .admin-who { display: inline; } }

.invoice-doc { color: var(--ink-900); }
.invoice-top { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; border-bottom: 1px solid var(--ink-100); padding-bottom: 1rem; margin-bottom: 1rem; }
.invoice-business { font-family: var(--font-display); font-size: 1.2rem; font-weight: 600; }
.invoice-title { text-align: right; }
.invoice-title h2 { font-size: 1.4rem; letter-spacing: 0.08em; color: var(--brand-800); }
.invoice-meta { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; font-size: 0.9rem; }
.invoice-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-500); }
.invoice-muted { font-size: 0.85rem; color: var(--ink-500); }
.invoice-sum td { font-weight: 600; border-top: 1px solid var(--ink-200); }
.invoice-payments { margin: 0.4rem 0 0; padding-left: 1.1rem; font-size: 0.85rem; color: var(--ink-600); }
.invoice-pay { margin-top: 1.25rem; padding: 0.8rem 1rem; background: var(--ink-50); border-radius: 0.6rem; font-size: 0.9rem; }

.progress-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.progress-steps li { display: flex; align-items: center; gap: 0.6rem; font-size: 0.9rem; color: var(--ink-500); }
.progress-steps li span { width: 1.3rem; height: 1.3rem; border-radius: 999px; border: 1.5px solid var(--ink-300); display: inline-flex; align-items: center; justify-content: center; font-size: 0.75rem; }
.progress-steps li.done { color: var(--ink-900); }
.progress-steps li.done span { background: var(--good); border-color: var(--good); color: #fff; }

@media print {
  .pub-header, .admin-header { display: none !important; }
  .admin-shell, .pub { background: #fff; }
  .auth-card { border: none; box-shadow: none; padding: 0; }
}

.low-stock { color: var(--bad); font-weight: 600; }

/* ============================================================
   Motion system
   - Tokens + keyframes live here once; everything else just
     references them, so tuning speed/feel is a one-file edit.
   - prefers-reduced-motion collapses everything to near-instant
     at the very end of this block, after all animations are
     defined, so it always wins.
   ============================================================ */
:root {
  --dur-fast: 150ms;
  --dur-base: 220ms;
  --dur-slow: 420ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.96) translateY(4px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes floatOrb {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(2%, -3%) scale(1.04); }
  66% { transform: translate(-2%, 2%) scale(0.97); }
}
@keyframes drawerSlideIn {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}
@keyframes shimmer {
  from { background-position: -200% 0; }
  to { background-position: 200% 0; }
}
@keyframes softPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 125, 128, 0.35); }
  50% { box-shadow: 0 0 0 8px rgba(34, 125, 128, 0); }
}

/* ---- Entrance animations, applied via class toggles ---- */
.route-enter { animation: fadeInUp var(--dur-slow) var(--ease-out) both; }
.reveal { opacity: 0; transform: translateY(16px); transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out); }
.reveal.in-view { opacity: 1; transform: translateY(0); }
.reveal-stagger.in-view > * { animation: fadeInUp var(--dur-base) var(--ease-out) both; }
.reveal-stagger.in-view > *:nth-child(1) { animation-delay: 0ms; }
.reveal-stagger.in-view > *:nth-child(2) { animation-delay: 60ms; }
.reveal-stagger.in-view > *:nth-child(3) { animation-delay: 120ms; }
.reveal-stagger.in-view > *:nth-child(4) { animation-delay: 180ms; }
.reveal-stagger.in-view > *:nth-child(5) { animation-delay: 240ms; }
.reveal-stagger.in-view > *:nth-child(6) { animation-delay: 300ms; }
.reveal-stagger.in-view > *:nth-child(n+7) { animation-delay: 360ms; }

/* ---- Global interactive polish: buttons, inputs, badges ---- */
.btn { transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out); }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn-primary:hover:not(:disabled) { box-shadow: 0 4px 14px rgba(21, 80, 82, 0.28); transform: translateY(-1px); }
.input, select.input, textarea.input { transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out); }
.badge { transition: transform var(--dur-fast) var(--ease-out); }
.chip, .pill { transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out); }
.chip:hover, .pill:hover { transform: translateY(-1px); }

/* ---- Cards: soft lift + 3D tilt on surfaces meant to be clicked ---- */
.card { transition: box-shadow var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out); }
.card-interactive, .feature-card, .step, .plan-card, .stat-card-link {
  transition: transform var(--dur-base) var(--ease-spring), box-shadow var(--dur-base) var(--ease-out);
  transform-style: preserve-3d;
}
.feature-card:hover, .step:hover, .plan-card:hover {
  transform: perspective(700px) rotateX(2deg) translateY(-4px);
  box-shadow: 0 16px 32px -12px rgba(18, 24, 28, 0.18);
}
.plan-card.popular:hover { transform: perspective(700px) rotateX(2deg) translateY(-6px); }

/* ---- Modals: fade backdrop, scale-in panel ---- */
.modal-overlay { animation: fadeIn var(--dur-base) var(--ease-out) both; }
.modal-panel { animation: scaleIn var(--dur-base) var(--ease-spring) both; }
.drawer-overlay { animation: fadeIn var(--dur-base) var(--ease-out) both; }
.drawer { animation: drawerSlideIn var(--dur-base) var(--ease-out) both; }
.search-results { animation: scaleIn var(--dur-fast) var(--ease-out) both; }
.account-menu:not(.hidden) { animation: scaleIn var(--dur-fast) var(--ease-out) both; }

/* ---- Tables: subtle motion on hover and on refresh ---- */
table.data-table tbody tr { transition: background-color var(--dur-fast) var(--ease-out); }
table.data-table tbody { animation: fadeIn var(--dur-base) var(--ease-out) both; }

/* ---- Stat cards with animated counters ---- */
.stat-num, .plan-onboarding strong { transition: color var(--dur-fast) var(--ease-out); }

/* ---- Skeleton loading shimmer (available for future async states) ---- */
.skeleton {
  background: linear-gradient(90deg, var(--ink-100) 25%, var(--ink-50) 37%, var(--ink-100) 63%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: 0.4rem;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
