:root {
  --ink: #0a2149;
  --muted: #707783;
  --line: #e6e8ec;
  --paper: #ffffff;
  --surface: #f4f5f6;
  --blue: #1769f6;
  --blue-soft: #edf4ff;
  --green: #168765;
  --red: #e34b55;
  --navy: #071b67;
  --shadow: none;
}

html {
  background: var(--navy);
}

body {
  background: var(--navy);
  color: var(--ink);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

.crumb h1,
.section-head h2,
.section-intro h2,
.modal h2,
.setting-card h3,
.auth-card h1,
.kpi strong,
.marketplace-stats strong,
.supply-stat strong,
.live-kpis strong,
.live-empty strong {
  font-family: Manrope, Arial, sans-serif;
}

button,
input,
select {
  transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease, opacity 160ms ease;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(23, 105, 246, 0.2);
  outline-offset: 2px;
}

.app-shell {
  min-height: 100vh;
  grid-template-columns: 250px minmax(0, 1fr);
  background: var(--navy);
  transition: grid-template-columns 220ms ease;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 3;
  height: 100vh;
  padding: 0 16px 22px;
  overflow: hidden;
  background: var(--navy);
  color: var(--ink);
  transition: padding 220ms ease;
}

.sidebar::before {
  content: '';
  position: absolute;
  z-index: 0;
  inset: 88px 0 0;
  border-radius: 32px 0 0;
  background: var(--surface);
}

.sidebar > * {
  position: relative;
  z-index: 1;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 88px;
  padding: 0 10px;
}

.sidebar-header .brand {
  flex: 1 1 auto;
  min-width: 0;
  height: 46px;
  margin: 0;
  padding: 0 14px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  color: #fff;
  font: 700 20px 'Space Grotesk', sans-serif;
  letter-spacing: 1.5px;
  white-space: nowrap;
}

.sidebar-header .brand .brand-mark {
  display: none;
}

.sidebar-toggle {
  display: grid;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 50%;
  place-items: center;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.18);
}

.sidebar-toggle span {
  font-size: 25px;
  line-height: 1;
  transform: translateY(-1px);
  transition: transform 220ms ease;
}

.sidebar nav {
  gap: 6px;
  margin-top: 26px;
}

.nav-item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  border-radius: 11px;
  color: #24272d;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.nav-item .nav-icon {
  display: inline-grid;
  flex: 0 0 25px;
  width: 25px;
  margin-right: 8px;
  place-items: center;
  color: #24272d;
  font-size: 20px;
}

.nav-label,
.sidebar-status-copy,
.brand-label {
  overflow: hidden;
  opacity: 1;
  transition: opacity 140ms ease;
}

.nav-item .nav-label {
  margin-right: 0;
  font-size: 14px;
}

.nav-item.active,
.nav-item:hover {
  background: #e9e9ea;
  color: #111827;
}

.sidebar-bottom {
  display: flex;
  align-items: flex-start;
  margin: auto 0 0;
  padding: 18px 13px 4px;
  border-top: 1px solid var(--line);
  color: #444b55;
  line-height: 1.6;
}

.sidebar-bottom .status-dot {
  flex: 0 0 auto;
  margin-top: 7px;
}

.sidebar small {
  color: #7c838d;
}

main {
  min-width: 0;
  background: var(--navy);
}

.topbar {
  height: 88px;
  padding: 0 32px;
  border: 0;
  background: var(--navy);
  color: #fff;
}

.crumb {
  gap: 12px;
  align-items: center;
}

.crumb span {
  color: rgba(255, 255, 255, 0.64);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.crumb h1 {
  color: #fff;
  font: 500 18px Manrope, sans-serif;
}

.top-actions {
  gap: 10px;
}

.icon-button,
.avatar {
  width: 42px;
  height: 42px;
  border-color: rgba(255, 255, 255, 0.26);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.18);
}

.avatar {
  border: 4px solid rgba(255, 255, 255, 0.2);
  background: #fff;
  color: var(--ink);
}

.user-menu {
  top: 50px;
  border-color: var(--line);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(10, 33, 73, 0.16);
}

.admin-key-badge {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.view {
  max-width: none;
}

.view.active {
  display: block;
  min-height: calc(100vh - 88px);
  padding: 38px 36px 64px;
  border-radius: 0;
  background: var(--surface);
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 76px minmax(0, 1fr);
}

.sidebar-collapsed .sidebar {
  padding-inline: 10px;
}

.sidebar-collapsed .sidebar-header {
  justify-content: center;
  padding-inline: 0;
}

.sidebar-collapsed .sidebar-header .brand {
  display: none;
}

.sidebar-collapsed .sidebar-toggle span {
  transform: translateY(-1px) rotate(180deg);
}

.sidebar-collapsed .sidebar nav {
  justify-items: center;
}

.sidebar-collapsed .nav-item {
  justify-content: center;
  width: 52px;
  padding-inline: 11px;
}

.sidebar-collapsed .nav-item .nav-icon {
  margin-right: 0;
}

.sidebar-collapsed .nav-label,
.sidebar-collapsed .sidebar-status-copy {
  width: 0;
  opacity: 0;
}

.sidebar-collapsed .sidebar-bottom {
  justify-content: center;
  padding-inline: 0;
}

.sidebar-collapsed .sidebar-bottom .status-dot {
  margin-right: 0;
}

.section-intro {
  margin-bottom: 26px;
}

.section-intro h2 {
  color: var(--ink);
  font: 700 34px 'Space Grotesk', sans-serif;
  letter-spacing: -0.03em;
}

.section-intro p:not(.eyebrow) {
  max-width: 760px;
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.6;
}

.eyebrow {
  margin-bottom: 7px;
  color: var(--blue);
  letter-spacing: 0.11em;
}

.card,
.kpi,
.supply-stat,
.cluster-card {
  border-color: transparent;
  border-radius: 16px;
  box-shadow: none;
}

.card {
  padding: 24px;
  margin-bottom: 20px;
}

.kpis {
  gap: 18px;
  margin-bottom: 20px;
}

.kpi {
  padding: 21px;
}

.kpi label,
.supply-stat span,
th {
  color: #7b8088;
}

.kpi strong {
  margin-top: 9px;
  color: var(--ink);
  font-size: 25px;
}

.button {
  min-height: 40px;
  padding: 10px 16px;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 700;
}

.button-primary {
  background: var(--blue);
  color: #fff;
}

.button-primary:hover {
  background: #0d5ee6;
}

.button-ghost {
  border-color: transparent;
  background: #ebebec;
  color: #262a31;
}

.button-ghost:hover {
  background: #e1e2e4;
}

.planning-toolbar,
.year-switcher,
.supply-section-tabs,
.supply-view-switch,
.supply-create-controls {
  border-color: transparent;
  box-shadow: none;
}

.year-switcher,
.supply-create-controls {
  background: #fff;
}

.month-tab.active,
.supply-section-tabs button.active,
.supply-view-switch button.active {
  background: #fff;
  color: var(--blue);
  box-shadow: none;
}

.month-tab:hover {
  color: var(--ink);
}

.marketplace-grid,
.settings-grid {
  gap: 20px;
}

.marketplace-card {
  padding: 25px;
}

.section-head h2,
.modal h2 {
  color: var(--ink);
  font-size: 21px;
}

.tag {
  border-radius: 999px;
}

.input-with-suffix,
.setting-card input,
.modal input,
.sales-input,
.price-input,
.status-select,
.supply-toolbar input[type='search'],
.supply-toolbar input[type='number'],
.supply-toolbar select,
.live-toolbar select {
  border-color: var(--line);
  border-radius: 10px;
  background: #fafafa;
}

.input-with-suffix:focus-within,
.setting-card input:focus,
.modal input:focus,
.sales-input:focus,
.price-input:focus {
  border-color: var(--blue);
  background: #fff;
}

.table-card {
  padding: 0;
  overflow: hidden;
}

.table-card > .section-head {
  margin: 0;
  padding: 23px 24px 19px;
}

.table-wrap {
  scrollbar-color: #c9cdd3 transparent;
}

table {
  background: #fff;
}

th {
  padding: 13px 14px;
  border-top: 1px solid #f0f1f2;
  background: #fbfbfb;
  font-size: 10px;
}

td {
  padding: 15px 14px;
  border-top-color: #eff0f2;
}

tbody tr:hover {
  background: #fafbfc;
}

.settings-grid {
  max-width: 1280px;
}

.setting-card {
  min-height: 230px;
}

.setting-card h3 {
  margin-bottom: 18px;
  color: var(--ink);
  font-size: 18px;
}

.connection {
  padding: 13px;
  border-radius: 11px;
  background: #f3f3f4;
}

.connection.is-active {
  background: #edf8f4;
}

.helper {
  color: var(--muted);
  line-height: 1.6;
}

.supply-summary {
  gap: 18px;
}

.supply-stat {
  padding: 20px;
}

.cluster-card {
  border-color: transparent;
}

.cluster-head {
  min-height: 58px;
  padding: 16px 20px;
}

.cluster-body {
  border-top-color: #eff0f2;
}

.modal {
  border-radius: 18px;
  box-shadow: 0 28px 80px rgba(4, 18, 58, 0.25);
}

.modal::backdrop {
  background: rgba(4, 18, 58, 0.58);
  backdrop-filter: blur(3px);
}

.auth-gate {
  background: rgba(4, 18, 58, 0.76);
}

.auth-card {
  border-radius: 22px;
  box-shadow: 0 32px 90px rgba(2, 13, 48, 0.32);
}

.auth-card .brand {
  padding-left: 0;
}

.auth-card .brand-mark {
  background: var(--navy);
}

.toast {
  border-radius: 12px;
  background: var(--navy);
}

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

  .sidebar-header .brand {
    padding-inline: 12px;
  }

  .view.active {
    padding-inline: 28px;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  html,
  body,
  main {
    background: var(--surface);
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .topbar {
    height: 76px;
    padding: 0 20px;
    background: var(--navy);
  }

  .crumb span,
  .admin-key-badge {
    display: none;
  }

  .view.active {
    min-height: calc(100vh - 76px);
    padding: 26px 20px 48px;
    border-radius: 0;
  }

  .section-intro h2 {
    font-size: 29px;
  }
}

@media (max-width: 560px) {
  .topbar {
    padding-inline: 16px;
  }

  .crumb h1 {
    font-size: 16px;
  }

  .icon-button,
  .avatar {
    width: 38px;
    height: 38px;
  }

  .view.active {
    padding: 22px 14px 40px;
  }

  .card,
  .marketplace-card {
    padding: 20px;
  }

  .table-card {
    padding: 0;
  }
}
