:root {
  color-scheme: light;
  --ink: #0b2345;
  --muted: #5f6f86;
  --line: #d9e0ea;
  --soft: #f5f7fa;
  --accent: #123a63;
  --danger: #9f1d1d;
  --ok: #12633a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #ffffff;
}

[hidden] {
  display: none !important;
}

a {
  color: var(--accent);
}

.shell {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.1;
}

h1 {
  font-size: 32px;
  font-weight: 600;
}

h2 {
  font-size: 20px;
  font-weight: 600;
}

h3 {
  font-size: 16px;
}

.muted {
  color: var(--muted);
}

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

.panel {
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
}

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

label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

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

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid #9daabd;
  border-radius: 6px;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

button {
  min-height: 42px;
  padding: 10px 16px;
  color: #ffffff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  cursor: pointer;
}

button.secondary {
  color: var(--ink);
  background: #ffffff;
  border-color: #9daabd;
}

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

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.items {
  display: grid;
  gap: 14px;
}

.item-row {
  display: grid;
  gap: 16px;
  padding: 16px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.item-search-row {
  width: min(720px, 100%);
}

.item-core-row {
  display: grid;
  grid-template-columns: minmax(440px, 1fr) 150px 100px 130px;
  gap: 12px;
  align-items: start;
}

.item-engraving-row {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.item-notes-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px;
  gap: 12px;
  align-items: end;
}

.engraving-fields {
  display: none;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.engraving-fields.is-visible {
  display: grid;
}

.engraving-location-field:has(.engraving-location:empty) {
  display: none !important;
}

.search-wrap {
  position: relative;
}

.suggestions {
  position: absolute;
  z-index: 10;
  top: calc(100% + 4px);
  left: 0;
  right: auto;
  width: min(720px, calc(100vw - 48px));
  max-height: 260px;
  overflow: auto;
  background: #ffffff;
  border: 1px solid #9daabd;
  border-radius: 6px;
  box-shadow: 0 14px 28px rgba(11, 35, 69, 0.16);
}

.suggestion {
  display: block;
  width: 100%;
  min-height: auto;
  padding: 8px 10px;
  color: var(--ink);
  text-align: left;
  background: #ffffff;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
}

.suggestion:last-child {
  border-bottom: 0;
}

.suggestion-empty {
  padding: 14px 16px;
  color: var(--muted);
  background: #ffffff;
}

.suggestion:hover,
.suggestion:focus {
  background: var(--soft);
}

.suggestion-content,
.selected-product {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.suggestion-content span,
.selected-product span {
  display: block;
}

.product-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.product-thumb-placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

.product-summary {
  min-height: 76px;
  padding: 10px 12px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
}

.totals {
  display: grid;
  gap: 8px;
  max-width: 360px;
  margin-left: auto;
}

.total-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.total-row.strong {
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 22px;
  font-weight: 700;
}

.notice,
.error,
.success {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 8px;
}

.notice {
  background: #eef3f8;
}

.error {
  color: var(--danger);
  background: #fff0f0;
}

.success {
  color: var(--ok);
  background: #eef9f2;
}

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

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

.order-card {
  text-align: left;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
}

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

pre {
  overflow: auto;
  padding: 16px;
  background: #07182d;
  color: #dce9ff;
  border-radius: 8px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

@media (max-width: 1180px) {
  .item-core-row {
    grid-template-columns: minmax(320px, 1fr) 130px 90px 120px;
  }
}

@media (max-width: 840px) {
  .grid,
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .item-core-row,
  .item-engraving-row,
  .item-notes-row,
  .engraving-fields {
    grid-template-columns: 1fr;
  }

  .totals {
    max-width: none;
    margin-left: 0;
  }
}
