:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --green: #0f9d58;
  --blue: #2563eb;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
}
.toast-root {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: grid;
  gap: 10px;
  width: min(92vw, 420px);
  pointer-events: none;
}
.toast {
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity .22s ease, transform .22s ease;
  border-radius: 12px;
  padding: 12px 14px;
  color: #fff;
  font-size: 14px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}
.toast.info { background: #2563eb; }
.toast.success { background: #0f9d58; }
.toast.error { background: #dc2626; }
.shell { max-width: 1120px; margin: 0 auto; padding: 24px; }
header { margin-bottom: 16px; }
header h1 { margin: 0 0 4px; font-size: 28px; }
header p { margin: 0; color: var(--muted); }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.04);
}
.grid-two { display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
h2 { margin: 0 0 12px; font-size: 18px; }
button {
  border: 0;
  border-radius: 10px;
  background: var(--blue);
  color: #fff;
  padding: 10px 14px;
  cursor: pointer;
}
button:hover { filter: brightness(0.95); }
.ghost-btn {
  background: transparent;
  color: var(--blue);
  border: 1px solid var(--blue);
}
.danger-btn {
  background: #dc2626;
  color: #fff;
}
.kv {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px dashed var(--line);
  padding: 10px 0;
}
.kv span { color: var(--muted); }
.kv b { text-align: right; word-break: break-word; }
.preview-box {
  position: relative;
  min-height: 260px;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #fafafa;
  display: grid;
  place-items: center;
}
.preview-box img {
  display: none;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.link-panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: #fbfdff;
  margin-bottom: 12px;
}
.pay-link {
  color: var(--blue);
  text-decoration: none;
  word-break: break-all;
}
.pay-link:hover { text-decoration: underline; }
.placeholder {
  color: var(--muted);
  padding: 24px;
  text-align: center;
}
.mini-meta {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
  display: grid;
  gap: 4px;
  word-break: break-all;
}
.mini-meta > div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.login-panel-header {
  align-items: flex-start;
  margin-bottom: 12px;
}
.login-actions {
  gap: 8px;
  flex-wrap: wrap;
}
.login-actions button {
  padding: 7px 10px;
  font-size: 12px;
  border-radius: 8px;
}
.cookie-box {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfdff;
  padding: 12px;
  display: grid;
  gap: 10px;
}
.cookie-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.cookie-input {
  width: 100%;
  min-height: 108px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  font: inherit;
  line-height: 1.5;
  color: var(--text);
  background: #fff;
}
.cookie-validate-hint {
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.5;
  background: #f3f4f6;
  color: var(--muted);
  border: 1px solid var(--line);
}
.cookie-validate-hint.ok {
  background: #ecfdf3;
  border-color: #b7ebc6;
  color: #0f9d58;
}
.cookie-validate-hint.warn {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #c2410c;
}
.cookie-validate-hint.error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #dc2626;
}
.cookie-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.cookie-actions button {
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 8px;
}
.cookie-hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
#login-qr-section {
  display: block;
}
.login-qr-hint {
  margin-bottom: 12px;
  min-height: 260px;
  display: none;
}
#login-qr-expire-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.user-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
  background: #fafcff;
}
.user-main {
  display: grid;
  gap: 4px;
}
.user-name {
  font-size: 20px;
  font-weight: 700;
}
.user-meta {
  color: var(--muted);
  font-size: 12px;
  word-break: break-all;
}
.user-pill {
  align-self: flex-start;
  border-radius: 999px;
  background: #e5e7eb;
  color: var(--muted);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
}
.user-pill.ok {
  background: #dcfce7;
  color: var(--green);
}
.orders { display: grid; gap: 12px; }
.selection-summary {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}
.order-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}
.order-check {
  display: flex;
  align-items: flex-start;
  padding-top: 4px;
}
.order-select {
  width: 16px;
  height: 16px;
}
.order-id { font-weight: 700; margin-bottom: 6px; }
.order-title { color: var(--text); margin-bottom: 6px; white-space: pre-wrap; word-break: break-word; }
.order-meta { display: flex; flex-wrap: wrap; gap: 10px 16px; color: var(--muted); font-size: 13px; }
.empty { color: var(--muted); padding: 14px 0; }
.pay-box { min-height: 300px; }
.pay-qr-hint {
  min-height: 300px;
  display: grid;
  place-items: center;
}
.order-actions { display: flex; align-items: center; }
.row-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}
.link-panel .kv:last-child { border-bottom: 0; padding-bottom: 0; }
@media (max-width: 860px) {
  .grid-two { grid-template-columns: 1fr; }
  .order-card { grid-template-columns: 1fr; }
  .order-actions { justify-content: flex-start; }
  .order-check { padding-top: 0; }
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(15, 23, 42, 0.45);
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal-card {
  width: min(92vw, 440px);
  background: #fff;
  border-radius: 16px;
  border: 1px solid rgba(229, 231, 235, 0.9);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.24);
  padding: 20px;
}
.modal-card h3 {
  margin: 0 0 10px;
  font-size: 18px;
}
.modal-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}
