/* Павер Админ — Mobile-first styles */
:root {
  --primary: #fa8502;
  --primary-dark: #e07600;
  --bg: #f2f2f7;
  --surface: #ffffff;
  --surface2: #f0f0f6;
  --text: #1a1a2e;
  --text-muted: #6b6b80;
  --danger: #e53935;
  --success: #43a047;
  --warning: #fb8c00;
  --info: #1976d2;
  --border: #e0e0ec;
  --shadow: 0 2px 8px rgba(0,0,0,0.09);
  --radius: 14px;
  --radius-sm: 10px;
  --nav-h: 62px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Page layouts ── */
.page {
  max-width: 600px;
  margin: 0 auto;
  padding: 0 16px calc(var(--nav-h) + 20px);
}

.page--auth {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  min-height: 100dvh;
}

/* ── Header ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 12px;
  gap: 10px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

/* ── Cards ── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 10px;
}

/* ── Forms ── */
.form-group { margin-bottom: 14px; }
.form-group:last-child { margin-bottom: 0; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 13px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

.form-input:focus { border-color: var(--primary); }

select.form-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b6b80' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 13px 18px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  min-height: 48px;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
  white-space: nowrap;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; pointer-events: none; }

.btn--primary { background: var(--primary); color: #fff; width: 100%; }
.btn--primary:active { background: var(--primary-dark); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--success { background: var(--success); color: #fff; }
.btn--ghost { background: var(--surface2); color: var(--text); }
.btn--outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn--sm { padding: 8px 14px; font-size: 13px; min-height: 36px; border-radius: 8px; }
.btn--full { width: 100%; }

/* ── Bottom nav ── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2px;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s;
  padding-top: 4px;
}

.nav-item.active { color: var(--primary); }
.nav-item svg { width: 22px; height: 22px; }

/* ── Slot grid ── */
.slots-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

@media (min-width: 380px) {
  .slots-grid { grid-template-columns: repeat(3, 1fr); }
}

.slot-card {
  background: var(--surface2);
  border-radius: var(--radius-sm);
  padding: 12px;
  border-left: 3px solid var(--border);
}

.slot-card--ok { border-left-color: var(--success); }
.slot-card--empty { border-left-color: var(--border); }
.slot-card--error { border-left-color: var(--danger); }

.slot-num {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 3px;
}

.slot-status {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
}

.slot-meta {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ── Orders ── */
.order-item {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s;
}

.order-item:active { transform: scale(0.98); }

.order-id {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'Courier New', monospace;
  margin-bottom: 4px;
  letter-spacing: 0.3px;
}

.order-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.order-info { flex: 1; min-width: 0; }

.order-device {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.order-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}

/* ── Status badges ── */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.badge--active   { background: #e3f2fd; color: var(--info); }
.badge--done     { background: #e8f5e9; color: var(--success); }
.badge--pending  { background: #fff3e0; color: var(--warning); }
.badge--canceled { background: #ffebee; color: var(--danger); }
.badge--refunded { background: #f3e5f5; color: #7b1fa2; }

/* ── Modal (bottom sheet) ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: env(safe-area-inset-bottom);
}

.modal {
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 8px 16px 28px;
  width: 100%;
  max-width: 600px;
  max-height: 90dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  animation: slideUp 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}

@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal-handle {
  width: 36px; height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 8px auto 14px;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  letter-spacing: -0.2px;
}

/* ── Data rows ── */
.data-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  gap: 16px;
}

.data-row:last-child { border-bottom: none; }

.data-label {
  font-size: 13px;
  color: var(--text-muted);
  flex-shrink: 0;
  padding-top: 1px;
}

.data-value {
  font-size: 13px;
  font-weight: 600;
  text-align: right;
  word-break: break-all;
}

/* ── Auth card ── */
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border-radius: 20px;
  padding: 28px 20px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
}

.auth-logo { text-align: center; margin-bottom: 28px; }

.auth-logo-icon {
  width: 60px; height: 60px;
  background: var(--primary);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  box-shadow: 0 4px 12px rgba(250,133,2,0.35);
}

.auth-logo h2 { font-size: 20px; font-weight: 700; }

.auth-logo p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ── Pagination ── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 0 4px;
}

.page-info {
  font-size: 13px;
  color: var(--text-muted);
  min-width: 80px;
  text-align: center;
}

/* ── Loading / Empty ── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 44px 0;
  color: var(--text-muted);
  font-size: 14px;
  gap: 10px;
}

.spinner {
  width: 20px; height: 20px;
  border: 2.5px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  text-align: center;
  padding: 44px 20px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.7;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + 14px);
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a2e;
  color: #fff;
  padding: 12px 20px;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 500;
  z-index: 400;
  white-space: nowrap;
  max-width: calc(100vw - 32px);
  text-align: center;
  white-space: normal;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  animation: toastIn 0.25s ease;
  pointer-events: none;
}

.toast--success { background: var(--success); }
.toast--error   { background: var(--danger); }
.toast--no-nav  { bottom: 20px; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Filter bar ── */
.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  align-items: flex-end;
}

.filter-bar .form-input { padding: 11px 14px; min-height: 44px; }
.filter-bar .btn { min-height: 44px; }

/* ── Divider ── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* ── Payments list ── */
.payment-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}

.payment-row:last-child { border-bottom: none; }

/* ── Utils ── */
.text-muted  { color: var(--text-muted); }
.text-sm     { font-size: 13px; }
.text-xs     { font-size: 12px; }
.fw-700      { font-weight: 700; }
.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.gap-8 { gap: 8px; }

.row {
  display: flex;
  gap: 8px;
}

.row .btn { flex: 1; }

/* copy icon */
.copy-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  line-height: 1;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.copy-btn:active { color: var(--primary); }

/* Section header */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
