:root {
  --bg: #f6f3eb;
  --surface: transparent;
  --surface-strong: transparent;
  --line: rgba(60, 71, 77, 0.14);
  --ink: #18212a;
  --muted: #53626a;
  --accent: #0d6c74;
  --accent-strong: #0a5056;
  --accent-soft: #d7ece8;
  --warn: #9f5e00;
  --weekend: #d96f1d;
  --calendar-high: #6abfe9;
  --calendar-morning: rgba(191, 226, 233, 0.72);
  --calendar-afternoon: rgba(246, 241, 223, 0.84);
  --calendar-evening: rgba(95, 104, 114, 0.18);
  --shadow: 0 18px 40px rgba(24, 33, 42, 0.09);
  --radius-xl: 28px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Manrope", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  background: var(--bg);
}

body::before {
  content: none;
}

.page-shell {
  width: min(1600px, calc(100% - 20px));
  margin: 0 auto;
  padding: 10px 0 28px;
}

.hero {
  padding: 0 0 8px;
}

.eyebrow,
.kicker {
  margin: 0 0 10px;
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card-head h2 {
  margin: 0;
  font-family: var(--font-display);
  line-height: 1.02;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(24, 33, 42, 0.08);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.version-line {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.layout {
  display: grid;
  gap: 12px;
  margin-top: 4px;
}

.card {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.summary-card,
.visual-card {
  padding: 0;
}

.controls-card,
.table-card {
  display: none;
}

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

.card-head h2 {
  font-size: 1.05rem;
}

.text-link {
  color: var(--accent);
  font-weight: 700;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.calendar-tools {
  display: flex;
  align-items: end;
  gap: 12px;
  margin-bottom: 10px;
}

.today-button {
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  min-height: 42px;
  padding: 0 12px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 0;
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
  line-height: 1;
  flex: 0 0 auto;
}

.calendar-jump {
  display: grid;
  flex: 1 1 auto;
  gap: 6px;
  min-width: 190px;
}

.calendar-jump span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.calendar-position-line {
  margin: 0;
  color: rgba(24, 33, 42, 0.76);
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.3;
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

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

.field-wide {
  grid-column: 1 / -1;
}

.field span {
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.field small {
  color: var(--muted);
  line-height: 1.5;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
}

input:focus,
select:focus,
button:focus {
  outline: 2px solid rgba(13, 108, 116, 0.22);
  outline-offset: 2px;
}

.secret-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.ghost-button,
.secondary-button,
.primary-button {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 0;
  border: 1px solid transparent;
  font-weight: 800;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

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

.ghost-button {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
}

.primary-button {
  background: #dbe6e4;
  color: var(--ink);
  box-shadow: none;
}

.secondary-button {
  border-color: var(--line);
  background: transparent;
  color: var(--ink);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

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

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid rgba(24, 33, 42, 0.08);
}

.status-message {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.status-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 0;
}

.summary-card {
  display: none;
}

.summary-grid div {
  padding: 16px;
  border: 1px solid rgba(24, 33, 42, 0.08);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.58);
}

.summary-grid dt {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.summary-grid dd {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}

.empty-state {
  padding: 34px 18px;
  text-align: center;
  border: 1px dashed rgba(24, 33, 42, 0.14);
  border-radius: var(--radius-lg);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.44);
}

.empty-state h3 {
  margin: 0 0 8px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.5rem;
}

.empty-state p {
  margin: 0;
  line-height: 1.6;
}

.calendar-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  overscroll-behavior-x: contain;
  touch-action: pan-x pinch-zoom;
  cursor: grab;
  border: 0;
  border-radius: 0;
  background: transparent;
  scrollbar-width: none;
}

.calendar-wrap::-webkit-scrollbar {
  display: none;
}

.calendar-graphic {
  min-height: var(--calendar-total-height, 620px);
  padding: 4px 0 0;
}

.calendar-svg {
  display: block;
}

.calendar-panel {
  display: grid;
  gap: 10px;
}

.calendar-panel.is-hidden {
  display: none;
}

.calendar-stage {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  align-items: start;
  gap: 0;
}

.calendar-axis {
  display: grid;
  align-content: start;
  min-height: var(--calendar-total-height, 620px);
  padding-top: var(--calendar-label-top, 150px);
  font-size: 0.78rem;
  color: rgba(24, 33, 42, 0.82);
  user-select: none;
  background: rgba(255, 255, 255, 0.5);
}

.calendar-axis-left {
  text-align: right;
}

.calendar-axis-right {
  text-align: left;
}

.calendar-axis-label {
  position: relative;
  height: var(--calendar-hour-height, 45px);
  line-height: 1;
}

.calendar-axis-label span {
  position: absolute;
  top: -6px;
}

.calendar-axis-left .calendar-axis-label span {
  right: 4px;
}

.calendar-axis-right .calendar-axis-label span {
  left: 4px;
}

.calendar-scroller {
  padding: 0 42px;
  background: rgba(255, 255, 255, 0.52);
}

.calendar-range {
  display: block;
  width: 100%;
  min-height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  accent-color: rgba(24, 33, 42, 0.6);
}

.calendar-range::-webkit-slider-runnable-track {
  height: 20px;
  border: 1px solid rgba(24, 33, 42, 0.12);
  background: rgba(24, 33, 42, 0.14);
}

.calendar-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 84px;
  height: 20px;
  margin-top: 0;
  border: 1px solid rgba(24, 33, 42, 0.16);
  background: rgba(24, 33, 42, 0.34);
}

.calendar-range::-moz-range-track {
  height: 20px;
  border: 1px solid rgba(24, 33, 42, 0.12);
  background: rgba(24, 33, 42, 0.14);
}

.calendar-range::-moz-range-thumb {
  width: 84px;
  height: 20px;
  border: 1px solid rgba(24, 33, 42, 0.16);
  border-radius: 0;
  background: rgba(24, 33, 42, 0.34);
}

@media (hover: none) and (pointer: coarse) {
  .calendar-wrap {
    cursor: auto;
  }

  .calendar-scroller {
    display: none;
  }
}

.table-wrap {
  overflow: auto;
  max-height: 72vh;
  border: 1px solid rgba(24, 33, 42, 0.08);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.72);
}

.table-wrap.is-hidden {
  display: none;
}

.tide-table {
  width: 100%;
  min-width: 960px;
  border-collapse: separate;
  border-spacing: 0;
}

.tide-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 14px 12px;
  border-bottom: 1px solid rgba(24, 33, 42, 0.12);
  background: #edf5f4;
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.tide-table th:first-child,
.tide-table td:first-child {
  min-width: 130px;
}

.tide-table th:nth-child(2),
.tide-table td:nth-child(2) {
  min-width: 76px;
}

.tide-table td {
  padding: 12px;
  border-bottom: 1px solid rgba(24, 33, 42, 0.08);
  white-space: nowrap;
  font-size: 0.94rem;
}

.tide-table tbody tr:nth-child(even) td {
  background: rgba(13, 108, 116, 0.025);
}

.tide-table tbody tr:hover td {
  background: rgba(13, 108, 116, 0.08);
}

.tide-table th:first-child,
.tide-table td:first-child,
.tide-table th:nth-child(2),
.tide-table td:nth-child(2) {
  position: sticky;
  left: 0;
  z-index: 1;
}

.tide-table th:nth-child(2),
.tide-table td:nth-child(2) {
  left: 130px;
}

.tide-table td:first-child,
.tide-table td:nth-child(2) {
  background: #fffdf6;
  font-weight: 800;
}

.tide-table thead th:first-child,
.tide-table thead th:nth-child(2) {
  z-index: 3;
}

.type-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 60px;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.76rem;
  font-weight: 800;
}

.notes-cell {
  color: var(--muted);
}

@media (max-width: 1040px) {
  .controls-grid,
  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 20px, 1400px);
    padding-top: 8px;
  }

  .controls-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }

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

  .actions {
    flex-direction: column;
  }

  .calendar-graphic {
    min-height: var(--calendar-total-height, 760px);
    padding: 4px 0 0;
  }

  .calendar-stage {
    grid-template-columns: 40px minmax(0, 1fr) 40px;
  }

  .calendar-axis {
    min-height: var(--calendar-total-height, 760px);
    padding-top: var(--calendar-label-top, 156px);
    font-size: 0.72rem;
  }

  .calendar-scroller {
    padding: 0 40px;
  }

  .calendar-tools {
    align-items: end;
    flex-direction: row;
    gap: 10px;
  }

  .calendar-jump {
    min-width: 0;
  }

  .calendar-position-line {
    font-size: 0.78rem;
  }

  .tide-table {
    min-width: 780px;
  }

  .tide-table th:first-child,
  .tide-table td:first-child,
  .tide-table th:nth-child(2),
  .tide-table td:nth-child(2) {
    position: static;
  }
}
