/* app.css — Lagio styles. Mobile first: written for a 360 px phone,
   with small additions for wider screens at the bottom. */

/* ---------- colours and sizes (change the theme here) ---------- */
:root {
  --color-primary: #0e5a8a;       /* deep sea blue */
  --color-primary-dark: #0a4468;
  --color-primary-soft: #e3eef6;
  --color-accent: #f2a93b;        /* suitcase amber */
  --color-accent-dark: #d48a1c;
  --color-danger: #b42318;
  --color-success: #1f7a3d;
  --color-success-soft: #e3f3e8;
  --color-bg: #f6f7f9;
  --color-surface: #ffffff;
  --color-text: #1c2430;
  --color-muted: #5b6573;
  --color-border: #dfe3e8;

  --radius: 12px;
  --space: 16px;
  --tap: 44px;                    /* smallest comfortable tap target */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  color-scheme: light;
}

/* Trip cover colours. All dark enough for white text on top. */
.cover-sea    { --cover: #0e5a8a; }
.cover-lagoon { --cover: #0f766e; }
.cover-forest { --cover: #2f6b3a; }
.cover-amber  { --cover: #b45309; }
.cover-sunset { --cover: #c2410c; }
.cover-berry  { --cover: #be185d; }
.cover-plum   { --cover: #6d28d9; }
.cover-slate  { --cover: #475569; }

/* ---------- base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-tap-highlight-color: transparent;
}

h1,
h2,
p {
  margin: 0;
}

a {
  color: var(--color-primary);
}

button,
input,
select,
textarea {
  font: inherit;
}

:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

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

.icon {
  width: 20px;
  height: 20px;
  flex: none;
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space);
  /* env(safe-area-inset-*) keeps clear of the phone's notch */
  padding: calc(8px + env(safe-area-inset-top)) var(--space) 8px;
  background: var(--color-primary);
  color: #fff;
}

.brand {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: inherit;
  text-decoration: none;
}

/* LT | EN */
.lang-switch {
  display: flex;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
}

.lang-switch button {
  min-width: var(--tap);
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.lang-switch button[aria-pressed="true"] {
  background: #fff;
  color: var(--color-primary);
}

/* ---------- screens ---------- */
.main {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: var(--space);
  padding-bottom: calc(120px + env(safe-area-inset-bottom));
}

.screen-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: var(--space);
}

.screen-title {
  font-size: 24px;
  line-height: 1.25;
}

.section-title {
  margin: 20px 0 8px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--color-muted);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: calc(100% + 6px);
  min-height: var(--tap);
  margin: -8px 0 4px -6px;
  padding-right: 8px;
  font-weight: 600;
  text-decoration: none;
}

.back-link span {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.back-link .icon {
  flex: none;
}

/* Below the trip list: Import trip and the archive link */
.home-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
}

.archive-link {
  display: inline-block;
  min-height: var(--tap);
  padding: 10px 12px;
  font-weight: 600;
}

/* Import summary (import-dialog.js) */
.import-summary {
  display: grid;
  gap: 2px;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--color-primary-soft);
}

.import-name {
  font-size: 18px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.notice {
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: #fdf3e2;
  color: #7a4a06;
}

/* ---------- empty state ---------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 32px var(--space);
  text-align: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.illustration {
  width: 120px;
  height: 120px;
  margin-bottom: 8px;
}

.empty-state-title {
  font-size: 20px;
}

.empty-state-text {
  max-width: 34ch;
  color: var(--color-muted);
}

.empty-state .button {
  margin-top: 8px;
}

/* ---------- lists and trip cards ---------- */
.card-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.trip-card {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: var(--tap);
  padding: 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text);
  text-decoration: none;
}

.trip-card:active {
  background: var(--color-primary-soft);
}

.trip-card-cover {
  display: grid;
  place-items: center;
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 10px;
  background: var(--cover);
  color: #fff;
  font-size: 22px;
  font-weight: 700;
}

.trip-card-body {
  display: flex;
  flex-direction: column;
  min-width: 0;   /* lets long names wrap instead of widening the page */
  gap: 2px;
}

.trip-card-name {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.trip-card-places {
  color: var(--color-muted);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.trip-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  font-size: 14px;
  color: var(--color-muted);
}

.archive-row {
  display: grid;
  gap: 6px;
}

.archive-row .button {
  justify-self: end;
}

/* Small labels like "Po 12 dienų" */
.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-soon   { background: var(--color-primary-soft); color: var(--color-primary-dark); }
.badge-active { background: var(--color-success-soft); color: var(--color-success); }
.badge-muted  { background: #eef0f3; color: var(--color-muted); }

/* ---------- buttons ---------- */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--tap);
  padding: 0 18px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-text);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.button:disabled {
  opacity: 0.5;
  cursor: default;
}

.button-primary {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: #fff;
}

.button-primary:active {
  background: var(--color-primary-dark);
}

.button-danger {
  border-color: var(--color-danger);
  background: var(--color-danger);
  color: #fff;
}

.button-small {
  padding: 0 14px;
  font-size: 15px;
}

.icon-button {
  display: grid;
  place-items: center;
  flex: none;
  width: var(--tap);
  height: var(--tap);
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  color: inherit;
  cursor: pointer;
}

/* ---------- forms ---------- */
.form {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  align-content: start; /* extra height goes below the field, not between label and input */
  gap: 6px;
  min-width: 0;
}

.field-label {
  font-weight: 600;
}

.field-hint {
  font-size: 14px;
  color: var(--color-muted);
}

.form-note {
  margin-top: -10px;
}

.field-error {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-danger);
}

/* 16 px text stops iPhones from zooming into the field */
.input {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid #c4cad3;
  border-radius: 10px;
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 16px;
}

.input:focus {
  border-color: var(--color-primary);
  outline: 2px solid var(--color-primary-soft);
}

.has-error .input {
  border-color: var(--color-danger);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: start; /* an error under one field must not push the other down */
  gap: 12px;
}

.form-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

/* Places: chips + add field */
.places {
  display: grid;
  gap: 8px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  max-width: 100%;
  padding-left: 12px;
  border-radius: 999px;
  background: var(--color-primary-soft);
  color: var(--color-primary-dark);
  font-weight: 600;
}

.chip span {
  overflow-wrap: anywhere;
}

.chip-remove {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.places-add {
  display: flex;
  gap: 8px;
}

/* Colour swatches */
.color-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.swatch {
  width: var(--tap);
  height: var(--tap);
  border: 3px solid transparent;
  border-radius: 999px;
  background: var(--cover);
  cursor: pointer;
}

.swatch[aria-checked="true"] {
  border-color: var(--color-surface);
  box-shadow: 0 0 0 3px var(--cover);
}

/* ---------- trip dashboard ---------- */
.trip-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 18px var(--space);
  border-radius: var(--radius);
  background: var(--cover);
  color: #fff;
}

.trip-header-text {
  min-width: 0;
}

.trip-header-name {
  font-size: 24px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.trip-header-places {
  margin-top: 4px;
  opacity: 0.92;
  overflow-wrap: anywhere;
}

.trip-header-dates {
  margin-top: 2px;
  font-weight: 600;
}

.stage-card {
  display: grid;
  justify-items: start;
  gap: 6px;
  margin-bottom: 12px;
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
}

.stage-card.is-active {
  border-color: var(--color-success);
  background: var(--color-success-soft);
}

.stage-label {
  color: var(--color-muted);
  font-weight: 600;
}

.stage-big {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
}

.stage-text {
  color: var(--color-muted);
}

.tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tile {
  display: grid;
  align-content: start;
  justify-items: start;
  gap: 6px;
  min-height: 112px;
  padding: 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-muted);
}

.tile .icon {
  width: 26px;
  height: 26px;
  color: var(--color-primary);
}

.tile-name {
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.3;
}

/* ---------- dialogs and the action sheet ---------- */
.modal {
  width: calc(100% - 32px);
  max-width: 420px;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.modal::backdrop {
  background: rgba(15, 23, 32, 0.5);
}

.modal-box {
  padding: 20px;
}

.modal-title {
  font-size: 20px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.modal-text {
  margin-top: 8px;
  color: var(--color-muted);
  overflow-wrap: anywhere;
}

.modal-buttons {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

/* The ⋯ menu slides up from the bottom */
.sheet {
  width: 100%;
  max-width: 640px;
  margin: auto auto 0;
  border-radius: 16px 16px 0 0;
}

.sheet .modal-box {
  padding: 8px var(--space) calc(var(--space) + env(safe-area-inset-bottom));
}

.sheet-title {
  padding: 10px 0;
  font-size: 15px;
  color: var(--color-muted);
  text-align: center;
  overflow-wrap: anywhere;
}

.sheet-list {
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
}

.sheet-action {
  width: 100%;
  min-height: 52px;
  padding: 0 8px;
  border: 0;
  border-top: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text);
  font-size: 17px;
  text-align: left;
  cursor: pointer;
}

.sheet-action.is-danger {
  color: var(--color-danger);
  font-weight: 600;
}

.sheet-cancel {
  width: 100%;
}

/* ---------- bottom messages: toast and update banner ---------- */
.bottom-stack {
  position: fixed;
  left: var(--space);
  right: var(--space);
  bottom: calc(var(--space) + env(safe-area-inset-bottom));
  z-index: 20;
  display: grid;
  gap: 8px;
  max-width: 608px;
  margin: 0 auto;
  pointer-events: none; /* taps go through the empty area */
}

.toast,
.update-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 6px 6px 6px var(--space);
  border-radius: var(--radius);
  background: var(--color-text);
  color: #fff;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
  pointer-events: auto;
}

.toast-action {
  min-height: var(--tap);
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #ffd38a;
  font-weight: 700;
  cursor: pointer;
}

/* Each tile fills its grid cell; tiles that open a screen look tappable */
.tiles > li {
  display: flex;
}

.tile {
  flex: 1;
}

.tile.is-link {
  color: var(--color-text);
  text-decoration: none;
  border-color: var(--color-primary);
  box-shadow: 0 1px 0 var(--color-primary-soft);
}

.tile.is-link:active {
  background: var(--color-primary-soft);
}

/* Hidden but still usable (e.g. the file input behind "Add document") */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.button-danger-text {
  color: var(--color-danger);
}

/* ---------- bookings ---------- */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 20px 0 8px;
}

.section-head .section-title {
  margin: 0;
}

.doc-section {
  margin-top: 28px;
}

.day-group + .day-group {
  margin-top: 16px;
}

.day-title {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 700;
}

.day-title::first-letter {
  text-transform: uppercase;
}

.booking-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  text-decoration: none;
}

.booking-card:active {
  background: var(--color-primary-soft);
}

.booking-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

.booking-icon.is-large {
  width: 56px;
  height: 56px;
}

.booking-icon.is-large .icon {
  width: 28px;
  height: 28px;
}

.booking-body {
  display: grid;
  min-width: 0;
}

.booking-title {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.booking-time {
  font-weight: 600;
  color: var(--color-primary-dark);
}

.booking-meta {
  font-size: 14px;
  color: var(--color-muted);
  overflow-wrap: anywhere;
}

/* Booking form */
.type-picker {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.type-option {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 4px;
  min-height: 64px;
  padding: 6px 2px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 12px;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
}

.type-option .icon {
  color: var(--color-primary);
}

.type-option[aria-checked="true"] {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: #fff;
}

.type-option[aria-checked="true"] .icon {
  color: #fff;
}

.date-time {
  margin: 0;
  padding: 0;
  border: 0;
}

.input:disabled {
  background: #f0f2f5;
  color: var(--color-muted);
}

.textarea {
  min-height: 88px;
  resize: vertical;
  line-height: 1.4;
}

.input-code {
  font-family: ui-monospace, "Cascadia Mono", Menlo, monospace;
  letter-spacing: 1px;
}

/* Booking screen */
.booking-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.booking-header-text {
  min-width: 0;
}

.booking-type {
  color: var(--color-muted);
  font-weight: 600;
}

.booking-header-title {
  font-size: 22px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.code-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px dashed var(--color-primary);
  border-radius: var(--radius);
  background: var(--color-primary-soft);
}

.code-value {
  font-family: ui-monospace, "Cascadia Mono", Menlo, monospace;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 2px;
  overflow-wrap: anywhere;
}

.detail-list {
  margin: 0 0 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
}

.detail-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  gap: 10px;
  padding: 10px 14px;
}

.detail-row + .detail-row {
  border-top: 1px solid var(--color-border);
}

.detail-label {
  margin: 0;
  font-size: 14px;
  color: var(--color-muted);
}

.detail-value {
  margin: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.detail-block {
  display: grid;
  justify-items: start;
  gap: 6px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
}

.detail-note {
  font-weight: 400;
  white-space: pre-wrap;
}

.detail-buttons {
  justify-content: space-between;
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
}

/* ---------- documents ---------- */
.doc-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.doc-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 60px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  text-align: left;
  cursor: pointer;
}

.doc-row:active {
  background: var(--color-primary-soft);
}

.doc-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

.doc-text {
  display: grid;
  min-width: 0;
}

.doc-name {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.doc-meta {
  font-size: 14px;
  color: var(--color-muted);
}

.doc-actions {
  margin-top: 12px;
}

.storage-line {
  margin-top: 12px;
  font-size: 14px;
}

/* ---------- document viewer (full screen) ---------- */
.viewer {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  border-radius: 0;
}

.viewer .modal-box {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0;
}

.viewer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(8px + env(safe-area-inset-top)) var(--space) 8px;
  background: var(--color-primary);
  color: #fff;
}

.viewer-title {
  min-width: 0;
  font-size: 17px;
  overflow-wrap: anywhere;
}

.viewer-body {
  display: grid;
  place-items: center;
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: #2b313a;
}

.viewer-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* PDF pages (pdf-view.js) */
.viewer-body.is-pdf {
  display: block;
  position: relative;
  overflow: hidden;
}

.pdf-scroll {
  position: absolute;
  inset: 0;
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: pan-x pan-y; /* two-finger pinch zooms the pages, not the app */
}

.pdf-scroll .viewer-message {
  margin: 40px auto 0;
}

.pdf-pages {
  box-sizing: border-box;
  margin: 0 auto;
  padding: 8px;
}

.pdf-page {
  margin-bottom: 8px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.pdf-page canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.pdf-zoom {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  gap: 8px;
}

.pdf-zoom .icon-button {
  background: rgba(15, 23, 32, 0.72);
  color: #fff;
}

.pdf-zoom .icon-button:disabled {
  opacity: 0.4;
}

.field-note {
  padding: 8px 10px;
  border-radius: 8px;
  background: #fdf3e2;
  color: #7a4a06;
  font-size: 14px;
}

.viewer-message {
  max-width: 32ch;
  padding: var(--space);
  color: #fff;
  text-align: center;
}

.viewer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px var(--space) calc(10px + env(safe-area-inset-bottom));
  background: var(--color-surface);
}

/* ---------- wider screens ---------- */
@media (min-width: 600px) {
  .main {
    padding-top: 24px;
  }

  .screen-title {
    font-size: 28px;
  }

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

/* Number of files attached to a booking (booking cards) */
.attachment-count {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex: none;
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--color-primary-soft);
  color: var(--color-primary-dark);
  font-size: 14px;
  font-weight: 700;
}

.attachment-count .icon {
  width: 16px;
  height: 16px;
}

/* Backup reminder on the trip dashboard: one slim strip */
.backup-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 6px 4px 6px 12px;
  border-radius: var(--radius);
  background: #fdf3e2;
  color: #7a4a06;
  font-size: 14px;
  line-height: 1.3;
}

.backup-strip > .icon {
  flex: none;
}

.backup-text {
  flex: 1;
  min-width: 0;
}


.backup-strip .button-small {
  min-height: 40px;
  padding: 0 12px;
  font-size: 14px;
}

.backup-close {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

/* ---------- packing list (trip-packing.js) ---------- */
.pack-progress {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.progress {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--color-border);
}

.progress-bar {
  height: 100%;
  border-radius: 999px;
  background: var(--color-success);
  transition: width 0.2s;
}

.pack-progress-text {
  font-weight: 600;
  color: var(--color-muted);
}

.pack-add {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
}

.pack-add-row {
  display: flex;
  gap: 8px;
}

.pack-add-row .input {
  flex: 1;
}

.pack-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}

/* A small on/off button ("Hide packed") */
.chip-toggle {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.chip-toggle[aria-pressed="true"] {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
  color: var(--color-primary-dark);
}

.pack-group-count {
  margin-left: 6px;
  font-weight: 600;
  letter-spacing: 0;
}

.pack-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
}

.pack-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-left: 12px;
}

.pack-item + .pack-item {
  border-top: 1px solid var(--color-border);
}

.pack-check {
  flex: none;
  width: 24px;
  height: 24px;
  margin: 0;
  accent-color: var(--color-success);
  cursor: pointer;
}

/* The whole row is tappable (the label belongs to the checkbox) */
.pack-label {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 8px;
  min-width: 0;
  min-height: 48px;
  padding: 8px 4px 8px 10px;
  cursor: pointer;
}

.pack-text {
  overflow-wrap: anywhere;
}

.pack-quantity {
  flex: none;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--color-primary-soft);
  color: var(--color-primary-dark);
  font-size: 14px;
  font-weight: 700;
}

.pack-item.is-done .pack-text {
  color: var(--color-muted);
  text-decoration: line-through;
}

.pack-edit {
  display: grid;
  place-items: center;
  flex: none;
  width: var(--tap);
  height: var(--tap);
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--color-muted);
  cursor: pointer;
}

.pack-all-hidden {
  margin-top: 16px;
  text-align: center;
  font-weight: 700;
  color: var(--color-success);
}

/* − ×3 + */
.stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  border: 1px solid #c4cad3;
  border-radius: 10px;
  background: var(--color-surface);
}

.stepper-button {
  display: grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  border: 0;
  background: transparent;
  color: var(--color-primary);
  cursor: pointer;
}

.stepper-button:disabled {
  color: var(--color-border);
  cursor: default;
}

.stepper-value {
  font-weight: 700;
}

.modal-form {
  margin-top: 12px;
}

/* Template picker (packing-templates.js) */
.tpl-heading {
  margin: 14px 0 6px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--color-muted);
}

.tpl-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.tpl-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-left: 12px;
}

.tpl-row + .tpl-row {
  border-top: 1px solid var(--color-border);
}

.tpl-label {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  min-width: 0;
  min-height: 48px;
  padding: 12px 4px 12px 10px;
  cursor: pointer;
}

.tpl-name {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.tpl-count {
  font-size: 14px;
  color: var(--color-muted);
}

.tpl-rename {
  display: flex;
  flex: 1;
  gap: 8px;
  padding: 6px 6px 6px 0;
}

/* Per-person packing: Visi · Bendri · names (scrolls sideways when long) */
.view-tabs {
  display: flex;
  gap: 6px;
  margin: 0 -16px 14px;
  padding: 0 16px 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.view-tab {
  display: inline-flex;
  align-items: baseline;
  flex: none;
  gap: 6px;
  min-height: var(--tap);
  padding: 0 14px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-text);
  font-weight: 600;
  line-height: var(--tap);
  cursor: pointer;
}

.view-tab[aria-pressed="true"] {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: #fff;
}

.view-tab-count {
  font-size: 13px;
  opacity: 0.8;
}

.pack-owner {
  flex: none;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef0f3;
  color: var(--color-muted);
  font-size: 13px;
  font-weight: 600;
}

/* A chip whose name can be tapped to rename it (travelers) */
.chip-name {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 600;
  text-decoration: underline dotted;
  cursor: pointer;
}

.chip-input {
  width: 8em;
  min-height: 32px;
  padding: 2px 6px;
  border: 1px solid var(--color-primary);
  border-radius: 6px;
  font: inherit;
}

/* ---------- itinerary (trip-itinerary.js) ---------- */
.day-card {
  margin-bottom: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  scroll-margin-top: 72px; /* below the sticky top bar when scrolled to */
}

.day-card.is-today {
  border-color: var(--color-success);
  box-shadow: 0 0 0 1px var(--color-success);
}

.day-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px 6px;
}

.day-card-date {
  font-size: 16px;
}

.day-card-date::first-letter {
  text-transform: uppercase;
}

.day-card-number {
  display: inline-flex;
  align-items: center;
  flex: none;
  gap: 6px;
  font-size: 14px;
  color: var(--color-muted);
}

.plan-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.plan-entry {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 6px 0 14px;
  border-top: 1px solid var(--color-border);
}

.plan-time {
  flex: none;
  width: 54px;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-primary-dark);
  line-height: 1.2;
}

.plan-main {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 10px;
  min-width: 0;
  min-height: 56px;
  padding: 8px 4px;
  border: 0;
  background: transparent;
  color: var(--color-text);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.plan-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

.plan-icon.is-own {
  background: #fdf3e2;
  color: #a2620c;
}

.plan-text {
  display: grid;
  min-width: 0;
}

.plan-title {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.plan-sub,
.plan-note {
  font-size: 14px;
  color: var(--color-muted);
  overflow-wrap: anywhere;
}

.plan-note {
  white-space: pre-wrap;
}

.plan-map {
  display: grid;
  place-items: center;
  flex: none;
  width: var(--tap);
  height: var(--tap);
  border-radius: 999px;
  color: var(--color-primary);
}

.plan-empty {
  padding: 4px 14px 8px;
  color: var(--color-muted);
}

.plan-add {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: var(--tap);
  padding: 0 14px;
  border: 0;
  border-top: 1px solid var(--color-border);
  border-radius: 0 0 var(--radius) var(--radius);
  background: transparent;
  color: var(--color-primary);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.other-days-hint {
  margin: -4px 0 10px;
  font-size: 14px;
}

/* Small grey version line at the bottom of Home */
.app-version {
  margin-top: 8px;
  font-size: 12px;
  color: var(--color-muted);
  opacity: 0.8;
}

/* Day title and order (itinerary 6b) */
.day-card-heading {
  min-width: 0;
}

.day-card-title {
  font-weight: 700;
  color: var(--color-primary-dark);
  overflow-wrap: anywhere;
}

.day-title-edit {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin: -8px -8px -8px 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--color-muted);
  cursor: pointer;
}

.day-card-actions {
  display: flex;
  align-items: stretch;
  border-top: 1px solid var(--color-border);
}

.day-card-actions .plan-add {
  flex: 1;
  border-top: 0;
}

.plan-reorder {
  min-height: var(--tap);
  padding: 0 14px;
  border: 0;
  border-left: 1px solid var(--color-border);
  border-radius: 0 0 var(--radius) 0;
  background: transparent;
  color: var(--color-muted);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.plan-reorder[aria-pressed="true"] {
  color: var(--color-primary);
}

.plan-move {
  display: flex;
  flex: none;
}

.plan-move-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: var(--tap);
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--color-primary);
  cursor: pointer;
}

.plan-move-button:disabled {
  color: var(--color-border);
  cursor: default;
}

/* "Šiandien" on the trip dashboard (today-card.js) */
.today-card {
  margin-bottom: 12px;
  border: 1px solid var(--color-success);
  border-radius: var(--radius);
  background: var(--color-surface);
  overflow: hidden;
}

.today-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  background: var(--color-success-soft);
}

.today-title {
  font-size: 18px;
  color: var(--color-success);
}

.today-day {
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-muted);
  text-align: right;
  overflow-wrap: anywhere;
}

.today-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.today-entry {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px 0 14px;
  border-top: 1px solid var(--color-border);
}

.today-main {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 10px;
  min-width: 0;
  min-height: 56px;
  padding: 8px 4px;
  color: var(--color-text);
  text-decoration: none;
}

.ticket-button {
  display: inline-flex;
  align-items: center;
  flex: none;
  gap: 4px;
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: var(--color-primary);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.ticket-button .icon {
  width: 18px;
  height: 18px;
}

.today-empty {
  padding: 12px 14px;
  color: var(--color-muted);
}

.today-all {
  display: block;
  min-height: var(--tap);
  padding: 12px 14px;
  border-top: 1px solid var(--color-border);
  font-weight: 600;
  text-decoration: none;
}

/* ---------- spending (trip-spending.js) ---------- */
.spend-summary {
  margin-bottom: 12px;
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
}

.spend-label {
  font-weight: 600;
  color: var(--color-muted);
}

.spend-total {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.2;
}

.spend-bars {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.spend-bar-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 8px;
  align-items: center;
}

.spend-bar-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 14px;
}

.spend-bar-name .icon {
  width: 16px;
  height: 16px;
  color: var(--color-primary);
}

.spend-bar-amount {
  font-size: 14px;
  font-weight: 700;
}

.spend-bar {
  grid-column: 1 / -1;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--color-primary-soft);
}

.spend-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--color-primary);
}

.spend-add {
  width: 100%;
  margin-bottom: 4px;
}

.spend-group {
  margin-top: 8px;
}

.spend-day {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.spend-day-total {
  letter-spacing: 0;
  text-transform: none;
}

.spend-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
}

.spend-list li + li {
  border-top: 1px solid var(--color-border);
}

.spend-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  color: var(--color-text);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.spend-text {
  display: grid;
  flex: 1;
  min-width: 0;
}

.spend-title {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.spend-sub {
  font-size: 13px;
  color: var(--color-muted);
}

.spend-amount {
  display: grid;
  flex: none;
  justify-items: end;
  font-weight: 700;
}

.spend-eur {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-muted);
}

.type-picker-3 {
  grid-template-columns: repeat(3, 1fr);
}

.amount-row {
  grid-template-columns: 1fr 1.3fr;
}

.input-amount {
  font-size: 22px;
  font-weight: 700;
}

/* ---------- budget, payers, post-trip recap (7b) ---------- */
.spend-budget-line {
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-muted);
}

.spend-budget-line.is-over,
.spend-bar-amount.is-over {
  color: var(--color-danger);
}

.spend-bar.is-over span {
  background: var(--color-danger);
}

.spend-summary > .spend-bar {
  display: block;
}

.spend-payers-title {
  margin-top: 14px;
}

.spend-payers,
.recap-list {
  display: grid;
  gap: 6px;
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
}

.spend-payers li,
.recap-list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
}

.spend-budget-button {
  margin-top: 14px;
}

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

.recap {
  display: grid;
  gap: 4px;
  width: 100%;
}

.recap-total {
  font-size: 22px;
  font-weight: 700;
}

.recap .button {
  justify-self: start;
  margin-top: 8px;
}

/* ---------- Today: next and ended entries; plan items past midnight ---------- */
.today-entry.is-next {
  background: var(--color-primary-soft);
  box-shadow: inset 4px 0 0 var(--color-primary);
}

.today-entry.is-next .plan-title {
  font-weight: 700;
}

.today-entry.is-ended .plan-time,
.today-entry.is-ended .today-main {
  opacity: 0.5;
}

.next-label {
  display: inline-block;
  margin-top: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--color-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.next-day {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-muted);
  white-space: nowrap;
}

/* ---------- notes (trip-notes.js) ---------- */
.notes-add {
  width: 100%;
  margin-bottom: 12px;
}

.notes-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
}

.notes-list li + li {
  border-top: 1px solid var(--color-border);
}

.note-row {
  display: grid;
  gap: 2px;
  min-height: 56px;
  padding: 10px 14px;
  color: var(--color-text);
  text-decoration: none;
}

.note-row-title {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.note-row-preview {
  overflow: hidden;
  font-size: 14px;
  color: var(--color-muted);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.note-title {
  margin-bottom: 10px;
  overflow-wrap: anywhere;
}

.note-title.is-untitled {
  color: var(--color-muted);
}

.note-body {
  padding: 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  font-size: 17px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.note-body a {
  font-weight: 600;
}

.note-updated {
  margin-top: 6px;
  font-size: 13px;
  color: var(--color-muted);
}

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

.note-editor {
  display: grid;
  gap: 10px;
}

.note-editor-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.note-status {
  font-size: 14px;
  color: var(--color-muted);
}

.note-title-input {
  font-size: 20px;
  font-weight: 700;
}

.note-body-input {
  min-height: 50vh;
  font-size: 17px;
  line-height: 1.5;
}

/* Big text: the whole screen, white, large letters */
.modal.big-text {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  border-radius: 0;
}

.big-text .modal-box {
  min-height: 100%;
  padding: 56px 20px 24px;
}

.big-text-close {
  position: fixed;
  top: 8px;
  right: 8px;
}

.big-text-title {
  margin-bottom: 12px;
  font-size: 30px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.big-text-body {
  font-size: 34px;
  font-weight: 600;
  line-height: 1.35;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ---------- password lock (export-dialog.js, import-dialog.js) ---------- */
.link-button {
  min-height: var(--tap);
  margin-top: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-primary);
  font: inherit;
  font-weight: 600;
  text-align: left;
  text-decoration: underline;
  cursor: pointer;
}

.password-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.password-row .input {
  flex: 1;
  min-width: 0;
}

.password-toggle {
  color: var(--color-primary);
}

.password-spacer {
  flex: none;
  width: var(--tap);
}

/* ---------- Kas naujo (whats-new.js, home.js) ---------- */
.news-strip .icon {
  color: var(--color-primary);
}

.news-strip-link {
  color: var(--color-text);
  font-weight: 600;
  text-decoration: underline;
}

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

.news-item {
  padding: 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
}

.news-item.is-current {
  border-color: var(--color-primary);
}

.news-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 10px;
  margin-bottom: 4px;
}

.news-version {
  font-weight: 700;
}

.news-date {
  font-size: 14px;
  color: var(--color-muted);
}

.news-strip {
  background: var(--color-primary-soft);
  color: var(--color-text);
}

/* ---------- top bar ⚙, Nustatymai (settings.js), backup import ---------- */
.topbar-end {
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar-icon {
  display: grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  border-radius: 999px;
  color: inherit;
}

.topbar-icon[aria-current="page"] {
  background: rgba(255, 255, 255, 0.16);
}

.settings-card {
  display: grid;
  justify-items: start;
  gap: 10px;
  margin-bottom: 12px;
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
}

.settings-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
}

.settings-title .icon {
  color: var(--color-primary);
}

.settings-text {
  line-height: 1.45;
}

.settings-text.muted {
  font-size: 14px;
  color: var(--color-muted);
}

.settings-lang {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.settings-link {
  display: block;
  min-height: var(--tap);
  padding: 12px 4px;
  font-weight: 600;
}

.backup-list {
  display: grid;
  gap: 10px;
  max-height: 50vh;
  margin: 12px 0 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.backup-item {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.backup-name {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.backup-details,
.backup-exists {
  font-size: 14px;
  color: var(--color-muted);
}

.backup-exists {
  font-weight: 600;
  color: #7a4a06;
}
