:root {
  color-scheme: light;
  --bg: #eef2f7;
  --bg-2: #e9eef5;
  --panel: #ffffff;
  --panel-border: #d8e0ea;
  --text: #1e293b;
  --muted: #68778c;
  --accent: #2563eb;
  --accent-2: #ea580c;
  --success: #15803d;
  --danger: #dc2626;
  --warning: #b45309;
  --surface-soft: #f7f9fc;
  --surface-muted: #eef2f7;
  --border-soft: #e2e8f0;
  --border-strong: #cbd5e1;
  --focus-ring: rgba(37, 99, 235, 0.18);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 12px 32px rgba(15, 23, 42, 0.12);
  --shadow: var(--shadow-sm);
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --control-height: 38px;
  --control-height-mobile: 44px;
  --dialog-surface: #ffffff;
  --dialog-border: #d8e0ea;
  --dialog-radius: 16px;
  --dialog-shadow: 0 24px 64px rgba(15, 23, 42, 0.2);
  --dialog-backdrop: rgba(15, 23, 42, 0.38);
  --dialog-space: 16px;
  --dialog-head-height: 58px;
  --table-header-bg: #f4f7fa;
  --table-header-text: #5d6d82;
  --table-border: #e3e9f0;
  --table-row-hover: #f5f9ff;
  --table-row-focus: #edf5ff;
  --state-empty-bg: #f8fafc;
  --state-empty-border: #cfd9e6;
  --state-error-bg: #fff4f2;
  --state-error-border: #f1b8b1;
  --state-error-text: #a42b22;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --font: "Segoe UI", "Trebuchet MS", "Arial", sans-serif;
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: rgba(102, 112, 133, 0.18) transparent;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background-color: rgba(102, 112, 133, 0.18);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}

*::-webkit-scrollbar-thumb:hover {
  background-color: rgba(102, 112, 133, 0.28);
}

input[type="search"] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  border-radius: 0;
  padding: 0;
  margin: 0;
  box-shadow: none;
}

input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
  -webkit-appearance: none;
  display: none;
}

input[type="search"]:focus {
  outline: none;
  box-shadow: none;
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  color: var(--text);
}

body {
  padding: 0;
  overflow: hidden;
}

body:not(.app-authenticated) .shell {
  visibility: hidden;
  opacity: 0;
}

body:not(.app-authenticated):not(.auth-required)::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9998;
  background:
    radial-gradient(circle at 50% 42%, rgba(37, 99, 235, 0.10), transparent 30%),
    linear-gradient(180deg, rgba(244, 247, 252, 0.80), rgba(248, 250, 252, 0.92));
  backdrop-filter: blur(1px);
}

.app-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.app-loading-card {
  width: min(320px, 100%);
  padding: 14px 16px 12px;
  border: 1px solid rgba(207, 215, 227, 0.35);
  border-radius: 20px;
  background: transparent;
  box-shadow: none;
}

.app-loading-logo-wrap {
  width: 120px;
  height: 120px;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 28px;
  background: transparent;
}

.app-loading-logo {
  width: 96px;
  height: 96px;
  object-fit: contain;
  filter: drop-shadow(0 10px 18px rgba(15, 23, 42, 0.12));
}

.app-loading-copy {
  display: grid;
  justify-items: center;
  gap: 4px;
  text-align: center;
}

.app-loading-copy strong {
  font-size: 1rem;
  line-height: 1.1;
  font-weight: 800;
}

.app-loading-copy span {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.app-loading-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(37, 99, 235, 0.16);
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: crmLoadingSpin 0.8s linear infinite;
}

@keyframes crmLoadingSpin {
  to { transform: rotate(360deg); }
}

@keyframes crmLoadingPulse {
  0%, 100% { opacity: 0.78; transform: scale(0.97); }
  50% { opacity: 1; transform: scale(1); }
}

@keyframes section-loading-shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

body.orders-drawer-open {
  overflow: hidden;
}

.backdrop {
  display: none;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.muted,
.timeline-item p,
.brand-subtitle {
  color: var(--muted);
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  min-width: 88px;
  padding: 0 11px;
  border-radius: 4px;
  background: #eef2f7;
  color: var(--text);
  font-size: 0.82rem;
  white-space: nowrap;
}


.button {
  border: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 11px 16px;
  font: inherit;
  cursor: pointer;
  background-clip: padding-box;
}

.button-ghost {
  background: #eef2f7;
  color: var(--text);
}

.button-primary {
  background: var(--accent);
  color: #fff;
}

.button-success {
  background: #16a34a;
  color: #fff;
}

.button-danger {
  background: #dc2626;
  color: #fff;
}

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.chip-warning {
  background: #fff4e5;
  color: #9a3412;
}

@media (max-width: 720px) {
  body {
    padding: 8px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  .panel {
    border-radius: 6px;
  }

  .button {
    min-height: 44px;
    padding: 12px 14px;
  }

  input,
  select,
  textarea {
    min-height: 44px;
    font-size: 16px;
  }
}


