:root {
  color-scheme: light;
  --ink: #171714;
  --muted: #716d65;
  --surface: #ffffff;
  --canvas: #f4f2ed;
  --line: #dedad2;
  --soft: #ebe7df;
  --gold: #b89255;
  --green: #33795a;
  --red: #a65142;
  --radius: 18px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--canvas); color: var(--ink); }
body { overflow-x: hidden; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.boot { min-height: 100vh; display: grid; place-content: center; gap: 14px; text-align: center; }
.boot > span { font-size: 50px; font-weight: 760; letter-spacing: -.095em; }
.boot > span span, .brand span { color: var(--gold); }
.boot small, .eyebrow { font: 700 10px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .15em; color: var(--muted); }

.connect { min-height: 100svh; padding: 0 max(22px, calc((100vw - 1320px) / 2)); background: radial-gradient(circle at 84% 18%, #fff 0, transparent 29%), linear-gradient(135deg, #f5f2ec, #e7e1d7); }
.connect-nav { height: 78px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #d8d1c6; }
.brand { color: var(--ink); text-decoration: none; font-size: 30px; line-height: 1; font-weight: 760; letter-spacing: -.095em; }
.connect-nav > a:last-child { color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 700; }
.connect-grid { min-height: calc(100svh - 78px); padding: 74px 0; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(340px, .7fr); align-items: center; gap: clamp(48px, 8vw, 120px); }
.connect-copy h1 { max-width: 780px; margin: 18px 0 28px; font-size: clamp(58px, 7vw, 108px); line-height: .89; letter-spacing: -.078em; text-wrap: balance; }
.connect-copy > p:not(.eyebrow) { max-width: 650px; font-size: clamp(17px, 1.5vw, 21px); color: var(--muted); line-height: 1.55; }
.trust { display: grid; gap: 12px; padding: 0; margin: 34px 0 0; list-style: none; color: #5d5951; font-size: 13px; }
.trust li::before { content: "✓"; color: var(--green); font-weight: 800; margin-right: 11px; }
.connect-card { min-width: 0; padding: clamp(28px, 4vw, 46px); background: #171715; border-radius: 24px; color: #f7f3eb; box-shadow: 0 36px 100px #3f382c25; }
.connect-card .eyebrow { color: #c6ab7c; }
.connect-card label { display: block; margin: 28px 0 10px; font-size: 13px; font-weight: 700; }
.connect-card input { width: 100%; padding: 16px; border: 1px solid #59554e; border-radius: 12px; background: #24241f; color: white; outline: 0; }
.connect-card input:focus { border-color: #c49b5a; box-shadow: 0 0 0 3px #c49b5a2e; }
.connect-card button { width: 100%; margin-top: 12px; display: flex; justify-content: space-between; border: 0; border-radius: 12px; padding: 16px 18px; background: #f2ede5; color: #171715; font-weight: 800; cursor: pointer; }
.connect-card small, .connect-card .legal-copy { color: #99948c; font-size: 11px; line-height: 1.55; }
.connect-card small { display: block; margin-top: 12px; }
.connect-card .legal-copy { margin: 28px 0 0; }
.connect-card a { color: #d8c9ad; }
.form-message { min-height: 18px; color: #e29b8c; font-size: 12px; font-weight: 700; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 224px minmax(0, 1fr); }
.side { min-height: 100vh; position: sticky; top: 0; align-self: start; background: #171715; color: #e8e4dc; padding: 28px 16px 20px; display: flex; flex-direction: column; }
.side .brand { color: #fff; padding: 0 12px 38px; }
.side nav { display: grid; gap: 7px; }
.side button { width: 100%; border: 0; border-radius: 11px; background: transparent; color: #aaa59c; padding: 12px 13px; text-align: left; cursor: pointer; font-size: 13px; display: flex; gap: 11px; align-items: center; }
.side button.active { background: #2a2925; color: white; box-shadow: inset 3px 0 var(--gold); }
.side button i { width: 17px; font-style: normal; color: #c1b9ab; }
.shop-card { margin-top: auto; padding: 18px 13px 0; border-top: 1px solid #373631; display: grid; gap: 7px; }
.shop-card small { font: 700 9px ui-monospace, SFMono-Regular, Menlo, monospace; color: #8b877f; letter-spacing: .12em; }
.shop-card strong { font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.plan-badge { width: max-content; border: 1px solid #6f6048; border-radius: 999px; padding: 5px 8px; color: #d4b77e; font-size: 9px; font-weight: 800; }

.workspace { min-width: 0; }
.topbar { height: 76px; position: sticky; top: 0; z-index: 8; padding: 0 clamp(18px, 3vw, 38px); border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--canvas) 90%, transparent); backdrop-filter: blur(18px); display: flex; align-items: center; gap: 12px; }
.topbar-title { margin-right: auto; display: grid; gap: 2px; }
.topbar-title strong { font-size: 13px; }
.topbar-title span { color: var(--muted); font-size: 11px; }
.button { border: 1px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--ink); padding: 11px 14px; font-size: 12px; font-weight: 750; cursor: pointer; }
.button:hover { border-color: #bbb4a9; }
.button.primary { border-color: var(--ink); background: var(--ink); color: white; }
.button.gold { border-color: #b89255; background: #b89255; color: #fff; }
.button.danger { color: var(--red); }
.button[disabled] { opacity: .5; cursor: not-allowed; }
.mobile-menu { display: none; }

.content { max-width: 1480px; margin: 0 auto; padding: clamp(26px, 4vw, 50px); }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
.page-head h1 { margin: 10px 0 8px; font-size: clamp(42px, 5vw, 70px); line-height: .95; letter-spacing: -.073em; }
.page-head p { margin: 0; max-width: 650px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.sync-state { text-align: right; color: var(--muted); font-size: 11px; line-height: 1.5; }
.sync-state strong { display: block; color: var(--ink); font-size: 12px; }

.notice { margin-bottom: 24px; padding: 15px 17px; border: 1px solid #d9bb84; border-radius: 14px; background: #fff8e9; color: #6d5229; display: flex; align-items: center; justify-content: space-between; gap: 18px; font-size: 13px; }
.notice.error { border-color: #ddb3aa; background: #fff2ef; color: #803f33; }
.notice.success { border-color: #a9c9b5; background: #f0faf3; color: #2f6b4e; }

.metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.metric { min-height: 142px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); display: flex; flex-direction: column; }
.metric small { color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; }
.metric strong { margin-top: auto; font-size: clamp(32px, 3vw, 48px); line-height: 1; letter-spacing: -.07em; }
.metric span { margin-top: 8px; color: var(--muted); font-size: 11px; }
.metric.accent { background: #1c1c19; border-color: #1c1c19; color: white; }
.metric.accent small, .metric.accent span { color: #a9a59d; }

.panel { margin-top: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.panel-head { padding: 20px 22px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-size: 15px; letter-spacing: -.02em; }
.panel-head p { margin: 0 0 0 auto; color: var(--muted); font-size: 11px; }
.catalogue-toolbar { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; gap: 8px; }
.catalogue-toolbar input { min-width: 0; flex: 1; border: 1px solid var(--line); border-radius: 11px; background: #fbfaf7; padding: 11px 13px; color: var(--ink); outline: 0; }
.catalogue-toolbar input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px #b8925520; }
.pagination { padding: 14px 18px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: flex-end; gap: 12px; color: var(--muted); font-size: 11px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 900px; }
th { padding: 12px 16px; color: var(--muted); background: #faf9f6; font-size: 9px; letter-spacing: .09em; text-transform: uppercase; text-align: left; }
td { padding: 15px 16px; border-top: 1px solid #ebe8e1; font-size: 12px; vertical-align: middle; }
.product-cell { min-width: 235px; display: flex; align-items: center; gap: 12px; }
.product-cell img, .product-placeholder { width: 42px; height: 42px; flex: 0 0 42px; border-radius: 10px; object-fit: cover; background: #eae6de; display: grid; place-items: center; color: #9b9489; }
.product-cell strong { display: block; font-size: 12px; }
.product-cell small { display: block; max-width: 220px; margin-top: 4px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.number { font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); }
.status { display: inline-flex; border-radius: 999px; padding: 5px 8px; font-size: 9px; font-weight: 800; background: #eeeae3; color: #5f5a52; white-space: nowrap; }
.status.ready, .status.applied, .status.healthy { background: #e9f5ed; color: var(--green); }
.status.blocked, .status.missing, .status.failed { background: #faeae7; color: var(--red); }
.row-actions { display: flex; gap: 7px; justify-content: flex-end; }
.row-actions .button { padding: 8px 10px; font-size: 10px; }

.empty { padding: 72px 28px; text-align: center; }
.empty .empty-mark { width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 20px; display: grid; place-items: center; background: #eee9e0; font-size: 25px; color: var(--gold); }
.empty h2 { margin: 0 0 10px; font-size: 22px; }
.empty p { max-width: 500px; margin: 0 auto 22px; color: var(--muted); line-height: 1.55; font-size: 13px; }

.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.settings-card { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.settings-card h2 { margin: 0 0 8px; font-size: 17px; }
.settings-card > p { margin: 0 0 22px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field { display: grid; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.field label { color: var(--muted); font-size: 11px; font-weight: 700; }
.field input, .field select { width: 100%; border: 1px solid var(--line); border-radius: 11px; background: #fbfaf7; padding: 12px; color: var(--ink); outline: 0; }
.field input:focus, .field select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px #b8925520; }
.setting-actions { margin-top: 18px; display: flex; justify-content: flex-end; }
.switch-line { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px 0; border-top: 1px solid var(--soft); }
.switch-line strong { display: block; font-size: 12px; }
.switch-line span { display: block; color: var(--muted); font-size: 11px; margin-top: 4px; }
.switch-line input { width: 42px; height: 23px; accent-color: var(--gold); }

.activity-list { display: grid; }
.activity-item { display: grid; grid-template-columns: 118px 1fr auto; gap: 18px; padding: 18px 22px; border-top: 1px solid var(--soft); align-items: start; }
.activity-item:first-child { border-top: 0; }
.activity-item time { color: var(--muted); font-size: 10px; }
.activity-item strong { display: block; font-size: 12px; }
.activity-item p { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.action-price { white-space: nowrap; font-size: 11px; color: var(--muted); }

.modal-backdrop { position: fixed; inset: 0; z-index: 30; padding: 20px; background: #17171480; backdrop-filter: blur(8px); display: grid; place-items: center; }
.modal { width: min(480px, 100%); padding: 27px; border-radius: 22px; background: white; box-shadow: 0 40px 100px #0003; }
.modal h2 { margin: 0 0 8px; font-size: 23px; letter-spacing: -.04em; }
.modal p { margin: 0 0 22px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.modal-actions { margin-top: 20px; display: flex; justify-content: flex-end; gap: 9px; }

.toast { position: fixed; right: 22px; bottom: 22px; z-index: 50; max-width: 390px; padding: 14px 16px; border-radius: 13px; background: #171715; color: white; box-shadow: 0 20px 60px #0003; font-size: 12px; line-height: 1.45; animation: toast-in .25s ease-out; }
.toast.error { background: #8b4034; }
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } }

@media (max-width: 1100px) {
  .metrics { grid-template-columns: repeat(3, 1fr); }
  .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .connect-grid { grid-template-columns: 1fr; padding: 64px 0; gap: 42px; }
  .connect-copy h1 { font-size: clamp(48px, 14vw, 68px); }
  .connect-card { padding: 25px 21px; }
  .shell { display: block; }
  .side { position: fixed; inset: 0 auto 0 0; width: 230px; z-index: 20; transform: translateX(-105%); transition: transform .25s ease; box-shadow: 30px 0 80px #0003; }
  .shell.menu-open .side { transform: translateX(0); }
  .topbar { height: 66px; }
  .mobile-menu { display: block; }
  .topbar .button span { display: none; }
  .content { padding: 24px 16px 40px; }
  .page-head { display: block; }
  .page-head h1 { font-size: clamp(40px, 13vw, 58px); }
  .sync-state { margin-top: 16px; text-align: left; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metric { min-height: 125px; }
  .fields { grid-template-columns: 1fr; }
  .activity-item { grid-template-columns: 1fr; gap: 7px; }
  .activity-item .status { width: max-content; }
}

@media (max-width: 420px) {
  .connect { padding-inline: 20px; }
  .metrics { grid-template-columns: 1fr 1fr; gap: 9px; }
  .metric { padding: 16px; }
  .metric strong { font-size: 32px; }
  .panel { border-radius: 15px; }
  .notice { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
