:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-elevated: #fcfdff;
  --text-primary: #0d1b2a;
  --text-secondary: #4f5d75;
  --brand: #1363df;
  --brand-soft: #e7f0ff;
  --accent: #00a8cc;
  --success: #0ea472;
  --warning: #f59e0b;
  --danger: #e5484d;
  --border: #dfe7f3;
  --overlay: rgba(13, 27, 42, 0.45);
  --shadow: 0 6px 20px rgba(12, 26, 46, 0.08);
  --radius-lg: 20px;
  --radius-md: 16px;
  --safe-bottom: calc(16px + env(safe-area-inset-bottom));
}

.theme-dark {
  --bg: #080e16;
  --surface: #0e1623;
  --surface-elevated: #131f31;
  --text-primary: #eaf1ff;
  --text-secondary: #afc0db;
  --brand: #5aa2ff;
  --brand-soft: rgba(90, 162, 255, 0.16);
  --accent: #2ec9e6;
  --success: #23c38b;
  --warning: #f5b73c;
  --danger: #ff6d73;
  --border: #23344c;
  --overlay: rgba(2, 8, 16, 0.64);
  --shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100%;
}

.app {
  max-width: 1440px;
  min-height: 100vh;
  margin: 0 auto;
  background: linear-gradient(180deg, var(--bg), color-mix(in srgb, var(--bg) 90%, #fff 10%));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
}

.brand-wrap { min-width: 0; }
.brand-title { font-size: 17px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-subtitle { font-size: 12px; margin: 1px 0 0; color: var(--text-secondary); }

.icon-btn {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text-primary);
  min-width: 42px;
  height: 42px;
  box-shadow: var(--shadow);
  position: relative;
}

.dot-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 11px;
  color: #fff;
  background: var(--danger);
}

.main {
  padding: 8px 16px calc(106px + var(--safe-bottom));
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stack { display: grid; gap: 10px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.metric-title { font-size: 13px; color: var(--text-secondary); margin: 0 0 2px; }
.metric-value { font-size: 25px; font-weight: 700; margin: 0; }
.muted { color: var(--text-secondary); font-size: 13px; margin: 4px 0 0; }

.chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
}

.chip.optimo { background: color-mix(in srgb, var(--success) 18%, transparent); color: color-mix(in srgb, var(--success) 76%, #fff 24%); }
.chip.atencion { background: color-mix(in srgb, var(--warning) 18%, transparent); color: color-mix(in srgb, var(--warning) 76%, #fff 24%); }
.chip.urgente { background: color-mix(in srgb, var(--danger) 18%, transparent); color: color-mix(in srgb, var(--danger) 76%, #fff 24%); }

.btn {
  display: inline-grid;
  place-items: center;
  border-radius: 14px;
  border: 1px solid transparent;
  min-height: 46px;
  padding: 0 14px;
  font-weight: 600;
  text-decoration: none;
  transition: transform 120ms ease, filter 120ms ease, border-color 180ms ease, background 180ms ease;
}

.btn.primary { background: var(--brand); color: #fff; }
.btn.secondary { border-color: var(--border); background: var(--surface); color: var(--text-primary); }
.btn.tertiary { background: transparent; color: var(--brand); }
.btn.full { width: 100%; }

.input,
.select,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--surface-elevated);
  color: var(--text-primary);
}

.label { font-size: 13px; margin: 0 0 6px; color: var(--text-secondary); }
.helper { font-size: 12px; color: var(--text-secondary); margin-top: 6px; }

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 1440px;
  margin: 0 auto;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-top: 1px solid var(--border);
  padding: 8px 10px var(--safe-bottom);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  z-index: 30;
}

.client-shell .bottom-nav {
  left: 14px;
  right: 14px;
  bottom: calc(8px + env(safe-area-inset-bottom));
  max-width: calc(1440px - 28px);
  border: 1px solid color-mix(in srgb, var(--brand) 16%, var(--border));
  border-radius: 22px;
  background: color-mix(in srgb, var(--surface) 84%, rgba(255, 255, 255, 0.75));
  backdrop-filter: blur(14px);
  box-shadow: 0 14px 30px rgba(10, 22, 44, 0.16);
  padding: 8px 10px;
  gap: 8px;
}

.client-shell .topbar .icon-btn {
  display: inline-grid;
  place-items: center;
}

.client-shell .topbar .icon-btn svg {
  width: 19px;
  height: 19px;
}

.client-shell .sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 18, 36, 0.34);
  backdrop-filter: blur(2px);
  z-index: 72;
}

.client-shell .client-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: min(84vw, 320px);
  height: 100vh;
  background: linear-gradient(180deg, #ffffff 0%, #f5f8fd 100%);
  border-right: 1px solid color-mix(in srgb, var(--brand) 18%, var(--border));
  box-shadow: 12px 0 28px rgba(10, 22, 44, 0.18);
  padding: calc(14px + env(safe-area-inset-top)) 14px 16px;
  z-index: 73;
}

.client-shell .client-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.tab {
  border: none;
  border-radius: 12px;
  background: transparent;
  min-height: 54px;
  color: var(--text-secondary);
  font-size: 12px;
  position: relative;
  transition: background 180ms ease, color 180ms ease, transform 120ms ease;
}


.client-shell .bottom-nav .tab {
  display: grid;
  place-items: center;
  gap: 4px;
  min-height: 52px;
  border-radius: 14px;
  font-size: 11.5px;
  letter-spacing: 0.01em;
}

.client-shell .bottom-nav .tab-icon {
  width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  position: relative;
  opacity: 0.86;
}

.client-shell .bottom-nav .tab-icon svg {
  width: 20px;
  height: 20px;
}

.client-shell .bottom-nav .tab-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.client-shell .bottom-nav .tab-badge {
  position: absolute;
  top: -6px;
  right: -10px;
  min-width: 18px;
  height: 18px;
  margin-left: 0;
  font-size: 10px;
  font-weight: 700;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--surface) 95%, transparent);
}

.client-shell .bottom-nav .tab.active {
  color: var(--brand);
  background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 18%, #fff 82%) 0%, color-mix(in srgb, var(--brand) 10%, #fff 90%) 100%);
  border: 1px solid color-mix(in srgb, var(--brand) 32%, var(--border));
  box-shadow: 0 6px 14px rgba(9, 36, 88, 0.14);
  font-weight: 700;
}

.client-shell .bottom-nav .tab.active .tab-icon {
  opacity: 1;
}

.client-shell .bottom-nav .small-badge {
  margin-left: 0;
}
.tab.active { color: var(--brand); background: var(--brand-soft); font-weight: 600; }
.small-badge {
  display: inline-grid;
  place-items: center;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  margin-left: 4px;
}

.fab {
  position: fixed;
  bottom: calc(58px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: 58px;
  height: 58px;
  border-radius: 999px;
  border: none;
  background: var(--brand);
  color: #fff;
  font-size: 28px;
  box-shadow: 0 12px 24px color-mix(in srgb, var(--brand) 45%, #000 55%);
  z-index: 40;
  transition: transform 120ms ease, box-shadow 180ms ease;
}

.client-shell .fab {
  bottom: calc(78px + env(safe-area-inset-bottom));
  width: 60px;
  height: 60px;
  box-shadow: 0 14px 28px color-mix(in srgb, var(--brand) 52%, #000 48%);
}

.fab:active,
.btn:active,
.icon-btn:active,
.tab:active { transform: scale(0.98); }

.btn:focus-visible,
.tab:focus-visible,
.icon-btn:focus-visible,
.input:focus-visible,
.select:focus-visible,
textarea:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--brand) 68%, #fff 32%);
  outline-offset: 2px;
}

.drawer {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 70;
  display: grid;
  align-items: end;
}

.drawer-sheet {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  margin: 0;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
}

.segment { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 14px; }
.seg-btn { min-height: 40px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text-secondary); }
.seg-btn.active { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }
.drawer-actions { display: grid; gap: 8px; margin-bottom: 14px; }

.status-banner {
  margin: 8px 16px 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--danger) 38%, var(--border));
  background: color-mix(in srgb, var(--danger) 14%, var(--surface));
  color: color-mix(in srgb, var(--danger) 72%, var(--text-primary));
  font-size: 13px;
}

.status-banner.info {
  border-color: color-mix(in srgb, var(--brand) 40%, var(--border));
  background: color-mix(in srgb, var(--brand) 13%, var(--surface));
  color: var(--text-primary);
}

.hidden { display: none !important; }

.kpi-chips { display: flex; gap: 8px; overflow: auto; padding-bottom: 4px; }
.kpi-chip {
  min-width: 108px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-elevated);
  padding: 8px;
}
.kpi-chip p { margin: 0; }
.kpi-chip .value { font-weight: 700; font-size: 16px; }

.home-hero {
  background: linear-gradient(160deg, color-mix(in srgb, var(--brand) 12%, var(--surface)) 0%, var(--surface) 100%);
}

.home-hero .helper {
  margin-top: 8px;
}

.home-hero-footer {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.home-hero-footer .muted {
  margin: 0;
}

.home-score-card {
  background: linear-gradient(180deg, var(--surface) 0%, color-mix(in srgb, var(--surface-elevated) 88%, #fff 12%) 100%);
}

.home-score-wrap {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-top: 4px;
}

.home-score-value {
  margin: 0;
  font-size: 44px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.home-kpi-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.home-kpi-item {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-elevated);
  padding: 10px;
}

.home-kpi-item p {
  margin: 0;
}

.home-kpi-item .value {
  font-weight: 700;
  font-size: 17px;
  margin: 2px 0 6px;
}

.home-actions-row {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.home-pending {
  border: 1px dashed color-mix(in srgb, var(--brand) 30%, var(--border));
  background: color-mix(in srgb, var(--brand) 8%, var(--surface));
}

.quick-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.quick-btn { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); min-height: 52px; font-size: 12px; color: var(--text-primary); }

.tabs-inline { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-bottom: 10px; overflow: auto; }
.tabs-inline button {
  border: 1px solid var(--border);
  background: var(--surface);
  min-height: 36px;
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: 12px;
  padding: 0 8px;
}
.tabs-inline button.active { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }

.chart {
  height: 120px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--success) 8%, transparent) 28%, transparent 28%, transparent 62%, color-mix(in srgb, var(--warning) 6%, transparent) 62%),
    repeating-linear-gradient(90deg, transparent 0 30px, color-mix(in srgb, var(--border) 80%, transparent) 30px 31px);
  position: relative;
  overflow: hidden;
}
.chart::after {
  content: "";
  position: absolute;
  inset: 30% 8px auto;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--brand), var(--accent), transparent);
}

.timeline-item { padding: 10px 0; border-bottom: 1px dashed var(--border); }
.timeline-item:last-child { border-bottom: none; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: var(--overlay);
  display: grid;
  align-items: end;
  animation: modalFade 220ms ease;
}
.modal-sheet {
  margin: 0;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
  animation: modalLift 220ms ease;
}

@keyframes modalFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalLift {
  from { transform: translateY(16px); opacity: 0.7; }
  to { transform: translateY(0); opacity: 1; }
}

.notice {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  background: var(--surface-elevated);
  font-size: 13px;
}

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat { border: 1px solid var(--border); border-radius: 14px; padding: 10px; background: var(--surface-elevated); }
.stat h4 { margin: 0 0 4px; font-size: 11px; color: var(--text-secondary); }
.stat p {
  margin: 0;
  font-size: clamp(12px, 2.8vw, 16px);
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.stat-inventory .stat-value-main {
  font-size: clamp(12px, 2.7vw, 15px);
}

.stat-inventory .stat-value-unit {
  font-size: clamp(10px, 2.1vw, 12px);
  color: var(--text-secondary);
}

.install-card {
  border: 1px dashed color-mix(in srgb, var(--brand) 35%, var(--border));
  border-radius: 14px;
  background: color-mix(in srgb, var(--brand) 8%, var(--surface));
  padding: 14px;
}

.hero-card {
  background: linear-gradient(145deg, color-mix(in srgb, var(--brand) 16%, var(--surface)) 0%, var(--surface) 100%);
}

.module-grid {
  display: grid;
  gap: 10px;
}

.module-link {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-elevated);
  padding: 12px;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.module-link strong {
  display: block;
  font-size: 15px;
  margin-bottom: 2px;
}

.auth-card {
  width: 100%;
  margin: 0 auto;
  padding: 0;
  min-height: 100vh;
  border-radius: 0;
  background: var(--surface);
  overflow: hidden;
  box-shadow: none;
}

.auth-title {
  margin: 2px 0 0;
  font-size: 30px;
  line-height: 1.08;
  letter-spacing: -0.015em;
}

.auth-main {
  display: grid;
  align-items: stretch;
  justify-items: center;
  min-height: 100vh;
  padding: 0 !important;
}

.auth-shell {
  background: linear-gradient(180deg, #eef2f8 0%, #f7f9fd 100%);
}

.auth-cap {
  min-height: 198px;
  padding: 22px 24px 14px;
  background: linear-gradient(160deg, #0b2f72 0%, #082452 100%);
  border-bottom-left-radius: 62% 22%;
  border-bottom-right-radius: 38% 16%;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 10px;
}

.auth-logo {
  width: 58px;
  height: 58px;
  object-fit: contain;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.94);
  padding: 8px;
  box-shadow: 0 8px 20px rgba(3, 14, 34, 0.28);
}

.auth-cap-title {
  margin: 0;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.92;
}

.auth-body {
  width: min(100%, 420px);
  margin: 0 auto;
  padding: 18px 22px 28px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafd 100%);
}

.auth-topbar {
  border-bottom: 1px solid transparent;
  justify-content: center;
  padding-top: 10px;
  padding-bottom: 8px;
}

.auth-topbar-note {
  margin: 0 0 2px;
  font-size: 11px;
  color: var(--text-secondary);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.auth-topbar .brand-title {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 600;
}

.auth-error {
  border: 1px solid color-mix(in srgb, var(--danger) 34%, var(--border));
  background: color-mix(in srgb, var(--danger) 12%, var(--surface));
  color: color-mix(in srgb, var(--danger) 72%, var(--text-primary));
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 13px;
  margin: 0;
}

.auth-role {
  display: inline-flex;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--brand) 36%, var(--border));
  background: var(--brand-soft);
  color: var(--brand);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
}

.auth-demo {
  border: 1px dashed color-mix(in srgb, var(--brand) 35%, var(--border));
  border-radius: 12px;
  background: color-mix(in srgb, var(--brand) 8%, var(--surface));
  padding: 10px;
  font-size: 12px;
  color: var(--text-secondary);
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
  padding: 3px;
  border: 1px solid #d8e1ef;
  border-radius: 12px;
  background: #f3f6fb;
}

.auth-tab-btn {
  border: 1px solid transparent;
  border-radius: 8px;
  min-height: 34px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
}

.auth-tab-btn.active {
  color: var(--brand);
  border-color: #bfd0ea;
  background: #ffffff;
}

.auth-card .input,
.auth-card .select {
  min-height: 42px;
  border: none;
  border-bottom: 1px solid #c8d5ea;
  border-radius: 0;
  background: transparent;
  padding: 10px 2px 8px;
  box-shadow: none;
}

#productForm.editing {
  border: 1px solid color-mix(in srgb, var(--brand) 28%, var(--border));
  border-radius: 12px;
  padding: 10px;
  background: color-mix(in srgb, var(--brand) 6%, var(--surface));
}

.auth-card .label {
  font-size: 11px;
  letter-spacing: 0.02em;
  margin-bottom: 2px;
}

.auth-card .select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #5f7394 50%),
    linear-gradient(135deg, #5f7394 50%, transparent 50%);
  background-position:
    calc(100% - 14px) calc(50% + 1px),
    calc(100% - 9px) calc(50% + 1px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 24px;
}

.auth-card .input::placeholder,
.auth-card .select {
  color: #7a8ea9;
}

.auth-card .input:focus,
.auth-card .select:focus {
  border-bottom-color: #0b2f72;
  outline: none;
}

.auth-card .muted,
.auth-card .helper {
  font-size: 12px;
}

.auth-card .btn.primary {
  min-height: 42px;
  border-radius: 12px;
  background: linear-gradient(180deg, #0b2f72 0%, #082452 100%);
  font-weight: 700;
  letter-spacing: 0.01em;
}

.theme-dark .client-shell .bottom-nav .tab.active {
  background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 28%, var(--surface) 72%) 0%, color-mix(in srgb, var(--brand) 18%, var(--surface) 82%) 100%);
  border-color: color-mix(in srgb, var(--brand) 42%, var(--border));
  box-shadow: 0 6px 14px rgba(2, 10, 22, 0.35);
}

.theme-dark .auth-shell {
  background: linear-gradient(180deg, #0b121c 0%, #0a0f18 100%);
}

.theme-dark .auth-card {
  background: var(--surface);
}

.theme-dark .auth-cap {
  background: linear-gradient(160deg, color-mix(in srgb, var(--brand) 56%, #07101f 44%) 0%, #07101f 100%);
}

.theme-dark .auth-body {
  background: linear-gradient(180deg, var(--surface) 0%, color-mix(in srgb, var(--surface-elevated) 70%, var(--surface) 30%) 100%);
}

.theme-dark .auth-tabs {
  border-color: var(--border);
  background: color-mix(in srgb, var(--surface-elevated) 85%, var(--surface) 15%);
}

.theme-dark .auth-tab-btn.active {
  border-color: color-mix(in srgb, var(--brand) 40%, var(--border));
  background: var(--surface-elevated);
}

.theme-dark .auth-card .input,
.theme-dark .auth-card .select {
  border-bottom-color: var(--border);
  color: var(--text-primary);
}

.theme-dark .auth-card .input::placeholder,
.theme-dark .auth-card .select {
  color: var(--text-secondary);
}

.theme-dark .auth-link-btn {
  color: var(--brand);
}

.auth-message {
  border: 1px solid color-mix(in srgb, var(--success) 34%, var(--border));
  background: color-mix(in srgb, var(--success) 10%, var(--surface));
  color: color-mix(in srgb, var(--success) 72%, var(--text-primary));
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 13px;
  margin: 0;
}

.auth-legal {
  margin: 10px 2px 0;
  font-size: 10px;
  color: var(--text-secondary);
  line-height: 1.4;
  text-align: center;
}

.auth-links {
  margin-top: 4px;
  display: flex;
  justify-content: flex-end;
}

.auth-switch {
  margin: 14px 0 2px;
  font-size: 11px;
  color: var(--text-secondary);
  text-align: center;
}

.auth-link-btn {
  border: none;
  background: transparent;
  color: var(--brand);
  font-size: inherit;
  font-weight: 600;
  padding: 0;
}

@media (min-width: 834px) {
  .main { padding: 0; }
  .topbar { padding-left: 24px; padding-right: 24px; }
  .grid-2.tablet { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .quick-actions { grid-template-columns: repeat(6, 1fr); }
  .module-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .auth-cap {
    min-height: 236px;
  }
  .auth-body {
    padding-top: 26px;
  }
}

.admin-shell {
  display: block;
}

.admin-main {
  padding-top: 0;
}

.admin-shell .topbar #adminSidebarBtn {
  display: inline-grid;
  place-items: center;
}

.admin-shell .topbar #adminSidebarBtn svg {
  width: 19px;
  height: 19px;
}

.admin-shell .sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 18, 36, 0.34);
  backdrop-filter: blur(2px);
  z-index: 72;
}

.admin-quick-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: min(84vw, 320px);
  height: 100vh;
  background: linear-gradient(180deg, #ffffff 0%, #f5f8fd 100%);
  border-right: 1px solid color-mix(in srgb, var(--brand) 18%, var(--border));
  box-shadow: 12px 0 28px rgba(10, 22, 44, 0.18);
  padding: calc(14px + env(safe-area-inset-top)) 14px 16px;
  z-index: 73;
}

.admin-quick-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.admin-shell .bottom-nav {
  left: 14px;
  right: 14px;
  bottom: calc(8px + env(safe-area-inset-bottom));
  max-width: calc(1440px - 28px);
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid color-mix(in srgb, var(--brand) 16%, var(--border));
  border-radius: 22px;
  background: color-mix(in srgb, var(--surface) 84%, rgba(255, 255, 255, 0.75));
  backdrop-filter: blur(14px);
  box-shadow: 0 14px 30px rgba(10, 22, 44, 0.16);
  padding: 8px 10px;
  gap: 8px;
}

.admin-shell .bottom-nav .tab {
  display: grid;
  place-items: center;
  gap: 4px;
  min-height: 52px;
  border-radius: 14px;
  font-size: 11.5px;
  letter-spacing: 0.01em;
  text-align: center;
}

.admin-shell .bottom-nav .tab .tab-icon {
  width: 20px;
  height: 20px;
}

.admin-shell .bottom-nav .tab .tab-icon svg {
  width: 100%;
  height: 100%;
}

.admin-shell .bottom-nav .tab-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.admin-chart-card {
  margin-top: 10px;
}

.admin-chart-wrap {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.admin-bar-item {
  display: grid;
  gap: 6px;
  justify-items: center;
}

.admin-bar-value {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.admin-bar-track {
  width: 100%;
  height: 120px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-alt) 72%, transparent);
  border: 1px solid var(--border);
  display: flex;
  align-items: end;
  overflow: hidden;
}

.admin-bar-fill {
  width: 100%;
  min-height: 10%;
  border-radius: 10px 10px 0 0;
}

.admin-bar-label {
  margin: 0;
  text-align: center;
  font-size: 11px;
  color: var(--text-secondary);
}

.admin-product-media {
  margin-top: 8px;
}

.admin-product-media img {
  width: 100%;
  max-height: 170px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--border);
}

.client-store-item {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
}

.client-store-item:last-child {
  border-bottom: none;
}

.client-store-image {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--border);
}

@media (min-width: 1024px) {
  .admin-main {
    padding-left: 24px;
    padding-right: 24px;
  }
}

@media (min-width: 1440px) {
  .app { display: grid; grid-template-columns: 300px 1fr; }
  .topbar { grid-column: 1 / span 2; }
  .bottom-nav { left: 300px; max-width: calc(1440px - 300px); }
  .main { padding: 20px 32px calc(112px + var(--safe-bottom)); }
}

@media (hover: hover) and (pointer: fine) {
  .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 26px rgba(12, 26, 46, 0.12);
  }

  .btn:hover,
  .module-link:hover {
    filter: brightness(1.02);
    border-color: color-mix(in srgb, var(--brand) 34%, var(--border));
  }

  .module-link:hover {
    transform: translateY(-2px);
  }
}
