:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-strong: #f9fafb;
  --ink: #17202a;
  --muted: #657282;
  --soft: #d7dee7;
  --line: #e5eaf0;
  --brand: #126b63;
  --brand-strong: #0b4d48;
  --brand-soft: #dff3ef;
  --accent: #b34f2a;
  --accent-soft: #f8e7df;
  --blue: #2563eb;
  --blue-soft: #e4edff;
  --green: #14804a;
  --green-soft: #e3f7ec;
  --red: #b42318;
  --red-soft: #fee4e2;
  --amber: #b54708;
  --amber-soft: #fff0d8;
  --shadow: 0 18px 50px rgba(23, 32, 42, 0.08);
  --radius: 8px;
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
}

body {
  overflow-x: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.crm-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  background: #0f2728;
  color: #f8fbfb;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 6px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  color: #ffffff;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0)),
    var(--brand);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.brand-copy strong {
  font-size: 18px;
}

.brand-copy span {
  color: #a9bdbe;
  font-size: 12px;
}

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

.nav button,
.quick-action {
  border: 0;
  color: inherit;
  background: transparent;
  min-height: 42px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  text-align: left;
}

.nav button svg,
.quick-action svg,
.icon-button svg,
.button svg,
.tool-button svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.nav button {
  color: #cad7d8;
}

.nav button:hover,
.nav button.active {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.sidebar-section {
  display: grid;
  gap: 10px;
}

.sidebar-label {
  font-size: 11px;
  line-height: 1;
  color: #8da6a7;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0 10px;
}

.quick-panel {
  margin-top: auto;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  padding: 12px;
  display: grid;
  gap: 12px;
}

.quick-panel strong {
  font-size: 13px;
}

.quick-action {
  justify-content: center;
  background: #ffffff;
  color: #0f2728;
  font-weight: 700;
}

.main {
  min-width: 0;
}

.topbar {
  min-height: 76px;
  display: grid;
  grid-template-columns: minmax(200px, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 18px 26px;
  background: rgba(244, 246, 248, 0.88);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid rgba(229, 234, 240, 0.75);
}

.search {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 12px;
  box-shadow: 0 1px 0 rgba(23, 32, 42, 0.03);
}

.search svg {
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.search input {
  width: 100%;
  border: 0;
  outline: 0;
  min-width: 0;
  color: var(--ink);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.button,
.icon-button,
.tool-button,
.chip,
.tab-button,
.link-button,
.stage-action {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 13px;
  white-space: nowrap;
}

.button.primary {
  background: var(--brand);
  color: #ffffff;
  border-color: var(--brand);
  font-weight: 700;
}

.button.primary:hover {
  background: var(--brand-strong);
}

.button.secondary {
  background: var(--surface-strong);
}

.button.danger {
  background: var(--red-soft);
  border-color: #fecdca;
  color: var(--red);
}

.button:disabled,
.stage-action:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.icon-button,
.tool-button {
  width: 40px;
  padding: 0;
}

.mobile-menu {
  display: none;
}

.content {
  padding: 0 26px 34px;
}

.view {
  display: grid;
  gap: 22px;
}

.view-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 18px;
  padding-top: 12px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--brand);
  font-size: 12px;
  line-height: 1;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.05;
  letter-spacing: 0;
}

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

h3 {
  font-size: 15px;
  line-height: 1.25;
}

.subtle {
  color: var(--muted);
  line-height: 1.55;
}

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

.metric-card,
.panel,
.table-panel,
.deal-card,
.contact-card,
.task-row,
.activity-row,
.modal,
.insight-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 0 rgba(23, 32, 42, 0.03);
}

.metric-card {
  padding: 18px;
  display: grid;
  gap: 12px;
  min-height: 150px;
}

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

.metric-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  color: var(--brand);
  background: var(--brand-soft);
}

.metric-icon svg {
  width: 20px;
  height: 20px;
}

.metric-value {
  font-size: 28px;
  line-height: 1;
  font-weight: 800;
}

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

.metric-foot {
  display: grid;
  gap: 8px;
}

.metric-revenue {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.metric-revenue-label {
  color: var(--muted);
  font-size: 12px;
}

.metric-revenue strong {
  font-size: 16px;
  line-height: 1;
}

.trend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  border-radius: var(--radius);
  min-height: 26px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 800;
}

.trend.good {
  background: var(--green-soft);
  color: var(--green);
}

.trend.warn {
  background: var(--amber-soft);
  color: var(--amber);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
  gap: 18px;
}

.panel {
  min-width: 0;
  padding: 18px;
  display: grid;
  gap: 16px;
}

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

.pipeline {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 3px;
}

.stage {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 360px;
  padding: 10px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
}

.stage.drag-over {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
}

.stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 30px;
}

.stage-title {
  font-size: 13px;
  font-weight: 800;
}

.stage-total {
  color: var(--muted);
  font-size: 12px;
}

.deal-list {
  display: grid;
  align-content: start;
  gap: 10px;
}

.deal-card {
  padding: 12px;
  display: grid;
  gap: 10px;
  cursor: grab;
}

.deal-card:active {
  cursor: grabbing;
}

.deal-card.selected,
.contact-card.selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(18, 107, 99, 0.12);
}

.deal-title {
  font-weight: 800;
  line-height: 1.3;
}

.deal-meta,
.contact-meta,
.task-meta,
.activity-meta,
.small-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.amount {
  font-weight: 800;
  color: var(--ink);
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  border-radius: var(--radius);
  padding: 0 8px;
  font-size: 12px;
  font-weight: 800;
  background: var(--surface-strong);
  color: var(--muted);
}

.pill.hot {
  background: var(--red-soft);
  color: var(--red);
}

.pill.warm {
  background: var(--amber-soft);
  color: var(--amber);
}

.pill.cold {
  background: var(--blue-soft);
  color: var(--blue);
}

.pill.good {
  background: var(--green-soft);
  color: var(--green);
}

.progress {
  height: 7px;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--line);
}

.progress span {
  display: block;
  height: 100%;
  background: var(--brand);
  border-radius: inherit;
}

.activity-list,
.task-list,
.insight-list {
  display: grid;
  gap: 10px;
}

.activity-row,
.task-row,
.insight-card {
  padding: 12px;
}

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

.activity-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  color: var(--brand);
  background: var(--brand-soft);
}

.activity-icon svg {
  width: 18px;
  height: 18px;
}

.activity-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

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

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

.chip,
.tab-button {
  min-height: 34px;
  font-size: 13px;
  background: #ffffff;
}

.chip.active,
.tab-button.active {
  background: var(--brand-soft);
  border-color: #b9ded7;
  color: var(--brand-strong);
  font-weight: 800;
}

.table-panel {
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
}

.data-table th,
.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  color: var(--muted);
  background: var(--surface-strong);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.data-table tr {
  cursor: pointer;
}

.data-table tr:hover td {
  background: #fbfcfd;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.person {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #ffffff;
  background: var(--brand);
}

.avatar.alt {
  background: var(--accent);
}

.person-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.person-copy strong,
.truncate {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.contact-card {
  padding: 15px;
  display: grid;
  gap: 12px;
  min-height: 160px;
}

.contact-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.detail-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  position: sticky;
  top: 94px;
  align-self: start;
  overflow: hidden;
}

.detail-cover {
  height: 78px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0)),
    #0f2728;
}

.detail-body {
  padding: 0 18px 18px;
  display: grid;
  gap: 16px;
}

.detail-avatar {
  width: 64px;
  height: 64px;
  margin-top: -32px;
  border: 4px solid #ffffff;
  font-size: 20px;
}

.info-grid {
  display: grid;
  gap: 10px;
}

.info-item {
  display: grid;
  gap: 3px;
}

.info-label {
  color: var(--muted);
  font-size: 12px;
}

.info-value {
  color: var(--ink);
  font-weight: 700;
  min-width: 0;
  overflow-wrap: anywhere;
}

.deal-workspace {
  display: grid;
  gap: 18px;
}

.deal-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(210px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.deal-board .stage {
  min-height: 520px;
}

.stage-actions {
  display: flex;
  gap: 8px;
}

.stage-action {
  min-height: 30px;
  padding: 0 8px;
}

.task-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.check-button {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--soft);
  background: #ffffff;
  display: grid;
  place-items: center;
  padding: 0;
}

.check-button.done {
  background: var(--green);
  border-color: var(--green);
  color: #ffffff;
}

.check-button svg {
  width: 16px;
  height: 16px;
}

.task-title.done {
  text-decoration: line-through;
  color: var(--muted);
}

.task-date.overdue {
  color: var(--red);
  font-weight: 800;
}

.empty-state {
  min-height: 220px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
  color: var(--muted);
  border: 1px dashed var(--soft);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.55);
}

.empty-state strong {
  color: var(--ink);
  display: block;
  margin-bottom: 6px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 39, 40, 0.42);
}

.modal {
  width: min(680px, 100%);
  max-height: min(760px, calc(100vh - 40px));
  overflow: auto;
  box-shadow: var(--shadow);
}

.modal-header,
.modal-footer {
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.modal-footer {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  justify-content: flex-end;
}

.form {
  padding: 18px;
  display: grid;
  gap: 14px;
}

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

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

.field.full {
  grid-column: 1 / -1;
}

.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--soft);
  border-radius: var(--radius);
  padding: 10px 11px;
  background: #ffffff;
  color: var(--ink);
  outline: 0;
}

.field textarea {
  resize: vertical;
  min-height: 96px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(18, 107, 99, 0.12);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  min-height: 44px;
  max-width: min(420px, calc(100vw - 40px));
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border-radius: var(--radius);
  background: #0f2728;
  color: #ffffff;
  box-shadow: var(--shadow);
}

.toast svg {
  width: 18px;
  height: 18px;
}

.mobile-scrim {
  display: none;
}

.period-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(160px, 1fr));
  gap: 14px;
}

.period-card {
  min-height: 172px;
}

.trend.bad {
  background: var(--red-soft);
  color: var(--red);
}

.trend.neutral {
  background: var(--blue-soft);
  color: var(--blue);
}

.upload-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.upload-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  display: grid;
  gap: 16px;
  box-shadow: 0 1px 0 rgba(23, 32, 42, 0.03);
}

.upload-card-head {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.upload-form {
  display: grid;
  gap: 13px;
}

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

.no-pad {
  padding: 0;
}

.table-scroll {
  overflow-x: auto;
  width: 100%;
}

.period-table {
  min-width: 980px;
}

.performance-table {
  min-width: 0;
  width: 100%;
}

.performance-table th,
.performance-table td {
  white-space: normal;
}

.performance-table tbody th {
  width: 220px;
  min-width: 220px;
}

.performance-table tbody td {
  width: auto;
}

.performance-table .person-copy strong,
.performance-table .person-copy span {
  white-space: normal;
}

.performance-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.period-table td {
  min-width: 136px;
}

.period-table .trend {
  margin-top: 6px;
}

.inline-search {
  width: min(520px, 100%);
}

.quick-list {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.product-hero {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  align-items: stretch;
  gap: 18px;
}

.product-hero-main {
  display: grid;
  align-content: start;
  gap: 14px;
  min-width: 0;
}

.hero-product-banner {
  display: grid;
  gap: 8px;
  grid-column: 1 / -1;
  min-width: 0;
  padding: 4px 4px 12px;
}

.hero-product-banner strong {
  font-size: 30px;
  line-height: 1.08;
  white-space: normal;
  overflow-wrap: anywhere;
}

.hero-stock-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  align-content: start;
  gap: 12px;
}

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

.box-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  padding: 14px;
  display: grid;
  gap: 14px;
}

.box-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.box-card-title {
  font-size: 18px;
  line-height: 1.1;
  font-weight: 800;
}

.box-card-body {
  display: grid;
  gap: 6px;
}

.box-card-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.box-card-actions .button {
  min-height: 40px;
  justify-content: flex-start;
}

.hero-stock {
  min-width: 150px;
  min-height: 78px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  display: grid;
  align-content: end;
  gap: 3px;
  padding: 12px;
}

.hero-stock strong {
  font-size: 28px;
  line-height: 1;
}

.bar-chart {
  width: 100%;
  min-height: 220px;
  display: grid;
  grid-template-columns: repeat(var(--bar-count), minmax(42px, 1fr));
  gap: 9px;
  align-items: end;
  overflow-x: auto;
  padding: 4px 2px 2px;
}

.bar-item {
  min-width: 42px;
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 6px;
  align-content: end;
  text-align: center;
  color: var(--muted);
}

.bar-track {
  width: 100%;
  height: 168px;
  display: flex;
  align-items: end;
  border-radius: var(--radius);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  overflow: hidden;
}

.bar-track span {
  display: block;
  width: 100%;
  min-height: 4px;
  background: linear-gradient(180deg, var(--brand), var(--brand-strong));
  border-radius: var(--radius) var(--radius) 0 0;
}

.bar-item strong {
  color: var(--ink);
  font-size: 12px;
  line-height: 1;
}

.bar-item small {
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
}

.warning-list {
  display: grid;
  gap: 10px;
}

.warning-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 11px;
}

.warning-card.critical {
  border-color: #fecdca;
  background: #fff8f7;
}

.warning-card.watch {
  border-color: #fedf89;
  background: #fffbf2;
}

.warning-card.critical .activity-icon {
  background: var(--red-soft);
  color: var(--red);
}

.warning-card.watch .activity-icon {
  background: var(--amber-soft);
  color: var(--amber);
}

.field input[type="file"] {
  padding: 9px;
}

.data-table .trend {
  display: inline-flex;
  margin-left: 0;
}

.data-table td strong {
  overflow-wrap: anywhere;
}

@media (max-width: 1180px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .dashboard-grid,
  .detail-layout {
    grid-template-columns: 1fr;
  }

  .performance-split {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: static;
  }
}

@media (max-width: 920px) {
  .crm-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    z-index: 30;
    left: 0;
    top: 0;
    width: min(300px, calc(100vw - 50px));
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(15, 39, 40, 0.38);
  }

  .mobile-menu {
    display: inline-flex;
  }

  .topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    padding: 14px 16px;
  }

  .top-actions .button:not(.primary) span,
  .top-actions .button.primary span {
    display: none;
  }

  .content {
    padding: 0 16px 26px;
  }

  .view-heading {
    grid-template-columns: 1fr;
  }

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

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

  .upload-period-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: stretch;
    grid-template-columns: auto minmax(0, 1fr);
  }

  .top-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
  }

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

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

  .product-hero {
    grid-template-columns: 1fr;
  }

  .hero-stock-group {
    grid-template-columns: 1fr;
  }

  .box-card-grid,
  .box-card-actions {
    grid-template-columns: 1fr;
  }

  .bar-chart {
    grid-template-columns: repeat(var(--bar-count), minmax(52px, 1fr));
  }

  h1 {
    font-size: 30px;
  }

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

  .task-row {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .task-row > .pill {
    grid-column: 2;
    width: fit-content;
  }

  .modal-backdrop {
    padding: 10px;
  }
}
