:root {
  --bg: #f4f8fd;
  --panel: #ffffff;
  --panel-soft: #f8fbff;
  --ink: #15253a;
  --muted: #647892;
  --line: #d6e5f3;
  --brand: #3b82f6;
  --brand-deep: #2563eb;
  --success: #0f9d58;
  --warning: #b76d00;
  --shadow: 0 18px 40px rgba(37, 99, 235, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top right, rgba(59, 130, 246, 0.12), transparent 24rem),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 100%);
}

button,
input {
  font: inherit;
}

input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
}

button {
  min-height: 46px;
  border: 0;
  border-radius: 14px;
  padding: 0 16px;
  font-weight: 800;
  cursor: pointer;
  background: var(--brand);
  color: #fff;
  box-shadow: 0 10px 22px rgba(59, 130, 246, 0.22);
  transition: transform 140ms ease, background-color 140ms ease, box-shadow 140ms ease;
}

button:hover {
  transform: translateY(-1px);
  background: var(--brand-deep);
}

button.secondary,
button.ghost,
button.danger {
  box-shadow: none;
}

button.secondary {
  background: #eaf2ff;
  color: var(--brand-deep);
}

button.ghost {
  background: #f4f7fb;
  color: #35506f;
}

button.danger {
  background: #fff1f2;
  color: #dc2626;
}

button.danger:hover {
  background: #ffe4e6;
}

input {
  width: 100%;
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0 14px;
  color: var(--ink);
}

.app-shell {
  min-height: 100vh;
  padding: 14px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0;
  color: var(--brand);
  font-weight: 800;
  font-size: 0.86rem;
}

.status {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.status.error {
  color: #c62828;
}

.field {
  display: grid;
  gap: 6px;
}

.remember-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #3a4f6b;
  font-size: 0.92rem;
  font-weight: 700;
}

label {
  color: #3a4f6b;
  font-size: 0.92rem;
  font-weight: 700;
}

.login-shell {
  min-height: calc(100vh - 28px);
  display: grid;
  gap: 18px;
  align-content: center;
}

.login-brand,
.login-card {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
}

.login-brand h1,
.hero h1 {
  margin: 6px 0 8px;
  font-size: clamp(2rem, 8vw, 3.2rem);
  line-height: 1;
}

.login-brand p:last-child,
.hero p:last-child,
.section-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.login-card {
  padding: 20px;
  display: grid;
  gap: 14px;
}

.dashboard-shell,
.content-grid,
.kpi-grid,
.product-grid,
.sync-grid {
  display: grid;
  gap: 14px;
}

.hero,
.filters,
.section-card {
  padding: 18px;
}

.hero {
  display: grid;
  gap: 8px;
  padding: 10px 16px;
}

.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hero-copy h1 {
  margin: 0;
  font-size: clamp(1.45rem, 3.2vw, 1.9rem);
  line-height: 1;
}

.icon-btn {
  min-width: 42px;
  min-height: 42px;
  padding: 0 12px;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-only {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
}

.btn-label {
  display: none;
}

.accordion-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.accordion-icon {
  font-size: 1.1rem;
  font-weight: 900;
}

.filters-panel {
  display: none;
  gap: 14px;
}

.filters-panel.open {
  display: grid;
}

.filters {
  display: grid;
  gap: 12px;
}

.filters-top,
.filters-actions,
.view-tabs {
  display: grid;
  gap: 10px;
}

.filters-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.view-tabs {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tab-btn {
  min-height: 44px;
}

.tab-btn.active {
  background: var(--brand);
  color: #fff;
}

.chip-btn {
  min-height: 42px;
}

.metric {
  padding: 18px;
  background: linear-gradient(180deg, #fff 0%, var(--panel-soft) 100%);
}

.metric.primary {
  background: linear-gradient(135deg, var(--brand) 0%, #5fa0ff 100%);
  color: #fff;
}

.metric-label {
  display: block;
  font-size: 0.92rem;
  color: inherit;
  opacity: 0.82;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 2rem;
  line-height: 1.1;
}

.metric small {
  display: block;
  margin-top: 6px;
  color: inherit;
  opacity: 0.86;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.section-head h2 {
  margin: 4px 0 0;
  font-size: 1.35rem;
}

.section-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.report-list,
.stack-list {
  display: grid;
  gap: 12px;
}

.report-item,
.product-card,
.sync-card,
.stack-row {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-soft);
}

.report-item,
.product-card,
.sync-card {
  padding: 14px;
}

.sync-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.84rem;
}

.report-top strong,
.stack-row strong,
.product-card strong,
.sync-card strong {
  display: block;
}

.report-top,
.report-meta,
.report-metrics,
.product-meta,
.stack-row,
.branch-grid {
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.report-top {
  align-items: flex-start;
}

.report-top p,
.report-meta,
.report-metrics,
.product-card p,
.stack-row p,
.branch-grid span,
.empty-state p,
.empty-mini {
  margin: 0;
  color: var(--muted);
}

.report-meta,
.report-metrics {
  margin-top: 10px;
  flex-wrap: wrap;
  font-size: 0.9rem;
}

.report-money {
  font-weight: 900;
  color: var(--success);
}

.stack-row {
  padding: 14px;
  align-items: center;
}

.stack-row span:last-child {
  font-weight: 900;
}

.branch-grid {
  flex-wrap: wrap;
  margin-top: 14px;
}

.branch-grid > div {
  min-width: 140px;
  flex: 1 1 140px;
  padding: 12px;
  border-radius: 14px;
  background: #fff;
}

.branch-grid strong {
  display: block;
  margin-top: 6px;
}

.rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #dbeafe;
  color: var(--brand-deep);
  font-weight: 900;
  margin-bottom: 12px;
}

.empty-state,
.empty-mini {
  text-align: center;
}

.empty-state {
  padding: 28px 12px;
}

.empty-state strong {
  display: block;
  margin-bottom: 8px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(8px);
  z-index: 100;
}

.modal-card {
  width: min(760px, 100%);
  max-height: calc(100vh - 28px);
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: 0 28px 60px rgba(15, 23, 42, 0.25);
  padding: 18px;
}

.modal-head {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.modal-head h2 {
  margin: 6px 0 8px;
}

.modal-grid {
  display: grid;
  gap: 14px;
}

.copy-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.inline-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.steps {
  margin-top: 18px;
  padding: 16px;
  border-radius: 18px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.steps strong {
  display: block;
  margin-bottom: 8px;
}

.steps p {
  margin: 0 0 6px;
  color: var(--muted);
}

.reset-block {
  margin-top: 18px;
  padding: 16px;
  border-radius: 18px;
  background: #fff6f6;
  border: 1px solid #fecaca;
  display: grid;
  gap: 10px;
}

.reset-block strong {
  display: block;
  color: #b91c1c;
}

.reset-block p {
  margin: 0;
  color: #7f1d1d;
}

@media (min-width: 640px) {
  .app-shell {
    padding: 20px;
  }

  .hero-actions {
    justify-content: flex-start;
  }

  .filters-actions,
  .view-tabs {
    grid-template-columns: repeat(4, max-content);
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .copy-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .btn-label {
    display: inline;
  }

  .icon-btn {
    gap: 10px;
    padding: 0 14px;
  }
}

@media (min-width: 860px) {
  .app-shell {
    padding: 24px;
  }

  .hero {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
  }

  .filters-top {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
    align-items: end;
  }

  .filters-actions {
    grid-template-columns: auto repeat(3, max-content);
    justify-content: start;
  }

  .view-tabs {
    grid-template-columns: repeat(4, max-content);
  }

  .kpi-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .content-grid {
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
    align-items: start;
  }

  .content-grid.single-column {
    grid-template-columns: minmax(0, 1fr);
  }

  .product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .sync-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .modal-head {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: flex-start;
  }

  .accordion-btn {
    display: none;
  }

  .filters-panel {
    display: grid;
  }
}
