:root {
  --bg: #cfdcf0;
  --window: #eef4fc;
  --window-strong: #ffffff;
  --sidebar: linear-gradient(180deg, #d4e3fb 0%, #b8cff2 42%, #9dbce8 100%);
  --panel: #ffffff;
  --panel-border: #6f91c5;
  --panel-shadow: 0 6px 14px rgba(39, 68, 115, 0.1);
  --ink: #0f2748;
  --muted: #49617f;
  --field: #ffffff;
  --field-border: #7f9db9;
  --field-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.96);
  --accent: #0a62c6;
  --accent-soft: rgba(10, 98, 198, 0.14);
  --danger: #c42b1c;
  --danger-soft: rgba(196, 43, 28, 0.12);
  --success: #107c10;
  --warning: #ffb900;
  --inactive: #7d8594;
  --unassigned: #e8f1ff;
  --active-fill: #e9f7ea;
  --inactive-fill: #eef1f5;
  --out-fill: #ffe7e5;
  --restricted-fill: #fff5d8;
  --problem-fill: #ffe9e7;
  --finder-blue: #0a5fc2;
  --finder-blue-deep: #003c8f;
}

body[data-theme="dark"] {
  --bg: #141821;
  --window: rgba(31, 37, 49, 0.9);
  --window-strong: #242a37;
  --sidebar: linear-gradient(180deg, rgba(34, 40, 53, 0.98), rgba(26, 31, 42, 0.96));
  --panel: rgba(34, 40, 52, 0.86);
  --panel-border: rgba(174, 189, 215, 0.12);
  --panel-shadow: 0 22px 60px rgba(0, 0, 0, 0.35);
  --ink: #edf2ff;
  --muted: #9ca8c1;
  --field: #252c39;
  --field-border: rgba(169, 185, 213, 0.14);
  --field-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  --accent-soft: rgba(10, 132, 255, 0.2);
  --danger-soft: rgba(255, 69, 58, 0.18);
  --inactive: #7f8795;
  --unassigned: #243750;
  --active-fill: #1c3b2b;
  --inactive-fill: #2a2f3a;
  --out-fill: #452524;
  --restricted-fill: #4d4321;
  --problem-fill: #472727;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
  font-family: "Segoe UI", "Segoe UI Variable Text", Tahoma, Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.65), transparent 24%),
    linear-gradient(180deg, #edf4ff 0%, #d8e6fb 36%, #c5d8f3 100%);
}

body.app-loading #login-screen,
body.app-loading .app-shell {
  visibility: hidden;
}

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

.hidden {
  display: none !important;
}

.app-shell {
  position: relative;
  display: grid;
  grid-template-columns: 290px 1fr;
  min-height: 100vh;
  margin: 12px;
  overflow: hidden;
  border: 1px solid #5f86bd;
  border-radius: 7px;
  background: var(--window);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 0 0 1px rgba(255, 255, 255, 0.55),
    0 14px 30px rgba(48, 73, 114, 0.16);
}

.login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(208, 222, 245, 0.82);
  z-index: 40;
}

.login-card,
.modal-card {
  width: min(720px, 100%);
  padding: 22px;
  border: 1px solid #5f86bd;
  border-radius: 6px;
  background: #ffffff;
  box-shadow:
    0 1px 0 #ffffff inset,
    0 0 0 1px rgba(255, 255, 255, 0.68),
    var(--panel-shadow);
}

.login-card {
  max-width: 430px;
}

.login-form,
.users-form {
  display: grid;
  gap: 12px;
}

.users-form-compact {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: end;
}

.users-temp-password-note {
  margin: 6px 0 16px;
}

.login-error {
  margin: 12px 0 0;
  color: #b3261e;
  font-size: 13px;
  font-weight: 700;
}

.sidebar {
  padding: 22px 16px 16px;
  background: var(--sidebar);
  border-right: 1px solid #6f92c6;
}

.main-content {
  padding: 22px;
}

.brand h1,
.hero h2,
.panel h2,
.listing-title {
  margin: 0;
  letter-spacing: -0.03em;
  font-weight: 700;
}

.brand h1,
.hero h2 {
  font-size: 27px;
}

.panel h2 {
  font-size: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #184f9c;
}

.subtle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.panel {
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  background: linear-gradient(180deg, #ffffff 0%, #eef4fc 100%);
  box-shadow:
    0 1px 0 #ffffff inset,
    0 0 0 1px rgba(255, 255, 255, 0.62);
  padding: 14px;
}

.sidebar .panel {
  margin-top: 14px;
}

.field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.fnsku-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.fnsku-print-btn {
  width: auto;
  min-height: 24px;
  padding: 2px 8px;
  font-size: 11px;
  flex: 0 0 auto;
  white-space: nowrap;
}

.fixed-user,
input,
select,
button,
textarea {
  width: 100%;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--field-border);
  border-radius: 3px;
  background: var(--field);
  color: var(--ink);
  box-shadow: var(--field-shadow);
}

textarea {
  resize: vertical;
}

.fixed-user {
  display: flex;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
}

.preview-panel {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(50, 65, 92, 0.1);
  display: grid;
  gap: 8px;
}

.preview-user-name {
  background: rgba(255, 244, 214, 0.9);
}

button {
  border: 1px solid #5f7fb0;
  background: linear-gradient(180deg, #fefefe 0%, #e8f0fd 48%, #cfdff8 100%);
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

button:hover {
  transform: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.98),
    0 0 0 1px rgba(255, 255, 255, 0.45),
    inset 0 -1px 0 rgba(91, 128, 180, 0.14);
  background: linear-gradient(180deg, #ffffff 0%, #edf4fe 48%, #d8e7fb 100%);
}

.ghost-btn {
  background: linear-gradient(180deg, #ffffff 0%, #edf4fd 52%, #d6e4fa 100%);
}

.ghost-btn.danger {
  color: #b3261e;
  border-color: rgba(255, 59, 48, 0.18);
}

input:focus,
select:focus,
textarea:focus {
  outline: 1px solid rgba(10, 95, 194, 0.5);
  border-color: #3c7bd6;
}

input:disabled,
select:disabled,
textarea:disabled {
  background: rgba(234, 237, 243, 0.9);
  color: #6d7685;
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr 84px;
  gap: 8px;
}

.add-supplier-inline {
  min-width: 320px;
}

.supplier-overview-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.supplier-overview-tools input[type="search"] {
  width: 220px;
}

.supplier-overview-tools select {
  width: 160px;
}

#storage-supplier-filter {
  width: 240px;
}

#print-storage-btn {
  width: auto;
  min-height: 30px;
  padding: 5px 10px;
  flex: 0 0 auto;
  white-space: nowrap;
}

#profits-search-input {
  width: 220px;
}

.audit-filters {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}

#audit-date-from,
#audit-date-to {
  width: 140px;
  min-width: 140px;
  max-width: 140px;
}

#audit-user-filter {
  width: 150px;
  min-width: 150px;
  max-width: 150px;
}

#delete-audit-user-btn,
#delete-audit-all-btn {
  width: auto;
  min-width: 110px;
  padding: 4px 10px;
}

.audit-pagination {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.audit-page-btn {
  width: auto;
  min-width: 34px;
  min-height: 28px;
  padding: 4px 10px;
}

.audit-page-btn-active {
  border-color: #3c7bd6;
  background: linear-gradient(180deg, #ffffff 0%, #d9e8fc 52%, #c4dbfa 100%);
}

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

.section-head-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.list-section-count {
  min-height: 14px;
  font-size: 11px;
  color: var(--muted);
}

#open-role-modal-btn {
  width: auto;
  flex: 0 0 auto;
  align-self: flex-start;
  padding: 8px 12px;
  white-space: nowrap;
}

.nav-alert-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-alert-btn .overview-alert {
  position: absolute;
  right: 10px;
}

.overview-alert {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #ff453a;
  color: white;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 6px 14px rgba(255, 69, 58, 0.28);
}

.supplier-list,
.listing-stack,
.dashboard-grid,
.users-list {
  display: grid;
  gap: 14px;
}

.main-content .panel + .panel {
  margin-top: 14px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 420px);
  gap: 14px;
  margin-bottom: 14px;
}

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

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

.stat-card {
  padding: 16px;
  border: 1px solid #7f9fc7;
  border-radius: 3px;
  background: linear-gradient(180deg, #ffffff 0%, #edf4fe 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.stat-card span {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
  letter-spacing: -0.04em;
}

.toolbar {
  margin-bottom: 14px;
}

.toolbar-grid,
.bulk-assign-bar,
.overview-meta {
  display: grid;
  gap: 10px;
}

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

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

.metric-visibility-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.metric-visibility-controls label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.metric-visibility-controls input {
  width: auto;
  min-height: auto;
  padding: 0;
}

.bulk-assign-bar {
  grid-template-columns: 140px minmax(0, 1fr) 170px;
  align-items: center;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid rgba(10, 132, 255, 0.14);
  border-radius: 3px;
  background: linear-gradient(180deg, #f7faff 0%, #e8f0fb 100%);
}

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

.replenishment-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.replenishment-table th,
.replenishment-table td {
  padding: 7px 9px;
  border: 1px solid #b8c6d9;
  text-align: left;
  vertical-align: top;
}

.replenishment-table th {
  background: linear-gradient(180deg, #f7fbff 0%, #dfeaf9 100%);
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
}

.replenishment-priority {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.priority-out-of-stock {
  background: rgba(255, 59, 48, 0.14);
  color: #b42318;
}

.priority-urgent {
  background: rgba(255, 159, 10, 0.18);
  color: #b54708;
}

.priority-soon {
  background: rgba(255, 204, 0, 0.22);
  color: #9a6700;
}

.priority-healthy {
  background: rgba(52, 199, 89, 0.16);
  color: #137333;
}

.priority-blocked {
  background: rgba(142, 142, 147, 0.18);
  color: #53545a;
}

.replenishment-link-btn {
  width: auto;
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--finder-blue-deep);
  text-align: left;
}

.replenishment-link-btn:hover {
  transform: none;
  box-shadow: none;
  text-decoration: underline;
}

.shipment-detail-box {
  padding: 8px 0 0;
}

.shipment-detail-table {
  font-size: 11px;
}

.bulk-check-all {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}

.bulk-check-all input,
.listing-select-checkbox {
  width: auto;
  min-height: auto;
}

.view-section {
  display: none;
}

.view-section.active {
  display: block;
}

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

.dashboard-summary {
  display: flex;
  justify-content: center;
  margin: 8px 0 18px;
}

.dashboard-summary-table {
  border-collapse: collapse;
  min-width: 900px;
  background: #ffffff;
}

.dashboard-summary-table th,
.dashboard-summary-table td {
  padding: 8px 14px;
  border: 1px solid #6f87a8;
  text-align: center;
  font-size: 14px;
}

.dashboard-summary-table thead th,
.dashboard-summary-table tbody th {
  font-weight: 700;
}

.dashboard-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid #7696be;
  border-radius: 3px;
  background: linear-gradient(180deg, #ffffff 0%, #edf4fe 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.supplier-row-card {
  display: grid;
  grid-template-columns: minmax(220px, 1.1fr) minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.supplier-row-head {
  min-width: 0;
}

.supplier-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.supplier-row-head h3 {
  margin-bottom: 4px;
}

.supplier-edit-btn {
  width: 24px;
  min-height: 24px;
  padding: 0;
  border-radius: 2px;
  background: #ffffff;
  font-size: 12px;
  line-height: 1;
}

.supplier-row-meta {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
  margin: 0;
  min-width: 0;
  overflow-x: auto;
}

.supplier-row-stats {
  display: grid;
  gap: 6px;
  margin: 0;
  justify-items: start;
}

.supplier-inline-field {
  display: inline-grid;
  align-content: end;
  gap: 2px;
  white-space: nowrap;
}

.supplier-inline-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  line-height: 1;
}

.supplier-inline-field input,
.supplier-inline-field select {
  min-width: 0;
  width: auto;
}

.supplier-inline-field input[type="date"] {
  width: 138px;
}

.supplier-inline-field select {
  width: 128px;
}

.supplier-inline-field input[type="text"] {
  width: 150px;
}

.supplier-inline-field input[type="number"] {
  width: 92px;
}

.supplier-row-btn {
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  min-height: 26px;
  padding: 3px 8px;
  font-size: 11px;
  white-space: nowrap;
  align-self: end;
}

.supplier-row-actions {
  display: inline-flex;
  width: auto;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  grid-column: 2;
  justify-self: end;
}

.supplier-row-meta,
.supplier-row-actions {
  width: 100%;
}

.dashboard-card.po-status-on_hold {
  background: linear-gradient(180deg, #ffeae7 0%, #ffd8d4 100%);
}

.dashboard-card.po-status-draft {
  background: linear-gradient(180deg, #e1e4ea 0%, #d0d6df 100%);
}

.dashboard-card.po-status-submitted {
  background: linear-gradient(180deg, #e7f2ff 0%, #d7e9ff 100%);
}

.dashboard-card.po-status-received {
  background: linear-gradient(180deg, #fff3c8 0%, #ffe79a 100%);
}

.dashboard-card.po-status-packaging {
  background: linear-gradient(180deg, #e7f7ea 0%, #d5f0db 100%);
}

.dashboard-card.po-status-completed {
  background: linear-gradient(180deg, #ffffff 0%, #eef3fb 100%);
}

.supplier-name-warning {
  margin: 8px 0 4px;
  color: #c62828;
  font-size: 12px;
  font-weight: 700;
}

.overview-meta {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 12px 0;
}

.overview-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 600;
  color: #33415a;
}

.profits-page-summary {
  flex-wrap: nowrap;
  overflow-x: auto;
  margin: 0 0 14px;
  white-space: nowrap;
}

.profit-card {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.85fr);
  align-items: start;
  gap: 12px;
}

.profit-card-main {
  display: grid;
  gap: 12px;
}

.profit-meta {
  display: flex;
  flex-wrap: nowrap;
  align-items: end;
  gap: 12px;
  overflow-x: auto;
}

.profit-meta-item {
  display: inline-grid;
  gap: 3px;
  white-space: nowrap;
}

.currency-input-wrap {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 6px;
}

.currency-input-symbol {
  font-size: 12px;
  font-weight: 700;
  color: #4e5b74;
}

.profit-meta-item strong {
  font-size: 15px;
}

.profit-meta-item input {
  width: 120px;
}

.profit-meta-note {
  margin-top: 2px;
  font-size: 10px;
  font-weight: 700;
  color: #1f2633;
}

.profit-information-panel {
  display: grid;
  gap: 6px;
}

.profit-information-box {
  min-height: 120px;
  padding: 12px;
  border: 1px solid rgba(50, 65, 92, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  white-space: normal;
  line-height: 1.4;
}

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

.supplier-warning,
.listing-supplier-warning {
  padding: 8px 10px;
  border-radius: 12px;
  background: linear-gradient(180deg, #ff5f57 0%, #ff453a 100%);
  color: white;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 10px 22px rgba(255, 69, 58, 0.2);
}

body[data-theme="dark"] .supplier-warning,
body[data-theme="dark"] .listing-supplier-warning {
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.3);
}

.supplier-header-warning {
  margin-bottom: 12px;
}

.dashboard-card h3,
.history-strip strong {
  margin: 0;
  font-size: 16px;
}

.supplier-header {
  margin-bottom: 14px;
  padding: 0;
  overflow: hidden;
  background: #ffffff;
}

.supplier-header-top {
  display: grid;
  grid-template-columns: 2fr 1.2fr 1fr;
  background: linear-gradient(180deg, #eef5ff 0%, #d6e4fa 100%);
}

.supplier-name-banner,
.po-banner,
.po-status-banner {
  padding: 16px 18px;
  border-right: 1px solid #8fa8cc;
}

.supplier-name-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #3a84e8 0%, #1f6ad0 52%, #0f52b6 100%);
  color: #ffffff;
  font-size: 22px;
  font-weight: 700;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.18);
}

.po-banner {
  background: linear-gradient(180deg, #ffffff 0%, #edf4fd 100%);
  color: var(--ink);
}

.po-status-banner {
  border-right: 0;
  background: linear-gradient(180deg, #ffffff 0%, #edf4fd 100%);
}

.po-status-banner.po-status-on_hold {
  background: linear-gradient(180deg, #ffd6d3 0%, #ffc3bf 100%);
}

.po-status-banner.po-status-draft {
  background: linear-gradient(180deg, #cfd2d8 0%, #b7bcc6 100%);
}

.po-status-banner.po-status-submitted {
  background: linear-gradient(180deg, #dff3ff 0%, #cce9ff 100%);
}

.po-status-banner.po-status-received {
  background: linear-gradient(180deg, #fff0b8 0%, #ffe08b 100%);
}

.po-status-banner.po-status-packaging {
  background: linear-gradient(180deg, #dff5e4 0%, #cdecd4 100%);
}

.po-status-banner.po-status-completed {
  background: linear-gradient(180deg, #eef2f9 0%, #e1e7f1 100%);
}

.supplier-page-stat {
  display: grid;
  align-content: center;
}

.supplier-header-body {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 20px;
  padding: 18px;
}

.supplier-summary-grid {
  display: grid;
  gap: 14px;
}

.supplier-stat-lines {
  display: grid;
  gap: 8px;
  font-size: 13px;
}

.supplier-stat-lines strong {
  display: inline-block;
  min-width: 84px;
}

.supplier-info-panel textarea {
  min-height: 190px;
  background: rgba(255, 255, 255, 0.94);
}

.supplier-prep-time {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  font-size: 9px;
  font-weight: 700;
  color: #4e5b74;
}

.supplier-prep-time strong {
  font-size: 9px;
  font-weight: 700;
}

.listing-card {
  overflow: hidden;
  border: 1px solid #6f8fba;
  border-radius: 6px;
  background: linear-gradient(180deg, #ffffff 0%, #eef4fc 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.92) inset,
    0 0 0 1px rgba(210, 223, 242, 0.7),
    0 8px 18px rgba(33, 47, 72, 0.08);
}

.listing-card.listing-card-alert {
  box-shadow: inset 4px 0 0 #d93025, 0 12px 24px rgba(33, 47, 72, 0.07);
}

.listing-card.listing-card-focused {
  box-shadow: inset 0 0 0 2px #0a84ff, 0 0 0 4px rgba(10, 132, 255, 0.16), 0 12px 24px rgba(33, 47, 72, 0.07);
}

.approval-review-btn {
  margin-top: 6px;
}

.listing-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(241, 244, 250, 0.96));
  border-bottom: 1px solid #9bb2cf;
}

.listing-topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.listing-select-wrap {
  display: flex;
  align-items: center;
}

.supplier-chip,
.badge {
  border-radius: 999px;
  border: 1px solid rgba(45, 61, 87, 0.12);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.supplier-chip {
  margin: 0;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 700;
  color: var(--finder-blue-deep);
}

.listing-title {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.listing-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.badge {
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 700;
}

.badge.restricted-market {
  background: var(--danger-soft);
  color: #b3261e;
}

.badge.out_of_stock {
  background: linear-gradient(180deg, #ff8a82 0%, #ff5f57 100%);
  border-color: rgba(255, 69, 58, 0.26);
  color: white;
}

.listing-sheet {
  display: grid;
  grid-template-columns: 1fr 176px;
  background: rgba(245, 247, 251, 0.94);
}

.listing-card.status-active .listing-sheet {
  background: rgba(245, 247, 251, 0.94);
}

.listing-card.status-inactive .listing-sheet,
.listing-card.status-discontinued .listing-sheet,
.listing-card.status-do_not_order .listing-sheet {
  background: var(--inactive-fill);
}

.listing-card.status-out_of_stock .listing-sheet {
  background: var(--out-fill);
}

.listing-card.status-restricted .listing-sheet {
  background: var(--restricted-fill);
}

.listing-card.status-approval_required .listing-sheet,
.listing-card.status-info_required .listing-sheet,
.listing-card.status-additional_info_required {
  background: #e3f3ff;
}

.listing-card.status-problem .listing-sheet,
.listing-card.status-duplicate_listing .listing-sheet,
.listing-card.status-invalid_cog_sku .listing-sheet,
.listing-card.status-sell_at_cost .listing-sheet,
.listing-card.status-sell_below_cost .listing-sheet,
.listing-card.status-listing_closed .listing-sheet {
  background: var(--problem-fill);
}

.listing-card.status-unassigned .listing-sheet {
  background: var(--unassigned);
}

.sheet-main {
  border-right: 1px solid rgba(50, 65, 92, 0.08);
}

.sheet-row {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
}

.sheet-row.sku-upc-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.import-metrics-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
}

.import-metrics-group {
  border: 1px solid rgba(50, 65, 92, 0.08);
  border-radius: 10px;
  background: rgba(246, 248, 252, 0.9);
  overflow: hidden;
}

.import-metrics-title {
  padding: 4px 6px;
  border-bottom: 1px solid rgba(50, 65, 92, 0.08);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: rgba(240, 243, 248, 0.95);
}

.import-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  padding: 1px;
  background: rgba(50, 65, 92, 0.08);
}

.import-metrics-grid div {
  min-height: 34px;
  padding: 4px 5px;
  border: 0;
  border-radius: 0;
  background: rgba(248, 249, 252, 0.96);
  text-align: center;
}

.import-metrics-grid span {
  display: block;
  font-size: 9px;
  text-transform: uppercase;
  color: var(--muted);
}

.import-metrics-grid strong {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 700;
  overflow-wrap: anywhere;
}


.sheet-row.plan-row {
  grid-template-columns: minmax(0, 1fr) 96px 20px 96px 114px;
  align-items: stretch;
}

.sheet-title-row {
  border-bottom: 1px solid rgba(50, 65, 92, 0.08);
}

.sheet-cell,
.sheet-input {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-height: 34px;
  padding: 4px 6px;
  border: 1px solid rgba(50, 65, 92, 0.08);
  border-radius: 10px;
  background: rgba(248, 249, 252, 0.9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.sheet-input {
  background: rgba(243, 245, 249, 0.96);
}

.sheet-input.pack-highlight,
.sheet-cell.pack-highlight {
  background: linear-gradient(180deg, #fff6d7 0%, #ffe89d 100%);
}

.sheet-cell.to-fba-active {
  background: linear-gradient(180deg, #dff6e6 0%, #ccefd8 100%);
}

.sheet-body {
  padding: 2px;
  border-radius: 0 0 14px 14px;
}

.sheet-body.status-active {
  background: transparent;
}

.sheet-body.status-inactive,
.sheet-body.status-discontinued,
.sheet-body.status-do_not_order {
  background: rgba(142, 142, 147, 0.08);
}

.sheet-body.status-out_of_stock {
  background: rgba(255, 59, 48, 0.08);
}

.sheet-body.status-restricted {
  background: rgba(255, 204, 0, 0.12);
}

.sheet-body.status-problem {
  background: rgba(255, 69, 58, 0.08);
}

.sheet-body.status-unassigned {
  background: rgba(10, 132, 255, 0.08);
}

.cell-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.cell-value {
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

a.cell-value {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.title-value {
  font-style: italic;
  color: #36435d;
}

.sheet-input input,
.sheet-input select {
  min-height: 22px;
  padding: 2px 6px;
}

.sheet-cell .compact-input {
  width: 100%;
  min-height: 22px;
  padding: 2px 6px;
}

.calc-inline-cell {
  align-items: center;
  text-align: center;
}

.calc-inline-symbol {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  text-align: center;
}

.calc-inline-symbol .cell-value {
  font-size: 15px;
  font-weight: 700;
}

.spacer-cell {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.map-box input {
  border: 2px solid rgba(31, 38, 51, 0.8);
  font-weight: 700;
}

.emphasis-cell {
  background: linear-gradient(180deg, #dff6e6 0%, #ccefd8 100%);
}

.sheet-cell:not(.emphasis-cell) .total-cog-value {
  color: inherit;
}

.calc-value {
  font-size: 20px;
  line-height: 1;
  letter-spacing: -0.05em;
}

.leftover-note {
  margin-top: 2px;
  font-size: 9px;
  font-weight: 700;
  color: #c62828;
}

.sheet-status {
  padding: 4px;
}

.status-box {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border: 1px solid rgba(50, 65, 92, 0.12);
  border-radius: 14px;
  background: rgba(243, 245, 249, 0.96);
}

.status-box-title {
  padding: 9px;
  border-bottom: 1px solid rgba(50, 65, 92, 0.08);
  text-align: center;
  font-weight: 700;
  font-size: 13px;
}

.status-color-block {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 72px;
  border-bottom: 1px solid rgba(50, 65, 92, 0.08);
  font-size: 20px;
  font-weight: 700;
  text-transform: uppercase;
}

.status-color-block.status-active {
  background: rgba(255, 255, 255, 0.96);
  color: inherit;
}

.status-color-block.status-inactive,
.status-color-block.status-discontinued,
.status-color-block.status-do_not_order {
  background: linear-gradient(180deg, #b0b3bb 0%, #8e8e93 100%);
  color: white;
}

.status-color-block.status-out_of_stock {
  background: linear-gradient(180deg, #ff6c62 0%, #ff3b30 100%);
  color: white;
}

.status-color-block.status-restricted {
  background: linear-gradient(180deg, #ffde59 0%, #ffcc00 100%);
}

.status-color-block.status-approval_required,
.status-color-block.status-info_required,
.status-color-block.status-additional_info_required {
  background: linear-gradient(180deg, #64d2ff 0%, #0a84ff 100%);
  color: white;
}

.status-color-block.status-problem,
.status-color-block.status-duplicate_listing,
.status-color-block.status-invalid_cog_sku,
.status-color-block.status-sell_at_cost,
.status-color-block.status-sell_below_cost,
.status-color-block.status-listing_closed {
  background: linear-gradient(180deg, #ff8c86 0%, #ff453a 100%);
  color: white;
}

.status-color-block.status-unassigned {
  background: linear-gradient(180deg, #9cc9ff 0%, #69a8ff 100%);
  color: white;
}

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

.listing-updated-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  padding: 6px 8px 2px;
}

.listing-updated-note {
  font-size: 9px;
  color: var(--muted);
  text-align: left;
}

.listing-updated-note.listing-updated-recent {
  font-style: italic;
}

.status-storage-panel,
.status-notes-panel {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 7px;
  border-top: 1px solid rgba(50, 65, 92, 0.08);
}

.status-storage-input {
  min-height: 28px;
  background: rgba(255, 255, 255, 0.94);
}

.status-storage-input.storage-active {
  background: rgba(226, 244, 231, 0.92);
}

.status-notes-panel {
  flex: 1;
}

.status-notes-input {
  flex: 1;
  min-height: 76px;
  resize: vertical;
  background: rgba(255, 255, 255, 0.94);
}

.history-strip {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) minmax(0, 320px);
  gap: 8px;
  padding: 6px 8px 7px;
  border-top: 1px solid rgba(50, 65, 92, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(244, 247, 252, 0.92));
}

.history-list {
  grid-column: 2;
  margin: 0;
  padding-left: 16px;
  display: grid;
  gap: 2px;
  font-size: 10px;
  color: #4e5b74;
}

.history-open-btn {
  grid-column: 1;
  min-height: 24px;
  padding: 4px 8px;
  font-size: 11px;
}

.unassign-listing-btn {
  min-height: 24px;
  padding: 4px 8px;
  font-size: 11px;
  width: auto;
  white-space: nowrap;
}

.history-warning-slot {
  grid-column: 3;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.empty-state {
  padding: 28px;
  border: 1px dashed rgba(50, 65, 92, 0.18);
  border-radius: 18px;
  text-align: center;
  color: var(--muted);
  background: rgba(240, 243, 247, 0.9);
}

.users-list {
  margin-top: 28px;
}

.roles-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.role-chip {
  display: inline-grid;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid rgba(50, 65, 92, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.role-chip-head {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
}

.role-chip-actions {
  display: inline-flex;
  gap: 6px;
}

.role-chip-btn {
  width: auto;
  min-height: 24px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
}

.role-chip-btn.danger {
  color: #b3261e;
}

.role-chip-system {
  background: rgba(223, 235, 255, 0.8);
}

.role-chip span {
  font-size: 11px;
  color: var(--muted);
}

.user-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(320px, 2fr);
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid rgba(50, 65, 92, 0.1);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
}

.user-row-disabled {
  background: rgba(255, 59, 48, 0.12);
  border-color: rgba(255, 59, 48, 0.28);
}

.user-row-locked {
  border-color: rgba(255, 159, 10, 0.34);
  background: rgba(255, 245, 224, 0.82);
}

.user-row-disabled .user-summary strong,
.user-row-disabled .user-summary span {
  color: #b3261e;
}

.user-summary {
  display: grid;
  gap: 4px;
}

.user-presence,
.user-presence-secondary {
  font-size: 11px;
  color: var(--muted);
}

.user-presence {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.user-presence-online {
  color: #0a6d1f;
  font-weight: 700;
}

.user-presence-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9aa7bb;
  border: 1px solid rgba(0, 0, 0, 0.12);
  flex: 0 0 auto;
}

.user-presence-online .user-presence-dot {
  background: #2fb344;
}

.user-lock-note {
  font-size: 11px;
  color: #b54708;
  font-weight: 700;
}

.user-controls {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  align-items: start;
}

.user-reset-cell {
  display: grid;
  gap: 4px;
  justify-items: center;
}

.user-meta-note {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.2;
  text-align: center;
}

.user-form-actions {
  display: flex;
  align-items: end;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(16, 24, 40, 0.28);
  backdrop-filter: blur(14px);
  z-index: 50;
}

.modal-card {
  max-height: 80vh;
  overflow: auto;
}

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

.rename-supplier-field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.shipment-checks-box {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(50, 65, 92, 0.1);
  border-radius: 12px;
  background: rgba(245, 247, 251, 0.92);
}

.shipment-checks-summary {
  font-size: 12px;
  font-weight: 700;
  color: #344054;
}

.shipment-checks-summary.has-errors {
  color: #b42318;
}

.shipment-checks-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: #475467;
}

.shipment-checks-list.has-errors {
  color: #b42318;
}

.shipment-checks-list li {
  line-height: 1.3;
}

.role-permissions-head {
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 700;
}

.role-permissions-list {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
}

.role-permission-group {
  display: grid;
  gap: 8px;
}

.role-permission-group-title {
  font-size: 12px;
  font-weight: 700;
  color: #475467;
}

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

.role-permission-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(50, 65, 92, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.76);
}

.role-permission-item input {
  width: auto;
  min-height: auto;
  margin-top: 2px;
}

.role-permission-danger input:checked + span {
  color: #b42318;
  font-weight: 700;
}

.role-permission-danger:has(input:checked) {
  border-color: rgba(180, 35, 24, 0.32);
  background: rgba(254, 228, 226, 0.92);
}

.modal-x-btn {
  width: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
}

.temp-password-box {
  margin: 12px 0;
  padding: 12px 14px;
  border: 1px solid rgba(10, 132, 255, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: center;
}

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

.temp-password-copy-btn {
  width: auto;
  min-width: 78px;
  margin-top: 0;
  white-space: nowrap;
}

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

.modal-history-item {
  padding: 10px 12px;
  border: 1px solid rgba(50, 65, 92, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  font-size: 12px;
}

.delete-warning-check {
  margin: 14px 0;
  color: #b3261e;
  font-weight: 700;
}

.span-1 { grid-column: span 1; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-12 { grid-column: span 12; }

.warning-row {
  padding-top: 0;
}

.warning-cell {
  background: transparent;
  border: 0;
  padding: 0;
}

.warning-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 8px 12px;
  border-radius: 14px;
  background: linear-gradient(180deg, #ff5f57 0%, #ff453a 100%);
  color: white;
  box-shadow: 0 12px 24px rgba(255, 69, 58, 0.18);
}

.warning-banner.warning-profit {
  background: linear-gradient(180deg, #ffd84d 0%, #ffcc00 100%);
  color: #2a2200;
}

.warning-triangle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #121212;
  font-size: 12px;
  font-weight: 800;
}

.warning-text {
  font-size: 16px;
}

.warning-reason {
  font-size: 12px;
  text-transform: uppercase;
}

@media (max-width: 1380px) {
  .app-shell,
  .hero,
  .listing-sheet,
  .toolbar-grid,
  .bulk-assign-bar,
  .supplier-header-top,
  .supplier-header-body,
  .overview-meta {
    grid-template-columns: 1fr;
  }

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

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

  .sheet-main {
    border-right: 0;
    border-bottom: 1px solid rgba(50, 65, 92, 0.08);
  }
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
    margin: 0;
    border-radius: 0;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid rgba(47, 63, 88, 0.08);
  }

  .dashboard-grid,
  .user-row,
  .user-controls,
  .supplier-card-actions,
  .users-form-compact {
    grid-template-columns: 1fr;
  }

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

  .span-1,
  .span-2,
  .span-3,
  .span-4,
  .span-12 {
    grid-column: span 1;
  }

  .history-strip {
    grid-template-columns: 1fr;
  }

  .history-open-btn,
  .history-list,
  .history-warning-slot {
    grid-column: auto;
  }

  .add-supplier-inline {
    min-width: 100%;
  }
}
