/* Page layouts and page-specific pieces. */

/* ---- two-column layouts ---- */
.cols-main { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.cols-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.stack-lg { display: grid; gap: 16px; align-content: start; min-width: 0; }
.settings-stack { display: grid; gap: 16px; max-width: 820px; }
@media (max-width: 1023px) {
  .cols-main, .cols-2 { grid-template-columns: minmax(0, 1fr); }
}

/* ---- lists ---- */
.list { list-style: none; margin: 0; padding: 0; }
.list-item + .list-item { border-top: 1px solid var(--line); }
.list-link { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 20px; color: inherit; text-decoration: none; }
.list-link:hover { background: var(--paper-2); }
.list-main { display: grid; gap: 4px; min-width: 0; }
.list-side { display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
.list-static { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 0; }
.list-note { margin: 12px 4px 0; }
.plain { margin: 0; padding-left: 16px; display: grid; gap: 4px; }
.guide { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 16px; }
.guide-item { display: flex; gap: 8px; align-items: flex-start; }
.guide-mark { color: var(--blue); margin-top: 1px; }
.guide-title { font-weight: 600; color: var(--ink); text-decoration: none; }
.guide-title:hover { text-decoration: underline; }
.subhead { font-size: 13px; margin-bottom: 12px; }
.staff-form { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }

/* ---- key/value, totals, address ---- */
.kv { align-items: center; display: grid; grid-template-columns: minmax(96px, max-content) minmax(0, 1fr); gap: 8px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.address { font-style: normal; display: grid; gap: 1px; }
.totals { display: grid; gap: 8px; width: min(100%, 360px); margin-left: auto; padding: 16px 20px 20px; }
.totals-line { display: flex; justify-content: space-between; gap: 16px; }
.totals-line.is-total { margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 15px; font-weight: 600; }

/* ---- timeline ---- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline-item { position: relative; display: grid; grid-template-columns: 12px minmax(0, 1fr); gap: 12px; padding-bottom: 16px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item:not(:last-child)::before { content: ""; position: absolute; left: 5px; top: 14px; bottom: 0; width: 2px; background: var(--line); }
.timeline-mark { width: 12px; height: 12px; margin-top: 3px; border-radius: 50%; border: 2px solid var(--blue); background: #fff; }
.timeline-event { font-weight: 600; }
.timeline-note { margin-top: 4px; color: var(--ink-2); }

/* ---- products ---- */
.product-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.product-name { font-weight: 600; }
.thumb { flex: none; width: 40px; height: 40px; border-radius: 8px; background: var(--paper-2); border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; color: var(--muted); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.variants { display: grid; gap: 12px; }
.variant { border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px 16px; }
.variant-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.variant-title { font-size: 13px; color: var(--muted); }
.variant-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; }
.variant-stock { display: grid; gap: 12px; align-content: start; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.media-item { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.media-thumb { width: 72px; height: 72px; border-radius: 10px; background: var(--paper-2); display: grid; place-items: center; overflow: hidden; color: var(--muted); }
.media-thumb img { width: 100%; height: 100%; object-fit: cover; }
button.media-thumb { padding: 0; border: 0; font: inherit; cursor: zoom-in; }
button.media-thumb:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.media-view { display: grid; gap: 8px; }
.media-view-frame { display: grid; place-items: center; background: var(--paper); border-radius: 10px; }
.media-view-frame:empty { display: none; }
.media-view-img { max-width: 100%; max-height: calc(100dvh - 180px); object-fit: contain; }
.media-view-alt { margin: 0; }
.media-view-size { margin: 0; }
.media-fields { display: grid; gap: 4px; min-width: 0; }
.media-tools { display: flex; align-items: center; gap: 4px; }
.media-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.media-path { display: flex; gap: 8px; align-items: flex-end; margin-top: 16px; }
.media-path .field { flex: 1; }
.cert-preview { border: 1px dashed var(--line-2); border-radius: 12px; padding: 12px; background: var(--paper); display: grid; place-items: center; min-height: 96px; }
.cert-preview img { max-height: 220px; width: auto; max-width: 100%; border-radius: 6px; }
.seo-preview { border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; background: var(--paper); display: grid; gap: 4px; }
.seo-url { color: var(--muted); font-size: 12.5px; }
.seo-title { color: var(--blue-ink); font-size: 16px; font-weight: 500; }
.seo-desc { color: var(--ink-2); }

/* ---- analytics ---- */
.chart-host { width: 100%; min-height: 250px; }
.chart { display: block; max-width: 100%; overflow: visible; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-label { fill: var(--muted); font-size: 11.5px; font-family: var(--font); }
.chart-bar { fill: var(--blue); }
.chart-zero { fill: var(--line-2); }
.chart-hit { fill: transparent; }
.chart-bar-group:hover .chart-bar { fill: var(--blue-ink); }
.chart-bar-group:hover .chart-hit { fill: var(--blue-soft); opacity: 0.5; }
.chart-bar-group:focus { outline: none; }
.chart-bar-group:focus-visible .chart-hit { fill: var(--blue-soft); stroke: var(--blue); }
.chart-data { margin-top: 12px; }
.chart-data summary { cursor: pointer; color: var(--blue-ink); font-weight: 500; }
.chart-data .table-scroll { margin-top: 8px; max-height: 320px; overflow: auto; }

@media (max-width: 1023px) {
  .variant-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 639px) {
  .variant-grid { grid-template-columns: minmax(0, 1fr); }
  .media-grid { grid-template-columns: minmax(0, 1fr); }
  .media-path { flex-direction: column; align-items: stretch; }
  .list-link { padding: 12px 16px; }
  .kv { grid-template-columns: minmax(80px, max-content) minmax(0, 1fr); }
  .totals { padding: 16px 16px 16px; }
}

/* ---- card payments (payments.js, order-detail.js) ---- */
.callout-warn { background: var(--amber-bg); color: var(--amber-fg); display: flex; gap: 8px; align-items: flex-start; }
.timeline-item.is-warning .timeline-mark { border-color: var(--amber-fg); background: var(--amber-bg); }
.timeline-item.is-warning .timeline-event { color: var(--amber-fg); }
.pay-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.pay-cards .panel-body > p + p, .pay-cards .panel-body > ul { margin-top: 8px; }
.choice { border: 0; margin: 12px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: center; }
.choice legend { width: 100%; margin-bottom: 4px; }
.choice .radio { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; }
.choice .radio:has(input:disabled) { color: var(--muted); cursor: not-allowed; }
.choice .field-hint { width: 100%; margin: 0; }
@media (max-width: 1023px) { .pay-cards { grid-template-columns: minmax(0, 1fr); } }
