:root {
  color-scheme: light;

  --red-500: #e6371a;
  --red-600: #d63216;
  --red-700: #c22c13;
  --purple-600: #643878;
  --sand-100: #e7e0da;
  --sand-050: #f4f0ec;
  --brown-800: #5c443e;
  --emerald-700: #195d55;
  --ginger-500: #bc6e4a;
  --graphite-900: #323232;

  --surface-page: light-dark(#ffffff, #141211);
  --surface-sand: light-dark(#e7e0da, #221d1a);
  --surface-card: light-dark(#ffffff, #1d1a18);
  --surface-muted: light-dark(#f6f6f6, #27221f);
  --text-strong: light-dark(#141211, #f6f3ef);
  --text-body: light-dark(#555555, #c9c1ba);
  --text-muted: light-dark(#757575, #9a9088);
  --border-hairline: light-dark(#d9d9d9, #362e29);
  --border-sand: light-dark(#d8cfc6, #433730);
  --danger-surface: light-dark(#fbe0da, #3d1d17);
  --danger-text: light-dark(#c22c13, #ff8f7a);
  --success-surface: light-dark(#e3ede9, #15312c);
  --success-text: light-dark(#195d55, #6cd1c2);
  --warning-surface: light-dark(#f6e7de, #38261a);
  --warning-text: light-dark(#8b4728, #f0ae86);
  --shadow-card: 0 1px 2px rgba(50, 35, 30, 0.06);
  --shadow-modal: 0 18px 40px rgba(20, 14, 10, 0.24);
  --ease: cubic-bezier(0.32, 0.72, 0, 1);

  &:has(> head > meta[name="color-scheme"][content="dark"]) {
    color-scheme: dark;
  }
  &:has(> head > meta[name="color-scheme"][content="light"]) {
    color-scheme: light;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: "Montserrat", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-strong);
  background: var(--surface-page);
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
}

.visually-hidden {
  position: absolute;
  clip-path: inset(50%);
  overflow: hidden;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  white-space: nowrap;
}

.stripe-top {
  height: 8px;
  width: 100%;
  background: repeating-linear-gradient(
    90deg,
    var(--red-500) 0 2px,
    transparent 2px 18px
  );
  border-bottom: 1px solid var(--border-hairline);
}

/* PIN экран входа */
.pin-gate {
  min-height: calc(100dvh - 10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
}

.pin-card {
  width: min(400px, 100%);
  background: var(--surface-card);
  border: 1px solid var(--border-hairline);
  border-radius: 16px;
  padding: 24px 20px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pin-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 4px;
}

.pin-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pin-form input {
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.35em;
}

.pin-submit {
  width: 100%;
  min-height: 48px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface-page);
  border-bottom: 1px solid var(--border-hairline);
}

.topbar-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
}

.brand-logo {
  display: block;
  width: auto;
  height: 26px;
  object-fit: contain;
  flex-shrink: 0;
}

.brand-logo-dark,
.theme-icon-to-light {
  display: none;
}

:root:has(> head > meta[name="color-scheme"][content="dark"]) {
  & .brand-logo-light,
  & .theme-icon-to-dark {
    display: none;
  }
  & .brand-logo-dark,
  & .theme-icon-to-light {
    display: inline-block;
  }
}

.eyebrow {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--red-500);
}

.brand-wrap .eyebrow {
  line-height: 1.2;
  min-width: 0;
}

@media (max-width: 480px) {
  .topbar-inner {
    padding: 10px 12px;
    gap: 8px;
  }
  .brand-wrap {
    gap: 8px;
  }
  .brand-logo {
    height: 22px;
  }
  .brand-wrap .eyebrow {
    font-size: 10px;
    letter-spacing: 0.08em;
    line-height: 1.15;
  }
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.icon-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 9999px;
  border: 1px solid var(--border-hairline);
  background: var(--surface-card);
  color: var(--text-strong);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 120ms var(--ease), transform 120ms var(--ease);
}

.icon-pill.icon-only {
  width: 44px;
  padding: 0;
}

.icon-pill:hover {
  background: var(--surface-muted);
}

.icon-pill:active,
.pill-btn:active {
  transform: scale(0.985);
}

.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.import-capsule {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr);
  align-items: stretch;
  padding: 3px;
  border-radius: 9999px;
  background: var(--surface-sand);
  border: 1px solid var(--border-sand);
}

.capsule-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  min-width: 0;
  padding: 0 12px;
  border-radius: 9999px;
  border: none;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 120ms var(--ease), transform 120ms var(--ease);
}

.capsule-btn svg {
  flex-shrink: 0;
}

.capsule-btn:active {
  transform: scale(0.985);
}

.capsule-primary {
  background: var(--red-500);
  color: #ffffff;
}

.capsule-primary:hover {
  background: var(--red-600);
}

.capsule-secondary {
  background: transparent;
  color: var(--text-strong);
}

.capsule-secondary:hover {
  background: light-dark(rgba(50, 35, 30, 0.06), rgba(255, 255, 255, 0.07));
}

.more-wrap {
  position: relative;
  flex-shrink: 0;
}

.icon-pill.icon-only.more-btn {
  width: 48px;
  height: 48px;
  min-height: 48px;
}

.more-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 35;
  min-width: 215px;
  max-width: calc(100vw - 24px);
  padding: 6px;
  border-radius: 14px;
  background: var(--surface-card);
  border: 1px solid var(--border-sand);
  box-shadow: var(--shadow-modal);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.more-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-strong);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.more-item svg {
  flex-shrink: 0;
  color: var(--text-body);
}

.more-item:hover {
  background: var(--surface-sand);
}

.more-divider {
  height: 1px;
  background: var(--border-hairline);
  margin: 4px 6px;
}

.more-danger {
  color: var(--danger-text);
}

.more-danger svg {
  color: var(--danger-text);
}

.more-danger:hover {
  background: var(--danger-surface);
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 9999px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 120ms var(--ease), border-color 120ms var(--ease), transform 120ms var(--ease);
}

.pill-sm {
  min-height: 32px;
  padding: 0 12px;
  font-size: 12px;
}

.pill-primary {
  background: var(--red-500);
  color: #ffffff;
}

.pill-primary:hover {
  background: var(--red-600);
}

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

.pill-secondary:hover {
  background: light-dark(#dcd2ca, #2e2723);
}

.pill-ghost {
  background: transparent;
  color: var(--text-body);
  border-color: var(--border-hairline);
}

.pill-ghost:hover {
  background: var(--surface-muted);
  color: var(--text-strong);
}

.card {
  background: var(--surface-card);
  border: 1px solid var(--border-hairline);
  border-radius: 16px;
  padding: 18px 16px;
  box-shadow: var(--shadow-card);
}

.card-result {
  background: var(--surface-sand);
  border-color: var(--border-sand);
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.result-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.card-title {
  margin: 2px 0 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.25;
}

.hint-tag,
.count-badge,
.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-muted);
  color: var(--text-body);
  border: 1px solid var(--border-hairline);
}

.status-badge.ok {
  background: var(--success-surface);
  color: var(--success-text);
  border-color: transparent;
}

.status-badge.warn {
  background: var(--warning-surface);
  color: var(--warning-text);
  border-color: transparent;
}

.grid-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
  gap: 12px;
}

@media (max-width: 420px) {
  .team-form .grid-two {
    grid-template-columns: 1fr;
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field.grow {
  flex: 1 1 200px;
}

.field-spaced {
  margin-top: 12px;
}

label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-body);
}

input[type="text"],
select,
textarea {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border-hairline);
  background: var(--surface-page);
  color: var(--text-strong);
  font: inherit;
  font-size: max(1rem, 1em);
  line-height: 1.4;
  transition: border-color 120ms var(--ease);
}

textarea {
  min-height: 140px;
  resize: vertical;
}

@media (pointer: coarse) {
  input[type="text"],
  select {
    min-height: 44px;
  }
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
label.pill-btn:focus-within,
label.capsule-btn:focus-within,
summary:focus-visible {
  outline: 2px solid var(--purple-600);
  outline-offset: 2px;
}

input[aria-invalid="true"] {
  border-color: var(--red-600);
}

.field-error {
  font-size: 12px;
  font-weight: 600;
  color: var(--danger-text);
  min-height: 16px;
}

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

/* Умный комбобокс поиска имён */
.combo-wrap {
  position: relative;
}

.combo-wrap input {
  padding-right: 42px;
}

.combo-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border-radius: 9999px;
  border: 1px solid var(--border-hairline);
  background: var(--surface-muted);
  color: var(--text-body);
  font: inherit;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.combo-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 30;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--surface-card);
  border: 1px solid var(--border-sand);
  border-radius: 14px;
  box-shadow: var(--shadow-modal);
  max-height: 230px;
  overflow-y: auto;
}

.combo-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.combo-item:hover,
.combo-item.active {
  background: var(--surface-sand);
}

.combo-hint {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.extra-settings,
.staff-drawer {
  margin-top: 12px;
  border-top: 1px solid var(--border-hairline);
  padding-top: 10px;
}

.staff-drawer {
  border-top: none;
  padding-top: 0;
  margin-bottom: 12px;
}

.extra-settings summary,
.staff-drawer summary {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-body);
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
}

.extra-settings summary::before,
.staff-drawer summary::before {
  content: "+";
  font-weight: 700;
  color: var(--red-500);
}

.extra-settings[open] summary::before,
.staff-drawer[open] summary::before {
  content: "−";
}

.extra-body {
  margin-top: 12px;
}

.section-note {
  margin: 0;
  font-size: 13px;
  color: var(--text-body);
}

.chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.staff-chip {
  min-height: 38px;
  padding: 6px 12px;
  border-radius: 9999px;
  border: 1px solid var(--border-hairline);
  background: var(--surface-muted);
  color: var(--text-strong);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 120ms var(--ease), border-color 120ms var(--ease);
}

.staff-chip.active {
  background: var(--red-500);
  color: #ffffff;
  border-color: var(--red-500);
  font-weight: 600;
}

.add-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

@media (max-width: 400px) {
  .add-row {
    flex-wrap: wrap;
  }
  .add-row > button {
    width: 100%;
  }
}

.waiters-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.waiter-card {
  border: 1px solid var(--border-hairline);
  background: var(--surface-muted);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.waiter-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.waiter-name {
  font-size: 15px;
  font-weight: 700;
}

.waiter-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rate-btn {
  min-height: 36px;
  min-width: 64px;
  padding: 0 10px;
  border-radius: 9999px;
  border: 1px solid var(--border-hairline);
  background: var(--surface-card);
  color: var(--text-strong);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.rate-btn.half {
  background: var(--purple-600);
  color: #ffffff;
  border-color: var(--purple-600);
}

.remove-btn {
  min-width: 36px;
  min-height: 36px;
  border-radius: 9999px;
  border: 1px solid var(--border-hairline);
  background: var(--surface-card);
  color: var(--text-body);
  font: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.remove-btn:hover {
  color: var(--danger-text);
  border-color: var(--red-500);
}

.waiter-inputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.empty-state {
  margin: 4px 0;
  font-size: 14px;
  color: var(--text-muted);
}

.alert-box {
  border-radius: 14px;
  padding: 12px 14px;
  background: var(--warning-surface);
  color: var(--warning-text);
  font-size: 13px;
  line-height: 1.45;
}

.alert-box ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.metric {
  background: var(--surface-card);
  border: 1px solid var(--border-hairline);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.metric-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.metric-val {
  font-size: 16px;
  font-weight: 700;
}

/* Вкладки-пилюли */
.seg-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 9999px;
  background: var(--surface-card);
  border: 1px solid var(--border-hairline);
  margin-bottom: 12px;
}

.seg-tab {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 9999px;
  border: none;
  background: transparent;
  color: var(--text-body);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.seg-tab.active {
  background: var(--red-500);
  color: #ffffff;
}

.payouts-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.payout-row {
  background: var(--surface-card);
  border: 1px solid var(--border-hairline);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.payout-info {
  min-width: 0;
}

.payout-name {
  font-size: 15px;
  font-weight: 700;
}

.payout-sub {
  font-size: 12px;
  color: var(--text-body);
  margin-top: 2px;
}

.req-copy-btn {
  margin-top: 6px;
  padding: 4px 10px;
  min-height: 28px;
  border-radius: 9999px;
  border: 1px solid var(--border-hairline);
  background: var(--surface-muted);
  color: var(--text-body);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.req-copy-btn:hover {
  border-color: var(--brown-800);
  color: var(--text-strong);
}

.payout-badge {
  flex-shrink: 0;
  padding: 6px 12px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.payout-badge.deduct {
  background: var(--danger-surface);
  color: var(--danger-text);
}

.payout-badge.add {
  background: var(--success-surface);
  color: var(--success-text);
}

.sticky-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 25;
  background: var(--surface-page);
  border-top: 1px solid var(--border-hairline);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
}

.sticky-inner {
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  align-items: center;
  justify-items: stretch;
  gap: 8px;
}

.sticky-inner .pill-btn {
  width: 100%;
  min-width: 0;
  padding: 0 12px;
  font-size: 13px;
  gap: 6px;
  justify-content: center;
  text-align: center;
}

.sticky-inner .pill-btn svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

@media (max-width: 345px) {
  .sticky-inner .pill-btn {
    font-size: 12px;
    padding: 6px 8px;
    white-space: normal;
    line-height: 1.2;
  }
}

dialog {
  width: min(540px, calc(100vw - 24px));
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 18px;
  border-radius: 16px;
  border: 1px solid var(--border-hairline);
  background: var(--surface-card);
  color: var(--text-strong);
  box-shadow: var(--shadow-modal);
}

dialog[open] {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  background: rgba(50, 35, 30, 0.48);
  backdrop-filter: blur(2px);
  overflow: hidden;
  overscroll-behavior: contain;
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dialog-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.icon-close {
  width: 40px;
  height: 40px;
  border-radius: 9999px;
  border: 1px solid var(--border-hairline);
  background: var(--surface-muted);
  color: var(--text-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

@media (max-width: 480px) {
  .dialog-actions {
    justify-content: center;
  }
  .dialog-actions > .pill-btn {
    flex: 1 1 0;
    min-width: 0;
  }
}

.report-opts {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.report-chk {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-body);
  cursor: pointer;
}

.report-chk input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--red-500);
}

.report-pre {
  margin: 0;
  padding: 12px;
  border-radius: 12px;
  background: var(--surface-muted);
  border: 1px solid var(--border-hairline);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 42dvh;
  overflow: auto;
}

.team-list,
.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 40dvh;
  overflow-y: auto;
}

.team-row,
.history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border-hairline);
  background: var(--surface-muted);
}

.team-meta,
.history-meta {
  min-width: 0;
}

.team-row-actions,
.history-row-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.offline-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 2px 10px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  background: var(--warning-surface);
  color: var(--warning-text);
  white-space: nowrap;
}

.field-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}

.expr-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--success-text);
  white-space: nowrap;
}

.calc-input-wrap {
  position: relative;
}

.calc-input-wrap input {
  padding-right: 36px;
}

.calc-plus-btn {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--border-sand);
  background: var(--surface-sand);
  color: var(--text-strong);
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.calc-plus-btn:active {
  transform: translateY(-50%) scale(0.95);
}

.report-date-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.date-chip {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 9999px;
  border: 1px solid var(--border-hairline);
  background: var(--surface-muted);
  color: var(--text-body);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.date-chip.active {
  background: var(--red-500);
  color: #ffffff;
  border-color: var(--red-500);
}

.date-picker-chip {
  position: relative;
  overflow: hidden;
}

.date-picker-chip input[type="date"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
}

.schedule-bar {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.schedule-load-btn {
  width: 100%;
  justify-content: center;
}

.alert-missing {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid color-mix(in srgb, var(--warning-text) 22%, transparent);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.transfers-progress {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-body);
  margin-bottom: 2px;
}

.transfer-row {
  justify-content: flex-start;
}

.transfer-row .payout-info {
  flex: 1 1 auto;
}

.transfer-check-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
}

.transfer-check {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--emerald-700);
  cursor: pointer;
}

.payout-row.paid {
  opacity: 0.6;
}

.payout-row.paid .payout-name {
  text-decoration: line-through;
}

@media (max-width: 480px) {
  body {
    font-size: 14px;
    line-height: 1.42;
    padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px));
  }
  .stripe-top {
    height: 6px;
  }
  .topbar-inner {
    padding: 8px 12px;
    gap: 8px;
  }
  .brand-logo {
    height: 20px;
  }
  .topbar .icon-pill.icon-only {
    width: 38px;
    height: 38px;
    min-height: 38px;
  }
  .page {
    padding: 10px 12px;
    gap: 10px;
  }
  .import-capsule {
    padding: 2px;
  }
  .capsule-btn {
    min-height: 36px;
    font-size: 12.5px;
    padding: 0 10px;
    gap: 5px;
  }
  .icon-pill.icon-only.more-btn {
    width: 42px;
    height: 42px;
    min-height: 42px;
  }
  .card {
    padding: 12px;
    border-radius: 14px;
  }
  .card-head {
    margin-bottom: 10px;
    gap: 8px;
  }
  .card-title {
    font-size: 16px;
  }
  .eyebrow {
    font-size: 10px;
    letter-spacing: 0.11em;
  }
  .hint-tag,
  .count-badge,
  .status-badge {
    min-height: 24px;
    padding: 2px 8px;
    font-size: 11px;
  }
  .grid-two {
    gap: 8px;
  }
  .field {
    gap: 4px;
  }
  .field-spaced {
    margin-top: 8px;
  }
  label {
    font-size: 12px;
  }
  input[type="text"],
  select {
    min-height: 42px;
    padding: 8px 10px;
    border-radius: 10px;
  }
  .pill-btn {
    min-height: 40px;
    padding: 0 14px;
    font-size: 13px;
  }
  .extra-settings,
  .staff-drawer {
    margin-top: 8px;
    padding-top: 6px;
  }
  .extra-settings summary,
  .staff-drawer summary {
    min-height: 30px;
    font-size: 12.5px;
  }
  .chips-wrap {
    gap: 6px;
    margin-top: 8px;
  }
  .staff-chip {
    min-height: 34px;
    padding: 4px 10px;
    font-size: 12px;
  }
  .waiters-list {
    gap: 8px;
  }
  .waiter-card {
    padding: 10px;
    gap: 8px;
    border-radius: 12px;
  }
  .waiter-name {
    font-size: 14px;
  }
  .rate-btn {
    min-height: 32px;
    min-width: 54px;
    font-size: 12px;
  }
  .remove-btn {
    min-width: 32px;
    min-height: 32px;
    font-size: 16px;
  }
  .waiter-inputs {
    gap: 8px;
  }
  .metrics-grid {
    gap: 8px;
    margin-bottom: 10px;
  }
  .metric {
    padding: 8px 10px;
    border-radius: 10px;
  }
  .metric-label {
    font-size: 10px;
  }
  .metric-val {
    font-size: 14.5px;
  }
  .seg-tabs {
    padding: 3px;
    margin-bottom: 10px;
  }
  .seg-tab {
    min-height: 32px;
    padding: 0 12px;
    font-size: 12.5px;
  }
  .payouts-list {
    gap: 6px;
  }
  .payout-row {
    padding: 10px;
    gap: 8px;
    border-radius: 10px;
  }
  .payout-name {
    font-size: 14px;
  }
  .payout-sub {
    font-size: 11.5px;
  }
  .payout-badge {
    padding: 5px 10px;
    font-size: 12px;
  }
  .sticky-bar {
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
  }
  .sticky-inner .pill-btn {
    min-height: 40px;
    font-size: 12.5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
