:root {
  --bg-color-pure: #000000;
  --bg-color-raised: #050505;
  --surface-color-primary: #111113;
  --surface-color-secondary: #1c1c1e;
  --surface-color-tertiary: #242426;
  --border-color-subtle: rgba(255, 255, 255, 0.08);
  --border-color-strong: rgba(255, 255, 255, 0.14);
  --accent-color-primary: #0a84ff;
  --accent-color-primary-soft: rgba(10, 132, 255, 0.16);
  --accent-color-warning: #ff9f0a;
  --accent-color-warning-soft: rgba(255, 159, 10, 0.12);
  --accent-color-danger: #ff453a;
  --accent-color-danger-soft: rgba(255, 69, 58, 0.12);
  --text-color-primary: #f5f5f7;
  --text-color-muted: #a1a1a6;
  --text-color-subtle: #6e6e73;
  --spacing-xxs: 4px;
  --spacing-xs: 8px;
  --spacing-sm: 12px;
  --spacing-md: 16px;
  --spacing-lg: 20px;
  --spacing-xl: 24px;
  --spacing-xxl: 32px;
  --radius-control: 8px;
  --radius-card: 8px;
  --radius-sheet: 18px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --miraichi-bg: var(--bg-color-pure);
  --miraichi-text: var(--text-color-primary);
  --miraichi-text-muted: var(--text-color-muted);
  --miraichi-primary: var(--accent-color-primary);
  --miraichi-primary-hover: #409cff;
  --miraichi-secondary: var(--surface-color-primary);
  --miraichi-border: var(--border-color-strong);
  --miraichi-accent: var(--accent-color-warning);
  --miraichi-danger: var(--accent-color-danger);
}

* {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  min-height: 100%;
  overflow-x: hidden;
}

body {
  background-color: var(--bg-color-pure);
  color: var(--text-color-primary);
  font-family: var(--font-family);
  margin: 0;
  padding: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent-color-primary);
  outline-offset: 3px;
}

.shell-loading {
  align-items: center;
  color: var(--text-color-muted);
  display: flex;
  min-height: 100dvh;
  justify-content: center;
  padding: var(--spacing-xl);
}

.app-shell {
  background: var(--bg-color-pure);
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100dvh;
  width: 100%;
}

.app-shell__top-bar {
  align-items: center;
  border-bottom: 1px solid var(--border-color-subtle);
  display: flex;
  justify-content: space-between;
  min-height: 64px;
  padding: calc(var(--spacing-sm) + var(--safe-top)) var(--spacing-md) var(--spacing-sm);
}

.app-shell__brand {
  align-items: center;
  color: var(--text-color-primary);
  display: inline-flex;
  gap: var(--spacing-sm);
  min-width: 0;
  text-decoration: none;
}

.app-shell__brand-mark {
  align-items: center;
  background: var(--surface-color-secondary);
  border: 1px solid var(--border-color-strong);
  border-radius: 50%;
  color: var(--accent-color-primary);
  display: inline-flex;
  flex: 0 0 36px;
  font-size: 0.9rem;
  font-weight: 700;
  height: 36px;
  justify-content: center;
  width: 36px;
}

.app-shell__brand strong,
.app-shell__brand small {
  display: block;
}

.app-shell__brand small {
  color: var(--text-color-muted);
  font-size: 0.78rem;
  margin-top: 2px;
}

.app-shell__phase-badge {
  border: 1px solid var(--border-color-strong);
  border-radius: 999px;
  color: var(--text-color-muted);
  flex: 0 0 auto;
  font-size: 0.75rem;
  padding: 6px 10px;
}

.app-shell__content {
  min-height: 0;
  overflow-y: auto;
  padding: var(--spacing-lg) var(--spacing-md) calc(88px + var(--safe-bottom));
  -webkit-overflow-scrolling: touch;
}

.app-shell__bottom-bar {
  background: color-mix(in srgb, var(--bg-color-pure) 92%, transparent);
  border-top: 1px solid var(--border-color-subtle);
  bottom: 0;
  left: 0;
  padding: var(--spacing-xs) var(--spacing-sm) calc(var(--spacing-xs) + var(--safe-bottom));
  position: fixed;
  right: 0;
  z-index: 20;
}

.tab-view {
  margin: 0 auto;
  max-width: 760px;
}

.tab-view__panel[hidden] {
  display: none;
}

.shell-section {
  margin-bottom: var(--spacing-lg);
}

.shell-section--hero {
  padding-top: var(--spacing-sm);
}

.shell-eyebrow {
  color: var(--accent-color-primary);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0 0 var(--spacing-xs);
  text-transform: uppercase;
}

.shell-section h1,
.shell-section h2 {
  color: var(--text-color-primary);
  letter-spacing: 0;
  line-height: 1.06;
  margin: 0;
}

.shell-section h1 {
  font-size: clamp(2.25rem, 9vw, 4.8rem);
}

.shell-section h2 {
  font-size: clamp(1.75rem, 6vw, 3rem);
}

.shell-section p,
.shell-lede {
  color: var(--text-color-muted);
  font-size: 1rem;
  line-height: 1.55;
  margin: var(--spacing-sm) 0 0;
  max-width: 680px;
}

.shell-metric-grid {
  display: grid;
  gap: var(--spacing-sm);
  grid-template-columns: 1fr;
  margin-bottom: var(--spacing-lg);
}

.shell-metric {
  background: var(--surface-color-primary);
  border: 1px solid var(--border-color-subtle);
  border-radius: var(--radius-card);
  min-height: 112px;
  padding: var(--spacing-md);
}

.shell-metric__label,
.shell-metric__note,
.ledger-row__label {
  color: var(--text-color-muted);
  display: block;
  font-size: 0.82rem;
}

.shell-metric__value {
  color: var(--text-color-primary);
  display: block;
  font-size: 1.65rem;
  line-height: 1;
  margin: var(--spacing-xs) 0;
}

.ledger-list {
  border: 1px solid var(--border-color-subtle);
  border-radius: var(--radius-card);
  overflow: hidden;
}

.ledger-row {
  align-items: center;
  background: var(--surface-color-primary);
  display: flex;
  gap: var(--spacing-sm);
  justify-content: space-between;
  min-height: 76px;
  padding: var(--spacing-md);
}

.ledger-row + .ledger-row {
  border-top: 1px solid var(--border-color-subtle);
}

.ledger-row strong {
  color: var(--text-color-primary);
  display: block;
  line-height: 1.3;
  margin-top: var(--spacing-xxs);
}

.status-pill {
  background: var(--accent-color-primary-soft);
  border: 1px solid rgba(10, 132, 255, 0.24);
  border-radius: 999px;
  color: var(--accent-color-primary);
  flex: 0 0 auto;
  font-size: 0.78rem;
  padding: 6px 10px;
}

.status-pill--muted {
  background: var(--surface-color-secondary);
  border-color: var(--border-color-strong);
  color: var(--text-color-muted);
}

.action-grid {
  display: grid;
  gap: var(--spacing-sm);
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.settings-summary {
  color: var(--text-color-muted);
  line-height: 1.5;
  margin-top: var(--spacing-md);
}

.nav-bar {
  display: grid;
  gap: var(--spacing-xs);
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 0 auto;
  max-width: 760px;
}

.nav-bar__item {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: var(--radius-control);
  color: var(--text-color-muted);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 56px;
  min-width: 44px;
  padding: 6px 4px;
}

.nav-bar__item--active {
  background: var(--accent-color-primary-soft);
  color: var(--accent-color-primary);
}

.nav-bar__icon {
  align-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  display: inline-flex;
  font-size: 0.72rem;
  font-weight: 800;
  height: 22px;
  justify-content: center;
  line-height: 1;
  width: 22px;
}

.nav-bar__label {
  font-size: 0.72rem;
  line-height: 1.1;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.miraichi-btn {
  align-items: center;
  background-color: var(--accent-color-primary);
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  font-weight: 700;
  justify-content: center;
  min-height: 44px;
  padding: 0.65rem 1rem;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.miraichi-btn:hover {
  background-color: var(--miraichi-primary-hover);
}

.miraichi-btn--secondary {
  background: var(--surface-color-secondary);
  border-color: var(--border-color-strong);
  color: var(--text-color-primary);
}

.miraichi-btn--secondary:hover {
  background: var(--surface-color-tertiary);
}

.miraichi-card {
  background-color: var(--surface-color-primary);
  border: 1px solid var(--border-color-subtle);
  border-radius: var(--radius-card);
  margin-bottom: 1rem;
  padding: 1rem;
}

.miraichi-card-title {
  color: var(--text-color-primary);
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.miraichi-card-body {
  color: var(--text-color-muted);
}

@media (min-width: 720px) {
  .app-shell__top-bar {
    padding-left: var(--spacing-xl);
    padding-right: var(--spacing-xl);
  }

  .app-shell__content {
    padding-left: var(--spacing-xl);
    padding-right: var(--spacing-xl);
  }

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

@media (max-width: 390px) {
  .app-shell__phase-badge {
    display: none;
  }

  .nav-bar__label {
    font-size: 0.66rem;
  }
}

/* Phase 5.9 production shell: Black Apple Ledger baseline. */
:root {
  --bg: var(--bg-color-pure);
  --bg-raised: var(--bg-color-raised);
  --surface: var(--surface-color-primary);
  --surface-2: var(--surface-color-secondary);
  --surface-3: var(--surface-color-tertiary);
  --line: var(--border-color-subtle);
  --line-strong: var(--border-color-strong);
  --text: var(--text-color-primary);
  --text-muted: var(--text-color-muted);
  --text-subtle: var(--text-color-subtle);
  --accent: var(--accent-color-primary);
  --accent-soft: var(--accent-color-primary-soft);
  --amber: var(--accent-color-warning);
  --amber-soft: var(--accent-color-warning-soft);
  --danger: var(--accent-color-danger);
  --font-system: var(--font-family);
  color-scheme: dark;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  color: inherit;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

svg {
  display: block;
  height: 100%;
  width: 100%;
}

.production-page {
  background: var(--bg);
  display: grid;
  min-height: 100dvh;
  padding: 20px;
  place-items: center;
}

.app-shell {
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 32px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  height: min(900px, calc(100dvh - 40px));
  min-height: 720px;
  overflow: hidden;
  position: relative;
  width: min(100%, 430px);
}

.top-bar {
  align-items: center;
  background: rgba(0, 0, 0, 0.92);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex: 0 0 auto;
  gap: 14px;
  justify-content: space-between;
  padding: calc(14px + var(--safe-top)) 18px 12px;
  z-index: 2;
}

.brand {
  align-items: center;
  color: var(--text);
  display: flex;
  gap: 10px;
  min-width: 0;
  text-decoration: none;
}

.brand-mark {
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  display: grid;
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 700;
  height: 30px;
  line-height: 1;
  place-items: center;
  width: 30px;
}

.brand-copy {
  display: block;
  min-width: 0;
}

.brand-name {
  color: var(--text);
  display: block;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.1;
}

.brand-meta {
  color: var(--text-subtle);
  display: block;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-chip {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-muted);
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 600;
  gap: 7px;
  min-height: 30px;
  padding: 0 10px;
  white-space: nowrap;
}

.status-dot {
  background: var(--accent);
  border-radius: 999px;
  height: 6px;
  width: 6px;
}

.notice {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  color: var(--text-muted);
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
  padding: 8px 18px;
  z-index: 2;
}

.main-scroll {
  flex: 1 1 auto;
  margin-right: -18px;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 34px 18px 16px;
  -ms-overflow-style: none;
  scrollbar-width: none;
  z-index: 1;
}

.main-scroll::-webkit-scrollbar {
  height: 0;
  width: 0;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.screen-header {
  align-items: flex-start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 16px;
}

.screen-label {
  color: var(--text-subtle);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 5px;
  text-transform: uppercase;
}

.screen-title {
  color: var(--text);
  font-size: 34px;
  font-weight: 760;
  letter-spacing: 0;
  line-height: 1.03;
  margin: 0;
}

.screen-subtitle {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
  margin: 7px 0 0;
}

.date-tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  flex: 0 0 auto;
  min-width: 70px;
  padding: 10px 12px;
  text-align: center;
}

.date-day {
  color: var(--text);
  display: block;
  font-size: 24px;
  font-weight: 760;
  line-height: 1;
}

.date-month {
  color: var(--text-muted);
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  margin-top: 5px;
}

.summary-list {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.summary-row {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  display: grid;
  gap: 11px;
  grid-template-columns: 34px 1fr auto;
  min-height: 62px;
  padding: 11px 12px;
}

.summary-icon,
.nav-icon,
.row-icon,
.sheet-icon {
  color: currentColor;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
}

.summary-icon {
  background: var(--surface-2);
  border-radius: 8px;
  color: var(--text-muted);
  height: 34px;
  width: 34px;
}

.summary-icon svg {
  height: 18px;
  width: 18px;
}

.summary-copy {
  min-width: 0;
}

.summary-title {
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
}

.summary-meta {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  margin-top: 3px;
}

.summary-value {
  color: var(--text);
  font-size: 17px;
  font-weight: 760;
  line-height: 1;
  text-align: right;
  white-space: nowrap;
}

.summary-value.small {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.segmented {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  gap: 2px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 4px 0 20px;
  padding: 2px;
}

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

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

.segmented button {
  background: transparent;
  border-radius: var(--radius-control);
  color: var(--text-subtle);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.1;
  min-height: 34px;
  min-width: 0;
  padding: 0 8px;
  transition: background 160ms ease, color 160ms ease;
}

.segmented button.active {
  background: var(--surface-3);
  color: var(--text);
}

.section-heading {
  align-items: flex-end;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin: 0 0 10px;
}

.section-heading h2 {
  color: var(--text);
  font-size: 21px;
  font-weight: 760;
  line-height: 1.12;
  margin: 0;
}

.section-heading span {
  color: var(--text-subtle);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  text-align: right;
  text-transform: uppercase;
  white-space: nowrap;
}

.stack {
  display: grid;
  gap: 10px;
}

.match-card,
.plain-card,
.note-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}

.match-card {
  overflow: hidden;
}

.match-main {
  padding: 14px;
}

.match-topline {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.tag-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.tag {
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-muted);
  display: inline-flex;
  font-size: 10px;
  font-weight: 760;
  line-height: 1;
  min-height: 23px;
  padding: 0 8px;
  text-transform: uppercase;
  white-space: nowrap;
}

.tag.blue {
  background: var(--accent-soft);
  border-color: rgba(10, 132, 255, 0.32);
  color: #8ec5ff;
}

.tag.amber {
  background: var(--amber-soft);
  border-color: rgba(255, 159, 10, 0.28);
  color: #ffd28a;
}

.icon-button {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  color: var(--text-muted);
  display: grid;
  height: 34px;
  place-items: center;
  transition: background 160ms ease, color 160ms ease;
  width: 34px;
}

.icon-button:hover,
.icon-button:focus-visible {
  background: var(--surface-3);
  color: var(--text);
}

.icon-button svg {
  height: 18px;
  width: 18px;
}

.match-title {
  color: var(--text);
  font-size: 19px;
  font-weight: 760;
  line-height: 1.18;
  margin: 0;
}

.match-meta {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  margin: 7px 0 0;
}

.ledger-detail {
  background: var(--bg-raised);
  border-top: 1px solid var(--line);
  display: grid;
  gap: 0;
}

.match-card.collapsed .ledger-detail {
  display: none;
}

.ledger-row {
  align-items: start;
  background: transparent;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr auto;
  min-height: 0;
  padding: 13px 14px;
}

.ledger-row:last-child {
  border-bottom: 0;
}

.ledger-title {
  color: var(--text);
  font-size: 14px;
  font-weight: 720;
  line-height: 1.25;
}

.ledger-meta {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  margin-top: 5px;
}

.ledger-state {
  align-self: start;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 760;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.text-button,
.primary-button,
.secondary-button {
  align-items: center;
  border-radius: var(--radius-control);
  display: inline-flex;
  font-size: 13px;
  font-weight: 760;
  gap: 7px;
  justify-content: center;
  line-height: 1;
  min-height: 38px;
  padding: 0 13px;
  white-space: nowrap;
}

.text-button {
  background: transparent;
  color: var(--accent);
}

.primary-button {
  background: var(--accent);
  color: #ffffff;
}

.primary-button:disabled {
  background: var(--surface-3);
  color: var(--text-subtle);
}

.secondary-button {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
}

.text-button svg,
.primary-button svg,
.secondary-button svg {
  height: 16px;
  width: 16px;
}

.note-card {
  padding: 14px;
}

.note-card.warning {
  background: rgba(255, 159, 10, 0.08);
  border-color: rgba(255, 159, 10, 0.24);
}

.note-eyebrow {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 760;
  line-height: 1.2;
  margin-bottom: 7px;
  text-transform: uppercase;
}

.note-title {
  color: var(--text);
  font-size: 15px;
  font-weight: 760;
  line-height: 1.25;
}

.note-copy {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
  margin: 6px 0 0;
}

.search-row {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr auto;
  margin: 0 0 14px;
}

.search-input,
.field-input,
.field-select,
.field-textarea {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  color: var(--text);
  outline: none;
  width: 100%;
}

.search-input {
  font-size: 14px;
  font-weight: 600;
  min-height: 42px;
  padding: 0 12px;
}

.search-input::placeholder,
.field-input::placeholder,
.field-textarea::placeholder {
  color: var(--text-subtle);
}

.filter-button {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  color: var(--text-muted);
  display: grid;
  height: 42px;
  place-items: center;
  width: 42px;
}

.filter-button svg {
  height: 19px;
  width: 19px;
}

.date-group {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.group-label {
  color: var(--text-subtle);
  font-size: 11px;
  font-weight: 760;
  line-height: 1.2;
  text-transform: uppercase;
}

.match-row,
.bet-row,
.assistant-row,
.points-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  display: grid;
  gap: 4px;
  padding: 13px 14px;
}

.row-split {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.row-title {
  color: var(--text);
  font-size: 15px;
  font-weight: 720;
  line-height: 1.25;
}

.row-meta {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  margin-top: 4px;
}

.row-actions {
  align-items: center;
  display: inline-flex;
  flex: 0 0 auto;
  gap: 6px;
  white-space: nowrap;
}

.back-button {
  margin: 0 0 12px;
}

.readonly-summary,
.match-context {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  display: grid;
  gap: 8px;
  padding: 13px 14px;
}

.match-context {
  margin-bottom: 14px;
}

.context-line {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr auto;
}

.context-label {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 760;
  line-height: 1.2;
  text-transform: uppercase;
}

.context-value {
  color: var(--text);
  font-size: 13px;
  font-weight: 720;
  line-height: 1.25;
  text-align: right;
}

.detail-panel[hidden] {
  display: none;
}

.points-grid {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.points-row {
  align-items: center;
  grid-template-columns: 1fr auto;
}

.points-label {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
}

.points-value {
  color: var(--text);
  font-size: 21px;
  font-weight: 760;
  line-height: 1;
  margin-top: 4px;
}

.points-state {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 760;
  white-space: nowrap;
}

.assistant-row {
  align-items: start;
  grid-template-columns: 34px 1fr;
}

.row-icon {
  background: var(--surface-2);
  border-radius: 8px;
  color: var(--text-muted);
  height: 34px;
  width: 34px;
}

.row-icon svg {
  height: 18px;
  width: 18px;
}

.empty-state {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  color: var(--text-muted);
  display: none;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  padding: 18px;
  text-align: center;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr;
  margin: -8px 0 20px;
}

.add-inline {
  box-shadow: none;
  min-height: 44px;
  width: 100%;
}

.bottom-nav {
  background: rgba(0, 0, 0, 0.96);
  border-top: 1px solid var(--line);
  display: grid;
  flex: 0 0 auto;
  gap: 4px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 10px 10px calc(10px + var(--safe-bottom));
  position: relative;
  z-index: 7;
}

.nav-item {
  background: transparent;
  border-radius: 12px;
  color: var(--text-subtle);
  display: grid;
  font-size: 11px;
  font-weight: 700;
  gap: 4px;
  line-height: 1;
  min-height: 58px;
  min-width: 0;
  place-items: center;
  transition: background 160ms ease, color 160ms ease;
}

.nav-item.active {
  background: var(--surface);
  color: var(--accent);
}

.nav-icon {
  height: 22px;
  width: 22px;
}

.sheet-backdrop {
  background: rgba(0, 0, 0, 0.62);
  display: none;
  inset: 0;
  position: absolute;
  z-index: 20;
}

.sheet-backdrop.open {
  display: block;
}

.sheet {
  background: var(--surface);
  border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
  border-top: 1px solid var(--line-strong);
  bottom: 0;
  box-shadow: 0 -24px 80px rgba(0, 0, 0, 0.72);
  display: none;
  left: 0;
  max-height: min(76%, 640px);
  overflow: hidden;
  position: absolute;
  right: 0;
  z-index: 21;
}

.sheet.open {
  display: flex;
  flex-direction: column;
}

.sheet-grabber {
  background: rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  flex: 0 0 auto;
  height: 5px;
  margin: 9px auto 6px;
  width: 36px;
}

.sheet-header {
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex: 0 0 auto;
  gap: 14px;
  justify-content: space-between;
  padding: 10px 16px 12px;
}

.sheet-title {
  color: var(--text);
  font-size: 20px;
  font-weight: 760;
  line-height: 1.15;
  margin: 0;
}

.sheet-subtitle {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  margin: 4px 0 0;
}

.sheet-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px 16px calc(16px + var(--safe-bottom));
}

.form-grid {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.field-input,
.field-select {
  font-size: 14px;
  font-weight: 600;
  min-height: 42px;
  padding: 0 11px;
}

.field-textarea {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  min-height: 78px;
  padding: 10px 11px;
  resize: vertical;
}

.sheet-actions {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr;
  margin-top: 14px;
}

.sheet-feedback {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  margin-top: 10px;
  min-height: 18px;
}

.review-list {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.review-item {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr auto;
  padding: 11px 0;
}

.review-item:last-child {
  border-bottom: 0;
}

.review-label {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.review-value {
  color: var(--text);
  font-size: 13px;
  font-weight: 720;
  line-height: 1.2;
  text-align: right;
}

@media (max-width: 520px) {
  .production-page {
    padding: 0;
    place-items: stretch start;
  }

  .app-shell {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    height: 100dvh;
    min-height: 0;
    width: min(100vw, 390px);
  }
}

@media (max-width: 360px) {
  .main-scroll {
    padding-left: 12px;
    padding-right: 30px;
  }

  .top-bar,
  .notice {
    padding-left: 14px;
    padding-right: 14px;
  }

  .screen-title {
    font-size: 30px;
  }

  .bottom-nav {
    gap: 2px;
    padding-left: 6px;
    padding-right: 6px;
  }

  .nav-item {
    font-size: 10px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .screen.active {
    animation: enter-screen 160ms ease-out;
  }

  .sheet.open {
    animation: sheet-in 180ms ease-out;
  }
}

@keyframes enter-screen {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes sheet-in {
  from {
    transform: translateY(18px);
  }

  to {
    transform: translateY(0);
  }
}
