/* Settings page: lists (categories, payment methods), account and privacy. */

/* Categories and payment methods: one group per list, each name as a chip */

.list-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.list-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
}

.list-group .group-title {
  margin: 0;
}

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

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0;
  max-width: 100%;
  padding: 3px 4px 3px 11px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--panel);
  font-size: 14px;
}

.chip > span {
  overflow-wrap: anywhere;
}

.chip-button {
  display: grid;
  place-items: center;
  width: 24px;
  height: 28px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
}

.chip-button:hover:not(:disabled) {
  transform: none;
  background: var(--soft);
  color: var(--ink);
}

.chip-button.remove:hover:not(:disabled) {
  color: var(--red);
}

.chip-add {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

.chip-add input {
  flex: 1;
  min-width: 0;
}

/* 13th-month salary: column only when there is one */
.year-table.no-thirteenth #thirteenthHead,
.year-table.no-thirteenth td.computed {
  display: none;
}

/* 13th-month salary per year: calculated, not typed in */
.year-table td.computed {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* 13th-month salary: switch "sparen" left of the amount (only when it is paid in Nov/Dec) */
.year-table td:first-child {
  white-space: nowrap;
}

.year-table td:first-child {
  white-space: nowrap;
}

/* Only on phones (see responsive.css): small title above the amount, short switch label */
.thirteenth-title,
.thirteenth-save .short-label {
  display: none;
}

.thirteenth-cell {
  display: flex;
  align-items: center;
  gap: 14px;
}

.year-table .thirteenth-save {
  display: none;
  gap: 10px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.year-table.thirteenth-paid .thirteenth-save {
  display: inline-flex;
}

/* Account and privacy */

.note a {
  color: var(--ink);
  font-weight: 600;
  text-underline-offset: 3px;
}

.danger.delete-account {
  border: 1px solid var(--danger-line);
  border-radius: 10px;
  padding: 11px 14px;
  font-weight: 650;
}

.delete-sent {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--good-soft);
  color: var(--green);
  font-size: 14px;
}

/* Allowances */

.allowance-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.allowance {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.allowance.on {
  border-color: color-mix(in srgb, var(--brand) 35%, var(--line));
  background: color-mix(in srgb, var(--brand-soft) 40%, var(--panel));
}

.allowance-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.allowance-head .switch {
  flex: 1;
  min-width: 0;
}

/* Yearly allowance: in which pay month it comes */
.allowance-month {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--label);
  font-size: 13px;
  white-space: nowrap;
}

.allowance-month select {
  width: auto;
  min-height: 36px;
  padding-top: 6px;
  padding-bottom: 6px;
  font-size: 14px;
}

/* Monthly or yearly */
.allowance-per {
  width: auto;
  min-height: 36px;
  padding-top: 6px;
  padding-bottom: 6px;
  font-size: 14px;
}

.allowance-head .allowance-rename {
  min-width: 36px;
  min-height: 36px;
  padding: 4px 8px;
  font-size: 15px;
}

.allowance-head .danger {
  min-height: 36px;
  padding: 4px 6px;
  font-size: 13px;
}

/* Per apprentice year: amount and "of which saved" */
.allowance-years {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.allowance-year {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 8px;
  padding: 10px;
  border-radius: 10px;
  background: var(--panel);
}

.allowance-year b {
  grid-column: 1 / -1;
  font-size: 13px;
}

.allowance-year label {
  display: grid;
  gap: 4px;
  color: var(--label);
  font-size: 12px;
}

.allowance-year input {
  min-height: 40px;
  padding: 8px;
}

/* Tabs at the top of the settings */

.settings-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 4px;
  padding: 4px;
  overflow-x: auto;
  border-radius: 12px;
  background: var(--soft);
  scrollbar-width: none;
}

.settings-tabs::-webkit-scrollbar {
  display: none;
}

.settings-tabs button {
  flex: 1 0 auto;
  min-height: 40px;
  padding: 8px 14px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.settings-tabs button:hover:not(:disabled) {
  transform: none;
  color: var(--ink);
}

.settings-tabs button.active {
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow-small);
}

.tab-hidden {
  display: none !important;
}

/* Accounts (settings) */

.account-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.account-row {
  display: grid;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: 14px;
  background: var(--panel);
}

.account-row.saving {
  border-left-color: var(--orange);
}

/* Name, balance today and buttons in one line */
.account-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
}

.account-row-name {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.account-row-name b {
  font-size: 16px;
  overflow-wrap: anywhere;
}

.account-today {
  display: grid;
  justify-items: end;
  gap: 1px;
}

.account-today small {
  color: var(--muted);
  font-size: 12px;
}

.account-today strong {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.account-row.spending .account-today strong {
  color: var(--green);
}

.account-row.saving .account-today strong {
  color: var(--orange-text);
}

.account-badge {
  justify-self: start;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 650;
}

.account-badge.spending {
  background: color-mix(in srgb, var(--red) 14%, var(--panel));
  color: var(--red);
}

.account-badge.saving {
  background: var(--warn-soft);
  color: var(--warn-text);
}

/* Opening balance: pay month and amount in a soft box */
.account-start {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--soft);
}

.account-start > label {
  color: var(--label);
  font-size: 13px;
  font-weight: 600;
}

.account-start-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.account-start-row select {
  width: 100%;
  min-height: 40px;
  padding-top: 6px;
  padding-bottom: 6px;
  font-size: 14px;
}

/* Amount with "CHF" in front */
.money-field {
  position: relative;
  display: block;
}

.money-field > span {
  position: absolute;
  top: 50%;
  left: 11px;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 13px;
  pointer-events: none;
}

.money-field input {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px 8px 44px;
  font-variant-numeric: tabular-nums;
}

.account-row .actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  min-width: 130px; /* same place for the balance, with or without "Löschen" */
}

.account-row .actions button {
  min-height: 36px;
  padding: 6px 10px;
  font-size: 13px;
}

.account-row .icon-button {
  min-width: 36px;
  font-size: 15px;
}

/* Headings inside a card: show what belongs together */
.group-title {
  margin: 4px 0 2px;
  font-size: 15px;
}

@media (max-width: 560px) {
  /* Phone: name and buttons on top, balance below */
  .account-head {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "name actions" "today today";
    gap: 8px 10px;
  }

  .account-row-name {
    grid-area: name;
  }

  .account-row .actions {
    grid-area: actions;
  }

  .account-row .actions {
    min-width: 0;
  }

  .account-start-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .account-today {
    grid-area: today;
    grid-template-columns: auto auto;
    justify-content: space-between;
    align-items: baseline;
  }
}

/* "Start tour" in the appearance settings */
.tour-row {
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.tour-row .note {
  flex: 1 1 220px;
  margin: 0;
}

.chip-add button {
  min-height: 0;
  padding: 8px 12px;
  font-size: 14px;
}

/* Settings → Profile: help and legal pages */
.help-links {
  display: grid;
  gap: 2px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.help-links li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.help-links li:last-child {
  border-bottom: 0;
}

.help-links a {
  color: var(--ink);
  font-weight: 650;
  text-underline-offset: 3px;
}

.help-links .note {
  margin: 0;
  font-size: 13px;
}
