:root {
  --ink: #15181c;
  --muted: #68727f;
  --paper: #f7f9fb;
  --panel: #ffffff;
  --line: #dfe6ee;
  --line-strong: #c5d0dc;
  --accent: #0a7568;
  --accent-dark: #075a51;
  --blue: #2f66b1;
  --red: #b6452c;
  --green-soft: #e7f5f1;
  --blue-soft: #edf4ff;
  --red-soft: #fff0ec;
  --shadow: 0 18px 44px rgba(24, 35, 48, 0.09);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, #f6f9fc 0, #ffffff 430px),
    #fff;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 12px clamp(16px, 4vw, 42px);
  border-bottom: 1px solid rgba(223, 230, 238, 0.9);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  color: var(--ink);
  font-weight: 780;
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 7px;
  color: #fff;
  background: var(--ink);
  font-size: 12px;
}

.top-nav {
  display: flex;
  justify-content: center;
  gap: 4px;
}

.top-nav a {
  min-height: 38px;
  border-radius: 7px;
  padding: 9px 12px;
  color: var(--muted);
  text-decoration: none;
}

.top-nav a:hover {
  color: var(--ink);
  background: var(--paper);
}

.lang-switch {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.lang-button {
  min-width: 48px;
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.lang-button.active {
  color: #fff;
  background: var(--ink);
}

main {
  display: grid;
  gap: 40px;
  padding-bottom: 76px;
}

.hero,
.rule-band,
.guide-band,
.faq-band {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.hero {
  padding-top: 28px;
}

.hero-copy {
  display: grid;
  gap: 10px;
  max-width: 820px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 12px;
  font-weight: 780;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.08;
  letter-spacing: 0;
}

h1 {
  max-width: 100%;
  font-size: clamp(34px, 3.8vw, 50px);
}

h2 {
  font-size: clamp(22px, 2.3vw, 30px);
}

h3 {
  font-size: 17px;
}

.timeline-head h3 {
  font-size: 18px;
  line-height: 1.12;
}

.lede,
.section-head p,
.result-note,
.disclaimer {
  color: var(--muted);
  line-height: 1.62;
}

.lede {
  max-width: 720px;
  margin: 0;
  font-size: 18px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 18px;
  align-items: start;
}

.calculator-panel,
.result-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
}

.calculator-panel {
  display: grid;
  gap: 18px;
  padding: clamp(16px, 2.4vw, 26px);
}

.result-panel {
  position: sticky;
  top: 82px;
  display: grid;
  gap: 14px;
  padding: 18px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.panel-head div {
  display: grid;
  gap: 8px;
}

.compact {
  margin-bottom: 12px;
}

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

.empty-state {
  margin: 0;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  padding: 14px;
  color: var(--muted);
  background: #fbfcfe;
  line-height: 1.45;
}

.trip-row {
  display: grid;
  grid-template-columns: 1fr 1fr 42px;
  gap: 10px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfe;
}

.date-parts {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(86px, 0.7fr);
  gap: 8px;
}

.trip-row.has-error {
  border-color: var(--red);
  background: var(--red-soft);
}

.field-error {
  grid-column: 1 / -1;
  margin: -2px 0 0;
  color: var(--red);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.timeline-builder {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.timeline-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.timeline-head div {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.timeline-help {
  margin: 0;
  min-height: 68px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.mobile-current-month {
  display: none;
}

.month-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding: 6px 2px 12px;
  scrollbar-width: thin;
}

.range-nav {
  border: 1px dashed var(--line-strong);
  color: var(--accent-dark);
  background: var(--green-soft);
}

.month-group {
  display: grid;
  gap: 7px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 7px;
  background: #fbfcfe;
}

.month-label {
  display: inline-block;
  justify-self: start;
  align-self: start;
  border-radius: 999px;
  padding: 3px 7px;
  color: var(--accent-dark);
  background: var(--green-soft);
  font-size: 11px;
  font-weight: 780;
  line-height: 1.2;
}

.weekday-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
}

.weekday-row span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 760;
  text-align: center;
}

.month-days {
  display: grid;
  grid-template-columns: repeat(7, 24px);
  grid-auto-rows: 30px;
  gap: 5px;
  justify-content: start;
}

.day-spacer {
  width: 24px;
  height: 30px;
  min-height: 0;
}

.day-dot {
  display: grid;
  place-items: center;
  justify-self: center;
  width: 24px;
  height: 30px;
  gap: 2px;
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  color: var(--muted);
  background: #fbfcfe;
  cursor: pointer;
  line-height: 1;
}

.day-dot span {
  font-size: 11px;
  font-weight: 760;
}

.day-dot small {
  color: var(--muted);
  font-size: 10px;
}

.day-dot.used {
  border-color: #9bd2c5;
  color: var(--accent-dark);
  background: var(--green-soft);
}

.day-dot:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--green-soft);
  box-shadow: 0 8px 18px rgba(10, 117, 104, 0.12);
  transform: translateY(-1px);
}

.day-dot:disabled {
  cursor: not-allowed;
}

.day-dot.pending {
  border-color: var(--blue);
  color: #fff;
  background: var(--blue);
}

.day-dot.today {
  border-color: var(--ink);
}

.is-disabled {
  cursor: default;
  opacity: 0.45;
}

label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 720;
}

input,
select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
}

input:hover,
select:hover {
  border-color: var(--accent);
  background: #fbfffd;
}

.date-parts select:hover:not(:disabled),
.date-parts select:focus {
  border-color: var(--accent);
  background: var(--green-soft);
  box-shadow: 0 8px 22px rgba(10, 117, 104, 0.12);
}

.date-parts select:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgba(10, 117, 104, 0.16);
  outline-offset: 2px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.next-trip {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button {
  min-height: 44px;
  border-radius: 8px;
  cursor: pointer;
}

.primary-button {
  border: 1px solid var(--accent);
  padding: 10px 15px;
  color: #fff;
  background: var(--accent);
}

.primary-button:hover {
  background: var(--accent-dark);
}

.secondary-button {
  border: 1px solid var(--line-strong);
  padding: 10px 15px;
  color: var(--ink);
  background: #fff;
}

.secondary-button:hover,
.ghost-button:hover {
  border-color: var(--ink);
}

.ghost-button {
  border: 1px solid transparent;
  padding: 10px 12px;
  color: var(--muted);
  background: transparent;
}

.icon-button {
  width: 42px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: #fff;
  font-size: 22px;
}

.full-width {
  width: 100%;
}

.status-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--blue-soft);
}

.status-card.safe {
  border-color: #b7dfd5;
  background: var(--green-soft);
}

.status-card.risky {
  border-color: #f0c3b7;
  background: var(--red-soft);
}

.status-card span,
.metric-grid span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 720;
}

.status-card strong {
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1;
}

.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.metric-grid div {
  display: grid;
  gap: 6px;
  min-height: 82px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.metric-grid strong {
  font-size: 24px;
}

.result-note,
.action-status,
.disclaimer {
  margin: 0;
  font-size: 14px;
}

.action-status {
  min-height: 20px;
  color: var(--accent);
}

.section-head {
  display: grid;
  gap: 8px;
  max-width: 760px;
  margin-bottom: 18px;
}

.rule-band {
  padding-bottom: 30px;
}

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

.source-grid a {
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  color: var(--ink);
  background: #fff;
  text-decoration: none;
}

.source-grid a:hover {
  border-color: var(--accent);
}

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

.guide-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.guide-grid h3 {
  font-size: 17px;
  line-height: 1.2;
}

.guide-grid p,
.guide-grid li {
  color: var(--muted);
  line-height: 1.58;
}

.guide-grid p {
  margin: 10px 0 0;
}

.guide-grid ul {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding-left: 20px;
}

.updated-note {
  color: var(--accent-dark) !important;
  font-weight: 760;
}

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

.faq-grid details {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.faq-grid summary {
  color: var(--ink);
  cursor: pointer;
  font-weight: 780;
  line-height: 1.35;
}

.faq-grid p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.mobile-result-bar {
  position: fixed;
  right: 12px;
  bottom: 12px;
  left: 12px;
  z-index: 30;
  display: none;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: rgba(21, 24, 28, 0.94);
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(120%);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.mobile-result-bar.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.mobile-result-bar a {
  color: #fff;
  font-weight: 720;
}

@media (max-width: 980px) {
  .app-header {
    grid-template-columns: 1fr auto;
  }

  .top-nav {
    grid-column: 1 / -1;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .result-panel {
    position: static;
  }

  .actions {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 680px) {
  main {
    padding-bottom: 122px;
  }

  main {
    gap: 30px;
  }

  .app-header {
    position: static;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 10px 12px;
    gap: 10px;
  }

  .brand {
    min-width: 0;
  }

  .top-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .lang-switch {
    justify-self: end;
  }

  .hero,
  .rule-band,
  .guide-band,
  .faq-band {
    width: min(100% - 24px, 1180px);
  }

  .hero {
    padding-top: 18px;
  }

  .lede {
    font-size: 16px;
  }

  .calculator-panel,
  .result-panel {
    padding: 14px;
  }

  .timeline-head h3 {
    font-size: 16px;
  }

  .panel-head {
    display: grid;
  }

  .trip-row,
  .form-grid,
  .actions,
  .source-grid,
  .guide-grid,
  .faq-grid {
    grid-template-columns: 1fr;
  }

  .month-strip {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    scroll-snap-type: x mandatory;
  }

  .mobile-current-month {
    display: none;
  }

  .mobile-month .month-label {
    display: inline-block;
  }

  .range-nav {
    flex: 0 0 auto;
  }

  .mobile-month {
    flex: 0 0 100%;
    width: 100%;
    min-width: 0;
    align-content: start;
    scroll-snap-align: center;
  }

  .month-days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    grid-auto-rows: 42px;
    gap: 6px;
    justify-content: stretch;
  }

  .day-dot {
    justify-self: auto;
    width: 100%;
    min-width: 0;
    height: 42px;
    min-height: 42px;
    border-radius: 7px;
  }

  .day-spacer {
    width: 100%;
    height: 42px;
    min-height: 0;
  }

  .mobile-month .range-nav {
    height: 42px;
    min-height: 42px;
  }

  .day-dot span {
    font-size: 13px;
  }

  .metric-grid {
    grid-template-columns: 1fr 1fr;
  }

  .primary-button,
  .secondary-button,
  .ghost-button {
    width: 100%;
  }

  .icon-button {
    justify-self: end;
    width: 46px;
  }

  .mobile-result-bar {
    display: flex;
  }
}

.range-nav span {
  font-size: 10px;
}

@media print {
  .app-header,
  .calculator-panel,
  .source-grid,
  .mobile-result-bar,
  .actions,
  .primary-button {
    display: none !important;
  }

  body {
    background: #fff;
  }

  main,
  .hero,
  .rule-band,
  .guide-band,
  .faq-band {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
  }

  .workspace {
    display: block;
  }

  .result-panel {
    break-inside: avoid;
    box-shadow: none;
    margin-bottom: 12px;
  }
}
