:root {
  color-scheme: light;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --sidebar-top: #082a56;
  --sidebar-bottom: #0b356e;
  --navy: var(--sidebar-top);
  --navy-2: var(--sidebar-bottom);
  --blue: var(--primary);
  --green: #15966b;
  --green-dark: #0b7555;
  --green-soft: #e8f7f1;
  --amber: #b96b07;
  --amber-soft: #fff3d9;
  --red: #d94655;
  --red-soft: #fff0f2;
  --ink: #12213b;
  --muted: #66758e;
  --line: #dce5f1;
  --surface: #fff;
  --canvas: #f3f7fc;
  --shadow: 0 14px 38px rgba(31, 62, 104, .08);
  font-family: "Roboto", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100vh; color: var(--ink); background: var(--canvas); font-family: "Roboto", Arial, sans-serif; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid rgba(37,99,235,.23); outline-offset: 2px; }
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); background: var(--canvas); font-size: 13px; }
body:not(.is-loading) .loading-screen { display: none; }
.loader-mark { width: 58px; height: 58px; display: grid; place-items: center; animation: pulse 1.2s ease-in-out infinite; }
.loader-mark img { width: 100%; height: 100%; object-fit: contain; }
@keyframes pulse { 50% { transform: translateY(-4px); } }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; width: 252px; padding: 22px 16px; display: flex; flex-direction: column; justify-content: space-between; color: #fff; background: radial-gradient(circle at 20% 8%, rgba(65,142,255,.27), transparent 28%), linear-gradient(180deg, var(--navy), var(--navy-2)); box-shadow: 12px 0 36px rgba(12,42,78,.08); transition: transform .22s ease; }
.brand { height: 80px; padding: 0 8px 21px; display: flex; align-items: center; border-bottom: 1px solid rgba(255,255,255,.13); }
.brand img { width: 100%; height: 58px; object-fit: contain; object-position: left center; }
.workspace-label { margin: 24px 12px 8px; color: #91afd6; font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.side-nav { display: grid; gap: 5px; }
.nav-item { min-height: 45px; padding: 10px 12px; display: flex; align-items: center; gap: 11px; border-radius: 11px; color: #d7e8ff; font-size: 13px; font-weight: 650; transition: .16s ease; }
.nav-item:hover { background: rgba(255,255,255,.08); }
.nav-item.is-active { color: #fff; background: linear-gradient(90deg, #1d4ed8, #2563eb); box-shadow: 0 8px 18px rgba(5,26,55,.2); }
.nav-item.is-disabled { opacity: .5; cursor: default; }
.nav-item small { margin-left: auto; font-size: 8px; }
.nav-icon { width: 24px; height: 24px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid rgba(255,255,255,.22); border-radius: 7px; font-size: 13px; }
.sidebar-footer { display: grid; gap: 16px; padding: 14px; border: 1px solid rgba(255,255,255,.13); border-radius: 14px; background: rgba(255,255,255,.06); }
.sidebar-footer a { font-size: 11px; font-weight: 700; }
.sidebar-footer p { margin: 0; color: #a9c6ec; font-size: 9px; line-height: 1.5; }
.sidebar-footer p span, .status-dot { display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: #54e2a4; box-shadow: 0 0 0 5px rgba(84,226,164,.14); }

.main-column { margin-left: 252px; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 30; height: 76px; padding: 0 30px; display: flex; align-items: center; border-bottom: 1px solid rgba(220,229,241,.92); background: rgba(255,255,255,.92); backdrop-filter: blur(16px); }
.breadcrumb { display: flex; gap: 9px; color: #8b99ad; font-size: 11px; }
.breadcrumb span::after { content: '/'; margin-left: 9px; color: #bcc7d6; }
.breadcrumb strong { color: var(--ink); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.avatar { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; color: #fff; background: linear-gradient(135deg, var(--navy), #3475d4); font-size: 12px; font-weight: 800; }
.user-copy { min-width: 130px; }
.user-copy strong, .user-copy small { display: block; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-copy strong { font-size: 12px; }
.user-copy small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.text-button { border: 0; color: var(--blue); background: transparent; font-size: 10px; font-weight: 800; cursor: pointer; }
.icon-button { display: none; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: #fff; cursor: pointer; }

main { width: min(1500px, 100%); margin: 0 auto; padding: 30px 30px 64px; }
.hero { min-height: 190px; padding: 34px 38px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-radius: 24px; color: #fff; background: radial-gradient(circle at 92% 100%, rgba(255,255,255,.13), transparent 29%), linear-gradient(120deg, #11366c, #266be0); box-shadow: 0 18px 48px rgba(28,74,150,.18); }
.eyebrow { margin: 0 0 8px; color: #8cc9ff; font-size: 10px; font-weight: 850; letter-spacing: .14em; }
.hero h1 { margin: 0; font-size: clamp(30px, 4vw, 45px); letter-spacing: -1.5px; }
.hero > div > p:last-child { max-width: 760px; margin: 12px 0 0; color: #d9e8ff; font-size: 13px; line-height: 1.7; }
.hero-status { min-width: 220px; padding: 20px; border: 1px solid rgba(255,255,255,.22); border-radius: 16px; background: rgba(255,255,255,.1); }
.hero-status strong, .hero-status small { display: block; }
.hero-status strong { margin-bottom: 7px; font-size: 12px; }
.hero-status small { padding-left: 20px; color: #dbe9ff; font-size: 9px; }

.kpi-grid { margin-top: 16px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi-card { min-height: 126px; padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.kpi-card span { color: var(--muted); font-size: 10px; font-weight: 700; }
.kpi-card strong { display: block; margin: 16px 0 7px; font-size: 28px; }
.kpi-card small { color: #8594a9; font-size: 9px; }

.content-grid { margin-top: 16px; display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(320px, .8fr); gap: 14px; }
.panel { border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.panel-heading { padding: 22px 24px; display: flex; justify-content: space-between; gap: 18px; border-bottom: 1px solid #edf1f6; }
.panel-heading h2 { margin: 0; font-size: 18px; letter-spacing: -.3px; }
.panel-heading p:last-child { margin: 7px 0 0; color: var(--muted); font-size: 10px; line-height: 1.6; }
.step-badge { height: fit-content; padding: 7px 9px; border-radius: 9px; color: #8b6119; background: var(--amber-soft); font-size: 9px; font-weight: 800; }
.connect-form { padding: 22px 24px 10px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; gap: 12px; }
.connect-form label { display: grid; gap: 7px; color: #31435f; font-size: 10px; font-weight: 750; }
.connect-form input { width: 100%; height: 44px; padding: 0 13px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: #f9fbfe; }
.connect-form label small { color: var(--muted); font-size: 8px; font-weight: 450; }
.primary-button { min-height: 44px; padding: 0 17px; grid-column: 1 / -1; border: 0; border-radius: 11px; color: #fff; background: linear-gradient(135deg, var(--green), var(--green-dark)); box-shadow: 0 10px 24px rgba(21,150,107,.2); font-size: 10px; font-weight: 800; cursor: pointer; }
.primary-button:disabled { opacity: .6; cursor: wait; }
.scope-box { margin: 12px 24px 24px; padding: 16px; border: 1px solid #dceae5; border-radius: 13px; background: #f8fcfa; }
.scope-box > div { display: flex; justify-content: space-between; gap: 16px; font-size: 10px; }
.scope-box > div span { color: var(--green-dark); font-size: 9px; }
.scope-box ul { margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; list-style: none; }
.scope-box li { display: flex; color: #52665f; font-size: 9px; }
.scope-box li::before { content: '✓'; margin-right: 7px; color: var(--green); font-family: Arial, sans-serif; font-weight: 900; }
.scope-box li strong, .scope-box li code { display: block; }
.scope-box li strong { color: #314a41; font-size: 9px; }
.scope-box li code { margin-top: 3px; color: #698078; font-size: 8px; }

.steps { margin: 0; padding: 21px 24px 24px; display: grid; gap: 18px; list-style: none; }
.steps li { display: flex; gap: 13px; }
.steps li > span { width: 30px; height: 30px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 10px; color: var(--blue); background: #eaf1ff; font-size: 10px; font-weight: 850; }
.steps strong { font-size: 11px; }
.steps p { margin: 5px 0 0; color: var(--muted); font-size: 9px; line-height: 1.5; }

.stores-panel { margin-top: 16px; }
.ghost-button { height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; color: #435772; background: #fff; font-size: 9px; font-weight: 750; cursor: pointer; }
.table-wrap { position: relative; min-height: 260px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 13px 22px; color: #7c8ba0; background: #f8fafd; text-align: left; font-size: 9px; letter-spacing: .04em; }
td { padding: 16px 22px; border-top: 1px solid #edf1f6; color: #4a5d77; font-size: 10px; }
.store-cell strong, .store-cell small { display: block; }
.store-cell strong { color: var(--ink); font-size: 11px; }
.store-cell small { margin-top: 4px; color: var(--muted); }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 999px; font-size: 8px; font-weight: 800; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; }
.badge.is-ok { color: #087357; background: var(--green-soft); }
.badge.is-ok::before { background: #20bc85; }
.badge.is-error { color: #a83240; background: var(--red-soft); }
.badge.is-error::before { background: var(--red); }
.scope-state { color: var(--green-dark); font-weight: 750; }
.scope-state.is-missing { color: var(--red); }
.empty-state { min-height: 230px; display: grid; place-content: center; justify-items: center; text-align: center; color: var(--muted); }
.empty-state[hidden] { display: none; }
.empty-state > span { width: 44px; height: 44px; display: grid; place-items: center; margin-bottom: 12px; border-radius: 14px; color: var(--blue); background: #eaf1ff; font-size: 20px; }
.empty-state strong { color: var(--ink); font-size: 12px; }
.empty-state p { margin: 7px 0 0; font-size: 9px; }

.access-error { position: fixed; inset: 0; z-index: 120; display: grid; place-content: center; justify-items: center; padding: 28px; text-align: center; background: var(--canvas); }
.access-error[hidden] { display: none; }
.fallback-mark { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 16px; color: #fff; background: var(--navy); font-size: 13px; font-weight: 850; }
.access-error h1 { margin: 20px 0 7px; font-size: 25px; }
.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(--blue); font-size: 10px; font-weight: 800; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 90; max-width: min(420px, 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: .18s ease; font-size: 10px; }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast.is-error { background: #8c2934; }
.toast.is-warning { background: #8a5a07; }

@media (max-width: 1120px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content-grid { grid-template-columns: 1fr; }
  .connect-form { grid-template-columns: 1fr 1fr; }
  .connect-form .primary-button { grid-column: 1 / -1; }
}
@media (max-width: 820px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.is-open { transform: translateX(0); }
  .main-column { margin-left: 0; }
  .menu-button { display: grid; place-items: center; }
  .breadcrumb { display: none; }
  .topbar { padding: 0 18px; }
  main { padding: 22px 18px 48px; }
  .hero { align-items: flex-start; flex-direction: column; }
  .hero-status { width: 100%; }
}
@media (max-width: 620px) {
  .kpi-grid, .connect-form, .scope-box ul { grid-template-columns: 1fr; }
  .user-copy, .topbar .text-button { display: none; }
  .hero { padding: 28px 24px; }
  .panel-heading { align-items: flex-start; flex-direction: column; }
  th, td { padding-right: 14px; padding-left: 14px; white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

