/* =========================================================
   GLOBAL THEME TOKENS
   ========================================================= */

:root {
    --bg-body: #020617;
    --bg-elevated: rgba(15, 23, 42, 0.96);
    --bg-soft: rgba(15, 23, 42, 0.8);
    --bg-subtle: rgba(15, 23, 42, 0.6);

    --border-subtle: #1e293b;
    --border-strong: #334155;

    --accent: #3b82f6;
    --accent-soft: rgba(59, 130, 246, 0.16);
    --accent-strong: #1d4ed8;

    --danger: #ef4444;
    --danger-soft: rgba(239, 68, 68, 0.16);

    --success: #22c55e;
    --success-soft: rgba(34, 197, 94, 0.12);

    --text-main: #e5e7eb;
    --text-soft: #9ca3af;
    --text-muted: #6b7280;

    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-pill: 999px;

    --shadow-soft: 0 14px 30px rgba(15, 23, 42, 0.8);
    --shadow-strong: 0 20px 50px rgba(15, 23, 42, 0.9);
}

/* =========================================================
   BASE
   ========================================================= */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body.body-bg,
body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(59, 130, 246, 0.16), transparent 55%),
        radial-gradient(circle at bottom right, rgba(8, 47, 73, 0.5), transparent 60%),
        var(--bg-body);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
    font-size: 14px;
}

/* Links */

a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

a:hover {
    text-decoration: underline;
}

/* Page Shell */

.page {
    max-width: 1240px;
    margin: 0 auto;
    padding: 24px 20px 40px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Top Navigation / Back-Links */

.link-back {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: var(--radius-pill);
    background: linear-gradient(120deg, rgba(15, 23, 42, 0.96), rgba(17, 24, 39, 0.96));
    border: 1px solid rgba(148, 163, 184, 0.25);
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.9);
    font-size: 13px;
}

.link-back a {
    color: var(--text-main);
    text-decoration: none;
    opacity: 0.85;
}

.link-back a:hover {
    opacity: 1;
    text-decoration: underline;
}

/* Page Typography */

h1,
.card-title {
    margin: 0 0 4px;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: #f9fafb;
}

.subtitle {
    font-size: 13px;
    color: var(--text-soft);
    margin: 0;
}

/* =========================================================
   CARDS & LAYOUT
   ========================================================= */

.card {
    background: radial-gradient(circle at top left, rgba(59, 130, 246, 0.14), transparent 55%),
                var(--bg-elevated);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(148, 163, 184, 0.22);
    padding: 18px 20px;
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.card-meta {
    font-size: 12px;
    color: var(--text-soft);
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.card-desc {
    font-size: 14px;
    color: var(--text-main);
    line-height: 1.6;
    white-space: pre-line;
}

.card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

/* Generic grid for cards & tiles */

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

/* Empty States */

.empty {
    margin-top: 10px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    border: 1px dashed var(--border-subtle);
    background: rgba(15, 23, 42, 0.7);
    color: var(--text-soft);
    font-size: 13px;
}

/* =========================================================
   FORMS & TOOLBAR
   ========================================================= */

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 16px 18px;
    border-radius: var(--radius-lg);
    background: var(--bg-soft);
    border: 1px solid var(--border-subtle);
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.9);
    align-items: flex-end;
}

/* Form fields */

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    min-width: 200px;
}

.field label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="file"],
input[type="password"],
select,
textarea {
    font-size: 14px;
    padding: 7px 10px;
    border-radius: 10px;
    border: 1px solid var(--border-subtle);
    background: rgba(15, 23, 42, 0.9);
    color: var(--text-main);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

textarea {
    resize: vertical;
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
    font-size: 13px;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.4);
    background: rgba(15, 23, 42, 1);
}

/* File input label */

.file-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: var(--radius-pill);
    border: 1px dashed rgba(148, 163, 184, 0.7);
    background: rgba(15, 23, 42, 0.9);
    font-size: 12px;
    color: var(--text-main);
    cursor: pointer;
}

.file-label:hover {
    border-style: solid;
    background: rgba(15, 23, 42, 1);
}

/* Submit area in forms */

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

/* =========================================================
   BUTTONS
   ========================================================= */

button,
.btn-small,
.btn-link,
.btn-primary,
.btn-secondary,
.btn-icon,
.btn-download,
.danger-btn,
.btn-danger {
    font-family: inherit;
    border: none;
    cursor: pointer;
    outline: none;
    background: none;
}

/* Primary Button – Default Submit (ohne Spezialklassen) */

button[type="submit"]:not(.btn-secondary):not(.btn-small):not(.btn-icon):not(.btn-download):not(.danger-btn):not(.btn-danger),
.btn-primary {
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.03em;
    box-shadow: 0 12px 24px rgba(59, 130, 246, 0.6);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: transform 0.05s ease, box-shadow 0.12s ease, background 0.15s ease;
}

button[type="submit"]:not(.btn-secondary):not(.btn-small):not(.btn-icon):not(.btn-download):not(.danger-btn):not(.btn-danger):hover,
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 32px rgba(59, 130, 246, 0.7);
}

button[type="submit"]:not(.btn-secondary):not(.btn-small):not(.btn-icon):not(.btn-download):not(.danger-btn):not(.btn-danger):active,
.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 10px 20px rgba(59, 130, 246, 0.5);
}

/* Small CTA Buttons */

.btn-small {
    padding: 5px 10px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 500;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.6);
    color: var(--text-main);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.9);
}

.btn-small:hover {
    background: rgba(31, 41, 55, 1);
}

/* Secondary Button (z.B. im Planner/Docs) */

.btn-secondary {
    padding: 7px 14px;
    border-radius: var(--radius-pill);
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.7);
    color: var(--text-main);
    font-size: 12px;
    font-weight: 500;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.9);
}

.btn-secondary:hover {
    background: rgba(31, 41, 55, 1);
}

/* Text-Link Button */

.btn-link {
    padding: 0;
    border-radius: 0;
    background: none;
    color: var(--accent);
    font-size: 13px;
    font-weight: 500;
    box-shadow: none;
}

.btn-link:hover {
    text-decoration: underline;
}

/* Danger / Destructive Button – vereinheitlicht */

.danger-btn,
.btn-danger {
    padding: 7px 14px;
    border-radius: var(--radius-pill);
    background: var(--danger-soft);
    border: 1px solid rgba(248, 113, 113, 0.8);
    color: #fecaca;
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 10px 24px rgba(127, 29, 29, 0.85);
}

.danger-btn:disabled,
.btn-danger:disabled {
    opacity: 0.45;
    cursor: default;
    box-shadow: none;
}

.danger-btn:hover:not(:disabled),
.btn-danger:hover:not(:disabled) {
    background: var(--danger);
    color: #fef2f2;
}

/* Icon Buttons (History etc.) */

.btn-icon {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.9);
    background: rgba(15, 23, 42, 0.95);
    color: var(--text-main);
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.9);
}

.btn-icon:hover {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.9);
}

/* =========================================================
   STATUS & BADGES
   ========================================================= */

.status-badge,
.priority-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* Generic Status */

.status-offen {
    background: rgba(59, 130, 246, 0.15);
    color: #bfdbfe;
    border: 1px solid rgba(59, 130, 246, 0.7);
}

.status-erledigt {
    background: var(--success-soft);
    color: #bbf7d0;
    border: 1px solid rgba(34, 197, 94, 0.8);
}

/* Priority */

.priority-hoch {
    background: rgba(248, 113, 113, 0.16);
    color: #fecaca;
    border: 1px solid rgba(248, 113, 113, 0.8);
}

.priority-normal {
    background: rgba(59, 130, 246, 0.12);
    color: #bfdbfe;
    border: 1px solid rgba(59, 130, 246, 0.7);
}

.priority-niedrig {
    background: rgba(55, 65, 81, 0.7);
    color: #e5e7eb;
    border: 1px solid rgba(75, 85, 99, 0.9);
}

/* =========================================================
   MESSAGES / ALERTS
   ========================================================= */

.message {
    padding: 10px 12px;
    border-radius: var(--radius-md);
    font-size: 13px;
    border: 1px solid var(--border-subtle);
    background: rgba(15, 23, 42, 0.9);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.9);
}

.message-success {
    border-color: rgba(34, 197, 94, 0.8);
    background: var(--success-soft);
    color: #bbf7d0;
}

.message-error {
    border-color: rgba(248, 113, 113, 0.8);
    background: var(--danger-soft);
    color: #fecaca;
}

/* =========================================================
   TABLES (Rollen, Historie, Übersichten)
   ========================================================= */

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 6px;
    font-size: 13px;
}

th,
td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid rgba(30, 64, 175, 0.25);
}

th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    background: rgba(15, 23, 42, 0.9);
}

tbody tr:nth-child(even) {
    background: rgba(15, 23, 42, 0.75);
}

tbody tr:hover {
    background: rgba(30, 64, 175, 0.4);
}

/* =========================================================
   IMAGES, PREVIEWS, PRINT
   ========================================================= */

.images {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin-top: 12px;
}

.images img,
.preview-image,
.print-image,
.image-preview img {
    max-width: 100%;
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
    background: #020617;
    display: block;
}

.image-preview img {
    cursor: pointer;
}

/* Print page wrapper */

.print-page {
    max-width: 960px;
    margin: 24px auto;
    padding: 20px 24px;
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-strong);
}

.meta,
.meta-info,
.text_meta {
    font-size: 13px;
    color: var(--text-soft);
    line-height: 1.5;
}

/* =========================================================
   VIEWER (Dokumentanzeige)
   ========================================================= */

.viewer-container {
    max-width: 1100px;
    margin: 24px auto;
    padding: 20px 22px;
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-strong);
}

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

.viewer-header h1 {
    margin: 0;
    font-size: 18px;
}

.viewer-meta {
    font-size: 12px;
    color: var(--text-soft);
    margin-bottom: 10px;
}

.viewer-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.viewer-frame {
    border-radius: 14px;
    border: 1px solid #111827;
    background: #020617;
    padding: 10px;
    overflow: hidden;
}

.viewer-frame iframe,
.viewer-frame embed {
    width: 100%;
    height: 70vh;
    border: none;
    border-radius: 10px;
    background: #020617;
}

.viewer-image {
    max-width: 100%;
    max-height: 70vh;
    border-radius: 10px;
    display: block;
    margin: 0 auto;
    background: #020617;
}

.viewer-fallback {
    padding: 24px 12px;
    text-align: center;
    font-size: 13px;
    color: var(--text-soft);
}

/* Verknüpfte Planner-Infos */

.linked-planner-block {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-subtle);
}

.linked-planner-block h2 {
    margin: 0 0 8px;
    font-size: 15px;
    color: #e5e7eb;
}

.linked-planner-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.linked-planner-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.linked-planner-title {
    font-size: 13px;
    font-weight: 600;
    color: #f9fafb;
}

.linked-planner-meta {
    font-size: 11px;
    color: var(--text-soft);
}

.linked-planner-actions {
    margin-top: 4px;
}

/* =========================================================
   LIGHTBOX / IMAGE-VIEWER (Übersicht, Galerie)
   ========================================================= */

.image-viewer {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.92);
    z-index: 9999;
}

.image-viewer.open {
    display: flex;
}

.image-viewer-backdrop {
    position: absolute;
    inset: 0;
}

.image-viewer-content {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-viewer-content img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 14px;
    border: 1px solid var(--border-subtle);
    background: #020617;
    box-shadow: var(--shadow-strong);
}

.image-viewer-close {
    position: absolute;
    top: -14px;
    right: -14px;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    background: #e5e7eb;
    color: #020617;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.95);
}

/* =========================================================
   RESPONSIVE BASE
   ========================================================= */

@media (max-width: 768px) {
    .page {
        padding: 16px 12px 28px;
    }

    .toolbar {
        padding: 12px 12px;
    }

    .viewer-frame iframe,
    .viewer-frame embed {
        height: 60vh;
    }
}

/* =========================================================
   LANDING DASHBOARD (index.php)
   ========================================================= */

.shell {
    max-width: 1240px;
    margin: 0 auto;
    padding: 24px 20px 40px;
    display: grid;
    grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
    gap: 28px;
}

.left-panel {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.right-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: radial-gradient(circle at top left, rgba(59,130,246,0.2), transparent 60%),
                rgba(15,23,42,0.95);
    border: 1px solid rgba(148,163,184,0.7);
    color: #e5e7eb;
    box-shadow: 0 10px 26px rgba(15,23,42,0.9);
}

.left-panel h1 {
    margin: 0;
    font-size: 26px;
    letter-spacing: 0.02em;
}

.left-panel .subtitle {
    margin: 0;
    font-size: 13px;
    color: var(--text-soft);
}

/* Login Card */

.login-card {
    margin-top: 8px;
    padding: 18px 18px 16px;
    border-radius: var(--radius-lg);
    background: radial-gradient(circle at top left, rgba(59,130,246,0.18), transparent 60%),
                rgba(15,23,42,0.96);
    border: 1px solid rgba(148,163,184,0.25);
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 14px;
}

.login-card h2 {
    margin: 0 0 6px;
    font-size: 18px;
}

.login-card p {
    margin: 0 0 6px;
}

.logout-link {
    margin-top: 8px;
}

.logout-link a {
    font-size: 13px;
}

/* Login actions */

.login-actions {
    margin-top: 10px;
}

/* Apps Header */

.apps-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.apps-title {
    font-size: 16px;
    font-weight: 600;
    color: #f9fafb;
}

.apps-subtitle {
    font-size: 13px;
    color: var(--text-soft);
}

/* Module Grid */

.apps-grid {
    margin-top: 6px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.apps-grid.apps-disabled {
    opacity: 0.35;
    pointer-events: none;
    filter: grayscale(0.2);
}

/* Single Module Card */

.app-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 14px 12px;
    border-radius: var(--radius-md);
    background: radial-gradient(circle at top left, rgba(59,130,246,0.22), transparent 65%),
                rgba(15,23,42,0.95);
    border: 1px solid rgba(148,163,184,0.35);
    text-decoration: none;
    color: var(--text-main);
    box-shadow: 0 12px 28px rgba(15,23,42,0.9);
    transition: transform 0.07s ease, box-shadow 0.12s ease, border-color 0.12s ease,
                background 0.12s ease;
}

.app-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 36px rgba(15,23,42,0.95);
    border-color: rgba(96,165,250,0.9);
}

.app-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.app-name {
    font-size: 15px;
    font-weight: 600;
    color: #f9fafb;
}

.app-desc {
    font-size: 13px;
    color: var(--text-soft);
}

.app-meta {
    margin-top: 4px;
    font-size: 11px;
}

.app-pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    border: 1px solid rgba(148,163,184,0.7);
    background: rgba(15,23,42,0.85);
    color: #e5e7eb;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 10px;
}

/* Meta Info (Build, Version) */

.meta-info {
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-muted);
}

/* Responsive Dashboard */

@media (max-width: 900px) {
    .shell {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 640px) {
    .shell {
        padding: 18px 12px 28px;
    }

    .apps-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* =========================================================
   MODUL 1 – QR-CODES (Generator & Galerie)
   ========================================================= */

.qr-wrapper {
    margin-top: 12px;
    display: flex;
    justify-content: center;
}

.qr-image {
    max-width: 260px;
    width: 100%;
    height: auto;
    border-radius: 12px;
    background: #ffffff;
    padding: 10px;
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.85);
}

.qr-download {
    display: inline-flex;
    border-radius: 16px;
    padding: 6px;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(148,163,184,0.6);
}

.qr-download:hover {
    border-color: rgba(59,130,246,0.9);
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
}

/* QR-Galerie Karten nutzen .card / .grid */

/* =========================================================
   MODUL 4 – PLANUNG & KARTEN
   ========================================================= */

.planner-layout {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.planner-main {
    margin-top: 10px;
    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    gap: 20px;
    align-items: flex-start;
}

/* Linke Spalte: Filter & Formular */

.planner-left {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.planner-filter-bar {
    margin-top: 6px;
    padding: 10px 12px;
    border-radius: var(--radius-lg);
    background: var(--bg-soft);
    border: 1px solid var(--border-subtle);
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.field-small {
    flex: 1 1 120px;
    min-width: 120px;
}

/* Modus-Umschalter */

.planner-mode-bar {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.planner-mode-btn {
    padding: 5px 10px;
    border-radius: var(--radius-pill);
    border: 1px solid rgba(148,163,184,0.5);
    background: rgba(15,23,42,0.95);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-main);
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(15,23,42,0.9);
}

.planner-mode-btn:hover {
    background: rgba(30,64,175,0.85);
    border-color: rgba(129,140,248,0.9);
}

.planner-mode-active {
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    border-color: transparent;
    color: #ffffff;
}

/* Eintragsliste links */

.planner-list-header {
    margin-top: 10px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.planner-list {
    margin-top: 4px;
    padding: 10px;
    border-radius: var(--radius-lg);
    background: var(--bg-soft);
    border: 1px solid var(--border-subtle);
    max-height: 320px;
    overflow: auto;
    box-shadow: var(--shadow-soft);
}

.planner-list-row {
    display: flex;
    align-items: stretch;
    gap: 6px;
    margin-bottom: 6px;
}

.planner-list-item {
    flex: 1;
    border-radius: 10px;
    border: 1px solid rgba(55,65,81,0.9);
    background: rgba(15,23,42,0.9);
    padding: 6px 8px;
    text-align: left;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.planner-list-item:hover {
    border-color: rgba(96,165,250,0.9);
    background: rgba(30,64,175,0.75);
}

.planner-list-item-active {
    border-color: rgba(250,204,21,0.95);
    box-shadow: 0 0 0 1px rgba(250,204,21,0.6);
    background: radial-gradient(circle at top left, rgba(250,204,21,0.25), transparent 70%),
                rgba(15,23,42,0.98);
}

.pli-title {
    font-weight: 600;
    font-size: 13px;
}

.pli-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    font-size: 11px;
    color: var(--text-soft);
}

.pli-delete {
    width: 28px;
    border-radius: 999px;
    border: 1px solid rgba(248,113,113,0.8);
    background: rgba(127,29,29,0.8);
    color: #fee2e2;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 18px rgba(127,29,29,0.7);
}

.pli-delete:hover {
    background: var(--danger);
    border-color: rgba(248,113,113,1);
}

/* Formular (Planner & History gemeinsam, siehe unten) */

.planner-sep {
    margin: 16px 0 10px;
    border: none;
    border-top: 1px solid var(--border-subtle);
}

.planner-form,
.history-form {
    padding: 14px 14px 16px;
    border-radius: var(--radius-lg);
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.id-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    background: rgba(15,23,42,0.9);
    border: 1px dashed rgba(148,163,184,0.8);
    font-size: 11px;
    color: var(--text-soft);
}

.file-info {
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-soft);
}

.planner-linked-doc-info {
    margin-top: 4px;
    font-size: 12px;
}

.planner-linked-doc-info a {
    font-size: 12px;
}

.planner-form-actions {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Hinweise */

.planner-hint,
.planner-map-hint {
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-muted);
}

.hint-text {
    font-size: 11px;
    color: var(--text-soft);
}

/* Rechte Spalte: Karte */

.planner-right {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.planner-map-wrapper {
    border-radius: var(--radius-lg);
    background: var(--bg-soft);
    border: 1px solid var(--border-subtle);
    padding: 8px;
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

.planner-zoom-inner {
    position: relative;
    transform-origin: top left;
    display: inline-block;
}

.planner-map-image {
    display: block;
    max-width: 100%;
    height: auto;
}

.planner-map-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

/* Zoom-Bar */

.planner-zoom-bar {
    margin-top: 6px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border-radius: var(--radius-pill);
    background: rgba(15,23,42,0.9);
    border: 1px solid var(--border-subtle);
    font-size: 12px;
    color: var(--text-soft);
    box-shadow: 0 10px 22px rgba(15,23,42,0.9);
}

.zoom-btn {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    border: 1px solid rgba(148,163,184,0.9);
    background: rgba(15,23,42,0.95);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zoom-btn:hover {
    background: rgba(30,64,175,0.9);
    border-color: rgba(129,140,248,0.9);
    color: #e5e7eb;
}

/* Responsive Layout Planner */

@media (max-width: 960px) {
    .planner-main {
        grid-template-columns: minmax(0, 1fr);
    }

    .planner-right {
        order: -1;
    }
}

@media (max-width: 640px) {
    .planner-list {
        max-height: 260px;
    }
}

/* =========================================================
   MODUL 7 – HISTORY & AUFGABEN
   ========================================================= */

.history-layout {
    grid-template-columns: minmax(260px, 1fr) minmax(330px, 1.3fr);
    align-items: flex-start;
}

.history-list-column,
.history-form-column {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Liste links */

.history-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.history-list {
    margin-top: 4px;
    padding: 10px;
    border-radius: var(--radius-lg);
    background: var(--bg-soft);
    border: 1px solid var(--border-subtle);
    max-height: 360px;
    overflow: auto;
    box-shadow: var(--shadow-soft);
}

.history-row {
    display: flex;
    align-items: stretch;
    gap: 6px;
    margin-bottom: 6px;
}

.history-item {
    flex: 1;
    border-radius: 10px;
    border: 1px solid rgba(55,65,81,0.9);
    background: rgba(15,23,42,0.9);
    padding: 6px 8px;
    text-align: left;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.history-item:hover {
    border-color: rgba(96,165,250,0.9);
    background: rgba(30,64,175,0.75);
}

.history-item-active {
    border-color: rgba(250,204,21,0.95);
    box-shadow: 0 0 0 1px rgba(250,204,21,0.6);
    background: radial-gradient(circle at top left, rgba(250,204,21,0.25), transparent 70%),
                rgba(15,23,42,0.98);
}

.hi-title {
    font-weight: 600;
    font-size: 13px;
}

.hi-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    font-size: 11px;
    color: var(--text-soft);
}

.history-row-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-end;
}

/* Formular rechts – nutzt .history-form oben */

.history-form-actions {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.history-form .id-pill {
    margin-top: 2px;
}

/* Responsive History */

@media (max-width: 960px) {
    .history-layout {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* =========================================================
   MODUL 5 – DOKUMENTE & UPLOAD
   ========================================================= */

.docs-grid {
    /* nutzt .grid als Basis */
}

.doc-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 8px;
}

.docs-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

/* Modal für Upload */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.90);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal-backdrop.hidden {
    display: none;
}

.modal {
    width: 100%;
    max-width: 420px;
    border-radius: var(--radius-lg);
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-strong);
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.modal-header h2 {
    margin: 0;
    font-size: 18px;
}

.modal-close {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    background: rgba(15,23,42,0.95);
    color: var(--text-main);
    box-shadow: 0 8px 18px rgba(15,23,42,0.9);
}

.modal-close:hover {
    background: rgba(30,64,175,0.9);
}

.modal-body {
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.upload-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.modal-actions {
    margin-top: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.modal-hint {
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-muted);
}

.modal-hint code {
    font-size: 11px;
}

/* =========================================================
   MODUL 8 – SPRACHNOTIZEN / REC
   ========================================================= */

/* History zweispaltig lassen */
.history-layout {
    grid-template-columns: minmax(260px, 1fr) minmax(330px, 1.3fr);
    align-items: flex-start;
}

/* Rec: Aufnahme und Liste untereinander */

.rec-layout {
    display: flex !important;
    flex-direction: column;
    gap: 16px;
    align-items: stretch;
}

/* Aufnahme-Panel */

.diktier-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.diktier-status {
    font-size: 13px;
    color: var(--text-soft);
}

#recordStatus {
    font-weight: 600;
    color: #fbbf24;
}

.diktier-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}

.diktier-hint {
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-muted);
}

.diktier-message {
    margin-top: 8px;
    font-size: 12px;
    padding: 8px 10px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
}

.diktier-message.msg-ok {
    border-color: rgba(34,197,94,0.9);
    background: var(--success-soft);
    color: #bbf7d0;
}

.diktier-message.msg-error {
    border-color: rgba(248,113,113,0.9);
    background: var(--danger-soft);
    color: #fecaca;
}

/* Liste der Aufnahmen */

.rec-list-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.recording-list {
    list-style: none;
    margin: 4px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.recording-item {
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
    background: rgba(15,23,42,0.95);
    box-shadow: 0 10px 24px rgba(15,23,42,0.9);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.recording-headline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.recording-meta {
    font-size: 13px;
    color: var(--text-main);
    word-break: break-all;
}

.recording-audio {
    width: 100%;
    outline: none;
}

.recording-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
    margin-top: 4px;
}

.recording-rename-form {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    font-size: 12px;
}

.recording-rename-form label {
    font-size: 11px;
    color: var(--text-soft);
}

.recording-rename-form input[type="text"] {
    max-width: 220px;
}

.recording-delete-form {
    margin-left: auto;
}

.btn-download {
    font-size: 12px;
    text-decoration: none;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    border: 1px solid rgba(148,163,184,0.7);
    background: rgba(15,23,42,0.9);
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 6px 14px rgba(15,23,42,0.9);
}

.btn-download:hover {
    background: rgba(31,41,55,1);
}

/* Responsive Rec */

/* Mobile: REC untereinander darstellen */
@media (max-width: 820px) {
    .rec-layout {
        display: flex !important;
        flex-direction: column !important;
        gap: 18px !important;
        align-items: stretch !important;
    }

    .recording-item,
    .diktier-panel {
        width: 100% !important;
    }
}



/* ============================================
   REC – Layout zentrieren & Breite begrenzen
   ============================================ */

/* Aufnahme-Panel und Aufnahmen-Card optisch enger machen */
.diktier-panel,
.rec-list-card {
    max-width: 720px;
    margin-inline: auto;   /* zentriert */
}

/* Buttons im Aufnahmebereich breiter & gleich groß */
.diktier-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.diktier-controls button {
    flex: 1 1 150px;       /* beide Buttons teilen sich die Zeile */
    justify-content: center;
}

/* Start-Button etwas „kräftiger“ */
#btnStart {
    padding: 10px 18px;
    font-size: 14px;
}

/* Stop-Button klar als „Stopp“ / Gefahr kennzeichnen */
#btnStop {
    padding: 10px 18px;
    font-size: 14px;
    background: var(--danger-soft);
    border-radius: var(--radius-pill);
    border: 1px solid rgba(248, 113, 113, 0.9);
    color: #fecaca;
    box-shadow: 0 10px 24px rgba(127, 29, 29, 0.85);
}

#btnStop:hover {
    background: var(--danger);
    color: #fef2f2;
}
