:root {
  color-scheme: light;
  --bg: #FAFAF8;
  --bg-warm: #F4EEE8;
  --panel: #FFFFFF;
  --ink: #2E2C2B;
  --muted: #6C6B69;
  --accent: #C96A45;
  --accent-hover: #B85A35;
  --accent-soft: #FFF2EA;
  --success: #059669;
  --danger: #DC2626;
  --warning: #D97706;
  --info: #2563EB;
  --border: #E5E3DF;
  --border-light: #F0EFEB;
  --shadow-sm: 0 1px 2px rgba(46, 44, 43, 0.05);
  --shadow: 0 2px 8px rgba(46, 44, 43, 0.08);
  --shadow-lg: 0 4px 16px rgba(46, 44, 43, 0.12);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(201, 106, 69, 0.08), transparent 34rem),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-warm) 100%);
  line-height: 1.6;
  font-size: 15px;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
}

h1 {
  font-size: 30px;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 20px;
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: none;
}

/* Header */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  color: var(--ink);
  letter-spacing: -0.02em;
  transition: color 0.15s ease;
}

.brand::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), #f0b08f);
  box-shadow: 0 0 0 4px rgba(201, 106, 69, 0.12);
}

.brand:hover {
  color: var(--accent);
}

.nav {
  display: flex;
  gap: 32px;
  align-items: center;
}

.nav a {
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  transition: color 0.15s ease;
  position: relative;
}

.nav a:hover {
  color: var(--ink);
}

.nav a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform 0.2s ease;
}

.nav a:hover::after {
  transform: scaleX(1);
}

.user {
  display: flex;
  gap: 20px;
  align-items: center;
  font-size: 14px;
  color: var(--muted);
}

.user span {
  font-weight: 500;
  color: var(--ink);
}

.user a {
  color: var(--muted);
  font-weight: 500;
  transition: color 0.15s ease;
}

.user a:hover {
  color: var(--accent);
}

/* Container */
.container {
  max-width: 1400px;
  margin: 32px auto;
  padding: 0 32px 64px;
}

.page-hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at top right, rgba(201, 106, 69, 0.14), transparent 26rem),
    linear-gradient(135deg, #fffefa 0%, #f6eee7 100%);
}

.page-hero::after {
  content: "";
  position: absolute;
  inset: auto 32px 0 auto;
  width: 160px;
  height: 8px;
  border-radius: 999px 999px 0 0;
  background: linear-gradient(90deg, rgba(201, 106, 69, 0.25), rgba(201, 106, 69, 0.02));
}

.page-hero h1 {
  margin-bottom: 0;
}

.page-title-row {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
}

.page-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.page-subtitle {
  margin-top: 8px;
  color: var(--muted);
}

.page-primary {
  margin-top: 10px;
  font-size: 18px;
  font-weight: 700;
}

.section-title {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.section-title h2 {
  margin-bottom: 0;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stack.tight {
  gap: 10px;
}

.panel-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: 1fr;
  align-items: start;
}

@media (min-width: 1120px) {
  .panel-grid.two {
    grid-template-columns: minmax(0, 1fr) minmax(360px, 0.42fr);
  }
}

.form-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}

@media (min-width: 760px) {
  .form-grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.action-bar {
  margin-top: 22px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.action-bar form,
.inline-form {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin: 0;
  min-width: 0;
}

.inline-note {
  margin-top: 10px;
}

.stat-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.stat-card {
  display: block;
  padding: 14px;
  border: 1px solid var(--border-light);
  border-radius: 14px;
  background: linear-gradient(180deg, #fff 0%, #fbf8f4 100%);
  color: var(--ink);
  text-decoration: none;
}

.stat-card:hover {
  color: var(--ink);
  border-color: rgba(201, 106, 69, 0.35);
  box-shadow: var(--shadow-sm);
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.stat-value {
  display: block;
  margin-top: 5px;
  font-size: 22px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 5px 9px;
  border-radius: 999px;
  background: #f3f0eb;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  overflow-wrap: normal;
  white-space: nowrap;
}

.status-pill.success,
.text-success {
  color: var(--success);
}

.status-pill.success {
  background: #ECFDF5;
}

.status-pill.error,
.text-error {
  color: var(--danger);
}

.status-pill.error {
  background: #FEF2F2;
}

.status-pill.warning,
.text-warning {
  color: var(--warning);
}

.status-pill.warning {
  background: #FEF3C7;
}

.status-pill.info {
  color: var(--info);
  background: #EFF6FF;
}

.status-pill.muted {
  color: var(--muted);
  background: var(--border-light);
}

.danger-zone {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid #FECACA;
}

.help-text {
  color: var(--muted);
  font-size: 13px;
}

.sticky-panel {
  position: sticky;
  top: 88px;
}

.is-hidden {
  display: none !important;
}

.modal-section-title {
  margin: 16px 0 8px;
}

.modal-section-title:first-child {
  margin-top: 0;
}

@media (min-width: 1600px) {
  .container {
    max-width: 1600px;
  }
}

/* Cards */
.card {
  background: var(--panel);
  padding: 32px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 24px;
}

.card.narrow {
  max-width: 460px;
  margin: 80px auto;
}

.card.compact {
  padding: 24px;
}

.card h2 {
  margin-bottom: 20px;
}

.card h2:first-child {
  margin-top: 0;
}

/* Grid */
.grid.two {
  display: grid;
  gap: 24px;
  grid-template-columns: 1fr;
}

.grid > *,
.panel-grid > *,
.search-actions-layout > *,
.shop-header-grid > *,
.item-layout > * {
  min-width: 0;
}

@media (min-width: 960px) {
  .grid.two {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
  }
}

@media (min-width: 1280px) {
  .grid.two.asymmetric {
    grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.55fr);
  }
}

.grid.three {
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .grid.three {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .grid.three {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Compact grid for filters */
.filters-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .filters-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .filters-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1280px) {
  .filters-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1600px) {
  .filters-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Forms */
.form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}

label span {
  font-size: 13px;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="file"],
select,
textarea {
  width: 100%;
  min-width: 0;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 15px;
  font-family: inherit;
  color: var(--ink);
  background: var(--panel);
  transition: all 0.15s ease;
  outline: none;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--muted);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(201, 106, 69, 0.1);
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%236C6B69' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 38px;
}

.checkbox {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  font-weight: 400;
  cursor: pointer;
}

.checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  margin: 0;
  accent-color: var(--accent);
}

table input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  margin: 0;
  accent-color: var(--accent);
}

/* Buttons */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 20px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #FFFFFF;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
  font-family: inherit;
  white-space: nowrap;
}

.button.small {
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
}

.button:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: #FFFFFF;
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.button.secondary {
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--border);
}

.button.secondary:hover {
  background: var(--border-light);
  border-color: var(--muted);
  color: var(--ink);
}

/* Tables */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}

.table th,
.table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
  overflow-wrap: anywhere;
}

.table th:first-child,
.table td:first-child {
  padding-left: 0;
}

.table th:last-child,
.table td:last-child {
  padding-right: 0;
}

.table thead th {
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  background: var(--panel);
  padding-bottom: 14px;
}

.table tbody tr {
  transition: background-color 0.15s ease;
}

.table tbody tr:hover {
  background: var(--bg);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table tbody tr:first-child td {
  padding-top: 16px;
}

.table td a {
  font-weight: 500;
  transition: color 0.15s ease;
}

.table td strong {
  font-weight: 600;
}

.item-id-nowrap {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}

.item-id-nowrap a,
.item-id-nowrap strong {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}

.table-wrap {
  overflow-x: auto;
  margin: 0 -32px;
  padding: 0 32px;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}

.shops-table {
  table-layout: auto;
}

.shops-table-name {
  width: 36%;
  min-width: 320px;
}

.shops-table-name a {
  display: block;
  max-width: min(520px, 42vw);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.single-runs-table {
  table-layout: fixed;
}

.single-runs-table th,
.single-runs-table td {
  padding: 10px 9px;
  overflow-wrap: normal;
  word-break: normal;
}

.single-runs-table th:nth-child(1),
.single-runs-id {
  width: 4%;
}

.single-runs-table th:nth-child(2),
.single-runs-item-id {
  width: 12%;
  white-space: nowrap;
}

.single-runs-table th:nth-child(3) {
  width: 6%;
}

.single-runs-table th:nth-child(4),
.single-runs-status {
  width: 11%;
  white-space: nowrap;
}

.single-runs-table th:nth-child(5),
.single-runs-step {
  width: 18%;
}

.single-runs-table th:nth-child(6),
.single-runs-comment {
  width: 24%;
}

.single-runs-table th:nth-child(7),
.single-runs-created {
  width: 11%;
  white-space: nowrap;
}

.single-runs-table th:nth-child(8),
.single-runs-open {
  width: 6%;
  white-space: nowrap;
}

.single-runs-table th:nth-child(9),
.single-runs-delete {
  width: 8%;
  white-space: nowrap;
}

.single-runs-status .status-pill {
  max-width: 100%;
  padding-inline: 8px;
  font-size: 11px;
}

.single-runs-step .breakable,
.single-runs-comment .breakable {
  display: -webkit-box;
  overflow: hidden;
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: normal;
  -webkit-box-orient: vertical;
}

.single-runs-step .breakable {
  -webkit-line-clamp: 2;
}

.single-runs-comment .breakable {
  -webkit-line-clamp: 3;
}

.single-runs-open a {
  white-space: nowrap;
  font-weight: 600;
}

.single-runs-delete .button.small {
  padding-inline: 9px;
  font-size: 12px;
}

@media (max-width: 768px) {
  .single-runs-table {
    display: block;
  }

  .single-runs-table thead {
    display: none;
  }

  .single-runs-table tbody {
    display: grid;
    gap: 12px;
  }

  .single-runs-table tr {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 12px;
    padding: 14px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: #FFFFFF;
  }

  .single-runs-table td {
    display: grid;
    grid-template-columns: 104px minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    padding: 0;
    border: 0;
    width: auto;
    min-width: 0;
    white-space: normal;
  }

  .single-runs-table td::before {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
    text-transform: uppercase;
  }

  .single-runs-id::before {
    content: "ID";
  }

  .single-runs-item-id::before {
    content: "ID товара";
  }

  .single-runs-table td:nth-child(3)::before {
    content: "Направление";
  }

  .single-runs-status::before {
    content: "Статус";
  }

  .single-runs-step::before {
    content: "Шаг";
  }

  .single-runs-comment::before {
    content: "Комментарий";
  }

  .single-runs-created::before {
    content: "Создан";
  }

  .single-runs-open,
  .single-runs-delete {
    display: flex;
    grid-template-columns: none;
    align-items: center;
    justify-content: flex-start;
    width: auto;
  }

  .single-runs-open::before,
  .single-runs-delete::before {
    content: none;
  }

  .single-runs-open {
    grid-column: 1;
  }

  .single-runs-delete {
    grid-column: 2;
    justify-content: flex-end;
  }

  .single-runs-step,
  .single-runs-comment,
  .single-runs-created {
    grid-column: 1 / -1;
  }
}

@media (max-width: 768px) {
  .table th:first-child,
  .table td:first-child {
    padding-left: 8px;
  }

  .table th:last-child,
  .table td:last-child {
    padding-right: 8px;
  }
}

/* Meta info */
.meta {
  display: grid;
  gap: 10px;
  margin-top: 20px;
  font-size: 14px;
  line-height: 1.7;
  grid-template-columns: 1fr;
}

@media (min-width: 780px) {
  .meta {
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  }
}

.meta div {
  padding: 8px 12px;
  background: var(--bg);
  border-radius: 6px;
  border: 1px solid var(--border-light);
  min-width: 0;
  overflow-wrap: anywhere;
}

.meta strong {
  font-weight: 600;
  color: var(--ink);
  margin-right: 8px;
}

/* Links group */
.links {
  margin-top: 24px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

/* List */
.list {
  margin: 16px 0 0 0;
  padding-left: 0;
  list-style: none;
}

.list li {
  margin-bottom: 12px;
  padding-left: 24px;
  position: relative;
  line-height: 1.6;
}

.list li::before {
  content: '•';
  position: absolute;
  left: 8px;
  color: var(--accent);
  font-weight: bold;
}

.list li strong {
  color: var(--ink);
  font-weight: 600;
}

.list.compact {
  margin: 0;
  padding-left: 0;
}

.list.compact li {
  margin-bottom: 6px;
  padding-left: 20px;
  font-size: 13px;
}

.list.compact li::before {
  left: 6px;
  font-size: 14px;
}

.list + .button,
.list + [data-dialog-open] {
  margin-top: 8px;
}

/* Modals */
dialog.modal {
  border: none;
  border-radius: 12px;
  padding: 0;
  width: min(720px, 92vw);
  box-shadow: var(--shadow-lg);
}

dialog.modal.centered {
  position: fixed;
  top: 50%;
  left: 50%;
  margin: 0;
  transform: translate(-50%, -50%);
}

dialog.modal::backdrop {
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
}

.modal-header,
.modal-footer {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-light);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background: var(--bg);
}

.modal-header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}

.modal-body {
  padding: 20px 24px;
  max-height: 60vh;
  overflow: auto;
}

.modal-footer {
  border-bottom: none;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--bg);
}

.updated-otc-compare-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 900px) {
  .updated-otc-compare-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.updated-otc-compare-col {
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 12px;
  background: #fff;
}

/* Muted text */
.muted {
  color: var(--muted);
  font-size: 14px;
}

span.muted {
  font-size: inherit;
}

/* Alerts */
.alert {
  background: #FEF2F2;
  color: #991B1B;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid #FECACA;
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert::before {
  content: '⚠';
  font-size: 16px;
  flex-shrink: 0;
}

.alert.success {
  background: #ECFDF5;
  color: #065F46;
  border-color: #A7F3D0;
}

.alert.success::before {
  content: '✓';
}

/* Status badges */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-success {
  background: #ECFDF5;
  color: #065F46;
}

.badge-error {
  background: #FEF2F2;
  color: #991B1B;
}

.badge-warning {
  background: #FEF3C7;
  color: #92400E;
}

.badge-info {
  background: #EFF6FF;
  color: #1E40AF;
}

/* Button variants */
.button-secondary {
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--border);
}

.button-secondary:hover {
  background: var(--border-light);
  border-color: var(--muted);
}

.button-danger {
  background: #DC2626;
}

.button-danger:hover {
  background: #B91C1C;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 24px;
}

.empty-state h3 {
  font-size: 18px;
  margin-bottom: 10px;
  color: var(--ink);
  font-weight: 600;
}

.empty-state p {
  color: var(--muted);
  margin-bottom: 0;
  font-size: 14px;
  line-height: 1.6;
}

/* Loading spinner */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* Link with icon */
a[target="_blank"]::after {
  content: ' ↗';
  font-size: 0.85em;
  opacity: 0.6;
}

/* Utility classes */
.text-muted {
  color: var(--muted);
}

/* Improved scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* Search & Actions Layout */
.search-actions-layout {
  display: grid;
  gap: 24px;
  grid-template-columns: 1fr;
  align-items: start;
}

@media (min-width: 1024px) {
  .search-actions-layout {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  }
}

.bulk-actions-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.bulk-actions-panel.card {
  margin-bottom: 0;
}

@media (max-width: 1023px) {
  .bulk-actions-panel {
    width: 100%;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 20px;
  }

  .nav {
    gap: 20px;
  }

  .nav a::after {
    display: none;
  }

  .container {
    padding: 20px 20px 40px;
    margin: 16px auto;
  }

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

  .card.compact {
    padding: 18px;
  }

  .grid.two {
    grid-template-columns: 1fr;
    gap: 16px;
  }

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

  .table-wrap {
    margin: 0 -20px;
    padding: 0 20px;
  }

  h1 {
    font-size: 24px;
  }

  h2 {
    font-size: 18px;
    margin-bottom: 14px;
  }

  .links {
    flex-direction: column;
    width: 100%;
    gap: 8px;
  }

  .action-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .action-bar form,
  .inline-form {
    width: 100%;
  }

  .button {
    width: 100%;
    white-space: normal;
  }

  .search-actions-layout {
    gap: 16px;
  }

  .meta {
    gap: 8px;
  }

  .meta div {
    padding: 10px;
    font-size: 13px;
  }

  .shop-header-grid,
  .item-layout {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .shop-sidebar-cards {
    gap: 16px;
  }

  .page-title-row,
  .single-run-progress-head {
    flex-direction: column;
  }
}

@media (max-width: 768px) {
  .single-runs-delete .inline-form {
    width: auto;
  }

  .single-runs-delete .button {
    width: auto;
    white-space: nowrap;
  }
}

/* Shop Detail Layout */
.shop-header-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: 1fr;
  align-items: start;
  margin-bottom: 24px;
}

.shop-sidebar-cards {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

@media (min-width: 1024px) {
  .shop-header-grid {
    grid-template-columns: 1fr 420px;
  }
}

@media (min-width: 1280px) {
  .shop-header-grid {
    grid-template-columns: 1fr 480px;
  }
}

/* Item Detail Layout */
.item-layout {
  display: grid;
  gap: 24px;
  grid-template-columns: 1fr;
  align-items: start;
}

@media (min-width: 1024px) {
  .item-layout {
    grid-template-columns: 480px 1fr;
  }
}

@media (min-width: 1280px) {
  .item-layout {
    grid-template-columns: 520px 1fr;
  }
}

.item-info,
.item-skus {
  min-width: 0;
}

.breakable {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.single-run-top-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: 1fr;
  align-items: start;
}

@media (min-width: 1180px) {
  .single-run-top-grid {
    grid-template-columns: minmax(0, 1fr) minmax(420px, 0.48fr);
  }
}

.single-run-meta {
  grid-template-columns: 1fr;
}

@media (min-width: 900px) {
  .single-run-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.single-run-ai-card {
  align-self: stretch;
}

.single-run-ai-form {
  display: grid;
  gap: 12px;
  margin-top: 4px;
}

.single-run-ai-form .checkbox {
  flex-direction: row;
  justify-content: flex-start;
  margin: 0;
}

.single-run-stage-actions {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border-light);
}

.single-run-stage-form {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.single-run-stage-form .button {
  width: 100%;
  white-space: normal;
  text-align: center;
}

@media (min-width: 640px) and (max-width: 1179px) {
  .single-run-stage-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.single-run-detail-layout {
  margin-top: 0;
}

.ai-command-panel {
  display: grid;
  gap: 18px;
}

.ai-command-main {
  display: flex;
  gap: 18px;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
}

.ai-command-main h2 {
  margin-bottom: 4px;
}

.ai-command-actions {
  margin-top: 0;
  justify-content: flex-end;
}

.ai-run-form {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
  align-items: center;
}

.ai-run-form .checkbox {
  flex-direction: row;
  margin: 0;
}

@media (min-width: 860px) {
  .ai-run-form {
    grid-template-columns: minmax(220px, 0.5fr) minmax(260px, 1fr) auto;
  }
}

.ai-unified-layout {
  margin-top: 24px;
}

.ai-progress {
  margin-bottom: 24px;
}

/* Sticky sidebar */
@media (max-width: 959px) {
  [style*="position: sticky"] {
    position: static !important;
  }
}

/* Medium screens (tablets, small laptops like 13" MacBook) */
@media (min-width: 769px) and (max-width: 1023px) {
  .topbar {
    padding: 16px 24px;
  }

  .container {
    max-width: 100%;
    padding: 0 24px 48px;
  }

  .card {
    padding: 24px;
  }

  .card.compact {
    padding: 20px;
  }

  h1 {
    font-size: 26px;
  }

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

  .shop-header-grid,
  .item-layout {
    grid-template-columns: 1fr;
  }
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Focus styles for accessibility */
input:focus-visible,
select:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.code-block {
  margin: 0;
  padding: 16px;
  border-radius: 16px;
  background: #1f1f1f;
  color: #f8f4ef;
  font-size: 13px;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.simple-list {
  margin: 0;
  padding-left: 18px;
}

.simple-list li + li {
  margin-top: 8px;
}

.stage-card {
  padding: 24px 0 28px;
  border-top: 1px solid var(--border);
  position: relative;
}

.stage-card:first-of-type {
  padding-top: 0;
  border-top: 0;
}

.stage-card:not(:last-of-type)::after {
  content: "";
  display: block;
  height: 8px;
  margin-top: 28px;
  border-radius: 999px;
  background: linear-gradient(90deg, #e6d7cb 0%, #f3ebe4 48%, #e6d7cb 100%);
}

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

.stage-head h3 {
  margin: 0 0 6px;
}

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

.field-label {
  display: block;
  margin: 12px 0 8px;
  font-weight: 600;
}

.input,
.textarea {
  width: 100%;
}

.textarea {
  min-height: 120px;
}

.details-block {
  margin-top: 16px;
}

.details-block-flush {
  margin-top: 0;
}

.details-block summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 12px;
}

.details-block:not([open]) summary {
  margin-bottom: 0;
}

.home-variation-audit h2 {
  font-size: 22px;
  overflow-wrap: anywhere;
}

.home-variation-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.home-variation-row {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--bg);
}

.home-variation-row > div {
  min-width: 0;
}

.home-variation-label {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.3;
  text-transform: uppercase;
}

.home-variation-value {
  display: block;
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (min-width: 640px) {
  .home-variation-row {
    grid-template-columns: minmax(0, 1fr) minmax(90px, 0.45fr);
  }
}

.stage-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0 0;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
}

.stage-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  flex: 0 0 auto;
  accent-color: var(--accent);
}

.stage-toggle-large {
  gap: 12px;
}

.stage-toggle-large input[type="checkbox"] {
  width: 36px;
  height: 36px;
}

.stage-toggle-text {
  line-height: 1.4;
}

.stage-toggle-help {
  margin: 8px 0 12px;
}

.status-bar {
  margin-top: 16px;
}

.single-run-progress {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background:
    radial-gradient(circle at top left, rgba(201, 106, 69, 0.12), transparent 32%),
    linear-gradient(135deg, #fffdf9 0%, #f6f0ea 100%);
  box-shadow: var(--shadow-sm);
}

.single-run-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.single-run-progress-head h2 {
  margin: 4px 0 0;
}

.single-run-progress-kicker,
.single-run-progress-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.single-run-progress-state {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.single-run-progress-steps {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 860px) {
  .single-run-progress-steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.single-run-progress-step {
  min-width: 0;
  position: relative;
  padding: 14px 14px 14px 18px;
  border: 1px solid var(--border-light);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.74);
  overflow: hidden;
}

.single-run-progress-step::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: #d7d2ca;
}

.single-run-progress-step.is-current {
  border-color: rgba(201, 106, 69, 0.42);
  background: #fff8f3;
  box-shadow: 0 0 0 3px rgba(201, 106, 69, 0.08);
}

.single-run-progress-step.is-current::before {
  background: var(--accent);
}

.single-run-progress-step.is-prev::before {
  background: #8fb99f;
}

.single-run-progress-step strong {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
  font-size: 16px;
}

.single-run-progress[data-status="DONE"] .single-run-progress-step.is-current,
.single-run-progress[data-status="TERMINAL"] .single-run-progress-step.is-current,
.single-run-progress[data-status="FAILED"] .single-run-progress-step.is-current {
  box-shadow: none;
}

.single-run-progress[data-status="TERMINAL"] {
  border-color: #f0c36a;
  background:
    radial-gradient(circle at top left, rgba(217, 119, 6, 0.10), transparent 32%),
    linear-gradient(135deg, #fffdf7 0%, #f7efe0 100%);
}

.single-run-progress[data-status="TERMINAL"] .single-run-progress-step.is-current::before {
  background: #d97706;
}

.single-run-progress[data-status="FAILED"] {
  border-color: #f3b6b6;
  background:
    radial-gradient(circle at top left, rgba(220, 38, 38, 0.10), transparent 32%),
    linear-gradient(135deg, #fffafa 0%, #f9eeee 100%);
}

.single-run-progress[data-status="FAILED"] .single-run-progress-step.is-current::before {
  background: #dc2626;
}

.single-run-progress-error {
  margin-top: 12px;
}

.single-run-progress-comment {
  margin: 8px 0 0;
  max-width: 760px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: #f3ebe4;
  color: #8a4b2f;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
