/* Mobile layer (M0) — design tokens. Prefixed `--m-` because `--border`, `--muted`, `--text-2`, `--bg`... already exist in this app
   (shadcn HSL triplets, the 3D package) and unprefixed names would break them.
   Dark/light follow <html data-theme="dark|light"> (see theme.ts). Nothing reads these until a screen opts in (`.mk-*` classes). */
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url('/assets/plus-jakarta-sans-latin-wght-normal-eXO_dkmS.woff2') format('woff2-variations');
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('/assets/space-grotesk-latin-wght-normal-BhU9QXUp.woff2') format('woff2-variations');
}

:root,
:root[data-theme='light'] {
  --m-bg: #f7f6f2;
  --m-panel: #ffffff;
  --m-panel-2: #fbfaf7;
  --m-border: #e6e2d8;
  --m-border-strong: #d8d2c5;
  --m-text: #0e1420;
  --m-text-2: #3a4257;
  --m-muted: #5f6678;
  --m-accent-a: #d4755f;
  --m-accent-b: #e48f5c;
  --m-accent-soft: #fdede6;
  --m-accent-soft-text: #8f3e2a;
  /* text on the accent gradient: dark, because white is 3.2:1 on coral and 2.5:1 on orange */
  --m-on-accent: #0e1420;
  /* icons, lines, large text */
  --m-amber: #c98a1e;
  /* small text / tab labels: darker so it reaches 4.5:1 on the light surfaces */
  --m-amber-text: #8a5a00;
  /* darker than the brief's #1f8a4f, which is 4.0:1 on the light background (small labels need 4.5:1) */
  --m-green: #1b7a47;
  --m-blue: #2f4f8f;
  --m-blue-soft: #e4ebf7;
  --m-danger: #b3261e;
  --m-sheet-backdrop: rgba(14, 20, 32, 0.45);
  --m-shadow: 0 8px 24px rgba(14, 20, 32, 0.08);
  color-scheme: light;
}

:root[data-theme='dark'] {
  --m-bg: #0e1420;
  --m-panel: #171e2f;
  --m-panel-2: #131a2a;
  --m-border: #232c45;
  --m-border-strong: #2a3350;
  --m-text: #eef1f8;
  --m-text-2: #c3cadc;
  --m-muted: #8e97ad;
  --m-accent-a: #d4755f;
  --m-accent-b: #e48f5c;
  --m-accent-soft: rgba(228, 143, 92, 0.16);
  --m-accent-soft-text: #ffd9c2;
  --m-on-accent: #0e1420;
  --m-amber: #e8b04a;
  --m-amber-text: #e8b04a;
  --m-green: #3ddc84;
  /* lighter than the brief's #5b8cff, which is 4.1:1 on its own soft background */
  --m-blue: #7ba3ff;
  --m-blue-soft: rgba(91, 140, 255, 0.16);
  --m-danger: #ff8a80;
  --m-sheet-backdrop: rgba(0, 0, 0, 0.6);
  --m-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}

:root {
  --m-font-text: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --m-font-display:
    'Space Grotesk', 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --m-gutter: 20px;
  --m-radius-card: 16px;
  --m-radius-sheet: 24px;
  --m-touch: 44px;
  --m-tabbar: 56px;
  --m-z-sheet: 1200;
}

/* The page background of a screen that already uses the mobile layer. `.m-night` = Servicio (always night, in light mode too).
   Only on phones and in the native app: the desktop web never changes. */
@media (max-width: 768px) {
  html.m-themed,
  html.m-themed body,
  html.m-themed #root {
    background: var(--m-bg);
  }
  html.m-night,
  html.m-night body,
  html.m-night #root {
    background: #0e1420;
  }
}
html[data-platform].m-themed,
html[data-platform].m-themed body,
html[data-platform].m-themed #root {
  background: var(--m-bg);
}
html[data-platform].m-night,
html[data-platform].m-night body,
html[data-platform].m-night #root {
  background: #0e1420;
}
/* Mobile layer (M0) — base components. Class names start with `mk-`; nothing here touches a screen until it uses them. */
.mk-root {
  font-family: var(--m-font-text);
  color: var(--m-text);
  background: var(--m-bg);
  -webkit-font-smoothing: antialiased;
}
.mk-display {
  font-family: var(--m-font-display);
  letter-spacing: -0.01em;
}

/* Header: one per screen. Safe area + 8 on top. */
.mk-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 8px) var(--m-gutter) 12px;
  background: var(--m-bg);
}
.native-app .mk-header {
  padding-top: calc(var(--safe-area-inset-top, env(safe-area-inset-top, 0px)) + 8px);
}
.mk-eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  line-height: 14px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--m-muted);
}
.mk-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--m-green);
  box-shadow: 0 0 8px var(--m-green);
}
.mk-title {
  margin: 2px 0 0;
  font-family: var(--m-font-display);
  font-size: 28px;
  line-height: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--m-text);
}
.mk-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Round 44px icon button (OIDO, search, notifications). */
.mk-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--m-touch);
  height: var(--m-touch);
  min-height: var(--m-touch);
  padding: 0;
  border: 1px solid var(--m-border);
  border-radius: 999px;
  background: var(--m-panel);
  color: var(--m-text);
}
.mk-icon-button--accent {
  border: 0;
  color: #fff;
  background: linear-gradient(135deg, var(--m-accent-a), var(--m-accent-b));
}

/* Chip: pill, at least 44px high. */
.mk-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--m-touch);
  padding: 0 16px;
  border: 1px solid var(--m-border);
  border-radius: 999px;
  background: var(--m-panel);
  color: var(--m-text-2);
  font-family: var(--m-font-text);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.mk-chip[aria-pressed='true'],
.mk-chip[aria-selected='true'] {
  border-color: transparent;
  background: var(--m-accent-soft);
  color: var(--m-accent-soft-text);
}
.mk-chip-count {
  min-width: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--m-accent-a);
  color: var(--m-on-accent);
  font-size: 11px;
  line-height: 20px;
  text-align: center;
}
.mk-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 var(--m-gutter);
  overflow-x: hidden;
  scrollbar-width: none;
}
.mk-chip-row::-webkit-scrollbar {
  display: none;
}

/* Card. */
.mk-card {
  border: 1px solid var(--m-border);
  border-radius: var(--m-radius-card);
  background: var(--m-panel);
  box-shadow: var(--m-shadow);
}
.mk-label {
  font-size: 11px;
  line-height: 14px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--m-muted);
}

/* Primary button (the only element with the accent gradient besides OIDO). */
.mk-button-primary,
.mk-button-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  font-family: var(--m-font-text);
  font-size: 15px;
  font-weight: 700;
}
.mk-button-primary {
  color: var(--m-on-accent);
  background: linear-gradient(135deg, var(--m-accent-a), var(--m-accent-b));
}
.mk-button-primary:disabled {
  opacity: 0.5;
}
.mk-button-ghost {
  color: var(--m-text-2);
  background: transparent;
}

/* Bottom sheet. */
.mk-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--m-z-sheet);
  background: var(--m-sheet-backdrop);
  animation: mk-fade 160ms ease-out;
}
.mk-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: calc(var(--m-z-sheet) + 1);
  display: flex;
  flex-direction: column;
  max-height: 88dvh;
  border-radius: var(--m-radius-sheet) var(--m-radius-sheet) 0 0;
  border: 1px solid var(--m-border);
  border-bottom: 0;
  background: var(--m-panel);
  color: var(--m-text);
  font-family: var(--m-font-text);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.25);
  animation: mk-rise 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
  touch-action: none;
}
.mk-sheet--tall {
  height: calc(var(--m-vvh, 100dvh) - 24px - env(safe-area-inset-top, 0px));
  max-height: none;
  bottom: var(--m-kb, 0px);
}
.mk-sheet--dragging {
  animation: none;
  transition: none;
}
.mk-sheet-grip {
  align-self: center;
  width: 40px;
  height: 5px;
  margin: 10px 0 6px;
  border-radius: 999px;
  background: var(--m-border-strong);
}
.mk-sheet-title {
  margin: 0;
  padding: 4px var(--m-gutter) 12px;
  font-family: var(--m-font-display);
  font-size: 20px;
  font-weight: 700;
}
.mk-sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 var(--m-gutter) 12px;
  touch-action: pan-y;
  overscroll-behavior: contain;
}
.mk-sheet-footer {
  display: flex;
  gap: 8px;
  padding: 12px var(--m-gutter) calc(env(safe-area-inset-bottom, 0px) + 12px);
  border-top: 1px solid var(--m-border);
}
.mk-sheet-footer .mk-button-primary {
  flex: 1;
}

/* Bottom tab bar: 56 + safe area. Active tab in amber with a luminous line on top. */
.mk-tabbar {
  display: flex;
  height: calc(var(--m-tabbar) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  border-top: 1px solid var(--m-border);
  background: var(--m-panel);
  font-family: var(--m-font-text);
}
.mk-tab {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 48px;
  border: 0;
  background: transparent;
  color: var(--m-muted);
  font-size: 11px;
  font-weight: 600;
}
.mk-tab[aria-current='page'] {
  color: var(--m-amber-text);
}
.mk-tab[aria-current='page']::before {
  content: '';
  position: absolute;
  top: 0;
  left: 22%;
  right: 22%;
  height: 2px;
  border-radius: 0 0 4px 4px;
  background: var(--m-amber);
  box-shadow: 0 0 12px var(--m-amber);
}
.mk-tab-badge {
  position: absolute;
  top: 6px;
  left: calc(50% + 6px);
  min-width: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--m-accent-a);
  color: var(--m-on-accent);
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}

/* Skeleton. */
.mk-skeleton {
  display: block;
  border-radius: 10px;
  background: linear-gradient(
    90deg,
    var(--m-border) 25%,
    var(--m-border-strong) 50%,
    var(--m-border) 75%
  );
  background-size: 200% 100%;
  animation: mk-shimmer 1.4s linear infinite;
}

/* Segmented control (theme selector). */
.mk-segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--m-border);
  border-radius: 14px;
  background: var(--m-panel-2);
}
.mk-segment {
  flex: 1;
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--m-muted);
  font-family: var(--m-font-text);
  font-size: 14px;
  font-weight: 700;
}
.mk-segment[aria-checked='true'] {
  background: var(--m-panel);
  color: var(--m-text);
  box-shadow: var(--m-shadow);
}

.mk-button-primary:focus-visible,
.mk-button-ghost:focus-visible,
.mk-chip:focus-visible,
.mk-icon-button:focus-visible,
.mk-tab:focus-visible,
.mk-segment:focus-visible {
  outline: 2px solid var(--m-amber-text);
  outline-offset: 2px;
}

@keyframes mk-fade {
  from {
    opacity: 0;
  }
}
@keyframes mk-rise {
  from {
    transform: translateY(100%);
  }
}
@keyframes mk-shimmer {
  to {
    background-position: -200% 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .mk-skeleton,
  .mk-sheet,
  .mk-sheet-backdrop {
    animation: none;
  }
}
