/* Trip spending — tool styles. Base tokens and components come from
   assets/base.css, inlined at build time. */

.trip {
  max-width: 960px;

  /* Chart colours: six category groups, in the validated categorical order
     so neighbouring segments in a stack stay distinguishable */
  --group-travel: #2a78d6;
  --group-stay: #eb6834;
  --group-food: #1baf7a;
  --group-activities: #eda100;
  --group-shopping: #e87ba4;
  --group-other: #008300;
  --chart-grid: #e1e0d9;
  --chart-axis: #c3c2b7;
  --chart-ink: var(--grey-dark);
}

.trip__intro {
  color: var(--grey-mid);
  margin: 0 0 1.5rem;
}

.trip__section {
  margin-top: 2.5rem;
}

.trip__section-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.75rem;
}

.trip__section-header h2 {
  margin: 0;
}

.trip__note {
  color: var(--grey-mid);
  font-size: 0.875rem;
  margin: 0.5rem 0 0;
}

/* Loader */

.dropzone {
  border: 2px dashed var(--grey-mid);
  border-radius: 3px;
  padding: 2rem 1.25rem;
  text-align: center;
  background: var(--grey-bg);
}

.dropzone--over {
  border-color: var(--accent);
  background: var(--accent-tint);
}

.dropzone__text {
  margin: 0 0 1rem;
}

.dropzone__hint {
  color: var(--grey-mid);
  font-size: 0.875rem;
  margin: 1rem 0 0;
}

.link-button {
  font: inherit;
  color: var(--black);
  background: none;
  border: none;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  cursor: pointer;
}

.link-button:hover {
  color: var(--accent);
}

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

/* Loaded trip bar */

.trip-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--grey-light);
}

.trip-bar__name {
  font-weight: 600;
  margin: 0;
}

.trip-bar__dates {
  color: var(--grey-mid);
  font-size: 0.875rem;
  margin: 0;
}

.trip-bar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.trip-bar__toggle[aria-pressed="true"] {
  color: var(--white);
  background: var(--black);
}

.trip-bar__toggle[aria-pressed="true"]:hover {
  background: var(--grey-dark);
}

.trip__lead {
  margin: 1.5rem 0 0;
  color: var(--grey-dark);
}

/* Checkbox option */

.check {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0 0 1rem;
  font-size: 0.875rem;
  cursor: pointer;
}

.check__input {
  width: 1.1rem;
  height: 1.1rem;
  margin: 0.1rem 0 0;
  flex: none;
  accent-color: var(--black);
  cursor: pointer;
}

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

/* Headline figures */

.figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 1rem;
  margin: 1.5rem 0 0;
}

.figure {
  margin: 0;
}

.figure__label {
  color: var(--grey-mid);
  font-size: 0.875rem;
}

.figure__value {
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.2;
  margin: 0;
}

.figure--hero .figure__value {
  font-size: 2.75rem;
}

.figure__note {
  color: var(--grey-mid);
  font-size: 0.875rem;
  margin: 0;
}

/* Category chips */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font: inherit;
  font-size: 0.875rem;
  color: var(--black);
  background: var(--white);
  border: 2px solid var(--black);
  border-radius: 3px;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
}

.chip:hover {
  border-color: var(--grey-dark);
  background: var(--grey-bg);
}

.chip:active {
  background: var(--grey-light);
}

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

.chip--off {
  color: var(--grey-mid);
  border-color: var(--grey-light);
  text-decoration: line-through;
}

.chip__amount {
  color: var(--grey-mid);
}

.chips__reset {
  align-self: center;
  font-size: 0.875rem;
}

.swatch {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 2px;
  flex: none;
}

.chip--off .swatch {
  opacity: 0.3;
}

.swatch--travel, .chart__fill--travel { background: var(--group-travel); fill: var(--group-travel); }
.swatch--stay, .chart__fill--stay { background: var(--group-stay); fill: var(--group-stay); }
.swatch--food, .chart__fill--food { background: var(--group-food); fill: var(--group-food); }
.swatch--activities, .chart__fill--activities { background: var(--group-activities); fill: var(--group-activities); }
.swatch--shopping, .chart__fill--shopping { background: var(--group-shopping); fill: var(--group-shopping); }
.swatch--other, .chart__fill--other { background: var(--group-other); fill: var(--group-other); }

/* Legend */

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin: 0 0 0.75rem;
  padding: 0;
  list-style: none;
  font-size: 0.875rem;
  color: var(--grey-dark);
}

.legend__item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* Segmented toggle */

.segmented {
  display: inline-flex;
  border: 2px solid var(--black);
  border-radius: 3px;
}

.segmented__option {
  font: inherit;
  font-size: 0.875rem;
  color: var(--black);
  background: var(--white);
  border: none;
  padding: 0.25rem 0.75rem;
  cursor: pointer;
}

.segmented__option + .segmented__option {
  border-left: 2px solid var(--black);
}

.segmented__option:hover {
  background: var(--grey-bg);
}

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

.segmented__option[aria-pressed="true"] {
  color: var(--white);
  background: var(--black);
}

/* Charts (SVG) */

.chart {
  position: relative;
}

.chart__svg {
  display: block;
  width: 100%;
  overflow: visible;
}

.chart__svg:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

.chart__grid {
  stroke: var(--chart-grid);
  stroke-width: 1;
}

.chart__axis {
  stroke: var(--chart-axis);
  stroke-width: 1;
}

.chart__tick {
  fill: var(--grey-mid);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.chart__label {
  fill: var(--black);
  font-size: 14px;
}

.chart__value {
  fill: var(--grey-dark);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.chart__bar {
  fill: var(--chart-ink);
}

.chart__row {
  cursor: pointer;
}

.chart__row:hover .chart__label,
.chart__row--active .chart__label {
  fill: var(--accent);
  text-decoration: underline;
}

.chart__row:focus-visible {
  outline: none;
}

.chart__row:focus-visible .chart__hit {
  stroke: var(--accent);
  stroke-width: 3;
}

.chart__hit {
  fill: transparent;
}

.chart__column {
  cursor: pointer;
}

.chart__column-hover {
  fill: var(--grey-bg);
  opacity: 0;
}

.chart__column--active .chart__column-hover {
  opacity: 1;
}

.chart__column--selected .chart__column-hover {
  opacity: 1;
  fill: var(--accent-tint);
}

.chart__country-line {
  stroke: var(--grey-mid);
  stroke-width: 2;
}

.chart__country-label {
  fill: var(--grey-dark);
  font-size: 12px;
}

.tooltip {
  position: absolute;
  z-index: 2;
  min-width: 11rem;
  max-width: 15rem;
  padding: 0.5rem 0.75rem;
  background: var(--white);
  border: 2px solid var(--black);
  border-radius: 3px;
  font-size: 0.8125rem;
  pointer-events: none;
}

.tooltip__title {
  font-weight: 600;
  margin: 0;
}

.tooltip__total {
  margin: 0 0 0.35rem;
}

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

.tooltip__item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.tooltip__item-value {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

/* Expense list */

.expenses__status {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1rem;
  margin: 0 0 0.75rem;
}

.expenses__summary {
  margin: 0;
}

.expenses__scroll {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table__head {
  text-align: left;
  color: var(--grey-mid);
  font-weight: normal;
  border-bottom: 2px solid var(--black);
  padding: 0.35rem 0.5rem 0.35rem 0;
  white-space: nowrap;
}

.table__cell {
  border-bottom: 1px solid var(--grey-light);
  padding: 0.35rem 0.5rem 0.35rem 0;
  vertical-align: top;
}

.table__cell--nowrap {
  white-space: nowrap;
}

.table__head--number,
.table__cell--number {
  text-align: right;
  padding-right: 0;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.table__detail {
  display: block;
  color: var(--grey-mid);
}

.tag {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0 0.3rem;
  border: 1px solid var(--grey-mid);
  border-radius: 3px;
  color: var(--grey-mid);
  font-size: 0.75rem;
  white-space: nowrap;
}

.daily-table {
  margin-top: 1rem;
}

.daily-table__summary {
  cursor: pointer;
  font-size: 0.875rem;
}

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

@media (max-width: 600px) {
  .figures {
    grid-template-columns: 1fr 1fr;
  }

  .figure--hero {
    grid-column: 1 / -1;
  }

  .table__cell--country,
  .table__head--country {
    display: none;
  }
}
