:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #667085;
  --subtle: #98a2b3;
  --panel: #ffffff;
  --line: #d9e1ea;
  --wash: #f4f7fb;
  --sidebar: #101820;
  --sidebar-soft: #1b2733;
  --teal: #0f766e;
  --teal-soft: #d8f3ee;
  --blue: #2563eb;
  --blue-soft: #dbeafe;
  --coral: #db5f4a;
  --coral-soft: #fee4dd;
  --amber: #d99a27;
  --amber-soft: #fff1c7;
  --violet: #7c3aed;
  --track: #ecf0f4;
  --shadow: 0 16px 40px rgba(16, 24, 32, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--wash);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  width: 100%;
  min-width: 0;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  min-width: 0;
  padding: 22px 16px;
  background: var(--sidebar);
  color: #ffffff;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 30px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: #ffffff;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.brand-name,
.brand-subtitle,
.eyebrow,
.panel p,
.metric-card p,
.metric-card span {
  margin: 0;
}

.brand-name {
  font-size: 18px;
  font-weight: 850;
}

.brand-subtitle {
  color: rgba(255, 255, 255, 0.66);
  font-size: 13px;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.76);
  background: transparent;
  text-align: left;
}

.nav-item.active {
  color: #ffffff;
  background: var(--sidebar-soft);
  font-weight: 800;
}

.nav-item.active .nav-icon {
  color: #ffffff;
  background: var(--teal);
}

.nav-item:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.nav-icon {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 12px;
  font-weight: 850;
}

.workspace {
  width: 100%;
  min-width: 0;
  max-width: 1520px;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.eyebrow {
  margin-bottom: 5px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 32px;
  line-height: 1.12;
}

h2 {
  font-size: 18px;
  line-height: 1.2;
}

.actions {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.period-control,
.panel-controls label,
.sheet-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.period-control input,
.panel-controls input {
  width: 142px;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--panel);
}

.upload-button,
.sheet-form button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 15px;
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  background: var(--sidebar);
  cursor: pointer;
  font-weight: 850;
}

.secondary-button {
  border: 1px solid var(--sidebar) !important;
  color: var(--sidebar) !important;
  background: transparent !important;
}

.upload-button input {
  display: none;
}

.sheet-connect {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 18px;
  align-items: end;
  margin-bottom: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.sheet-copy h2 {
  margin-top: 4px;
}

.section-kicker {
  margin: 0;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.sheet-copy p:last-child {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.sheet-form {
  display: flex;
  gap: 10px;
  align-items: end;
  justify-content: flex-end;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.metric-card,
.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric-card {
  min-height: 132px;
  padding: 18px;
}

.metric-card p {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.metric-card strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 30px;
  line-height: 1.1;
}

.metric-card span {
  color: var(--muted);
  font-size: 13px;
}

.metric-card:nth-child(1) {
  border-top: 4px solid var(--blue);
}

.metric-card:nth-child(2) {
  border-top: 4px solid var(--violet);
}

.metric-card:nth-child(3) {
  border-top: 4px solid var(--teal);
}

.metric-card:nth-child(4) {
  border-top: 4px solid var(--coral);
}

.metric-card:nth-child(5) {
  border-top: 4px solid var(--amber);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.panel {
  padding: 18px;
}

.panel-wide {
  grid-column: 1 / -1;
}

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

.panel-header p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.panel-controls {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.chart-area {
  position: relative;
  min-height: 310px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
}

.chart-area.offer-chart {
  min-height: 290px;
}

.chart-area.tall {
  min-height: 460px;
  max-height: 640px;
  overflow: auto;
}

.chart-area.scroll-chart {
  min-height: 380px;
  max-height: 560px;
  overflow: auto;
}

.bar-label,
.axis-label,
.legend-label {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.bar-value {
  fill: var(--ink);
  font-size: 12px;
  font-weight: 850;
}

.grid-line {
  stroke: var(--line);
  stroke-width: 1;
}

.empty-state {
  display: grid;
  min-height: 220px;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.offer-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 850;
}

.offer-discount-50 {
  color: #9f2f21;
  background: var(--coral-soft);
}

.offer-free-product {
  color: #075e56;
  background: var(--teal-soft);
}

.offer-discount-30 {
  color: #7c5300;
  background: var(--amber-soft);
}

.offer-missing {
  color: #475467;
  background: var(--track);
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
  }

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

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

@media (max-width: 760px) {
  .workspace {
    padding: 18px 14px;
  }

  .topbar,
  .actions,
  .sheet-connect,
  .panel-header {
    display: grid;
    justify-content: stretch;
  }

  .period-control input,
  .panel-controls input,
  .upload-button,
  .sheet-form button {
    width: 100%;
  }

  .panel-controls,
  .sheet-form {
    display: grid;
    grid-template-columns: 1fr;
  }

  .nav-list,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 26px;
  }
}
