/* «Город золотой» — дизайн-система, тёмная тема
   Токены из stitch_gorod_zolotoy_staff_tool/gorod_zolotoy_internal/DESIGN.md */

:root {
  --bg: #0F1115;
  --card: #1A1D23;
  --card-high: #232833;
  --border: #2A2F38;
  --text: #F2F3F5;
  --muted: #9AA1AC;
  --gold: #C9A227;
  --gold-bright: #ECC246;
  --green: #22C55E;
  --yellow: #EAB308;
  --red: #EF4444;
  --radius: 16px;
  --radius-sm: 12px;
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --touch: 48px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; }

body {
  background: #000;
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100dvh;
}

#app {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  position: relative;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

input, textarea {
  font-family: inherit;
  color: var(--text);
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0 var(--space-md) var(--space-md);
  animation: screen-in .18s ease-out;
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Иконки ---------- */
.icon {
  width: 24px;
  height: 24px;
  fill: currentColor;
  flex-shrink: 0;
}
.icon-sm { width: 20px; height: 20px; }
.icon-lg { width: 28px; height: 28px; }

/* ---------- Шапка экрана ---------- */
.topbar {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 calc(-1 * var(--space-md));
  padding: 0 var(--space-md);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.topbar-btn {
  width: var(--touch);
  height: var(--touch);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text);
  margin-left: -8px;
}
.topbar-btn:active { background: var(--card); }
.topbar-title {
  font-size: 17px;
  font-weight: 600;
  flex: 1;
  text-align: center;
}
.topbar-spacer { width: var(--touch); flex-shrink: 0; }

/* ---------- Кнопки ---------- */
.btn {
  width: 100%;
  height: 56px;
  border-radius: var(--radius);
  font-size: 17px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform .1s ease, opacity .15s ease, background .15s ease;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--gold); color: var(--bg); }
.btn-green   { background: var(--green); color: var(--bg); }
.btn-red     { background: var(--red); color: var(--text); }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-ghost {
  background: none;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  height: var(--touch);
}
.btn-ghost:active { opacity: .7; }

/* ---------- Карточки ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-md);
}

.section-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: var(--space-sm);
}

/* ---------- Статусная карточка на главном ---------- */
.status-card {
  height: 160px;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.status-card .status-name {
  font-size: 32px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.5px;
}
.status-card .status-meta {
  margin-top: 8px;
  font-size: 14px;
  font-weight: 500;
  opacity: .7;
}
.status-card.on-floor  { background: var(--green);  color: var(--bg); }
.status-card.break     { background: var(--yellow); color: var(--bg); }
.status-card.off-shift { background: var(--card); color: var(--muted); border: 1px solid var(--border); }
.status-card.off-shift .status-name { color: var(--text); }

/* ---------- Очередь ---------- */
.queue-row {
  min-height: 60px;
  background: var(--card);
  border: 1px solid transparent;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  padding: 0 var(--space-md);
  gap: 0;
}
.queue-row.me { border-color: var(--gold); }
.queue-row.dimmed { opacity: .6; }
.queue-pos {
  font-size: 16px;
  font-weight: 700;
  color: var(--muted);
  width: 24px;
  flex-shrink: 0;
}
.queue-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 12px;
  flex-shrink: 0;
}
.queue-dot.g { background: var(--green); }
.queue-dot.y { background: var(--yellow); }
.queue-dot.r { background: var(--red); }
.queue-name {
  font-size: 16px;
  font-weight: 500;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.queue-row.dimmed .queue-name { color: var(--muted); }
.queue-meta { font-size: 14px; color: var(--muted); }
.queue-meta.you { font-size: 13px; font-weight: 600; color: var(--gold); }

/* ---------- Экран входа (PIN) ---------- */
.login-logo {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--gold);
  text-transform: uppercase;
  text-align: center;
}
.login-sub {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--muted);
  text-transform: uppercase;
  text-align: center;
  margin-top: 4px;
}
.pin-row {
  display: flex;
  justify-content: center;
  gap: var(--space-sm);
}
.pin-cell {
  width: 64px;
  height: 72px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 600;
  position: relative;
}
.pin-cell.active::after {
  content: '';
  position: absolute;
  width: 2px;
  height: 32px;
  background: var(--gold);
  animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.pin-row.error .pin-cell {
  border-color: var(--red);
  animation: shake .4s ease;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
}
.key-btn {
  height: 64px;
  background: var(--card);
  border-radius: var(--radius);
  font-size: 24px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}
.key-btn:active { background: var(--border); }
.key-btn.empty { background: transparent; pointer-events: none; }

/* ---------- Экран консультации ---------- */
.consult-label {
  color: var(--red);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-align: center;
}
.consult-timer {
  font-size: 72px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-align: center;
  margin-top: 12px;
}
.consult-since {
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  margin-top: 8px;
}
.reminder-item {
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 15px;
}
.reminder-item::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  margin-right: 12px;
  flex-shrink: 0;
}

/* ---------- Блокирующий поток (результат) ---------- */
.lock-bar {
  height: 44px;
  margin: 0 calc(-1 * var(--space-md));
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--yellow);
  font-size: 13px;
  font-weight: 500;
  flex-shrink: 0;
}

.outcome-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
}
.outcome-tile {
  height: 96px;
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--green);
  border-radius: var(--radius);
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  text-align: left;
  color: var(--muted);
}
.outcome-tile:active { background: var(--card-high); }
.outcome-tile .t-name { font-size: 15px; font-weight: 600; color: var(--text); }

.outcome-list-item {
  min-height: 64px;
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--red);
  border-radius: var(--radius);
  padding: 0 var(--space-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  text-align: left;
  color: var(--muted);
}
.outcome-list-item:active { background: var(--card-high); }
.outcome-list-item .li-left {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
}
.outcome-list-item .li-left .icon { color: var(--muted); }
.outcome-list-item.neutral { border-left-color: var(--border); }

.label-green { color: var(--green); }
.label-red   { color: var(--red); }

/* ---------- Документы ---------- */
.search-field {
  position: relative;
}
.search-field .icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
}
.search-field input {
  width: 100%;
  height: var(--touch);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 var(--space-md) 0 44px;
  font-size: 15px;
  outline: none;
}
.search-field input::placeholder { color: var(--muted); }
.search-field input:focus { border-color: var(--gold); }

.doc-row {
  min-height: 64px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px var(--space-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  text-align: left;
  gap: 12px;
}
.doc-row:active { background: var(--card-high); }
.doc-row.suggested { border-color: var(--gold); }
.doc-row.selected { border-color: var(--gold); background: var(--card-high); }
.doc-num { font-size: 16px; font-weight: 600; }
.doc-meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.doc-amount { font-size: 15px; font-weight: 500; white-space: nowrap; }
.doc-tag {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gold);
  margin-bottom: 6px;
}
.radio {
  width: 22px;
  height: 22px;
  border: 1.5px solid var(--border);
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.selected .radio, .doc-row.suggested.selected .radio { border-color: var(--gold); }
.selected .radio::before {
  content: '';
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--gold);
}

/* ---------- Чипы (детализация спроса) ---------- */
.chip-row {
  display: flex;
  gap: var(--space-xs);
  overflow-x: auto;
  margin: 0 calc(-1 * var(--space-md));
  padding: 0 var(--space-md) 4px;
  scrollbar-width: none;
}
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  height: 40px;
  padding: 0 var(--space-md);
  border-radius: 9999px;
  background: var(--card);
  border: 1px solid var(--border);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  color: var(--text);
}
.chip.active {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--bg);
}

textarea.comment {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-md);
  font-size: 15px;
  resize: none;
  outline: none;
}
textarea.comment:focus { border-color: var(--gold); }
textarea.comment::placeholder { color: var(--muted); }

/* ---------- Перерыв ---------- */
.break-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
}
.break-tile {
  height: 110px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
}
.break-tile .icon { color: var(--gold); }
.break-tile .t-name { font-size: 16px; font-weight: 600; }
.break-tile.active {
  border-color: var(--gold);
  background: var(--card-high);
}

/* ---------- Низ экрана ---------- */
.bottom-actions {
  margin-top: auto;
  padding-top: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  flex-shrink: 0;
}
.bottom-hint {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

/* ---------- Модалка подтверждения ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  z-index: 100;
  animation: fade-in .15s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%;
  max-width: 360px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-lg);
}
.modal h3 { font-size: 18px; font-weight: 600; }
.modal p { font-size: 14px; color: var(--muted); margin-top: 8px; line-height: 1.45; }
.modal-actions {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}
.modal-actions .btn { height: 48px; font-size: 15px; }

/* ---------- Тост ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card-high);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  z-index: 200;
  white-space: nowrap;
  animation: toast-in .2s ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------- Утилиты ---------- */
.mt-xs { margin-top: var(--space-xs); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.stack { display: flex; flex-direction: column; gap: var(--space-xs); }
.stack-sm { display: flex; flex-direction: column; gap: var(--space-sm); }
.grow { flex: 1; }
.muted { color: var(--muted); }
.center { text-align: center; }
.tabular { font-variant-numeric: tabular-nums; }
