:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --ink: #111827;
  --muted: #667085;
  --line: #d9e1ec;
  --primary: #4f46e5;
  --primary-strong: #4338ca;
  --green: #059669;
  --danger: #dc2626;
  --shadow: 0 16px 40px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", sans-serif;
}

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--primary);
  flex: 0 0 auto;
}
.brand-mark svg { width: 23px; height: 23px; }
.brand strong { display: block; font-size: 15px; }
.brand span { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }

.top-status {
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
  white-space: nowrap;
}

.plain-link {
  color: var(--primary);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.workspace {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 46px;
}

.lookup-panel, .info-card, .status-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.lookup-panel {
  padding: 26px;
  margin-bottom: 18px;
}

.overline {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

h1 {
  margin: 0 0 20px;
  font-size: 28px;
  line-height: 1.2;
}

.lookup-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 12px;
}
.lookup-row.compact { grid-template-columns: minmax(0, 1fr) 96px; }

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

input { height: 46px; padding: 0 14px; }
textarea { padding: 13px 14px; resize: vertical; margin: 0 0 14px; }

button {
  border: 0;
  border-radius: 10px;
  height: 46px;
  padding: 0 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.primary { color: white; background: var(--primary); }
.primary:hover { background: var(--primary-strong); }
.secondary { color: var(--primary); background: #eef2ff; }
.secondary:hover { background: #e0e7ff; }

.text-button {
  height: 34px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
}

.icon-button {
  width: 34px;
  height: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
}
.icon-button svg { width: 18px; height: 18px; }
.icon-button:hover, .text-button:hover { color: var(--primary); border-color: #c7d2fe; }

.message {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
}
.message.error { color: var(--danger); }
.message.ok { color: var(--green); }

.hidden { display: none !important; }

.result-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.info-card { padding: 22px; min-width: 0; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 16px;
}

.main-value {
  display: block;
  min-height: 50px;
  font-size: 36px;
  line-height: 1.15;
  overflow-wrap: anywhere;
  margin-bottom: 18px;
}

.sms-card { grid-column: span 2; }
.sms-text {
  margin: 0;
  min-height: 86px;
  padding: 16px;
  border-radius: 10px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.status-card {
  grid-column: span 2;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  overflow: hidden;
  padding: 0;
}
.status-card > div {
  padding: 18px 20px;
  background: var(--surface);
}
.status-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 8px;
}
.status-card strong { font-size: 16px; overflow-wrap: anywhere; }

.shop-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 18px;
  align-items: stretch;
  margin-bottom: 18px;
}
.shop-hero > div {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 26px;
}
.shop-copy { margin: 0; color: var(--muted); line-height: 1.7; }
.price-box { display: flex; flex-direction: column; justify-content: center; }
.price-box span, .price-box small { color: var(--muted); font-size: 13px; font-weight: 800; }
.price-box strong { display: block; font-size: 30px; margin: 10px 0; }
.order-result {
  margin-top: 16px;
  min-height: 160px;
  color: var(--muted);
}
.order-meta { margin: 0 0 14px; display: grid; gap: 8px; }
.order-meta div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.order-meta dt { color: var(--muted); font-size: 13px; font-weight: 800; }
.order-meta dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; text-align: right; }
.payment-box, .delivery-box {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  padding: 14px;
  line-height: 1.7;
}
.delivery-box span { display: block; color: var(--muted); font-size: 12px; font-weight: 800; }
.delivery-box strong { display: block; font-size: 24px; color: var(--ink); overflow-wrap: anywhere; margin: 6px 0; }
.delivery-box a { color: var(--primary); font-weight: 800; text-decoration: none; }

.admin-shell h1 { font-size: clamp(30px, 5vw, 48px); }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 18px;
}
.hero { display: flex; justify-content: space-between; gap: 24px; align-items: center; margin-bottom: 20px; }
.admin-link {
  color: white;
  background: var(--ink);
  padding: 12px 16px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 800;
}
.label, .kicker { display: block; color: var(--muted); font-size: 13px; font-weight: 800; margin-bottom: 8px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.summary { display: flex; flex-wrap: wrap; gap: 8px; }
.summary span { background: #eef3f8; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { border-bottom: 1px solid var(--line); padding: 10px; text-align: left; font-size: 13px; }
th { color: var(--muted); }
td { overflow-wrap: anywhere; }

@media (max-width: 760px) {
  .topbar { padding: 0 14px; }
  .top-status { display: none; }
  .workspace { width: min(100% - 20px, 1080px); padding-top: 22px; }
  .lookup-panel, .info-card { padding: 18px; }
  h1 { font-size: 23px; }
  .lookup-row, .result-layout, .status-card, .form-grid { grid-template-columns: 1fr; }
  .shop-hero { grid-template-columns: 1fr; }
  .sms-card, .status-card { grid-column: span 1; }
  .main-value { font-size: 28px; }
}
