:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1d252d;
  --muted: #667085;
  --line: #d9dee7;
  --primary: #cc0000;
  --primary-dark: #9f0000;
  --green: #087443;
  --amber: #9a6700;
  --red: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
}

a {
  color: var(--primary-dark);
}

button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  padding: 8px 12px;
}

button.primary,
button:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

button.success {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

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

button.info {
  background: #155eef;
  border-color: #155eef;
  color: #fff;
}

button:disabled {
  background: #eef2f6;
  border-color: var(--line);
  color: var(--muted);
  cursor: default;
}

input {
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  padding: 9px 10px;
  width: 100%;
}

main {
  margin: 0 auto;
  max-width: 1180px;
  padding: 24px;
}

.app-header {
  align-items: center;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 18px 24px;
}

.app-header h1,
.app-header p {
  margin: 0;
}

.app-header h1 {
  font-size: 22px;
}

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

.check-status {
  color: var(--muted);
  font-size: 13px;
  min-height: 18px;
}

.logout-form button {
  color: var(--muted);
}

.app-header p,
.muted,
.empty {
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 16px;
}

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

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 16px;
  padding: 16px;
}

.panel h2 {
  font-size: 16px;
  margin: 0 0 14px;
}

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

.panel-header h2 {
  margin: 0;
}

.modal-backdrop {
  align-items: start;
  background: rgba(29, 37, 45, 0.35);
  bottom: 0;
  display: flex;
  justify-content: center;
  left: 0;
  overflow-y: auto;
  padding: 48px 24px;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 20;
}

.modal-panel {
  background: var(--panel);
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(29, 37, 45, 0.25);
  max-width: 860px;
  padding: 16px;
  width: min(100%, 860px);
}

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

.modal-header {
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
  padding-bottom: 12px;
}

.modal-header h2 {
  font-size: 16px;
  margin: 0;
}

.modal-footer {
  border-top: 1px solid var(--line);
  justify-content: end;
  margin-top: 12px;
  padding-top: 12px;
}

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

.inline-form {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(120px, 1fr) auto;
}

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

.section-search.compact {
  max-width: 340px;
}

.notice {
  align-items: center;
  background: #eef7ff;
  border: 1px solid #b9ddff;
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr auto;
  margin-bottom: 16px;
  padding: 10px 12px;
}

.notice.error {
  background: #fff1f0;
  border-color: #f3b8b4;
}

.notice-dismiss {
  background: transparent;
  border: 0;
  color: var(--muted);
  line-height: 1;
  padding: 2px 4px;
}

.notice-dismiss:hover,
.notice-dismiss:focus {
  background: transparent;
  color: var(--text);
}

.login-page {
  background: var(--bg);
}

.login-shell {
  align-items: center;
  display: grid;
  min-height: 100vh;
  padding: 24px;
}

.login-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(29, 37, 45, 0.12);
  display: grid;
  gap: 18px;
  margin: 0 auto;
  max-width: 380px;
  padding: 24px;
  width: 100%;
}

.login-panel h1,
.login-panel p {
  margin: 0;
}

.login-panel h1 {
  font-size: 24px;
}

.eyebrow {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 4px;
  text-transform: uppercase;
}

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

table {
  border-collapse: collapse;
  min-width: 760px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

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

.product-cell {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: 52px 1fr;
}

.product-cell img {
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 6px;
  object-fit: cover;
  width: 52px;
}

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

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

.store-row {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr auto auto;
  padding: 10px;
}

.store-row .muted {
  display: block;
}

.status {
  border-radius: 999px;
  display: inline-block;
  font-size: 13px;
  padding: 3px 8px;
}

.status.available {
  background: #dcfae6;
  color: var(--green);
}

.status.limited {
  background: #fef0c7;
  color: var(--amber);
}

.status.out_of_stock,
.status.not_sold_in_store,
.status.error {
  background: #fee4e2;
  color: var(--red);
}

.status.pending,
.status.unknown,
.status.online_only {
  background: #eef2f6;
  color: #475467;
}

.alerts {
  margin: 0;
  padding-left: 20px;
}

@media (max-width: 760px) {
  main {
    padding: 16px;
  }

  .app-header,
  .grid.two,
  .panel-header,
  .store-row {
    grid-template-columns: 1fr;
  }

  .app-header {
    align-items: stretch;
    display: grid;
    gap: 12px;
  }

  .header-actions {
    align-items: stretch;
    display: grid;
    justify-content: stretch;
  }

  .panel-header {
    align-items: stretch;
    display: grid;
  }

  .section-search,
  .section-search.compact {
    max-width: none;
    width: 100%;
  }
}
