:root {
  --bg: #0a0b14;
  --surface: #121322;
  --surface-2: #17192b;
  --surface-3: #1d2034;
  --line: rgba(255,255,255,0.08);
  --text: #f5f7ff;
  --muted: #9aa0b5;
  --orange: #ff7a00;
  --orange-soft: rgba(255, 122, 0, 0.14);
  --green: #27d980;
  --red: #ff5d62;
  --blue: #2cb6ff;
  --purple: #9b6cff;
  --yellow: #ffb800;
  --shadow: 0 24px 50px rgba(0, 0, 0, 0.35);
  --radius: 22px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: radial-gradient(circle at top, #1a1d33 0%, #0a0b14 42%); color: var(--text); font-family: Inter, system-ui, sans-serif; }
button { font: inherit; }
.shell { width: min(1600px, calc(100% - 32px)); margin: 18px auto 40px; }
.card { background: linear-gradient(180deg, rgba(24,25,42,0.98), rgba(16,17,29,0.98)); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.hero { padding: 26px 26px 18px; position: sticky; top: 12px; z-index: 20; backdrop-filter: blur(14px); }
.hero-top { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.hero-actions { display: flex; align-items: center; gap: 10px; }
.eyebrow { margin: 0 0 8px; color: #d8dcef; font-size: 15px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
h1 { margin: 0; font-size: clamp(28px, 4vw, 46px); }
.month-pill, .pill, .tab-btn, .refresh-btn, .segment-btn, .table-chip { border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,0.04); color: var(--text); }
.month-pill { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; margin-top: 14px; color: #ffd7b2; background: rgba(255,122,0,0.12); border-color: rgba(255,122,0,0.35); font-weight: 700; }
.filter-row, .tab-row { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.filter-row { margin-top: 20px; }
.tab-row { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.segment-btn, .tab-btn { padding: 12px 16px; white-space: nowrap; cursor: pointer; transition: .2s ease; }
.segment-btn:hover, .tab-btn:hover, .refresh-btn:hover { transform: translateY(-1px); border-color: rgba(255,255,255,0.18); }
.segment-btn.active, .tab-btn.active { background: linear-gradient(180deg, rgba(255,122,0,0.24), rgba(255,122,0,0.12)); border-color: rgba(255,122,0,0.5); color: #fff; box-shadow: inset 0 -2px 0 var(--orange); }
.icon-btn { width: 50px; height: 50px; font-size: 22px; display: inline-grid; place-items: center; cursor: pointer; transition: .2s ease; }
.settings-btn { background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03)); }
.refresh-btn { width: 50px; height: 50px; font-size: 22px; display: inline-grid; place-items: center; background: linear-gradient(180deg, #ff8d25, #ff6a00); border-color: transparent; box-shadow: 0 8px 20px rgba(255,122,0,0.35); cursor: pointer; transition: .2s ease; }
.content { margin-top: 18px; display: grid; gap: 18px; }
.grid { display: grid; gap: 18px; }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.metric-card, .panel, .list-card { background: linear-gradient(180deg, rgba(19,20,35,.98), rgba(15,16,29,.98)); border: 1px solid var(--line); border-radius: 20px; padding: 18px; min-width: 0; }
.metric-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.metric-value { margin-top: 14px; font-size: clamp(28px, 3vw, 42px); font-weight: 800; }
.metric-foot { margin-top: 10px; color: var(--muted); font-size: 13px; }
.metric-trend { display: inline-flex; margin-top: 10px; padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.metric-trend.up { background: rgba(39,217,128,.12); color: #7effbb; }
.metric-trend.down { background: rgba(255,93,98,.12); color: #ff8e94; }
.metric-trend.neutral { background: rgba(255,184,0,.12); color: #ffd76a; }
.panel-header { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 18px; }
.panel h2 { margin: 0; font-size: 22px; }
.panel-subtitle { color: var(--muted); margin-top: 6px; font-size: 14px; }
.chart { min-height: 330px; }
.gauge-wrap { display: grid; grid-template-columns: 280px 1fr; gap: 18px; align-items: center; }
.score-bars { display: grid; gap: 12px; }
.score-item { display: grid; gap: 7px; }
.score-head { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; }
.progress { height: 10px; border-radius: 999px; background: rgba(255,255,255,.07); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 12px; border-bottom: 1px solid rgba(255,255,255,0.06); text-align: left; font-size: 14px; }
th { color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
.positive { color: #6df0a5; }
.negative { color: #ff858b; }
.muted { color: var(--muted); }
.section-title { margin: 0 0 6px; font-size: 18px; }
.kpi-strip { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap: 14px; }
.kpi-strip .metric-card { padding: 16px; }
.accordion { display: grid; gap: 10px; }
.acc-row { display: grid; grid-template-columns: 1.5fr .6fr .4fr; gap: 12px; align-items: center; padding: 14px 16px; border-radius: 16px; border: 1px solid rgba(255,255,255,0.05); background: rgba(255,255,255,0.02); }
.acc-row.highlight { background: rgba(39,217,128,0.08); border-color: rgba(39,217,128,0.25); }
.acc-row.warn { background: rgba(255,122,0,0.07); border-color: rgba(255,122,0,0.22); }
.acc-name { font-weight: 700; }
.acc-right { text-align: right; }
.tag { display: inline-flex; align-items: center; padding: 5px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.tag.orange { background: rgba(255,122,0,.12); color: #ffb576; }
.tag.green { background: rgba(39,217,128,.12); color: #82f2b5; }
.tag.red { background: rgba(255,93,98,.12); color: #ff8d93; }
.list-card { padding: 0; overflow: hidden; }
.list-head, .list-row { display: grid; grid-template-columns: 52px 1.4fr 1fr .6fr .4fr; gap: 12px; align-items: center; padding: 16px 18px; }
.list-head { background: rgba(255,255,255,.03); color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.list-row { border-top: 1px solid rgba(255,255,255,0.05); }
.empty-state { min-height: 260px; display: grid; place-items: center; color: var(--muted); border: 1px dashed rgba(255,255,255,.08); border-radius: 18px; }
.footer-note { color: var(--muted); font-size: 13px; }
.settings-overlay { position: fixed; inset: 0; background: rgba(4, 8, 18, 0.56); backdrop-filter: blur(3px); opacity: 0; pointer-events: none; transition: .25s ease; z-index: 39; }
.settings-drawer { position: fixed; top: 16px; right: 16px; width: min(420px, calc(100vw - 24px)); height: calc(100vh - 32px); background: linear-gradient(180deg, rgba(20,22,37,0.98), rgba(13,15,26,0.99)); border: 1px solid rgba(255,255,255,0.08); border-radius: 24px; box-shadow: 0 30px 60px rgba(0,0,0,.45); padding: 22px; transform: translateX(calc(100% + 22px)); transition: transform .28s ease; z-index: 40; display: flex; flex-direction: column; gap: 18px; }
body.settings-open .settings-overlay { opacity: 1; pointer-events: auto; }
body.settings-open .settings-drawer { transform: translateX(0); }
.settings-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding-bottom: 14px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.settings-header h2 { margin: 6px 0 0; font-size: 28px; }
.close-btn { font-size: 18px; }
.settings-body { display: grid; gap: 18px; overflow: auto; padding-right: 4px; }
.settings-section { border: 1px solid rgba(255,255,255,0.06); border-radius: 18px; padding: 16px; background: rgba(255,255,255,0.025); }
.settings-section h3 { margin: 0 0 14px; font-size: 16px; }
.settings-item { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 12px 0; color: var(--muted); border-top: 1px solid rgba(255,255,255,0.06); }
.settings-item:first-of-type { border-top: 0; padding-top: 0; }
.drawer-link { width: 100%; text-align: left; padding: 14px 16px; border-radius: 14px; border: 1px solid rgba(255,255,255,0.08); background: rgba(255,255,255,0.03); color: var(--text); cursor: pointer; margin-top: 10px; }
.drawer-link:first-of-type { margin-top: 0; }
.integration-list { display: grid; gap: 10px; }
.integration-trigger { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.integration-trigger.active { border-color: rgba(255,122,0,0.4); background: rgba(255,122,0,0.1); }
.status-pill { display: inline-flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.status-pill.disconnected { background: rgba(255,93,98,0.12); color: #ff9da2; }
.status-pill.disconnected .status-dot { background: var(--red); box-shadow: 0 0 0 4px rgba(255,93,98,0.15); }
.status-pill.warning { background: rgba(255,184,0,0.12); color: #ffd76a; }
.status-pill.warning .status-dot { background: var(--yellow); box-shadow: 0 0 0 4px rgba(255,184,0,0.14); }
.status-pill.connected { background: rgba(39,217,128,0.12); color: #8ff0ba; }
.status-pill.connected .status-dot { background: var(--green); box-shadow: 0 0 0 4px rgba(39,217,128,0.15); }
.integration-panel { margin-top: 14px; border-top: 1px solid rgba(255,255,255,0.08); padding-top: 14px; }
.integration-card { display: grid; gap: 14px; }
.integration-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.integration-head h4 { margin: 0; font-size: 18px; }
.integration-help { color: var(--muted); font-size: 13px; line-height: 1.5; }
.field { display: grid; gap: 8px; }
.field label { color: #dbe0f4; font-size: 13px; font-weight: 600; }
.field input { width: 100%; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.1); color: var(--text); border-radius: 12px; padding: 12px 14px; outline: none; }
.field input:focus { border-color: rgba(255,122,0,0.45); box-shadow: 0 0 0 4px rgba(255,122,0,0.12); }
.copy-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.copy-btn, .save-btn { border: 1px solid rgba(255,255,255,0.1); background: rgba(255,255,255,0.05); color: var(--text); border-radius: 12px; padding: 12px 14px; cursor: pointer; }
.save-btn { background: linear-gradient(180deg, #ff8d25, #ff6a00); border-color: transparent; font-weight: 700; }
.save-btn:disabled { opacity: .7; cursor: wait; }
.inline-status { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.integration-result { border: 1px solid rgba(255,255,255,0.08); border-radius: 16px; padding: 14px; background: rgba(255,255,255,0.025); display: grid; gap: 10px; }
.integration-result h5 { margin: 0; font-size: 15px; }
.result-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.result-item { padding: 12px; border-radius: 12px; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.05); }
.result-item-label { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.result-message { color: var(--muted); font-size: 13px; }
.drawer-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.drawer-chip { display: inline-flex; align-items: center; padding: 10px 14px; border-radius: 999px; border: 1px solid rgba(255,255,255,0.08); background: rgba(255,255,255,0.03); color: var(--muted); }
.drawer-chip.active { color: #fff; border-color: rgba(255,122,0,0.45); background: rgba(255,122,0,0.12); }
.inventory-panel { padding: 0; overflow: hidden; }
.inventory-table { display: grid; }
.inventory-head, .inventory-main { display: grid; grid-template-columns: 46px minmax(320px, 2.2fr) 120px 80px 110px 110px 120px 150px 46px; gap: 12px; align-items: center; }
.inventory-head { padding: 16px 18px; background: rgba(255,255,255,0.03); color: var(--muted); font-size: 12px; font-weight: 700; text-transform: none; }
.inventory-row { border-top: 1px solid rgba(255,255,255,0.06); }
.inventory-main { padding: 12px 18px; min-height: 64px; width: 100%; border: 0; color: inherit; background: transparent; text-align: left; cursor: pointer; }
.inventory-row.active { background: rgba(255,255,255,0.02); }
.inventory-check { display: flex; justify-content: center; }
.inventory-check input { width: 16px; height: 16px; accent-color: #2563eb; }
.inventory-desc { display: flex; align-items: center; gap: 12px; min-width: 0; }
.inventory-desc strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inventory-thumb { width: 52px; height: 52px; border-radius: 10px; display: inline-grid; place-items: center; background: linear-gradient(180deg, #ffffff, #dbe2f3); color: #1b1f30; font-size: 26px; flex: 0 0 auto; }
.inventory-sku { font-weight: 800; }
.inventory-expand { width: 28px; height: 28px; border-radius: 999px; display: inline-grid; place-items: center; background: rgba(255,255,255,0.06); }
.inventory-detail { padding: 0 18px 18px 76px; display: grid; gap: 14px; }
.inventory-detail-grid { display: grid; gap: 10px; }
.inventory-detail-grid div { display: flex; gap: 8px; flex-wrap: wrap; }
.inventory-detail-grid span { color: var(--muted); }
@media (max-width: 1280px) {
  .grid.cols-4, .kpi-strip { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .gauge-wrap { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .result-grid { grid-template-columns: 1fr; }
  .shell { width: min(100% - 18px, 100%); }
  .hero { padding: 20px 16px 14px; }
  .hero-top { flex-direction: column; }
  .hero-actions { width: 100%; justify-content: flex-end; }
  .grid.cols-4, .grid.cols-3, .grid.cols-2, .kpi-strip { grid-template-columns: 1fr; }
  .list-head, .list-row, .acc-row { grid-template-columns: 1fr; }
  .inventory-head { display: none; }
  .inventory-main { grid-template-columns: 1fr; gap: 8px; }
  .inventory-detail { padding: 0 18px 18px 18px; }
  .metric-value { font-size: 32px; }
  .settings-drawer { top: 8px; right: 8px; left: 8px; width: auto; height: calc(100vh - 16px); }
}
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(520px, 100%); background: linear-gradient(180deg, rgba(24,25,42,0.98), rgba(16,17,29,0.98)); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); padding: 28px; }
.auth-card h1, .auth-card h2 { margin: 0 0 10px; }
.auth-subtitle { color: var(--muted); line-height: 1.5; margin-bottom: 18px; }
.auth-form { display: grid; gap: 14px; }
.auth-hidden { display: none; }
.auth-qr { width: 220px; max-width: 100%; border-radius: 16px; background: #fff; padding: 12px; }
::-webkit-scrollbar { height: 8px; width: 8px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 999px; }