:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --bg2: var(--tg-theme-secondary-bg-color, #f1f4f7);
  --text: var(--tg-theme-text-color, #111827);
  --hint: var(--tg-theme-hint-color, #6b7280);
  --brand: #3c81fa;
  --link: var(--brand);
  --btn: var(--brand);
  --btn-text: #ffffff;
  --danger: #dc2626; --ok: #059669; --warn: #d97706;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg2); color: var(--text);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
#app { padding: 12px 12px 84px; max-width: 760px; margin: 0 auto; }
h1 { font-size: 20px; margin: 4px 0 12px; }
h2 { font-size: 16px; margin: 18px 0 8px; }
a { color: var(--link); text-decoration: none; }
.card { background: var(--bg); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; }
.row { display: flex; gap: 8px; align-items: center; }
.row > * { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; } .shrink { flex: 0 0 auto; }
.hint { color: var(--hint); font-size: 13px; }
.small { font-size: 13px; }
.right { text-align: right; }
.bold { font-weight: 600; }
.ok { color: var(--ok); } .danger { color: var(--danger); } .warn { color: var(--warn); }
label { display: block; font-size: 12px; color: var(--hint); margin: 8px 0 3px; }
input, select, textarea { width: 100%; padding: 9px 10px; border: 1px solid color-mix(in srgb, var(--hint) 35%, transparent);
  border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; }
textarea { min-height: 70px; resize: vertical; }
input[type=checkbox] { width: auto; }
button, .btn { border: 0; border-radius: 10px; padding: 10px 14px; background: var(--btn); color: var(--btn-text);
  font: inherit; font-weight: 600; cursor: pointer; text-align: center; display: inline-block; }
button.secondary, .btn.secondary { background: color-mix(in srgb, var(--btn) 12%, var(--bg)); color: var(--btn); }
button.ghost { background: transparent; color: var(--link); padding: 6px 8px; }
button.danger { background: color-mix(in srgb, var(--danger) 12%, var(--bg)); color: var(--danger); }
button.sm, .btn.sm { padding: 6px 10px; font-size: 13px; }
button:disabled { opacity: .5; }
.full { width: 100%; }
.list-item { display: block; color: var(--text); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; background: var(--bg2); }
.badge.new { background: #e0f2fe; color: #075985; } .badge.booked { background: #fef3c7; color: #92400e; }
.badge.paid { background: #d1fae5; color: #065f46; } .badge.done { background: #e5e7eb; color: #374151; }
.badge.departing { background: #ede9fe; color: #5b21b6; }
.badge.cancelled { background: #fee2e2; color: #991b1b; }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: var(--bg);
  border-top: 1px solid color-mix(in srgb, var(--hint) 20%, transparent); padding-bottom: env(safe-area-inset-bottom); z-index: 10; }
.tabs a { flex: 1; text-align: center; padding: 8px 2px; color: var(--hint); font-size: 11px; }
.tabs a .ic { display: block; font-size: 20px; }
.tabs a.active { color: var(--btn); font-weight: 600; }
.copy { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px dashed color-mix(in srgb, var(--hint) 25%, transparent); cursor: pointer; }
.copy:last-child { border-bottom: 0; }
.copy .v { font-family: ui-monospace, Menlo, monospace; font-weight: 600; text-align: right; word-break: break-all; }
.preview { white-space: pre-wrap; background: var(--bg2); border-radius: 10px; padding: 10px; font-size: 14px; }
.seg { display: flex; background: var(--bg2); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { flex: 1; background: transparent; color: var(--text); padding: 7px; font-weight: 500; }
.seg button.on { background: var(--bg); color: var(--btn); font-weight: 600; box-shadow: 0 1px 2px #0002; }
.variant.off { opacity: .55; }
.price-big { font-size: 18px; font-weight: 700; }
.item-row { display: grid; grid-template-columns: 1.2fr 1.5fr 1.1fr .9fr .55fr auto; gap: 6px; margin-top: 6px; align-items: center; }
.item-row input, .item-row select { padding: 7px 6px; font-size: 13px; }
.stat { background: var(--bg); border-radius: var(--radius); padding: 10px; }
.stat .n { font-size: 18px; font-weight: 700; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.sticky-bottom { position: sticky; bottom: 70px; z-index: 5; }
.modal-bg { position: fixed; inset: 0; background: #0006; z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: var(--bg); width: 100%; max-width: 760px; border-radius: 16px 16px 0 0; padding: 16px; max-height: 88vh; overflow: auto; }
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: #111827e6; color: #fff;
  padding: 8px 14px; border-radius: 99px; font-size: 14px; z-index: 30; }
.story-canvas { width: 100%; max-width: 320px; aspect-ratio: 9/16; border-radius: 12px; display: block; margin: 0 auto; background: #000; }
.brand-bar { background: var(--brand); border-radius: 16px; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.brand-bar img { height: 30px; display: block; }
.brand-bar a { color: #fff; font-size: 22px; }
.picker { position: relative; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: color-mix(in srgb, var(--brand) 12%, var(--bg)); color: var(--text); padding: 5px 10px; border-radius: 99px; font-size: 14px; flex: 0 0 auto !important; }
.chip b { cursor: pointer; color: var(--hint); }
.picker-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--bg); border-radius: 12px;
  box-shadow: 0 8px 24px #0003; z-index: 40; max-height: 280px; overflow: auto; }
.picker-item { display: flex; justify-content: space-between; gap: 8px; padding: 10px 12px; cursor: pointer; border-bottom: 1px solid color-mix(in srgb, var(--hint) 15%, transparent); }
.picker-item:active, .picker-item:hover { background: var(--bg2); }
.empty { text-align: center; color: var(--hint); padding: 30px 10px; }
.fab-row { display: flex; gap: 8px; margin-bottom: 12px; }
.fab-row > * { flex: 1; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
@media (max-width: 480px) {
  .item-row { grid-template-columns: 1fr 1fr 1fr; padding-bottom: 6px; border-bottom: 1px dashed color-mix(in srgb, var(--hint) 25%, transparent); }
  .item-row select { grid-column: 1 / 3; } .item-row .del { justify-self: end; }
}
