/* Responsive editor workspace and device-only live preview. */
:root {
  --page: #f2f5f8;
  --radius-xl: 18px;
  --radius-lg: 13px;
  --radius-md: 10px;
  --radius-sm: 9px;
  --shadow-panel: 0 4px 18px rgba(27, 54, 79, .055);
}
html { min-width: 0; }
body { background: var(--page); }
.bg-auth { background: #005caa; box-shadow: 0 2px 12px rgba(0, 51, 96, .10); }
.navbar, .navbar-container { min-height: 62px; }
.app-shell, .navbar-container, .footer { width: min(1440px, calc(100% - 48px)); }
.app-shell { margin-block: 24px; grid-template-columns: minmax(0, 1.18fr) minmax(0, 1fr); align-items: start; gap: 24px; }
.panel { border: 1px solid #dfe7ee; background: #fff; }
.editor-panel, .preview-panel { padding: clamp(18px, 2vw, 28px); }
.panel-heading, .preview-toolbar { align-items: center; gap: 12px; }
.panel-heading > div, .preview-toolbar > div:first-child { min-width: 0; }
.panel-heading .button, .preview-actions { flex-shrink: 0; }
.eyebrow { letter-spacing: .1em; color: #577386; font-size: 10px; }
h1 { font-size: clamp(19px, 1.7vw, 25px); }
h2 { font-size: clamp(14px, 1.3vw, 18px); }
.editor-group { margin-top: 24px; }
.group-heading { margin-bottom: 15px; gap: 4px; }
.group-heading > span { font-size: 14px; color: #213f53; }
.group-heading > small { font-size: 12px; color: #687e8d; }
.form-grid, .display-settings-grid, .stamp-settings-grid { gap: 14px 16px; }
.field { gap: 7px; }
.field > span { font-size: 12px; color: #415b6c; }
.field > input:not([type=range]):not([type=file]), .field > select, .date-time-trigger { height: 46px; font-size: 13px; }
.field > input:not([type=range]):not([type=file]), .field > select, .date-time-trigger { background-color: #fbfcfe; }
.field > input:focus, .field > select:focus { background-color: #fff; }
.switch-card { min-height: 76px; background: #f8fafc; }
.switch-copy strong, .stamp-settings-head strong { font-size: 12px; }
.switch-copy small, .stamp-settings-head small { font-size: 11px; }
.stamp-settings-card { background: #f8fafc; padding: 16px; }
.stamp-upload-row { min-width: 0; }
.actions { grid-template-columns: minmax(92px, .35fr) minmax(0, 1fr); }
.button { border-radius: 10px; font-size: 13px; }
.button.small { font-size: 12px; }
.preview-column { top: 78px; }
.preview-panel { height: auto; overflow: visible; }
.preview-toolbar { min-height: 0; margin-bottom: 12px; }
.demo-notice { text-align: center; font-size: 11px; font-weight: 700; letter-spacing: .025em; color: #934017; background: #fff4e8; border: 1px solid #f1d9bd; border-radius: 8px; padding: 8px; margin-bottom: 12px; }
.canvas-stage {
  height: clamp(320px, calc(100dvh - 245px), 790px);
  flex: 0 0 auto; contain: none; overflow: hidden; scrollbar-gutter: auto;
  padding: 16px; align-items: center; justify-content: center;
  border: 1px solid #e0e7ee; border-radius: 13px;
  background: #edf1f5; box-shadow: none;
}
.canvas-surface {
  position: relative; width: min(100%, 300px); aspect-ratio: 827 / 1701;
  max-width: 100%; margin: 0; isolation: isolate; flex: 0 0 auto;
  transition: none;
}
.phone-frame { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: fill; pointer-events: none; z-index: 2; }
/* Screen aperture measured against the cropped reference image. */
.phone-screen {
  position: absolute; left: 4.2%; top: 1.65%; width: 91.6%; height: 96.6%;
  border-radius: 17% / 7.3%; overflow: hidden; background: #fff; z-index: 1;
  display: flex; flex-direction: column; padding: 13% 2% 3%;
}
.phone-screen-content { flex: 1 1 0; min-width: 0; min-height: 0; display: grid; place-items: center; overflow: hidden; }
#receiptCanvas { width: 100%; height: 100%; min-width: 0; min-height: 0; object-fit: contain; display: block; background: transparent; box-shadow: none; }
.preview-caption { color: #5d7281; font-size: 11px; margin: 12px 0 0; }
@media (max-width: 1050px) {
  .app-shell { width: min(780px, calc(100% - 32px)); grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .navbar-container, .footer { width: min(780px, calc(100% - 32px)); }
  .preview-column { position: static; }
  .canvas-stage { height: auto; min-height: 0; overflow: visible; padding: 18px; touch-action: pan-y pinch-zoom; }
  .canvas-surface { touch-action: pan-y pinch-zoom; }
  .date-time-popover { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(360px, calc(100vw - 28px)); max-height: calc(100dvh - 36px); }
}
@media (max-width: 640px) {
  .app-shell { width: calc(100% - 24px); margin-block: 14px; gap: 14px; }
  .navbar, .navbar-container { min-height: 56px; }
  .navbar-container, .footer { width: calc(100% - 24px); }
  .editor-panel, .preview-panel { padding: 16px; border-radius: 14px; }
  .panel-heading, .preview-toolbar { flex-wrap: wrap; }
  .form-grid, .display-settings-grid, .stamp-settings-grid { grid-template-columns: minmax(0, 1fr); gap: 13px; }
  .field-span-2, .stamp-settings-card { grid-column: 1 / -1; }
  .field > input:not([type=range]):not([type=file]), .field > select { font-size: 16px; }
  .stamp-settings-card { padding: 12px; }
  .stamp-upload-row, .actions { grid-template-columns: minmax(0, 1fr); }
  .canvas-stage { padding: 10px; }
  .preview-actions { margin-left: auto; }
  .icon-button { width: 38px; height: 38px; }
  .footer { gap: 5px; }
}
@media (max-width: 360px) {
  .editor-panel, .preview-panel { padding: 12px; }
  .canvas-stage { padding: 8px; }
  .date-time-popover-actions { gap: 4px; }
  .date-time-now, .date-time-cancel, .date-time-apply { padding-inline: 8px; }
}
@media (min-width: 1051px) and (max-height: 650px) {
  .preview-column { position: static; }
}
