:root {
  --tg-bg: #ffffff;
  --tg-text: #1c1c1e;
  --tg-hint: #8e8e93;
  --tg-link: #2481cc;
  --tg-button: #2481cc;
  --tg-button-text: #ffffff;
  --tg-secondary-bg: #f2f2f7;

  --card-bg: #ffffff;
  --border: rgba(0, 0, 0, 0.08);
  --green: #34c759;
  --red: #ff3b30;
  --hize: #1aff9a;
  --hize-dim: rgba(26, 255, 154, 0.14);
  --hize-glow: 0 0 16px rgba(26, 255, 154, 0.45);
  --hize-text-glow: 0 0 10px rgba(26, 255, 154, 0.55);
  --payout-ink: #042616;
  --paid-text: #0b8a52;
  --radius: 14px;
  --pace-1: #1f9a68;
  --pace-2: #3d7ec4;
  --pace-3: #c4964a;
  --pace-4: #6a8f9a;
  --pace-5: #8a6a9a;
  --pace-6: #4a9a88;
}

html[data-theme="hize"] {
  color-scheme: dark;
  --tg-bg: #0a1410;
  --tg-text: #e8fff4;
  --tg-hint: #7d9a8c;
  --tg-link: #1aff9a;
  --tg-button: #1aff9a;
  --tg-button-text: #042616;
  --tg-secondary-bg: #12201a;
  --card-bg: #101c17;
  --border: rgba(26, 255, 154, 0.16);
  --green: #34f5a0;
  --red: #ff6b6b;
  --hize: #1aff9a;
  --hize-dim: rgba(26, 255, 154, 0.16);
  --hize-glow: 0 0 18px rgba(26, 255, 154, 0.42);
  --hize-text-glow: 0 0 12px rgba(26, 255, 154, 0.6);
  --payout-ink: #042616;
  --paid-text: #1aff9a;
  --pace-1: #3dcca0;
  --pace-2: #7ddec4;
  --pace-3: #c4b48a;
  --pace-4: #5a9e88;
  --pace-5: #9ecfb8;
  --pace-6: #2f8f78;
}

html[data-theme="ocean"] {
  color-scheme: dark;
  --tg-bg: #0a1220;
  --tg-text: #e8eef8;
  --tg-hint: #7d8aa3;
  --tg-link: #5eb0ff;
  --tg-button: #3d8dff;
  --tg-button-text: #f4f8ff;
  --tg-secondary-bg: #141e30;
  --card-bg: #111a2b;
  --border: rgba(94, 176, 255, 0.16);
  --green: #3ee0a0;
  --red: #ff6b7a;
  --hize: #5eb0ff;
  --hize-dim: rgba(94, 176, 255, 0.16);
  --hize-glow: 0 0 18px rgba(61, 141, 255, 0.42);
  --hize-text-glow: 0 0 12px rgba(94, 176, 255, 0.55);
  --payout-ink: #071018;
  --paid-text: #7ec4ff;
  --pace-1: #6aa8e8;
  --pace-2: #8ec4c8;
  --pace-3: #a8b4d4;
  --pace-4: #4f8fbf;
  --pace-5: #c4b48a;
  --pace-6: #7eb8a8;
}

html[data-theme="burgundy"] {
  color-scheme: dark;
  --tg-bg: #12080c;
  --tg-text: #fff1f3;
  --tg-hint: #a07a84;
  --tg-link: #e07080;
  --tg-button: #8e3348;
  --tg-button-text: #fff4f6;
  --tg-secondary-bg: #1f1016;
  --card-bg: #1a0d12;
  --border: rgba(224, 112, 128, 0.16);
  --green: #49d18a;
  --red: #ff6b7a;
  --hize: #e07080;
  --hize-dim: rgba(142, 51, 72, 0.28);
  --hize-glow: 0 0 18px rgba(142, 51, 72, 0.45);
  --hize-text-glow: 0 0 12px rgba(224, 112, 128, 0.5);
  --payout-ink: #fff4f6;
  --paid-text: #e07080;
  --pace-1: #d48996;
  --pace-2: #e0b4a0;
  --pace-3: #c4a0a8;
  --pace-4: #a86a78;
  --pace-5: #c9b4a0;
  --pace-6: #8f9a88;
}

html[data-theme="hize"] .card,
html[data-theme="ocean"] .card,
html[data-theme="burgundy"] .card,
html[data-theme="hize"] .day-block,
html[data-theme="ocean"] .day-block,
html[data-theme="burgundy"] .day-block {
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04), 0 10px 28px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; touch-action: manipulation; }

html, body {
  margin: 0;
  padding: 0;
  color: var(--tg-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  overscroll-behavior: none;
}

body {
  padding-bottom: 78px;
  min-height: 100vh;
  background-color: var(--tg-secondary-bg);
  background-image:
    radial-gradient(circle at 8% 0%, color-mix(in srgb, var(--tg-button) 16%, transparent) 0%, transparent 45%),
    radial-gradient(circle at 95% 18%, color-mix(in srgb, var(--tg-link) 12%, transparent) 0%, transparent 40%),
    radial-gradient(circle at 50% 100%, color-mix(in srgb, var(--tg-button) 10%, transparent) 0%, transparent 50%);
  background-attachment: fixed;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: color-mix(in srgb, var(--tg-bg) 82%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.app-header h1 {
  font-size: 17px;
  font-weight: 600;
  margin: 0;
}

.app-header .sub {
  font-size: 12px;
  color: var(--tg-hint);
  margin-top: 1px;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.header-pills {
  display: flex;
  gap: 6px;
  align-items: stretch;
}

.rapira-pill {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  min-width: 68px;
  padding: 4px 8px;
  border-radius: 12px;
  background: var(--hize-dim);
  border: 1px solid color-mix(in srgb, var(--hize) 45%, transparent);
  box-shadow: var(--hize-glow);
  font-family: inherit;
  cursor: default;
}
button.rapira-pill {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.rapira-pill.is-warn {
  border-color: color-mix(in srgb, var(--red) 55%, transparent);
  box-shadow: none;
}
.rapira-pill.is-warn .rapira-k,
.rapira-pill.is-warn .rapira-v {
  color: var(--red);
  text-shadow: none;
}
.rapira-k {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--hize);
  opacity: 0.78;
}
.rapira-v {
  font-size: 16px;
  font-weight: 700;
  color: var(--hize);
  letter-spacing: -0.03em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  text-shadow: var(--hize-text-glow);
}

@media (max-width: 380px) {
  .rapira-pill { min-width: 56px; padding: 3px 6px; }
  .rapira-v { font-size: 13px; }
  .rapira-k { font-size: 8px; }
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--tg-secondary-bg);
  color: var(--tg-text);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform .14s ease;
}
.icon-btn:active { transform: scale(0.92); }

main {
  padding: 14px 14px 24px;
  max-width: 560px;
  margin: 0 auto;
  transition: opacity 0.34s ease, transform 0.34s ease;
}

.view { display: none; }
.view.active { display: block; }

main.tab-fade {
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
}

.tab-loader {
  position: fixed;
  left: 0;
  right: 0;
  top: 62px;
  bottom: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  z-index: 15;
  transition: opacity 0.22s ease;
}
.tab-loader.show { opacity: 1; }

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 6px 16px rgba(0, 0, 0, 0.03);
}

.card h2 {
  font-size: 15px;
  margin: 0 0 12px;
  font-weight: 600;
}

.card h2 .hint { color: var(--tg-hint); font-weight: 400; font-size: 12px; }

.greeting {
  font-size: 22px;
  font-weight: 700;
  margin: 2px 0 2px;
  letter-spacing: -0.03em;
}

.greeting-sub { color: var(--tg-hint); font-size: 13px; margin-bottom: 14px; }

.hero-card { padding: 18px 16px 14px; }

.pace-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 18px 16px 16px;
  margin-bottom: 12px;
}
.pace-k {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hize);
}
.pace-sub {
  font-size: 12px;
  color: var(--tg-hint);
  margin-top: 2px;
}
.pace-ring-wrap {
  position: relative;
  width: min(232px, 68vw);
  aspect-ratio: 1;
  margin: 12px 0 10px;
}
.pace-ring { width: 100%; height: 100%; transform: rotate(-90deg); display: block; }
.pace-ring-bg,
.pace-ring-expected,
.pace-seg {
  fill: none;
  stroke-width: 12;
}
.pace-ring-bg { stroke: var(--border); }
.pace-seg { stroke-linecap: butt; }
.pace-ring-expected {
  stroke: color-mix(in srgb, var(--tg-text) 55%, transparent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 2.2 487.89;
  stroke-dashoffset: 490.09;
}
.pace-ring-center {
  position: absolute;
  inset: 22%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.pace-ring-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
}
.pace-ring-target {
  margin-top: 4px;
  font-size: 13px;
  color: var(--tg-hint);
}
.pace-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 12px;
  max-width: 320px;
  margin-bottom: 8px;
  opacity: 0;
  transform: translateY(6px);
}
.pace-card.is-live .pace-legend,
.pace-card.is-live .pace-status {
  opacity: 1;
  transform: none;
  transition: opacity .5s ease .12s, transform .5s ease .12s;
}
.pace-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--tg-hint);
}
.pace-legend-item b {
  color: var(--tg-text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.pace-legend-swatch {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--swatch, var(--hize));
  opacity: 0.9;
}
.pace-status {
  font-size: 13px;
  color: var(--tg-hint);
  line-height: 1.35;
  max-width: 280px;
  opacity: 0;
  transform: translateY(4px);
}
.pace-card.is-ahead .pace-status { color: var(--hize); }
.pace-card.is-closed .pace-status { color: var(--green); }
.hero-k { font-size: 13px; color: var(--tg-hint); font-weight: 500; }
.hero-v {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.04em;
  margin: 2px 0 4px;
  line-height: 1.15;
}
.hero-hint {
  font-size: 13px;
  color: var(--tg-hint);
  line-height: 1.35;
  margin-bottom: 4px;
}
.hero-hint.hidden { display: none; }

.metric-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0 16px;
}
.metric {
  background: var(--tg-secondary-bg);
  border-radius: 12px;
  padding: 10px 8px;
  text-align: center;
}
.metric .v { font-size: 15px; font-weight: 700; }
.metric .k { font-size: 11px; color: var(--tg-hint); margin-top: 2px; }

.btn.ghost-link {
  background: transparent;
  color: var(--tg-link);
  padding: 10px 8px 2px;
  font-size: 14px;
  font-weight: 600;
}

.home-admin-row {
  display: flex;
  gap: 8px;
  padding: 12px;
}
.home-admin-row .btn { width: auto; flex: 1; padding: 11px 10px; font-size: 13px; }

.grid-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card-bg);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}

.action-btn .emoji { font-size: 22px; }
.action-btn .label { font-size: 13px; font-weight: 600; line-height: 1.25; }

.today-profit-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}
.today-profit-box {
  flex: 1;
  background: var(--tg-secondary-bg);
  border-radius: 14px;
  padding: 12px 14px;
}
.today-profit-box .k { font-size: 12px; color: var(--tg-hint); }
.today-profit-box .v { font-size: 19px; font-weight: 700; margin-top: 2px; }

.balance-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--tg-secondary-bg);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 13px 16px;
  border-radius: 12px;
  border: none;
  background: var(--tg-button);
  color: var(--tg-button-text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: transform .14s ease, filter .14s ease;
}
.btn:active:not(:disabled) {
  transform: scale(0.975);
  filter: brightness(1.08);
}

.btn:disabled { opacity: .5; }
.btn.secondary { background: var(--tg-secondary-bg); color: var(--tg-text); }
.btn.danger { background: var(--red); color: #fff; }
.btn.ghost { background: transparent; color: var(--tg-link); padding: 8px; width: auto; }
.btn.small { padding: 8px 12px; font-size: 13px; width: auto; }
.btn.payout {
  background: var(--hize);
  color: var(--payout-ink);
  font-weight: 700;
  margin-top: 4px;
}

.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

input[type="text"], input[type="number"], input[type="time"], textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--tg-secondary-bg);
  color: var(--tg-text);
  font-size: 16px;
  font-family: inherit;
}

.date-field {
  position: relative;
  min-height: 54px;
}
.date-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 54px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--tg-secondary-bg);
  color: var(--tg-text);
  pointer-events: none;
}
.date-ico {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: var(--tg-link);
}
.date-btn-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.date-btn-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
}
.date-btn-hint {
  font-size: 12px;
  color: var(--tg-hint);
}
.date-native {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0.02;
  z-index: 2;
  background: transparent;
  color: transparent;
  -webkit-text-fill-color: transparent;
  font-size: 16px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.date-native::-webkit-datetime-edit,
.date-native::-webkit-date-and-time-value,
.date-native::-webkit-datetime-edit-fields-wrapper,
.date-native::-webkit-datetime-edit-text,
.date-native::-webkit-datetime-edit-month-field,
.date-native::-webkit-datetime-edit-day-field,
.date-native::-webkit-datetime-edit-year-field,
.date-native::-webkit-inner-spin-button,
.date-native::-webkit-calendar-picker-indicator {
  opacity: 0;
  color: transparent;
  background: transparent;
}

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

.field-select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--tg-secondary-bg);
  color: var(--tg-text);
  font-size: 15px;
  font-family: inherit;
  margin-bottom: 12px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%238e8e93'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z' clip-rule='evenodd'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
}

label { font-size: 12px; color: var(--tg-hint); margin-bottom: 4px; display: block; }

.field { margin-bottom: 12px; }

.toggle-group { display: flex; gap: 8px; margin-bottom: 12px; }
.toggle-group button {
  flex: 1;
  padding: 12px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--tg-secondary-bg);
  color: var(--tg-text);
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: transform .14s ease, background .14s ease, border-color .14s ease;
}
.toggle-group button:active { transform: scale(0.97); }
.toggle-group.compact { gap: 6px; }
.toggle-group.compact button {
  padding: 9px 4px;
  font-size: 12px;
  border-radius: 10px;
}
.toggle-group.compact .period-date-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}
.toggle-group.compact .period-date-wrap > button {
  width: 100%;
}
.toggle-group.compact .period-date-wrap .date-native {
  display: none;
}
.toggle-group.compact .period-date-wrap.picking .date-native {
  display: block;
}
.stats-range-hint {
  font-size: 12px;
  color: var(--tg-hint);
  font-weight: 500;
  margin: -4px 0 12px;
  text-align: center;
}
.stats-range-hint.hidden { display: none; }
.toggle-group button.active {
  border-color: var(--tg-button);
  background: color-mix(in srgb, var(--tg-button) 14%, var(--tg-secondary-bg));
  color: var(--tg-link);
}
.toggle-group button:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.toggle-group button.locked::after {
  content: " 🔒";
  font-size: 11px;
}

.quota-lock-hint {
  font-size: 12px;
  color: var(--red);
  margin-top: 6px;
  line-height: 1.4;
}
.quota-lock-hint[hidden] { display: none; }

.quota-switcher {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 4px;
  margin-bottom: 12px;
  -webkit-overflow-scrolling: touch;
}
.quota-switcher[hidden] { display: none; }
.quota-chip {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  padding: 9px 13px;
  border-radius: 13px;
  border: 1.5px solid var(--border);
  background: var(--card-bg);
  min-width: 88px;
  cursor: pointer;
  font-family: inherit;
}
.quota-chip.active {
  border-color: var(--tg-button);
  background: color-mix(in srgb, var(--tg-button) 14%, var(--card-bg));
}
.quota-chip-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--tg-text);
  white-space: nowrap;
}
.quota-chip-bar {
  width: 100%;
  height: 5px;
  border-radius: 3px;
  background: var(--border);
  overflow: hidden;
}
.quota-chip-fill {
  display: block;
  height: 100%;
  background: var(--tg-button);
  border-radius: 3px;
}
.quota-chip.done .quota-chip-fill { background: var(--green); }
.quota-chip-pct {
  font-size: 11px;
  color: var(--tg-hint);
}
.quota-chip.done .quota-chip-pct { color: var(--green); }

.quota-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px 16px 18px;
}
.quota-title { font-size: 16px; font-weight: 700; }
.quota-sub { font-size: 12px; color: var(--tg-hint); margin-top: 2px; margin-bottom: 18px; }

.quota-ring-wrap {
  position: relative;
  width: 168px;
  height: 168px;
  margin-bottom: 18px;
}
.quota-ring { width: 100%; height: 100%; transform: rotate(-90deg); display: block; }
.quota-ring-bg, .quota-ring-fill {
  fill: none;
  stroke-width: 10;
  stroke-linecap: round;
}
.quota-ring-bg { stroke: var(--border); }
.quota-ring-fill {
  stroke: var(--tg-button);
  stroke-dasharray: 326.73;
  stroke-dashoffset: 326.73;
}
.quota-ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.quota-ring-value { font-size: 21px; font-weight: 700; }
.quota-ring-target { font-size: 12px; color: var(--tg-hint); margin-top: 3px; }

.quota-status {
  font-size: 13px;
  font-weight: 600;
  padding: 11px 14px;
  border-radius: 12px;
  background: var(--tg-secondary-bg);
  color: var(--tg-hint);
  width: 100%;
}
.quota-status.ok { color: var(--green); background: color-mix(in srgb, var(--green) 16%, var(--tg-secondary-bg)); }
.quota-status.pending { color: var(--tg-link); background: color-mix(in srgb, var(--tg-button) 14%, var(--tg-secondary-bg)); }
.quota-status.locked { color: var(--red); background: color-mix(in srgb, var(--red) 16%, var(--tg-secondary-bg)); }

.key-done {
  position: fixed;
  right: 10px;
  bottom: calc(58px + env(safe-area-inset-bottom));
  z-index: 30;
  display: flex;
}
.key-done[hidden] { display: none; }
.key-done button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: none;
  border-radius: 8px;
  padding: 5px 9px;
  background: var(--tg-button);
  color: var(--tg-button-text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: transform .14s ease, filter .14s ease;
}
.key-done button:active {
  transform: scale(0.96);
  filter: brightness(1.08);
}
.key-done svg { width: 14px; height: 14px; }
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: var(--tg-bg);
  border-top: 1px solid var(--border);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  z-index: 20;
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 7px 2px 5px;
  border: none;
  background: transparent;
  color: var(--tg-hint);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}
.tab-icon {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tab-icon svg {
  width: 22px;
  height: 22px;
}
.tab-coin {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  opacity: 0.58;
  filter: grayscale(0.15);
}
.tab-label { line-height: 1.1; }
.tab-item.active { color: var(--tg-link); }
.tab-item.active .tab-coin {
  opacity: 1;
  filter: none;
  box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--tg-link) 55%, transparent);
}
.tab-item { transition: color 0.2s ease, transform 0.2s ease; }
.tab-item:active { transform: scale(0.96); }

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data-table th {
  text-align: left;
  color: var(--tg-hint);
  font-weight: 500;
  font-size: 11px;
  padding: 6px 6px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data-table td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table-scroll { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.stat-box {
  background: var(--tg-secondary-bg);
  border-radius: 12px;
  padding: 10px 12px;
}
.stat-box.wide { grid-column: 1 / -1; }
.stat-box .v { font-size: 16px; font-weight: 700; }
.stat-box .k { font-size: 11px; color: var(--tg-hint); margin-top: 2px; }

.empty-state { text-align: center; color: var(--tg-hint); padding: 24px 8px; font-size: 13px; }

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0);
  display: flex; align-items: flex-end;
  z-index: 50;
  transition: background .28s ease;
}
.modal-overlay.open { background: rgba(0,0,0,.45); }
.modal-overlay.hidden { display: none; }
.modal-sheet {
  background: var(--card-bg);
  width: 100%;
  border-radius: 18px 18px 0 0;
  padding: 10px 16px calc(20px + env(safe-area-inset-bottom));
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(110%);
  transition: transform .32s cubic-bezier(.22, .8, .24, 1);
}
.modal-overlay.open .modal-sheet { transform: translateY(0); }
.sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 99px;
  background: var(--tg-hint);
  opacity: 0.45;
  margin: 4px auto 14px;
}
.modal-sheet h3 { margin: 0 0 10px; font-size: 16px; }
.sheet-success { text-align: center; padding: 6px 0 2px; }
.sheet-success h3 { margin-bottom: 6px; }
.sheet-success p {
  color: var(--tg-hint);
  font-size: 13px;
  line-height: 1.4;
  margin: 0 0 16px;
}

.storm-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
}
.storm-row span { color: var(--tg-hint); }
.storm-row b {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.share-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  min-width: 108px;
}
.share-stack.sheet {
  align-items: stretch;
  margin: 8px 0 12px;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--tg-secondary-bg);
}
.share-line {
  font-size: 12px;
  line-height: 1.25;
  color: var(--tg-hint);
  font-variant-numeric: tabular-nums;
}
.share-line b { color: var(--tg-text); font-weight: 700; }
.share-line.mine b { color: var(--hize); }
.share-stack.sheet .share-line {
  display: flex;
  justify-content: space-between;
  font-size: 15px;
  padding: 6px 0;
}

.pill-warning {
  background: color-mix(in srgb, orange 18%, transparent);
  border: 1px solid rgba(255,149,0,.4);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 12px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%);
  background: rgba(0,0,0,.85);
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  z-index: 60;
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
  max-width: 90vw;
  text-align: center;
}
.toast.show { opacity: 1; }

.section-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--tg-hint);
  margin: 18px 4px 8px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.title-hint {
  text-transform: none;
  letter-spacing: 0;
  font-size: 11px;
  font-weight: 500;
  color: var(--tg-link);
  opacity: 0.85;
}

.list-card { padding: 10px; }

.list-rise > .list-item,
.list-rise > .worker-week-row,
.list-rise > .day-block {
  animation: row-rise .4s cubic-bezier(.22, .8, .24, 1) backwards;
}
.list-rise > :nth-child(2) { animation-delay: .04s; }
.list-rise > :nth-child(3) { animation-delay: .08s; }
.list-rise > :nth-child(4) { animation-delay: .12s; }
.list-rise > :nth-child(5) { animation-delay: .16s; }
.list-rise > :nth-child(6) { animation-delay: .2s; }
.list-rise > :nth-child(7) { animation-delay: .24s; }
.list-rise > :nth-child(n + 8) { animation-delay: .28s; }
@keyframes row-rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .modal-overlay,
  .modal-sheet,
  .list-rise > .list-item,
  .list-rise > .worker-week-row,
  .list-rise > .day-block,
  .btn,
  .icon-btn,
  .toggle-group button,
  .key-done button {
    animation: none;
    transition: none;
  }
  .modal-sheet { transform: none; }
  .modal-overlay.open { background: rgba(0, 0, 0, .45); }
}

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}
.list-item.clickable {
  cursor: pointer;
  background: var(--tg-secondary-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 10px 12px 12px;
  margin-bottom: 8px;
}
.list-item.clickable:last-child { margin-bottom: 0; border-bottom: none; }
.list-item.clickable:active { transform: scale(0.985); opacity: 0.92; }
.list-item.clickable.deal-mine {
  border-color: color-mix(in srgb, var(--hize) 55%, var(--border));
  background: var(--hize-dim);
  box-shadow: inset 3px 0 0 var(--hize);
}
.deal-amount { text-align: right; }
.amount-sub {
  font-size: 11px;
  font-weight: 500;
  color: var(--tg-hint);
  margin-top: 2px;
  letter-spacing: 0.01em;
}
.list-item:last-child { border-bottom: none; }
.list-item .main { font-size: 15px; font-weight: 600; letter-spacing: -0.02em; }
.list-item .meta { font-size: 12px; color: var(--tg-hint); margin-top: 3px; }
.list-item .amount { font-weight: 700; white-space: nowrap; font-size: 15px; }
.deal-row-end {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.chevron {
  width: 16px;
  height: 16px;
  color: var(--tg-hint);
  opacity: 0.7;
  flex-shrink: 0;
}
.amount.pos { color: var(--green); }
.amount.neg { color: var(--red); }

.week-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 14px;
}
.week-nav-btn {
  appearance: none;
  -webkit-appearance: none;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--tg-text);
  font-size: 26px;
  line-height: 1;
  font-weight: 500;
  cursor: pointer;
}
.week-nav-btn:disabled {
  opacity: 0.28;
}
.week-nav-btn:not(:disabled):active {
  transform: scale(0.96);
}
.week-nav-center {
  flex: 1;
  text-align: center;
  min-width: 0;
}
.week-nav-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.week-nav-dates {
  font-size: 12px;
  color: var(--tg-hint);
  margin-top: 2px;
  font-weight: 500;
}
.worker-week-row {
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 12px 10px;
  margin-bottom: 8px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--tg-secondary-bg);
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.worker-week-row:last-child { margin-bottom: 0; }
.worker-week-row:active { transform: scale(0.985); opacity: 0.92; }
.worker-week-row.mine {
  box-shadow: inset 3px 0 0 var(--hize);
}
.worker-week-row.selected {
  border-color: color-mix(in srgb, var(--hize) 70%, var(--border));
  background: var(--hize-dim);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--hize) 35%, transparent);
}
.worker-week-row.selected.mine {
  box-shadow: inset 3px 0 0 var(--hize), inset 0 0 0 1px color-mix(in srgb, var(--hize) 35%, transparent);
}
.team-profit-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  margin: 8px 0 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card-bg);
}
.team-profit-banner .k {
  font-size: 13px;
  font-weight: 600;
}
.team-profit-banner .sub {
  font-size: 11px;
  color: var(--tg-hint);
  margin-top: 2px;
  font-weight: 500;
}
.week-compare {
  font-size: 10.5px;
  font-weight: 600;
  margin-top: 3px;
}
.week-compare.up { color: var(--green); }
.week-compare.down { color: var(--red); }
.team-profit-banner .v {
  font-size: 16px;
  font-weight: 700;
  color: var(--tg-hint);
  white-space: nowrap;
}
.worker-week-row .main { font-size: 15px; font-weight: 600; letter-spacing: -0.02em; }
.worker-week-row .meta { font-size: 12px; color: var(--tg-hint); margin-top: 3px; }
.worker-week-end {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}
.payout-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.01em;
}
.payout-pill.paid {
  background: var(--hize-dim);
  color: var(--paid-text);
}
.payout-pill.open {
  background: rgba(255, 159, 10, 0.16);
  color: #c27800;
}
.week-paid-banner {
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--paid-text);
  background: var(--hize-dim);
  border-radius: 12px;
  padding: 10px 12px;
  margin: 4px 0 12px;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 4px 0 16px;
}
.theme-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 10px 4px 8px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: var(--tg-secondary-bg);
  color: var(--tg-text);
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.15;
}
.theme-chip.active {
  border-color: var(--tg-button);
  background: color-mix(in srgb, var(--tg-button) 14%, var(--tg-secondary-bg));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tg-button) 20%, transparent);
}
.theme-swatch {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.38);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.18);
}
#table-payout-wrap { margin: 8px 0 4px; }

.feed-days { display: flex; flex-direction: column; gap: 12px; }
.day-block {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 10px 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 6px 16px rgba(0, 0, 0, 0.03);
}
.day-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 2px 6px 10px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.day-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.03em;
  text-transform: none;
}
.day-sub {
  font-size: 12px;
  color: var(--tg-hint);
  margin-top: 3px;
  font-weight: 500;
}
.day-profit {
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  padding-top: 1px;
}
.day-deals .list-item.clickable:last-child { margin-bottom: 0; }

.spinner, .coin-loader {
  margin: 20px auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.coin-loader img, .coin-loader-inline img {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  animation: coinspin 1.15s linear infinite;
}
.coin-loader-inline {
  display: flex;
  align-items: center;
  justify-content: center;
}
.coin-loader-inline img {
  width: 28px;
  height: 28px;
}
@keyframes coinspin {
  to { transform: rotate(360deg); }
}

.spinner {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--tg-button);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.divider { height: 1px; background: var(--border); margin: 12px 0; }

.result-line { display: flex; justify-content: space-between; font-size: 13px; padding: 4px 0; }
.result-line .k { color: var(--tg-hint); }
.result-line.emphasis { font-weight: 600; }
.result-line.strong { font-weight: 700; font-size: 15px; padding-top: 8px; border-top: 1px solid var(--border); margin-top: 6px; }

.hours-chart { display: flex; align-items: flex-end; gap: 3px; height: 64px; margin-top: 10px; }
.hours-bar {
  flex: 1; height: var(--h, 4%); min-height: 3px; padding: 0; border: 0; border-radius: 3px;
  background: var(--tg-hint); opacity: 0.28; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.hours-bar.best { background: var(--tg-link); opacity: 0.9; }
.hours-bar.active { opacity: 1; outline: 1px solid var(--tg-text); outline-offset: 1px; }
.hours-axis { display: grid; grid-template-columns: repeat(24, 1fr); margin-top: 4px; font-size: 10px; color: var(--tg-hint); }
.hours-axis span:nth-child(1) { grid-column: 1; }
.hours-axis span:nth-child(2) { grid-column: 7; }
.hours-axis span:nth-child(3) { grid-column: 13; }
.hours-axis span:nth-child(4) { grid-column: 19; }
.hours-caption { margin-top: 8px; font-size: 12px; color: var(--tg-hint); min-height: 16px; }
