/* ── LK: Design tokens (inherit from main site) ─────────────── */

:root {
  --lk-bg: #ffffff;
  --lk-bg-secondary: #f5f5f7;
  --lk-accent: #1d1d1f;
  --lk-accent-hover: #000000;
  --lk-text: #1d1d1f;
  --lk-text-secondary: #6e6e73;
  --lk-text-muted: #86868b;
  --lk-border: rgba(0, 0, 0, 0.08);
  --lk-radius: 16px;
  --lk-radius-sm: 10px;
  --lk-radius-xs: 6px;
  --lk-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  --lk-transition: 0.25s cubic-bezier(0.25, 0.1, 0.25, 1);
  --lk-font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --lk-font-heading: 'Unbounded', sans-serif;

  --lk-badge-new: #86868b;
  --lk-badge-new-bg: #f5f5f7;
  --lk-badge-progress: #0071e3;
  --lk-badge-progress-bg: #e8f2ff;
  --lk-badge-ready: #28a745;
  --lk-badge-ready-bg: #e6f9ed;
  --lk-badge-delivered: #6e6e73;
  --lk-badge-delivered-bg: #f0f0f0;
}

/* ── Reset / base ────────────────────────────────────────────── */

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

body {
  font-family: var(--lk-font);
  color: var(--lk-text);
  background: var(--lk-bg-secondary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Login page ──────────────────────────────────────────────── */

.lk-login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--lk-bg);
}

.lk-login-container,
.lk-onboarding-container {
  text-align: center;
  max-width: 400px;
  width: 100%;
}

.lk-onboarding-container { max-width: 560px; }

.lk-login-logo { margin-bottom: 28px; }

.lk-login-title {
  font-family: var(--lk-font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.lk-login-subtitle {
  color: var(--lk-text-secondary);
  font-size: 0.9375rem;
  margin-bottom: 32px;
}

.lk-login-step { margin-top: 8px; }

.lk-login-waiting { margin-bottom: 20px; }

.lk-login-waiting-text {
  font-size: 0.9375rem;
  font-weight: 500;
  margin-top: 16px;
}

.lk-login-waiting-hint {
  color: var(--lk-text-muted);
  font-size: 0.8125rem;
  margin-top: 6px;
}

.lk-login-error-text {
  color: #e53e3e;
  margin-bottom: 16px;
}

/* ── Buttons ─────────────────────────────────────────────────── */

.lk-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 28px;
  border-radius: var(--lk-radius-sm);
  font-family: var(--lk-font);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: transform var(--lk-transition), box-shadow var(--lk-transition), background var(--lk-transition);
}

.lk-btn:active { transform: scale(0.98); }

.lk-btn-primary {
  background: var(--lk-accent);
  color: #fff;
}

.lk-btn-primary:hover {
  background: var(--lk-accent-hover);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.lk-btn-telegram { background: #2AABEE; }
.lk-btn-telegram:hover { background: #229ED9; box-shadow: 0 4px 16px rgba(42, 171, 238, 0.3); }

.lk-btn-secondary {
  background: var(--lk-bg-secondary);
  color: var(--lk-text);
}

.lk-btn-secondary:hover { background: #ebebed; }

.lk-btn-danger {
  background: transparent;
  color: #e53e3e;
  border: 1px solid #e53e3e;
  padding: 12px 24px;
}

.lk-btn-danger:hover { background: #fff5f5; }

/* ── Spinner ─────────────────────────────────────────────────── */

.lk-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--lk-border);
  border-top-color: var(--lk-accent);
  border-radius: 50%;
  animation: lk-spin 0.7s linear infinite;
  margin: 0 auto;
}

@keyframes lk-spin { to { transform: rotate(360deg); } }

/* ── Header ──────────────────────────────────────────────────── */

.lk-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--lk-border);
}

.lk-header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.lk-header-logo { flex-shrink: 0; display: flex; }

.lk-header-back {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--lk-text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: color var(--lk-transition);
}

.lk-header-back:hover { color: var(--lk-text); }

.lk-header-title {
  font-weight: 600;
  font-size: 0.9375rem;
}

.lk-header-nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.lk-nav-link {
  padding: 6px 14px;
  border-radius: var(--lk-radius-xs);
  color: var(--lk-text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background var(--lk-transition), color var(--lk-transition);
}

.lk-nav-link:hover { background: var(--lk-bg-secondary); color: var(--lk-text); }
.lk-nav-link--active { background: var(--lk-bg-secondary); color: var(--lk-text); }

.lk-header-logout {
  color: var(--lk-text-muted);
  transition: color var(--lk-transition);
  display: flex;
  flex-shrink: 0;
}

.lk-header-logout:hover { color: var(--lk-text); }

/* ── Branch selector ─────────────────────────────────────────── */

#lk-branch-selector { position: relative; }

.lk-branch-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--lk-border);
  border-radius: var(--lk-radius-xs);
  background: transparent;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color var(--lk-transition);
}

.lk-branch-btn:hover { border-color: var(--lk-text-muted); }

.lk-branch-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 200px;
  background: var(--lk-bg);
  border: 1px solid var(--lk-border);
  border-radius: var(--lk-radius-sm);
  box-shadow: var(--lk-shadow);
  padding: 4px;
  z-index: 200;
}

.lk-dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: none;
  background: transparent;
  border-radius: var(--lk-radius-xs);
  font-size: 0.875rem;
  cursor: pointer;
  transition: background var(--lk-transition);
}

.lk-dropdown-item:hover { background: var(--lk-bg-secondary); }
.lk-dropdown-item--active { font-weight: 600; }

/* ── Main content ────────────────────────────────────────────── */

.lk-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.lk-page-title {
  font-family: var(--lk-font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
}

.lk-section-title {
  font-family: var(--lk-font-heading);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* ── Summary cards ───────────────────────────────────────────── */

.lk-summary { margin-bottom: 28px; }
.lk-summary-loading { padding: 24px; text-align: center; }

.lk-summary-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.lk-stat-card {
  background: var(--lk-bg);
  border-radius: var(--lk-radius-sm);
  padding: 16px;
  text-align: center;
  border: 1px solid var(--lk-border);
}

.lk-stat-value {
  display: block;
  font-family: var(--lk-font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.lk-stat-label {
  display: block;
  font-size: 0.75rem;
  color: var(--lk-text-muted);
  margin-top: 4px;
}

/* ── Orders section ──────────────────────────────────────────── */

.lk-orders-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.lk-orders-filters {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.lk-filter-btn {
  padding: 6px 14px;
  border: none;
  border-radius: 100px;
  background: transparent;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--lk-text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--lk-transition), color var(--lk-transition);
}

.lk-filter-btn:hover { background: var(--lk-bg); }
.lk-filter-btn--active { background: var(--lk-accent); color: #fff; }
.lk-filter-btn--active:hover { background: var(--lk-accent-hover); }

.lk-orders-list { display: flex; flex-direction: column; gap: 8px; }
.lk-orders-loading { padding: 40px; text-align: center; }

/* ── Order card ──────────────────────────────────────────────── */

.lk-order-card {
  display: block;
  background: var(--lk-bg);
  border: 1px solid var(--lk-border);
  border-radius: var(--lk-radius-sm);
  padding: 16px;
  text-decoration: none;
  color: inherit;
  transition: border-color var(--lk-transition), box-shadow var(--lk-transition);
}

.lk-order-card:hover {
  border-color: rgba(0, 0, 0, 0.15);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.lk-order-card--cancelled { opacity: 0.55; }
.lk-order-card--cancelled .lk-order-card-services { text-decoration: line-through; }

.lk-order-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.lk-order-id {
  font-weight: 600;
  font-size: 0.875rem;
}

.lk-urgent { margin-left: 4px; }

.lk-order-card-services {
  font-size: 0.8125rem;
  color: var(--lk-text-secondary);
  margin-bottom: 10px;
}

.lk-order-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.lk-order-price { font-weight: 600; font-size: 0.9375rem; }

.lk-order-date {
  font-size: 0.75rem;
  color: var(--lk-text-muted);
}

/* ── Badges ──────────────────────────────────────────────────── */

.lk-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.lk-badge--new { color: var(--lk-badge-new); background: var(--lk-badge-new-bg); }
.lk-badge--progress { color: var(--lk-badge-progress); background: var(--lk-badge-progress-bg); }
.lk-badge--ready { color: var(--lk-badge-ready); background: var(--lk-badge-ready-bg); }
.lk-badge--delivered { color: var(--lk-badge-delivered); background: var(--lk-badge-delivered-bg); }

/* ── Order detail ────────────────────────────────────────────── */

.lk-order-detail { max-width: 640px; }

.lk-detail-card {
  background: var(--lk-bg);
  border: 1px solid var(--lk-border);
  border-radius: var(--lk-radius);
  padding: 24px;
}

.lk-detail-card.lk-order-detail--cancelled { opacity: 0.6; }

.lk-detail-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.lk-detail-dates {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  font-size: 0.875rem;
}

.lk-detail-dates > div { display: flex; flex-direction: column; gap: 2px; }

.lk-detail-label {
  font-size: 0.75rem;
  color: var(--lk-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.lk-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--lk-border);
}

.lk-detail-row:last-child { border-bottom: none; }
.lk-detail-row--highlight { font-weight: 600; font-size: 1rem; }

.lk-detail-total { font-weight: 600; }

.lk-detail-items {
  margin: 20px 0;
  padding-top: 16px;
  border-top: 1px solid var(--lk-border);
}

.lk-detail-items-title {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--lk-text-muted);
  margin-bottom: 12px;
}

.lk-item-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid var(--lk-border);
}

.lk-item-row:last-child { border-bottom: none; }

.lk-item-info { display: flex; flex-direction: column; gap: 2px; }

.lk-item-name { font-size: 0.875rem; font-weight: 500; }

.lk-item-meta {
  font-size: 0.75rem;
  color: var(--lk-text-muted);
}

.lk-item-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.lk-item-price { font-size: 0.875rem; font-weight: 500; }

.lk-item-express {
  font-size: 0.6875rem;
  font-weight: 600;
  color: #e65100;
  background: #fff3e0;
  padding: 2px 6px;
  border-radius: 4px;
}

.lk-item-ready { color: var(--lk-badge-ready); font-size: 0.75rem; }
.lk-item-delivered { color: var(--lk-badge-delivered); font-size: 0.75rem; }

.lk-detail-loyalty {
  margin-top: 16px;
  padding: 12px;
  background: var(--lk-badge-ready-bg);
  color: var(--lk-badge-ready);
  border-radius: var(--lk-radius-xs);
  font-size: 0.8125rem;
  font-weight: 600;
  text-align: center;
}

.lk-detail-totals {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--lk-border);
}

/* ── Branches grid ───────────────────────────────────────────── */

.lk-branches-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.lk-branches-grid--compact { margin-top: 12px; }

.lk-branches-loading { grid-column: 1 / -1; padding: 24px; text-align: center; }

.lk-branch-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  background: var(--lk-bg);
  border: 2px solid var(--lk-border);
  border-radius: var(--lk-radius-sm);
  cursor: pointer;
  text-align: left;
  transition: border-color var(--lk-transition), box-shadow var(--lk-transition);
  font-family: var(--lk-font);
}

.lk-branch-card:hover {
  border-color: var(--lk-text-muted);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.lk-branch-card--active {
  border-color: var(--lk-accent);
  background: #fafafa;
}

.lk-branch-card-name { font-weight: 600; font-size: 0.9375rem; }

.lk-branch-card-addr {
  font-size: 0.8125rem;
  color: var(--lk-text-secondary);
}

/* ── Settings ────────────────────────────────────────────────── */

.lk-settings-section {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--lk-border);
}

.lk-settings-section:last-child { border-bottom: none; }

.lk-settings-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--lk-text-muted);
  margin-bottom: 6px;
}

.lk-settings-value { font-size: 0.9375rem; }

/* ── Empty & error states ────────────────────────────────────── */

.lk-empty {
  padding: 48px 24px;
  text-align: center;
  background: var(--lk-bg);
  border: 1px solid var(--lk-border);
  border-radius: var(--lk-radius-sm);
}

.lk-empty-text { font-weight: 500; margin-bottom: 6px; }

.lk-empty-hint {
  font-size: 0.8125rem;
  color: var(--lk-text-muted);
}

.lk-error {
  color: #e53e3e;
  text-align: center;
  padding: 20px;
  font-size: 0.875rem;
}

.lk-error--sm { padding: 10px; font-size: 0.8125rem; }

/* ── Load more ───────────────────────────────────────────────── */

.lk-load-more {
  margin-top: 16px;
  width: 100%;
}

/* ── Responsive ──────────────────────────────────────────────── */

@media (max-width: 768px) {
  .lk-summary-cards { grid-template-columns: repeat(2, 1fr); }

  .lk-header-inner { padding: 10px 16px; }
  .lk-main { padding: 16px 16px 40px; }

  .lk-orders-header { flex-direction: column; align-items: flex-start; }

  .lk-detail-dates { flex-direction: column; gap: 12px; }

  .lk-branches-grid { grid-template-columns: 1fr; }

  .lk-header-nav { gap: 2px; }
  .lk-nav-link { padding: 6px 10px; font-size: 0.8125rem; }
}

@media (max-width: 480px) {
  .lk-login-title { font-size: 1.25rem; }

  .lk-stat-value { font-size: 1rem; }
  .lk-stat-label { font-size: 0.6875rem; }
}
