:root {
  color-scheme: light;
  --bg: #f7faf7;
  --ink: #18201d;
  --muted: #5f6f68;
  --line: #d9e5de;
  --panel: #ffffff;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --warn: #9a3412;
  --shadow: 0 16px 50px rgba(18, 32, 29, 0.12);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.13), transparent 320px),
    var(--bg);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

.sticky-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(247, 250, 247, 0.95);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: calc(14px + env(safe-area-inset-top)) 18px 14px;
  border-bottom: 1px solid var(--line);
}

.topbar-brand {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-grow: 1;
}

.topbar-status-group {
  display: flex;
  gap: 6px;
  align-items: center;
}

.topbar-time-control {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #eef3f0;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.toggle-switch.compact {
  font-size: 12px;
  font-weight: 700;
  gap: 4px;
}

.toggle-switch.compact input {
  width: 14px;
  height: 14px;
}

.custom-time-inputs.compact {
  display: flex;
  gap: 6px;
  align-items: center;
}

.custom-time-inputs.compact input {
  padding: 4px 6px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-family: inherit;
}

.custom-time-inputs.compact input[type="text"] {
  width: 150px;
}

.topbar h1,
.hero h2,
section h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: 22px;
}

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

.status,
.offline-pill {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--muted);
  background: var(--panel);
  font-size: 13px;
  white-space: nowrap;
}

.status.online {
  color: var(--accent-strong);
  border-color: rgba(15, 118, 110, 0.35);
}

.status.offline {
  color: var(--warn);
  border-color: rgba(154, 52, 18, 0.35);
}

.app-shell {
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 18px 16px 44px;
}

.view-nav {
  display: flex;
  gap: 8px;
  padding: 10px 18px;
}

.view-nav a {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--muted);
  background: #fff;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.view-nav a.active {
  border-color: rgba(15, 118, 110, 0.55);
  color: #fff;
  background: var(--accent);
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  min-height: 210px;
  margin: 8px 0 18px;
  padding: 24px;
  border-radius: 8px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(10, 48, 45, 0.78), rgba(10, 48, 45, 0.25)),
    url("./landscape.svg") center/cover;
  box-shadow: var(--shadow);
}

.hero .eyebrow {
  color: #b8fff2;
}

.hero h2 {
  font-size: clamp(28px, 6vw, 48px);
}

.hero p:last-child {
  max-width: 680px;
  margin: 8px 0 0;
  line-height: 1.55;
}

.hero .offline-pill {
  color: #f3fffc;
  background: rgba(0, 0, 0, 0.28);
  border-color: rgba(255, 255, 255, 0.35);
}

.calendar-hero {
  min-height: 190px;
}

.role-panel,
.tools,
.timeline article,
.grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
}

.role-panel {
  display: grid;
  gap: 14px;
  margin: 0 0 14px;
  padding: 14px;
}

.role-panel h2 {
  font-size: 19px;
}

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

.segmented button {
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  color: var(--ink);
  background: #f8fbf9;
  text-align: left;
}

.segmented button.active {
  border-color: rgba(15, 118, 110, 0.7);
  color: #fff;
  background: var(--accent);
}

.segmented span,
.segmented small {
  display: block;
}

.segmented span {
  font-weight: 800;
}

.segmented small {
  margin-top: 3px;
  color: var(--muted);
}

.segmented button.active small {
  color: rgba(255, 255, 255, 0.82);
}

.tools {
  display: grid;
  gap: 8px;
  margin: 0 0 22px;
  padding: 14px;
}

.tools label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.tools input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 13px;
  background: #fff;
  color: var(--ink);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
}

.section-title button {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  color: #fff;
  background: var(--accent);
}

.timeline,
.grid {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

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

article {
  padding: 15px;
}

.timeline article {
  display: grid;
  grid-template-columns: minmax(92px, 0.28fr) minmax(0, 1fr);
  gap: 14px;
}

.date-rail {
  border-right: 1px solid var(--line);
  padding-right: 12px;
}

.date-rail strong,
.date-rail span,
.date-rail em,
.event-kicker {
  display: block;
}

.date-rail strong {
  color: var(--accent-strong);
  font-size: 14px;
}

.date-rail span,
.date-rail em,
.event-kicker {
  color: var(--muted);
  font-size: 13px;
}

.date-rail em {
  margin-top: 6px;
  color: var(--accent-strong);
  font-style: normal;
  font-weight: 700;
}

.event-kicker {
  margin: 0 0 5px;
  font-weight: 700;
}

article h3 {
  margin: 0 0 7px;
  font-size: 18px;
  letter-spacing: 0;
}

article p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.movement-list {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.movement-list li {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.movement-button {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px;
  color: var(--ink);
  background: #f8fbf9;
  text-align: left;
}

.movement-button.compact {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.movement-button time {
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
}

.movement-button strong {
  display: block;
  margin-bottom: 3px;
  font-size: 14px;
}

.movement-button small {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.movement-button em,
.lodging-button em {
  justify-self: end;
  color: var(--accent-strong);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  white-space: nowrap;
}

.movement-button em::after,
.lodging-button em::after {
  content: "⌄";
  display: inline-block;
  margin-left: 6px;
  transition: transform 0.18s ease;
}

.movement-button[aria-expanded="true"],
.lodging-button[aria-expanded="true"] {
  border-color: rgba(15, 118, 110, 0.48);
  background: #e8f4f1;
}

.movement-button[aria-expanded="true"] em::after,
.lodging-button[aria-expanded="true"] em::after {
  transform: rotate(180deg);
}

.movement-detail {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.movement-detail.compact {
  padding: 10px;
}

.movement-detail p {
  margin: 0 0 10px;
}

.movement-detail dl {
  display: grid;
  gap: 9px;
  margin: 0;
}

.movement-detail div {
  display: grid;
  gap: 3px;
}

.movement-detail dt {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
}

.movement-detail dd {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.document-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.document-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(15, 118, 110, 0.28);
  border-radius: 8px;
  padding: 7px 9px;
  color: var(--accent-strong);
  background: #fff;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.document-links span {
  border-radius: 6px;
  padding: 2px 5px;
  color: #fff;
  background: var(--accent);
  font-size: 11px;
}

.document-links.compact a {
  padding: 5px 7px;
  font-size: 12px;
}

.lodging,
.lodging-empty {
  margin-top: 14px;
}

.lodging-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  width: 100%;
  min-height: 54px;
  border: 1px solid rgba(15, 118, 110, 0.28);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: #eef8f5;
  text-align: left;
}

.lodging-button.compact {
  min-height: 46px;
  padding: 8px 10px;
}

.lodging-button.compact strong {
  font-size: 14px;
}

.lodging-button span {
  grid-column: 1;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
}

.lodging-button strong {
  grid-column: 1;
  margin-top: 2px;
  line-height: 1.35;
}

.stay-badges {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.stay-badges span {
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--accent-strong);
  background: #d8eee8;
  font-size: 12px;
  font-weight: 800;
}

.stay-badges.compact {
  margin-top: 6px;
}

.stay-badges.compact span {
  padding: 3px 7px;
  font-size: 11px;
}

.lodging-detail {
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 8px 8px;
  padding: 12px;
  background: #fff;
}

.lodging-detail dl {
  display: grid;
  gap: 10px;
  margin: 0;
}

.lodging-detail div {
  display: grid;
  gap: 3px;
}

.lodging-detail dt {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
}

.lodging-detail dd {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.lodging-detail a {
  color: var(--accent-strong);
  font-weight: 800;
}

.lodging-empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--muted);
  background: #fff;
}

.notes {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  border-left: 3px solid var(--line);
  padding-left: 10px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.meta span {
  border-radius: 999px;
  padding: 5px 9px;
  background: #e8f4f1;
  color: var(--accent-strong);
  font-size: 13px;
}

.empty {
  padding: 18px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.calendar-list {
  display: grid;
  gap: 26px;
  margin-top: 14px;
}

.calendar-month h2 {
  margin: 0 0 12px;
  letter-spacing: 0;
}

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

.calendar-day {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  min-height: 190px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
}

.calendar-date {
  display: grid;
  align-content: start;
  justify-items: center;
  border-right: 1px solid var(--line);
  padding-top: 12px;
}

.calendar-date strong {
  color: var(--accent-strong);
  font-size: 24px;
  line-height: 1;
}

.calendar-date span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.calendar-day-body h3 {
  margin: 0 0 6px;
  font-size: 16px;
  letter-spacing: 0;
}

.calendar-day-body p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.calendar-movements {
  display: grid;
  gap: 5px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.calendar-movements li {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.calendar-movements time {
  margin-right: 6px;
  color: var(--accent-strong);
  font-weight: 800;
}

.calendar-lodging {
  margin-top: 10px;
}

.calendar-lodging.muted {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  color: var(--muted);
  background: #fff;
  font-size: 13px;
}

@media (max-width: 640px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  }

  .topbar-brand {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
  }

  .topbar-time-control {
    width: 100%;
    justify-content: space-between;
    box-sizing: border-box;
    flex-wrap: wrap;
    gap: 8px;
  }

  .custom-time-inputs.compact {
    width: 100%;
    justify-content: space-between;
  }

  .custom-time-inputs.compact input {
    flex-grow: 1;
    min-width: 0;
  }

  .custom-time-inputs.compact input[type="text"] {
    width: 120px;
    flex-grow: 0;
  }

  .view-nav {
    padding: 8px 14px;
  }

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

  .hero {
    display: grid;
    min-height: 250px;
    padding: 20px;
  }

  .section-title {
    align-items: stretch;
    flex-direction: column;
  }

  .timeline article {
    grid-template-columns: 1fr;
  }

  .date-rail {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 0 0 10px;
  }

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

  .calendar-day {
    min-height: 0;
  }

  .movement-button {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 8px;
  }

  .movement-button time {
    grid-column: 1 / -1;
  }

  .movement-button span {
    grid-column: 1;
    min-width: 0;
  }

  .movement-button em {
    grid-column: 2;
    align-self: end;
  }

  .movement-button.compact {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

/* Time Simulation Panel & Highlights */
.time-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  display: grid;
  gap: 14px;
  margin: 0 0 14px;
  padding: 14px;
}

.time-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.current-time-display {
  font-size: 13px;
  font-weight: 800;
  color: var(--accent-strong);
  background: #e8f4f1;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid rgba(15, 118, 110, 0.2);
}

.time-control-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}

.toggle-switch input {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--accent);
  margin: 0;
}

.custom-time-inputs input {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
}

/* Highlight Items */
.timeline article .movement-list li.is-now {
  border-top-color: var(--accent);
}

.timeline article .movement-list li.is-now .movement-button {
  border-color: rgba(15, 118, 110, 0.55);
  background: #e6f7f4;
  box-shadow: 0 2px 8px rgba(15, 118, 110, 0.08);
}

.timeline article .movement-list li.is-next {
  border-top-color: #d97706;
}

.timeline article .movement-list li.is-next .movement-button {
  border-color: rgba(217, 119, 6, 0.45);
  background: #fffbeb;
}

.pill-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 800;
  margin-left: 6px;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pill-now {
  color: #fff;
  background: var(--accent);
  animation: pulse-active 2s infinite ease-in-out;
}

.pill-next {
  color: #fff;
  background: #d97706;
}

@keyframes pulse-active {
  0% {
    box-shadow: 0 0 0 0 rgba(15, 118, 110, 0.4);
  }
  70% {
    box-shadow: 0 0 0 5px rgba(15, 118, 110, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(15, 118, 110, 0);
  }
}

