.view-title-name:not(:empty)::before {
  content: "— ";
  font-weight: 500;
  color: var(--ink-muted);
}

.view-title-name {
  font-weight: 600;
  color: var(--ink);
}

/* Shell background/layout: .panel-page / .account-app / .account-main in styles.css */

.account-hero {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem 1.25rem;
  align-items: center;
  background: linear-gradient(180deg, var(--surface-elevated) 0%, var(--panel) 100%);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 1.35rem 1.4rem;
}

.account-avatar {
  width: 3.4rem;
  height: 3.4rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: Literata, Georgia, serif;
  font-weight: 700;
  font-size: 1.45rem;
  color: var(--btn-on-accent);
  background: linear-gradient(145deg, var(--accent) 0%, var(--accent-mid) 60%, var(--accent-warm) 120%);
}

.account-kicker {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-muted);
  font-weight: 600;
}

.account-hero h2 {
  margin: 0;
  font-family: Literata, Georgia, serif;
  font-size: 1.7rem;
  letter-spacing: -0.02em;
}

.account-name-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0.15rem 0 0.25rem;
  min-width: 0;
}

.account-name-row h2 {
  margin: 0;
  min-width: 0;
}

.btn-name-edit {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn-name-edit:hover,
.btn-name-edit:focus-visible {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: rgba(var(--accent-rgb), 0.2);
  outline: none;
}

.account-meta {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.9rem;
}

.field-hint {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.8rem;
  color: var(--ink-muted);
  line-height: 1.35;
  font-weight: 400;
}

.smtp-status-ok {
  color: var(--accent-hover, #0f766e);
  font-weight: 600;
}

.smtp-status-bad {
  color: #9f1239;
  font-weight: 600;
}

.account-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: flex-end;
}

.account-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.stat-card {
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1.05rem;
  display: grid;
  gap: 0.2rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

a.stat-card:hover {
  border-color: rgba(var(--accent-rgb), 0.4);
}

.stat-value {
  font-family: Literata, Georgia, serif;
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--accent);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--ink-muted);
  font-weight: 600;
}

.account-sections {
  display: grid;
  gap: var(--shell-gap, 1.15rem);
}

.account-panel {
  background: linear-gradient(180deg, var(--surface-elevated) 0%, var(--panel) 100%);
  border: 1px solid var(--line);
  border-radius: var(--card-radius, 14px);
  box-shadow: var(--shadow);
  padding: var(--card-pad, 1.15rem 1.25rem 1.25rem);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.account-panel[hidden] {
  display: none !important;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.panel-head h3 {
  margin: 0;
  font-family: Literata, Georgia, serif;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.panel-lead,
.account-admin-hint {
  margin: 0 0 1rem;
  color: var(--ink-muted);
  font-size: 0.9rem;
  line-height: 1.45;
  max-width: 42rem;
}

.panel-lead a,
.account-admin-hint a {
  color: var(--accent);
  font-weight: 600;
}

.password-form {
  gap: 0.75rem;
}

.password-form > .btn,
.password-form > .btn-primary {
  justify-self: start;
  width: auto;
  min-width: 10rem;
  margin-top: 0.2rem;
}

.pass-msg {
  margin: 0;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  font-size: 0.88rem;
}

.pass-msg.error {
  background: #fce7ef;
  color: #9f1239;
}

.pass-msg.ok {
  background: var(--accent-soft);
  color: var(--accent-hover);
}

@media (max-width: 860px) {
  .account-hero {
    grid-template-columns: auto 1fr;
  }

  .account-hero-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .account-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

.force-password-banner {
  margin: 0 0 0.85rem;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  border: 1px solid rgba(180, 83, 9, 0.35);
  background: rgba(251, 191, 36, 0.2);
  color: #92400e;
  font-weight: 600;
  font-size: 0.92rem;
}

body.force-password-mode .account-stats,
body.force-password-mode .account-hero,
body.force-password-mode #twofa-section {
  display: none !important;
}

body.force-password-mode .account-panel:not(#panel-haslo) {
  display: none !important;
}

.field-check span {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-weight: 600;
  color: var(--ink);
}

.perm-list {
  display: grid;
  gap: 0.65rem;
}

.perm-group {
  display: grid;
  gap: 0.2rem;
}

.perm-group-title {
  margin: 0 0 0.15rem;
  padding: 0.35rem 0 0.15rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
  border-bottom: 1px solid rgba(212, 203, 192, 0.7);
}

/* [ Nazwa uprawnienia .............. [☐] ]
   [ krótki opis                          ] */
.perm-item {
  display: grid;
  gap: 0.15rem;
  margin: 0;
  padding: 0.4rem 0.2rem;
  cursor: pointer;
  text-align: left;
  border-radius: 8px;
}

.perm-item:hover {
  background: rgba(var(--accent-rgb), 0.04);
}

.perm-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
}

.perm-item-label {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
  text-align: left;
}

.perm-item-row input[type="checkbox"] {
  flex: 0 0 auto;
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  accent-color: var(--accent, #0f5c4c);
}

.perm-item-hint {
  display: block;
  font-size: 0.82rem;
  font-weight: 400;
  line-height: 1.35;
  color: var(--ink-muted);
  text-align: left;
}

.perm-item.field,
.perm-item.field-check {
  /* override .field grid (label-above-input) used on forms */
  display: grid;
}

.perm-item.field > span,
.perm-item.field-check > span {
  display: contents;
}

.users-list {
  list-style: none;
  margin: 1.1rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.user-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.65rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-muted);
}

.user-row-add {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 0.5rem 0 0;
  padding: 0.75rem 0.85rem;
  min-height: 3.35rem;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--ink-muted);
  font: inherit;
  font-size: 0.94rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.user-row-add:hover,
.user-row-add:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.06);
  outline: none;
}

.modal-card {
  max-height: min(90vh, 720px);
  overflow: auto;
}

#create-user-modal .modal-card {
  width: min(480px, 100%);
}

.user-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.user-row-main {
  display: grid;
  gap: 0.12rem;
  min-width: 0;
}

.user-row-main strong {
  font-size: 0.94rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.user-online-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: rgba(var(--ink-rgb), 0.25);
  flex: 0 0 auto;
}

.user-online-dot.is-on {
  background: #22a06b;
}

.user-activity {
  margin-top: 0.65rem;
  padding-top: 0.55rem;
  border-top: 1px dashed var(--line);
}

.user-activity h4 {
  margin: 0 0 0.35rem;
  font-size: 0.88rem;
}

.user-activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 14rem;
  overflow: auto;
  font-size: 0.8rem;
  color: var(--ink-muted);
  display: grid;
  gap: 0.25rem;
}

.user-row-main span {
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.user-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  flex-shrink: 0;
}

.user-edit-form {
  display: grid;
  gap: 0.55rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--line);
}

.user-edit-form[hidden] {
  display: none !important;
}

.user-edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

/* .auth-form { display:grid } must not beat [hidden] on this page */
.account-page [hidden],
.account-page .is-hidden,
.totp-setup[hidden],
.totp-setup.is-hidden,
.auth-form[hidden],
.auth-form.is-hidden,
#totp-disable-form[hidden],
#totp-disable-form.is-hidden,
#totp-qr[hidden],
.pass-msg[hidden] {
  display: none !important;
}

.totp-setup {
  margin: 0.75rem 0 1rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-muted);
}

.totp-steps {
  margin: 0 0 0.85rem;
  padding-left: 1.2rem;
  color: var(--ink-muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.totp-steps li {
  margin-bottom: 0.35rem;
}

.totp-qr {
  display: block;
  margin: 0.5rem 0 0.75rem;
  border-radius: 8px;
  background: var(--surface);
}

.totp-secret {
  font-size: 0.85rem;
  color: var(--ink-muted);
  word-break: break-all;
  margin-bottom: 0.85rem;
}

.totp-secret code {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.totp-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.auth-2fa-hint {
  margin: 0 0 0.85rem;
  color: var(--ink-muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.perm-fieldset {
  margin: 0.35rem 0 0.75rem;
  padding: 0.65rem 0.75rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-muted);
}

.perm-fieldset legend {
  padding: 0 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-muted);
}

.perm-fieldset.is-disabled {
  opacity: 0.65;
}

/* —— Theme picker (Konto → Wygląd) —— */
.theme-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
  gap: 0.55rem;
}

.theme-option {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.55rem;
  row-gap: 0.05rem;
  align-items: center;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-muted);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.theme-option:hover {
  border-color: rgba(var(--accent-rgb), 0.4);
  background: var(--surface);
}

.theme-option[aria-checked="true"] {
  border-color: rgba(var(--accent-rgb), 0.55);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.12);
}

.theme-swatch {
  grid-row: 1 / span 2;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px rgba(var(--ink-rgb), 0.18);
}

.theme-option-label {
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.2;
}

.theme-option-hint {
  font-size: 0.75rem;
  color: var(--ink-muted);
  font-weight: 500;
}
