/* =========================================================================
   onlion.it Management-Tool — Design-System (Etappe E, nach Design-Handoff)
   Sidebar-Shell, Instrument Sans, Tokens aus design/design_handoff_management_tool
   Die Variablennamen sind mit dem Altsystem kompatibel (--primary, --accent, ...),
   damit Inline-Styles in den Views weiterhin funktionieren.
   ========================================================================= */

:root {
    /* Farben */
    --primary: #1d8fd6;
    --primary-hover: #136ba3;
    --primary-soft: #e3f2fc;
    --accent: #0d1726;          /* Sidebar / Dunkel */
    --accent-light: #16233a;    /* Flaechen in der Sidebar */
    --accent-lighter: #243347;
    --accent-line: #1c2a3d;
    --bg-main: #f4f6f9;
    --bg-card: #ffffff;
    --bg-subtle: #f8fafc;       /* Tabellenkopf, Gruppenkopf */
    --bg-hover: #f8fbfd;
    --bg-row-hover: #f2f7fb;
    --text-main: #17212e;
    --text-secondary: #3c4a5b;
    --text-muted: #6b7889;
    --text-faint: #8b97a6;
    --text-white: #ffffff;
    --sidebar-text: #8fa2b8;
    --sidebar-text-dim: #6d8098;
    --border: #e4e9f0;
    --border-strong: #dde4ec;
    --border-hover: #1d8fd6;
    --line: #eef2f6;
    --success: #177245;
    --success-bg: #e5f6ec;
    --danger: #c0392b;
    --danger-bg: #fdecea;
    --warning: #b26a00;
    --warning-bg: #fff4e2;
    --today-bg: #fdf6e3;

    --shadow-sm: 0 1px 2px rgba(23, 33, 46, 0.05);
    --shadow-md: 0 4px 12px rgba(23, 33, 46, 0.08);
    --shadow-lg: 0 16px 40px rgba(23, 33, 46, 0.16);

    /* Radien */
    --radius-xs: 6px;   /* Aktions-Buttons */
    --radius-sm: 8px;   /* Buttons, Inputs */
    --radius-md: 12px;  /* Karten */
    --radius-lg: 16px;  /* Pills */
    --radius: 8px;

    --font-family: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --transition: all 0.18s ease;

    --sidebar-width: 218px;
    --page-pad: 24px 28px;
}

/* --- RESET --- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font-family);
    font-size: 13.5px;
    line-height: 1.5;
    background: var(--bg-main);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}
h1, h2, h3, h4, h5, p, ul, ol { margin: 0; }
img { max-width: 100%; }
a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-hover); }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d3dae3; border-radius: 4px; }

/* =========================================================================
   APP-SHELL: Sidebar links, Inhalt rechts
   ========================================================================= */
.app {
    display: flex;
    flex-direction: row;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    background: var(--accent);
    color: var(--sidebar-text);
    width: var(--sidebar-width);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 16px 12px;
    overflow: auto;
}
.sidebar-logo {
    display: flex;
    align-items: center;
    padding: 4px 6px;
    margin-bottom: 14px;
}
.sidebar-logo a {
    background: #fff;
    border-radius: 8px;
    padding: 7px 12px;
    display: inline-flex;
}
.sidebar-logo img { height: 26px; display: block; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 8px 11px;
    border-radius: 8px;
    color: var(--sidebar-text);
    font-weight: 600;
    min-width: 0;
    transition: var(--transition);
}
.nav-link i {
    width: 17px;
    text-align: center;
    font-size: 15px;
    flex-shrink: 0;
}
.nav-link span.nav-label { white-space: nowrap; font-size: 13.5px; }
.nav-link:hover { color: #fff; }
.nav-link.active { background: var(--primary); color: #fff; }
.nav-badge {
    margin-left: auto;
    background: var(--primary);
    color: #fff;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 7px;
}
.nav-badge.amber { background: var(--accent-lighter); color: #ffb454; }
.nav-link.active .nav-badge { background: rgba(255,255,255,0.22); color: #fff; }

.sidebar-spacer { flex: 1; min-height: 8px; }
.sidebar-account {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-top: 1px solid var(--accent-line);
}
.sidebar-account .avatar {
    width: 30px; height: 30px;
    background: var(--accent-lighter);
    color: #9fd4f5;
    font-size: 12px;
}
.sidebar-account .acc-mail {
    color: #e6edf5; font-weight: 600; font-size: 12px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-account .acc-role { font-size: 11px; color: var(--sidebar-text-dim); }
.sidebar-account .acc-actions { display: flex; gap: 4px; flex-shrink: 0; }
.sidebar-account .acc-actions a {
    color: var(--sidebar-text-dim); font-size: 14px;
    width: 28px; height: 28px; border-radius: 7px;
    display: inline-flex; align-items: center; justify-content: center;
}
.sidebar-account .acc-actions a:hover, .sidebar-account .acc-actions a.active { color: #fff; background: var(--accent-lighter); }
.sidebar-foot { padding: 6px 10px 0; font-size: 11px; color: var(--sidebar-text-dim); }
.sidebar-foot a { color: var(--sidebar-text-dim); }
.sidebar-foot a:hover { color: #fff; }

.main {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.page {
    flex: 1;
    overflow: auto;
    padding: var(--page-pad);
}
.page.page-full {              /* Vollflaechige Module (Mail, Chat): keine Aussenabstaende */
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.page-alerts { padding: var(--page-pad); padding-bottom: 0; }
.page-full .page-alerts { padding: 12px 16px 0; }
.content-container { display: flex; flex-direction: column; gap: 16px; }

/* Kopfzeile einer Seite */
.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
}
.page-title { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.page-title.lg { font-size: 21px; }
.page-sub { color: var(--text-muted); margin-top: 2px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* =========================================================================
   KOMPONENTEN
   ========================================================================= */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
}
.card-hover:hover { border-color: var(--primary); }
.card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-title i { color: var(--primary); }
.card-head {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 8px; gap: 8px; flex-wrap: wrap;
}
.card-head .card-title { margin-bottom: 0; }
.card-link { font-size: 12px; font-weight: 600; }
.card-flush { padding: 0; overflow: hidden; }
.card-flush .card-bar {
    display: flex; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line);
    align-items: center; flex-wrap: wrap;
}

/* KPI-Karten (Dashboard) */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md);
    padding: 14px 16px; display: block; color: inherit;
}
.kpi-card:hover { border-color: var(--primary); color: inherit; }
.kpi-label { color: var(--text-muted); font-size: 12px; font-weight: 600; }
.kpi-value { font-size: 24px; font-weight: 700; margin-top: 3px; font-variant-numeric: tabular-nums; }
.kpi-meta { color: var(--text-faint); font-size: 11.5px; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 12px; }

/* Listenzeilen in Karten */
.list-row {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 0; border-top: 1px solid var(--line);
}
.list-row:first-child { border-top: 0; }
.list-main { flex: 1; min-width: 0; }
.list-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-sub { font-size: 11.5px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-amount { font-weight: 700; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.list-time { font-size: 11px; color: var(--text-faint); flex-shrink: 0; }

/* Avatar mit Initialen */
.avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--primary); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.avatar.sm { width: 28px; height: 28px; font-size: 10.5px; }
.avatar.lg { width: 34px; height: 34px; }

/* Status-Pills */
.pill {
    display: inline-block; border-radius: 11px; padding: 2px 9px;
    font-size: 10.5px; font-weight: 700; letter-spacing: 0.03em; white-space: nowrap;
}
.pill-open, .pill-warning { background: var(--warning-bg); color: var(--warning); }
.pill-paid, .pill-success { background: var(--success-bg); color: var(--success); }
.pill-danger { background: var(--danger-bg); color: var(--danger); }
.pill-info { background: var(--primary-soft); color: var(--primary-hover); }
.pill-muted { background: var(--line); color: var(--text-secondary); }
.pill-dark { background: var(--accent); color: #fff; }
.pill-lg { padding: 4px 11px; font-size: 11.5px; border-radius: 13px; }

/* Tabs als Pills (Dokumente) und Filter (Aufgaben) */
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tab {
    background: #fff; border: 1px solid var(--border-strong); color: var(--text-secondary);
    border-radius: 8px; padding: 6px 12px; font-size: 12px; font-weight: 600;
    display: inline-flex; align-items: center; gap: 6px;
}
.tab:hover { border-color: var(--primary); color: var(--primary); }
.tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.tabs.round .tab { border-radius: 15px; padding: 5px 13px; }
.tab.dashed { border-style: dashed; border-color: #c6d0dc; color: var(--text-faint); }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    font-family: var(--font-family); font-size: 13px; font-weight: 600;
    padding: 8px 14px; border-radius: var(--radius-sm);
    border: 1px solid transparent; cursor: pointer; transition: var(--transition);
    line-height: 1.3; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-secondary { background: #fff; color: var(--text-main); border-color: var(--border-strong); }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #a93226; color: #fff; }
.btn-outline-danger { background: #fff; color: var(--danger); border-color: var(--border-strong); }
.btn-outline-danger:hover { border-color: var(--danger); }
.btn-dark { background: var(--accent); color: #fff; }
.btn-dark:hover { background: var(--accent-light); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 7px; }
.btn-xs { padding: 3px 8px; font-size: 11px; border-radius: var(--radius-xs); }
.btn-icon { width: 30px; height: 30px; padding: 0; }
.btn:disabled, .btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn-group { display: flex; gap: 5px; flex-wrap: wrap; }

/* Formulare */
.form-group { margin-bottom: 14px; display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.form-control {
    font-family: var(--font-family); font-size: 13px;
    padding: 8px 12px; border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong); background: #fff; color: var(--text-main);
    transition: var(--transition); width: 100%;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(29, 143, 214, 0.12); }
select.form-control { appearance: auto; }
textarea.form-control { min-height: 90px; resize: vertical; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.form-hint { font-size: 11.5px; color: var(--text-faint); }
.form-check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset[disabled] .form-control { background: var(--bg-subtle); color: var(--text-muted); }

/* Tabellen */
.table-responsive { overflow-x: auto; width: 100%; }
.table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; }
.table th, .table td { padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th {
    background: var(--bg-subtle); font-size: 11px; font-weight: 700; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap;
}
.table tbody tr:hover { background: var(--bg-hover); }
.table .num, .table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table td.strong { font-weight: 700; }
.table td.muted { color: var(--text-muted); font-size: 12.5px; }
.table-actions { display: flex; gap: 5px; justify-content: flex-end; }
.group-head {
    padding: 8px 14px; background: var(--bg-subtle); border-bottom: 1px solid var(--line);
    font-size: 11.5px; font-weight: 700; color: var(--text-muted); text-transform: uppercase;
    letter-spacing: 0.04em; display: flex; justify-content: space-between;
}

/* Leerzustand */
.empty-state { padding: 44px 20px; text-align: center; color: var(--text-faint); }
.empty-state .empty-icon {
    width: 48px; height: 48px; border-radius: 50%; background: var(--line);
    display: flex; align-items: center; justify-content: center; font-size: 18px;
    margin: 0 auto 10px; color: var(--text-secondary);
}
.empty-state .empty-title { font-weight: 700; color: var(--text-secondary); }
.empty-state .empty-text { font-size: 12.5px; margin-top: 3px; }

/* Alerts */
.alert {
    padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13px;
    display: flex; align-items: center; gap: 10px; border: 1px solid transparent;
    animation: fadeIn 0.25s ease-in-out; margin-bottom: 14px;
}
.alert-success { background: var(--success-bg); color: var(--success); border-color: #cdebd8; }
.alert-error, .alert-danger { background: var(--danger-bg); color: var(--danger); border-color: #f5c9c4; }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-color: #f5dfb8; }
.alert-info { background: var(--primary-soft); color: var(--primary-hover); border-color: #c8e4f7; }

/* Modals (gemeinsames Muster fuer alle Views) */
.modal-backdrop, .modal {
    position: fixed; inset: 0; background: rgba(13, 23, 38, 0.45);
    display: none; align-items: center; justify-content: center; z-index: 2000; padding: 16px;
}
.modal.open, .modal[style*="flex"] { display: flex; }
.modal-content, .modal-box {
    background: #fff; border-radius: var(--radius-md); width: 100%; max-width: 560px;
    max-height: 92vh; overflow: auto; box-shadow: var(--shadow-lg); padding: 20px;
}
.modal-content.wide, .modal-box.wide { max-width: 860px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-title { font-size: 15px; font-weight: 700; }
.modal-close { background: none; border: 0; font-size: 18px; color: var(--text-muted); cursor: pointer; }
.modal-close:hover { color: var(--text-main); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* Hilfsklassen */
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.small { font-size: 12px; }
.strong { font-weight: 700; }
.num { font-variant-numeric: tabular-nums; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flex { display: flex; align-items: center; gap: 8px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }
.hide-mobile { }
.show-mobile { display: none !important; }

/* =========================================================================
   MAIL: drei Spalten, volle Hoehe
   ========================================================================= */
.mail-layout { flex: 1; display: flex; min-height: 0; }
.mail-folders {
    width: 225px; flex-shrink: 0; border-right: 1px solid var(--border); background: #fbfcfe;
    display: flex; flex-direction: column; overflow: auto; padding: 12px 10px;
}
.folder-link {
    display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 7px;
    color: var(--text-secondary); font-weight: 500;
}
.folder-link:hover { background: #eef3f8; color: var(--text-main); }
.folder-link.active { background: var(--primary-soft); color: var(--primary-hover); font-weight: 700; }
.folder-link .folder-icon { font-size: 12px; width: 15px; text-align: center; flex-shrink: 0; color: var(--text-faint); }
.folder-link.active .folder-icon { color: var(--primary-hover); }
.folder-link .folder-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.folder-link .folder-count { font-size: 11px; color: var(--text-faint); font-weight: 600; }
.folder-link.active .folder-count, .folder-link.unread .folder-count { color: var(--primary); }
.folder-link.level-1 { margin-left: 12px; } .folder-link.level-2 { margin-left: 24px; } .folder-link.level-3 { margin-left: 36px; }

.mail-list {
    width: 330px; flex-shrink: 0; border-right: 1px solid var(--border);
    display: flex; flex-direction: column; min-width: 0; background: #fff;
}
.mail-list-bar { padding: 10px 12px; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: center; }
.mail-list-scroll { flex: 1; overflow: auto; }
.mail-item {
    display: flex; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line);
    background: #fff; color: inherit; cursor: pointer;
}
.mail-item:hover { background: var(--bg-row-hover); color: inherit; }
.mail-item.active { background: #e9f4fc; }
.mail-item .mail-from { font-weight: 700; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-item.read .mail-from { font-weight: 600; color: var(--text-secondary); }
.mail-item .mail-time { font-size: 11px; color: var(--text-faint); flex-shrink: 0; }
.mail-item .mail-subject { font-size: 12px; font-weight: 600; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.mail-item.read .mail-subject { font-weight: 500; }
.mail-item .mail-preview { font-size: 11.5px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.mail-list-foot {
    padding: 8px 12px; border-top: 1px solid var(--line); display: flex; justify-content: space-between;
    align-items: center; font-size: 12px; color: var(--text-muted);
}
.mail-reader { flex: 1; min-width: 0; display: flex; flex-direction: column; background: #fff; }
.mail-reader-head { padding: 16px 20px; border-bottom: 1px solid var(--line); }
.mail-reader-body { flex: 1; overflow: auto; padding: 20px; color: var(--text-secondary); line-height: 1.6; }
.mail-back { display: none; font-weight: 600; font-size: 12.5px; margin-bottom: 8px; }

/* Lesebereich-Kopf: An/Cc/Datum vollstaendig, Aktionsleiste unter dem Kopf */
.mail-meta-lines { display: grid; grid-template-columns: max-content 1fr; gap: 2px 8px; margin: 6px 0 0; font-size: 12px; }
.mail-meta-lines dt { color: var(--text-faint); font-weight: 600; }
.mail-meta-lines dd { margin: 0; color: var(--text-secondary); word-break: break-word; overflow-wrap: anywhere; }
.mail-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.mail-actions-bar { width: 100%; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.mail-task-form select.form-control { max-width: 170px; }

/* Durchsuchbare Ordner-Combobox (Verschieben) */
.folder-combo { position: relative; display: inline-block; min-width: 170px; }
.folder-combo .folder-combo-input { width: 100%; padding: 5px 8px; font-size: 12px; border-radius: 7px; }
.folder-combo-xs { min-width: 150px; }
.folder-combo-xs .folder-combo-input { padding: 4px 8px; font-size: 11.5px; }
.folder-combo-list {
    position: absolute; top: calc(100% + 4px); left: 0; z-index: 500; min-width: 100%; width: max-content; max-width: 320px;
    max-height: 260px; overflow: auto; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg); padding: 4px 0;
}
.folder-combo-list[hidden] { display: none; }
.folder-combo-item {
    display: flex; align-items: center; gap: 7px; padding: 5px 10px; font-size: 12px; cursor: pointer;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-main);
}
.folder-combo-item i { color: var(--text-faint); font-size: 11px; width: 12px; text-align: center; }
.folder-combo-item:hover, .folder-combo-item.active { background: var(--primary-soft); color: var(--primary-hover); }
.folder-combo-item.level-1 { padding-left: 22px; } .folder-combo-item.level-2 { padding-left: 34px; }
.folder-combo-item.level-3 { padding-left: 46px; } .folder-combo-item.level-4 { padding-left: 58px; }
.folder-combo-empty { padding: 6px 10px; font-size: 12px; color: var(--text-faint); }

/* Leiste "Externe Bilder blockiert" */
.mail-images-bar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; padding: 8px 12px;
    background: var(--warning-bg); border: 1px solid #f0dcaa; border-radius: var(--radius-sm); font-size: 12px; color: var(--text-secondary);
}
.mail-images-bar > i { color: var(--warning); }
.mail-images-bar form { margin: 0; }

/* Drag & Drop: Mail-Zeilen auf Ordner ziehen */
.mail-item[draggable="true"] { cursor: pointer; }
.mail-item.dragging { opacity: 0.5; }
.folder-link.drop-hover { background: var(--primary-soft); color: var(--primary-hover); outline: 2px dashed var(--primary); outline-offset: -2px; }
body.mail-dragging .mail-folders { background: #f2f7fc; }

/* =========================================================================
   ZEITERFASSUNG: dunkle Timer-Karte
   ========================================================================= */
.timer-card {
    background: var(--accent); border-radius: var(--radius-md); padding: 14px 16px;
    display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px;
}
.timer-card .form-control {
    border-color: #2a3b52; background: var(--accent-light); color: #e6edf5; width: auto;
}
.timer-card .form-control::placeholder { color: #8fa2b8; }
.timer-card .form-control:focus { border-color: var(--primary); box-shadow: none; }
.timer-card .timer-clock { color: #fff; font-weight: 700; font-size: 20px; font-variant-numeric: tabular-nums; }

/* =========================================================================
   CHAT
   ========================================================================= */
.chat-layout { flex: 1; display: flex; flex-direction: column; min-height: 0; background: #fff; }
.chat-head { padding: 12px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.chat-messages { flex: 1; overflow: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px; background: var(--bg-subtle); }
.chat-msg { display: flex; flex-direction: column; align-items: flex-start; }
.chat-msg.mine { align-items: flex-end; }
.chat-meta { font-size: 11px; color: var(--text-faint); margin-bottom: 3px; }
.chat-bubble { background: #fff; color: var(--text-main); border-radius: 12px; padding: 9px 13px; max-width: 70%; line-height: 1.5; border: 1px solid var(--line); }
.chat-msg.mine .chat-bubble { background: var(--primary); color: #fff; border-color: var(--primary); }
.chat-input { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; }

/* =========================================================================
   KALENDER (FullCalendar-Anpassungen)
   ========================================================================= */
.fc { --fc-border-color: var(--line); --fc-today-bg-color: var(--today-bg); --fc-page-bg-color: #fff;
      --fc-event-bg-color: var(--primary-soft); --fc-event-border-color: var(--primary-soft); --fc-event-text-color: var(--primary-hover);
      font-family: var(--font-family); font-size: 12.5px; }
.fc .fc-toolbar-title { font-size: 18px; font-weight: 700; }
.fc .fc-button { background: #fff; border: 1px solid var(--border-strong); color: var(--text-secondary); font-weight: 600; font-size: 12.5px; text-transform: none; box-shadow: none; }
.fc .fc-button:hover { border-color: var(--primary); color: var(--primary); background: #fff; }
.fc .fc-button-primary:not(:disabled).fc-button-active, .fc .fc-button-primary:not(:disabled):active { background: var(--accent); border-color: var(--accent); color: #fff; }
.fc .fc-col-header-cell-cushion { font-size: 11.5px; font-weight: 700; color: var(--text-muted); padding: 8px; }
.fc .fc-daygrid-day-number { font-size: 11.5px; font-weight: 600; color: var(--text-secondary); }
.fc .fc-day-other .fc-daygrid-day-number { color: #c2cbd6; }
.fc .fc-event { border-radius: 4px; font-size: 11px; font-weight: 600; padding: 1px 4px; }
.fc-theme-standard .fc-scrollgrid { border-radius: var(--radius-md); overflow: hidden; border-color: var(--border); }

/* =========================================================================
   LOGIN
   ========================================================================= */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--accent); padding: 16px; }
.login-card { background: #fff; border-radius: var(--radius-md); padding: 28px; width: 100%; max-width: 400px; box-shadow: var(--shadow-lg); }
.login-logo { display: flex; justify-content: center; margin-bottom: 18px; }
.login-logo img { height: 34px; }

/* =========================================================================
   ANIMATION
   ========================================================================= */
@keyframes fadeIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

/* =========================================================================
   RESPONSIVE: < 760 px Sidebar wird zur Icon-Leiste unten
   ========================================================================= */
@media (max-width: 759px) {
    :root { --page-pad: 16px 14px; }
    .app { flex-direction: column; }
    .sidebar {
        order: 2; width: 100%; flex-direction: row; padding: 6px 8px; gap: 2px;
        align-items: stretch; overflow-x: auto; overflow-y: hidden;
        border-top: 1px solid var(--accent-line);
    }
    .sidebar-logo, .sidebar-spacer, .sidebar-account, .sidebar-foot, .nav-badge { display: none; }
    .nav-link { flex: 1 1 0; min-width: 0; flex-direction: column; gap: 3px; padding: 7px 2px; justify-content: center; border-radius: 8px; }
    .nav-link i { font-size: 16px; }
    .nav-link span.nav-label { font-size: 9.5px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
    .nav-link.mobile-only { display: flex; }
    .hide-mobile { display: none !important; }
    .show-mobile { display: initial !important; }

    /* Mail: Ordner weg, Liste/Lesebereich abwechselnd */
    .mail-folders { display: none; }
    .mail-list { width: 100%; flex-shrink: 1; border-right: 0; }
    .mail-reader { display: none; }
    .mail-layout.has-selection .mail-list { display: none; }
    .mail-layout.has-selection .mail-reader { display: flex; }
    .mail-back { display: inline-block; }
    .mail-layout.has-selection .page-alerts { display: none; }

    .modal-content, .modal-box { padding: 16px; }
    .table th, .table td { padding: 8px 10px; }
    .chat-bubble { max-width: 88%; }
}
@media (min-width: 760px) {
    .nav-link.mobile-only { display: none; }
}
