:root {
  color-scheme: light;
  --ink: #17211f;
  --muted: #58635f;
  --paper: #f8f5ef;
  --panel: #ffffff;
  --line: #d9d3c6;
  --sea: #0b7d8c;
  --sea-dark: #07545f;
  --olive: #626f37;
  --coral: #c85d42;
  --sun: #e6b85c;
  --shadow: 0 18px 50px rgba(23, 33, 31, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  overflow-x: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
  min-width: 0;
}

a {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  background: var(--paper);
}

.login-media {
  background:
    linear-gradient(90deg, rgba(23, 33, 31, 0.15), rgba(23, 33, 31, 0.02)),
    url("https://commons.wikimedia.org/wiki/Special:FilePath/Poetto%2C%20Cagliari.jpg?width=1600") center / cover;
}

.login-panel {
  align-self: center;
  margin: 48px;
  padding: 40px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.login-panel h1,
.hero h1,
.section h2 {
  margin: 0;
  letter-spacing: 0;
  line-height: 1.02;
}

.login-panel h1 {
  max-width: 9ch;
  font-size: clamp(3rem, 8vw, 5.8rem);
}

.login-copy {
  margin: 22px 0 28px;
  color: var(--muted);
  font-size: 1.05rem;
}

.login-form {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px;
  background: #fff;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

button,
.button {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 12px 16px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

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

.button.secondary,
.topbar button,
.planner-tools button,
.filters button,
.activity-actions button,
.card-button {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}

.button.primary {
  background: var(--coral);
}

.form-error {
  min-height: 1.4em;
  margin: 0;
  color: #9b2e1b;
  font-weight: 700;
}

.form-message {
  margin: 8px 0 0;
  color: var(--sea-dark);
  font-weight: 700;
}

.security-note {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

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

.hero {
  min-height: 78vh;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(90deg, rgba(13, 30, 28, 0.76), rgba(13, 30, 28, 0.22)),
    url("https://commons.wikimedia.org/wiki/Special:FilePath/Poetto%2C%20Cagliari.jpg?width=1800") center / cover;
  color: #fff;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px clamp(18px, 4vw, 44px);
  background: rgba(248, 245, 239, 0.92);
  color: var(--ink);
  border-bottom: 1px solid rgba(23, 33, 31, 0.08);
  backdrop-filter: blur(14px);
}

.topbar a {
  padding: 9px 10px;
  border-radius: 8px;
  font-weight: 800;
  text-decoration: none;
  color: var(--muted);
  white-space: nowrap;
}

.topbar a:hover {
  color: var(--ink);
  background: rgba(11, 125, 140, 0.08);
}

.current-user {
  margin-left: auto;
  color: var(--sea-dark);
  font-size: 0.85rem;
  font-weight: 900;
  white-space: nowrap;
}

.topbar button {
  padding: 9px 12px;
  white-space: nowrap;
}

.hero-content {
  width: min(1120px, calc(100% - 36px));
  margin: auto auto 7vh;
}

.hero-content h1 {
  max-width: min(860px, 100%);
  font-size: clamp(3rem, 7.2vw, 6.4rem);
}

.hero-content p:not(.eyebrow) {
  max-width: 660px;
  margin: 18px 0 0;
  font-size: clamp(1.1rem, 2vw, 1.35rem);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.section {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 64px 0;
  scroll-margin-top: 74px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--coral);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero .eyebrow {
  color: #f2ca7c;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.section h2 {
  font-size: clamp(2rem, 4vw, 3.4rem);
}

.lead {
  max-width: 64ch;
  color: var(--muted);
  font-size: 1.04rem;
}

.overview-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr;
  gap: 16px;
}

.summary-panel,
.day-card,
.calendar-day,
.flight-card,
.activity-card,
.decision-panel,
.notes-panel,
.import-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(23, 33, 31, 0.07);
}

.summary-panel {
  padding: 24px;
}

.summary-panel.accent {
  border-top: 5px solid var(--sea);
}

.summary-panel.warning {
  border-top: 5px solid var(--coral);
}

.summary-panel h2,
.day-card h3,
.flight-card h3,
.activity-card h3,
.decision-panel h3 {
  margin: 0 0 12px;
  line-height: 1.1;
}

.timeline {
  display: grid;
  gap: 16px;
}

.timeline div {
  padding-left: 16px;
  border-left: 4px solid var(--sun);
}

.timeline span,
.timeline small {
  display: block;
  color: var(--muted);
}

.timeline strong {
  display: block;
  margin: 2px 0;
  font-size: 1.08rem;
}

.compact-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
}

.planner-tools,
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.calendar-note {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(220px, 1fr));
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 10px;
}

.calendar-day {
  min-height: 420px;
  overflow: hidden;
}

.calendar-day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  background: var(--sea-dark);
  color: #fff;
}

.calendar-day-header span {
  font-weight: 900;
}

.calendar-day-header strong {
  white-space: nowrap;
}

.calendar-events {
  display: grid;
  gap: 0;
  padding: 8px 14px 14px;
}

.calendar-event {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.calendar-event:last-child {
  border-bottom: 0;
}

.calendar-event div {
  display: grid;
  align-content: start;
  gap: 2px;
}

.calendar-event span {
  color: var(--coral);
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
}

.calendar-event strong {
  color: var(--ink);
  font-size: 0.86rem;
}

.calendar-event h3 {
  margin: 0 0 4px;
  font-size: 1rem;
  line-height: 1.18;
}

.calendar-event p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.refresh-stamp,
.flight-disclaimer {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

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

.flight-card {
  padding: 22px;
}

.flight-card-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.flight-card h3 {
  font-size: clamp(1.8rem, 4vw, 3rem);
}

.flight-status {
  align-self: start;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8f5ef;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.flight-status.watch {
  border-color: rgba(230, 184, 92, 0.6);
  background: rgba(230, 184, 92, 0.18);
  color: #6b4a09;
}

.flight-status.urgent {
  border-color: rgba(200, 93, 66, 0.55);
  background: rgba(200, 93, 66, 0.12);
  color: #9b2e1b;
}

.flight-status.airborne,
.flight-status.landed {
  border-color: rgba(11, 125, 140, 0.42);
  background: rgba(11, 125, 140, 0.1);
  color: var(--sea-dark);
}

.flight-route {
  margin: 0 0 18px;
  color: var(--muted);
  font-weight: 800;
}

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

.flight-times div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbf8;
}

.flight-times dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.flight-times dd {
  margin: 4px 0 0;
  color: var(--ink);
  font-weight: 900;
}

.flight-next {
  display: grid;
  gap: 4px;
  margin: 18px 0;
  padding-left: 14px;
  border-left: 4px solid var(--sun);
}

.flight-next strong {
  font-size: 1.15rem;
}

.flight-next span {
  color: var(--muted);
}

.flight-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.flight-links a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--sea-dark);
  font-weight: 900;
  text-decoration: none;
}

.flight-disclaimer {
  margin-top: 14px;
  max-width: 78ch;
  font-size: 0.94rem;
}

.filters button.active {
  background: var(--sea);
  color: #fff;
  border-color: var(--sea);
}

.import-panel {
  padding: 18px;
  margin-bottom: 20px;
}

.day-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(210px, 1fr));
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 10px;
  -webkit-overflow-scrolling: touch;
}

.day-card {
  min-height: 460px;
  padding: 18px;
}

.day-card-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  min-height: 76px;
}

.weather-hint {
  align-self: start;
  padding: 5px 8px;
  border: 1px solid rgba(98, 111, 55, 0.35);
  border-radius: 999px;
  color: var(--olive);
  font-size: 0.74rem;
  font-weight: 900;
  white-space: nowrap;
}

.day-focus {
  min-height: 72px;
  margin: 0 0 14px;
  color: var(--muted);
}

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

.slot-card {
  padding: 12px;
  background: #f9fbf8;
  border: 1px solid #dfe4d6;
  border-radius: 8px;
}

.slot-card strong {
  display: block;
  margin-bottom: 4px;
}

.slot-card small {
  color: var(--muted);
}

.slot-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
}

.vote-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--sea-dark);
  font-weight: 900;
  font-size: 0.85rem;
}

.vote-summary {
  flex-basis: 100%;
  margin: 0;
  color: var(--sea-dark);
  font-size: 0.86rem;
  font-weight: 900;
}

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

.activity-card {
  overflow: hidden;
}

.activity-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: #d9d3c6;
}

.activity-body {
  padding: 18px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0;
}

.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 8px;
  background: rgba(230, 184, 92, 0.22);
  color: #6b4a09;
  font-size: 0.75rem;
  font-weight: 900;
}

.activity-meta {
  display: grid;
  gap: 7px;
  margin: 12px 0;
  color: var(--muted);
  font-size: 0.92rem;
}

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

.review-notes {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.review-notes div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
}

.review-notes strong {
  display: block;
  margin-bottom: 3px;
  color: var(--ink);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.review-notes p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.activity-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.activity-actions select {
  flex: 1 1 140px;
  padding: 10px;
}

.split-section {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 22px;
  align-items: start;
}

.car-options {
  display: grid;
  gap: 12px;
}

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

.car-option h3 {
  margin: 0 0 6px;
}

.car-option p {
  margin: 0;
  color: var(--muted);
}

.car-option a,
.source-list a,
.activity-meta a {
  color: var(--sea-dark);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.decision-panel,
.notes-panel {
  padding: 20px;
  position: sticky;
  top: 84px;
}

.checklist {
  display: grid;
  gap: 10px;
}

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

.check-item {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.check-item input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.check-item span {
  color: var(--ink);
  font-weight: 700;
}

.source-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

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

.source-card small {
  display: block;
  color: var(--muted);
}

@media (max-width: 980px) {
  .login-shell,
  .overview-grid,
  .flight-grid,
  .activity-grid,
  .split-section {
    grid-template-columns: 1fr;
  }

  .login-media {
    min-height: 38vh;
  }

  .login-panel {
    margin: 18px;
  }

  .day-board {
    grid-template-columns: repeat(5, minmax(260px, 1fr));
  }

  .calendar-grid {
    grid-template-columns: repeat(5, minmax(270px, 1fr));
  }

  .decision-panel,
  .notes-panel {
    position: static;
  }
}

@media (max-width: 680px) {
  .login-shell {
    min-height: 100svh;
  }

  .login-media {
    min-height: 28svh;
  }

  .login-panel {
    align-self: start;
    justify-self: center;
    width: calc(100% - 24px);
    max-width: calc(100% - 24px);
    margin: 12px auto;
    padding: 24px;
  }

  .login-copy {
    margin: 16px 0 22px;
    font-size: 1rem;
  }

  select,
  input,
  textarea {
    padding: 12px;
  }

  .topbar {
    gap: 8px;
    overflow-x: auto;
    padding: 10px 12px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .topbar::-webkit-scrollbar {
    display: none;
  }

  .topbar a,
  .topbar button,
  .current-user {
    flex: 0 0 auto;
    padding: 8px 10px;
    font-size: 0.88rem;
  }

  .current-user {
    margin-left: 0;
  }

  .hero {
    min-height: 72svh;
    background-position: 58% center;
  }

  .hero-content {
    width: min(calc(100% - 28px), 1120px);
    margin-bottom: 34px;
  }

  .hero-content h1,
  .login-panel h1 {
    font-size: clamp(2.3rem, 12vw, 3rem);
  }

  .hero-content p:not(.eyebrow) {
    font-size: 1.02rem;
  }

  .hero-actions {
    gap: 10px;
    margin-top: 22px;
  }

  .section {
    width: min(calc(100% - 28px), 1180px);
    padding: 38px 0;
    scroll-margin-top: 62px;
  }

  .section-heading {
    display: grid;
    align-items: start;
    gap: 12px;
    margin-bottom: 18px;
  }

  .section h2 {
    font-size: clamp(1.85rem, 9vw, 2.55rem);
  }

  .summary-panel,
  .day-card,
  .decision-panel,
  .notes-panel,
  .import-panel {
    padding: 18px;
  }

  .calendar-grid,
  .day-board {
    grid-template-columns: 1fr;
    overflow-x: visible;
    padding-bottom: 0;
  }

  .calendar-day,
  .day-card {
    min-height: auto;
  }

  .calendar-day-header {
    padding: 14px 16px;
  }

  .calendar-event {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 10px;
  }

  .day-card-header {
    min-height: 0;
  }

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

  .checklist.columns,
  .flight-times,
  .source-list {
    grid-template-columns: 1fr;
  }

  .planner-tools,
  .filters {
    width: 100%;
  }

  .planner-tools button {
    flex: 1 1 0;
  }

  .filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .filters::-webkit-scrollbar {
    display: none;
  }

  .filters button {
    flex: 0 0 auto;
  }

  .activity-card img {
    height: 205px;
  }

  .activity-body {
    padding: 16px;
  }

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

  .activity-actions select {
    grid-column: 1 / -1;
  }

  .slot-actions {
    align-items: stretch;
    display: grid;
  }

  .slot-actions > div {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
}

@media (max-width: 420px) {
  .hero-actions,
  .activity-actions {
    grid-template-columns: 1fr;
  }

  .hero-actions {
    display: grid;
  }

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

  .weather-hint {
    white-space: normal;
    text-align: right;
  }
}
