:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #647184;
  --line: #d9e0ea;
  --panel: #ffffff;
  --soft: #f4f7fb;
  --accent: #0f8b8d;
  --accent-strong: #076f71;
  --warn: #b25b16;
  --danger: #b42318;
  --ok: #087443;
  --shadow: 0 16px 40px rgba(23, 32, 42, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

a {
  color: inherit;
  text-decoration: none;
}

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

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

.shell {
  min-height: 100vh;
}

.auth-shell {
  display: grid;
  place-items: center;
  padding: 28px;
}

.login-wrap {
  width: min(420px, 100%);
}

.login-panel {
  box-shadow: 0 18px 50px rgba(23, 32, 42, 0.12);
}

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

.login-form .primary-button {
  width: 100%;
  min-height: 42px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 64px;
  padding: 0 28px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: #fff;
  background: #17202a;
  border-radius: 7px;
  font-weight: 800;
}

.brand-title {
  font-size: 17px;
  font-weight: 760;
  white-space: nowrap;
}

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

.nav a,
.ghost-button,
.primary-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 7px;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}

.nav a,
.ghost-button {
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}

.primary-button {
  color: #fff;
  background: var(--accent);
}

.primary-button:hover {
  background: var(--accent-strong);
}

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

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  max-width: 1160px;
  margin: 0 auto;
  padding: 36px 28px 18px;
}

.hero h1 {
  max-width: 760px;
  margin: 0;
  font-size: 38px;
  line-height: 1.15;
}

.hero p {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

.hero-copy {
  display: grid;
  gap: 14px;
}

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

.eyebrow,
.section-kicker {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.service-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.service-strip > div {
  display: grid;
  gap: 4px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.service-strip span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.content {
  max-width: 1160px;
  margin: 0 auto;
  padding: 20px 28px 56px;
}

.notice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 30px;
}

.notice-card {
  display: grid;
  gap: 8px;
  min-height: 132px;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.notice-card h2,
.support-band h2,
.section-head h2 {
  margin: 0;
  font-size: 20px;
}

.notice-card p,
.support-band p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.notice-main {
  grid-column: 1 / -1;
  min-height: 92px;
  background: #fffaf0;
  border-color: #efd7a0;
}

.shop-section {
  display: grid;
  gap: 16px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

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

.search {
  width: min(360px, 100%);
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.category-tabs {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.tab-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
}

.tab-button.active {
  color: #fff;
  background: var(--ink);
  border-color: var(--ink);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 238px;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.product-card {
  min-height: 420px;
}

.product-cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #dfe7ef;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.product-cover-fallback {
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #17202a, #0f8b8d);
  font-size: 30px;
  font-weight: 800;
}

.card h3 {
  min-height: 72px;
  margin: 0;
  font-size: 17px;
  line-height: 1.4;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  color: #3b4754;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
}

.stock-ok {
  color: var(--ok);
}

.stock-warn {
  color: var(--warn);
}

.stock-danger {
  color: var(--danger);
}

.description {
  display: -webkit-box;
  min-height: 64px;
  overflow: hidden;
  line-height: 1.55;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.product-foot {
  display: grid;
  gap: 12px;
  margin-top: auto;
}

.price {
  margin-top: auto;
  font-size: 28px;
  font-weight: 800;
}

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

.empty {
  padding: 36px;
  text-align: center;
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.support-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 34px;
  padding: 22px;
  background: #17202a;
  color: #fff;
  border-radius: 8px;
}

.support-band .section-kicker,
.support-band p {
  color: #c9d8e3;
}

.lookup-panel {
  display: grid;
  gap: 14px;
  margin-top: 24px;
  padding: 22px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.lookup-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
}

.lookup-result {
  display: grid;
  gap: 12px;
}

.order-result-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.order-result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.order-result-head h3 {
  margin: 4px 0 0;
  font-size: 20px;
}

.order-result-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 18px;
  margin: 0;
}

.order-result-list div {
  display: grid;
  gap: 4px;
}

.order-result-list dt {
  color: var(--muted);
  font-size: 12px;
}

.order-result-list dd {
  margin: 0;
  font-weight: 700;
}

.delivery-box {
  display: grid;
  gap: 8px;
}

.delivery-box pre {
  min-height: 64px;
  max-height: 260px;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.payment-box {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: #eef8f8;
  border: 1px solid #b9dddd;
  border-radius: 8px;
}

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

.admin-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px 28px 56px;
}

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

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

.panel-header h2 {
  margin: 0;
  font-size: 17px;
}

.panel-body {
  padding: 18px;
}

.wide-panel {
  grid-column: 1 / -1;
}

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

.form-grid.compact {
  grid-template-columns: 1fr 120px;
}

.span-2 {
  grid-column: 1 / -1;
}

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

.field label {
  color: #364354;
  font-size: 13px;
  font-weight: 700;
}

.check-field label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
}

.check-field input {
  width: auto;
  min-height: auto;
}

.field input,
.field textarea,
.field select,
td select {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.field textarea {
  min-height: 72px;
  resize: vertical;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.status {
  margin-top: 12px;
  min-height: 22px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.status.ok {
  color: var(--ok);
}

.status.err {
  color: var(--danger);
}

.table-wrap {
  overflow: auto;
}

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

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

th {
  position: sticky;
  top: 64px;
  z-index: 2;
  background: #f8fafc;
  color: #3f4c5b;
  font-size: 12px;
}

td input[type="text"],
td input[type="number"],
td textarea,
td select {
  width: 100%;
  min-width: 90px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

td textarea {
  min-height: 48px;
}

.orders-table {
  min-width: 1320px;
}

.orders-table textarea {
  min-width: 220px;
  min-height: 68px;
  margin-bottom: 8px;
}

.small-button {
  min-height: 32px;
  padding: 0 10px;
}

.switch-cell {
  min-width: 70px;
}

.pill-ok {
  color: var(--ok);
  font-weight: 700;
}

.pill-warn {
  color: var(--warn);
  font-weight: 700;
}

.order-box {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(23, 32, 42, 0.48);
}

.modal-backdrop[hidden] {
  display: none;
}

.order-modal {
  display: grid;
  gap: 16px;
  width: min(640px, 100%);
  max-height: min(760px, calc(100vh - 40px));
  overflow: auto;
  padding: 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 22px 70px rgba(23, 32, 42, 0.22);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.modal-header h2 {
  margin: 4px 0 0;
  font-size: 20px;
  line-height: 1.35;
}

.icon-button {
  width: 36px;
  padding: 0;
  font-size: 22px;
}

.order-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: #364354;
  font-size: 14px;
  line-height: 1.5;
}

.check-row input {
  margin-top: 3px;
}

.modal-actions {
  margin-top: 0;
}

@media (max-width: 860px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 18px;
  }

  .nav {
    width: 100%;
    overflow-x: auto;
  }

  .hero {
    padding: 28px 18px 14px;
  }

  .hero h1 {
    font-size: 28px;
  }

  .content,
  .admin-layout {
    padding: 18px;
  }

  .admin-layout {
    grid-template-columns: 1fr;
  }

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

  .service-strip,
  .notice-grid {
    grid-template-columns: 1fr;
  }

  .category-tabs {
    justify-content: flex-start;
  }

  .section-head,
  .support-band {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .lookup-form,
  .order-result-list {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }
}
