:root {
  --bg: #f2ede4;
  --paper: #fffdf8;
  --paper-strong: #fffaf0;
  --ink: #172532;
  --ink-soft: #5d6b77;
  --line: #d9d1c3;
  --navy: #17324f;
  --navy-deep: #0f2236;
  --gold: #b88a35;
  --gold-soft: #efe2bf;
  --danger: #9e4135;
  --shadow: 0 18px 44px rgba(18, 33, 47, 0.12);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Bahnschrift", "Trebuchet MS", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(184, 138, 53, 0.14), transparent 26%),
    linear-gradient(135deg, #f5efe4 0%, #ece4d4 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(23, 50, 79, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 50, 79, 0.03) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.35), transparent 88%);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1320px, calc(100% - 32px));
  margin: 28px auto 36px;
  display: grid;
  gap: 22px;
}

.panel,
.report-sheet,
.entry-row {
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 250, 242, 0.92);
  box-shadow: var(--shadow);
}

.eyebrow,
.section-label {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
}

.page-title,
.panel h2,
.report-title {
  margin: 0;
  font-family: "Georgia", "Palatino Linotype", serif;
  letter-spacing: -0.02em;
}

.page-title {
  font-size: clamp(1.8rem, 3vw, 2.6rem);
}

.header-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.panel {
  padding: 24px;
  border-radius: var(--radius-lg);
}

.panel-heading,
.button-row,
.entry-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.button-row {
  flex-wrap: wrap;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-size: 0.92rem;
  color: var(--ink-soft);
}

.field input,
.field select,
.entry-row input,
.entry-row select {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}

.field input:focus,
.field select:focus,
.entry-row input:focus,
.entry-row select:focus {
  outline: 2px solid rgba(23, 50, 79, 0.18);
  border-color: var(--navy);
}

.primary-button,
.secondary-button,
.icon-button,
.plus-button {
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.primary-button {
  background: var(--navy);
  color: #f8f1e7;
}

.secondary-button {
  background: rgba(23, 50, 79, 0.06);
  color: var(--navy);
  border-color: rgba(23, 50, 79, 0.14);
}

.icon-button {
  background: rgba(158, 65, 53, 0.08);
  color: var(--danger);
  border-color: rgba(158, 65, 53, 0.14);
}

.plus-button {
  min-width: 44px;
  padding: 0;
  background: var(--navy);
  color: #f8f1e7;
  font-size: 1.5rem;
  line-height: 1;
}

.primary-button:hover,
.secondary-button:hover,
.icon-button:hover,
.plus-button:hover {
  transform: translateY(-1px);
}

.entries-table {
  margin-top: 18px;
}

.it-counter {
  margin-top: 18px;
  margin-bottom: 10px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy-deep);
}

.entries-table-head,
.entry-row {
  display: grid;
  grid-template-columns: 48px 170px 190px minmax(380px, 1.9fr) minmax(150px, 0.65fr) 110px 96px 96px;
  gap: 12px;
  align-items: center;
}

.entries-table-head {
  padding: 0 10px 10px;
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 700;
}

.entries-list {
  display: grid;
  gap: 10px;
}

.entry-row {
  padding: 10px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 253, 248, 0.96), rgba(250, 244, 233, 0.92));
}

.entry-row .entry-type,
.entry-row .entry-result,
.entry-row .entry-distance,
.entries-table-head span:nth-child(5),
.entries-table-head span:nth-child(6),
.entries-table-head span:nth-child(7),
.entries-table-head span:nth-child(8) {
  justify-self: stretch;
}

.entry-status,
.helper-text,
.report-note,
.report-subtitle {
  color: var(--ink-soft);
}

.entry-status {
  grid-column: 2 / -1;
  font-size: 0.92rem;
  padding: 0 2px 2px;
}

.entry-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 12px;
  background: rgba(23, 50, 79, 0.08);
  color: var(--navy);
  font-weight: 700;
}

.entry-actions {
  justify-content: flex-start;
}

.entry-actions .icon-button {
  min-height: 40px;
  min-width: 40px;
  width: 40px;
  padding: 0;
  border-radius: 12px;
}

.entry-actions .icon-button svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.report-panel {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.calendar-panel {
  max-width: 420px;
}

.mini-calendar {
  margin-top: 12px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(23, 50, 79, 0.12);
  background: linear-gradient(180deg, rgba(255, 253, 248, 0.96), rgba(248, 243, 232, 0.92));
}

.mini-calendar-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.mini-calendar-head strong {
  color: var(--navy-deep);
  font-size: 1rem;
}

.mini-calendar-head span {
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.mini-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.mini-calendar-grid-weekdays {
  margin-bottom: 8px;
}

.mini-calendar-weekday {
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.mini-calendar-day {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border-radius: 12px;
  border: 1px solid rgba(23, 50, 79, 0.08);
  background: rgba(255, 255, 255, 0.68);
  color: var(--ink);
  font-size: 0.92rem;
}

.mini-calendar-day.is-used {
  background: #dcefd6;
  border-color: rgba(58, 126, 62, 0.25);
  color: #245229;
  font-weight: 700;
}

.mini-calendar-day.is-today {
  outline: 2px solid rgba(23, 50, 79, 0.22);
}

.mini-calendar-day.is-empty {
  background: transparent;
  border-color: transparent;
}

.report-sheet {
  padding: 30px;
  border-radius: var(--radius-lg);
  background: var(--paper-strong);
}

.report-brand {
  width: min(100%, 350px);
  display: block;
  margin: 0 auto 20px;
}

.report-title {
  text-align: left;
  font-size: 16pt;
  color: var(--navy-deep);
}

.report-subtitle {
  margin: 8px 0 20px;
}

.report-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 20px;
  margin-bottom: 20px;
}

.report-meta strong {
  color: var(--navy-deep);
}

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

.report-table {
  width: 100%;
  border-collapse: collapse;
}

.report-table th,
.report-table td {
  border: 1px solid #ccbfa6;
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
  font-size: 10pt;
}

.report-table th {
  background: var(--gold-soft);
  color: var(--navy-deep);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.report-table td:first-child,
.report-table th:first-child {
  text-align: center;
  white-space: nowrap;
}

.report-table th:nth-child(2),
.report-table td:nth-child(2),
.report-table th:nth-child(3),
.report-table td:nth-child(3) {
  white-space: nowrap;
}

.report-table th:nth-child(5),
.report-table td:nth-child(5),
.report-table th:nth-child(6),
.report-table td:nth-child(6),
.report-table th:nth-child(7),
.report-table td:nth-child(7) {
  text-align: center;
}

.report-table td:nth-child(4) {
  text-align: justify;
}

.empty-cell {
  color: var(--ink-soft);
  padding: 18px;
}

@media (max-width: 980px) {
  .header-grid,
  .report-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: min(100% - 20px, 100%);
    margin: 10px auto 24px;
  }

  .panel,
  .report-sheet,
  .entry-row {
    padding: 18px;
    border-radius: 22px;
  }

  .panel-heading,
  .button-row,
  .entry-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .header-grid,
  .entries-table-head,
  .entry-row,
  .report-meta {
    grid-template-columns: 1fr;
  }

  .entries-table-head {
    display: none;
  }

  .entry-actions .icon-button {
    width: 100%;
  }

  .entry-status {
    grid-column: auto;
  }
}

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

  body {
    background: white;
  }

  body::before,
  .app-shell > .panel:first-child,
  .app-shell > .panel:nth-child(2),
  .calendar-panel,
  .report-panel > .panel-heading {
    display: none !important;
  }

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

  .report-panel {
    padding: 0;
    margin: 0;
  }

  .report-sheet {
    box-shadow: none;
    border: 0;
    padding: 0;
    background: white;
    break-inside: avoid;
  }

  .report-brand {
    margin-top: 0;
  }
}
