:root {
  --ink: #172126;
  --muted: #617079;
  --line: #d9e0e3;
  --paper: #ffffff;
  --soft: #f3f6f7;
  --brand: #0e6f63;
  --brand-dark: #064c44;
  --accent: #b99447;
  --danger: #9f2d2d;
  --ok: #0f6d3c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: #eef2f3;
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: 24px;
}

.workspace {
  width: min(1120px, 100%);
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 42px);
  letter-spacing: 0;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 700;
}

.button.primary {
  border-color: var(--brand-dark);
  color: #fff;
  background: var(--brand);
}

.button.subtle {
  color: var(--ink);
  background: var(--paper);
}

.notice {
  display: none;
  margin-bottom: 14px;
  border: 1px solid #b8d8c6;
  border-radius: 8px;
  padding: 12px 14px;
  color: #0d4f30;
  background: #e8f7ef;
  font-size: 15px;
  font-weight: 800;
}

.notice.is-visible {
  display: block;
}

.notice.is-error {
  border-color: #e0b7b7;
  color: #842323;
  background: #fdecec;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--paper);
}

.grid-meta,
.days-grid,
.previous-grid,
.summary-strip {
  display: grid;
  gap: 14px;
}

.grid-meta {
  grid-template-columns: 1.8fr .7fr .7fr;
  margin-bottom: 14px;
}

.days-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 14px;
}

.previous-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid #cbd5d9;
  border-radius: 6px;
  padding: 9px 11px;
  color: var(--ink);
  background: #fff;
  font-size: 18px;
  font-weight: 700;
}

input:focus,
select:focus {
  outline: 3px solid rgba(14, 111, 99, .18);
  border-color: var(--brand);
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
}

.panel-title strong,
.stat strong,
.summary-strip strong {
  font-size: 30px;
}

.stat {
  min-height: 74px;
  display: grid;
  align-content: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: var(--soft);
}

.stat span,
.summary-strip span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.history-list {
  display: grid;
  gap: 8px;
}

.history-list p,
.status-line {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.history-row {
  display: grid;
  grid-template-columns: .6fr repeat(3, 1fr);
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: var(--soft);
  font-size: 15px;
}

.history-row strong {
  color: var(--ink);
}

.status-line {
  margin-top: 12px;
  font-weight: 700;
}

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

.summary-strip {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 14px;
}

.summary-strip > div {
  min-height: 106px;
  display: grid;
  align-content: center;
  gap: 5px;
  border-radius: 8px;
  padding: 16px;
  color: #fff;
  background: var(--brand-dark);
}

.summary-strip > div:nth-child(2) {
  background: #32444b;
}

.summary-strip > div:nth-child(3) {
  background: #7a5a17;
}

.summary-strip small {
  font-size: 16px;
  font-weight: 700;
}

.negative {
  color: var(--danger) !important;
}

.positive {
  color: var(--ok) !important;
}

.summary-strip .negative,
.summary-strip .positive {
  color: #fff !important;
}

.print-page {
  display: none;
}

.general-report-page {
  display: none;
}

.general-report {
  color: #000;
  background: #fff;
  font-family: Arial, Helvetica, sans-serif;
}

.general-report-header {
  display: grid;
  grid-template-columns: 34mm 1fr;
  gap: 10mm;
  align-items: center;
  border-bottom: 2px solid #000;
  padding-bottom: 5mm;
  margin-bottom: 5mm;
}

.general-report-header img {
  width: 34mm;
  filter: brightness(0) contrast(8);
}

.general-report-header h2 {
  margin: 0 0 1mm;
  font-size: 22px;
  text-transform: uppercase;
}

.general-report-header p {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  text-transform: uppercase;
}

.general-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
}

.general-table th,
.general-table td {
  border: 1px solid #000;
  padding: 2mm;
  text-align: center;
  vertical-align: middle;
}

.general-table th {
  background: #f7f7f7;
  font-weight: 800;
}

.general-table td:nth-child(4) {
  text-align: left;
}

.ticket-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, minmax(0, 1fr));
  width: 100%;
  height: 100%;
  background: #fff;
}

.ticket {
  display: grid;
  align-content: start;
  min-height: 0;
  overflow: hidden;
  border: 1px solid #000;
  color: #000;
  background: #fff;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 10.5px;
  line-height: 1.14;
  text-align: center;
}

.ticket * {
  min-width: 0;
}

.ticket-header {
  position: relative;
  min-height: 16mm;
  display: grid;
  place-items: center;
  padding: 1mm 2mm .4mm;
}

.ticket-header img {
  width: 36mm;
  max-height: 15mm;
  object-fit: contain;
  opacity: 1;
  filter: brightness(0) contrast(8);
}

.ticket-title {
  margin: 0;
  border-top: 1px solid #000;
  border-bottom: 1px solid #000;
  padding: 1mm 1.5mm;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.ticket-part,
.ticket-total,
.ticket-history {
  border-bottom: 1px solid #000;
  padding: .8mm 1.5mm;
}

.ticket-part h3,
.ticket-history h3 {
  margin: 0 0 .7mm;
  font-size: 11.5px;
  line-height: 1;
}

.ticket p {
  margin: 0;
}

.ticket-counts,
.ticket-total p:first-child {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 1.2mm;
  font-size: 11.5px;
  white-space: nowrap;
}

.ticket-counts span,
.ticket-total span,
.ticket-part > p:not(.ticket-counts) span {
  min-width: 8mm;
  display: inline-block;
  border-bottom: 1.5px solid #000;
  font-size: 12.5px;
  font-weight: 900;
  line-height: 1;
}

.ticket-part small {
  display: block;
  margin-top: .6mm;
  font-size: 8.5px;
}

.ticket-name {
  min-height: 3.4mm;
  overflow: hidden;
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ticket-total {
  font-size: 10px;
  font-weight: 800;
}

.ticket-total p + p {
  margin-top: .5mm;
}

.ticket-total p + p span {
  min-width: 14mm;
  font-size: 12px;
}

.ticket-history {
  border-bottom: 0;
  font-size: 9.6px;
  line-height: 1.05;
}

.ticket-history h3 {
  font-size: 10px;
  margin-bottom: .6mm;
}

.ticket-history p {
  white-space: nowrap;
}

.ticket-history div {
  display: grid;
  gap: .25mm;
}

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

  .topbar,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .button {
    width: 100%;
  }

  .grid-meta,
  .days-grid,
  .previous-grid,
  .summary-strip,
  .form-grid {
    grid-template-columns: 1fr;
  }
}

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

  body {
    background: #fff;
  }

  .app-shell {
    display: none !important;
  }

  .print-page {
    display: block;
    width: 285mm;
    height: 196mm;
    margin: 0 auto;
  }

  body.general-report-mode .print-page {
    display: none;
  }

  body.general-report-mode .general-report-page {
    display: block;
  }

  body.general-report-mode .general-report {
    width: 285mm;
    margin: 0 auto;
  }

  .ticket {
    height: 98mm;
    break-inside: avoid;
    page-break-inside: avoid;
  }
}
