.auth-card,
.account-page,
.dashboard-placeholder,
.error-page {
    background: var(--color-panel);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    width: 100%;
    max-width: 420px;
}

/* .error-page ist ausschliesslich im schmalen Gast-Layout (layout/guest, kein
   Sidebar) im Einsatz, bleibt daher bewusst schmal wie eine Auth-Karte. */
.error-page {
    max-width: 640px;
    margin: 0 auto;
}

/* Alle App-Layout-Seiten (mit Sidebar) füllen einheitlich .app-content-inner
   (80% der Seite, siehe layout.css) statt jede ihr eigenes max-width zu
   definieren — genau das sorgte vorher für unterschiedlich breite "Rahmen"
   je nach Seite (560px hier, 640px da, 960px dort). */
.account-page,
.dashboard-placeholder {
    max-width: 100%;
}

form label {
    display: block;
    font-weight: 600;
    margin: 1rem 0 0.35rem;
    font-size: 0.9rem;
}

form input[type="text"],
form input[type="email"],
form input[type="password"],
form select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    font-size: 1rem;
    background: var(--color-bg);
    color: var(--color-text);
}

form input:focus,
form select:focus {
    border-color: var(--color-primary);
    outline: none;
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.hint {
    font-size: 0.85rem;
    color: var(--color-muted);
    margin: 0.35rem 0 0;
}

.button {
    display: inline-block;
    padding: 0.65rem 1.25rem;
    border-radius: 0.5rem;
    border: 1px solid var(--color-primary);
    background: var(--color-panel);
    color: var(--color-primary);
    cursor: pointer;
    font-weight: 600;
    text-align: center;
}

.button-primary {
    background: var(--color-primary);
    color: #fff;
    margin-top: 1.5rem;
    width: 100%;
    border: 1px solid var(--color-primary);
}

.button-primary:hover {
    background: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
    text-decoration: none;
}

/* Gleiche Farben wie .button-primary, aber ohne die dortigen Form-spezifischen
   width:100%/margin-top — fuer Button-Paare außerhalb von Formularen (Startseite). */
.button-solid {
    background: var(--color-primary);
    color: #fff;
}

.button-solid:hover {
    background: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
    text-decoration: none;
}

.home-hero-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

.referral-code-box {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.85rem;
    border: 1px dashed var(--color-primary);
    border-radius: 0.5rem;
    background: var(--color-primary-light);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--color-primary-dark);
}

.connection-list {
    list-style: none;
    margin: 0.75rem 0 1.5rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.connection-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
}

/* Zeilen mit mehreren Aktionen (Level-Formular + Verwalten-Link + Entfernen,
   siehe teacher/connections.php) brauchen auf schmalen Screens mehr als die
   82px, die bei nowrap vom Flex-Rest uebrig bleiben -- flex-wrap oben laesst
   diese Zeile umbrechen, hier bekommt sie dann die volle Breite. */
@media (max-width: 600px) {
    .admin-actions-cell {
        flex-basis: 100%;
    }
}

.connection-item-name {
    font-weight: 600;
}

/* .button-small ist standardmäßig 100% breit (für die Admin-Aktion-Spalte
   gedacht) — hier in einer Zeile neben dem Namen soll er sich stattdessen
   an seinem Text orientieren. */
.connection-item .button-small {
    width: auto;
}

.inline-form {
    display: inline;
}

/* Fasst Code-Label, Code-Badge und Hinweistext zu einem ruhigen Block
   zusammen statt drei lose untereinanderstehende Absätze mit vollem
   Absatz-Abstand. */
.code-share-block {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
}

.code-share-block p {
    margin: 0;
}

.code-entry-form {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.code-entry-form input[type="text"],
.code-entry-form select {
    width: auto;
    min-width: 8rem;
}

/* Level-Auswahlboxen (z.B. "A1.2") tragen nur ganz kurzen Inhalt -- ohne
   diese Regel strecken sie sich (per .code-entry-form select bzw. der
   generischen "form select"-Regel) unnötig auf Container- bzw. Button-Breite.
   Fixe, kompakte Breite statt relativ, damit es in jedem Kontext (Formular
   in einer Zeile wie hier, oder gestapelt in .admin-actions-cell) gleich
   knapp aussieht. */
select.level-select {
    width: auto;
    min-width: 6rem;
    max-width: 6rem;
}

.code-entry-form .button-small {
    width: auto;
}

.admin-filter {
    width: 100%;
    max-width: 20rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    margin: 1rem 0;
    background: var(--color-bg);
    color: var(--color-text);
}

.admin-table-wrap {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.admin-table th,
.admin-table td {
    text-align: left;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--color-border);
    vertical-align: top;
}

.admin-roles-form {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
}

.admin-role-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    /* Überschreibt bewusst die generische "form label"-Regel weiter unten
       (margin: 1rem 0 ...) — die war für normale Formularfeld-Label gedacht,
       hat hier aber ungewollt 16px Abstand über jede Rollen-Checkbox gelegt. */
    margin: 0;
    font-weight: 400;
    white-space: nowrap;
}

.admin-actions-cell {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
}

.admin-actions-cell .inline-form {
    display: block;
    width: 100%;
}

/* .connection-item .button-small (oben) setzt width:auto fuer die einzeiligen
   Faelle -- innerhalb der gestapelten Aktionsspalte hier soll jeder Button
   aber wieder die volle Spaltenbreite bekommen, sonst richtet sich nur der
   Button ohne eigenes .inline-form-Sibling (z.B. "Save level" neben dem
   Level-Select) an seinem Text aus, waehrend "Manage Leitner"/"Remove"
   (per align-items:stretch) die volle Breite haben -- ungleich lange Buttons. */
.admin-actions-cell .button-small {
    width: 100%;
}

.button-small {
    display: inline-block;
    width: 100%;
    box-sizing: border-box;
    padding: 0.35rem 0.75rem;
    border-radius: 0.4rem;
    border: 1px solid var(--color-primary);
    background: var(--color-panel);
    color: var(--color-primary);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    text-align: center;
}

.button-small:hover {
    background: var(--color-primary-light);
    text-decoration: none;
}

.button-small-danger {
    border-color: var(--color-error);
    color: var(--color-error);
}

.button-small-danger:hover {
    background: var(--color-error-bg);
}

.admin-type-switch {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

/* Ohne diese Regel richtet sich .button-small (width: 100%) an seinem
   eigenen Inhalt aus -> "Basic"/"Medium"/"Premium" landen nebeneinander
   unterschiedlich breit. flex: 1 zwingt alle Geschwister auf gleiche Breite,
   unabhängig vom Label. */
.admin-type-switch .inline-form,
.admin-type-switch > a,
.admin-type-switch > button {
    flex: 1;
}

.link-button {
    background: none;
    border: none;
    color: var(--color-muted);
    cursor: pointer;
    padding: 0;
    font-size: 0.95rem;
}

.link-button:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

.auth-secondary-link {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.alert-success {
    background: var(--color-success-bg);
    color: #14532d;
}

.alert-error {
    background: var(--color-error-bg);
    color: #7f1d1d;
}

.account-summary {
    margin: 0;
}

.account-summary dt {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-muted);
    margin-top: 1rem;
}

.account-summary dd {
    margin: 0.15rem 0 0;
    font-size: 1.05rem;
}

.home-hero {
    text-align: center;
    max-width: 480px;
}

.home-hero h1 {
    font-size: 2.5rem;
    color: var(--color-primary);
}

.radio-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 400;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    cursor: pointer;
}

.radio-option:has(input:checked) {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

/* --- Leitner (Vokabeltrainer) --- */

.hidden {
    display: none !important;
}

.leitner-tab-active {
    background: var(--color-primary);
    color: #fff;
}

.leitner-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 1rem 0;
}

.leitner-day-label {
    font-weight: 600;
    color: var(--color-text);
}

.topbar-boxes {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.lang-label {
    color: var(--color-muted);
    font-size: 0.9rem;
}

.box-rect,
.box-rect-filled {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 600;
}

.box-rect {
    background: var(--color-panel);
    border: 2px solid var(--color-border);
    color: var(--color-muted);
}

.box-rect-filled {
    background: var(--color-primary);
    border: 2px solid var(--color-primary-dark);
    color: #fff;
}

.leitner-card {
    max-width: 560px;
    min-height: 260px;
    margin: 0 auto;
    padding: 1.5rem;
    background: var(--color-panel);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.leitner-card .meta {
    font-size: 0.85rem;
    color: var(--color-muted);
    margin-bottom: 0.5rem;
}

.leitner-card .term-main {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 0.5rem;
}

.leitner-card .term-translation {
    font-size: 1.3rem;
    color: var(--color-muted);
    margin-top: 0.4rem;
}

.leitner-card .card-actions {
    display: flex;
    justify-content: center;
    margin-top: 1.25rem;
}

.leitner-card .card-actions button {
    padding: 0.6rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--color-primary);
    background: var(--color-panel);
    color: var(--color-primary);
    font-size: 1rem;
    cursor: pointer;
}

.leitner-card .card-actions button:hover {
    background: var(--color-primary-light);
}

.leitner-card .card-actions button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.leitner-grade-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.leitner-grade-buttons button {
    font-size: 1.4rem;
    padding: 0.5rem 0.9rem;
}
