*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  height: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  padding: 0;
  height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 0.9375rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body:has(#app-main[data-view-state^="camera_"]) .topbar {
  display: none;
}

p {
  text-wrap: pretty;
  margin: 0;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
}

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hidden {
  display: none !important;
}

.app-shell {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-canvas);
  overflow: hidden;
}

/* Topbar */
.topbar {
  height: 54px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  border-bottom: 1px solid var(--hairline);
  background-color: var(--bg-canvas);
  box-sizing: border-box;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 1.4375rem;
  letter-spacing: 0.01em;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  white-space: nowrap;
}

.brand-accent {
  color: var(--accent-text);
}

.brand-arrow {
  font-family: var(--font-ui);
  font-weight: 400;
  margin: 0 0.2em;
  color: var(--text-muted);
}

.brand-divider {
  display: inline-block;
  width: 1px;
  height: 18px;
  background-color: var(--hairline);
}

.brand-subtitle {
  font-size: 0.8125rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Desktop hides topbar-nav because desktop uses Left Sidebar */
.topbar-nav {
  display: none;
}

.nav-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0 12px;
  height: 48px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, border-color 0.15s;
  min-width: 44px;
}

.nav-tab:hover {
  color: var(--text-primary);
}

.nav-tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.nav-tab-label-compact {
  display: none;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.topbar-meta .btn-secondary {
  background-color: transparent;
  border-color: transparent;
  color: var(--text-secondary);
}

.topbar-meta .btn-secondary:hover:not(:disabled) {
  background-color: var(--bg-raised);
  color: var(--text-primary);
}

.meta-icon {
  flex-shrink: 0;
}

.meta-ttl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  padding: 0;
  border: 0;
  background: transparent;
}

.ttl-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.ttl-clock {
  font-variant-numeric: tabular-nums;
  color: var(--accent-text);
  font-weight: 600;
}

.topbar-user-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  padding: 4px 8px;
  font-variant-numeric: tabular-nums;
}

/* App Body & Left Vertical Sidebar Grid */
.app-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 204px minmax(0, 1fr);
  background-color: var(--bg-canvas);
  overflow: hidden;
}

body:has(#app-main[data-view-state="auth_login"]) .app-body,
body:has(#app-main[data-view-state^="camera_"]) .app-body,
.app-body:has(#app-sidebar.hidden) {
  grid-template-columns: minmax(0, 1fr);
}

.app-sidebar {
  width: 204px;
  background-color: var(--bg-canvas);
  border-right: 1px solid var(--hairline);
  padding: 14px 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
  overflow-y: auto;
}

.sidebar-nav-group {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.sidebar-nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 46px;
  padding: 10px 18px;
  border-radius: 0;
  border: 0;
  position: relative;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
  box-sizing: border-box;
}

.sidebar-nav-btn:hover:not(:disabled) {
  background-color: var(--bg-surface);
  color: var(--text-primary);
}

.sidebar-active-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background-color: transparent;
  pointer-events: none;
}

.sidebar-nav-btn.active .sidebar-active-bar {
  background-color: var(--accent);
}

.sidebar-nav-btn.active {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  font-weight: 600;
  border: 0;
}

.sidebar-nav-btn.active svg {
  color: var(--accent-text);
}

.sidebar-icon {
  flex-shrink: 0;
}

.sidebar-btn-label {
  flex: 1;
  white-space: nowrap;
}

.sidebar-count {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: 0;
  padding: 0;
}

.sidebar-nav-btn.active .sidebar-count {
  color: var(--text-muted);
}

.sidebar-telemetry-group {
  border-top: 1px solid var(--hairline);
  padding: 12px 18px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-telemetry {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 2px 0;
}

.telemetry-icon {
  flex-shrink: 0;
  color: var(--text-muted);
}

.telemetry-label {
  white-space: nowrap;
}

/* Main Area */
#app-main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: var(--bg-canvas);
}

.screen-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* Common Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  padding: 8px 16px;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  min-width: 24px;
  min-height: 24px;
  box-sizing: border-box;
  gap: 6px;
}

.btn-sm {
  min-height: 32px;
  padding: 4px 10px;
  font-size: 0.8125rem;
}

.btn-lg {
  min-height: 44px;
  padding: 10px 20px;
  font-size: 0.9375rem;
}

.btn-cta {
  min-height: 44px;
  padding: 10px 24px;
  font-size: 0.9375rem;
}

.btn-primary {
  background-color: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  border-bottom: 0;
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--accent-hover);
}

.btn-primary:disabled {
  background-color: var(--bg-raised);
  color: var(--text-muted);
  border: 1px solid var(--hairline);
  opacity: 1;
  cursor: not-allowed;
}

.btn-secondary {
  background-color: var(--bg-surface);
  color: var(--text-secondary);
  border-color: var(--hairline-strong);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--bg-raised);
  color: var(--text-primary);
}

.btn-secondary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Screen Upload (Scanner Cockpit) */
.screen-upload {
  flex: 1;
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 14px;
  padding: 16px 24px;
  box-sizing: border-box;
  overflow: hidden;
}

.workspace-hero {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

.workspace-title {
  font-family: var(--font-display);
  font-size: 2.1875rem;
  font-weight: 700;
  line-height: 1.12;
  color: var(--text-primary);
  margin: 0;
}

.workspace-subtitle {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin: 0;
}

.upload-cockpit {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 368px;
  gap: 20px;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

/* Page Rail */
.page-rail {
  width: 120px;
  background: transparent;
  border: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
}

.rail-header {
  display: none;
}

.rail-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rail-item {
  background: transparent;
  border: none;
  padding: 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--text-secondary);
  width: 100%;
  box-sizing: border-box;
}

.rail-thumb-box {
  width: 92px;
  height: 124px;
  border-radius: var(--radius-md);
  background-color: var(--bg-surface);
  border: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.rail-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.rail-thumb-placeholder {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.rail-label {
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.rail-item.active .rail-thumb-box {
  border: 2px solid var(--accent);
}

.rail-item.active .rail-label {
  color: var(--text-primary);
  font-weight: 600;
}

/* Optical Stage */
.optical-stage {
  flex: 1;
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: transparent;
  padding: 0;
  overflow: hidden;
}

.stage-frame {
  background-color: var(--bg-surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
}

.stage-empty {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
  padding: 24px;
  position: relative;
  box-sizing: border-box;
}

.corner {
  position: absolute;
  width: 22px;
  height: 22px;
  border-style: solid;
  border-width: 0;
  pointer-events: none;
}

.stage-empty .corner {
  border-color: var(--border-input);
}

.stage-empty .corner-tl { top: 16px; left: 16px; border-top-width: 2px; border-left-width: 2px; }
.stage-empty .corner-tr { top: 16px; right: 16px; border-top-width: 2px; border-right-width: 2px; }
.stage-empty .corner-bl { bottom: 16px; left: 16px; border-bottom-width: 2px; border-left-width: 2px; }
.stage-empty .corner-br { bottom: 16px; right: 16px; border-bottom-width: 2px; border-right-width: 2px; }

.stage-reticle {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background-color: var(--bg-raised);
  border: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-text);
  margin-bottom: 4px;
}

.stage-prompt {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  max-width: 360px;
}

.stage-hint {
  font-size: 0.8125rem;
  color: var(--text-muted);
  max-width: 360px;
}

.stage-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.stage-loaded {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.stage-viewport {
  flex: 1;
  min-height: 0;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  box-sizing: border-box;
  background-color: var(--bg-canvas);
}

.sheet-reticle {
  display: inline-flex;
  position: relative;
  max-height: 100%;
  max-width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
}

.sheet-reticle .corner {
  border-color: var(--status-ok);
  width: 22px;
  height: 22px;
}

.sheet-reticle .corner-tl { top: -8px; left: -8px; border-top-width: 3px; border-left-width: 3px; }
.sheet-reticle .corner-tr { top: -8px; right: -8px; border-top-width: 3px; border-right-width: 3px; }
.sheet-reticle .corner-bl { bottom: -8px; left: -8px; border-bottom-width: 3px; border-left-width: 3px; }
.sheet-reticle .corner-br { bottom: -8px; right: -8px; border-bottom-width: 3px; border-right-width: 3px; }

#stage-preview-img {
  max-width: 100%;
  max-height: 100%;
  height: 100%;
  width: auto;
  object-fit: contain;
  display: block;
  border-radius: var(--radius-sm);
}

.stage-toolbar {
  height: 42px;
  min-height: 42px;
  border-top: 1px solid var(--hairline);
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
  box-sizing: border-box;
  background-color: var(--bg-surface);
}

.stage-doc-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 0.8125rem;
}

.stage-status-icon {
  color: var(--status-ok);
  flex-shrink: 0;
}

.stage-status-ok {
  color: var(--status-ok);
  font-weight: 500;
  font-size: 0.75rem;
  white-space: nowrap;
}

.meta-sep {
  color: var(--text-muted);
}

.stage-filename {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.8125rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

.stage-filesize {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  font-size: 0.8125rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.stage-doc-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.stage-doc-actions .btn-secondary {
  background-color: transparent;
  border-color: transparent;
  color: var(--text-secondary);
}

.stage-doc-actions .btn-secondary:hover:not(:disabled) {
  background-color: var(--bg-raised);
  color: var(--text-primary);
}

/* Ledger Panel */
.ledger-panel {
  width: 368px;
  background-color: var(--bg-surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 0;
  overflow-y: auto;
  box-sizing: border-box;
  gap: 14px;
}

.ledger-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ledger-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ledger-icon {
  color: var(--text-muted);
  flex-shrink: 0;
}

.panel-heading {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--font-ui);
}

.ledger-rows {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--hairline);
  flex: 0 0 auto;
}

.ledger-rows .ledger-row:last-child {
  border-bottom: 0;
}

.ledger-row {
  padding: 10px 0;
  border-top: 0;
  border-left: 0;
  border-right: 0;
  border-bottom: 1px solid var(--hairline);
  border-radius: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ledger-row-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ledger-row-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.doc-badge {
  display: inline-flex;
  align-items: center;
  padding: 0;
  background: transparent;
  border: 0;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
}

.doc-badge-ok {
  color: var(--status-ok);
}

.doc-badge-ok::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--status-ok);
  display: inline-block;
}

.ledger-row-help {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.35;
}

#app-main[data-view-state="upload_loaded"] #card-order .ledger-row-help {
  display: none;
}

.rulings-ledger {
  list-style: none;
  margin: 6px 0 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.ruling-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  border-top: 0;
  border-left: 0;
  border-right: 0;
  border-bottom: 1px solid var(--hairline);
  border-radius: 0;
  gap: 8px;
  font-size: 0.8125rem;
}

.ruling-idx {
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  font-size: 0.75rem;
  flex-shrink: 0;
}

.ruling-body {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.ruling-name {
  color: var(--text-primary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}

.ruling-meta {
  color: var(--text-muted);
  font-size: 0.75rem;
  white-space: nowrap;
}

.btn-ledger-remove {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 0.75rem;
  padding: 2px 8px;
  cursor: pointer;
  min-width: 26px;
  min-height: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  flex-shrink: 0;
}

.btn-ledger-remove:hover:not(:disabled) {
  background-color: var(--bg-raised);
  color: var(--status-danger);
  border-color: transparent;
}

.rulings-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.rulings-actions .btn-secondary {
  background-color: transparent;
  border-color: transparent;
  color: var(--accent-text);
}

.rulings-actions .btn-secondary:hover:not(:disabled) {
  background-color: var(--bg-raised);
  color: var(--accent-hover);
}

.field-select {
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  cursor: pointer;
  box-sizing: border-box;
}

.ledger-label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.ledger-row-quiet {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
}

.ledger-quiet-title {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.ledger-quiet-desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.ledger-footer-status {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ledger-status-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-shield-icon {
  color: var(--text-muted);
  flex-shrink: 0;
}

.ledger-status-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.ledger-status-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.35;
  margin: 0;
}

/* Bottom Action Dock */
.action-bar {
  border: 0;
  border-top: 1px solid var(--hairline);
  border-radius: 0;
  background-color: transparent;
  padding: 12px 0 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
  box-sizing: border-box;
}

.action-bar-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.action-bar-icon-box {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  background-color: var(--bg-raised);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.action-info-text-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.action-info-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.action-info-text {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  max-width: 430px;
  line-height: 1.35;
}

.action-bar-cta {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.btn-cta {
  min-width: 280px;
  min-height: 48px;
  padding: 10px 24px;
  font-size: 0.9375rem;
}

/* Center Card Screen Views (Login, Progress, INN, Ready, Error) */
.screen-center-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 20px;
  overflow-y: auto;
  box-sizing: border-box;
}

.cockpit-card {
  width: 100%;
  max-width: 600px;
  background-color: var(--bg-surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: auto;
  box-sizing: border-box;
}

.login-card {
  max-width: 420px;
}

.card-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card-title {
  font-size: 1.375rem;
}

.card-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.login-form,
.inquiry-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.field-input {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: 0.9375rem;
  box-sizing: border-box;
}

.inn-input {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.1em;
  font-size: 1.125rem;
}

.field-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.field-hint.is-ok {
  color: var(--status-ok);
}

.field-hint.is-error {
  color: var(--status-danger);
}

.card-footer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 8px;
}

/* Progress View */
.progress-track {
  width: 100%;
  height: 4px;
  background-color: var(--bg-raised);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: var(--progress, 0%);
  background-color: var(--accent);
  transition: width 0.3s ease;
}

.pipeline-ledger {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--hairline);
}

.pipeline-step {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--hairline);
}

.pipeline-num {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.pipeline-name {
  flex: 1;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.pipeline-state {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.pipeline-step.active .pipeline-name {
  color: var(--text-primary);
  font-weight: 600;
}

.pipeline-step.active .pipeline-state {
  color: var(--accent-text);
}

.pipeline-step.completed .pipeline-state {
  color: var(--status-ok);
}

.progress-footer {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 8px;
}

.card-quiet-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  width: 100%;
}

.progress-footer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 12px;
}

.progress-footer-actions .btn {
  white-space: nowrap;
}

/* Ready View (Dossier) */
.dossier-card {
  max-width: 720px;
  width: 100%;
}

.card-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  width: 100%;
  gap: 8px;
}

.card-heading-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ready-check-icon {
  color: var(--status-ok);
  flex-shrink: 0;
}

.batch-status-strip {
  display: none;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.strip-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.strip-clock {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--accent-text);
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background-color: var(--bg-canvas);
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  border-left: none;
  border-right: none;
  border-radius: 0;
}

.stat-cell {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 4px;
  border-right: 1px solid var(--hairline);
}

.stat-cell:last-child {
  border-right: none;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.stat-figure {
  font-size: 1.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.stat-figure-warn {
  color: var(--status-warn);
}

.dossier-ledger {
  display: flex;
  flex-direction: column;
  border-top: none;
}

.dossier-ledger .ledger-row {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
}

.ledger-term {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.ledger-val {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-primary);
  text-align: right;
}

.a8-footnote {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.dossier-footer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 12px;
  padding-top: 8px;
}

.dossier-right-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.dossier-right-actions .btn,
.dossier-footer-actions .btn {
  white-space: nowrap;
}

.btn-danger-hover:hover:not(:disabled) {
  border-color: var(--status-danger);
  color: var(--status-danger);
}

/* Error View */
.refusal-sheet {
  padding: 12px 0 12px 14px;
  background: transparent;
  border: none;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  border-left: 2px solid var(--status-danger);
  border-radius: 0;
}

.refusal-prose {
  font-size: 0.875rem;
  color: var(--text-primary);
  line-height: 1.5;
}

/* Cabinet View */
.screen-cabinet {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-canvas);
  overflow: hidden;
}

.cabinet-container {
  width: 100%;
  max-width: 1040px;
  margin: 0;
  padding: 18px 24px;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  box-sizing: border-box;
}

.cabinet-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--hairline);
  flex-shrink: 0;
  gap: 12px;
}

.cabinet-title-group {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.cabinet-heading {
  font-size: 1.75rem;
  line-height: 1.2;
}

.cabinet-user-badge {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  padding: 0;
  border: none;
}

/* Hide user and logout on desktop cabinet since they are in desktop topbar */
#cabinet-username,
#btn-cabinet-logout {
  display: none !important;
}

.cabinet-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

#btn-cabinet-refresh {
  background-color: transparent;
  border-color: transparent;
  color: var(--text-secondary);
}

#btn-cabinet-refresh:hover:not(:disabled) {
  background-color: var(--bg-raised);
  color: var(--text-primary);
}

.cabinet-scrollable-area {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding-top: 16px;
}

.cabinet-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cabinet-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.cabinet-section-title {
  font-size: 1.0625rem;
  font-weight: 600;
}

.cabinet-ledger {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--hairline);
}

.cabinet-empty-note {
  font-size: 0.875rem;
  color: var(--text-muted);
  padding: 16px 0;
}

.cabinet-row,
.history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-top: 0;
  border-left: 0;
  border-right: 0;
  border-bottom: 1px solid var(--hairline);
  border-radius: 0;
  gap: 12px;
  background: transparent;
}

.cabinet-row:hover,
.history-row:hover {
  background-color: var(--bg-surface);
}

.row-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot-ok,
.dot-ok {
  background-color: var(--status-ok);
}

.status-dot-accent {
  background-color: var(--accent);
}

.status-dot-warn {
  background-color: var(--status-warn);
}

.status-dot-danger {
  background-color: var(--status-danger);
}

.row-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.row-time-label {
  font-variant-numeric: tabular-nums;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.row-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.row-actions .btn-secondary:not(:first-child) {
  background-color: transparent;
  border-color: transparent;
  color: var(--text-secondary);
}

.row-actions .btn-secondary:not(:first-child):hover:not(:disabled) {
  background-color: var(--bg-raised);
  color: var(--text-primary);
}

/* Camera Screen */
.screen-camera {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-canvas);
  position: relative;
}

.camera-topbar {
  min-height: 52px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 8px 16px;
  border-bottom: 0;
  background-color: transparent;
}

#btn-camera-close {
  position: absolute;
  left: 8px;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  background: transparent;
  border-color: transparent;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
}

#btn-camera-close:hover:not(:disabled) {
  background-color: var(--bg-raised);
  color: var(--text-primary);
}

.camera-title {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 1rem;
  text-align: center;
  color: var(--text-primary);
  margin: 0;
  min-width: 0;
  max-width: calc(100% - 140px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.camera-live-pill {
  position: absolute;
  right: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
}

#app-main[data-view-state="camera_review"] .camera-live-pill {
  display: none !important;
}

.camera-viewport-wrapper {
  flex: 1;
  min-height: 0;
  position: relative;
  background-color: var(--bg-canvas);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#camera-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.camera-frame {
  position: absolute;
  left: var(--frame-x, 4%);
  top: var(--frame-y, 4%);
  width: var(--frame-w, 92%);
  height: var(--frame-h, 92%);
  pointer-events: none;
  border: 0;
  box-sizing: border-box;
}

.camera-frame .corner {
  position: absolute;
  width: 28px;
  height: 28px;
  border-style: solid;
  border-width: 0;
  border-color: var(--text-primary);
}

.camera-frame .corner-tl { top: 0; left: 0; border-top-width: 4px; border-left-width: 4px; }
.camera-frame .corner-tr { top: 0; right: 0; border-top-width: 4px; border-right-width: 4px; }
.camera-frame .corner-bl { bottom: 0; left: 0; border-bottom-width: 4px; border-left-width: 4px; }
.camera-frame .corner-br { bottom: 0; right: 0; border-bottom-width: 4px; border-right-width: 4px; }

.camera-frame.frame-red .corner {
  border-color: var(--status-danger);
}

.camera-frame.frame-green .corner {
  border-color: var(--status-ok);
}

.camera-preview-overlay {
  position: absolute;
  inset: 0;
  background-color: var(--bg-canvas);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
}

#camera-preview-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.camera-controls {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-top: 0;
  background-color: transparent;
}

.camera-hint {
  font-size: 0.875rem;
  color: var(--text-primary);
  text-align: center;
  min-height: 20px;
}

.hint-green {
  color: var(--status-ok);
}

.hint-red {
  color: var(--status-danger);
}

.shutter {
  width: 64px;
  height: 64px;
  min-width: 64px;
  min-height: 64px;
  border-radius: 50%;
  background-color: var(--bg-surface);
  border: 2px solid var(--accent);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  box-sizing: border-box;
}

.shutter:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.shutter-ring {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: var(--accent);
  display: block;
}

.shutter-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.review-actions {
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 360px;
}

.review-actions .btn {
  flex: 1;
}

/* ======================================================== */
/* Responsive Rules: Mobile Screens (<= 60rem, 360x704)      */
/* ======================================================== */
@media (max-width: 60rem) {
  html, body {
    height: 100%;
    overflow-x: hidden;
  }

  .app-shell {
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .topbar {
    height: 48px;
    max-height: 52px;
    padding: 0 8px;
    gap: 4px;
    flex-shrink: 0;
  }

  .topbar-brand {
    gap: 6px;
  }

  .topbar:has(.topbar-nav:not(.hidden)) .brand-full {
    display: none !important;
  }

  .topbar:has(.topbar-nav:not(.hidden)) .brand-compact {
    display: inline-block !important;
    font-size: 1.0625rem;
    white-space: nowrap;
  }

  .brand-divider,
  .brand-subtitle,
  #ttl-badge,
  #topbar-username,
  #btn-logout {
    display: none !important;
  }

  #app-sidebar {
    display: none !important;
  }

  .app-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .topbar-nav:not(.hidden) {
    display: flex;
    gap: 2px;
    margin-left: auto;
  }

  .nav-tab {
    min-width: 44px;
    min-height: 44px;
    padding: 0 6px;
    font-size: 0.75rem;
    height: 44px;
  }

  .nav-tab-label-full {
    display: none !important;
  }

  .nav-tab-label-compact {
    display: inline !important;
  }

  .brand-title {
    white-space: nowrap;
    font-size: 1rem;
  }

  .topbar-meta {
    gap: 4px;
    flex-shrink: 0;
  }

  #btn-theme-toggle {
    min-width: 44px;
    min-height: 44px;
    padding: 4px 6px;
    font-size: 0.75rem;
  }

  #theme-toggle-label {
    display: none;
  }

  .theme-label-compact {
    display: inline !important;
    font-size: 0.75rem;
  }

  /* Mobile Cabinet */
  #cabinet-username {
    display: inline-flex !important;
    font-size: 0.8125rem;
    color: var(--text-muted);
  }

  #btn-cabinet-logout {
    display: inline-flex !important;
  }

  .cabinet-container {
    padding: 12px 8px;
  }

  .cabinet-header-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding-bottom: 12px;
  }

  .cabinet-title-group {
    justify-content: space-between;
    width: 100%;
  }

  .cabinet-heading {
    font-size: 1.25rem;
  }

  .cabinet-header-actions {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .cabinet-header-actions #btn-cabinet-logout,
  .cabinet-header-actions #btn-cabinet-refresh {
    flex: 0 0 auto;
    min-width: 44px;
    min-height: 44px;
    padding: 6px 10px;
    font-size: 0.75rem;
  }

  .cabinet-header-actions #btn-cabinet-new-batch {
    flex: 1 1 auto;
    min-width: 44px;
    min-height: 44px;
    padding: 6px 12px;
    font-size: 0.8125rem;
  }

  .cabinet-row,
  .history-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px 0;
  }

  .cabinet-row .row-title,
  .cabinet-row .row-desc,
  .history-row .row-title,
  .history-row .row-desc {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    word-break: break-word;
  }

  .row-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-start;
  }

  .row-actions .btn {
    min-height: 44px;
    min-width: 44px;
    padding: 6px 10px;
    font-size: 0.75rem;
    flex: 1 1 auto;
  }

  /* Mobile Upload Screen */
  .screen-upload {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 0;
    gap: 0;
    overflow: hidden;
  }

  .workspace-hero {
    padding: 6px 12px 2px 12px;
    flex-shrink: 0;
  }

  .workspace-title {
    font-size: 1.1875rem;
  }

  .workspace-subtitle {
    font-size: 0.75rem;
    line-height: 1.4;
  }

  .upload-cockpit {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0;
    -webkit-overflow-scrolling: touch;
  }

  .page-rail {
    width: 100%;
    height: 50px;
    border-bottom: 1px solid var(--hairline);
    flex-direction: row;
    padding: 3px 8px;
    overflow-x: auto;
    flex-shrink: 0;
  }

  .page-rail.is-empty,
  .page-rail.has-single-sheet {
    display: none;
  }

  .rail-header {
    display: none;
  }

  .rail-list {
    flex-direction: row;
    gap: 6px;
  }

  .rail-item {
    width: auto;
    min-width: 56px;
    height: 44px;
    min-height: 44px;
    padding: 2px 6px;
    flex-direction: row;
    gap: 6px;
    flex-shrink: 0;
  }

  .rail-thumb-box {
    width: 32px;
    height: 36px;
    min-width: 32px;
  }

  .rail-label {
    font-size: 0.6875rem;
  }

  .optical-stage {
    flex: none;
    min-height: auto;
    height: auto;
    padding: 4px 12px;
    overflow: visible;
  }

  .stage-frame {
    height: auto;
    padding: 0;
    width: 100%;
    border: 0;
    background: transparent;
  }

  .stage-empty {
    height: auto;
    padding: 16px 12px;
    gap: 8px;
  }

  .stage-reticle {
    width: 40px;
    height: 40px;
  }

  .stage-prompt {
    font-size: 0.8125rem;
  }

  .stage-hint {
    font-size: 0.75rem;
  }

  .stage-actions {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 6px;
  }

  .stage-actions .btn {
    min-height: 44px;
    min-width: 44px;
    width: 100%;
  }

  .stage-loaded {
    height: auto;
    min-height: 0;
  }

  .stage-viewport {
    height: 184px;
    min-height: 170px;
    max-height: 192px;
    flex: none;
    padding: 8px;
  }

  .sheet-reticle .corner {
    width: 14px;
    height: 14px;
  }

  .sheet-reticle .corner-tl { top: -5px; left: -5px; border-top-width: 2px; border-left-width: 2px; }
  .sheet-reticle .corner-tr { top: -5px; right: -5px; border-top-width: 2px; border-right-width: 2px; }
  .sheet-reticle .corner-bl { bottom: -5px; left: -5px; border-bottom-width: 2px; border-left-width: 2px; }
  .sheet-reticle .corner-br { bottom: -5px; right: -5px; border-bottom-width: 2px; border-right-width: 2px; }

  #stage-preview-img {
    height: 100%;
    min-height: 130px;
    max-height: 168px;
    object-fit: contain;
  }

  .stage-toolbar {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: auto;
    min-height: auto;
    gap: 6px;
    padding: 6px 0 0 0;
    border-top: 1px solid var(--hairline);
    flex-shrink: 0;
  }

  .stage-doc-meta {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: baseline;
    width: 100%;
    min-width: 0;
    gap: 8px;
  }

  .stage-filename {
    flex: 1;
    min-width: 0;
    font-size: 0.75rem;
  }

  .stage-filesize {
    font-size: 0.75rem;
  }

  .stage-doc-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    width: 100%;
    gap: 4px;
  }

  .stage-doc-actions .btn {
    flex: 1 1 auto;
    min-width: 44px;
    min-height: 44px;
    padding: 4px 6px;
    font-size: 0.75rem;
  }

  .ledger-panel {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--hairline);
    border-radius: 0;
    padding: 8px 12px 14px 12px;
    overflow: visible;
    flex-shrink: 0;
    gap: 6px;
  }

  .panel-heading {
    font-size: 0.9375rem;
  }

  .ledger-row {
    padding: 6px 0;
  }

  .ledger-row-help {
    display: none;
  }

  .field-select {
    min-height: 44px;
    font-size: 0.875rem;
  }

  .rulings-actions .btn {
    min-height: 44px;
    min-width: 44px;
    padding: 4px 8px;
    font-size: 0.75rem;
  }

  .btn-ledger-remove {
    min-width: 44px;
    min-height: 44px;
  }

  .action-bar {
    position: sticky;
    bottom: 0;
    flex-shrink: 0;
    z-index: 20;
    height: auto;
    padding: 6px 12px;
    background-color: var(--bg-canvas);
    border-top: 1px solid var(--hairline);
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
  }

  .action-bar-info {
    display: none;
  }

  .action-bar-cta {
    width: 100%;
  }

  .btn-cta {
    width: 100%;
    min-height: 44px;
  }

  /* Mobile Center Cards */
  .screen-center-card {
    height: 100%;
    overflow-y: auto;
    padding: 10px;
    justify-content: flex-start;
  }

  .cockpit-card {
    padding: 14px 12px;
    gap: 12px;
  }

  .card-title-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  /* Mobile Dossier / Ready Screen */
  .batch-status-strip:not(.hidden) {
    display: inline-flex;
  }

  .dossier-card {
    padding: 10px;
    gap: 8px;
  }

  #screen-ready .card-title {
    font-size: 1.1875rem;
    line-height: 1.2;
  }

  .card-desc {
    font-size: 0.75rem;
    line-height: 1.35;
  }

  .stat-cell {
    padding: 6px 8px;
  }

  .stat-figure {
    font-size: 1.1875rem;
  }

  .dossier-ledger .ledger-row {
    padding: 4px 0;
  }

  .a8-footnote {
    font-size: 0.6875rem;
    line-height: 1.32;
  }

  .dossier-footer-actions {
    flex-direction: column;
    gap: 8px;
    width: 100%;
  }

  .dossier-right-actions {
    flex-direction: column;
    gap: 8px;
    width: 100%;
    margin-left: 0;
  }

  #screen-ready #btn-download {
    order: -1;
    width: 100%;
    min-height: 44px;
  }

  #screen-ready #btn-new-batch {
    order: 0;
    width: 100%;
    min-height: 44px;
  }

  #screen-ready #btn-delete-now {
    order: 1;
    width: 100%;
    min-height: 44px;
  }

  /* Mobile Progress Screen */
  .progress-footer-actions {
    flex-direction: column;
    gap: 8px;
    width: 100%;
  }

  #btn-progress-new-batch {
    order: -1;
    width: 100%;
    min-height: 44px;
  }

  #btn-cancel-process {
    order: 1;
    width: 100%;
    min-height: 44px;
  }

  .camera-topbar {
    height: 52px;
    padding: 0 8px;
  }

  #btn-camera-close {
    min-width: 44px;
    min-height: 44px;
    height: 44px;
  }

  /* Mobile Interactive Touch Targets */
  button,
  select,
  input:not(.sr-only),
  [role="button"] {
    min-width: 44px;
    min-height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
