/* Screen chrome around the paper, and the print/screen split. The paper's
   own design lives in paper.css and is untouched here. Editor-specific
   styles (cards, form fields) live in editor.css. */

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  background: #f0f1f3;
  font-family: 'Noto Sans', sans-serif;
  min-height: 100vh;
}

button, input, select, textarea {
  font-family: inherit;
}

/* ---- top bar: mode toggle + save/load ---- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  background: #2b2d31;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.mode-toggle {
  display: flex;
  gap: 4px;
  background: #1c1d20;
  border-radius: 8px;
  padding: 3px;
}

.mode-btn {
  border: none;
  background: transparent;
  color: #cfd2d8;
  font-size: 15px;
  font-weight: 600;
  padding: 9px 18px;
  min-height: 44px;
  border-radius: 6px;
  cursor: pointer;
}

.mode-btn[aria-pressed="true"] {
  background: #4c8bf5;
  color: #fff;
}

.topbar-title {
  color: #fff;
  font-size: 15px;
  font-weight: 700;
}

.btn-back {
  background: transparent;
  border-color: #555;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.save-status {
  font-size: 12px;
  color: #9aa0aa;
  white-space: nowrap;
}

.save-status.status-dirty {
  color: #cfd2d8;
}

.save-status.status-saving {
  color: #cfd2d8;
}

.save-status.status-saved {
  color: #7ec27e;
}

.save-status.status-error {
  color: #ff8a8a;
  font-weight: 600;
}

.btn {
  font-size: 14px;
  font-weight: 600;
  padding: 9px 14px;
  min-height: 44px;
  border-radius: 6px;
  border: 1px solid #555;
  background: #3a3c40;
  color: #fff;
  cursor: pointer;
}

.btn:hover {
  background: #46484d;
}

/* ---- preview-only bar: totals + print ---- */

.preview-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  background: #e5e7eb;
  border-bottom: 1px solid #cbd0d6;
}

.totals {
  font-size: 13px;
  color: #444;
}

.totals strong {
  color: #111;
}

.totals.mismatch strong {
  color: #c62828;
}

.btn-print {
  background: #4c8bf5;
  border-color: #4c8bf5;
}

.btn-print:hover {
  background: #3f78d9;
}

/* ---- preview sheet ---- */

.preview-view {
  padding: 0;
}

.preview-scale-wrap {
  width: 100%;
  overflow: auto;
  display: flex;
  justify-content: center;
  padding: 8mm 4mm 16mm;
}

.preview-scale-wrap .page {
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.35);
  flex: none;
}

@media print {
  body {
    background: #fff;
  }

  .topbar,
  .preview-bar {
    display: none;
  }

  .preview-scale-wrap {
    padding: 0;
    overflow: visible;
  }

  .preview-scale-wrap .page {
    box-shadow: none;
    margin: 0;
    zoom: 1 !important;
  }
}

@page {
  size: A4;
  margin: 0;
}
