/* Shared by every makan+ page. Mobile first: large touch targets (hands may be wet or full), strong contrast (bright sun), and a dark theme for evenings. */
:root {
  --bg: #f4f6f2;
  --surface: #ffffff;
  --text: #1b1f1c;
  --muted: #5a645d;
  --line: #d5dbd4;
  --brand: #0b6b3a;
  --brand-text: #ffffff;
  --new: #c2410c;
  --prep: #1c63b5;
  --ready: #0b6b3a;
  --danger: #b42318;
  --warn-bg: #fff3cd;
  --warn-text: #5c4300;
  --error-bg: #fde8e6;
  --error-text: #7a1a12;
  --info-bg: #e3f0fb;
  --info-text: #0e3d6b;
  --radius: 14px;
  --tap: 3.25rem;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  --on-new: #ffffff;
  --on-danger: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101411; --surface: #1b211c; --text: #eef2ee; --muted: #a5afa7; --line: #36413a;
    --brand: #2fbf71; --brand-text: #05210f; --new: #ff8a4c; --on-new: #1b1f1c; --on-danger: #1b1f1c; --prep: #6aa8ff; --ready: #2fbf71; --danger: #ff7b6e;
    --warn-bg: #3d3300; --warn-text: #ffe59a; --error-bg: #4a1a15; --error-text: #ffd0cb; --info-bg: #11304d; --info-text: #cfe6fb;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 1rem/1.4 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; overflow-wrap: anywhere; } /* a long word (a link typed into a name) wraps instead of widening the page */
h1, h2 { margin: 0; line-height: 1.2; }
h2 { font-size: 1.125rem; }
p { margin: 0 0 0.5rem; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--prep); outline-offset: 2px; }
[hidden] { display: none !important; }
.loading { padding: 3rem 1rem; text-align: center; color: var(--muted); }

/* Buttons */
.btn { min-height: var(--tap); padding: 0.5rem 1.1rem; border: 2px solid var(--line); border-radius: var(--radius); background: var(--surface); font-weight: 650; cursor: pointer; touch-action: manipulation; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-text); }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn:disabled { opacity: 0.55; cursor: progress; }
.btn.block { width: 100%; }
.link { background: none; border: 0; padding: 0.6rem; color: var(--prep); text-decoration: underline; cursor: pointer; min-height: 2.75rem; }
.link.center { display: block; margin: 0.5rem auto; }

/* Sign-in */
.signin { max-width: 26rem; margin: 0 auto; padding: 2rem 1rem; }
.signin h2 { margin: 1rem 0 0.75rem; }
.brand { display: flex; align-items: center; gap: 0.75rem; }
.logo { display: inline-grid; place-items: center; width: 3rem; height: 3rem; border-radius: 0.8rem; background: var(--brand); color: var(--brand-text); font-weight: 800; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.form { display: grid; gap: 0.6rem; }
.form label { font-weight: 650; }
.form input[type=text], .form input[type=number], .form input[type=datetime-local], .form textarea, .branch-select { display: block; width: 100%; min-height: var(--tap); padding: 0.5rem 0.75rem; border: 2px solid var(--line); border-radius: 10px; background: var(--bg); font-size: 1.125rem; }
.code-input { letter-spacing: 0.4em; text-align: center; font-size: 1.6rem !important; font-variant-numeric: tabular-nums; }
.hint { color: var(--muted); font-size: 0.9rem; }
.form-error { color: var(--danger); font-weight: 650; margin: 0; }
.link-row { display: flex; flex-wrap: wrap; justify-content: space-between; }


/* Banners float over the bottom of the page, above the navigation, and never push the content: a banner that appeared or went
   away between a finger touching and leaving the screen would move the button and lose the tap. */
.banners { position: fixed; left: 0; right: 0; bottom: calc(var(--tap) + env(safe-area-inset-bottom)); z-index: 6; display: grid; pointer-events: none; }
.banner { pointer-events: auto; margin: 0; padding: 0.6rem 0.9rem; font-weight: 600; border: 0; border-top: 1px solid var(--line); box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.15); text-align: left; width: 100%; }
.banner.warn { background: var(--warn-bg); color: var(--warn-text); }
.banner.error { background: var(--error-bg); color: var(--error-text); }
.banner.info { background: var(--info-bg); color: var(--info-text); cursor: pointer; }
.banner.action { background: var(--brand); color: var(--brand-text); display: block; text-decoration: none; text-align: center; font-size: 1.05rem; cursor: pointer; }

.content { flex: 1 0 auto; padding: 0.75rem 0.75rem 10rem; } /* room for the banners that float over the bottom */
.bottom-nav { position: sticky; bottom: 0; z-index: 5; display: grid; grid-template-columns: 1fr 1fr; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.bottom-nav.three { grid-template-columns: repeat(3, 1fr); }
.nav-item { min-height: var(--tap); border: 0; background: none; font-weight: 700; color: var(--muted); cursor: pointer; position: relative; }
.nav-item[aria-current=page] { color: var(--brand); box-shadow: inset 0 3px 0 var(--brand); }

.badge { display: inline-block; min-width: 1.4rem; margin-left: 0.4rem; padding: 0 0.4rem; border-radius: 999px; background: var(--line); color: var(--text); font-size: 0.8rem; line-height: 1.4rem; text-align: center; }
.badge.alert { background: var(--new); color: var(--on-new); }

.empty { color: var(--muted); text-align: center; padding: 2rem 1rem; }

.chip { margin-left: auto; padding: 0.1rem 0.6rem; border-radius: 999px; background: var(--line); font-size: 0.8rem; font-weight: 700; }
.chip.completed, .chip.active { background: var(--brand); color: var(--brand-text); }
.chip.cancelled, .chip.rejected, .chip.expired, .chip.disputed { background: var(--error-bg); color: var(--error-text); }

/* Dialogs and toasts */
dialog.sheet { width: min(32rem, 100%); max-width: 100%; margin: auto auto 0; border: 0; border-radius: 18px 18px 0 0; background: var(--surface); color: var(--text); padding: 1.1rem; }
dialog.sheet .form-error { position: sticky; bottom: 0; background: var(--surface); padding: 0.4rem 0; }   /* on a long form the message stays in view even when the box that needs fixing is far up */
dialog.sheet::backdrop { background: rgba(0, 0, 0, 0.55); }
.reasons { border: 0; padding: 0; margin: 0; display: grid; gap: 0.4rem; }
.reasons legend { font-weight: 700; padding: 0; margin-bottom: 0.3rem; }
.choice { display: flex; align-items: center; gap: 0.6rem; min-height: var(--tap); padding: 0 0.6rem; border: 2px solid var(--line); border-radius: 10px; font-weight: 600; }
.choice input { width: 1.4rem; height: 1.4rem; }
#toasts { position: fixed; left: 0.75rem; right: 0.75rem; top: calc(env(safe-area-inset-top) + 0.75rem); z-index: 20; display: grid; gap: 0.4rem; pointer-events: none; }
.toast { background: var(--text); color: var(--bg); padding: 0.7rem 0.9rem; border-radius: 12px; font-weight: 600; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3); max-width: 36rem; justify-self: center; }
.toast.error { background: var(--danger); color: var(--on-danger); }
.toast small { display: block; font-weight: 400; opacity: 0.85; }

@media (prefers-reduced-motion: no-preference) {
  .btn { transition: background-color 0.12s, border-color 0.12s; }
}

.signin .btn.block, .signin .card + .btn { margin-top: 0.75rem; }

/* Read out by screen readers, never shown. */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
