:root {
  color-scheme: light;
  --bg: #f4f7f5;
  --surface: #ffffff;
  --ink: #132521;
  --muted: #6d7c78;
  --line: #e2e9e6;
  --green: #0b9f76;
  --green-dark: #087357;
  --green-soft: #e8f7f1;
  --nav: #102b27;
  --shadow: 0 18px 55px rgba(16, 52, 44, .07);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; color: var(--ink); background: var(--bg); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }

.is-loading .app-shell { visibility: hidden; }
.loading-screen { position: fixed; inset: 0; z-index: 100; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--muted); font-size: 13px; }
body:not(.is-loading) .loading-screen { display: none; }
.loader-mark, .brand-mark { display: grid; place-items: center; color: #fff; background: linear-gradient(145deg, #11b98a, #087357); box-shadow: 0 10px 25px rgba(8, 128, 94, .25); font-weight: 850; }
.loader-mark { width: 50px; height: 50px; border-radius: 16px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: translateY(-4px); } }

.app-shell { display: grid; grid-template-columns: 238px 1fr; min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; display: flex; width: 238px; flex-direction: column; justify-content: space-between; padding: 28px 20px 22px; color: #dce8e4; background: var(--nav); }
.brand { display: inline-flex; align-items: center; gap: 11px; font-size: 20px; font-weight: 820; letter-spacing: -.5px; }
.brand-mark { width: 34px; height: 34px; border-radius: 11px; font-size: 14px; }
.workspace-label { margin: 30px 10px 12px; color: #6f9188; font-size: 9px; font-weight: 850; letter-spacing: 1.4px; }
.side-nav { display: grid; gap: 5px; }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 11px; color: #9fb7b0; font-size: 11px; font-weight: 680; transition: 160ms ease; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.055); }
.nav-item.is-active { color: #fff; background: rgba(27, 191, 143, .13); box-shadow: inset 3px 0 #1bc18f; }
.nav-icon { display: grid; width: 20px; place-items: center; color: #6fae9b; font-size: 16px; }
.sidebar-footer { display: grid; gap: 15px; }
.sidebar-footer a { color: #a8c0b9; font-size: 10px; font-weight: 700; }
.sidebar-footer p { margin: 0; color: #6f9188; font-size: 8px; }
.sidebar-footer p span { display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: #28c996; box-shadow: 0 0 0 4px rgba(40,201,150,.08); }

.main-column { grid-column: 2; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; height: 70px; align-items: center; justify-content: space-between; padding: 0 34px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.93); backdrop-filter: blur(16px); }
.breadcrumb { display: flex; align-items: center; gap: 9px; color: #8a9995; font-size: 10px; }
.breadcrumb span::after { content: '/'; margin-left: 9px; color: #c1cbc8; }
.breadcrumb strong { color: var(--ink); }
.topbar-actions { display: flex; align-items: center; gap: 11px; }
.avatar { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 11px; color: #087158; background: var(--green-soft); font-size: 10px; font-weight: 850; }
.user-copy { display: grid; min-width: 100px; }
.user-copy strong { overflow: hidden; max-width: 155px; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.user-copy small { margin-top: 2px; color: var(--muted); font-size: 8px; }
.ghost-button, .text-button, .filter-button, .icon-button, .link-button { border: 0; cursor: pointer; }
.ghost-button { padding: 9px 12px; border: 1px solid #d7e3df; border-radius: 10px; color: #31544c; background: #fff; font-size: 9px; font-weight: 760; }
.text-button { color: #687a75; background: transparent; font-size: 9px; font-weight: 700; }
.menu-button { display: none; width: 36px; height: 36px; place-items: center; border-radius: 10px; color: var(--ink); background: #f2f6f4; }

main { max-width: 1480px; margin: 0 auto; padding: 42px 38px 60px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.eyebrow { margin: 0 0 8px; color: #79a398; font-size: 8px; font-weight: 850; letter-spacing: 1.35px; }
.page-heading h1 { margin: 0; font-size: clamp(27px, 3vw, 38px); letter-spacing: -1.3px; }
.page-heading > div > p:last-child { margin: 8px 0 0; color: var(--muted); font-size: 11px; }
.filters { display: flex; gap: 8px; }
.filter-button { display: flex; min-width: 142px; align-items: center; justify-content: space-between; gap: 18px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 11px; color: #38564f; background: #fff; font-size: 9px; font-weight: 700; }
.filter-button small { color: #8ca09a; }
.filter-select select { min-width: 0; flex: 1; border: 0; outline: 0; color: inherit; background: transparent; font: inherit; appearance: none; cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-top: 28px; }
.kpi-card { min-height: 142px; padding: 20px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); box-shadow: var(--shadow); }
.kpi-card--primary { color: #fff; border-color: transparent; background: linear-gradient(135deg, #0d8f6d, #0b684f); box-shadow: 0 18px 48px rgba(10,116,86,.18); }
.kpi-head { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 9px; font-weight: 760; }
.kpi-card--primary .kpi-head { color: #c7ede2; }
.kpi-icon { display: grid; width: 29px; height: 29px; place-items: center; border-radius: 9px; color: #258d70; background: var(--green-soft); font-size: 13px; }
.kpi-card--primary .kpi-icon { color: #fff; background: rgba(255,255,255,.13); }
.kpi-card > strong { display: block; margin-top: 16px; font-size: clamp(21px, 2.4vw, 30px); letter-spacing: -.8px; }
.kpi-card > p { margin: 8px 0 0; color: #87948f; font-size: 8px; }
.kpi-card--primary > p { color: #b9ded4; }

.content-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(275px, .78fr); gap: 14px; margin-top: 14px; }
.panel { border: 1px solid var(--line); border-radius: 17px; background: var(--surface); box-shadow: var(--shadow); }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 20px 21px; border-bottom: 1px solid #edf1ef; }
.panel-heading h2 { margin: 0; font-size: 14px; letter-spacing: -.2px; }
.panel-heading .eyebrow { margin-bottom: 5px; }
.legend { display: flex; gap: 14px; color: #7f8f8a; font-size: 8px; }
.legend span { display: flex; align-items: center; gap: 5px; }
.legend i { width: 7px; height: 7px; border-radius: 50%; background: #0ca477; }
.legend span:last-child i { background: #9fd8c7; }
.chart-empty { position: relative; height: 292px; overflow: hidden; padding: 24px 22px 0; }
.chart-empty svg { position: absolute; right: 20px; bottom: 18px; left: 20px; width: calc(100% - 40px); height: 210px; opacity: .47; }
.chart-empty .area { fill: url(#none); fill: rgba(14,161,117,.08); }
.chart-empty .line { fill: none; stroke: #4eb99b; stroke-width: 2; stroke-dasharray: 6 6; }
.chart-grid { position: absolute; inset: 34px 22px 34px; display: flex; flex-direction: column; justify-content: space-between; }
.chart-grid i { width: 100%; border-top: 1px dashed #e5ece9; }
.empty-copy { position: relative; z-index: 2; display: grid; width: fit-content; gap: 5px; margin: 82px auto 0; padding: 13px 17px; border: 1px solid #dfebe7; border-radius: 12px; text-align: center; background: rgba(255,255,255,.92); box-shadow: 0 10px 30px rgba(19,62,51,.07); }
.empty-copy strong { font-size: 10px; }
.empty-copy span { color: var(--muted); font-size: 8px; }

.sync-panel { padding-bottom: 20px; text-align: center; }
.sync-panel .panel-heading { text-align: left; }
.status-badge { padding: 6px 8px; border-radius: 8px; color: #916b2a; background: #fff2da; font-size: 8px; font-weight: 750; }
.sync-visual { display: flex; align-items: center; justify-content: center; margin: 30px 24px 22px; }
.sync-visual > span { display: grid; min-width: 58px; height: 50px; place-items: center; border: 1px solid #dce9e4; border-radius: 14px; color: #0a8565; background: #f6fbf9; font-size: 11px; font-weight: 850; }
.sync-visual i { width: 62px; border-top: 1px dashed #a8cfc3; }
.sync-visual .shopify-mark { min-width: 50px; color: #6c9b2f; font-size: 16px; }
.sync-panel h3 { margin: 0; font-size: 13px; }
.sync-panel > p { max-width: 230px; margin: 8px auto 18px; color: var(--muted); font-size: 9px; line-height: 1.6; }
.primary-button { display: flex; width: calc(100% - 40px); min-height: 40px; align-items: center; justify-content: center; gap: 9px; margin: 0 20px; border-radius: 11px; color: #fff; background: var(--green); font-size: 9px; font-weight: 780; }

.lower-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }
.link-button { padding: 0; color: #0a8e6b; background: transparent; font-size: 8px; font-weight: 780; }
.table-empty { display: grid; min-height: 190px; place-content: center; justify-items: center; color: var(--muted); text-align: center; }
.table-empty > span { display: grid; width: 38px; height: 38px; place-items: center; margin-bottom: 10px; border-radius: 12px; color: #2a9b7b; background: var(--green-soft); font-size: 16px; }
.table-empty strong { color: #425b54; font-size: 10px; }
.table-empty p { margin: 5px 0 0; font-size: 8px; }

.access-error { position: fixed; inset: 0; z-index: 120; display: grid; place-content: center; justify-items: center; padding: 28px; text-align: center; background: var(--bg); }
.access-error[hidden] { display: none; }
.access-error .brand-mark { width: 48px; height: 48px; border-radius: 15px; }
.access-error h1 { margin: 20px 0 7px; font-size: 24px; }
.access-error p { margin: 0; color: var(--muted); font-size: 11px; }
.access-error a { margin-top: 20px; padding: 11px 16px; border-radius: 10px; color: #fff; background: var(--green); font-size: 9px; font-weight: 750; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 80; max-width: min(390px, calc(100vw - 32px)); padding: 13px 16px; border-radius: 12px; color: #fff; background: #15342e; box-shadow: 0 18px 45px rgba(6,31,29,.24); opacity: 0; transform: translateY(12px); pointer-events: none; transition: 180ms ease; font-size: 10px; }
.toast.is-visible { opacity: 1; transform: translateY(0); }

@media (max-width: 1120px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content-grid { grid-template-columns: 1fr; }
  .sync-panel { max-width: none; }
}
@media (max-width: 820px) {
  .app-shell { display: block; }
  .main-column { min-width: 0; }
  .sidebar { transform: translateX(-100%); box-shadow: 25px 0 70px rgba(6,29,28,.24); transition: transform 190ms ease; }
  .sidebar.is-open { transform: translateX(0); }
  .menu-button { display: grid; }
  .breadcrumb, .ghost-button { display: none; }
  .topbar { padding: 0 18px; }
  main { padding: 30px 18px 48px; }
  .lower-grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .page-heading { align-items: flex-start; flex-direction: column; }
  .filters { width: 100%; }
  .filter-button { flex: 1; min-width: 0; }
  .kpi-grid { grid-template-columns: 1fr; }
  .user-copy, .topbar .text-button { display: none; }
  .legend { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
