:root {
  color-scheme: dark;
  --bg: #121212;
  --surface: #1b1b1d;
  --surface-2: #242428;
  --line: rgba(255, 255, 255, 0.09);
  --text: #f2f0f5;
  --muted: #aaa7b4;
  --primary: #39ddb0;
  --primary-strong: #20c99b;
  --danger: #ffb4ab;
  --warning: #ffb95e;
  --success: #87d7a0;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; background: var(--bg); }
body { font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--text); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.auth-view {
  min-height: 100dvh;
  padding: 30px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background:
    radial-gradient(circle at 50% 35%, rgba(192, 193, 255, .08), transparent 26rem),
    var(--bg);
}

.logo-panel {
  width: auto;
  height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #f3f2f5;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -.035em;
}
.logo-panel img { width: 34px; height: 34px; object-fit: contain; }
.accent-line { width: 44px; height: 2px; margin: 32px 0 20px; background: var(--primary); }
.eyebrow { color: var(--primary); font-size: 11px; font-weight: 700; letter-spacing: .16em; }
.auth-status p { max-width: 330px; color: var(--muted); line-height: 1.55; }
.device-pill, .live-pill {
  margin-top: 22px;
  padding: 8px 14px;
  border: 1px solid rgba(192,193,255,.23);
  border-radius: 100px;
  background: rgba(192,193,255,.07);
  color: var(--primary);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .13em;
}

.phone-site { width: 100%; min-height: 100dvh; background: var(--bg); }
.auth-view { justify-content: flex-start; padding-top: max(48px, env(safe-area-inset-top)); overflow-y: auto; }
.auth-logo { width: auto; height: 42px; }
.auth-brand { margin-top: 24px; color: #39ddb0; font-size: clamp(42px, 13vw, 58px); font-weight: 800; letter-spacing: -.075em; line-height: .95; }
.auth-subtitle { margin-top: 12px; color: #8f8b99; font-size: 10px; font-weight: 700; letter-spacing: .28em; }
.auth-status { margin-top: 72px; }
.auth-status h1 { margin: 18px 0 4px; font-size: 24px; }
.spinner {
  width: 30px; height: 30px; margin: 0 auto;
  border: 3px solid rgba(192,193,255,.18); border-top-color: var(--primary);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.auth-error { max-width: 350px; padding: 22px; border: 1px solid rgba(255,180,171,.25); border-radius: 20px; background: rgba(255,180,171,.06); }
.auth-error h1 { margin-top: 0; }
.primary-button, .secondary-button {
  border: 0; border-radius: 13px; padding: 14px 18px; font-weight: 700;
  background: var(--primary); color: #06271f;
}
.secondary-button { border: 1px solid var(--line); background: var(--surface-2); color: var(--text); }
.login-form { width: 100%; max-width: 380px; margin-top: 34px; text-align: left; }
.login-heading { margin-bottom: 24px; text-align: center; }
.login-heading h1 { margin: 0 0 7px; font-size: 27px; }
.login-heading p, .login-note { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.login-form .primary-button, .login-form .secondary-button { width: 100%; }
.login-error { min-height: 18px; margin: -5px 0 10px; color: var(--danger); font-size: 12px; line-height: 1.45; }
.login-divider { height: 34px; display: flex; align-items: center; justify-content: center; color: #777481; font-size: 9px; letter-spacing: .14em; }
.login-divider::before, .login-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.login-divider span { padding: 0 10px; }
.login-note { margin-top: 18px; text-align: center; font-size: 11px; }
.otp-actions { display: flex; justify-content: space-between; margin-top: 10px; }
.otp-actions .text-button { color: #39ddb0; }

.workspace { min-height: 100dvh; padding-bottom: calc(82px + env(safe-area-inset-bottom)); }
.topbar {
  position: sticky; top: 0; z-index: 10; min-height: 68px;
  padding: calc(14px + env(safe-area-inset-top)) 18px 12px;
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(18,18,18,.94); backdrop-filter: blur(18px); border-bottom: 1px solid var(--line);
}
.topbar strong { color: var(--primary); font-size: 21px; letter-spacing: -.03em; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.live-pill { margin: 0; display: flex; align-items: center; gap: 6px; padding: 6px 10px; }
.live-pill i { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 10px var(--primary); }
.icon-button { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--muted); }
.page { width: min(100%, 560px); margin: 0 auto; padding: 26px 16px 30px; }
.page-title { margin: 0; font-size: 39px; line-height: 1.03; letter-spacing: -.055em; }
.page-subtitle { margin: 8px 0 24px; color: var(--muted); line-height: 1.5; }
.urgent { color: var(--danger); font-weight: 650; }
.section-title { margin: 28px 0 12px; font-size: 14px; letter-spacing: .02em; }
.card {
  margin-bottom: 12px; padding: 17px; overflow: hidden;
  border: 1px solid var(--line); border-radius: 20px;
  background: linear-gradient(145deg, rgba(255,255,255,.055), rgba(255,255,255,.022));
}
.card.critical { border-color: rgba(255,180,171,.28); box-shadow: 0 10px 40px rgba(130,0,0,.11); }
.card-head, .card-foot, .row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.store-code, .meta, .label { color: #8f8b99; font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.store-name { margin: 5px 0 0; font-size: 20px; }
.badge { padding: 6px 9px; border-radius: 100px; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.badge.critical, .priority-critical { color: var(--danger); background: rgba(255,180,171,.09); }
.badge.low, .priority-high { color: var(--warning); background: rgba(255,185,94,.09); }
.badge.optimal, .priority-medium { color: var(--success); background: rgba(135,215,160,.09); }
.card-rule { height: 1px; margin: 14px 0; background: var(--line); }
.detail-list { display: grid; gap: 8px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.stock-meter { height: 6px; margin-top: 12px; border-radius: 10px; overflow: hidden; background: rgba(255,255,255,.07); }
.stock-meter i { display: block; height: 100%; border-radius: inherit; background: var(--primary); }
.text-button { border: 0; padding: 7px 0; background: transparent; color: var(--primary); font-size: 12px; font-weight: 700; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { padding: 17px 8px; text-align: center; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.stat strong { display: block; color: var(--primary); font-size: 26px; }
.stat span { color: var(--muted); font-size: 11px; }
.action-card { width: 100%; padding: 16px; text-align: left; border: 1px solid rgba(192,193,255,.2); border-radius: 17px; background: rgba(192,193,255,.06); color: var(--text); }
.action-card strong { display: block; margin-bottom: 4px; }
.action-card span { color: var(--muted); font-size: 12px; }
.ticket-status { color: var(--muted); font-size: 12px; text-transform: capitalize; }

.slot-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; margin: 16px 0; }
.slot { aspect-ratio: .65; border: 1px solid var(--line); border-radius: 10px; display: grid; place-items: center; font-size: 11px; font-weight: 800; background: var(--surface-2); }
.slot.correct { border-color: rgba(135,215,160,.4); color: var(--success); }
.slot.incorrect { border-color: rgba(255,180,171,.5); color: var(--danger); }
.slot.empty { border-style: dashed; color: var(--warning); }
.proof-image { width: 100%; border-radius: 16px; border: 1px solid var(--line); }

.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 50px; padding: 13px 14px;
  border: 1px solid var(--line); border-radius: 13px; outline: 0;
  background: #19191c; color: var(--text);
}
.field textarea { min-height: 110px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); }
.form-actions { display: grid; grid-template-columns: 1fr 1.5fr; gap: 10px; }

.bottom-nav {
  position: fixed; z-index: 20; left: 0; right: 0; bottom: 0;
  min-height: 72px; padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line); background: rgba(22,22,24,.97); backdrop-filter: blur(20px);
}
.bottom-nav button { border: 0; background: transparent; color: #85818e; font-size: 10px; font-weight: 650; }
.bottom-nav button span { display: block; margin-bottom: 4px; font-size: 20px; }
.bottom-nav button.active { color: var(--primary); }
.toast {
  position: fixed; z-index: 50; left: 50%; bottom: 96px; max-width: calc(100vw - 32px);
  padding: 12px 16px; border-radius: 12px; transform: translate(-50%, 20px);
  background: var(--text); color: #1b1b1d; font-size: 13px; font-weight: 650;
  opacity: 0; pointer-events: none; transition: .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.empty, .loading-card { padding: 34px 20px; text-align: center; color: var(--muted); }

@media (min-width: 700px) {
  .phone-site { width: min(100%, 620px); margin: 0 auto; border-inline: 1px solid var(--line); }
}
