:root {
  --bg: #eef2f0;
  --panel: #fbfcfc;
  --panel-strong: #ffffff;
  --text: #16201d;
  --muted: #6e7a76;
  --line: #dbe3df;
  --accent: #0f8a5f;
  --accent-2: #1d4ed8;
  --accent-soft: #e5f5ee;
  --danger: #b42318;
  --shadow: 0 24px 70px rgba(27, 42, 38, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 12%, rgba(15, 138, 95, 0.13), transparent 26rem),
    linear-gradient(135deg, #eef3f1 0%, #f8faf9 48%, #e9eef6 100%);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

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

button {
  border: 0;
}

.theme-blue {
  --accent: #2563eb;
  --accent-2: #0f766e;
  --accent-soft: #e7efff;
}

.theme-terracotta {
  --accent: #c2410c;
  --accent-2: #0f766e;
  --accent-soft: #fff1e8;
}

.app-shell {
  display: block;
  min-height: 100vh;
  padding: 22px;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  max-width: 1180px;
  margin: 0 auto 18px;
  padding: 14px;
  border: 1px solid rgba(219, 227, 223, 0.9);
  border-radius: 18px;
  background: rgba(251, 252, 252, 0.88);
  backdrop-filter: blur(18px);
  box-shadow: 0 16px 44px rgba(22, 32, 29, 0.08);
}

.editor-panel {
  padding: 0;
}

.brand-strip {
  display: flex;
  align-items: center;
  padding: 0 2px 14px;
}

.brand-logo {
  display: block;
  width: min(100%, 300px);
  height: auto;
  object-fit: contain;
}

.brand-strip h1,
.preview-toolbar h2,
.panel-section h2 {
  margin: 0;
}

.brand-strip h1 {
  font-size: 1.45rem;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sticky-actions {
  margin: 0 0 12px;
  padding: 0;
}

.action-row {
  display: flex;
  gap: 10px;
}

.primary-button,
.ghost-button,
.icon-text-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 10px;
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.primary-button {
  gap: 9px;
  padding: 0 16px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 14px 34px rgba(15, 138, 95, 0.25);
  font-weight: 750;
}

.primary-button.success {
  background: var(--accent);
  box-shadow: 0 14px 34px rgba(15, 138, 95, 0.15);
}

.ghost-button,
.icon-text-button,
.icon-button {
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--line);
}

.ghost-button,
.icon-text-button {
  gap: 8px;
  padding: 0 14px;
  font-weight: 700;
}

.ghost-button.compact {
  min-height: 36px;
  width: fit-content;
  padding: 0 12px;
  font-size: 0.82rem;
}

.icon-button {
  width: 34px;
  height: 34px;
  min-height: 34px;
}

.danger {
  color: var(--danger);
}

.primary-button:hover,
.ghost-button:hover,
.icon-text-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(22, 32, 29, 0.11);
}

.primary-button:disabled,
.ghost-button:disabled,
.icon-text-button:disabled,
.icon-button:disabled {
  cursor: wait;
  opacity: 0.68;
  transform: none;
}

.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.export-error {
  margin: -2px 0 12px;
  color: var(--danger);
  font-size: 0.82rem;
  font-weight: 700;
}

.login-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 32px 18px;
}

.login-card {
  width: 100%;
  max-width: 480px;
  padding: 28px;
  border: 1px solid rgba(219, 227, 223, 0.9);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 24px 64px rgba(22, 32, 29, 0.12);
  backdrop-filter: blur(18px);
}

.login-header {
  display: grid;
  gap: 6px;
  margin-bottom: 18px;
  text-align: center;
}

.login-header .brand-logo {
  margin: 0 auto 8px;
  width: min(220px, 70%);
}

.login-header h1 {
  margin: 0;
  font-size: 1.3rem;
}

.login-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.user-list {
  display: grid;
  gap: 8px;
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
}

.user-list li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-tile {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  cursor: pointer;
  text-align: left;
  transition: border-color 160ms ease, transform 160ms ease;
}

.user-tile:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: #ffffff;
  font-weight: 850;
  font-size: 0.95rem;
  flex: 0 0 auto;
}

.avatar.small {
  width: 32px;
  height: 32px;
  font-size: 0.82rem;
}

.user-meta,
.user-chip-meta {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.user-meta strong,
.user-chip-meta strong {
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-meta small,
.user-chip-meta small {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.25;
}

.user-meta .draft-count {
  color: var(--accent);
  font-weight: 700;
}

.user-signup {
  display: grid;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
}

.user-signup strong {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.auth-form {
  display: grid;
  gap: 10px;
}

.auth-error {
  margin: 0;
  padding: 9px 12px;
  border-radius: 10px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--danger);
  font-size: 0.82rem;
  font-weight: 700;
}

.auth-switch {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

.link-button {
  display: inline;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 800;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.link-button:hover {
  color: var(--accent-2);
}

.tos-check {
  font-size: 0.82rem;
}

.tos-check span {
  display: inline;
}

.tos-content {
  max-height: 60vh;
  overflow-y: auto;
  padding: 0 4px;
}

.tos-content h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: var(--text);
}

.tos-content p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.tos-content ol {
  margin: 0 0 16px;
  padding-left: 20px;
}

.tos-content li {
  margin-bottom: 10px;
  color: var(--text);
  font-size: 0.84rem;
  line-height: 1.55;
}

.tos-content li strong {
  color: var(--text);
}

.tos-footer {
  display: flex;
  justify-content: center;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 10px 6px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  margin-left: auto;
}

.brand-strip {
  align-items: center;
  justify-content: space-between;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 10px;
}

.save-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 800;
}

.save-indicator.saving {
  background: #fff5e1;
  color: #92400e;
}

.save-indicator.idle {
  background: #f1f5f3;
  color: var(--muted);
}

.active-draft-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 0.74rem;
  font-weight: 700;
  max-width: 240px;
}

.active-draft-name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  margin-left: 4px;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 850;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(15, 23, 21, 0.42);
  backdrop-filter: blur(4px);
  animation: modal-fade 160ms ease;
}

.modal-card {
  width: 100%;
  max-width: 540px;
  max-height: min(90vh, 720px);
  display: flex;
  flex-direction: column;
  padding: 20px;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 30px 80px rgba(22, 32, 29, 0.28);
  animation: modal-pop 180ms ease;
}

.modal-card.narrow {
  max-width: 420px;
}

.modal-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin: 0 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfc;
  color: var(--muted);
}

.modal-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  outline: 0;
  color: var(--text);
  font-size: 0.88rem;
}

.modal-search .icon-button {
  width: 26px;
  height: 26px;
  min-height: 26px;
  border-color: transparent;
  background: transparent;
}

.modal-empty {
  flex: 1 1 auto;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px 12px;
  color: var(--muted);
}

.modal-empty p {
  margin: 0 0 4px;
  color: var(--text);
  font-weight: 700;
}

.modal-empty small {
  font-size: 0.78rem;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.modal-head h2 {
  margin: 2px 0 0;
  font-size: 1.05rem;
}

.draft-list {
  flex: 1 1 auto;
  overflow: auto;
  display: grid;
  gap: 8px;
  margin: 0 -4px;
  padding: 0 4px;
  list-style: none;
}

.draft-tile {
  display: flex;
  align-items: stretch;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfc;
}

.draft-tile.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.draft-main {
  flex: 1;
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.draft-main:hover {
  background: rgba(15, 138, 95, 0.08);
}

.draft-main strong {
  font-size: 0.9rem;
}

.draft-main small {
  color: var(--muted);
  font-size: 0.72rem;
}

.draft-total {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  width: fit-content;
}

.draft-tile.active .draft-total {
  background: #ffffff;
}

.draft-main input {
  width: 100%;
  padding: 4px 6px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  outline: 0;
  font-size: 0.9rem;
  font-weight: 800;
}

.draft-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.entry-list {
  flex: 1 1 auto;
  overflow: auto;
  display: grid;
  gap: 8px;
  margin: 0 -4px;
  padding: 0 4px;
  list-style: none;
}

.entry-tile {
  display: flex;
  align-items: stretch;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfc;
}

.entry-main {
  flex: 1;
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.entry-main:hover {
  background: rgba(15, 138, 95, 0.08);
}

.entry-main strong {
  font-size: 0.92rem;
}

.entry-main small {
  color: var(--muted);
  font-size: 0.74rem;
}

.entry-main small.muted {
  font-size: 0.72rem;
  color: var(--muted);
}

.entry-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.header-actions .icon-text-button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 0.8rem;
}

.section-heading.with-action > div {
  align-items: center;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.shortcut-hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.5;
  text-align: center;
}

.shortcut-hint kbd {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 20px;
  padding: 0 5px;
  margin: 0 1px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: #ffffff;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.7rem;
  font-weight: 700;
}

@keyframes modal-fade {
  from {
    opacity: 0;
  }
}

@keyframes modal-pop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}

.tab-switcher {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #eef3f1;
}

.tab-switcher button {
  min-height: 40px;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-weight: 850;
}

.tab-switcher button.active {
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 24px rgba(15, 138, 95, 0.2);
}

.tab-stage {
  position: relative;
  max-width: 1180px;
  margin: 0 auto;
}

.tab-panel {
  width: 100%;
}

.tab-panel:not(.active) {
  position: absolute;
  top: 0;
  left: -120vw;
}

.panel-section {
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid rgba(219, 227, 223, 0.9);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 12px 34px rgba(22, 32, 29, 0.06);
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 14px;
  color: var(--accent);
}

.section-heading h2 {
  color: var(--text);
  font-size: 0.98rem;
}

.section-heading.with-action {
  justify-content: space-between;
}

.section-heading.with-action > div {
  display: flex;
  align-items: center;
  gap: 9px;
}

.field-grid {
  display: grid;
  gap: 11px;
}

.field-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-grid.three {
  grid-template-columns: 0.8fr 0.8fr 1.4fr;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 11px;
}

.field span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 750;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: 0;
  background: #ffffff;
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.field input,
.field select {
  height: 42px;
  padding: 0 12px;
}

.field select {
  cursor: pointer;
}

.field textarea {
  min-height: 82px;
  resize: vertical;
  padding: 11px 12px;
  line-height: 1.45;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 138, 95, 0.14);
}

.option-stack {
  display: grid;
  gap: 11px;
  margin-bottom: 14px;
}

.field-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.field-hint {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 750;
}

.check-row input {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
}

.segment-control {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #eef3f1;
}

.segment-control button {
  min-height: 36px;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 800;
}

.segment-control button.active {
  color: #ffffff;
  background: var(--accent);
  box-shadow: 0 8px 18px rgba(15, 138, 95, 0.2);
}

.segment-control.lang-switch {
  min-width: 130px;
  align-self: center;
}

.action-row.sticky-actions {
  align-items: center;
  flex-wrap: wrap;
}

.items-editor {
  display: grid;
  gap: 8px;
}

.item-editor {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
}

.item-editor.collapsed {
  background: #fbfcfc;
}

.item-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.item-editor.collapsed .item-editor-head {
  margin-bottom: 0;
}

.item-editor-title {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.item-editor-title span {
  font-size: 0.78rem;
  font-weight: 850;
  color: var(--accent);
}

.item-editor-title small {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-editor-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

.item-editor-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 8px;
  align-items: start;
}

.item-editor .field {
  gap: 4px;
  margin-bottom: 0;
}

.item-editor .field span {
  font-size: 0.68rem;
}

.item-editor .field input,
.item-editor .field select {
  height: 36px;
  padding: 0 9px;
  border-radius: 8px;
  font-size: 0.82rem;
}

.item-editor .field textarea {
  min-height: 36px;
  padding: 8px 9px;
  border-radius: 8px;
  font-size: 0.82rem;
  line-height: 1.25;
}

.item-name-field,
.item-description-field {
  grid-column: span 4;
}

.item-kind-field,
.item-loading-field,
.item-price-field {
  grid-column: span 2;
}

.item-qty-field,
.item-unit-field {
  grid-column: span 1;
}

.item-discount-type-field,
.item-discount-value-field {
  grid-column: span 2;
}

.item-image-field {
  display: grid;
  grid-column: span 4;
  gap: 4px;
  margin: 0;
}

.item-image-field > span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 750;
}

.item-image-control {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 36px;
}

.item-image-control img,
.item-image-control small {
  width: 42px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf8;
}

.item-image-control img {
  display: block;
  object-fit: cover;
}

.item-image-control small {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.58rem;
  line-height: 1.1;
  text-align: center;
}

.item-image-control input {
  min-width: 0;
  color: var(--muted);
  font-size: 0.72rem;
}

.template-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 2px 0 12px;
}

.template-section {
  display: grid;
  gap: 8px;
  margin: 4px 0 6px;
}

.template-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--accent);
}

.template-header > span {
  font-size: 0.78rem;
  font-weight: 800;
  margin-right: auto;
}

.template-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.template-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
}

.template-chip:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.tpl-entry {
  cursor: default;
}

.tpl-preview {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
  white-space: pre-line;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.tpl-rename-input {
  width: 100%;
  padding: 4px 6px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  outline: 0;
  font-size: 0.9rem;
  font-weight: 800;
}

.swatch-row {
  display: flex;
  gap: 9px;
  margin: 4px 0 14px;
}

.swatch {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 3px solid #ffffff;
  cursor: pointer;
  box-shadow: 0 0 0 1px var(--line);
}

.swatch.active {
  box-shadow:
    0 0 0 2px var(--accent),
    0 8px 18px rgba(22, 32, 29, 0.18);
}

.swatch.emerald {
  background: linear-gradient(135deg, #0f8a5f, #1d4ed8);
}

.swatch.blue {
  background: linear-gradient(135deg, #2563eb, #0f766e);
}

.swatch.terracotta {
  background: linear-gradient(135deg, #c2410c, #0f766e);
}

.signature-editor {
  display: grid;
  gap: 11px;
  margin-top: 6px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.signature-auto-info {
  display: grid;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--accent-soft);
}

.signature-auto-info > span {
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.signature-auto-info strong {
  color: var(--text);
  font-size: 0.95rem;
}

.signature-auto-info > small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.signature-auto-hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.4;
}

.preview-panel {
  min-width: 0;
  padding: 28px;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 auto 20px;
  max-width: 1020px;
}

.preview-toolbar h2 {
  font-size: clamp(1.25rem, 1.7vw, 1.85rem);
}

.preview-scroll {
  overflow: auto;
  padding: 14px 0 70px;
}

.print-area {
  display: grid;
  gap: 3px;
  justify-items: center;
}

.quote-sheet {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(100%, 210mm);
  min-height: 297mm;
  overflow: hidden;
  padding: 18mm 16mm 14mm;
  border-radius: 6px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.page-accent {
  position: absolute;
  inset: 0 0 auto;
  height: 9mm;
  background:
    linear-gradient(90deg, var(--accent), var(--accent-2)),
    var(--accent);
}

.quote-header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16mm;
}

.company-lockup {
  display: flex;
  align-items: center;
}

.quote-brand-logo {
  display: block;
  width: 72mm;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

.quote-meta small,
.table-title small {
  color: var(--muted);
  font-size: 0.78rem;
}

.quote-meta {
  display: grid;
  justify-items: end;
  gap: 4px;
  text-align: right;
}

.quote-meta span {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.quote-meta strong {
  font-size: 1.18rem;
}

.info-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 12px;
  margin-bottom: 10mm;
}

.info-card {
  min-height: 128px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fbfcfc;
}

.info-card span,
.document-notes span,
.table-title span {
  display: block;
  margin-bottom: 7px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 850;
  text-transform: uppercase;
}

.info-card strong {
  display: block;
  margin-bottom: 7px;
  font-size: 1.02rem;
}

.info-card p {
  margin: 3px 0;
  color: #4d5a56;
  font-size: 0.84rem;
  line-height: 1.42;
  white-space: pre-line;
}

.opening-text {
  margin: 0 0 7mm;
  color: #3d4a46;
  font-size: 0.84rem;
  line-height: 1.48;
}

.opening-text p {
  margin: 0;
  white-space: pre-line;
}

.continuation-banner {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 10mm;
  padding: 17px 20px;
  border-radius: 16px;
  background: var(--accent-soft);
}

.continuation-banner span {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.table-section {
  flex: 1 1 auto;
}

.table-title {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 4px;
}

.quote-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.quote-table .col-no {
  width: 5%;
}

.quote-table .col-image {
  width: 10%;
}

.quote-table .col-item {
  width: 27%;
}

.quote-table .col-jenis {
  width: 14%;
}

.quote-table .col-loading {
  width: 12%;
}

.quote-table .col-jumlah {
  width: 8%;
}

.quote-table .col-satuan {
  width: 8%;
}

.quote-table .col-harga,
.quote-table .col-total {
  width: 13%;
}

.quote-table.with-images .col-no {
  width: 4%;
}

.quote-table.with-images .col-image {
  width: 16%;
}

.quote-table.with-images .col-item {
  width: 19%;
}

.quote-table.with-images .col-jenis {
  width: 11%;
}

.quote-table.with-images .col-loading {
  width: 10%;
}

.quote-table.with-images .col-jumlah,
.quote-table.with-images .col-satuan {
  width: 7%;
}

.quote-table.with-images .col-harga {
  width: 11%;
}

.quote-table.with-images .col-total {
  width: 15%;
}

.quote-table th {
  padding: 6px 6px;
  color: #ffffff;
  background: #18231f;
  font-size: 0.6rem;
  line-height: 1.18;
  text-align: center;
  text-transform: uppercase;
  vertical-align: middle;
  white-space: normal;
  overflow-wrap: anywhere;
}

.quote-table th:first-child {
  border-radius: 10px 0 0 10px;
}

.quote-table th:last-child {
  border-radius: 0 10px 10px 0;
}

.quote-table td {
  padding: 5px 6px;
  border-bottom: 1px solid #e6ece9;
  color: #24312d;
  font-size: 0.68rem;
  line-height: 1.28;
  vertical-align: top;
  overflow-wrap: break-word;
}

.quote-table tr {
  break-inside: avoid;
}

.quote-table td:first-child,
.quote-table td:nth-child(3),
.quote-table td:nth-child(4),
.quote-table td:nth-child(5),
.quote-table td:nth-child(6) {
  text-align: center;
}

.quote-table td:nth-child(7),
.quote-table td:nth-child(8) {
  text-align: right;
  white-space: nowrap;
  font-size: 0.62rem;
  font-variant-numeric: tabular-nums;
}

.quote-table.with-images td:nth-child(2),
.quote-table.with-images td:nth-child(4),
.quote-table.with-images td:nth-child(5),
.quote-table.with-images td:nth-child(6),
.quote-table.with-images td:nth-child(7) {
  text-align: center;
}

.quote-table.with-images td:nth-child(3) {
  text-align: left;
}

.quote-table.with-images td:nth-child(7) {
  white-space: normal;
  font-size: 0.68rem;
}

.quote-table.with-images td:nth-child(8),
.quote-table.with-images td:nth-child(9) {
  text-align: right;
  white-space: nowrap;
  font-size: 0.62rem;
  font-variant-numeric: tabular-nums;
}

.item-image-cell {
  padding: 7px 5px !important;
  text-align: center;
  vertical-align: middle !important;
}

.item-image-frame {
  display: flex;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid #d9e3de;
  border-radius: 6px;
  background: #f7faf8;
}

.item-image-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.item-image-empty {
  color: #9aa6a2;
}

.quote-table td strong {
  display: block;
  margin-bottom: 3px;
  color: #17211e;
  font-size: 0.78rem;
  line-height: 1.22;
}

.quote-table td span {
  display: block;
  color: #66736f;
  line-height: 1.35;
  white-space: pre-line;
}

.item-discount-note {
  display: block;
  margin-top: 2px;
  color: var(--accent);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.item-total-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  line-height: 1.18;
}

.item-total-original {
  color: #94a09b;
  font-size: 0.6rem;
  font-weight: 600;
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.item-total-final {
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.item-total-saving {
  display: inline-block;
  margin-top: 2px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.quote-table tfoot td {
  padding: 8px 5px;
  border-bottom: 0;
  background: #f7faf8;
  font-weight: 800;
  font-size: 0.68rem;
}

.quote-table tfoot tr:first-child td {
  border-top: 2px solid #18231f;
}

.quote-table tfoot td:first-child {
  color: #4f5d59;
  text-align: right;
}

.quote-table tfoot td:last-child {
  color: #17211e;
  text-align: right;
  white-space: nowrap;
  font-size: 0.62rem;
  font-variant-numeric: tabular-nums;
}

.quote-table tfoot .grand-total td {
  color: #ffffff;
  background: #16201d;
  font-size: 0.72rem;
}

.quote-table tfoot .grand-total td:last-child {
  font-size: 0.66rem;
}

.quote-table tfoot .grand-total td:first-child {
  border-radius: 0 0 0 10px;
}

.quote-table tfoot .grand-total td:last-child {
  border-radius: 0 0 10px 0;
}

.document-notes {
  display: grid;
  gap: 6px;
  margin-top: 2mm;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f7faf8;
  break-inside: avoid;
}

.amount-in-words {
  margin-top: 2mm;
  padding: 8px 14px;
  border: 1px dashed var(--accent);
  border-radius: 14px;
  background: var(--accent-soft);
  break-inside: avoid;
}

.amount-in-words span {
  display: block;
  margin-bottom: 3px;
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.amount-in-words p {
  margin: 0;
  color: #17211e;
  font-size: 0.86rem;
  font-style: italic;
  font-weight: 700;
  line-height: 1.4;
}

.payment-info-inline {
  display: grid;
  gap: 4px;
}

.payment-info-inline > span {
  display: block;
  margin-bottom: 4px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.payment-rows {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px 14px;
  align-items: start;
}

.payment-rows div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.payment-rows small {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.payment-rows strong {
  color: #17211e;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  word-break: break-word;
}

.payment-note {
  margin: 8px 0 0;
  color: #52605c;
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-line;
}

.document-notes div + div {
  padding-top: 9px;
  border-top: 1px solid #e3ebe7;
}

.document-notes p {
  margin: 0;
  color: #52605c;
  font-size: 0.82rem;
  line-height: 1.45;
  white-space: pre-line;
}

.signature-block {
  width: 235px;
  max-width: 100%;
}

.signature-space {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  height: 55px;
  margin: 2px 0 2px;
}

.signature-space img {
  display: block;
  max-width: 180px;
  max-height: 70px;
  object-fit: contain;
}

.signature-block strong {
  display: block;
  color: #17211e;
  font-size: 0.9rem;
  line-height: 1.25;
}

.signature-block p {
  margin-top: 2px;
  color: #66736f;
  font-size: 0.78rem;
}

.quote-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: auto;
  padding-top: 11px;
  border-top: 1px solid #dfe7e3;
  break-inside: avoid;
  text-align: center;
}

.quote-footer strong {
  display: block;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 850;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.desktop-only {
  display: inline-flex;
}

@media (max-width: 1180px) {
  .app-shell {
    padding: 18px;
  }

  .preview-panel {
    padding: 20px;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 12px;
  }

  .app-topbar,
  .preview-panel {
    padding: 16px;
  }

  .brand-strip,
  .action-row {
    align-items: stretch;
    flex-direction: column;
  }

  .user-chip {
    margin-left: 0;
  }

  .status-row {
    flex-direction: column;
    align-items: stretch;
  }

  .active-draft-name {
    max-width: 100%;
  }

  .modal-card {
    max-height: 92vh;
    padding: 16px;
  }

  .field-grid.two,
  .field-grid.three,
  .info-grid {
    grid-template-columns: 1fr;
  }

  .item-editor-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .item-name-field,
  .item-description-field,
  .item-kind-field,
  .item-loading-field {
    grid-column: span 3;
  }

  .item-qty-field,
  .item-unit-field,
  .item-price-field {
    grid-column: span 2;
  }

  .item-discount-type-field,
  .item-discount-value-field {
    grid-column: span 3;
  }

  .item-image-field {
    grid-column: span 6;
  }

  .preview-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .desktop-only {
    display: none;
  }

  .quote-sheet {
    min-height: auto;
    padding: 38px 18px 22px;
  }

.quote-header,
.continuation-banner {
    flex-direction: column;
  }

  .quote-meta {
    justify-items: start;
    text-align: left;
  }

  .quote-table {
    min-width: 680px;
  }

  .quote-table.with-images {
    min-width: 760px;
  }

  .table-section {
    overflow-x: auto;
  }

}

body.pdf-exporting .quote-sheet {
  width: 210mm !important;
  min-height: 297mm !important;
  height: auto !important;
  padding: 18mm 16mm 14mm !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  overflow: visible !important;
}

body.pdf-exporting .preview-panel {
  position: static !important;
  left: auto !important;
  top: auto !important;
}

body.pdf-exporting .quote-header {
  flex-direction: row !important;
}

body.pdf-exporting .quote-meta {
  justify-items: end !important;
  text-align: right !important;
}

body.pdf-exporting .info-grid {
  grid-template-columns: 1.1fr 0.9fr !important;
}

body.pdf-exporting .table-section {
  overflow: visible !important;
}

body.pdf-exporting .quote-table {
  min-width: 0 !important;
}

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

  html,
  body {
    width: 210mm;
    background: #ffffff !important;
  }

  body * {
    visibility: hidden;
  }

  .preview-panel,
  .preview-panel *,
  .print-area,
  .print-area * {
    visibility: visible;
  }

  .editor-panel,
  .preview-toolbar {
    display: none !important;
  }

  .app-shell,
  .preview-panel,
  .preview-scroll,
  .print-area {
    display: block !important;
    min-height: 0;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
    background: #ffffff !important;
  }

  .quote-sheet {
    width: 210mm;
    min-height: 297mm;
    height: 297mm;
    margin: 0 !important;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    page-break-after: always;
    break-after: page;
  }

  .quote-sheet:last-child {
    page-break-after: auto;
    break-after: auto;
  }

  .quote-table tr,
  .info-card,
  .document-notes,
  .quote-footer {
    break-inside: avoid;
  }
}

/* ── Laporan Dokumentasi ── */

.compact.report-btn {
  min-height: 34px;
  height: 34px;
  padding: 0 10px;
  font-size: 0.78rem;
  white-space: nowrap;
}

.report-topbar-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-right: auto;
}

.report-topbar-title .eyebrow {
  margin: 0;
}

.report-topbar-title strong {
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
}

.report-date-row {
  display: flex;
  gap: 10px;
  margin-bottom: 11px;
}

.report-date-row select {
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: 0;
  background: #ffffff;
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  cursor: pointer;
  font-size: 0.88rem;
}

.report-date-row select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 138, 95, 0.14);
}

/* Floors */
.report-floors-list {
  display: grid;
  gap: 12px;
}

.report-floor-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfcfc;
}

.report-floor-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.report-floor-drag-handle {
  cursor: grab;
  color: var(--muted);
  display: grid;
  place-items: center;
  padding: 4px;
  border-radius: 6px;
  flex-shrink: 0;
  transition: background 120ms ease, color 120ms ease;
}

.report-floor-drag-handle:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.report-floor-drag-handle:active {
  cursor: grabbing;
}

.report-floor-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.report-floor-card.dragging {
  opacity: 0.45;
  border-style: dashed;
  background: var(--accent-soft);
}

.report-floor-card.drag-over {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.report-floor-name-input {
  flex: 1;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  background: #ffffff;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 700;
}

.report-floor-name-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 138, 95, 0.14);
}

.report-floor-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: #ffffff;
}

.report-floor-layout .field-label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.7rem;
  color: var(--muted);
}

.report-floor-layout .field-hint {
  display: block;
  margin-top: 4px;
}

@media (max-width: 640px) {
  .report-floor-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

.report-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
}

.report-photo-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: #eef3f1;
}

.report-photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.report-photo-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #ffffff;
  cursor: pointer;
  border: 0;
  padding: 0;
  font-size: 0;
}

.report-photo-remove:hover {
  background: rgba(180, 35, 24, 0.85);
}

.report-photo-upload {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: 8px;
  border: 2px dashed var(--line);
  background: #ffffff;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 700;
  transition: border-color 160ms ease, background 160ms ease;
}

.report-photo-upload:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.report-photo-count {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.7rem;
}

.report-no-photos {
  color: var(--muted);
  font-size: 0.82rem;
  font-style: italic;
}

.report-list-no {
  font-size: 0.7rem;
  color: var(--muted);
  font-family: "Courier New", monospace;
  letter-spacing: 0.04em;
}

.report-history-list {
  margin-top: 4px;
}

.report-history-tile {
  padding: 6px;
}

.report-history-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.report-history-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  font-family: "Courier New", monospace;
  letter-spacing: 0.03em;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(15, 138, 95, 0.1);
  color: #0f8a5f;
  white-space: nowrap;
}

.panel-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.panel-section-header h2 {
  margin: 0;
  font-size: 1rem;
}

/* Report editor input */
.report-editor-input {
  max-width: 780px;
  margin: 0 auto;
}

/* ── Report Preview Sheet (A4) ── */
.report-sheet {
  width: 210mm;
  min-height: 297mm;
  padding: 0;
  margin: 0 auto 3px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 12px 48px rgba(22, 32, 29, 0.1);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 10pt;
  line-height: 1.6;
  color: #1f2937;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

/* Top accent bar (halaman 1 only) */
.report-sheet-topbar {
  height: 5mm;
  background: linear-gradient(90deg, #0f8a5f, #16a34a);
  flex-shrink: 0;
}

/* ── Header halaman 1 ── */
.report-sheet-header {
  text-align: center;
  padding: 6mm 22mm 4mm;
  flex-shrink: 0;
}

.report-sheet-logo {
  display: block;
  margin: 0 auto 18px;
  max-width: 300px;
  max-height: 120px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.report-sheet-label {
  margin: 0 0 4px;
  font-size: 11pt;
  font-weight: 700;
  letter-spacing: 0.25em;
  color: #0f8a5f;
  text-transform: uppercase;
}

.report-sheet-company {
  margin: 0 0 10px;
  font-size: 26pt;
  font-weight: 800;
  color: #111827;
  letter-spacing: -0.03em;
  line-height: 1.15;
  font-family: Georgia, "Times New Roman", serif;
}

/* Meta info row (halaman 1) */
.report-sheet-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.report-sheet-date {
  font-size: 11pt;
  font-weight: 600;
  color: #374151;
  letter-spacing: 0.02em;
}

.report-sheet-doc-below {
  font-size: 9pt;
  font-weight: 700;
  font-family: "Courier New", monospace;
  color: #0f8a5f;
  padding: 3px 12px;
  background: rgba(15, 138, 95, 0.08);
  border-radius: 5px;
  letter-spacing: 0.04em;
}

/* ── Header slim (halaman 2+) ── */
.report-sheet-header-slim {
  padding: 6mm 22mm 3mm;
  flex-shrink: 0;
}

.report-sheet-header-slim-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 4mm;
  border-bottom: 1px solid #e5e7eb;
}

.report-sheet-header-slim-title {
  font-size: 8.5pt;
  font-weight: 600;
  color: #6b7280;
  letter-spacing: 0.04em;
}

.report-sheet-header-slim-date {
  font-size: 8pt;
  font-weight: 500;
  color: #9ca3af;
}

/* ── Body ── */
.report-sheet-body {
  flex: 1;
  padding: 0 22mm;
  display: flex;
  flex-direction: column;
}

/* ── Floor ── */
.report-sheet-floor {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.report-sheet-floor-head {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  padding: 0 0 7px 10px;
  border-left: 3px solid #0f8a5f;
}

.report-sheet-floor-head h2 {
  margin: 0;
  font-size: 11pt;
  font-weight: 700;
  color: #1f2937;
}

/* ── Photo grid ── */
.report-sheet-photo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  flex: 1;
  align-content: start;
}

.report-sheet-photo-item {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  background: #f9fafb;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  border: 1px solid #e5e7eb;
  width: 100%;
  padding-bottom: 75%;
  height: 0;
}

.report-sheet-photo-item img {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: calc(100% - 8px);
  max-height: calc(100% - 8px);
  width: auto;
  height: auto;
  display: block;
}

.report-sheet-photo-num {
  position: absolute;
  top: 5px;
  left: 5px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(15, 138, 95, 0.85);
  color: #fff;
  font-size: 7pt;
  font-weight: 700;
  line-height: 1;
  z-index: 1;
}

/* ── Signature ── */
.report-sheet-signature {
  padding: 0 22mm 4mm;
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
}

.report-sheet-signature-col {
  width: 200px;
  text-align: center;
}

.report-sheet-signature-label {
  margin: 0 0 4px;
  font-size: 9pt;
  font-weight: 600;
  color: #374151;
}

.report-sheet-signature-space {
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.report-sheet-signature-space img {
  display: block;
  max-width: 160px;
  max-height: 50px;
  object-fit: contain;
}

.report-sheet-signature-name {
  margin: 0;
  font-size: 9pt;
  font-weight: 500;
  color: #6b7280;
  border-top: 1px solid #d1d5db;
  padding-top: 6px;
}

/* ── Footer ── */
.report-sheet-footer {
  padding: 6mm 22mm 6mm;
  border-top: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.report-sheet-page-num {
  font-size: 8pt;
  font-weight: 500;
  color: #9ca3af;
}

.report-sheet-site {
  font-size: 8pt;
  font-weight: 600;
  color: #0f8a5f;
  letter-spacing: 0.04em;
}

/* ── PDF export ── */
.pdf-exporting .report-sheet {
  border: 0;
  box-shadow: none;
  border-radius: 0;
  page-break-after: always;
  break-after: page;
}

.pdf-exporting .report-sheet-topbar {
  height: 5mm;
}

.is-hidden {
  display: none !important;
}

#historyBody {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.report-sheet-note {
  flex-shrink: 0;
  padding: 0 22mm;
  margin: 0 0 5mm;
}

.report-sheet-note-label {
  margin: 0 0 2px;
  font-size: 9pt;
  font-weight: 700;
  color: #374151;
}

.report-sheet-note-text {
  margin: 0;
  font-size: 9pt;
  line-height: 1.5;
  color: #4b5563;
  white-space: pre-wrap;
}

.report-sheet-photo-grid--solo {
  align-content: stretch;
}

.report-sheet-photo-grid--solo .report-sheet-photo-item {
  height: auto;
  padding-bottom: 0;
  min-height: 0;
}

