:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f4f7fb;
  color: #172033;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.app-shell {
  width: min(1240px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 30px 0;
}

.topbar,
.top-actions,
.panel-title,
.notice,
.row-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar {
  justify-content: space-between;
  margin-bottom: 18px;
}

.top-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.eyebrow {
  margin: 0 0 4px;
  color: #526b86;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: 32px;
  line-height: 1.15;
}

h2 {
  font-size: 18px;
}

.notice {
  align-items: flex-start;
  margin-bottom: 18px;
  border: 1px solid #d5dee9;
  border-left: 4px solid #2e75b8;
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff;
  color: #314259;
}

.layout,
.workspace {
  display: grid;
  gap: 16px;
}

.workspace {
  grid-template-columns: 0.78fr 1.1fr;
  align-items: start;
}

.orders-panel,
.admin-panel {
  grid-column: 1 / -1;
}

.panel {
  border: 1px solid #dce4ef;
  border-radius: 8px;
  padding: 18px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(42, 65, 94, 0.08);
}

.auth-panel {
  max-width: 460px;
}

.panel-title {
  justify-content: space-between;
  margin-bottom: 14px;
}

.status-pill,
.tag {
  border: 1px solid #cbd6e5;
  border-radius: 999px;
  padding: 7px 11px;
  background: #fff;
  color: #42536a;
  font-size: 13px;
  font-weight: 700;
}

.status-pill.ok {
  border-color: #58b786;
  color: #17663d;
}

.status-pill.bad {
  border-color: #e19191;
  color: #9d2424;
}

.segmented {
  display: flex;
  border: 1px solid #cbd6e5;
  border-radius: 8px;
  overflow: hidden;
}

.segment {
  min-width: 64px;
  border: 0;
  padding: 8px 10px;
  background: #f8fafc;
  color: #4a5c72;
  font-weight: 700;
}

.segment.active {
  background: #1f6fbf;
  color: #fff;
}

.icon-button,
.text-button,
.primary-button,
.mini-button,
.mini-danger {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 12px;
  font-weight: 700;
}

.icon-button {
  width: 38px;
  padding: 0;
  border-color: #cbd6e5;
  background: #f9fbfe;
}

.text-button,
.mini-button {
  border-color: #cbd6e5;
  background: #f9fbfe;
  color: #26364c;
}

.primary-button {
  background: #1f6fbf;
  color: #fff;
}

.mini-danger {
  background: #b93535;
  color: #fff;
}

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

.metric {
  display: grid;
  gap: 4px;
  min-height: 90px;
  border-radius: 8px;
  padding: 14px;
  background: #eef5fb;
}

.metric span {
  color: #5f7188;
  font-size: 13px;
}

.metric strong {
  overflow-wrap: anywhere;
  font-size: 26px;
}

.form,
label {
  display: grid;
}

.form {
  gap: 12px;
}

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

.dense-form .primary-button {
  grid-column: 1 / -1;
}

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

.catalog-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid #dce4ef;
  border-radius: 8px;
  padding: 11px;
  background: #fbfdff;
}

.catalog-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #eef5fb;
  color: #1f6fbf;
  font-size: 22px;
  font-weight: 800;
  overflow: hidden;
}

.catalog-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.catalog-main {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.catalog-main strong,
.catalog-main span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.catalog-main span {
  color: #667990;
  font-size: 12px;
}

.catalog-price {
  color: #17663d;
  font-weight: 800;
}

.catalog-empty {
  grid-column: 1 / -1;
  border: 1px dashed #cbd6e5;
  border-radius: 8px;
  padding: 14px;
  color: #6b7c90;
  text-align: center;
}

label {
  gap: 6px;
  color: #314259;
  font-size: 13px;
  font-weight: 700;
}

input {
  width: 100%;
  border: 1px solid #cbd6e5;
  border-radius: 8px;
  padding: 10px 12px;
  color: #172033;
}

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

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

th,
td {
  border-bottom: 1px solid #e2e8f0;
  padding: 11px 10px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: #526b86;
  font-size: 13px;
}

.selected-row {
  background: #eef5fb;
}

.empty {
  color: #6b7c90;
  text-align: center;
}

.code-cell {
  color: #17663d;
  font-weight: 800;
}

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

.output {
  min-height: 112px;
  max-height: 280px;
  overflow: auto;
  margin: 14px 0 0;
  border-radius: 8px;
  padding: 12px;
  background: #111827;
  color: #d6e4ff;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.output.small {
  min-height: 72px;
}

@media (max-width: 980px) {
  .workspace,
  .admin-grid,
  .dense-form,
  .catalog-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100vw - 20px, 1240px);
    padding: 18px 0;
  }

  .topbar,
  .notice {
    align-items: flex-start;
    flex-direction: column;
  }

  h1 {
    font-size: 26px;
  }

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

  .catalog-card {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .catalog-price,
  .catalog-card .mini-button {
    grid-column: 1 / -1;
  }
}
