/* ===========================================
   TOKENS
   =========================================== */
:root {
    --bg:               #f5f0eb;
    --surface:          #fffdf9;
    --border:           #e8e0d5;
    --text-primary:     #2c2416;
    --text-primary-dark: #3d3024;
    --text-secondary:   #7a6350;
    --text-muted:       #b0a090;
    --accent:           #c8b89a;
    --done-bg:          #f0ebe4;
    --error:            #a05030;
}

/* ===========================================
   RESET & BASE
   =========================================== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }

body {
    background: var(--bg);
    color: var(--text-primary);
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 16px;
    line-height: 1.4;
    -webkit-tap-highlight-color: transparent;
}

body.is-sorting {
    user-select: none;
    cursor: grabbing;
}

button, input { font: inherit; }
[hidden] { display: none !important; }

/* ===========================================
   SVG ICONS
   =========================================== */
.icon {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    display: block;
    pointer-events: none;
    flex-shrink: 0;
}

.header-icon-btn .icon,
.btn-tabs-toggle .icon { width: 20px; height: 20px; }

.btn-add .icon { width: 22px; height: 22px; stroke-width: 2.5; }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ===========================================
   APP LAYOUT (full-height, fixed bottom nav)
   =========================================== */
.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100svh;
    height: 100dvh;
    height: var(--app-height, 100dvh);
    max-width: 640px;
    margin: 0 auto;
    padding-top: env(safe-area-inset-top, 0px);
    overflow: hidden;
}

/* ===========================================
   HEADERS
   =========================================== */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 16px 10px;
    flex-shrink: 0;
}

.app-title {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.app-subtitle {
    min-width: 0;
    color: var(--text-secondary);
    font-size: 0.76rem;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-title-group,
.settings-title-group,
.admin-title-group {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.app-title-stack {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.brand-mark {
    display: block;
    object-fit: cover;
    border-radius: 18px;
    flex-shrink: 0;
}

.brand-mark-app {
    width: 28px;
    height: 28px;
    border-radius: 9px;
}

.brand-mark-login {
    width: 88px;
    height: 88px;
    margin: 0 auto 14px;
    box-shadow: 0 12px 26px rgba(44, 36, 22, 0.12);
}

.brand-mark-settings,
.brand-mark-admin {
    width: 32px;
    height: 32px;
    border-radius: 10px;
}

.header-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.progress {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ===========================================
   INPUT AREA (Liste-Modus only)
   =========================================== */
.input-area {
    padding: 0 16px calc(12px + env(safe-area-inset-bottom, 0px));
    flex-shrink: 0;
}

.input-area form {
    display: flex;
    gap: 8px;
    align-items: stretch;
    flex-wrap: wrap;
}

.input-area input,
.input-area textarea {
    min-height: 48px;
    padding: 0 14px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input-area textarea {
    min-height: 82px;
    padding: 12px 14px;
    resize: none;
    overflow: hidden;
    line-height: 1.4;
}

.input-area input:focus-visible,
.input-area textarea:focus-visible {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(200, 184, 154, 0.2);
}

.input-area input::placeholder,
.input-area textarea::placeholder { color: var(--text-muted); }

.input-area input[name="quantity"] { flex: 0 0 100px; }

.file-input-group {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 48px;
    padding: 8px 12px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 12px;
}

.file-picker-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0 12px;
    background: var(--border);
    border-radius: 9px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease;
}

.file-picker-button:hover {
    background: var(--accent);
}

.file-picker-name {
    min-width: 0;
    flex: 1;
    color: var(--text-secondary);
    font-size: 0.85rem;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
    line-height: 1.4;
}

.disk-free-display {
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: 0.75rem;
    white-space: nowrap;
}

.file-input-group.is-disabled {
    opacity: 0.65;
}

.file-input-group.is-disabled .file-picker-button {
    cursor: not-allowed;
}

.input-hint {
    margin: 8px 2px 0;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.drop-zone {
    margin-top: 10px;
    padding: 18px 12px;
    border: 2px dashed var(--border);
    border-radius: 12px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    transition: border-color 0.15s ease, background 0.15s ease;
    cursor: default;
    user-select: none;
}

.drop-zone.drop-active {
    border-color: var(--accent);
    background: rgba(200, 184, 154, 0.1);
    color: var(--text-primary);
}

.btn-add {
    min-width: 48px;
    min-height: 48px;
    padding: 0;
    background: var(--accent);
    color: var(--text-primary);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, transform 0.1s ease;
}

.btn-add:hover  { background: var(--border); }
.btn-add:active { transform: scale(0.94); }

/* ===========================================
   LIST AREA
   =========================================== */
.list-area {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0 16px 16px;
    position: relative;
}

.list-area.is-swipe-gesture {
    overflow-x: clip;
}

.list-swipe-stage {
    min-height: 100%;
    will-change: transform, opacity;
    position: relative;
    z-index: 1;
    background: var(--bg);
}

.list-swipe-stage.is-swipe-animating {
    transition: transform 220ms ease, opacity 220ms ease;
}

.list-area.is-swipe-gesture .list-swipe-stage,
.list-swipe-stage.is-swipe-animating {
    box-shadow: 0 0 0 1px rgba(232, 224, 213, 0.8), 10px 0 24px rgba(44, 36, 22, 0.08);
}

.list-area.is-swipe-gesture .list-swipe-stage {
    border-radius: 0 18px 18px 0;
}

.list-swipe-preview {
    display: none !important;
}

/* Pull-to-refresh indicator */
#ptr-indicator {
    height: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted, #aaa);
    font-size: 18px;
    transition: height 0.25s ease;
    user-select: none;
}
#ptr-indicator::after {
    content: '↓';
    display: block;
    transition: transform 0.2s ease, opacity 0.2s ease;
    opacity: 0.5;
}
#ptr-indicator.ptr-ready::after {
    content: '↑';
    opacity: 1;
}

#list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* ===========================================
   ITEM CARDS
   =========================================== */
.item-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    cursor: grab;
    animation: cardIn 0.22s ease both;
    transition: opacity 0.2s ease, background 0.2s ease;
}

[data-mode="einkaufen"] .item-card,
.app.is-searching .item-card {
    cursor: default;
    touch-action: auto;
}

.item-card.is-dragging {
    opacity: 0.98;
    border-color: var(--accent);
    box-shadow: 0 18px 36px rgba(44, 36, 22, 0.22);
    animation: none;
    transform: scale(1.01) rotate(-0.4deg);
}

.item-card.is-editing {
    align-items: flex-start;
    flex-wrap: wrap;
    background: #fffaf2;
    border-color: var(--accent);
    box-shadow: 0 10px 22px rgba(44, 36, 22, 0.08);
    opacity: 1;
    cursor: default;
}

.item-card.is-editing .item-content {
    flex: 1 1 calc(100% - 32px);
    align-items: stretch;
}

.item-card.done {
    background: var(--done-bg);
    border-color: transparent;
    opacity: 0.55;
}

.item-card.is-removing {
    opacity: 0;
    transform: translateX(12px);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.item-card.is-dragging {
    cursor: grabbing;
}

.drag-placeholder {
    position: relative;
    background: rgba(200, 184, 154, 0.08);
    border: 1.5px dashed rgba(200, 184, 154, 0.7);
    animation: none;
}

.drag-placeholder::after {
    content: "";
    position: absolute;
    left: 16px;
    right: 16px;
    top: 50%;
    height: 4px;
    border-radius: 999px;
    background: var(--accent);
    transform: translateY(-50%);
    box-shadow: 0 0 0 4px rgba(200, 184, 154, 0.16);
}

.item-card.is-drop-target-before,
.item-card.is-drop-target-after {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(200, 184, 154, 0.16);
}

.item-card.is-drop-target-before {
    box-shadow:
        0 0 0 3px rgba(200, 184, 154, 0.16),
        inset 0 4px 0 0 var(--accent);
}

.item-card.is-drop-target-after {
    box-shadow:
        0 0 0 3px rgba(200, 184, 154, 0.16),
        inset 0 -4px 0 0 var(--accent);
}

/* Shopping mode: slightly larger tap targets */
[data-mode="einkaufen"] .item-card { padding: 14px 16px; gap: 10px; }

/* ===========================================
   CHECKBOX TOGGLE
   =========================================== */
.toggle {
    appearance: none;
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    min-width: 24px;
    border: 1.5px solid var(--accent);
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.toggle:checked { background: var(--accent); border-color: var(--accent); }

.toggle:checked::after {
    content: "✓";
    font-size: 11px;
    color: var(--surface);
    line-height: 1;
}

.toggle:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

[data-mode="einkaufen"] .toggle {
    width: 26px;
    height: 26px;
    min-width: 26px;
    border-radius: 7px;
}

[data-mode="einkaufen"] .toggle:checked::after { font-size: 12px; }

/* ===========================================
   ITEM CONTENT
   =========================================== */
.item-content {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.item-content-attachment {
    align-items: flex-start;
    gap: 12px;
}

.item-content-image {
    flex-wrap: nowrap;
}

.item-content-link {
    align-items: flex-start;
}

.attachment-preview-link {
    display: block;
    flex-shrink: 0;
    width: 92px;
    height: 92px;
    padding: 0;
    border-radius: 10px;
    overflow: hidden;
    background: var(--done-bg);
    border: 1px solid var(--border);
    cursor: zoom-in;
}

.attachment-image-preview {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.attachment-preview-placeholder {
    display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f0ebe4, #e7ddd0);
    color: var(--text-muted);
    font-size: 1.6rem;
}

.attachment-meta {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    justify-content: flex-start;
}

.attachment-title {
    flex: 0 0 auto;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
}

.attachment-meta > .attachment-title,
.attachment-meta > .attachment-subline,
.attachment-meta > .attachment-inline-actions {
    flex: 0 0 auto;
}

.attachment-subline {
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.attachment-inline-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 0;
}

.attachment-download-link {
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: var(--accent);
}

.item-content-file .attachment-meta {
    padding-top: 2px;
}

.item-content-missing-attachment .attachment-subline {
    color: var(--error);
}

.lightbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    cursor: zoom-out;
}

.lightbox-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 6px;
    cursor: default;
    user-select: none;
    -webkit-user-drag: none;
}

.lightbox-close {
    position: absolute;
    top: 12px;
    right: 16px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    color: #fff;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.lightbox-close:hover,
.lightbox-close:focus-visible {
    background: rgba(255, 255, 255, 0.3);
    outline: none;
}


.item-edit-fields {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.item-edit-quantity-row {
    display: flex;
    gap: 8px;
}

.item-edit-replace-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-replace-attachment {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0 12px;
    background: var(--border);
    border-radius: 9px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease;
}

.btn-replace-attachment:hover {
    background: var(--accent);
}

.item-edit-replace-label {
    min-width: 0;
    flex: 1;
    color: var(--text-secondary);
    font-size: 0.85rem;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
    line-height: 1.4;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.item-edit-input {
    min-height: 42px;
    width: 100%;
    padding: 0 12px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
}

.item-edit-textarea {
    min-height: 112px;
    padding: 8px 10px;
    resize: none;
    overflow: hidden;
    font-size: 0.92rem;
    line-height: 1.35;
}

.item-edit-input:focus-visible {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(200, 184, 154, 0.18);
}

.item-name {
    font-size: 0.95rem;
    font-weight: 600;
    min-width: 0;
    flex: 1 1 220px;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
    line-height: 1.4;
}

.item-card.done .item-name {
    text-decoration: line-through;
    color: var(--text-muted);
}

.date-badge {
    background: rgba(200, 184, 154, 0.18) !important;
    font-variant-numeric: tabular-nums;
}

.item-link {
    display: block;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
    line-height: 1.45;
    color: var(--text-primary);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: var(--accent);
}

.item-link:hover { color: var(--text-secondary); }

[data-mode="einkaufen"] .item-name { font-size: 1rem; font-weight: 500; }

.quantity-badge {
    padding: 2px 8px;
    background: var(--border);
    color: var(--text-secondary);
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
    white-space: nowrap;
}

.item-actions {
    display: inline-flex;
    align-items: center;
    gap: 0;
    margin-left: auto;
    flex-shrink: 0;
}

.item-card.is-editing .item-actions {
    width: 100%;
    justify-content: flex-end;
    padding-left: 0;
}

.btn-item-action,
.btn-delete {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    padding: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 7px;
    font-size: 1rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}

.item-actions .icon {
    width: 16px;
    height: 16px;
}

.btn-item-menu {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    padding: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.15s ease, background 0.15s ease;
}

.btn-item-menu:hover {
    color: var(--text-secondary);
    background: rgba(200, 184, 154, 0.12);
}

.btn-pin-active { color: var(--text-primary); }
.btn-pin-active .icon { stroke-width: 3; }
.btn-pin-active:hover { color: var(--text-secondary); }

.btn-item-action:hover,
.btn-delete:hover {
    transform: translateY(-1px);
}

.btn-edit:hover {
    color: var(--text-secondary);
    background: rgba(200, 184, 154, 0.12);
}

.btn-save {
    color: #5d7b4c;
}

.btn-save:hover {
    background: rgba(93, 123, 76, 0.1);
}

.btn-cancel:hover {
    color: var(--text-secondary);
    background: rgba(200, 184, 154, 0.12);
}

/* ===========================================
   DELETE BUTTON
   =========================================== */
.btn-delete { font-size: 1.05rem; }

.btn-delete:hover { color: var(--error); background: rgba(160, 80, 48, 0.08); /* --error at 8% opacity */ }
.btn-item-action:disabled,
.btn-delete:disabled { opacity: 0.35; cursor: not-allowed; }

/* Hidden in shopping mode */
[data-mode="einkaufen"] .btn-edit { display: none; }
[data-mode="einkaufen"] .btn-pin { display: none; }
[data-mode="einkaufen"] .btn-delete { display: none; }
[data-mode="einkaufen"] .btn-item-menu { display: none; }

.item-menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100;
    background: rgba(19, 16, 11, 0.28);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 16px;
}

.item-menu-sheet {
    width: min(100%, 420px);
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 18px 40px rgba(19, 16, 11, 0.18);
    padding: 12px;
}

.item-menu-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    padding: 4px 6px 10px;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.4;
}

.item-menu-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.item-menu-action {
    width: 100%;
    min-height: 42px;
    padding: 0 14px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
}

.item-menu-action.is-secondary {
    color: var(--text-secondary);
}

.item-menu-action.is-danger {
    color: var(--error);
}

/* ===========================================
   EMPTY STATE
   =========================================== */
.empty-state {
    list-style: none;
    padding: 40px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
    animation: cardIn 0.22s ease both;
}

/* ===========================================
   CLEAR DONE BUTTON
   =========================================== */
.btn-clear {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 10px;
    background: none;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.btn-clear:hover   { border-color: var(--accent); color: var(--text-secondary); }
.btn-clear:disabled { opacity: 0.4; cursor: not-allowed; }

/* ===========================================
   STATUS MESSAGE (toast)
   =========================================== */
.message {
    position: fixed;
    bottom: calc(env(safe-area-inset-bottom, 8px) + 16px);
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: var(--text-primary);
    color: var(--surface);
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 0.85rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 100;
    max-width: calc(100vw - 32px);
    text-align: center;
}

.message.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.message.is-error   { background: var(--error); }

/* ===========================================
   UPLOAD PROGRESS BAR
   =========================================== */
.upload-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 200;
    background: var(--border);
}

.upload-progress-bar {
    height: 100%;
    background: var(--text-secondary);
    width: 0%;
    transition: width 0.25s ease-out;
}

/* ===========================================
   HEADER ICON BUTTONS
   =========================================== */
.header-icon-btn {
    min-width: 40px;
    min-height: 40px;
    padding: 0 10px;
    background: var(--border);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s ease, transform 0.1s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-secondary);
}

.header-icon-btn:hover  { background: var(--accent); color: var(--text-primary); }
.header-icon-btn:active { background: var(--accent); color: var(--text-primary); transform: scale(0.92); }

/* ===========================================
   MODE VISIBILITY (CSS-driven)
   =========================================== */
[data-mode="einkaufen"] .liste-only { display: none; }
[data-mode="liste"]     .shopping-only { display: none; }

/* ===========================================
   ANIMATIONS
   =========================================== */
@keyframes cardIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0);   }
}

/* ===========================================
   PWA INSTALL BANNER
   =========================================== */
.install-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--surface);
    border-bottom: 1.5px solid var(--border);
    flex-shrink: 0;
}

.install-banner[hidden] { display: none; }

.status-banner,
.update-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1.5px solid var(--border);
    flex-shrink: 0;
}

.status-banner {
    background: #efe7dc;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.status-banner[hidden],
.update-banner[hidden] {
    display: none;
}

.update-banner {
    background: var(--surface);
}

.update-text {
    flex: 1;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.btn-update-reload {
    padding: 6px 14px;
    background: var(--text-primary);
    color: var(--surface);
    border: none;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.15s ease;
}

.btn-update-reload:hover { background: var(--text-primary-dark); }

.install-text {
    flex: 1;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.btn-install {
    padding: 6px 14px;
    background: var(--text-primary);
    color: var(--surface);
    border: none;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.15s ease;
}

.btn-install:hover { background: var(--text-primary-dark); }

.btn-install-dismiss {
    min-width: 32px;
    min-height: 32px;
    padding: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
    font-size: 1.1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.15s ease;
}

.btn-install-dismiss:hover { color: var(--text-primary); }

/* ===========================================
   REDUCED MOTION
   =========================================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===========================================
   TABS TOGGLE BUTTON
   =========================================== */
.btn-tabs-toggle {
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    background: none;
    border: none;
    border-radius: 7px;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease, background 0.15s ease;
}

.btn-tabs-toggle:hover,
.btn-tabs-toggle:active    { color: var(--text-primary); background: rgba(200,184,154,0.15); }
.btn-tabs-toggle.is-active { color: var(--text-primary); }

.section-tabs.tabs-hidden { display: none; }

/* ===========================================
   SECTION TABS (Bereichs-Navigation unten)
   =========================================== */
.section-tabs {
    display: flex;
    border-top: 1.5px solid var(--border);
    background: var(--surface);
    flex-shrink: 0;
    position: relative;
    z-index: 1;
    justify-content: space-between;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.section-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 0;
    padding: 6px 3px 7px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    flex: 1 1 0;
    transition: color 0.15s ease;
    touch-action: none; /* prevent browser scroll-gesture from cancelling pointer events */
}

.section-tab.is-tab-dragging {
    opacity: 0.25;
    pointer-events: none;
}

.section-tabs.is-tab-reordering {
    cursor: grabbing;
    user-select: none;
}

.section-tab.tab-drop-before { box-shadow: -2px 0 0 0 var(--accent); }
.section-tab.tab-drop-after  { box-shadow:  2px 0 0 0 var(--accent); }

.section-tab[aria-current="page"] { color: var(--text-primary); }

.section-tab:hover:not([aria-current="page"]),
.section-tab:active:not([aria-current="page"]) {
    color: var(--text-secondary);
}

.section-icon {
    font-size: 0.96rem;
    line-height: 1;
    filter: grayscale(1) opacity(0.45);
    transition: filter 0.15s ease;
}
.section-tab[aria-current="page"] .section-icon { filter: grayscale(1) opacity(1); }
.section-label {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.64rem;
    line-height: 1.1;
    letter-spacing: -0.015em;
}

.section-dot {
    width: 4px; height: 4px; border-radius: 50%;
    background: var(--text-primary);
    opacity: 0;
    transition: opacity 0.15s ease;
}
.section-tab[aria-current="page"] .section-dot { opacity: 1; }

.mehr-btn {
    flex: 0 0 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    padding: 6px 3px 7px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
}
.mehr-btn:hover, .mehr-btn:active { color: var(--text-secondary); }

@media (min-width: 520px) {
    .section-tab {
        gap: 4px;
        padding: 8px 6px 10px;
    }

    .section-icon {
        font-size: 1.08rem;
    }

    .section-label {
        font-size: 0.74rem;
    }
}

.mehr-menu {
    position: absolute;
    bottom: 100%;
    left: 0; right: 0;
    z-index: 100;
    background: var(--bg);
    border-top: 1.5px solid var(--border);
    border-radius: 12px 12px 0 0;
    padding: 10px 12px 8px;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.08);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.mehr-menu[hidden] { display: none; }
.mehr-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    font-size: 13px;
    color: var(--text-secondary);
    flex: 1 0 calc(50% - 3px);
    cursor: pointer;
    min-width: 0;
}
.mehr-item-icon { font-size: 1.1rem; filter: grayscale(1) opacity(0.6); }
.mehr-item.active { color: var(--text-primary); border-color: var(--accent); }
.mehr-item.active .mehr-item-icon { filter: grayscale(1) opacity(1); }

/* ===========================================
   NOTE CARDS
   =========================================== */
.note-card {
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.note-card:hover { border-color: var(--accent); }

.note-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.note-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
    line-height: 1.4;
}

.note-card-preview {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
    line-height: 1.4;
}

/* ===========================================
   NOTE EDITOR OVERLAY
   =========================================== */
.app { position: relative; }

.note-editor {
    position: absolute;
    inset: 0;
    z-index: 50;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.note-editor[hidden] { display: none; }

.note-editor-top {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px 10px;
    flex-shrink: 0;
    border-bottom: 1.5px solid var(--border);
}

.btn-note-back {
    min-width: 40px;
    min-height: 40px;
    padding: 0 10px;
    background: var(--border);
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.btn-note-back:hover { background: var(--accent); }

.note-title-input {
    flex: 1;
    min-width: 0;
    min-height: 40px;
    padding: 0;
    background: transparent;
    border: none;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.note-title-input:focus { outline: none; }
.note-title-input::placeholder { color: var(--text-muted); font-weight: 400; }

.note-save-status {
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
    min-width: 56px;
    text-align: right;
}

/* ===========================================
   NOTE TOOLBAR
   =========================================== */
.note-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 5px 10px;
    background: var(--surface);
    border-bottom: 1.5px solid var(--border);
    flex-shrink: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.note-toolbar::-webkit-scrollbar { display: none; }

.note-toolbar button {
    min-width: 40px;
    min-height: 40px;
    padding: 0 6px;
    background: none;
    border: 1.5px solid transparent;
    border-radius: 7px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    cursor: pointer;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.note-toolbar button:hover,
.note-toolbar button:active {
    background: rgba(200, 184, 154, 0.15);
    color: var(--text-primary);
}

.note-toolbar button.is-active {
    background: rgba(200, 184, 154, 0.25);
    border-color: var(--accent);
    color: var(--text-primary);
}

.toolbar-sep {
    width: 1px;
    height: 18px;
    background: var(--border);
    margin: 0 3px;
    flex-shrink: 0;
}

/* ===========================================
   NOTE EDITOR BODY (TipTap content)
   =========================================== */
.note-editor-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px 16px 40px;
}

.note-editor-body .tiptap {
    min-height: 200px;
    outline: none;
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-primary);
}

.note-editor-body .tiptap > * + * { margin-top: 0.7em; }

.note-editor-body .tiptap h1,
.note-editor-body .tiptap h2,
.note-editor-body .tiptap h3 { margin-top: 1.2em; }

.note-editor-body .tiptap :first-child { margin-top: 0; }

.note-editor-body .tiptap h1 {
    font-size: 1.55rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.note-editor-body .tiptap h2 {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.3;
}

.note-editor-body .tiptap h3 {
    font-size: 1.02rem;
    font-weight: 600;
}

.note-editor-body .tiptap p { margin: 0; }

.note-editor-body .tiptap ul,
.note-editor-body .tiptap ol {
    padding-left: 1.4em;
    margin: 0;
}

.note-editor-body .tiptap li + li { margin-top: 0.2em; }

.note-editor-body .tiptap blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 1em;
    color: var(--text-secondary);
    font-style: italic;
    margin-left: 0;
}

.note-editor-body .tiptap code {
    font-family: 'SF Mono', ui-monospace, monospace;
    font-size: 0.875em;
    background: rgba(200, 184, 154, 0.2);
    padding: 0.15em 0.4em;
    border-radius: 4px;
}

.note-editor-body .tiptap pre {
    background: rgba(44, 36, 22, 0.06);
    border-radius: 8px;
    padding: 1em;
    overflow-x: auto;
}

.note-editor-body .tiptap pre code {
    background: none;
    padding: 0;
    font-size: 0.875rem;
}

.note-editor-body .tiptap a {
    color: var(--text-primary);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.note-editor-body .tiptap hr {
    border: none;
    border-top: 1.5px solid var(--border);
    margin: 1.5em 0;
}

.note-editor-body .tiptap p.is-editor-empty:first-child::before {
    content: attr(data-placeholder);
    color: var(--text-muted);
    float: left;
    height: 0;
    pointer-events: none;
}

@media (max-width: 480px) {
    .item-content-image {
        flex-direction: column;
    }

    .attachment-preview-link {
        width: 100%;
        height: auto;
        aspect-ratio: 4 / 3;
    }
}

/* ===========================================
   SEARCH BUTTON
   =========================================== */
.btn-search.is-active { background: var(--accent); color: var(--text-primary); }

/* ===========================================
   SEARCH BAR
   =========================================== */
.search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px 10px;
    flex-shrink: 0;
}

.search-bar[hidden] { display: none; }

.search-input {
    flex: 1;
    min-height: 44px;
    padding: 0 12px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.15s ease;
}

.search-input:focus { border-color: var(--accent); }

.btn-search-close {
    min-width: 40px;
    min-height: 40px;
    padding: 0;
    background: none;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.15s ease, background 0.15s ease;
}

.btn-search-close:hover {
    color: var(--text-primary);
    background: rgba(200, 184, 154, 0.12);
}

/* Hide input area and clear button while searching */
.app.is-searching .input-area  { display: none !important; }
.app.is-searching .btn-clear   { display: none !important; }

/* ===========================================
   SEARCH RESULTS
   =========================================== */
.search-result { cursor: pointer; }
.search-result:hover,
.search-result:active { background: var(--done-bg); }

.search-result-section {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 1px 6px;
    background: var(--border);
    color: var(--text-secondary);
    border-radius: 4px;
    flex-shrink: 0;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

.search-result-preview {
    display: block;
    width: 100%;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===========================================
   PINNED ITEMS
   =========================================== */
.item-card.is-pinned {
    border-left: 3px solid var(--accent);
    padding-left: calc(16px - 3px);
}

.btn-pin {
    opacity: 0.22;
    transition: opacity 0.15s ease, transform 0.12s ease;
}

.btn-pin.is-pinned { opacity: 1; }
.btn-pin:hover     { opacity: 0.7; }
.btn-pin:disabled  { opacity: 0.12; }

/* ===========================================
   LOGIN PAGE
   =========================================== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    width: 100%;
    max-width: 360px;
}

.login-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1.25rem;
}

.login-card h1 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-primary);
    text-align: center;
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 1rem;
}

.login-field label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.login-field input {
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text-primary);
    font-size: 1rem;
}

.login-field input:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.login-btn {
    width: 100%;
    padding: 0.7rem;
    background: var(--text-primary);
    color: var(--surface);
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    margin-top: 0.5rem;
}

.login-btn:hover { opacity: 0.85; }

.login-error {
    color: var(--error);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    padding: 0.5rem 0.75rem;
    background: #fdf0ec;
    border-radius: 6px;
}

/* ===========================================
   SETTINGS PAGE
   =========================================== */
.settings-page {
    min-height: 100vh;
    min-height: 100dvh;
    padding: env(safe-area-inset-top, 0px) 16px 24px;
    max-width: 640px;
    margin: 0 auto;
}

.settings-card {
    margin-top: 20px;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
}

.settings-header h1 {
    margin: 0;
    font-size: 1.35rem;
    color: var(--text-primary);
}

.settings-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 40px;
    padding: 0 12px;
    border-radius: 10px;
    background: var(--border);
    color: var(--text-primary);
    text-decoration: none;
}

.settings-back:hover {
    background: var(--accent);
}

.settings-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.settings-section-secondary {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.settings-copy {
    margin: 0;
    color: var(--text-secondary);
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.settings-block h2 {
    margin: 0 0 8px;
    font-size: 1rem;
}

.settings-options {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.settings-option {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
    color: var(--text-primary);
}

.settings-toggle input {
    margin: 0;
    width: 18px;
    height: 18px;
    accent-color: var(--text-primary);
}

.settings-category-row {
    display: grid;
    gap: 14px;
}

.settings-row-main {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 14px;
    align-items: end;
}

.settings-row-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.settings-row-meta {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.settings-actions {
    display: flex;
}

.settings-password-fields {
    display: grid;
    gap: 12px;
    margin-top: 14px;
}

.settings-field {
    display: flex;
    flex-direction: column;
    flex: 1 1 180px;
    gap: 6px;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.settings-field input {
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
    color: var(--text-primary);
}

.settings-field select {
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
    color: var(--text-primary);
}

.settings-field input:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.settings-field select:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.settings-field-icon {
    flex: 0 0 96px;
}

.settings-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    min-height: 44px;
}

.settings-type-badge {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 10px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.85rem;
    white-space: nowrap;
}

.settings-move-group {
    display: inline-flex;
    gap: 8px;
}

.settings-delete-button {
    align-self: end;
    white-space: nowrap;
}

.settings-row-actions {
    display: inline-flex;
    align-items: end;
    gap: 8px;
}

.settings-row-save {
    min-height: 40px;
    padding: 0 14px;
}

.settings-move-button {
    min-width: 40px;
    min-height: 40px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text-primary);
    cursor: pointer;
}

.settings-move-button:hover {
    background: var(--border);
}

@media (max-width: 640px) {
    .settings-row-main {
        grid-template-columns: 1fr;
    }

    .settings-field-icon {
        flex-basis: auto;
    }

    .settings-row-bottom {
        align-items: stretch;
    }

    .settings-row-meta,
    .settings-row-actions {
        width: 100%;
    }

    .settings-row-actions {
        justify-content: stretch;
    }

    .settings-row-actions > * {
        flex: 1 1 0;
    }
}

.settings-save {
    min-height: 44px;
    padding: 0 16px;
    border: none;
    border-radius: 10px;
    background: var(--text-primary);
    color: var(--surface);
    font-weight: 600;
    cursor: pointer;
}

.settings-save:hover {
    opacity: 0.9;
}

.settings-flash {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 0.95rem;
}

.settings-flash-ok {
    background: #e9f2e5;
    color: #36562d;
}

.settings-flash-err {
    background: #fdf0ec;
    color: var(--error);
}

.settings-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 16px;
    border-radius: 10px;
    background: var(--text-primary);
    color: var(--surface);
    text-decoration: none;
    font-weight: 600;
    width: fit-content;
}

.settings-link:hover {
    opacity: 0.9;
}

/* ===========================================
   ADMIN PAGE
   =========================================== */
.admin-page {
    max-width: 640px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.admin-header h1 {
    margin: 0;
    font-size: 1.25rem;
}

.admin-logout {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-decoration: none;
}

.admin-logout:hover { color: var(--error); }

.admin-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.admin-section h2 {
    margin: 0 0 1rem;
    font-size: 1rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.admin-form-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.admin-form-row input[type="text"],
.admin-form-row input[type="password"] {
    flex: 1;
    min-width: 120px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.admin-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    background: var(--text-primary);
    color: var(--surface);
}

.admin-btn:hover { opacity: 0.85; }

.admin-btn-danger {
    background: var(--error);
}

.admin-user-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.admin-user-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
}

.admin-user-item:last-child { border-bottom: none; }

.admin-user-name {
    flex: 1;
    font-weight: 500;
}

.admin-user-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.admin-notice {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin: 0;
}

.admin-flash {
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.admin-flash-ok  { background: #edf7ed; color: #2e6e2e; }
.admin-flash-err { background: #fdf0ec; color: var(--error); }

.admin-inline-form {
    display: inline-flex;
    gap: 0.4rem;
    align-items: center;
}

.admin-inline-form input[type="password"] {
    width: 130px;
    padding: 0.35rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text-primary);
    font-size: 0.85rem;
}

.admin-btn-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.8rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: var(--text-primary);
    color: var(--surface);
}

.admin-btn-sm:hover { opacity: 0.85; }

.admin-btn-sm-danger {
    background: var(--error);
}
