/* Account row — used on dashboard and accounts index */
.account-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--color-border);
  text-decoration: none;
  color: var(--color-text);
}

.account-row:last-child {
  border-bottom: none;
}

.account-row:hover {
  text-decoration: none;
  color: var(--color-text-secondary);
}

.account-row__name {
  font-weight: 500;
}

.account-row__balance {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: var(--text-lg);
  letter-spacing: -0.02em;
}

/* Period selector — preset buttons */
.period-selector {
  display: flex;
  justify-content: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.btn--active {
  background: var(--color-text);
  color: var(--color-bg);
}

/* Month navigation */
.month-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  padding: var(--space-4) 0;
  margin-bottom: var(--space-4);
}

.month-nav__current {
  font-weight: 600;
  min-width: 10rem;
  text-align: center;
}

/* Timeline — date-grouped movements */
.timeline-group {
  margin-bottom: var(--space-6);
}

.timeline-date {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-1);
}

.timeline-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: var(--space-3) 0;
  padding-left: var(--space-3);
  border-left: 2px dashed transparent;
  text-decoration: none;
  color: var(--color-text);
}

.timeline-item:hover {
  text-decoration: none;
  color: var(--color-text-secondary);
}

.timeline-item--skipped {
  color: var(--color-text-muted);
}

.timeline-item--unreconciled {
  border-left-color: var(--color-border);
  color: var(--color-text-secondary);
}

.pending-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border);
}

.pending-item__info {
  display: flex;
  flex-direction: column;
  flex: 1 1 100%;
}

.pending-item__edit {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.timeline-item__description {
  font-size: var(--text-base);
}

.timeline-item__right {
  text-align: right;
  flex-shrink: 0;
  margin-left: var(--space-4);
}

.timeline-item__amount {
  font-family: var(--font-mono);
  font-weight: 500;
  white-space: nowrap;
  display: block;
}

.timeline-item__balance {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  white-space: nowrap;
  display: block;
}

/* Movement detail — stacked key-value pairs */
.detail-list {
  margin-top: var(--space-6);
}

.detail-list dt {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-1);
}

.detail-list dd {
  margin-bottom: var(--space-4);
  font-size: var(--text-base);
}

/* Money input (POS-style) */
.money-input {
  width: 100%;
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: 0;
  background: var(--color-surface);
  font-family: var(--font-mono);
  font-size: var(--text-2xl);
  font-weight: 600;
  text-align: right;
  letter-spacing: 0.02em;
  caret-color: transparent;
}

.money-input:focus {
  outline: 2px solid var(--color-text);
  outline-offset: -2px;
}

.money-input::placeholder {
  font-weight: 400;
  color: var(--color-text-muted);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-4);
  color: var(--color-text-secondary);
}

.empty-state p {
  margin-bottom: var(--space-4);
}

/* Simple list — for categories etc */
.simple-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border);
}

.simple-list-item:last-child {
  border-bottom: none;
}

/* Floating action button */
.fab {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  left: var(--space-6);
  max-width: var(--content-width);
  margin: 0 auto;
  display: block;
  padding: var(--space-4);
  background: var(--color-text);
  color: var(--color-bg);
  text-align: center;
  text-decoration: none;
  font-weight: 600;
  font-size: var(--text-base);
  z-index: 50;
}

.fab-spacer {
  height: 5rem;
}

.fab:hover {
  background: var(--color-text-secondary);
  color: var(--color-bg);
  text-decoration: none;
}

/* Chip select — select + removable chips */
.chip-select__chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.chip-select__chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--color-border);
  font-size: var(--text-sm);
  background: var(--color-bg);
}

.chip-select__remove {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-size: var(--text-base);
  line-height: 1;
  color: var(--color-text-secondary);
}

.chip-select__remove:hover {
  color: var(--color-text);
}

/* Category chips — colored labels for a movement's categories */
.timeline-item__main {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}

.timeline-item__categories {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.category-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  white-space: nowrap;
}

.category-chip__dot {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  /* Square to match the flat, radius-0 aesthetic; color set inline. */
}

/* Movement category filter bar — toggleable chips above the timeline.
   Single scrollable row rather than wrapping; the edges fade only on whichever
   side still hides chips (fade vars driven by the filter-scroll controller). */
.movement-filter {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  overflow-x: auto;
  /* Hide the native scrollbar — the edge fade signals scrollability instead */
  scrollbar-width: none;
  -ms-overflow-style: none;
  --fade-left: 0px;
  --fade-right: 0px;
  -webkit-mask-image: linear-gradient(
    to right,
    transparent 0,
    #000 var(--fade-left),
    #000 calc(100% - var(--fade-right)),
    transparent 100%
  );
  mask-image: linear-gradient(
    to right,
    transparent 0,
    #000 var(--fade-left),
    #000 calc(100% - var(--fade-right)),
    transparent 100%
  );
}

.movement-filter::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  text-decoration: none;
  border: 1px solid var(--color-border);
  white-space: nowrap;
}

.filter-chip--active {
  color: var(--color-bg);
  background: var(--color-text);
  border-color: var(--color-text);
}

/* Running signed total for the shown movements, one amount per currency */
.movements-total {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
  font-size: var(--text-sm);
}

.movements-total__label {
  color: var(--color-text-secondary);
}

.movements-total__amount {
  font-family: var(--font-mono);
  font-weight: 600;
}

.movements-total__count {
  color: var(--color-text-muted);
  font-size: var(--text-xs);
}

/* Segmented control — radio inputs styled as a button group */
.segmented {
  display: flex;
  border: 1px solid var(--color-border);
}

.segmented__option {
  flex: 1;
}

.segmented__option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.segmented__option label {
  display: block;
  margin-bottom: 0;
  padding: var(--space-3);
  text-align: center;
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  border-right: 1px solid var(--color-border);
}

.segmented__option:last-child label {
  border-right: none;
}

.segmented__option input:checked + label {
  background: var(--color-text);
  color: var(--color-bg);
}

.segmented__option input:focus-visible + label {
  outline: 2px solid var(--color-text);
  outline-offset: -2px;
}

.segmented__option input:disabled + label {
  opacity: 0.4;
  cursor: not-allowed;
}
