/* ============================================================
   RadioPlan v2.0 – Design System
   Fonts: Outfit (Headings) + Plus Jakarta Sans (Body) + JetBrains Mono (Mono)
   Themes: Dark Orange + Light Blue
   ============================================================ */

/* ── DARK THEME (Standard) ── */
:root, [data-theme="dark"] {
    --bg-primary:     #0a0e1a;
    --bg-secondary:   #111827;
    --bg-tertiary:    #1a2236;
    --bg-card:        #141b2d;
    --bg-sidebar:     #080c16;
    --input-bg:       #1a2236;
    --hover-bg:       rgba(255,255,255,0.04);

    --text-primary:   #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted:     #64748b;

    --border:         #1e293b;
    --border-light:   #162032;

    --accent:         #f97316;
    --accent-hover:   #fb923c;
    --accent-light:   #fb923c;
    --accent-soft:    rgba(249,115,22,0.12);
    --accent-glow:    rgba(249,115,22,0.25);

    --success:        #22c55e;
    --success-bg:     rgba(34,197,94,0.12);
    --warning:        #eab308;
    --warning-bg:     rgba(234,179,8,0.12);
    --danger:         #ef4444;
    --danger-bg:      rgba(239,68,68,0.12);
    --info:           #3b82f6;
    --info-bg:        rgba(59,130,246,0.12);
    --purple:         #a855f7;
    --purple-bg:      rgba(168,85,247,0.12);

    --radius:         12px;
    --radius-sm:      8px;
    --sidebar-width:  240px;

    --shadow:         0 4px 16px rgba(0,0,0,0.5);
    --shadow-sm:      0 1px 3px rgba(0,0,0,0.4);
    --shadow-lg:      0 8px 32px rgba(0,0,0,0.6);

    --footer-bg:      #080c16;
    --player-bg:      #111827;

    --sidebar-active-bg: rgba(249,115,22,0.15);
    --sidebar-text:       #94a3b8;
    --sidebar-text-hover: #e2e8f0;
    --sidebar-text-active:#ffffff;
    --sidebar-label:      #475569;
    --sidebar-heading:    #f1f5f9;
    --sidebar-border:     rgba(255,255,255,0.06);

    --stat-c1: #22c55e; --stat-c2: #f97316; --stat-c3: #3b82f6; --stat-c4: #a855f7;
}

/* ── LIGHT THEME ── */
[data-theme="light"] {
    --bg-primary:     #f0f4f8;
    --bg-secondary:   #f8fafc;
    --bg-tertiary:    #e8edf3;
    --bg-card:        #ffffff;
    --bg-sidebar:     #0f172a;
    --input-bg:       #f1f5f9;
    --hover-bg:       rgba(0,0,0,0.03);

    --text-primary:   #0f172a;
    --text-secondary: #475569;
    --text-muted:     #94a3b8;

    --border:         #e2e8f0;
    --border-light:   #eef2f7;

    --accent:         #2563eb;
    --accent-hover:   #3b82f6;
    --accent-light:   #3b82f6;
    --accent-soft:    rgba(37,99,235,0.08);
    --accent-glow:    rgba(37,99,235,0.15);

    --success:        #16a34a;
    --success-bg:     rgba(22,163,74,0.08);
    --warning:        #ca8a04;
    --warning-bg:     rgba(202,138,4,0.08);
    --danger:         #dc2626;
    --danger-bg:      rgba(220,38,38,0.08);
    --info:           #2563eb;
    --info-bg:        rgba(37,99,235,0.08);
    --purple:         #7c3aed;
    --purple-bg:      rgba(124,58,237,0.08);

    --shadow:         0 4px 16px rgba(15,23,42,0.08);
    --shadow-sm:      0 1px 3px rgba(15,23,42,0.06);
    --shadow-lg:      0 8px 32px rgba(15,23,42,0.1);

    --footer-bg:      #e2e8f0;
    --player-bg:      #ffffff;

    --sidebar-active-bg: rgba(255,255,255,0.12);
    --sidebar-text:       #94a3b8;
    --sidebar-text-hover: #e2e8f0;
    --sidebar-text-active:#ffffff;
    --sidebar-label:      #475569;
    --sidebar-heading:    #f1f5f9;
    --sidebar-border:     rgba(255,255,255,0.06);

    --stat-c1: #16a34a; --stat-c2: #ea580c; --stat-c3: #2563eb; --stat-c4: #7c3aed;
}

/* ════════════════════ RESET & BASE ════════════════════ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 15px; scroll-behavior: smooth; overflow-x: hidden; -webkit-text-size-adjust: 100%; }

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    transition: background 0.35s ease, color 0.3s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

a { color: var(--accent-light); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--accent-hover); }

code, .mono { font-family: 'JetBrains Mono', 'Fira Code', monospace; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ════════════════════ LAYOUT ════════════════════ */
.app-layout { display: flex; min-height: 100vh; }

/* ════════════════════ SIDEBAR ════════════════════ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    overflow-y: auto;
    border-right: 1px solid var(--sidebar-border);
    transition: background 0.35s ease;
}

.sidebar-header {
    padding: 22px 18px 16px;
    border-bottom: 1px solid var(--sidebar-border);
}
.sidebar-header h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 17px;
    font-weight: 700;
    color: var(--sidebar-heading);
    white-space: nowrap;
    letter-spacing: -0.02em;
}
.sidebar-header small {
    color: var(--sidebar-label);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.04em;
}

.theme-toggle {
    width: 32px; height: 32px;
    border: 1px solid var(--sidebar-border);
    border-radius: 8px;
    background: rgba(255,255,255,0.04);
    color: var(--sidebar-text);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 15px;
    transition: all 0.15s;
}
.theme-toggle:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.15); }

.sidebar-nav { flex: 1; padding: 8px 10px; }

/* Section labels */
.nav-section-label {
    font-family: 'Outfit', -apple-system, sans-serif;
    font-size: 10px;
    font-weight: 600;
    color: var(--sidebar-label);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 14px 12px 4px;
    margin-top: 2px;
}
.nav-section-label:first-child { padding-top: 6px; margin-top: 0; }

.sidebar-nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; margin: 1px 0;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
    font-size: 13.5px; font-weight: 450;
    text-decoration: none;
    transition: all 0.15s ease;
    position: relative;
}
.sidebar-nav a:hover { background: rgba(255,255,255,0.04); color: var(--sidebar-text-hover); text-decoration: none; }
.sidebar-nav a.active { background: var(--sidebar-active-bg); color: var(--sidebar-text-active); font-weight: 550; }
.sidebar-nav a.active::before {
    content: '';
    position: absolute;
    left: 0; top: 6px; bottom: 6px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--accent);
}

/* SVG Icons */
.sidebar-nav .icon {
    width: 20px; height: 20px;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    color: currentColor;
    opacity: 0.7;
}
.sidebar-nav a:hover .icon { opacity: 0.9; }
.sidebar-nav a.active .icon { opacity: 1; color: var(--accent); }
.sidebar-nav .icon svg { display: block; }

/* Sidebar logo icon */
.sidebar-logo-icon {
    width: 34px; height: 34px;
    border-radius: 9px;
    background: var(--accent);
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 2px 10px var(--accent-glow);
}
[data-theme="light"] .sidebar-logo-icon { background: #2563eb; box-shadow: 0 2px 10px rgba(37,99,235,0.3); }

/* Sidebar avatar – fixed size, never grows */
.sidebar-avatar {
    width: 32px; height: 32px;
    min-width: 32px; min-height: 32px;
    max-width: 32px; max-height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent), #f59e0b);
    display: flex; align-items: center; justify-content: center;
    font-family: 'Outfit', sans-serif;
    font-size: 13px; font-weight: 700; color: #fff;
    overflow: hidden; flex-shrink: 0;
}
.sidebar-avatar img {
    width: 32px; height: 32px;
    min-width: 32px; min-height: 32px;
    max-width: 32px; max-height: 32px;
    object-fit: cover;
    display: block;
}
[data-theme="light"] .sidebar-avatar { background: linear-gradient(135deg, #2563eb, #7c3aed); }

/* Sidebar user footer */
.sidebar-user {
    padding: 14px;
    border-top: 1px solid var(--sidebar-border);
    display: flex; align-items: center; justify-content: space-between;
}
.sidebar-user .user-name {
    color: var(--sidebar-text-hover); font-weight: 550; font-size: 13px;
    font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
}
.sidebar-user .user-role {
    font-size: 11px; color: var(--sidebar-label); font-weight: 450;
    font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
}

/* Sidebar action button (logout) */
.sidebar-action-btn {
    width: 30px; height: 30px;
    border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    color: var(--sidebar-text);
    transition: all 0.15s;
    text-decoration: none;
}
.sidebar-action-btn:hover { background: rgba(239,68,68,0.12); color: #ef4444; text-decoration: none; }

/* Sidebar profile button */
.sidebar-profile-btn {
    display: flex; align-items: center; justify-content: center; gap: 7px;
    width: 100%;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    color: #94a3b8;
    font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
    font-size: 12px; font-weight: 500;
    text-decoration: none;
    transition: all 0.15s;
}
.sidebar-profile-btn:hover { background: rgba(255,255,255,0.06); color: #e2e8f0; text-decoration: none; }
.sidebar-profile-btn.active { border-color: var(--accent); color: var(--accent); background: var(--sidebar-active-bg); }

.divider { height: 1px; background: rgba(255,255,255,0.06); margin: 8px 6px; }

.sidebar-user {
    padding: 14px;
    border-top: 1px solid rgba(255,255,255,0.06);
    display: flex; align-items: center; justify-content: space-between;
}
.user-name { color: #e2e8f0; font-weight: 550; font-size: 13px; font-family: 'Plus Jakarta Sans', -apple-system, sans-serif; }
.user-role { font-size: 11px; color: #64748b; font-weight: 450; font-family: 'Plus Jakarta Sans', -apple-system, sans-serif; }

/* ════════════════════ MAIN CONTENT ════════════════════ */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 28px 32px;
    min-height: 100vh;
    padding-bottom: 120px;
    padding-top: 76px; /* space for fixed top header */
}

/* ════════════════════ FIXED TOP HEADER ════════════════════ */
.top-header {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: 52px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    backdrop-filter: blur(12px);
    background: color-mix(in srgb, var(--bg-card) 88%, transparent);
    transition: left 0.3s;
}
.top-header-left { display: flex; align-items: center; gap: 16px; }
.top-header-title { font-size: 16px; font-weight: 650; margin: 0; white-space: nowrap; }
.top-header-date { display: flex; flex-direction: column; line-height: 1.2; }
.top-header-dayname { font-weight: 700; font-size: 13px; }
.top-header-datestr { font-size: 11px; color: var(--text-muted); }
.top-header-clock { font-size: 28px; font-weight: 200; color: var(--accent); letter-spacing: -0.5px; font-variant-numeric: tabular-nums; }
.top-header-right { display: flex; align-items: center; gap: 6px; }
.top-header-btn {
    width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border);
    background: var(--bg-tertiary); color: var(--text-primary); cursor: pointer;
    display: flex; align-items: center; justify-content: center; position: relative;
    transition: background 0.15s, border-color 0.15s;
}
.top-header-btn:hover { background: var(--bg-primary); border-color: var(--accent); }
.top-header-badge {
    display: none; position: absolute; top: -4px; right: -4px;
    background: #ef4444; color: #fff; font-size: 10px; font-weight: 700;
    min-width: 17px; height: 17px; border-radius: 99px; line-height: 17px;
    text-align: center; padding: 0 4px;
}
.top-header-user {
    display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px;
    border-radius: 10px; text-decoration: none; color: inherit;
    transition: background 0.15s; border: 1px solid transparent;
}
.top-header-user:hover { background: var(--bg-tertiary); border-color: var(--border); }
.top-header-avatar {
    width: 30px; height: 30px; border-radius: 50%; background: var(--accent);
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; overflow: hidden; flex-shrink: 0;
}
.top-header-avatar img { width: 100%; height: 100%; object-fit: cover; }
.top-header-userinfo { display: flex; flex-direction: column; line-height: 1.2; }
.top-header-username { font-size: 13px; font-weight: 600; }
.top-header-userrole { font-size: 10px; color: var(--text-muted); }

/* Notification Dropdown (from top header) */
.notif-dropdown {
    display: none; position: absolute; top: 100%; right: 0; margin-top: 8px;
    width: 380px; max-height: 520px; background: var(--bg-card);
    border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: 0 12px 40px rgba(0,0,0,0.18); z-index: 999; overflow-y: auto;
}

/* ════════════════════ PAGE HEADER ════════════════════ */
.page-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.page-header h2 { font-size: 24px; font-weight: 700; }

/* ════════════════════ CARDS ════════════════════ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
    transition: background 0.35s, border-color 0.35s, box-shadow 0.3s;
}
.card:hover { box-shadow: var(--shadow); }

.card-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 16px;
}
.card-header h3 { font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 8px; }

/* ════════════════════ STAT CARDS ════════════════════ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px; margin-bottom: 24px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 22px;
    position: relative; overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}
.stat-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; }
.stat-card:nth-child(1)::before { background: var(--stat-c1); }
.stat-card:nth-child(2)::before { background: var(--stat-c2); }
.stat-card:nth-child(3)::before { background: var(--stat-c3); }
.stat-card:nth-child(4)::before { background: var(--stat-c4); }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.stat-icon {
    width: 40px; height: 40px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; margin-bottom: 14px;
}
.stat-card:nth-child(1) .stat-icon { background: var(--success-bg); color: var(--success); }
.stat-card:nth-child(2) .stat-icon { background: var(--accent-soft); color: var(--accent); }
.stat-card:nth-child(3) .stat-icon { background: var(--info-bg); color: var(--info); }
.stat-card:nth-child(4) .stat-icon { background: var(--purple-bg); color: var(--purple); }

.stat-number {
    font-family: 'Outfit', sans-serif;
    font-size: 32px; font-weight: 700;
    line-height: 1; margin-bottom: 4px; letter-spacing: -0.03em;
}
.stat-value {
    font-family: 'Outfit', sans-serif;
    font-size: 28px; font-weight: 700;
    line-height: 1; margin-bottom: 4px;
}
.stat-label { font-size: 13px; color: var(--text-secondary); font-weight: 450; }

.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ════════════════════ BUTTONS ════════════════════ */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 18px; border: none; border-radius: 9px;
    font-family: 'Plus Jakarta Sans', sans-serif; font-size: 13px; font-weight: 550;
    cursor: pointer; transition: all 0.15s ease;
    text-decoration: none; white-space: nowrap; line-height: 1.4;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 2px 8px var(--accent-glow); }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 4px 16px var(--accent-glow); color: #fff; }
.btn-ghost { background: var(--bg-tertiary); color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { opacity: 0.9; color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { opacity: 0.9; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.9; color: #fff; }
.btn-ok { background: var(--success); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 12px; border-radius: 7px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

.flex { display: flex; align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 8px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; }
.text-center { text-align: center; } .text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }

/* ════════════════════ FORMS ════════════════════ */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 550; color: var(--text-secondary); }
.form-control {
    width: 100%; padding: 10px 14px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--input-bg); color: var(--text-primary);
    font-family: 'Plus Jakarta Sans', sans-serif; font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s; outline: none;
}
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.form-check input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ════════════════════ ALERTS ════════════════════ */
.alert { padding: 14px 18px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px; font-weight: 450; border-left: 3px solid; }
.alert-success { background: var(--success-bg); color: var(--success); border-left-color: var(--success); }
.alert-error, .alert .err { background: var(--danger-bg); color: var(--danger); border-left-color: var(--danger); }

/* ════════════════════ BADGES ════════════════════ */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 6px; font-size: 11px; font-weight: 600; background: var(--bg-tertiary); color: var(--text-secondary); }
.badge-active { background: var(--success-bg); color: var(--success); }
.badge-inactive { background: var(--danger-bg); color: var(--danger); }
.badge-admin { background: var(--danger-bg); color: var(--danger); }
.badge-radioadmin { background: var(--purple-bg); color: var(--purple); }
.badge-sendeleitung { background: var(--info-bg); color: var(--info); }
.badge-redakteur { background: var(--accent-soft); color: var(--accent); }
.badge-moderator { background: var(--success-bg); color: var(--success); }

/* ════════════════════ TABLES ════════════════════ */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; padding: 10px 12px; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); border-bottom: 2px solid var(--border); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
tr:hover td { background: var(--hover-bg); }

/* ════════════════════ MODAL ════════════════════ */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); z-index: 1000; align-items: center; justify-content: center; }
.modal-overlay.active { display: flex; }
.modal { background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; padding: 28px; width: 90%; max-width: 550px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); }

/* ════════════════════ SENDUNGEN ════════════════════ */
.sendung-grid { display: grid; grid-template-columns: 60px repeat(7, 1fr); gap: 2px; font-size: 12px; }
.sendung-time-header { padding: 6px 4px; font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text-muted); display: flex; align-items: center; }
.sendung-day-header { padding: 8px 4px; text-align: center; font-weight: 700; font-family: 'Outfit', sans-serif; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-secondary); }
.sendung-cell { min-height: 36px; border: 1px solid var(--border-light); border-radius: 4px; padding: 2px; cursor: pointer; transition: background 0.15s; }
.sendung-cell:hover { background: var(--hover-bg); }
.sendung-block { padding: 3px 6px; border-radius: 4px; font-size: 10px; font-weight: 600; cursor: pointer; line-height: 1.3; border-left: 3px solid transparent; }

.sendung-color-0 { background: rgba(59,130,246,0.15); border-left-color: #3b82f6; color: #93bbfc; }
.sendung-color-1 { background: rgba(168,85,247,0.15); border-left-color: #a855f7; color: #c4a0f7; }
.sendung-color-2 { background: rgba(236,72,153,0.15); border-left-color: #ec4899; color: #f5a0cb; }
.sendung-color-3 { background: rgba(34,197,94,0.15); border-left-color: #22c55e; color: #86e8a7; }
.sendung-color-4 { background: rgba(234,179,8,0.15); border-left-color: #eab308; color: #e8d46f; }
.sendung-color-5 { background: rgba(249,115,22,0.15); border-left-color: #f97316; color: #fbb97a; }
.sendung-color-6 { background: rgba(6,182,212,0.15); border-left-color: #06b6d4; color: #7edce8; }
.sendung-color-7 { background: rgba(239,68,68,0.15); border-left-color: #ef4444; color: #f8a0a0; }

[data-theme="light"] .sendung-color-0 { color: #1d4ed8; }
[data-theme="light"] .sendung-color-1 { color: #7c3aed; }
[data-theme="light"] .sendung-color-2 { color: #db2777; }
[data-theme="light"] .sendung-color-3 { color: #16a34a; }
[data-theme="light"] .sendung-color-4 { color: #a16207; }
[data-theme="light"] .sendung-color-5 { color: #c2410c; }
[data-theme="light"] .sendung-color-6 { color: #0891b2; }
[data-theme="light"] .sendung-color-7 { color: #dc2626; }


/* ════════════════════ KALENDER ════════════════════ */
.cal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }

.cal-10day-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 8px; }
.cal-10day-cell { background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 8px; text-align: center; cursor: pointer; transition: all 0.15s; }
.cal-10day-cell:hover { border-color: var(--accent); transform: translateY(-2px); }
.cal-10day-cell.today { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent), inset 0 0 0 1px var(--accent); }
.cal-10day-header { font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; }
.cal-10day-date { font-family: 'Outfit', sans-serif; font-size: 22px; font-weight: 700; margin: 4px 0; }
.cal-10day-cell.today .cal-10day-date { color: var(--accent); }
.cal-10day-items { margin-top: 6px; }
.cal-10day-item { font-size: 9px; padding: 2px 4px; border-radius: 3px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-day-header { padding: 8px; text-align: center; font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.cal-day { min-height: 72px; padding: 8px; background: var(--bg-tertiary); border: 1px solid var(--border-light); border-radius: var(--radius-sm); cursor: pointer; transition: all 0.15s; }
.cal-day:hover { border-color: var(--accent); }
.cal-day.today { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent); position: relative; z-index: 1; }
.cal-day.empty { background: transparent; border-color: transparent; cursor: default; }
.cal-day.empty:hover { border-color: transparent; }
.day-num { font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 15px; }
.cal-day.today .day-num { color: var(--accent); }
.day-count { font-size: 10px; color: var(--text-muted); margin-top: 2px; }
.day-beitrag-count { font-size: 10px; padding: 1px 6px; border-radius: 4px; background: var(--success-bg); color: var(--success); font-weight: 600; margin-top: 4px; display: inline-block; }
.has-items { }

.week-grid { display: grid; grid-template-columns: 60px repeat(7, 1fr); gap: 2px; font-size: 12px; }
.week-time { padding: 6px 4px; font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text-muted); }
.week-cell { min-height: 36px; border: 1px solid var(--border-light); border-radius: 4px; padding: 2px; }
.mini-beitrag { font-size: 9px; padding: 2px 4px; border-radius: 3px; background: var(--accent-soft); color: var(--accent); margin: 1px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.beitrag-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 10px; transition: all 0.15s; }
.beitrag-card:hover { border-color: var(--accent); }
.beitrag-card .beitrag-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; }
.beitrag-title { font-weight: 600; font-size: 14px; }
.beitrag-times { font-size: 12px; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; }
.beitrag-status { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 6px; font-size: 11px; font-weight: 600; }
.status-available { background: var(--bg-tertiary); color: var(--text-secondary); }
.status-played { background: var(--success-bg); color: var(--success); }
.status-locked { background: var(--warning-bg); color: var(--warning); }
.beitrag-actions { display: flex; gap: 6px; margin-top: 8px; }

/* ════════════════════ SENDEPLAN TIMELINE ════════════════════ */
.timeline-entry { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border-light); }
.timeline-entry:last-child { border-bottom: none; }
.timeline-time { font-family: 'JetBrains Mono', monospace; font-size: 13px; color: var(--text-muted); min-width: 55px; font-weight: 450; }
.timeline-content { flex: 1; }
.tl-title { font-weight: 600; font-size: 14px; }
.tl-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }

/* ════════════════════ FAQ ════════════════════ */
.faq-list { display: flex; flex-direction: column; gap: 4px; }
.faq-item { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; transition: border-color 0.2s; }
.faq-item:hover { border-color: var(--accent); }
.faq-item.faq-inactive { opacity: 0.6; }
.faq-question { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; cursor: pointer; font-weight: 600; font-size: 14px; background: var(--bg-tertiary); transition: background 0.15s; user-select: none; }
.faq-question:hover { background: var(--hover-bg); }
.faq-q-text { flex: 1; padding-right: 12px; }
.faq-toggle { font-size: 12px; color: var(--text-muted); transition: transform 0.3s; flex-shrink: 0; }
.faq-toggle.open { transform: rotate(180deg); }
.faq-answer-content { padding: 16px 20px; font-size: 14px; line-height: 1.8; color: var(--text-secondary); }
.faq-answer-content strong { color: var(--text-primary); font-weight: 600; }
.faq-admin-actions { padding: 8px 16px 12px; display: flex; gap: 8px; border-top: 1px solid var(--border); }

/* ════════════════════ AUFZEICHNUNGEN ════════════════════ */
.aufzeichnung-review-item { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; margin-bottom: 10px; border-left: 3px solid var(--warning); background: var(--bg-tertiary); }
.upload-drop-zone { border: 2px dashed var(--border); border-radius: var(--radius-sm); transition: border-color 0.2s, background 0.2s; overflow: hidden; }
.upload-drop-zone.drag-over { border-color: var(--accent); background: var(--accent-soft); }
.upload-zone { border: 2px dashed var(--border); border-radius: var(--radius-sm); padding: 24px; text-align: center; transition: border-color 0.2s, background 0.2s; }
.upload-zone:hover { border-color: var(--accent); background: var(--accent-soft); }

/* ════════════════════ AUDIO PLAYER ════════════════════ */
.audio-player-bar { position: fixed; bottom: 0; left: var(--sidebar-width); right: 0; height: 56px; background: var(--player-bg); border-top: 1px solid var(--border); z-index: 200; display: none; box-shadow: 0 -4px 16px rgba(0,0,0,0.3); }
.audio-player-bar.active { display: flex; }
.audio-player-inner { display: flex; align-items: center; gap: 12px; width: 100%; padding: 0 20px; height: 100%; }

.audio-btn { width: 36px; height: 36px; border: none; border-radius: 8px; background: var(--accent); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 15px; transition: all 0.15s; flex-shrink: 0; }
.audio-btn:hover { background: var(--accent-hover); transform: scale(1.05); }
.audio-btn.audio-close { background: var(--bg-tertiary); color: var(--text-muted); width: 28px; height: 28px; font-size: 12px; }
.audio-btn.audio-close:hover { background: var(--danger-bg); color: var(--danger); }

.audio-info { display: flex; flex-direction: column; gap: 2px; min-width: 100px; max-width: 200px; }
.audio-title { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audio-time { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text-muted); }

.audio-progress-wrap { flex: 1; cursor: pointer; padding: 6px 0; }
.audio-progress-bg { width: 100%; height: 4px; background: var(--bg-tertiary); border-radius: 2px; overflow: hidden; }
.audio-progress-fill { height: 100%; background: var(--accent); border-radius: 2px; width: 0%; transition: width 0.1s linear; }
.audio-volume { width: 28px; }
.audio-volume-slider { width: 80px; height: 4px; accent-color: var(--accent); cursor: pointer; }

.audio-preview-btn { background: var(--accent-soft); border: 1px solid transparent; color: var(--accent); padding: 4px 10px; border-radius: 6px; cursor: pointer; font-size: 12px; font-weight: 550; transition: all 0.15s; }
.audio-preview-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ════════════════════ FOOTER ════════════════════ */
.app-footer { position: fixed; bottom: 0; left: var(--sidebar-width); right: 0; height: 36px; background: var(--footer-bg); border-top: 1px solid var(--border); z-index: 190; display: flex; align-items: center; justify-content: center; padding: 0 24px; transition: bottom 0.3s; }
.audio-player-bar.active ~ .app-footer, body.audio-active .app-footer { bottom: 56px; }
.footer-content { display: flex; align-items: center; gap: 16px; font-size: 11.5px; color: var(--text-muted); }
.footer-content a { color: var(--accent); text-decoration: none; }
.footer-content a:hover { text-decoration: underline; }
.footer-version { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text-secondary); font-weight: 400; }
.footer-sep { color: var(--text-muted); margin: 0 2px; }

/* ════════════════════ LOGIN ════════════════════ */
.login-box { max-width: 400px; margin: 100px auto; padding: 32px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); }
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo h1 { font-family: 'Outfit', sans-serif; font-size: 28px; font-weight: 700; }

/* ════════════════════ MISC ════════════════════ */
.steps { display: flex; gap: 8px; margin-bottom: 20px; }
.steps .ok { color: var(--success); font-weight: 600; }
.steps .err { color: var(--danger); font-weight: 600; }
.send-time-row, .row2 { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.ico { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }

.user-avatar-lg {
    width: 64px; height: 64px; border-radius: 16px;
    background: linear-gradient(135deg, var(--accent), #f59e0b);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 24px; overflow: hidden;
}
.user-avatar-lg img { width: 100%; height: 100%; object-fit: cover; }
[data-theme="light"] .user-avatar-lg { background: linear-gradient(135deg, #2563eb, #7c3aed); }
.user-info .name { font-weight: 600; }
.logo { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }

/* ════════════════════ MOBILE ════════════════════ */
.mobile-menu-btn {
    display: none;
}
.mobile-menu-btn-inline {
    display: none; width: 38px; height: 38px; border: 1px solid var(--border); border-radius: 8px;
    background: var(--bg-tertiary); color: var(--text-primary); font-size: 18px; cursor: pointer;
    align-items: center; justify-content: center; flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

/* Sidebar backdrop overlay (mobile) */
.sidebar-backdrop {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.5); backdrop-filter: blur(2px);
    z-index: 99; transition: opacity 0.3s;
    -webkit-tap-highlight-color: transparent;
}

/* Mobile utility classes */
.m-hide { }
.m-show { display: none; }
.m-full { }
.scroll-hint { position: relative; }
.scroll-hint::after {
    content: '← swipe →'; position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%);
    font-size: 10px; color: var(--text-muted); opacity: 0; transition: opacity 0.3s; pointer-events: none;
}

/* Responsive helper classes (used by PHP pages) */
.rp-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.rp-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.rp-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.rp-stack { display: flex; flex-direction: column; gap: 8px; }
.rp-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rp-overflow-x { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }

/* ── TABLET: ≤ 1100px ── */
@media (max-width: 1100px) {
    .main-content { padding: 28px 20px; }
    .top-header { padding: 0 16px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid { grid-template-columns: 1fr; }
    .notif-dropdown { width: 340px; }
    .form-row { grid-template-columns: 1fr !important; }
    .rp-grid-4 { grid-template-columns: 1fr 1fr; }
}

/* ── MOBILE: ≤ 900px ── */
@media (max-width: 900px) {
    /* Hamburger menu */
    .mobile-menu-btn-inline { display: flex; }
    .m-hide { display: none !important; }
    .m-show { display: block !important; }

    /* Sidebar: slide in from left */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
        width: 280px;
        box-shadow: none;
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,0.4);
    }
    .sidebar.open + .sidebar-backdrop,
    .sidebar.open ~ .sidebar-backdrop { display: block; }

    /* Main layout */
    .main-content {
        margin-left: 0 !important;
        padding: 16px 14px;
        padding-top: 64px;
        padding-bottom: 100px;
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
    }

    /* Top header */
    .top-header {
        left: 0 !important;
        padding: 0 12px;
        height: 52px;
    }
    .top-header-username,
    .top-header-userrole { display: none; }
    .top-header-datestr { display: none; }
    .top-header-clock { font-size: 20px; }
    .top-header-user { padding: 4px; }
    .top-header-btn { width: 34px; height: 34px; }
    .top-header-left { gap: 8px; }
    .top-header-right { gap: 4px; }

    /* Notification dropdown → full-width overlay */
    .notif-dropdown {
        position: fixed !important;
        top: 52px !important;
        left: 8px !important;
        right: 8px !important;
        width: auto !important;
        max-height: calc(100vh - 80px);
        max-height: calc(100dvh - 80px);
        border-radius: var(--radius);
    }

    /* Footer + Audio */
    .app-footer { left: 0 !important; padding: 0 10px; }
    .audio-player-bar { left: 0 !important; }
    .audio-player-inner { padding: 0 10px; gap: 8px; }
    .audio-info { max-width: 120px; }
    .audio-volume-slider { width: 50px; }

    /* Code blocks overflow */
    code, pre { word-break: break-all; overflow-wrap: break-word; }
    pre { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }

    /* Long text overflow prevention */
    td, .card, .modal { word-break: break-word; overflow-wrap: break-word; }

    /* Page header */
    .page-header { flex-direction: column; align-items: flex-start !important; gap: 10px; }
    .page-header h2 { font-size: 20px; }
    .page-header > .btn,
    .page-header > a.btn,
    .page-header > div { width: 100%; }
    .page-header .btn { justify-content: center; }

    /* Cards */
    .card { padding: 14px; margin-bottom: 12px; border-radius: 10px; }
    .card-header { flex-wrap: wrap; gap: 8px; }

    /* Stats grid */
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card { padding: 14px 16px; }
    .stat-number, .stat-value { font-size: 24px; }
    .stat-label { font-size: 12px; }
    .stat-icon { width: 36px; height: 36px; font-size: 16px; margin-bottom: 10px; }

    /* Dashboard grid */
    .dashboard-grid { grid-template-columns: 1fr !important; }

    /* Form layout */
    .form-row { grid-template-columns: 1fr !important; }
    .rp-grid-2, .rp-grid-3, .rp-grid-4 { grid-template-columns: 1fr !important; }

    /* Tables – horizontal scroll */
    .card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table { min-width: 480px; }
    th, td { padding: 8px 10px; font-size: 12px; }
    th { font-size: 10px; white-space: nowrap; }

    /* Modal – nearly full width */
    .modal-overlay { padding: 12px; align-items: flex-start; padding-top: 5vh; }
    .modal {
        width: 100% !important; max-width: 100% !important;
        padding: 18px; max-height: 85vh; max-height: 85dvh;
        border-radius: 14px;
    }
    .modal h3 { font-size: 16px; }
    .modal .form-row { grid-template-columns: 1fr !important; }

    /* Calendar */
    .cal-grid { gap: 2px; }
    .cal-day { min-height: 48px; padding: 4px; font-size: 11px; }
    .cal-day-header { font-size: 10px; padding: 4px; }
    .day-num { font-size: 13px; }
    .cal-10day-grid { grid-template-columns: repeat(5, 1fr) !important; gap: 6px; }
    .cal-10day-cell { padding: 8px 4px; }
    .cal-10day-date { font-size: 18px; }
    .cal-10day-header { font-size: 10px; }
    .cal-header { flex-direction: column; align-items: flex-start !important; gap: 8px; }

    /* Sendung/Week grid → horizontal scroll */
    .sendung-grid, .week-grid {
        overflow-x: auto; -webkit-overflow-scrolling: touch;
        min-width: 620px; scrollbar-width: thin;
    }

    /* Timeline */
    .timeline-entry { flex-direction: column; gap: 4px; }
    .timeline-time { min-width: auto; }

    /* FAQ */
    .faq-question { padding: 12px; font-size: 13px; }
    .faq-answer-content { padding: 12px; }

    /* Buttons */
    .btn { padding: 9px 14px; font-size: 12.5px; }
    .btn-lg { padding: 10px 18px; font-size: 14px; }
    .btn-sm { padding: 5px 10px; font-size: 11px; }

    /* Login */
    .login-box { margin: 40px 16px; padding: 24px; max-width: 100%; }

    /* Messages layout */
    .msg-layout { grid-template-columns: 1fr !important; height: auto !important; }

    /* ── GENERIC INLINE STYLE OVERRIDES ── */
    /* All multi-column inline grids → 1 column */
    div[style*="grid-template-columns: auto 1fr 1fr"],
    div[style*="grid-template-columns:auto 1fr 1fr"],
    div[style*="grid-template-columns: 1fr 1fr 1fr"],
    div[style*="grid-template-columns:1fr 1fr 1fr"],
    div[style*="grid-template-columns: 1fr 1fr"],
    div[style*="grid-template-columns:1fr 1fr"],
    div[style*="grid-template-columns: 2fr 1fr"],
    div[style*="grid-template-columns:2fr 1fr"],
    div[style*="grid-template-columns: repeat(2"],
    div[style*="grid-template-columns:repeat(2"],
    div[style*="grid-template-columns: repeat(3"],
    div[style*="grid-template-columns:repeat(3"],
    div[style*="grid-template-columns: repeat(4"],
    div[style*="grid-template-columns:repeat(4"],
    div[style*="grid-template-columns: repeat(5"],
    div[style*="grid-template-columns:repeat(5"],
    div[style*="grid-template-columns:320px 1fr"],
    div[style*="grid-template-columns: 320px 1fr"],
    div[style*="grid-template-columns:300px 1fr"],
    div[style*="grid-template-columns: 300px 1fr"],
    div[style*="grid-template-columns:250px 1fr"],
    div[style*="grid-template-columns: 250px 1fr"] {
        grid-template-columns: 1fr !important;
    }

    /* Inline flex → wrap */
    div[style*="display:flex"][style*="gap"],
    div[style*="display: flex"][style*="gap"] {
        flex-wrap: wrap;
    }

    /* Tab bars – horizontal scroll, not wrap */
    .page-tabs,
    .tab-bar,
    div[style*="display:flex"][style*="border-bottom"][style*="padding-bottom"],
    div[style*="display: flex"][style*="border-bottom"][style*="padding-bottom"] {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap !important;
        white-space: nowrap;
        gap: 4px !important;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    .page-tabs::-webkit-scrollbar,
    .tab-bar::-webkit-scrollbar,
    div[style*="display:flex"][style*="border-bottom"]::-webkit-scrollbar,
    div[style*="display: flex"][style*="border-bottom"]::-webkit-scrollbar { height: 0; display: none; }

    /* Aufzeichnungen */
    .upload-zone { padding: 16px; }
    .aufzeichnung-review-item { padding: 12px; }

    /* User avatar large */
    .user-avatar-lg { width: 56px; height: 56px; font-size: 20px; border-radius: 14px; }

    /* Profile / Settings info rows */
    .info-row, .setting-row { flex-direction: column; gap: 4px; }

    /* Sendungsvorlagen inline cards */
    .send-time-row, .row2 { flex-wrap: wrap; }

    /* Quick action cards */
    .qc-grid,
    div[style*="grid-template-columns: repeat(4"],
    div[style*="grid-template-columns:repeat(4"] {
        grid-template-columns: 1fr 1fr !important;
    }

    /* Fixed max-widths → full width */
    div[style*="max-width:300px"], div[style*="max-width: 300px"],
    div[style*="max-width:350px"], div[style*="max-width: 350px"],
    div[style*="max-width:400px"], div[style*="max-width: 400px"],
    div[style*="max-width:420px"], div[style*="max-width: 420px"],
    div[style*="max-width:450px"], div[style*="max-width: 450px"],
    div[style*="max-width:500px"], div[style*="max-width: 500px"],
    div[style*="max-width:520px"], div[style*="max-width: 520px"],
    div[style*="max-width:550px"], div[style*="max-width: 550px"],
    div[style*="max-width:600px"], div[style*="max-width: 600px"],
    div[style*="max-width:650px"], div[style*="max-width: 650px"],
    div[style*="max-width:700px"], div[style*="max-width: 700px"] {
        max-width: 100% !important;
    }
    .form-group[style*="max-width"] { max-width: 100% !important; }

    /* Fixed min-widths → remove */
    input[style*="min-width:200px"], input[style*="min-width: 200px"],
    input[style*="min-width:180px"], input[style*="min-width: 180px"],
    input[style*="min-width:150px"], input[style*="min-width: 150px"] {
        min-width: 0 !important; width: 100% !important;
    }
    input[style*="max-width:180px"], input[style*="max-width: 180px"],
    input[style*="max-width:130px"], input[style*="max-width: 130px"] {
        max-width: 100% !important; width: 100% !important;
    }

    /* Fixed width containers → full */
    div[style*="width:100px"], div[style*="width: 100px"] { width: auto !important; }
    td[style*="width:130px"], td[style*="width: 130px"],
    td[style*="width:120px"], td[style*="width: 120px"] { width: auto !important; }
    th[style*="width:120px"], th[style*="width: 120px"],
    th[style*="width:100px"], th[style*="width: 100px"],
    th[style*="width:40px"], th[style*="width: 40px"] { width: auto !important; }

    /* Color pickers on mobile */
    input[type="color"] {
        width: 44px !important; height: 40px !important;
        min-width: 44px; padding: 2px !important;
    }

    /* Flex action rows (button groups) */
    .page-header > div,
    .card-header > div {
        display: flex; flex-wrap: wrap; gap: 6px;
        width: 100%;
    }
    .card-header > div .btn,
    .page-header > div .btn {
        flex: 1; min-width: 0; justify-content: center; text-align: center;
    }

    /* File upload zones */
    .upload-zone, .drop-zone, [id*="drop"] {
        padding: 16px !important;
    }
    .upload-zone p, .drop-zone p { font-size: 13px; }

    /* Long select/option elements */
    select.form-control { max-width: 100%; }

    /* Horizontally overflowing content */
    .table-wrap { margin: 0 -14px; padding: 0 14px; overflow-x: auto; -webkit-overflow-scrolling: touch; }

    /* Prevent any element from causing horizontal scroll */
    img, video, iframe, canvas, svg { max-width: 100%; height: auto; }

    /* ── Beitrag-card mobile ── */
    .beitrag-card { padding: 12px; }
    .beitrag-header { flex-direction: column; gap: 6px; }
    .beitrag-title { font-size: 13px; }
    .beitrag-times { font-size: 11px; }
    .beitrag-actions { flex-wrap: wrap; }

    /* ── Design Editor / Color grids ── */
    .color-grid { grid-template-columns: 1fr !important; }
    .ms-design-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

/* ── SMALL MOBILE: ≤ 600px ── */
@media (max-width: 600px) {
    html { font-size: 14px; }

    .main-content { padding: 10px 10px; padding-top: 60px; padding-bottom: 90px; }
    .top-header { height: 48px; }
    .top-header-date { display: none; }
    .top-header-clock { font-size: 18px; }

    .stats-grid { grid-template-columns: 1fr !important; gap: 8px; }
    .stat-card { padding: 12px 14px; display: flex; align-items: center; gap: 12px; flex-direction: row; }
    .stat-icon { margin-bottom: 0; flex-shrink: 0; }
    .stat-number, .stat-value { font-size: 22px; }

    .page-header h2 { font-size: 18px; }
    .card { padding: 12px; border-radius: 10px; }
    .card-header { flex-direction: column; align-items: flex-start; gap: 8px; }
    .card-header h3 { font-size: 14px; }

    .cal-10day-grid { grid-template-columns: repeat(3, 1fr) !important; }
    .cal-grid { grid-template-columns: repeat(7, 1fr); }
    .cal-day { min-height: 40px; padding: 3px; }
    .day-num { font-size: 11px; }
    .day-count { font-size: 9px; }

    /* Prevent iOS zoom on form focus (must be 16px+) */
    .form-control, input, select, textarea { font-size: 16px !important; }
    .form-control { padding: 10px 12px; }

    .btn { padding: 8px 12px; font-size: 12px; }
    .btn-lg { padding: 10px 16px; font-size: 13px; }

    .modal { padding: 14px; border-radius: 12px; }

    /* Quick action cards → single column */
    .qc-grid,
    div[style*="grid-template-columns: repeat(4"],
    div[style*="grid-template-columns:repeat(4"],
    div[style*="grid-template-columns: repeat(3"],
    div[style*="grid-template-columns:repeat(3"] {
        grid-template-columns: 1fr !important;
    }

    /* Sendungen grid */
    .sendung-grid { font-size: 11px; }
    .scroll-hint::after { opacity: 0.7; }

    /* Rechteverwaltung / complex tables */
    .table-wrap { margin: 0 -8px; padding: 0 8px; }

    /* Footer: hidden on mobile */
    .app-footer { display: none !important; }

    /* Audio player compact */
    .audio-player-bar { height: 48px; }
    .audio-info { max-width: 80px; }
    .audio-title { font-size: 11px; }
    .audio-volume { display: none; }
    .audio-volume-slider { display: none; }

    /* Login */
    .login-box { margin: 20px 8px; padding: 20px; border-radius: 12px; }
    .login-logo h1 { font-size: 22px; }

    /* Badge text */
    .badge { font-size: 10px; padding: 2px 7px; }

    /* Timeline compact */
    .timeline-entry { padding: 8px 0; }

    /* Messages compact */
    .msg-sidebar { max-height: 50vh; }

    /* Sendeplan design grid */
    .ms-design-grid { grid-template-columns: 1fr !important; }
}

/* ── EXTRA SMALL: ≤ 400px ── */
@media (max-width: 400px) {
    .main-content { padding: 8px 6px; padding-top: 56px; }
    .card { padding: 10px; border-radius: 8px; }
    .btn { padding: 7px 10px; font-size: 11px; gap: 4px; }
    .page-header h2 { font-size: 16px; }
    .top-header-clock { font-size: 16px; }
    .cal-10day-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .stats-grid { gap: 6px; }
    .stat-card { padding: 10px 12px; }
    .stat-number, .stat-value { font-size: 20px; }

    /* Stack all buttons vertically */
    .page-header .btn,
    .card-header .btn { width: 100%; }

    /* Very small table tweaks */
    table { min-width: 400px; }
    th, td { padding: 6px 8px; font-size: 11px; }
    th { font-size: 9px; }

    /* Sidebar narrower */
    .sidebar.open { width: 260px; }
}

/* ════════════════════ TOUCH HELPERS ════════════════════ */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets - 44px minimum per Apple HIG */
    .sidebar-nav a { padding: 12px; min-height: 44px; }
    .btn { min-height: 44px; }
    .top-header-btn { width: 40px; height: 40px; }
    .form-check input[type="checkbox"] { width: 22px; height: 22px; }
    .faq-question { padding: 14px 16px; min-height: 48px; }
    select.form-control { min-height: 44px; }
    .form-control { min-height: 44px; }
    input[type="color"] { min-height: 44px; }

    /* Better tap areas for small items */
    .badge { min-height: 28px; display: inline-flex; align-items: center; }
    .sidebar-action-btn { min-width: 44px; min-height: 44px; }

    /* Disable hover effects on touch */
    .stat-card:hover { transform: none; }
    .card:hover { box-shadow: var(--shadow-sm); }
    .show-card:hover { transform: none; }
    .day-tile:hover { transform: none; border-color: var(--border); }
    .cal-10day-cell:hover { transform: none; }
    .btn-primary:hover { transform: none; }
    .btn-ghost:hover { background: var(--bg-tertiary); color: var(--text-secondary); border-color: var(--border); }
    tr:hover td { background: transparent; }
    .beitrag-card:hover { border-color: var(--border); }
    .faq-item:hover { border-color: var(--border); }

    /* Better tap feedback */
    .btn:active { opacity: 0.8; transform: scale(0.97); }
    .sidebar-nav a:active { background: var(--sidebar-active-bg); }
    .faq-question:active { background: var(--bg-tertiary); }
    .beitrag-card:active { background: var(--hover-bg); }
    .cal-day:active { background: var(--accent-soft); }

    /* Prevent long-press context menu on certain items */
    .sidebar-nav a, .btn, .faq-question, .cal-day, .day-tile {
        -webkit-touch-callout: none;
    }
}

/* ════════════════════ SAFE AREA (Notch / Dynamic Island) ════════════════════ */
@supports (padding-top: env(safe-area-inset-top)) {
    .top-header {
        padding-top: env(safe-area-inset-top);
        height: calc(52px + env(safe-area-inset-top));
    }
    .app-footer { padding-bottom: env(safe-area-inset-bottom); }
    .audio-player-bar { padding-bottom: env(safe-area-inset-bottom); }
    .sidebar {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
    }
    .main-content {
        padding-left: calc(14px + env(safe-area-inset-left));
        padding-right: calc(14px + env(safe-area-inset-right));
    }
    .modal-overlay {
        padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    }
}

/* ════════════════════ LANDSCAPE PHONE ════════════════════ */
@media (max-height: 500px) and (orientation: landscape) {
    .main-content { padding-top: 48px; padding-bottom: 60px; }
    .top-header { height: 42px; }
    .sidebar.open { width: 240px; }
    .modal { max-height: 80vh; max-height: 80dvh; }
    .app-footer { height: 24px; }
    .footer-content { font-size: 9px; }
    .audio-player-bar { height: 44px; }
}

/* ════════════════════ DARK MODE SCROLL INDICATORS ════════════════════ */
.rp-overflow-x::-webkit-scrollbar { height: 4px; }
.rp-overflow-x::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ════════════════════ PRINT ════════════════════ */
@media print {
    .sidebar, .audio-player-bar, .app-footer, .mobile-menu-btn, .mobile-menu-btn-inline, .top-header, .btn, .sidebar-backdrop { display: none !important; }
    .main-content { margin-left: 0 !important; padding: 0 !important; padding-top: 0 !important; }
    .card { border: 1px solid #ccc; box-shadow: none; break-inside: avoid; }
    body { background: #fff; color: #000; }
    a { color: #000; text-decoration: underline; }
}
