/* Приём наличных — стиль Apple Wallet, светлый, акцент «цвет моря». Макет: design/maket.dc.html */
:root {
  --ink: #1D1D1F;
  --sub: #5E5E66;
  --fill: rgba(118, 118, 128, 0.12);
  --hair: rgba(0, 0, 0, 0.08);
  --sea: #0E7C7B;          /* кнопки, кружок свайпа */
  --sea-text: #0B6B6A;     /* текст цвета моря на светлом */
  --red: #D70015;
  --off: #AEAEB2;
  --glass: rgba(255, 255, 255, 0.66);
  --glass-edge: rgba(255, 255, 255, 0.9);
  --shadow: 0 0 0 0.5px rgba(20, 24, 60, 0.06), 0 14px 40px rgba(31, 38, 90, 0.09), inset 0 1px 0 rgba(255, 255, 255, 0.95);
  --pass-sea: radial-gradient(120% 90% at 0% 0%, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0) 55%), linear-gradient(135deg, #062F36 0%, #0B5560 55%, #0F7377 100%);
  --pass-red: radial-gradient(120% 90% at 0% 0%, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0) 55%), linear-gradient(135deg, #5A0B12 0%, #8E1420 55%, #B01C2B 100%);
  --pass-dark: radial-gradient(120% 90% at 0% 0%, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0) 55%), linear-gradient(135deg, #1C1C1E 0%, #2C2C2E 60%, #3A3A3C 100%);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  font-family: -apple-system, BlinkMacSystemFont, system-ui, Helvetica, Arial, sans-serif;
  color: var(--ink);
  letter-spacing: -0.1px;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  background:
    radial-gradient(900px 640px at 0% 0%, #DCEFEF 0%, rgba(220, 239, 239, 0) 70%),
    radial-gradient(820px 600px at 100% 0%, #ECEBF4 0%, rgba(236, 235, 244, 0) 70%),
    radial-gradient(900px 620px at 75% 100%, #F6EDE4 0%, rgba(246, 237, 228, 0) 70%),
    #F2F2F5;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}
input { -webkit-user-select: text; user-select: text; }
button { font-family: inherit; color: inherit; cursor: pointer; transition: transform .15s ease, background-color .2s ease, box-shadow .2s ease, opacity .2s ease; }
button:active:not(:disabled) { transform: scale(0.97); }
button:disabled { cursor: default; }
input::placeholder { color: inherit; opacity: 0.55; }
[hidden] { display: none !important; }

.app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }

/* --- шапка --- */
.topbar {
  height: 68px; flex-shrink: 0; margin: 16px 20px 0; padding: 0 12px 0 22px;
  border-radius: 22px; background: var(--glass); border: 1px solid var(--glass-edge); box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand-wrap { display: flex; align-items: center; gap: 18px; min-width: 0; }
.brand { display: flex; flex-direction: column; align-items: center; line-height: 1; font-family: Montserrat, -apple-system, sans-serif; }
.brand small { font-size: 9px; letter-spacing: 3px; font-weight: 600; color: var(--sub); }
.brand strong { font-size: 20px; font-weight: 800; letter-spacing: 1px; margin-top: 4px; }
.divider { width: 1px; height: 32px; background: var(--hair); flex-shrink: 0; }
.title { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.title h1 { margin: 0; font-size: 17px; font-weight: 600; }
.title span { font-size: 13px; color: var(--sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-right { display: flex; align-items: center; gap: 14px; font-size: 13px; flex-shrink: 0; }
.seg { display: flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--fill); }
.seg button { height: 44px; padding: 0 20px; border: 0; border-radius: 999px; background: transparent; color: var(--sub); font-size: 14px; font-weight: 600; }
.seg button[aria-pressed="true"] { background: #FFFFFF; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 0 0 0.5px rgba(0, 0, 0, 0.04); }
.status { display: flex; align-items: center; gap: 7px; color: var(--sub); white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #34C759; box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.2); }
.dot.bad { background: #FF3B30; box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.2); }
.chip { display: flex; align-items: center; gap: 7px; height: 44px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--fill); font-size: 13px; font-weight: 500; }
.chip.warn { color: var(--red); }

/* --- нет связи --- */
.offline {
  flex-shrink: 0; min-height: 44px; margin: 12px 20px 0; padding: 10px 18px; border-radius: 14px;
  background: var(--red); color: #FFFFFF; display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600;
  animation: fadeIn .24s ease-out both;
}
.offline small { font-weight: 400; opacity: 0.85; }

/* --- сегодня --- */
.today {
  flex: 1; min-height: 0; padding: 20px; display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px;
  transition: grid-template-columns 260ms var(--ease); animation: fadeIn 240ms ease-out both;
}
.today.collapsed { grid-template-columns: minmax(0, 1fr) 64px; }
.queue { display: flex; flex-direction: column; gap: 14px; min-width: 0; min-height: 0; }
.queue-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 0 4px; }
.queue-head h2 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -0.4px; }
.queue-head span { font-size: 15px; color: var(--sub); }
.empty { background: rgba(255, 255, 255, 0.85); border-radius: 26px; padding: 40px; text-align: center; font-size: 16px; color: var(--sub); }
.cards {
  flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 16px;
  align-items: start; align-content: start; padding: 4px;
}
.legend { display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 13px; color: var(--sub); padding-left: 4px; }
.legend span { display: flex; align-items: center; gap: 8px; }
.legend i { width: 14px; height: 10px; border-radius: 3px; background: var(--pass-sea); }
.legend i.red { background: var(--pass-red); }

/* --- карточка чека --- */
.card {
  background: rgba(255, 255, 255, 0.85); border-radius: 26px; border: 1px solid rgba(255, 255, 255, 0.95);
  padding: 12px 12px 14px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow);
}
.card.late { box-shadow: 0 0 0 2px var(--red), var(--shadow); }
.card.enter { animation: cardIn 450ms var(--ease) both; }
.card.leaving { animation: cardOut 220ms ease-in both; pointer-events: none; }
.pass {
  border-radius: 18px; padding: 16px 18px; background: var(--pass-sea); color: #FFFFFF;
  display: flex; flex-direction: column; gap: 12px; box-shadow: 0 8px 20px rgba(11, 85, 96, 0.24);
  transition: box-shadow .3s ease;
}
.card.late .pass { background: var(--pass-red); box-shadow: 0 8px 20px rgba(176, 28, 43, 0.28); }
.pass-top, .pass-bottom { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.pass-top { flex-wrap: wrap; row-gap: 4px; }
.pass-top .pass-no { margin-left: auto; }
.pass-brand { font-family: Montserrat, -apple-system, sans-serif; font-size: 9px; font-weight: 600; letter-spacing: 2px; color: rgba(255, 255, 255, 0.8); white-space: nowrap; }
.pass-brand b { font-weight: 800; }
.pass-no { font-size: 13px; font-weight: 600; color: rgba(255, 255, 255, 0.92); white-space: nowrap; }
.pass-label { font-size: 11px; font-weight: 600; letter-spacing: 0.8px; color: rgba(255, 255, 255, 0.75); }
.pass-amount { font-size: 36px; font-weight: 700; letter-spacing: -1px; margin-top: 2px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pass-amount span { font-size: 20px; font-weight: 600; letter-spacing: -0.3px; color: rgba(255, 255, 255, 0.75); }
.pass-mixed { font-size: 13px; color: rgba(255, 255, 255, 0.82); margin-top: 2px; }
.pass-meta { font-size: 13px; color: rgba(255, 255, 255, 0.88); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { font-size: 12px; font-weight: 600; padding: 5px 11px; border-radius: 999px; background: rgba(0, 0, 0, 0.25); color: #FFFFFF; white-space: nowrap; }
.card.fresh .badge { animation: ping 1.6s ease-out infinite; }
.lines { display: flex; flex-direction: column; gap: 8px; font-size: 14px; padding: 0 6px; }
.row { display: flex; justify-content: space-between; gap: 12px; }
.row .qty, .muted { color: var(--sub); }
.row .num { font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sums { border-top: 1px solid var(--hair); margin: 0 6px; padding-top: 10px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.sums .total { font-weight: 600; font-size: 16px; }

/* свайп «Принято» */
.swipe {
  position: relative; height: 60px; border: 0; border-radius: 999px; background: var(--fill); padding: 5px;
  display: flex; align-items: center; overflow: hidden; touch-action: pan-y; text-align: left;
}
.swipe:active { transform: none !important; }
.swipe-fill { position: absolute; inset: 0; width: 0; border-radius: 999px; background: rgba(14, 124, 123, 0.14); pointer-events: none; }
.knob {
  position: relative; z-index: 1; width: 50px; height: 50px; flex-shrink: 0; border-radius: 50%; background: var(--sea);
  box-shadow: 0 3px 10px rgba(14, 124, 123, 0.35); display: flex; align-items: center; justify-content: center;
  touch-action: none; will-change: transform;
}
.knob.back { transition: transform .25s var(--ease); }
.swipe-text { position: relative; z-index: 0; margin-left: 14px; font-size: 16px; font-weight: 600; pointer-events: none; transition: opacity .1s linear; }

/* --- сводка справа --- */
.panel {
  background: rgba(255, 255, 255, 0.72); border: 1px solid var(--glass-edge); border-radius: 26px; padding: 20px;
  display: flex; flex-direction: column; min-height: 0; box-shadow: var(--shadow);
}
.today.collapsed .panel { padding: 0; }
.panel-open { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 4px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.panel-head h2 { margin: 0; font-size: 17px; font-weight: 600; }
.round { width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%; border: 0; background: var(--fill); display: flex; align-items: center; justify-content: center; }
.search { display: flex; align-items: center; gap: 8px; height: 44px; flex-shrink: 0; padding: 0 12px; border-radius: 12px; background: var(--fill); margin-bottom: 6px; }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 15px; color: var(--ink); outline: none; }
.panel-list { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; }
.item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--hair); }
.item.enter { animation: fadeIn 260ms ease-out both; }
.item-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.item-main b { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.item-main small { font-size: 12px; color: var(--sub); }
.pill { height: 44px; flex-shrink: 0; padding: 0 14px; border-radius: 999px; border: 0; background: var(--fill); font-size: 13px; font-weight: 600; color: var(--sea-text); }
.out-amount { font-size: 15px; font-weight: 600; color: var(--red); white-space: nowrap; }
.caps { font-size: 11px; font-weight: 600; letter-spacing: 0.8px; color: var(--sub); }
.outs-title { margin-top: 14px; }
.note { padding: 16px 0; font-size: 14px; color: var(--sub); }
.panel-foot { flex-shrink: 0; border-top: 1px solid var(--hair); padding-top: 12px; margin-top: 8px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.panel-foot label { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.panel-foot input { width: 120px; height: 36px; padding: 0 10px; border-radius: 10px; border: 0; background: var(--fill); font: inherit; font-size: 14px; font-weight: 600; text-align: right; color: var(--ink); }
.panel-foot .row b { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.panel-foot .row b.red { color: var(--red); }
.cash-card {
  border-radius: 18px; padding: 12px 14px; background: var(--pass-dark); color: #FFFFFF;
  display: flex; flex-direction: column; gap: 2px; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}
.cash-card .caps, .cash-card small { color: rgba(255, 255, 255, 0.72); }
.cash-card strong { font-size: 26px; font-weight: 700; letter-spacing: -0.6px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cash-card strong .unit { font-size: 15px; font-weight: 600; color: rgba(255, 255, 255, 0.72); }
.cash-card small { font-size: 12px; }
.buttons { display: flex; gap: 8px; }
.btn { flex: 1; min-width: 0; height: 48px; padding: 0 6px; border-radius: 999px; border: 0; font-size: 14px; font-weight: 600; background: var(--fill); color: var(--ink); }
.btn.primary { background: var(--sea); color: #FFFFFF; }
.btn.primary:disabled { background: var(--off); }
.btn.danger { background: var(--red); color: #FFFFFF; }
.btn.danger:disabled { background: var(--off); }
.closed-note { font-size: 13px; font-weight: 600; }
.rail { flex: 1; width: 100%; border: 0; border-radius: 26px; background: transparent; display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 18px 0; }
.rail span { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 14px; font-weight: 600; white-space: nowrap; }
.today:not(.collapsed) .rail, .today.collapsed .panel-open { display: none; }

/* --- история --- */
.history { flex: 1; min-height: 0; padding: 20px; display: flex; flex-direction: column; gap: 14px; animation: fadeIn 240ms ease-out both; }
.history h2 { margin: 0 0 0 4px; font-size: 24px; font-weight: 700; letter-spacing: -0.4px; }
.table { background: rgba(255, 255, 255, 0.8); border: 1px solid var(--glass-edge); border-radius: 26px; padding: 8px 24px; overflow: auto; min-height: 0; box-shadow: var(--shadow); }
.trow { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--hair); font-size: 14px; align-items: center; font-variant-numeric: tabular-nums; }
.trow.head { padding: 14px 0; font-size: 11px; font-weight: 600; letter-spacing: 0.6px; color: var(--sub); }
.trow b { font-weight: 600; }
.hint { font-size: 13px; color: var(--sub); padding-left: 4px; }

/* --- окна --- */
.modal { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; background: rgba(20, 24, 40, 0.25); animation: veilIn 180ms ease-out both; }
.modal-veil { position: absolute; inset: 0; border: 0; padding: 0; background: transparent; cursor: default; }
.modal-veil:active { transform: none !important; }
.dialog { position: relative; width: min(460px, calc(100vw - 32px)); background: #FFFFFF; border-radius: 28px; padding: 28px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 24px 70px rgba(0, 0, 0, 0.25); animation: popIn 220ms var(--ease) both; }
.dialog h2 { margin: 0; font-size: 22px; font-weight: 700; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--sub); }
.field input { height: 52px; padding: 0 14px; border-radius: 12px; border: 0; background: var(--fill); font: inherit; font-size: 16px; color: var(--ink); }
.field input.big { font-size: 20px; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { height: 44px; padding: 0 16px; border-radius: 999px; border: 0; background: var(--fill); font-size: 14px; font-weight: 500; }
.chips button[aria-pressed="true"] { background: var(--sea); color: #FFFFFF; }
.dialog .buttons { gap: 12px; margin-top: 4px; }
.dialog .btn { height: 52px; font-size: 16px; }
.expected-card { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; border-radius: 16px; padding: 14px 16px; background: var(--pass-dark); color: #FFFFFF; }
.expected-card b { white-space: nowrap; }
.diff { font-size: 20px; font-weight: 700; }
.note-text { margin: 0; font-size: 15px; line-height: 1.45; color: var(--ink); }
.note-text.small { font-size: 13px; color: var(--sub); }

/* --- старт смены (включает звук) --- */
.start { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; background: rgba(242, 242, 245, 0.92); animation: veilIn 200ms ease-out both; }
.start-card { width: min(420px, calc(100vw - 32px)); background: #FFFFFF; border-radius: 30px; padding: 32px; text-align: center; box-shadow: 0 24px 70px rgba(0, 0, 0, 0.15); display: flex; flex-direction: column; gap: 14px; align-items: center; }
.start-card .brand { align-items: center; }
.start-card p { margin: 0; color: var(--sub); font-size: 15px; }
.start-card .btn { width: 100%; height: 56px; font-size: 17px; flex: none; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 40; background: rgba(29, 29, 31, 0.92); color: #FFFFFF; padding: 12px 18px; border-radius: 14px; font-size: 14px; animation: fadeIn .2s ease-out both; }

/* --- движение: плавно, но быстро --- */
@keyframes cardIn { 0% { opacity: 0; transform: translateY(-18px) scale(0.97); } 60% { opacity: 1; } 100% { opacity: 1; transform: none; } }
@keyframes cardOut { to { opacity: 0; transform: scale(0.96) translateY(-6px); } }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.6); } 100% { box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes popIn { from { opacity: 0; transform: scale(0.96) translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes veilIn { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* узкий экран (iPad вертикально): сводка уходит вниз */
@media (max-width: 900px) {
  .today, .today.collapsed { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .panel { max-height: 46vh; }
  .rail { display: none !important; }
  .today.collapsed .panel-open { display: flex; }
  .top-right .status { display: none; }
}
