.app-rail-footer {
  padding: 0.25rem 0;
}

.app-rail-footer-item {
  position: relative;
}

/* Gleiche Zeile wie .app-rail-link — nur Button-Reset */
.app-rail-link.app-rail-settings-btn {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-weight: inherit;
  line-height: inherit;
  color: inherit;
}

.app-rail-settings-panel {
  position: absolute;
  left: 0.25rem;
  right: 0.25rem;
  bottom: calc(100% + 6px);
  width: min(360px, calc(100vw - 1.5rem));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
  z-index: 30;
}

/* Darstellung: Scroll nur wenn der Inhalt den Platz oberhalb des Footers sprengt */
#rail-account #display-settings-panel.app-rail-settings-panel {
  max-height: calc(100dvh - 8rem);
  overflow-y: auto;
  z-index: 45;
}

body.rail-collapsed #rail-account #display-settings-panel.app-rail-settings-panel {
  max-height: calc(100dvh - 1.25rem);
  left: calc(100% + 8px);
  right: auto;
  width: min(360px, calc(100vw - 4rem));
  bottom: 0.35rem;
}

html[data-theme="dark"] .app-rail-settings-panel {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

body.rail-collapsed .app-rail-footer-item .app-rail-settings-panel {
  left: calc(100% + 8px);
  right: auto;
  width: min(360px, calc(100vw - 4rem));
  bottom: 0;
}

.display-settings-reset {
  display: block;
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.display-settings-reset:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.display-settings-heading {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.display-settings-block {
  margin-bottom: 0.85rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.display-settings-block--last {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.display-settings-block > strong {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.display-segmented {
  display: grid;
  gap: 6px;
}

.display-segmented--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.display-segmented--4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.display-segmented--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.display-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 58px;
  padding: 6px 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-weight: inherit;
  line-height: 1.2;
  font-size: 11px;
  cursor: pointer;
  text-align: center;
}

.display-option-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: var(--muted);
}

.display-option-icon svg {
  width: 22px;
  height: 22px;
}

.display-option.is-active {
  border-color: #2b8bb1;
  background: #e8f4f9;
  color: #1e5f7a;
  font-weight: 600;
}

.display-option.is-active .display-option-icon {
  color: #2b8bb1;
}

html[data-theme="dark"] .display-option.is-active {
  background: rgba(43, 139, 177, 0.18);
  border-color: #3da5cf;
  color: #b8e6ff;
}

html[data-theme="dark"] .display-option.is-active .display-option-icon {
  color: #7dd3fc;
}

.display-option:hover:not(.is-active) {
  border-color: var(--accent);
}

.app-rail-settings-panel.app-rail-legal-panel {
  left: 0.75rem;
  right: 0.75rem;
  width: auto;
  max-width: none;
  max-height: none;
  padding: 0.35rem;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  bottom: calc(100% + 4px);
}

html[data-theme="dark"] .app-rail-settings-panel.app-rail-legal-panel {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.app-rail-legal-panel:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.app-rail-legal-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.38rem 0.45rem;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.25;
  color: var(--text);
  text-decoration: none;
}

.app-rail-legal-link:hover {
  background: var(--surface-muted, rgba(0, 0, 0, 0.04));
  color: var(--accent);
}

.app-rail-legal-link--btn {
  width: 100%;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}

.app-rail-legal-ext {
  font-size: 10px;
  opacity: 0.45;
  line-height: 1;
}

@media (max-width: 768px) {
  .app-rail-settings-panel {
    position: fixed;
    left: 50%;
    right: auto;
    bottom: auto;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(360px, calc(100vw - 2rem));
    max-height: min(85vh, 560px);
  }
