:root {
  --bg: #f4efe5;
  --bg-accent: #e2f0e7;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: #fffdf8;
  --text: #1e2f26;
  --muted: #597062;
  --primary: #0b6e4f;
  --primary-dark: #084c39;
  --secondary: #d58f28;
  --danger: #9a2f2f;
  --border: rgba(11, 110, 79, 0.15);
  --shadow: 0 20px 40px rgba(58, 78, 58, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(213, 143, 40, 0.2), transparent 25%),
    radial-gradient(circle at top right, rgba(11, 110, 79, 0.18), transparent 30%),
    linear-gradient(180deg, var(--bg-accent), var(--bg));
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 31, 26, 0.52);
  display: grid;
  place-items: center;
  padding: 1rem;
  z-index: 50;
}

.modal-card {
  width: min(560px, 100%);
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 1.25rem;
}

.login-overlay {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.login-card {
  width: min(460px, 100%);
  background: linear-gradient(145deg, var(--primary-dark), var(--primary));
  color: white;
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.login-card label {
  margin-bottom: 0.9rem;
  color: white;
}

.login-card input {
  margin-top: 0.25rem;
}

.hint,
.status-text {
  color: rgba(255, 255, 255, 0.82);
}

.status-text {
  min-height: 1.25rem;
}

.inline-help {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.app-shell {
  width: min(1400px, calc(100% - 2rem));
  margin: 1rem auto 3rem;
}

.hero,
.card,
.tab-bar {
  backdrop-filter: blur(12px);
}

.hero {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: white;
  border-radius: 28px;
  padding: 2rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  box-shadow: var(--shadow);
}

.hero-brand {
  display: grid;
  gap: 0.9rem;
  min-width: 0;
}

.hero-brand-top {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.hero-logo {
  width: 88px;
  height: 88px;
  object-fit: contain;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  padding: 0.35rem;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
}

.eyebrow {
  margin: 0 0 0.5rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.78rem;
  opacity: 0.78;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1;
  max-width: 18ch;
}

.hero-system-title {
  margin: 0.35rem 0 0;
  font-size: clamp(1rem, 3vw, 1.35rem);
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
}

.hero-copy {
  max-width: 48ch;
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.86);
}

.hero-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.hero-actions-column {
  flex-direction: column;
  align-items: stretch;
  min-width: 220px;
}

.user-chip,
.sync-pill {
  border-radius: 16px;
  padding: 0.8rem 1rem;
  background: rgba(255, 255, 255, 0.12);
}

.app-pill {
  border-radius: 16px;
  padding: 0.78rem 1rem;
  background: rgba(255, 255, 255, 0.12);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-weight: 700;
}

.user-chip strong,
.user-chip span {
  display: block;
}

.sync-pill.success {
  background: rgba(53, 169, 111, 0.26);
}

.sync-pill.warning {
  background: rgba(213, 143, 40, 0.26);
}

.sync-pill.error {
  background: rgba(154, 47, 47, 0.28);
}

.app-pill.success {
  background: rgba(53, 169, 111, 0.26);
}

.app-pill.warning {
  background: rgba(213, 143, 40, 0.26);
}

.app-pill.error {
  background: rgba(154, 47, 47, 0.28);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin: 1.2rem 0;
}

.compact-stats {
  margin: 1rem 0 0;
}

.stat-card,
.card,
.tab-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.stat-card {
  padding: 1.1rem 1.2rem;
}

.stat-card p {
  margin: 0;
  color: var(--muted);
}

.stat-card strong {
  display: block;
  margin-top: 0.3rem;
  font-size: 1.6rem;
}

.tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.5rem;
  position: sticky;
  top: 0.5rem;
  z-index: 20;
}

.tab-btn,
.primary-btn,
.ghost-btn,
.upload-btn {
  border: none;
  border-radius: 14px;
  padding: 0.9rem 1rem;
  font: inherit;
  cursor: pointer;
  transition: transform 150ms ease, opacity 150ms ease, background 150ms ease;
}

.tab-btn {
  flex: 1 1 180px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
}

.tab-btn.active {
  background: var(--primary);
  color: white;
}

.mini-tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.mini-tab-btn {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.7rem 0.95rem;
  background: rgba(11, 110, 79, 0.06);
  color: var(--primary-dark);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.mini-tab-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.primary-btn {
  background: linear-gradient(135deg, var(--secondary), #bf6d12);
  color: white;
  font-weight: 700;
}

.ghost-btn,
.upload-btn {
  background: rgba(11, 110, 79, 0.08);
  color: var(--primary-dark);
  font-weight: 700;
}

body.is-standalone .hero {
  padding-top: 1.35rem;
}

#installAppBtn {
  width: 100%;
}

.ghost-btn.danger {
  background: rgba(154, 47, 47, 0.1);
  color: var(--danger);
}

.tab-panel {
  display: none;
  margin-top: 1rem;
}

.tab-panel.active {
  display: block;
}

.mini-tab-panel {
  display: none;
}

.mini-tab-panel.active {
  display: block;
}

.grid-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.card {
  padding: 1.25rem;
}

.card-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  margin-bottom: 1rem;
}

.card-heading h2,
.card h3 {
  margin: 0;
}

.card-heading p,
.formula-box p {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.form-grid,
.filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.filters {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 1rem;
  align-items: end;
}

.compact-filters {
  grid-template-columns: repeat(auto-fit, minmax(180px, 220px));
}

.button-stack {
  display: grid;
  gap: 0.6rem;
}

.form-actions,
.submit-row,
.quick-centers,
.edit-row,
.lock-row,
.record-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.quick-centers {
  margin-top: -0.35rem;
}

.chip-btn,
.slim-btn {
  border: 1px solid rgba(11, 110, 79, 0.18);
  border-radius: 999px;
  padding: 0.7rem 0.9rem;
  background: rgba(11, 110, 79, 0.06);
  color: var(--primary-dark);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease;
}

.chip-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.submit-row .primary-btn,
.submit-row .ghost-btn {
  flex: 1 1 220px;
}

.edit-row {
  align-items: center;
}

.edit-chip,
.lock-chip,
.table-note {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  border-radius: 999px;
  padding: 0.55rem 0.9rem;
  font-weight: 700;
}

.edit-chip {
  background: rgba(213, 143, 40, 0.14);
  color: #8a5a0a;
}

.lock-chip {
  background: rgba(11, 110, 79, 0.1);
  color: var(--primary-dark);
}

.table-note {
  background: rgba(11, 110, 79, 0.08);
  color: var(--muted);
  white-space: nowrap;
}

.card-subsection {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.32);
}

.card-subsection h3 {
  margin: 0;
}

.theme-color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.85rem;
}

.theme-color-grid input[type="color"] {
  height: 52px;
  padding: 0.3rem;
}

.admin-branding-only {
  display: contents;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-weight: 600;
  color: var(--primary-dark);
}

input,
select {
  width: 100%;
  border: 1px solid rgba(11, 110, 79, 0.18);
  background: var(--surface-strong);
  border-radius: 14px;
  padding: 0.85rem 0.9rem;
  font: inherit;
  color: var(--text);
}

.locked-entry-form input:disabled,
.locked-entry-form select:disabled,
.locked-entry-form textarea:disabled {
  cursor: not-allowed;
  background: rgba(124, 139, 129, 0.12);
  color: var(--text);
  border-color: rgba(124, 139, 129, 0.24);
}

.locked-entry-form label,
.locked-entry-form .card-subsection,
.locked-entry-form .inline-help {
  cursor: not-allowed;
}

.lock-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.7rem;
  width: 100%;
}

.lock-summary-item {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.75rem 0.85rem;
}

.lock-summary-item span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.lock-summary-item strong {
  display: block;
  margin-top: 0.22rem;
  line-height: 1.45;
  color: var(--primary-dark);
}

.span-2 {
  grid-column: span 2;
}

.single-filter {
  margin-bottom: 1rem;
  max-width: 240px;
}

.snapshot-list {
  display: grid;
  gap: 0.9rem;
}

.dashboard-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.info-list {
  display: grid;
  gap: 0.85rem;
}

.info-item {
  background: rgba(11, 110, 79, 0.06);
  border: 1px solid rgba(11, 110, 79, 0.08);
  border-radius: 18px;
  padding: 0.95rem 1rem;
}

.info-item span {
  display: block;
  color: var(--muted);
  font-size: 0.92rem;
}

.info-item strong {
  display: block;
  margin-top: 0.25rem;
  line-height: 1.5;
}

.lookup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-top: 0.65rem;
}

.lookup-grid div {
  background: rgba(255, 255, 255, 0.66);
  border-radius: 14px;
  padding: 0.7rem 0.8rem;
}

.lookup-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.lookup-grid strong {
  display: block;
  margin-top: 0.18rem;
  font-size: 1rem;
}

.server-url-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.server-url-row .slim-btn {
  width: auto;
}

.info-item code {
  display: inline-block;
  margin: 0.15rem 0.35rem 0.15rem 0;
}

.snapshot-item {
  background: rgba(11, 110, 79, 0.06);
  border: 1px solid rgba(11, 110, 79, 0.08);
  border-radius: 18px;
  padding: 0.9rem 1rem;
}

.snapshot-item strong {
  display: block;
  font-size: 1.2rem;
}

.snapshot-item small {
  display: block;
  margin-top: 0.3rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.closing-balance-panel {
  background: rgba(255, 255, 255, 0.42);
}

.closing-balance-total {
  margin-bottom: 1rem;
  padding: 1rem 1.1rem;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(11, 110, 79, 0.14), rgba(11, 110, 79, 0.06));
  border: 1px solid rgba(11, 110, 79, 0.12);
}

.closing-balance-total span {
  display: block;
  color: var(--muted);
  font-weight: 600;
}

.closing-balance-total strong {
  display: block;
  margin-top: 0.2rem;
  font-size: clamp(1.7rem, 4vw, 2.35rem);
  color: var(--primary-dark);
}

.closing-balance-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.table-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.table-wrap {
  overflow: auto;
  border: 1px solid rgba(11, 110, 79, 0.12);
  border-radius: 18px;
}

.table-wrap .ghost-btn {
  padding: 0.55rem 0.8rem;
}

.record-actions {
  justify-content: flex-end;
  min-width: 160px;
}

.record-actions .ghost-btn,
.record-actions .slim-btn {
  padding: 0.45rem 0.75rem;
}

.table-wrap.wide {
  max-width: 100%;
}

.table-wrap.wide table {
  min-width: 0;
  table-layout: fixed;
}

.table-wrap.wide th,
.table-wrap.wide td {
  padding: 0.42rem 0.3rem;
  font-size: 0.79rem;
  line-height: 1.12;
  overflow-wrap: anywhere;
  word-break: break-word;
}

#reconciliationTable th,
#reconciliationTable td,
#monthlyCenterTable th,
#monthlyCenterTable td {
  text-align: center;
}

#monthlyCenterTable {
  width: 100%;
  table-layout: fixed;
}

#monthlyCenterTable th,
#monthlyCenterTable td {
  padding: 0.34rem 0.18rem;
  font-size: 0.71rem;
  line-height: 1.08;
}

#monthlyCenterTable th {
  white-space: nowrap;
}

#reconciliationTable th:nth-child(1),
#reconciliationTable td:nth-child(1),
#monthlyCenterTable th:nth-child(1),
#monthlyCenterTable td:nth-child(1) {
  width: 84px;
}

#reconciliationTable th:nth-child(2),
#reconciliationTable td:nth-child(2),
#monthlyCenterTable th:nth-child(8),
#monthlyCenterTable td:nth-child(8),
#monthlyCenterTable th:nth-child(9),
#monthlyCenterTable td:nth-child(9),
#monthlyCenterTable th:nth-child(10),
#monthlyCenterTable td:nth-child(10) {
  width: 76px;
}

#reconciliationTable th:nth-child(3),
#reconciliationTable td:nth-child(3) {
  width: 72px;
}

#reconciliationTable th:nth-child(n+4),
#reconciliationTable td:nth-child(n+4),
#monthlyCenterTable th:nth-child(n+2),
#monthlyCenterTable td:nth-child(n+2) {
  width: 56px;
}

#monthlyCenterTable th:nth-child(1),
#monthlyCenterTable td:nth-child(1) {
  width: 92px;
}

#monthlyCenterTable th:nth-child(8),
#monthlyCenterTable td:nth-child(8),
#monthlyCenterTable th:nth-child(9),
#monthlyCenterTable td:nth-child(9) {
  width: 62px;
}

#monthlyCenterTable th:nth-child(10),
#monthlyCenterTable td:nth-child(10) {
  width: 66px;
}

#monthlyCenterTable th:nth-child(2),
#monthlyCenterTable td:nth-child(2),
#monthlyCenterTable th:nth-child(3),
#monthlyCenterTable td:nth-child(3),
#monthlyCenterTable th:nth-child(4),
#monthlyCenterTable td:nth-child(4),
#monthlyCenterTable th:nth-child(5),
#monthlyCenterTable td:nth-child(5),
#monthlyCenterTable th:nth-child(6),
#monthlyCenterTable td:nth-child(6),
#monthlyCenterTable th:nth-child(7),
#monthlyCenterTable td:nth-child(7),
#monthlyCenterTable th:nth-child(11),
#monthlyCenterTable td:nth-child(11),
#monthlyCenterTable th:nth-child(12),
#monthlyCenterTable td:nth-child(12),
#monthlyCenterTable th:nth-child(13),
#monthlyCenterTable td:nth-child(13),
#monthlyCenterTable th:nth-child(14),
#monthlyCenterTable td:nth-child(14),
#monthlyCenterTable th:nth-child(15),
#monthlyCenterTable td:nth-child(15),
#monthlyCenterTable th:nth-child(16),
#monthlyCenterTable td:nth-child(16),
#monthlyCenterTable th:nth-child(17),
#monthlyCenterTable td:nth-child(17),
#monthlyCenterTable th:nth-child(18),
#monthlyCenterTable td:nth-child(18),
#monthlyCenterTable th:nth-child(19),
#monthlyCenterTable td:nth-child(19),
#monthlyCenterTable th:nth-child(20),
#monthlyCenterTable td:nth-child(20),
#monthlyCenterTable th:nth-child(21),
#monthlyCenterTable td:nth-child(21),
#monthlyCenterTable th:nth-child(22),
#monthlyCenterTable td:nth-child(22),
#monthlyCenterTable th:nth-child(23),
#monthlyCenterTable td:nth-child(23),
#monthlyCenterTable th:nth-child(24),
#monthlyCenterTable td:nth-child(24),
#monthlyCenterTable th:nth-child(25),
#monthlyCenterTable td:nth-child(25),
#monthlyCenterTable th:nth-child(26),
#monthlyCenterTable td:nth-child(26) {
  width: 44px;
}

.print-report-card {
  margin-top: 1rem;
}

.monthly-print-report-card {
  margin-top: 1rem;
}

.print-sheet {
  background: white;
  border: 1px solid rgba(11, 110, 79, 0.12);
  border-radius: 18px;
  padding: 0.85rem;
}

.print-sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 1rem;
  margin-bottom: 1rem;
}

.print-header-left {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  align-items: start;
  flex: 1;
}

.print-header-right {
  display: grid;
  gap: 0.5rem;
  align-content: start;
  min-width: 280px;
}

.print-logo-block {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.55rem;
  align-items: center;
  padding: 0.45rem 0.55rem;
  border: 1px solid #97aa9f;
  border-radius: 14px;
  background: #f5f8f6;
}

.print-logo-circle {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid #29463a;
  font-weight: 800;
  color: #29463a;
  background: white;
}

.print-logo-image {
  width: 46px;
  height: 46px;
  object-fit: contain;
  display: block;
}

.print-logo-text span,
.print-logo-text small {
  display: block;
}

.print-logo-text span {
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #20392f;
}

.print-logo-text small {
  color: #556d61;
  font-size: 0.68rem;
}

.print-header-badge {
  border: 1px solid #7d9689;
  border-radius: 999px;
  padding: 0.55rem 0.9rem;
  background: #eef4f0;
  font-weight: 700;
  color: #20392f;
}

.print-brand-line {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  color: #29463a;
}

.print-brand-subline {
  margin: 0;
  font-size: 0.78rem;
  color: #50665b;
}

.print-branding {
  display: grid;
  align-content: start;
}

.print-report-code {
  margin: 0.18rem 0 0;
  font-size: 0.72rem;
  font-weight: 700;
  color: #355246;
}

.print-kicker {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.print-sheet-header h2 {
  margin: 0.15rem 0;
  font-size: 1.35rem;
  letter-spacing: 0.01em;
}

.print-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.print-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.3rem 1rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid #c4d2cb;
  border-radius: 14px;
  background: #fbfcfb;
}

.print-summary-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.print-summary-strip div {
  border: 1px solid #bccfc4;
  background: #f5f8f6;
  border-radius: 12px;
  padding: 0.5rem 0.6rem;
}

.print-summary-strip span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
}

.print-summary-strip strong {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.88rem;
}

.print-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  min-width: 1200px;
}

.print-table .col-date {
  width: 5.5%;
}

.print-table .col-province {
  width: 6.5%;
}

.print-table .col-center {
  width: 10%;
}

.print-table .col-factory {
  width: 7.5%;
}

.print-table th,
.print-table td {
  border: 1px solid #9eb3a8;
  padding: 0.28rem 0.22rem;
  text-align: center;
  font-size: 0.7rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.print-table td.num,
.print-table tfoot td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.print-table thead th {
  background: #e7eeea;
  position: static;
  color: #15271f;
}

.print-table thead tr:first-child th {
  background: #d3dfd8;
  font-size: 0.72rem;
}

.print-table tfoot td {
  font-weight: 700;
  background: #eef3f0;
}

.print-table tbody tr {
  break-inside: avoid;
  page-break-inside: avoid;
}

.monthly-print-table {
  min-width: 1500px;
}

.monthly-print-sheet .print-report-code {
  margin: 0 0 0.45rem;
}

.monthly-print-table th,
.monthly-print-table td {
  font-size: 0.67rem;
  padding: 0.24rem 0.18rem;
}

.monthly-print-table thead tr:first-child th {
  background: #cfddd6;
}

.monthly-print-table .col-date {
  width: 7%;
}

.print-footer {
  margin-top: 0.7rem;
}

.signature-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 0.75rem;
}

.signature-box {
  border-top: 1px solid #7c9387;
  padding-top: 0.35rem;
}

.signature-box span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
}

.signature-box strong {
  display: block;
  margin-top: 0.18rem;
  font-size: 0.85rem;
}

.print-footnote {
  margin: 0.65rem 0 0;
  font-size: 0.68rem;
  color: var(--muted);
  text-align: left;
}

.print-footer-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  padding: 0.45rem 0 0.55rem;
  border-top: 1px solid #97aa9f;
  border-bottom: 1px solid #d4dfd9;
  color: #40574b;
  font-size: 0.7rem;
  align-items: center;
}

.print-legal-note {
  margin: 0.3rem 0 0;
  font-size: 0.64rem;
  color: #60766a;
  text-align: left;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

th,
td {
  padding: 0.8rem 0.7rem;
  border-bottom: 1px solid rgba(11, 110, 79, 0.08);
  text-align: left;
  font-size: 0.95rem;
}

th {
  position: sticky;
  top: 0;
  background: #eff8f2;
  z-index: 1;
}

tbody tr:nth-child(even) {
  background: rgba(11, 110, 79, 0.025);
}

.stack-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.top-gap {
  margin-top: 1rem;
}

.upload-btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.upload-btn input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.formula-box {
  margin-top: 1rem;
  background: rgba(213, 143, 40, 0.09);
  border: 1px solid rgba(213, 143, 40, 0.18);
  border-radius: 18px;
  padding: 1rem;
}

code {
  display: block;
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: 0.92rem;
}

.positive {
  color: var(--primary);
  font-weight: 700;
}

.negative {
  color: var(--danger);
  font-weight: 700;
}

button:hover,
.upload-btn:hover {
  transform: translateY(-1px);
}

@media print {
  @page {
    size: A4 landscape;
    margin: 8mm 9mm;
  }

  body {
    background: white;
    color: #111;
  }

  .hero-actions,
  .tab-bar,
  #operations,
  #summary,
  #settings,
  .filters,
  .table-wrap,
  .print-report-card .card-heading,
  .monthly-print-report-card .card-heading,
  .login-overlay {
    display: none !important;
  }

  .app-shell {
    width: 100%;
    margin: 0;
  }

  .hero,
  .card,
  .table-wrap,
  .print-sheet {
    box-shadow: none;
    background: white;
    border: 1px solid #999;
  }

  .tab-panel {
    display: none !important;
  }

  #reconciliation {
    display: block !important;
  }

  .print-report-card {
    display: block !important;
    margin-top: 0;
    border: none;
    box-shadow: none;
    padding: 0;
  }

  .monthly-print-report-card {
    display: block !important;
    margin-top: 0;
    border: none;
    box-shadow: none;
    padding: 0;
  }

  body[data-print-mode="daily"] .monthly-print-report-card {
    display: none !important;
  }

  body[data-print-mode="monthly"] #printReportCard {
    display: none !important;
  }

  .print-sheet {
    border: none;
    padding: 0;
  }

  .print-table {
    min-width: 0;
  }

  .print-table thead {
    display: table-header-group;
  }

  .print-table tfoot {
    display: table-footer-group;
  }

  .print-table tbody tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .print-table th,
  .print-table td {
    font-size: 0.62rem;
    padding: 0.22rem 0.18rem;
  }

  .print-table .col-center {
    width: 11%;
  }

  .print-table .col-factory {
    width: 8%;
  }

  .monthly-print-table {
    min-width: 0;
  }

  .print-sheet-header {
    margin-bottom: 0.42rem;
  }

  .print-summary-strip {
    margin-bottom: 0.38rem;
  }

  .print-header-left {
    grid-template-columns: auto 1fr;
  }

  .print-summary-strip div,
  .print-header-badge,
  .print-sheet-header,
  .print-summary-strip,
  .print-footer-bar,
  .signature-row,
  .print-footer {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}

@media (max-width: 1100px) {
  .grid-two,
  .table-grid,
  .filters {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 1rem, 100%);
  }

  .hero {
    padding: 1.25rem;
    border-radius: 22px;
    flex-direction: column;
  }

  .hero-actions-column {
    min-width: 100%;
  }

  .hero-brand-top {
    align-items: flex-start;
  }

  .hero-logo {
    width: 70px;
    height: 70px;
  }

  .hero h1 {
    max-width: none;
  }

  .tab-bar {
    overflow: auto;
    position: static;
  }

  .tab-btn {
    min-width: 190px;
  }

  .form-grid,
  .filters {
    grid-template-columns: 1fr;
  }

  .slim-btn {
    width: 100%;
  }

  .mini-tab-btn {
    width: 100%;
  }

  .span-2 {
    grid-column: span 1;
  }

  .print-meta-grid,
  .print-header-left,
  .print-header-right,
  .print-summary-strip,
  .print-footer-bar,
  .signature-row {
    grid-template-columns: 1fr;
  }

  .table-wrap.wide th,
  .table-wrap.wide td {
    padding: 0.34rem 0.2rem;
    font-size: 0.72rem;
  }

  #reconciliationTable th:nth-child(1),
  #reconciliationTable td:nth-child(1),
  #monthlyCenterTable th:nth-child(1),
  #monthlyCenterTable td:nth-child(1) {
    width: 70px;
  }

  #reconciliationTable th:nth-child(2),
  #reconciliationTable td:nth-child(2),
  #monthlyCenterTable th:nth-child(8),
  #monthlyCenterTable td:nth-child(8),
  #monthlyCenterTable th:nth-child(9),
  #monthlyCenterTable td:nth-child(9),
  #monthlyCenterTable th:nth-child(10),
  #monthlyCenterTable td:nth-child(10) {
    width: 64px;
  }

  #reconciliationTable th:nth-child(3),
  #reconciliationTable td:nth-child(3) {
    width: 62px;
  }

  #reconciliationTable th:nth-child(n+4),
  #reconciliationTable td:nth-child(n+4),
  #monthlyCenterTable th:nth-child(n+2),
  #monthlyCenterTable td:nth-child(n+2) {
    width: 48px;
  }

  #monthlyCenterTable th,
  #monthlyCenterTable td {
    padding: 0.28rem 0.14rem;
    font-size: 0.65rem;
  }

  #monthlyCenterTable th:nth-child(1),
  #monthlyCenterTable td:nth-child(1) {
    width: 78px;
  }

  #monthlyCenterTable th:nth-child(8),
  #monthlyCenterTable td:nth-child(8),
  #monthlyCenterTable th:nth-child(9),
  #monthlyCenterTable td:nth-child(9),
  #monthlyCenterTable th:nth-child(10),
  #monthlyCenterTable td:nth-child(10) {
    width: 56px;
  }

  #monthlyCenterTable th:nth-child(2),
  #monthlyCenterTable td:nth-child(2),
  #monthlyCenterTable th:nth-child(3),
  #monthlyCenterTable td:nth-child(3),
  #monthlyCenterTable th:nth-child(4),
  #monthlyCenterTable td:nth-child(4),
  #monthlyCenterTable th:nth-child(5),
  #monthlyCenterTable td:nth-child(5),
  #monthlyCenterTable th:nth-child(6),
  #monthlyCenterTable td:nth-child(6),
  #monthlyCenterTable th:nth-child(7),
  #monthlyCenterTable td:nth-child(7),
  #monthlyCenterTable th:nth-child(11),
  #monthlyCenterTable td:nth-child(11),
  #monthlyCenterTable th:nth-child(12),
  #monthlyCenterTable td:nth-child(12),
  #monthlyCenterTable th:nth-child(13),
  #monthlyCenterTable td:nth-child(13),
  #monthlyCenterTable th:nth-child(14),
  #monthlyCenterTable td:nth-child(14),
  #monthlyCenterTable th:nth-child(15),
  #monthlyCenterTable td:nth-child(15),
  #monthlyCenterTable th:nth-child(16),
  #monthlyCenterTable td:nth-child(16),
  #monthlyCenterTable th:nth-child(17),
  #monthlyCenterTable td:nth-child(17),
  #monthlyCenterTable th:nth-child(18),
  #monthlyCenterTable td:nth-child(18),
  #monthlyCenterTable th:nth-child(19),
  #monthlyCenterTable td:nth-child(19),
  #monthlyCenterTable th:nth-child(20),
  #monthlyCenterTable td:nth-child(20),
  #monthlyCenterTable th:nth-child(21),
  #monthlyCenterTable td:nth-child(21),
  #monthlyCenterTable th:nth-child(22),
  #monthlyCenterTable td:nth-child(22),
  #monthlyCenterTable th:nth-child(23),
  #monthlyCenterTable td:nth-child(23),
  #monthlyCenterTable th:nth-child(24),
  #monthlyCenterTable td:nth-child(24),
  #monthlyCenterTable th:nth-child(25),
  #monthlyCenterTable td:nth-child(25),
  #monthlyCenterTable th:nth-child(26),
  #monthlyCenterTable td:nth-child(26) {
    width: 38px;
  }
}
