/* PricePulse prototype design system
   Offline-first, responsive, no external font or icon dependency. */

:root {
  --font-sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --bg: #f4f7f9;
  --surface: #ffffff;
  --surface-2: #f8fafb;
  --surface-3: #eef3f5;
  --surface-elevated: rgba(255, 255, 255, 0.92);
  --text: #17222b;
  --text-2: #4a5b67;
  --muted: #7b8b95;
  --line: #dfe7eb;
  --line-strong: #cbd7dd;
  --primary: #0b776f;
  --primary-strong: #075c57;
  --primary-soft: #e3f5f2;
  --secondary: #304c63;
  --success: #16845b;
  --success-soft: #e5f6ee;
  --danger: #c44343;
  --danger-soft: #fbeaea;
  --warning: #b66c12;
  --warning-soft: #fff1da;
  --info: #2b70b7;
  --info-soft: #e8f2fc;
  --purple: #6d58c6;
  --purple-soft: #eeebfb;
  --shadow-sm: 0 1px 2px rgba(20, 40, 50, 0.04), 0 3px 12px rgba(20, 40, 50, 0.04);
  --shadow-md: 0 14px 40px rgba(26, 50, 63, 0.10);
  --shadow-lg: 0 26px 80px rgba(12, 35, 45, 0.18);
  --radius-sm: 8px;
  --radius: 13px;
  --radius-lg: 18px;
  --radius-xl: 26px;
  --sidebar-width: 252px;
  --topbar-height: 72px;
  --mobile-bottom-height: 68px;
  --chart-grid: #e6edf0;
  --chart-text: #72838e;
  --overlay: rgba(11, 25, 34, 0.52);
}

html[data-theme="dark"] {
  --bg: #0d151a;
  --surface: #151f25;
  --surface-2: #111a20;
  --surface-3: #202c33;
  --surface-elevated: rgba(21, 31, 37, 0.94);
  --text: #ecf2f4;
  --text-2: #b3c0c7;
  --muted: #83939d;
  --line: #29363d;
  --line-strong: #394951;
  --primary: #55c7ba;
  --primary-strong: #79dbcf;
  --primary-soft: #163834;
  --secondary: #9ab3c5;
  --success: #61d39d;
  --success-soft: #18382d;
  --danger: #ff8585;
  --danger-soft: #432426;
  --warning: #f4b45e;
  --warning-soft: #3d3020;
  --info: #79b9f2;
  --info-soft: #203447;
  --purple: #b0a1f0;
  --purple-soft: #302b4b;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.22), 0 3px 12px rgba(0, 0, 0, 0.12);
  --shadow-md: 0 14px 40px rgba(0, 0, 0, 0.24);
  --shadow-lg: 0 26px 80px rgba(0, 0, 0, 0.38);
  --chart-grid: #2a373e;
  --chart-text: #8ca0ab;
  --overlay: rgba(0, 0, 0, 0.68);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; }
button { color: inherit; }
a { color: inherit; }
img { max-width: 100%; }
.is-hidden { display: none !important; }
.muted { color: var(--muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-info { color: var(--info); }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.w-100 { width: 100%; }

.noscript-banner, .offline-banner {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  color: #fff;
  background: #24353f;
  padding: 11px 18px;
  border-radius: 0 0 10px 10px;
  font-size: 13px;
  box-shadow: var(--shadow-md);
}
.noscript-banner { top: 0; }
.offline-banner { bottom: -80px; transition: bottom .25s ease; }
.offline-banner.show { bottom: 18px; }

/* Login */
.login-screen { min-height: 100vh; display: grid; grid-template-columns: minmax(480px, 1.08fr) minmax(420px, .92fr); background: var(--surface); }
.login-visual {
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  padding: 46px clamp(40px, 6vw, 92px);
  color: #ecfffb;
  background:
    radial-gradient(circle at 14% 12%, rgba(69, 190, 170, .25), transparent 31%),
    radial-gradient(circle at 92% 79%, rgba(104, 145, 222, .22), transparent 27%),
    linear-gradient(145deg, #082d31 0%, #0c4145 46%, #173947 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.login-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .18;
  background-image: linear-gradient(rgba(255,255,255,.11) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.11) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 88%);
  pointer-events: none;
}
.login-brand, .mobile-login-brand, .sidebar-brand { display: flex; align-items: center; gap: 12px; font-weight: 750; letter-spacing: -.02em; }
.login-brand { position: relative; z-index: 2; font-size: 21px; }
.brand-mark { width: 35px; height: 35px; display: inline-flex; align-items: flex-end; justify-content: center; gap: 3px; padding: 8px; border-radius: 11px; background: var(--primary); box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.brand-mark span { display: block; width: 4px; border-radius: 4px; background: #fff; }
.brand-mark span:nth-child(1) { height: 8px; opacity: .72; }
.brand-mark span:nth-child(2) { height: 17px; }
.brand-mark span:nth-child(3) { height: 12px; opacity: .85; }
.visual-copy { position: relative; z-index: 2; max-width: 680px; margin-top: 8vh; }
.eyebrow { display: inline-block; margin-bottom: 12px; color: var(--primary); font-size: 12px; line-height: 1; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.eyebrow.light { color: #8ce7d8; }
.visual-copy h1 { margin: 0; max-width: 740px; font-size: clamp(42px, 5.2vw, 76px); line-height: .98; letter-spacing: -.052em; }
.visual-copy p { max-width: 610px; margin: 25px 0 0; color: rgba(236,255,251,.72); font-size: 17px; line-height: 1.65; }
.visual-chart-card { position: relative; z-index: 2; width: min(620px, 100%); padding: 24px; margin-top: 7vh; border: 1px solid rgba(255,255,255,.16); border-radius: 22px; background: rgba(10,39,43,.58); backdrop-filter: blur(18px); box-shadow: 0 22px 80px rgba(0,0,0,.2); }
.visual-card-head { display: flex; justify-content: space-between; align-items: flex-start; }
.visual-card-head small { display: block; color: rgba(236,255,251,.62); margin-bottom: 8px; }
.visual-card-head strong { font-size: 29px; letter-spacing: -.03em; }
.visual-chart-card svg { display: block; width: 100%; height: 160px; margin: 10px 0 0; }
.mini-chip { display: inline-flex; align-items: center; padding: 6px 9px; border-radius: 999px; font-size: 12px; font-weight: 750; }
.mini-chip.success { color: #92f1cd; background: rgba(67,198,145,.14); border: 1px solid rgba(146,241,205,.18); }
.visual-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.12); }
.visual-stats span { display: block; color: rgba(236,255,251,.54); font-size: 11px; }
.visual-stats b { display: block; margin-top: 7px; font-size: 13px; }
.visual-orb { position: absolute; border-radius: 50%; filter: blur(2px); opacity: .5; }
.orb-a { width: 220px; height: 220px; right: -90px; top: 12%; background: rgba(73,210,191,.12); }
.orb-b { width: 340px; height: 340px; left: -160px; bottom: -100px; background: rgba(83,139,219,.13); }
.login-panel { position: relative; display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 52px clamp(34px, 7vw, 104px); background: var(--surface); }
.login-theme { position: absolute; top: 28px; right: 30px; }
.login-form { width: min(440px, 100%); }
.mobile-login-brand { display: none; margin-bottom: 54px; font-size: 21px; }
.login-form h2 { margin: 0; font-size: clamp(30px, 3vw, 42px); letter-spacing: -.042em; }
.login-form > p { margin: 13px 0 34px; line-height: 1.6; }
.field { display: grid; gap: 9px; margin-bottom: 20px; }
.field > span, .field-label { font-size: 13px; font-weight: 700; color: var(--text-2); }
.field input, .field select, .field textarea, .input, .select {
  width: 100%;
  min-height: 46px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 0 13px;
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.field textarea { min-height: 100px; padding-top: 12px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus, .select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent); }
.password-field { position: relative; }
.password-field input { padding-right: 70px; }
.password-field button { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--primary); font-size: 12px; font-weight: 750; cursor: pointer; }
.login-options { display: flex; align-items: center; justify-content: space-between; margin: 3px 0 25px; font-size: 13px; }
.check-row { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; }
.check-row input { accent-color: var(--primary); width: 16px; height: 16px; }
.text-button { border: 0; padding: 0; color: var(--primary); background: transparent; cursor: pointer; font-weight: 700; }
.demo-note { display: flex; align-items: center; justify-content: center; gap: 9px; margin-top: 20px; color: var(--muted); font-size: 12px; }
.pulse-dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--success); }
.pulse-dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 1px solid var(--success); opacity: .4; animation: pulse 1.8s infinite; }
@keyframes pulse { 70% { transform: scale(1.7); opacity: 0; } 100% { opacity: 0; } }

/* App shell */
.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-width) 1fr; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 50; width: var(--sidebar-width); display: flex; flex-direction: column; padding: 21px 14px 16px; background: var(--surface); border-right: 1px solid var(--line); transition: width .25s ease, transform .25s ease; }
.sidebar-brand { min-height: 44px; padding: 0 9px 18px; }
.sidebar-brand > div { display: grid; line-height: 1.15; white-space: nowrap; }
.sidebar-brand strong { font-size: 17px; }
.sidebar-brand small { color: var(--muted); font-size: 10px; margin-top: 5px; text-transform: uppercase; letter-spacing: .1em; }
.sidebar-nav { display: grid; gap: 3px; padding-top: 14px; border-top: 1px solid var(--line); }
.nav-item { position: relative; display: flex; align-items: center; gap: 12px; min-height: 44px; width: 100%; padding: 0 12px; border: 0; border-radius: 10px; color: var(--text-2); background: transparent; cursor: pointer; text-align: left; transition: background .16s ease, color .16s ease, transform .16s ease; }
.nav-item:hover { color: var(--text); background: var(--surface-2); }
.nav-item.active { color: var(--primary); background: var(--primary-soft); font-weight: 750; }
.nav-item.active::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: var(--primary); }
.nav-icon { width: 22px; text-align: center; font-size: 18px; font-weight: 500; flex: 0 0 22px; }
.nav-count { margin-left: auto; min-width: 23px; padding: 3px 6px; text-align: center; border-radius: 999px; color: var(--muted); background: var(--surface-3); font-size: 10px; font-weight: 800; }
.nav-count.danger { color: var(--danger); background: var(--danger-soft); }
.sidebar-bottom { display: grid; gap: 9px; margin-top: auto; }
.crawler-mini-card { padding: 13px; margin: 0 2px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.crawler-mini-head { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.crawler-mini-card p { margin: 7px 0 10px; color: var(--muted); font-size: 11px; }
.crawler-mini-card small { display: block; margin-top: 7px; color: var(--muted); font-size: 10px; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status-dot.success { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.status-dot.warning { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-soft); }
.status-dot.danger { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.mini-progress, .progress { overflow: hidden; height: 5px; border-radius: 999px; background: var(--surface-3); }
.mini-progress span, .progress span { display: block; height: 100%; border-radius: inherit; background: var(--primary); }
.sidebar-collapse { display: flex; justify-content: space-between; align-items: center; min-height: 34px; padding: 0 12px; border: 0; color: var(--muted); background: transparent; font-size: 11px; cursor: pointer; }
.sidebar-collapse b { font-size: 20px; }
.app-shell.sidebar-collapsed { --sidebar-width: 78px; }
.app-shell.sidebar-collapsed .sidebar-brand > div, .app-shell.sidebar-collapsed .nav-item > span:not(.nav-icon), .app-shell.sidebar-collapsed .nav-count, .app-shell.sidebar-collapsed .crawler-mini-card, .app-shell.sidebar-collapsed .sidebar-collapse span { display: none; }
.app-shell.sidebar-collapsed .sidebar-brand { justify-content: center; padding-left: 0; padding-right: 0; }
.app-shell.sidebar-collapsed .nav-item { justify-content: center; padding: 0; }
.app-shell.sidebar-collapsed .sidebar-collapse { justify-content: center; }
.app-shell.sidebar-collapsed .sidebar-collapse b { transform: rotate(180deg); }
.app-main { min-width: 0; grid-column: 2; }
.topbar { position: sticky; top: 0; z-index: 40; min-height: var(--topbar-height); display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 0 28px; border-bottom: 1px solid var(--line); background: var(--surface-elevated); backdrop-filter: blur(16px); }
.topbar-left, .topbar-actions { display: flex; align-items: center; gap: 10px; min-width: 0; }
.global-search { width: min(420px, 38vw); display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 11px; border: 1px solid transparent; border-radius: 10px; background: var(--surface-2); transition: border .2s ease; }
.global-search:focus-within { border-color: var(--line-strong); }
.global-search > span { color: var(--muted); font-size: 20px; }
.global-search input { flex: 1; min-width: 0; border: 0; outline: none; color: var(--text); background: transparent; }
.global-search kbd { color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 2px 5px; font-size: 9px; }
.connection-status { display: flex; align-items: center; gap: 7px; height: 32px; padding: 0 10px; color: var(--success); border-radius: 999px; background: var(--success-soft); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.connection-status span { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.icon-button, .theme-icon, .notification-button { display: inline-grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 1px solid var(--line); border-radius: 10px; color: var(--text-2); background: var(--surface); cursor: pointer; transition: background .16s ease, border-color .16s ease, transform .16s ease; }
.icon-button:hover, .theme-icon:hover, .notification-button:hover { background: var(--surface-2); border-color: var(--line-strong); }
.notification-button { position: relative; }
.notification-button b { position: absolute; top: -4px; right: -5px; min-width: 17px; height: 17px; display: grid; place-items: center; padding: 0 4px; border-radius: 999px; color: #fff; background: var(--danger); font-size: 9px; box-shadow: 0 0 0 2px var(--surface); }
.profile-menu-wrap { position: relative; }
.profile-button { display: flex; align-items: center; gap: 10px; min-height: 45px; padding: 4px 8px 4px 5px; border: 0; border-radius: 12px; background: transparent; cursor: pointer; }
.profile-button:hover { background: var(--surface-2); }
.avatar { width: 35px; height: 35px; display: grid; place-items: center; flex: 0 0 35px; color: #fff; background: linear-gradient(135deg, #0c7a70, #345d7d); border-radius: 11px; font-size: 11px; font-weight: 800; }
.profile-copy { display: grid; text-align: left; line-height: 1.15; }
.profile-copy strong { font-size: 12px; }
.profile-copy small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.mobile-menu-button { display: none; }
.page-content { min-height: calc(100vh - var(--topbar-height)); padding: 28px; outline: none; }

/* Shared page layout */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-title-wrap { min-width: 0; }
.breadcrumb { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; color: var(--muted); font-size: 11px; }
.breadcrumb button { border: 0; padding: 0; color: var(--primary); background: transparent; cursor: pointer; }
.page-header h1 { margin: 0; font-size: clamp(26px, 3vw, 35px); letter-spacing: -.04em; }
.page-header p { margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 9px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 39px; padding: 0 13px; border: 1px solid transparent; border-radius: 9px; background: transparent; cursor: pointer; font-size: 12px; font-weight: 750; transition: transform .15s ease, background .15s ease, border-color .15s ease, opacity .15s ease; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { cursor: not-allowed; opacity: .55; transform: none; }
.btn-primary { color: #fff; background: var(--primary); border-color: var(--primary); box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 20%, transparent); }
.btn-primary:hover { background: var(--primary-strong); }
.btn-secondary { color: var(--text); background: var(--surface); border-color: var(--line-strong); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { color: var(--text-2); border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.btn-success { color: var(--success); background: var(--success-soft); }
.btn-warning { color: var(--warning); background: var(--warning-soft); }
.btn-block { width: 100%; }
.btn-lg { min-height: 48px; padding: 0 18px; font-size: 14px; }
.btn-sm { min-height: 31px; padding: 0 9px; font-size: 10px; }
.icon-only { width: 36px; padding: 0; }
.card { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 19px 20px; border-bottom: 1px solid var(--line); }
.card-head.compact { padding: 15px 17px; }
.card-head h2, .card-head h3 { margin: 0; font-size: 15px; letter-spacing: -.015em; }
.card-head p { margin: 6px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.card-body { padding: 20px; }
.card-body.flush { padding: 0; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--line); }
.section { margin-top: 24px; }
.section-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 13px; }
.section-title h2 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.section-title p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-dashboard { grid-template-columns: minmax(0, 1.65fr) minmax(310px, .85fr); }
.grid-detail { grid-template-columns: minmax(0, 1.7fr) minmax(290px, .75fr); }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.summary-card { position: relative; overflow: hidden; min-height: 124px; padding: 17px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.summary-card::after { content: ""; position: absolute; width: 90px; height: 90px; right: -40px; top: -40px; border-radius: 50%; background: var(--accent-soft, var(--primary-soft)); opacity: .72; }
.summary-top { position: relative; z-index: 1; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.summary-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: var(--accent, var(--primary)); background: var(--accent-soft, var(--primary-soft)); font-size: 17px; }
.summary-trend { font-size: 10px; color: var(--muted); }
.summary-trend.positive { color: var(--success); }
.summary-trend.negative { color: var(--danger); }
.summary-value { position: relative; z-index: 1; display: block; margin-top: 16px; font-size: 25px; line-height: 1; letter-spacing: -.035em; }
.summary-label { position: relative; z-index: 1; display: block; margin-top: 8px; color: var(--text-2); font-size: 11px; font-weight: 650; }
.summary-note { position: relative; z-index: 1; display: block; margin-top: 4px; color: var(--muted); font-size: 9px; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 5px; min-height: 23px; padding: 3px 8px; border-radius: 999px; font-size: 9px; line-height: 1.2; font-weight: 800; letter-spacing: .01em; white-space: nowrap; }
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.success { color: var(--success); background: var(--success-soft); }
.badge.danger { color: var(--danger); background: var(--danger-soft); }
.badge.warning { color: var(--warning); background: var(--warning-soft); }
.badge.info { color: var(--info); background: var(--info-soft); }
.badge.neutral { color: var(--muted); background: var(--surface-3); }
.badge.purple { color: var(--purple); background: var(--purple-soft); }
.badge.outline { color: var(--text-2); background: transparent; border: 1px solid var(--line-strong); }
.price-change { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 750; }
.price-change.drop { color: var(--success); }
.price-change.rise { color: var(--danger); }
.price-change.flat { color: var(--muted); }
.freshness { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; }
.freshness::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--success); }
.freshness.stale { color: var(--warning); }
.freshness.stale::before { background: var(--warning); }
.freshness.failed { color: var(--danger); }
.freshness.failed::before { background: var(--danger); }

/* Charts */
.chart-card canvas { display: block; width: 100%; height: 280px; }
.chart-wrap { position: relative; min-height: 280px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 15px; margin-top: 10px; }
.legend-item { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--legend-color, var(--primary)); }
.donut-wrap { display: grid; grid-template-columns: minmax(150px, .8fr) minmax(170px, 1fr); gap: 20px; align-items: center; }
.donut-wrap canvas { height: 210px; }
.donut-legend { display: grid; gap: 12px; }
.donut-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; font-size: 11px; }
.donut-row span:nth-child(2) { color: var(--text-2); }
.range-control, .segmented { display: inline-flex; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); }
.range-control button, .segmented button { min-height: 29px; padding: 0 10px; border: 0; border-radius: 6px; color: var(--muted); background: transparent; cursor: pointer; font-size: 9px; font-weight: 750; }
.range-control button.active, .segmented button.active { color: var(--text); background: var(--surface); box-shadow: var(--shadow-sm); }
.chart-tooltip { position: fixed; z-index: 1200; display: none; min-width: 190px; padding: 12px; pointer-events: none; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-md); font-size: 10px; }
.chart-tooltip.show { display: block; }
.chart-tooltip strong { display: block; margin-bottom: 7px; font-size: 12px; }
.chart-tooltip dl { display: grid; grid-template-columns: 1fr auto; gap: 5px 12px; margin: 0; }
.chart-tooltip dt { color: var(--muted); }
.chart-tooltip dd { margin: 0; font-weight: 700; }

/* Dashboard */
.insight-list { display: grid; gap: 1px; background: var(--line); }
.insight-row { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; padding: 14px 17px; background: var(--surface); cursor: pointer; }
.insight-row:hover { background: var(--surface-2); }
.insight-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; font-size: 17px; }
.insight-icon.success { color: var(--success); background: var(--success-soft); }
.insight-icon.danger { color: var(--danger); background: var(--danger-soft); }
.insight-icon.info { color: var(--info); background: var(--info-soft); }
.insight-copy { min-width: 0; }
.insight-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.insight-copy small { display: block; margin-top: 5px; color: var(--muted); font-size: 9px; }
.insight-value { text-align: right; font-size: 11px; font-weight: 800; }
.activity-list { display: grid; }
.activity-item { position: relative; display: grid; grid-template-columns: 32px 1fr auto; gap: 11px; padding: 13px 0; }
.activity-item + .activity-item { border-top: 1px solid var(--line); }
.activity-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; color: var(--activity-color, var(--primary)); background: var(--activity-bg, var(--primary-soft)); font-size: 13px; }
.activity-copy strong { display: block; font-size: 11px; line-height: 1.4; }
.activity-copy p { margin: 4px 0 0; color: var(--muted); font-size: 9px; line-height: 1.4; }
.activity-time { color: var(--muted); font-size: 9px; white-space: nowrap; }
.quick-stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.quick-stat { padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); }
.quick-stat span { display: block; color: var(--muted); font-size: 9px; }
.quick-stat strong { display: block; margin-top: 7px; font-size: 17px; }

/* Tables and toolbars */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.toolbar-left, .toolbar-right { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.search-input { position: relative; min-width: 230px; flex: 1; }
.search-input span { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-input input { min-height: 38px; width: 100%; padding: 0 12px 0 34px; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; outline: none; }
.search-input input:focus { border-color: var(--primary); }
.toolbar select, .compact-select { min-height: 38px; max-width: 180px; padding: 0 30px 0 10px; color: var(--text-2); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; outline: none; font-size: 10px; }
.filter-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; color: #fff; background: var(--primary); border-radius: 999px; font-size: 8px; }
.table-card { overflow: hidden; margin-top: 13px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 13px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { position: relative; color: var(--muted); background: var(--surface-2); font-size: 9px; font-weight: 800; letter-spacing: .035em; text-transform: uppercase; white-space: nowrap; }
td { color: var(--text-2); font-size: 10px; }
tbody tr { transition: background .15s ease; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
.product-cell { min-width: 240px; display: flex; align-items: center; gap: 10px; }
.product-thumb { width: 43px; height: 43px; display: grid; place-items: center; flex: 0 0 43px; overflow: hidden; color: var(--thumb-color, #315b70); background: var(--thumb-bg, #e7f0f4); border: 1px solid var(--line); border-radius: 10px; font-size: 11px; font-weight: 850; letter-spacing: -.02em; }
.product-thumb.large { width: 106px; height: 106px; flex-basis: 106px; border-radius: 16px; font-size: 20px; }
.product-name { min-width: 0; }
.product-name strong { display: block; max-width: 230px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.product-name small { display: block; margin-top: 5px; color: var(--muted); font-size: 9px; }
.favorite-button { width: 28px; height: 28px; display: inline-grid; place-items: center; border: 0; border-radius: 8px; color: var(--muted); background: transparent; cursor: pointer; }
.favorite-button.active { color: #d99115; background: var(--warning-soft); }
.price-cell strong { display: block; color: var(--text); font-size: 11px; }
.price-cell small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; }
.action-cell { position: relative; }
.action-menu-button { width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; }
.dropdown-menu { position: absolute; z-index: 160; display: none; min-width: 190px; padding: 6px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); box-shadow: var(--shadow-md); }
.dropdown-menu.show { display: grid; }
.dropdown-menu button, .dropdown-menu a { width: 100%; min-height: 34px; display: flex; align-items: center; gap: 8px; padding: 0 10px; border: 0; border-radius: 7px; color: var(--text-2); background: transparent; text-decoration: none; cursor: pointer; font-size: 10px; text-align: left; }
.dropdown-menu button:hover, .dropdown-menu a:hover { color: var(--text); background: var(--surface-2); }
.dropdown-menu button.danger { color: var(--danger); }
.dropdown-menu hr { width: 100%; margin: 5px 0; border: 0; border-top: 1px solid var(--line); }
.row-action-menu { right: 8px; top: calc(100% - 4px); }
.profile-dropdown { right: 0; top: calc(100% + 8px); }
.notification-dropdown { position: fixed; right: 24px; top: 64px; width: min(390px, calc(100vw - 32px)); max-height: 560px; overflow: hidden; padding: 0; }
.notification-dropdown .dropdown-head { display: flex; align-items: center; justify-content: space-between; padding: 15px; border-bottom: 1px solid var(--line); }
.notification-dropdown .dropdown-head strong { font-size: 13px; }
.notification-dropdown .dropdown-body { max-height: 440px; overflow-y: auto; }
.notification-dropdown .dropdown-foot { padding: 10px; border-top: 1px solid var(--line); }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 14px; border-top: 1px solid var(--line); }
.pagination-info { color: var(--muted); font-size: 9px; }
.pagination-controls { display: flex; align-items: center; gap: 4px; }
.page-button { min-width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 8px; color: var(--text-2); background: var(--surface); cursor: pointer; font-size: 9px; }
.page-button.active { color: #fff; border-color: var(--primary); background: var(--primary); }
.page-button:disabled { opacity: .45; cursor: not-allowed; }
.mobile-product-list { display: none; gap: 11px; margin-top: 13px; }
.product-mobile-card { padding: 15px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.mobile-card-head { display: flex; gap: 11px; align-items: flex-start; }
.mobile-card-head .product-name { flex: 1; }
.mobile-card-head .product-name strong { white-space: normal; line-height: 1.4; }
.mobile-price-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-top: 16px; }
.mobile-price-row .current-price { font-size: 20px; font-weight: 800; letter-spacing: -.03em; }
.mobile-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.mobile-metric { padding: 9px; border-radius: 9px; background: var(--surface-2); }
.mobile-metric span { display: block; color: var(--muted); font-size: 8px; }
.mobile-metric b { display: block; margin-top: 5px; font-size: 10px; }
.mobile-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 9px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }

/* Product detail */
.detail-hero { display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; padding: 20px; }
.detail-main { min-width: 0; }
.detail-main .market-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.detail-main h2 { margin: 0; max-width: 780px; font-size: 21px; line-height: 1.35; letter-spacing: -.025em; }
.detail-main .product-url { display: block; max-width: 700px; margin-top: 8px; color: var(--primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; text-decoration: none; }
.detail-main .detail-meta { display: flex; flex-wrap: wrap; gap: 15px; margin-top: 13px; color: var(--muted); font-size: 10px; }
.detail-price { min-width: 190px; padding-left: 20px; border-left: 1px solid var(--line); text-align: right; }
.detail-price span { display: block; color: var(--muted); font-size: 9px; }
.detail-price strong { display: block; margin: 7px 0 8px; font-size: 27px; letter-spacing: -.04em; }
.detail-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.detail-kpi { padding: 14px 17px; }
.detail-kpi + .detail-kpi { border-left: 1px solid var(--line); }
.detail-kpi span { display: block; color: var(--muted); font-size: 9px; }
.detail-kpi strong { display: block; margin-top: 6px; font-size: 13px; }
.tab-bar { display: flex; gap: 3px; overflow-x: auto; padding: 5px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); }
.tab-button { min-height: 33px; padding: 0 13px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; white-space: nowrap; cursor: pointer; font-size: 10px; font-weight: 750; }
.tab-button.active { color: var(--text); background: var(--surface); box-shadow: var(--shadow-sm); }
.metric-strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-bottom: 17px; }
.metric-box { padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.metric-box span { display: block; color: var(--muted); font-size: 8px; }
.metric-box strong { display: block; margin-top: 7px; font-size: 12px; }
.metric-box small { display: block; margin-top: 5px; color: var(--muted); font-size: 8px; }
.opportunity-callout { display: flex; align-items: flex-start; gap: 12px; padding: 14px; margin-bottom: 17px; border: 1px solid color-mix(in srgb, var(--success) 25%, var(--line)); border-radius: 11px; background: var(--success-soft); }
.opportunity-callout .callout-icon { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 34px; border-radius: 10px; color: var(--success); background: var(--surface); }
.opportunity-callout strong { display: block; color: var(--success); font-size: 11px; }
.opportunity-callout p { margin: 4px 0 0; color: var(--text-2); font-size: 9px; line-height: 1.45; }
.side-info-list { display: grid; gap: 0; }
.info-row { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 10px; }
.info-row:last-child { border-bottom: 0; }
.info-row span { color: var(--muted); }
.info-row strong { text-align: right; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; align-items: center; min-height: 25px; padding: 0 8px; border-radius: 7px; color: var(--text-2); background: var(--surface-3); font-size: 9px; font-weight: 700; }
.notes-box { padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--text-2); font-size: 10px; line-height: 1.5; }
.statistics-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.stat-period-card { padding: 16px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.stat-period-card h4 { margin: 0 0 13px; font-size: 12px; }
.stat-period-values { display: grid; gap: 10px; }
.stat-period-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 10px; }
.stat-period-row span { color: var(--muted); }
.timeline { position: relative; display: grid; }
.timeline-item { position: relative; display: grid; grid-template-columns: 80px 25px 1fr; gap: 10px; min-height: 70px; }
.timeline-item::before { content: ""; position: absolute; left: 92px; top: 23px; bottom: -10px; width: 1px; background: var(--line); }
.timeline-item:last-child::before { display: none; }
.timeline-time { padding-top: 4px; color: var(--muted); font-size: 9px; text-align: right; }
.timeline-dot { position: relative; z-index: 1; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; color: var(--primary); background: var(--primary-soft); border: 4px solid var(--surface); font-size: 7px; }
.timeline-copy { padding: 2px 0 17px; }
.timeline-copy strong { display: block; font-size: 10px; }
.timeline-copy p { margin: 5px 0 0; color: var(--muted); font-size: 9px; line-height: 1.4; }

/* Forms and add product wizard */
.wizard { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 590px; overflow: hidden; }
.wizard-steps { padding: 22px; border-right: 1px solid var(--line); background: var(--surface-2); }
.wizard-steps h3 { margin: 0 0 20px; font-size: 12px; }
.step-item { display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding: 10px 0; color: var(--muted); }
.step-number { width: 26px; height: 26px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--surface); font-size: 9px; font-weight: 800; }
.step-item.active { color: var(--text); }
.step-item.active .step-number { color: #fff; border-color: var(--primary); background: var(--primary); }
.step-item.done .step-number { color: var(--success); border-color: var(--success); background: var(--success-soft); }
.step-copy strong { display: block; font-size: 10px; }
.step-copy small { display: block; margin-top: 4px; font-size: 8px; line-height: 1.35; }
.wizard-content { padding: 28px; }
.wizard-panel { max-width: 770px; margin: 0 auto; }
.wizard-panel h2 { margin: 0; font-size: 22px; letter-spacing: -.025em; }
.wizard-panel > p { margin: 8px 0 25px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.input-hint { margin-top: 6px; color: var(--muted); font-size: 9px; line-height: 1.4; }
.input-error { margin-top: 6px; color: var(--danger); font-size: 9px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 23px; padding-top: 18px; border-top: 1px solid var(--line); }
.url-status { display: flex; align-items: center; gap: 9px; padding: 12px; margin-top: 12px; border-radius: 10px; font-size: 10px; }
.url-status.success { color: var(--success); background: var(--success-soft); }
.url-status.danger { color: var(--danger); background: var(--danger-soft); }
.url-status.warning { color: var(--warning); background: var(--warning-soft); }
.marketplace-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 9px; margin-top: 18px; }
.marketplace-card { position: relative; min-height: 84px; display: grid; place-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); text-align: center; }
.marketplace-card strong { font-size: 10px; }
.marketplace-card small { display: block; margin-top: 4px; color: var(--muted); font-size: 8px; }
.marketplace-card.supported { border-color: color-mix(in srgb, var(--success) 40%, var(--line)); background: var(--success-soft); }
.marketplace-card .future { position: absolute; right: 5px; top: 5px; font-size: 7px; color: var(--muted); }
.test-crawl { display: grid; place-items: center; min-height: 320px; text-align: center; }
.crawl-animation { position: relative; width: 82px; height: 82px; display: grid; place-items: center; margin: 0 auto 18px; border-radius: 50%; background: var(--primary-soft); }
.crawl-animation::before, .crawl-animation::after { content: ""; position: absolute; inset: 7px; border: 2px solid transparent; border-top-color: var(--primary); border-radius: 50%; animation: spin 1.1s linear infinite; }
.crawl-animation::after { inset: 17px; border-top-color: var(--info); animation-direction: reverse; animation-duration: .8s; }
@keyframes spin { to { transform: rotate(360deg); } }
.preview-card { display: grid; grid-template-columns: 110px 1fr; gap: 18px; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.preview-card .preview-data { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.preview-data div { padding: 10px; border-radius: 9px; background: var(--surface); }
.preview-data span { display: block; color: var(--muted); font-size: 8px; }
.preview-data b { display: block; margin-top: 5px; font-size: 10px; }
.variant-options { display: grid; gap: 8px; margin-top: 15px; }
.variant-option { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.variant-option.selected { border-color: var(--primary); background: var(--primary-soft); }
.variant-option input { accent-color: var(--primary); }

/* Alerts, notifications, settings */
.alert-rule { max-width: 300px; line-height: 1.4; }
.switch { position: relative; display: inline-block; width: 36px; height: 21px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line-strong); cursor: pointer; transition: .2s; }
.switch span::before { content: ""; position: absolute; width: 15px; height: 15px; left: 3px; top: 3px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.2); transition: .2s; }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::before { transform: translateX(15px); }
.notification-list { display: grid; }
.notification-item { display: grid; grid-template-columns: 38px 1fr auto; gap: 12px; align-items: flex-start; padding: 15px 17px; border-bottom: 1px solid var(--line); cursor: pointer; }
.notification-item:last-child { border-bottom: 0; }
.notification-item.unread { background: color-mix(in srgb, var(--primary-soft) 48%, var(--surface)); }
.notification-type-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; color: var(--notification-color, var(--primary)); background: var(--notification-bg, var(--primary-soft)); }
.notification-copy strong { display: block; font-size: 10px; line-height: 1.45; }
.notification-copy p { margin: 5px 0 0; color: var(--muted); font-size: 9px; line-height: 1.45; }
.notification-copy small { display: block; margin-top: 7px; color: var(--muted); font-size: 8px; }
.unread-dot { width: 7px; height: 7px; margin-top: 6px; border-radius: 50%; background: var(--primary); }
.settings-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 16px; }
.settings-nav { align-self: start; padding: 7px; position: sticky; top: calc(var(--topbar-height) + 16px); }
.settings-nav button { width: 100%; min-height: 38px; display: flex; align-items: center; gap: 9px; padding: 0 10px; border: 0; border-radius: 8px; color: var(--text-2); background: transparent; cursor: pointer; font-size: 10px; text-align: left; }
.settings-nav button.active { color: var(--primary); background: var(--primary-soft); font-weight: 750; }
.setting-section { padding: 20px; }
.setting-section + .setting-section { border-top: 1px solid var(--line); }
.setting-section h3 { margin: 0; font-size: 13px; }
.setting-section > p { margin: 6px 0 17px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 56px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.setting-copy strong { display: block; font-size: 10px; }
.setting-copy small { display: block; margin-top: 4px; color: var(--muted); font-size: 8px; line-height: 1.45; }
.color-options { display: flex; gap: 7px; }
.color-option { width: 25px; height: 25px; border: 3px solid var(--surface); border-radius: 50%; box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.color-option.selected { box-shadow: 0 0 0 2px var(--text); }
.state-preview-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.state-card { min-height: 120px; display: grid; place-items: center; padding: 14px; border: 1px dashed var(--line-strong); border-radius: 11px; background: var(--surface-2); text-align: center; }
.state-card .state-icon { width: 38px; height: 38px; display: grid; place-items: center; margin: 0 auto 9px; border-radius: 10px; color: var(--muted); background: var(--surface-3); }
.state-card strong { display: block; font-size: 10px; }
.state-card p { margin: 5px 0 0; color: var(--muted); font-size: 8px; line-height: 1.4; }
.skeleton { position: relative; overflow: hidden; background: var(--surface-3); border-radius: 7px; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.42), transparent); animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.skeleton-line { height: 8px; margin: 7px 0; }

/* Compare and reports */
.compare-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.compare-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 37px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); font-size: 9px; }
.compare-chip button { width: 20px; height: 20px; border: 0; border-radius: 50%; color: var(--muted); background: var(--surface-3); cursor: pointer; }
.best-value { position: relative; }
.best-value::after { content: "Best"; position: absolute; right: 5px; top: 4px; padding: 2px 5px; border-radius: 999px; color: var(--success); background: var(--success-soft); font-size: 7px; font-weight: 800; }
.report-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.report-card { padding: 17px; cursor: pointer; transition: transform .16s ease, border-color .16s ease; }
.report-card:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.report-icon { width: 38px; height: 38px; display: grid; place-items: center; margin-bottom: 15px; border-radius: 10px; color: var(--report-color, var(--primary)); background: var(--report-bg, var(--primary-soft)); }
.report-card h3 { margin: 0; font-size: 12px; }
.report-card p { min-height: 42px; margin: 7px 0 15px; color: var(--muted); font-size: 9px; line-height: 1.5; }
.report-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 8px; }

/* Modals, drawer, sheets, toasts */
.modal-backdrop, .sidebar-overlay { position: fixed; inset: 0; z-index: 190; display: none; background: var(--overlay); backdrop-filter: blur(2px); }
.modal-backdrop.show, .sidebar-overlay.show { display: block; }
.modal { position: fixed; z-index: 200; left: 50%; top: 50%; display: none; width: min(620px, calc(100vw - 30px)); max-height: min(820px, calc(100vh - 32px)); overflow: hidden; transform: translate(-50%, -48%) scale(.98); opacity: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); transition: opacity .18s ease, transform .18s ease; }
.modal.show { display: block; opacity: 1; transform: translate(-50%, -50%) scale(1); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 16px; }
.modal-head p { margin: 5px 0 0; color: var(--muted); font-size: 9px; }
.modal-body { max-height: calc(100vh - 200px); overflow-y: auto; padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); }
.filter-drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 210; width: min(390px, 90vw); padding: 20px; overflow-y: auto; background: var(--surface); box-shadow: var(--shadow-lg); transform: translateX(105%); transition: transform .25s ease; }
.filter-drawer.show { transform: translateX(0); }
.filter-drawer-head, .sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.filter-drawer-head h2 { margin: 0; font-size: 17px; }
.bottom-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 210; display: none; padding: 9px 18px calc(22px + env(safe-area-inset-bottom)); background: var(--surface); border-radius: 20px 20px 0 0; box-shadow: var(--shadow-lg); transform: translateY(105%); transition: transform .25s ease; }
.bottom-sheet.show { transform: translateY(0); }
.sheet-handle { width: 38px; height: 4px; margin: 2px auto 17px; border-radius: 999px; background: var(--line-strong); }
.more-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.more-grid button { min-height: 82px; display: grid; place-items: center; gap: 4px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); cursor: pointer; font-size: 9px; }
.more-grid button span { font-size: 20px; color: var(--primary); }
.toast-region { position: fixed; z-index: 300; right: 18px; bottom: 18px; display: grid; gap: 9px; width: min(360px, calc(100vw - 36px)); }
.toast { display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: center; padding: 12px 13px; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--toast-color, var(--success)); border-radius: 11px; box-shadow: var(--shadow-md); animation: toastIn .25s ease; }
.toast-icon { width: 28px; height: 28px; display: grid; place-items: center; color: var(--toast-color, var(--success)); background: var(--toast-bg, var(--success-soft)); border-radius: 8px; }
.toast strong { display: block; font-size: 10px; }
.toast p { margin: 3px 0 0; color: var(--muted); font-size: 8px; line-height: 1.4; }
.toast button { border: 0; color: var(--muted); background: transparent; cursor: pointer; }
@keyframes toastIn { from { transform: translateY(12px); opacity: 0; } }

/* Mobile bottom navigation */
.mobile-bottom-nav { display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; height: calc(var(--mobile-bottom-height) + env(safe-area-inset-bottom)); padding: 7px 8px env(safe-area-inset-bottom); border-top: 1px solid var(--line); background: var(--surface-elevated); backdrop-filter: blur(16px); }
.mobile-bottom-nav button { position: relative; flex: 1; display: grid; place-items: center; gap: 2px; border: 0; color: var(--muted); background: transparent; cursor: pointer; }
.mobile-bottom-nav button > span { font-size: 19px; }
.mobile-bottom-nav button small { font-size: 8px; }
.mobile-bottom-nav button.active { color: var(--primary); font-weight: 800; }
.mobile-bottom-nav .mobile-add-button > span { width: 39px; height: 39px; display: grid; place-items: center; margin-top: -20px; color: #fff; background: var(--primary); border-radius: 13px; box-shadow: 0 8px 22px color-mix(in srgb, var(--primary) 34%, transparent); font-size: 24px; }

/* Empty and error states */
.empty-state { display: grid; place-items: center; min-height: 310px; padding: 30px; text-align: center; }
.empty-illustration { width: 82px; height: 82px; display: grid; place-items: center; margin-bottom: 18px; border-radius: 24px; color: var(--muted); background: var(--surface-2); border: 1px dashed var(--line-strong); font-size: 31px; }
.empty-state h3 { margin: 0; font-size: 15px; }
.empty-state p { max-width: 430px; margin: 8px 0 18px; color: var(--muted); font-size: 10px; line-height: 1.55; }
.error-state .empty-illustration { color: var(--danger); background: var(--danger-soft); }

/* Responsive */
@media (max-width: 1180px) {
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .report-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-kpis { grid-template-columns: repeat(3, 1fr); }
  .detail-kpi:nth-child(4) { border-left: 0; border-top: 1px solid var(--line); }
  .detail-kpi:nth-child(5) { border-top: 1px solid var(--line); }
}

@media (max-width: 980px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .mobile-login-brand { display: flex; }
  .login-panel { padding: 44px 26px; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { width: min(290px, 86vw); transform: translateX(-105%); box-shadow: var(--shadow-lg); }
  .sidebar.mobile-open { transform: translateX(0); }
  .app-main { grid-column: 1; }
  .mobile-menu-button { display: inline-grid; }
  .topbar { padding: 0 18px; }
  .global-search { width: min(430px, 47vw); }
  .profile-copy, .profile-button > span:last-child, .connection-status { display: none; }
  .page-content { padding: 22px 18px; }
  .grid-dashboard, .grid-detail { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wizard { grid-template-columns: 180px 1fr; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; display: flex; overflow-x: auto; }
  .settings-nav button { width: auto; white-space: nowrap; }
}

@media (max-width: 720px) {
  :root { --topbar-height: 61px; }
  body { padding-bottom: var(--mobile-bottom-height); }
  .topbar { padding: 0 13px; }
  .global-search { width: auto; flex: 1; height: 37px; }
  .global-search kbd { display: none; }
  .topbar-left { flex: 1; min-width: 0; }
  .topbar-actions { gap: 6px; }
  #theme-toggle, .profile-button { display: none; }
  .page-content { padding: 18px 13px 24px; }
  .mobile-bottom-nav { display: flex; }
  .bottom-sheet { display: block; }
  .page-header { align-items: flex-start; margin-bottom: 18px; }
  .page-header h1 { font-size: 27px; }
  .page-header p { font-size: 11px; }
  .page-actions .hide-mobile { display: none; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .summary-card { min-height: 112px; padding: 14px; }
  .summary-value { font-size: 21px; }
  .summary-label { font-size: 10px; }
  .grid-2, .grid-3, .grid-4, .statistics-grid { grid-template-columns: 1fr; }
  .card-head { padding: 16px; }
  .card-body { padding: 16px; }
  .section { margin-top: 18px; }
  .chart-card canvas { height: 235px; }
  .donut-wrap { grid-template-columns: 1fr; }
  .donut-wrap canvas { height: 190px; }
  .toolbar { padding: 11px; }
  .toolbar-left { flex: 1; width: 100%; }
  .search-input { min-width: 0; width: 100%; }
  .desktop-filter, .desktop-table { display: none; }
  .mobile-product-list { display: grid; }
  .table-card.mobile-hide { display: none; }
  .pagination { padding: 12px 0 0; border-top: 0; }
  .detail-hero { grid-template-columns: auto 1fr; align-items: flex-start; padding: 16px; }
  .product-thumb.large { width: 72px; height: 72px; flex-basis: 72px; }
  .detail-main h2 { font-size: 16px; }
  .detail-price { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; min-width: 0; padding: 14px 0 0; border-left: 0; border-top: 1px solid var(--line); text-align: left; }
  .detail-price strong { font-size: 24px; }
  .detail-kpis { grid-template-columns: repeat(2, 1fr); }
  .detail-kpi:nth-child(n) { border-top: 1px solid var(--line); border-left: 0; }
  .detail-kpi:nth-child(even) { border-left: 1px solid var(--line); }
  .detail-kpi:first-child, .detail-kpi:nth-child(2) { border-top: 0; }
  .metric-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-toolbar { display: grid; gap: 9px; }
  .range-control { max-width: 100%; overflow-x: auto; }
  .range-control button { flex: 0 0 auto; }
  .timeline-item { grid-template-columns: 56px 25px 1fr; }
  .timeline-item::before { left: 68px; }
  .wizard { grid-template-columns: 1fr; min-height: 0; }
  .wizard-steps { display: flex; overflow-x: auto; padding: 12px 14px; border-right: 0; border-bottom: 1px solid var(--line); }
  .wizard-steps h3, .step-copy small { display: none; }
  .step-item { flex: 0 0 auto; align-items: center; padding: 6px 9px; }
  .wizard-content { padding: 20px 15px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .marketplace-grid { grid-template-columns: repeat(2, 1fr); }
  .preview-card { grid-template-columns: 1fr; }
  .preview-card .preview-data { grid-template-columns: repeat(2, 1fr); }
  .settings-layout { gap: 10px; }
  .state-preview-grid { grid-template-columns: repeat(2, 1fr); }
  .report-grid { grid-template-columns: 1fr; }
  .modal { width: calc(100vw - 20px); max-height: calc(100vh - 20px); border-radius: 15px; }
  .modal-body { max-height: calc(100vh - 176px); }
  .toast-region { bottom: calc(var(--mobile-bottom-height) + 12px); }
  .notification-dropdown { top: 58px; right: 10px; }
}

@media (max-width: 430px) {
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .summary-card { min-height: 106px; }
  .summary-note { display: none; }
  .page-header { display: grid; }
  .page-actions { justify-content: flex-start; }
  .page-actions .btn { flex: 1; }
  .visual-stats { grid-template-columns: 1fr; }
  .metric-strip { grid-template-columns: 1fr 1fr; }
  .form-actions { position: sticky; bottom: calc(var(--mobile-bottom-height) - 1px); z-index: 10; margin-left: -15px; margin-right: -15px; margin-bottom: -20px; padding: 12px 15px calc(12px + env(safe-area-inset-bottom)); background: var(--surface); }
  .form-actions .btn { flex: 1; }
  .state-preview-grid { grid-template-columns: 1fr; }
}

@media print {
  .sidebar, .topbar, .mobile-bottom-nav, .page-actions, .toolbar, .btn, .toast-region { display: none !important; }
  .app-shell { display: block; }
  .app-main { display: block; }
  .page-content { padding: 0; }
  .card, .table-card { box-shadow: none; break-inside: avoid; }
  body { background: #fff; color: #111; }
}
