.admin-body { padding-bottom: 40px; }
.admin-wrap { max-width: 1180px; margin: 0 auto; }
.admin-topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 16px; }
.admin-top-actions { display: flex; align-items: center; gap: 14px; }
.admin-identity { color: var(--muted); font-size: 0.88rem; }
.admin-auth-panel { max-width: 460px; margin: 10vh auto; padding: 28px; background: var(--surface); border: 1px solid var(--line); }
.admin-auth-panel h1, .admin-heading-row h1 { font-size: clamp(2rem, 4vw, 3rem); line-height: 1; margin-top: 8px; }
.admin-auth-panel > p:not(.label-caps), .admin-heading-row > div > p:last-child { color: var(--muted); margin-top: 12px; }
.admin-auth-form { display: grid; gap: 14px; margin-top: 24px; }
.admin-message { min-height: 1.4em; color: var(--ok); font-size: 0.88rem; margin-block: 12px; }
.admin-message.is-error { color: var(--danger); }
.admin-dashboard { padding-top: 30px; }
.admin-heading-row, .admin-section-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; }
.admin-heading-row > div > .label-caps, .admin-section-head .label-caps { color: var(--blue); }
.admin-ops-note { margin-top: 20px; padding: 12px 14px; border-left: 3px solid var(--red); background: var(--surface); color: var(--muted); font-size: 0.9rem; }
.admin-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin-top: 22px; background: var(--line); border: 1px solid var(--line); }
.admin-metrics > div { display: grid; gap: 5px; padding: 16px; background: var(--surface); }
.admin-metrics span { color: var(--muted); font-size: 0.78rem; }
.admin-metrics strong { font: 700 1.7rem var(--font-display); }
.admin-section { margin-top: 36px; }
.admin-section-head { padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.admin-section-head h2 { font-size: 1.6rem; }
.admin-search { width: min(100%, 300px); padding: 9px 12px; border: 1px solid var(--line); background: var(--surface); border-radius: 4px; }
.admin-sla-note { color: var(--muted); font-size: 0.82rem; text-align: right; }
.admin-order-list, .admin-ticket-list { display: grid; gap: 14px; margin-top: 14px; }
.admin-order, .admin-ticket { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 20px; min-width: 0; }
.admin-order-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.admin-order-head h3 { font-size: 1.25rem; margin-top: 4px; }
.admin-order-meta { color: var(--muted); font-size: 0.86rem; margin-top: 12px; }
.admin-address { white-space: pre-line; line-height: 1.5; margin-top: 12px; }
.admin-letter-copy { max-height: 220px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; padding: 14px; margin: 16px 0; background: var(--paper); color: var(--paper-ink); border: 1px solid var(--paper-line); font: 1rem/1.7 var(--font-hand); }
.admin-order-actions { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.admin-status-select, .admin-tracking, .admin-reply { padding: 9px 10px; min-width: 160px; border: 1px solid var(--line); border-radius: 4px; background: var(--field); }
.admin-tracking { flex: 1; }
.admin-ticket-message { white-space: pre-wrap; overflow-wrap: anywhere; margin: 12px 0; }
.admin-reply { width: 100%; resize: vertical; }
.admin-empty { padding: 24px; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); }
.status-badge { display: inline-flex; align-items: center; padding: 6px 9px; border: 1px solid var(--line); border-radius: 3px; color: var(--muted); font-size: 0.75rem; text-transform: capitalize; white-space: nowrap; }
.status-ready_for_print, .status-printing { color: #155E39; border-color: #8FC5A4; background: #EAF5EE; }
.status-dispatched { color: #174B87; border-color: #9CBCE0; background: #EDF4FB; }
.status-on_hold { color: #9C3D25; border-color: #D9AA91; background: #FBF1EC; }

@media (max-width: 760px) {
  .admin-heading-row, .admin-section-head { align-items: flex-start; flex-direction: column; }
  .admin-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-search { width: 100%; }
  .admin-sla-note { text-align: left; }
  .admin-order-actions > * { flex: 1 1 100%; }
}

@media print {
  body.admin-body { padding: 0; background: #fff; color: #000; }
  .admin-topbar, .stripe, #adminAuthPanel, .admin-heading-row, .admin-ops-note, .admin-metrics, .admin-section:not(:has(#adminOrders)), #adminOrders .admin-order:not(.print-target), .admin-order-actions, #adminGlobalMessage { display: none !important; }
  .admin-wrap { max-width: none; }
  .admin-dashboard, .admin-section, #adminOrders, .admin-order.print-target { display: block !important; margin: 0; padding: 0; border: 0; }
  .admin-order.print-target { border: 0; box-shadow: none; }
  .admin-letter-copy { max-height: none; overflow: visible; }
}