/* Inställningar: tät lista med etikett till vänster och fält till höger, en Spara-knapp längst ned */

.page-sub { font-size: 13px; color: var(--text-2); }

.pref-card { display: flex; flex-direction: column; gap: 4px; max-width: 720px; padding: 8px 18px 14px; }

.pref-section { display: flex; flex-direction: column; padding: 10px 0 6px; }
.pref-section + .pref-section { border-top: 1px solid var(--line); }
.pref-section h2 { margin-bottom: 4px; font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }

.pref-row { display: grid; grid-template-columns: 140px minmax(0, 1fr); align-items: center; gap: 12px; min-height: 44px; }
.pref-row > label, .pref-label { font-size: 13.5px; color: var(--text-2); }
.pref-row .field { height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
select.field { appearance: auto; }
.pref-inline { display: flex; gap: 8px; min-width: 0; }
.pref-inline .field { flex: 1; min-width: 0; }
.pref-inline .btn { height: 36px; padding: 0 14px; font-size: 13px; flex-shrink: 0; }
.pref-note { margin: 2px 0 4px 152px; font-size: 12px; line-height: 1.5; color: var(--text-3); }
.pref-note a { color: var(--accent); }

/* Personer i hushållet: namn och yrke under varandra */
.people { display: flex; flex-direction: column; gap: 12px; }
.person + .person { padding-top: 12px; border-top: 1px dashed var(--line); }
.person { display: grid; grid-template-columns: 140px minmax(0, 1fr) 28px; align-items: start; gap: 12px; }
.person-tag { padding-top: 9px; font-size: 13.5px; color: var(--text-2); }
.person-fields { display: flex; flex-direction: column; gap: 6px; }
.person-fields .field { height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.person-remove { display: grid; place-items: center; width: 28px; height: 28px; margin-top: 4px; border: 0; border-radius: 50%; background: none; color: var(--text-3); cursor: pointer; }
.person-remove:hover { background: var(--subtle); color: var(--warning-text); }
.person-static { display: flex; flex-direction: column; justify-content: center; min-height: 36px; padding: 0 12px; border: 1px dashed var(--line); border-radius: 10px; }
.person-static strong { font-size: 14px; font-weight: 500; }
.person-static small { font-size: 11.5px; color: var(--text-3); }
.add-person { align-self: flex-start; margin: 6px 0 0 152px; padding: 6px 0; border: 0; background: none; color: var(--text-2); font-size: 13px; cursor: pointer; }
.add-person:hover { color: var(--accent); }

/* Dela ekonomin */
.pref-note-full { margin-left: 0; }
.household { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.hh-list { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; }
.hh-member, .hh-request { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 4px 6px; border-radius: 10px; }
.hh-requests .hh-request { background: var(--accent-tint); }
.hh-avatar { display: grid; place-items: center; flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%; background: var(--subtle); color: var(--text); font-size: 13px; font-weight: 600; }
.hh-avatar.is-new { background: var(--accent); color: #FFFFFF; }
.hh-who { display: flex; flex-direction: column; min-width: 0; margin-right: auto; font-size: 13.5px; }
.hh-who small { overflow: hidden; font-size: 11.5px; color: var(--text-3); text-overflow: ellipsis; white-space: nowrap; }
.hh-you { color: var(--text-3); font-weight: 400; }
.hh-badge { padding: 2px 8px; border-radius: 999px; background: var(--subtle); color: var(--text-2); font-size: 11px; }
.hh-remove { width: 28px; height: 28px; border: 0; border-radius: 50%; background: none; color: var(--text-3); cursor: pointer; }
.hh-remove:hover { background: var(--subtle); color: var(--warning-text); }
.hh-request .btn { height: 30px; padding: 0 12px; font-size: 12.5px; }
.hh-box { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--subtle); font-size: 13px; line-height: 1.5; }
.hh-box.is-waiting { border-color: var(--accent); background: var(--accent-tint); }
.hh-box .btn { align-self: flex-start; height: 32px; padding: 0 14px; font-size: 12.5px; }
.hh-invite { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px 12px; border: 1px solid var(--accent); border-radius: 14px; background: var(--accent-tint); }
.hh-invite-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.hh-invite-label { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
.hh-invite-expires { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.hh-code-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 8px 8px 14px; border: 1px dashed var(--line-strong); border-radius: 10px; background: var(--surface); }
.hh-code { font-family: var(--font-mono); font-size: 24px; font-weight: 600; letter-spacing: .1em; color: var(--accent); }
.hh-copy { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--subtle); color: var(--text-2); font: 500 12.5px var(--font-sans); cursor: pointer; }
.hh-copy:hover { color: var(--text); border-color: var(--line-strong); }
.hh-invite-text { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--text-2); }
.hh-invite-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.hh-invite-actions .btn { height: 34px; padding: 0 16px; font-size: 13px; }
.hh-revoke { margin-left: auto; font-size: 12.5px; color: var(--text-3); }
.hh-revoke:hover { color: var(--warning-text); }
.hh-join label { font-size: 12.5px; color: var(--text-2); }
.hh-code-input { font-family: var(--font-mono); letter-spacing: .1em; text-transform: uppercase; }
.hh-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.hh-choice { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--subtle); color: var(--text); text-align: left; cursor: pointer; transition: border-color .15s, background .15s; }
.hh-choice:hover { border-color: var(--accent); background: var(--accent-tint); }
.hh-choice strong { font-size: 13.5px; font-weight: 600; }
.hh-choice span { font-size: 12px; line-height: 1.45; color: var(--text-2); }
.hh-choice[data-invite] strong { color: var(--accent); }
.hh-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.hh-actions .btn { height: 32px; padding: 0 14px; font-size: 12.5px; }
.hh-leave { margin-left: auto; color: var(--warning-text); }
.hh-actions:empty { display: none; }

/* Spara-raden */
.pref-save { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 6px; padding: 10px 12px; border-radius: 12px; background: var(--subtle); }
.pref-save-text { margin-right: auto; font-size: 12.5px; color: var(--text-3); }
.pref-save.is-dirty { background: var(--accent-tint); }
.pref-save.is-dirty .pref-save-text { color: var(--text); }
.pref-save .btn { height: 34px; padding: 0 16px; font-size: 13px; }
.pref-save.is-flashing { animation: save-flash .5s ease-in-out 3; }
@keyframes save-flash {
  50% { box-shadow: 0 0 0 3px var(--accent); transform: scale(1.015); }
}

/* Ta bort konto: hopfällt längst ned */
.pref-danger { margin-top: 6px; padding: 10px 0 2px; border-top: 1px solid var(--line); }
.pref-danger summary { font-size: 13px; color: var(--warning-text); cursor: pointer; list-style-position: inside; }
.danger-body { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; margin-top: 10px; padding: 14px; border: 1px solid var(--warning-border); border-radius: 12px; background: var(--warning-bg); }
.danger-body p { font-size: 12.5px; line-height: 1.5; color: var(--text-2); }
.danger-body .btn { height: 34px; padding: 0 16px; font-size: 13px; }
.danger-body .btn:disabled { opacity: .45; cursor: not-allowed; }

.check { display: flex; align-items: center; gap: 10px; font-size: 13px; line-height: 1.4; cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--warning); flex-shrink: 0; }

@media (max-width: 600px) {
  .pref-card { padding: 2px 12px 10px; }
  .pref-section { padding: 8px 0 4px; }
  .pref-section h2 { margin-bottom: 2px; font-size: 9.5px; }
  .pref-row { grid-template-columns: 78px minmax(0, 1fr); gap: 8px; min-height: 36px; }
  .pref-row > label, .pref-label { font-size: 12px; }
  .pref-row .field, .person-fields .field { height: 32px; padding: 0 10px; font-size: 13.5px; border-radius: 9px; }
  .pref-inline .btn { height: 32px; padding: 0 12px; font-size: 12.5px; }
  .pref-note { margin: 2px 0 2px; font-size: 11px; }
  .people { gap: 8px; }
  .person + .person { padding-top: 8px; }
  .person { grid-template-columns: 78px minmax(0, 1fr) 24px; gap: 8px; }
  .person-tag { padding-top: 7px; font-size: 12px; }
  .person-fields { gap: 4px; }
  .person-remove { width: 24px; height: 24px; margin-top: 4px; }
  .add-person { margin: 2px 0 0 86px; font-size: 12px; }
  #backup-card .pref-row { grid-template-columns: 1fr; gap: 6px; padding-bottom: 4px; }
  #backup-card .pref-inline .btn { flex: 1; }
  .pref-save { padding: 8px 10px; }
  .pref-save .btn { height: 32px; font-size: 12.5px; }
  .pref-save-text { font-size: 11.5px; }
  .pref-save { position: sticky; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 5; box-shadow: var(--shadow-pop); }
  .pref-save:not(.is-dirty) { position: static; box-shadow: none; }
  .pref-danger summary { font-size: 12px; }
  .hh-invite { padding: 12px 12px 10px; }
  .hh-invite-actions .btn { flex: 1 1 0; }
  .hh-revoke { flex-basis: 100%; margin: 2px 0 0; text-align: center; }
  .hh-choices { grid-template-columns: 1fr; }
  .hh-code { font-size: 22px; }
  .hh-request { flex-wrap: wrap; }
  .hh-request .hh-who { flex-basis: calc(100% - 40px); }
  .hh-request .btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) { .pref-save.is-flashing { animation: none; box-shadow: 0 0 0 3px var(--accent); } }

/* Profilbild */
.avatar-edit { display: flex; align-items: center; gap: 12px; min-height: 52px; }
.avatar-edit .avatar-lg { width: 44px; height: 44px; }
.avatar-pick { position: relative; height: 34px; padding: 0 14px; font-size: 13px; cursor: pointer; }
.avatar-pick:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.avatar-edit .link-button { font-size: 13px; color: var(--text-3); }
