@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --color-primary: #c8102e;
    --color-primary-dark: #a00d24;
    --color-primary-light: #fde8ec;
    --color-black: #111111;
    --color-text: #1a1a1a;
    --color-text-muted: #6b7280;
    --color-white: #ffffff;
    --color-bg: #f5f5f7;
    --color-surface: #ffffff;
    --color-border: #e5e7eb;
    --color-border-light: #f0f0f2;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.08);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 999px;
    --sidebar-width: 260px;
    --content-padding: clamp(16px, 2.5vw, 40px);
    --transition: 0.2s ease;
    --status-open: #c8102e;
    --status-progress: #d97706;
    --status-solved: #059669;
    --status-paid: #059669;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    margin: 0;
    padding: 0;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

img, video, embed, iframe, canvas, svg {
    max-width: 100%;
}

/* ── App Shell ── */
.app-shell {
    display: flex;
    align-items: stretch;
    min-height: 100vh;
}

.app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.app-content {
    flex: 1;
    padding: var(--content-padding);
    padding-bottom: clamp(24px, 4vw, 48px);
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--color-black);
    color: var(--color-white);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    align-self: stretch;
    min-height: 100vh;
    height: auto;
    flex-shrink: 0;
    z-index: 100;
}

.sidebar-brand {
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand a {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--color-white);
}

.sidebar-brand img {
    height: 36px;
    width: auto;
    border-radius: 6px;
}

.sidebar-brand span {
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: -0.02em;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
    list-style: none;
    margin: 0;
}

.sidebar-nav li {
    margin-bottom: 2px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    color: rgba(255, 255, 255, 0.72);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition);
}

.sidebar-nav a i {
    width: 18px;
    text-align: center;
    font-size: 0.95rem;
    opacity: 0.85;
}

.sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--color-white);
}

.sidebar-nav a.active {
    background: var(--color-primary);
    color: var(--color-white);
}

.sidebar-nav a.active i {
    opacity: 1;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
}

/* ── Page Header ── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 16px;
}

h1 {
    font-size: clamp(1.35rem, 2.8vw, 1.75rem);
    font-weight: 700;
    color: var(--color-black);
    margin: 0 0 8px;
    letter-spacing: -0.03em;
}

h2 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--color-black);
    margin: 0 0 16px;
    letter-spacing: -0.02em;
}

h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text);
    margin: 0 0 12px;
}

/* ── Cards ── */
.card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--color-border-light);
    padding: clamp(16px, 3vw, 24px);
    width: 100%;
}

.card + .card {
    margin-top: 20px;
}

.dashboard-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.dashboard-quick-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    box-shadow: var(--shadow-sm);
    color: var(--color-black);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.dashboard-quick-btn i {
    color: var(--color-primary);
}

.dashboard-quick-btn:hover {
    background: var(--color-primary-light);
    border-color: rgba(200, 16, 46, 0.25);
    box-shadow: var(--shadow-md);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
    gap: clamp(12px, 2vw, 20px);
    width: 100%;
}

.dashboard-card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--color-border-light);
    padding: 24px;
    transition: box-shadow var(--transition);
}

.dashboard-card:hover {
    box-shadow: var(--shadow-lg);
}

.dashboard-card h2 {
    margin-top: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dashboard-card h2 i {
    color: var(--color-primary);
    font-size: 1.1rem;
}

.dashboard-card p {
    margin: 8px 0;
    font-size: 0.95rem;
    color: var(--color-text-muted);
}

.dashboard-stat-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dashboard-stat-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    margin: 0 -10px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--color-text-muted);
    font-size: 0.95rem;
    transition: background var(--transition);
}

.dashboard-stat-link:hover {
    background: rgba(200, 16, 46, 0.06);
}

.dashboard-stat-link.is-disabled {
    opacity: 0.55;
    cursor: default;
}

.dashboard-stat-link strong {
    color: var(--color-black);
    font-size: 1.1rem;
}

.dashboard-card-header-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    margin: 0 0 4px;
}

.dashboard-card-header-link:hover .dashboard-card-go {
    color: var(--color-primary);
}

.dashboard-card-go {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
    white-space: nowrap;
    transition: color var(--transition);
}

.dashboard-card strong {
    color: var(--color-black);
    font-size: 1.1rem;
}

.dashboard-card--wide {
    grid-column: 1 / -1;
}

.dashboard-link {
    display: inline-block;
    margin-top: 14px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--color-primary);
    text-decoration: none;
}

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

.dashboard-kv {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin: 8px 0;
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.dashboard-kv strong {
    font-size: 0.95rem;
}

.dashboard-empty {
    margin: 0;
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

.dashboard-warnings-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dashboard-warning {
    display: grid;
    grid-template-columns: 20px 1fr;
    gap: 10px;
    align-items: start;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--color-border-light);
    transition: background var(--transition);
}

.dashboard-warning:hover {
    background: var(--color-bg);
}

.dashboard-warning strong {
    display: block;
    font-size: 0.85rem;
    color: var(--color-black);
}

.dashboard-warning small {
    display: block;
    margin-top: 2px;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.dashboard-warning-error {
    border-left: 4px solid var(--color-primary);
    background: rgba(200, 16, 46, 0.04);
}

.dashboard-warning-warning {
    border-left: 4px solid #d97706;
    background: rgba(217, 119, 6, 0.05);
}

.dashboard-warning-info {
    border-left: 4px solid #2563eb;
    background: rgba(37, 99, 235, 0.04);
}

.dashboard-week-list,
.dashboard-activity-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 280px;
    overflow-y: auto;
}

.dashboard-week-item,
.dashboard-activity-item {
    display: block;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border-light);
    text-decoration: none;
    color: inherit;
    transition: background var(--transition);
}

.dashboard-week-item:hover,
.dashboard-activity-item:hover {
    background: rgba(200, 16, 46, 0.04);
}

.dashboard-week-item.is-today {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

.dashboard-week-date,
.dashboard-activity-date {
    display: block;
    font-size: 0.72rem;
    color: var(--color-text-muted);
    margin-bottom: 4px;
}

.dashboard-week-item strong,
.dashboard-activity-body strong {
    display: block;
    font-size: 0.84rem;
    color: var(--color-black);
}

.dashboard-week-item small,
.dashboard-activity-body small {
    display: block;
    margin-top: 2px;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.dashboard-activity-item {
    display: grid;
    grid-template-columns: 32px 1fr auto;
    gap: 10px;
    align-items: start;
}

.dashboard-activity-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--color-primary-light);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
}

.dashboard-chart-wrap {
    height: 220px;
    margin-top: 8px;
}

/* ── Buttons ── */
button,
.btn,
a.btn,
a.btn-secondary,
a.btn-ghost,
a.btn-primary {
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    line-height: 1.4;
    text-decoration: none;
    box-sizing: border-box;
}

button, .btn-primary {
    background: var(--color-primary);
    color: var(--color-white);
}

button:hover, .btn-primary:hover {
    background: var(--color-primary-dark);
}

.btn-secondary {
    background: var(--color-white);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover {
    background: var(--color-bg);
    border-color: #d1d5db;
}

.btn-ghost {
    background: transparent;
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
}

.btn-ghost:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

.btn-edit {
    background: var(--color-white);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-edit:hover {
    border-color: var(--color-black);
    color: var(--color-black);
}

.btn-delete {
    background: var(--color-white);
    color: var(--color-primary);
    border: 1px solid var(--color-primary-light);
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-delete:hover {
    background: var(--color-primary);
    color: var(--color-white);
    border-color: var(--color-primary);
}

.button-group {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: wrap;
}

/* ── Forms ── */
form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}

label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--color-text);
}

input, select, textarea {
    font-family: inherit;
    font-size: 0.9rem;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-white);
    color: var(--color-text);
    transition: border-color var(--transition), box-shadow var(--transition);
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
}

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

textarea {
    resize: vertical;
    min-height: 100px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: 16px 20px;
    width: 100%;
}

.form-grid .full-width {
    grid-column: 1 / -1;
}

.form-grid > div input,
.form-grid > div select,
.form-grid > div textarea {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.form-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    width: 100%;
    margin-top: 4px;
}

.form-actions button {
    width: 100%;
    justify-content: center;
}

.form-grid > button.full-width {
    grid-column: 1 / -1;
    width: 100%;
    justify-content: center;
}

.form-card {
    width: 100%;
}

.form-card form {
    display: block;
    width: 100%;
}

/* ── Tables ── */
.table-wrapper {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--color-border-light);
    overflow-x: auto;
    overflow-y: hidden;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
}

th, td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--color-border-light);
    font-size: 0.875rem;
}

th {
    background: var(--color-bg);
    font-weight: 600;
    color: var(--color-text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: rgba(200, 16, 46, 0.02);
}

/* ── Filter Bar ── */
.filter-bar {
    background: var(--color-surface);
    padding: 16px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border-light);
}

.filter-btn {
    padding: 9px 18px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    background: var(--color-white);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    transition: all var(--transition);
}

.filter-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.filter-btn.active {
    background: var(--color-primary);
    color: var(--color-white);
    border-color: var(--color-primary);
}

.export-year-bar label {
    font-weight: 600;
    color: var(--color-text);
    flex: 0 0 auto;
}

.export-year-input {
    flex: 0 0 90px !important;
    width: 90px !important;
    max-width: 120px !important;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* ── Status ── */
.status-open    { color: var(--status-open); }
.status-progress { color: var(--status-progress); }
.status-solved   { color: var(--status-solved); }
.status-paid     { color: var(--status-paid); }
.status-offen    { color: var(--status-open); }
.status-inbearbeitung { color: var(--status-progress); }
.status-gelöst   { color: var(--status-solved); }

.paid-yes { color: var(--status-paid); font-weight: 600; }
.paid-no  { color: var(--status-open); font-weight: 600; }

.status-badge {
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-white);
    display: inline-block;
}

.status-badge.status-offen { background: var(--status-open); }
.status-badge.status-inbearbeitung { background: var(--status-progress); color: var(--color-black); }
.status-badge.status-gelöst { background: var(--status-solved); }

/* ── Tickets ── */
.ticket-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
}

.ticket-card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--color-border-light);
    border-left: 4px solid var(--status-open);
    transition: all var(--transition);
    font-size: 0.9rem;
    overflow: hidden;
}

.ticket-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.ticket-card.gelöst { border-left-color: var(--status-solved); }
.ticket-card.inbearbeitung { border-left-color: var(--status-progress); }

.ticket-header {
    padding: 14px 18px;
    background: var(--color-bg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--color-border-light);
}

.ticket-id {
    font-weight: 700;
    color: var(--color-black);
    font-size: 0.85rem;
}

.ticket-body {
    padding: 16px 18px;
}

.ticket-body .customer {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: 8px;
    font-weight: 500;
}

.ticket-body .problem {
    font-weight: 500;
    line-height: 1.45;
    margin-bottom: 10px;
    color: var(--color-text);
}

.ticket-body .solution {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    background: var(--color-bg);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    border-left: 3px solid var(--status-solved);
}

.ticket-body .meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.ticket-body .hours {
    font-weight: 700;
    color: var(--color-black);
}

.ticket-content {
    white-space: pre-line;
    line-height: 1.6;
    margin: 10px 0;
}

.ticket-textarea {
    width: 100%;
    min-width: 100%;
    min-height: 120px;
    max-height: 70vh;
    resize: both;
    overflow: auto;
}

#ticketSolution.ticket-textarea {
    min-height: 160px;
}

/* ── Modern Ticket System ── */
.ticket-system { display: flex; flex-direction: column; gap: 20px; }

.ticket-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
    gap: 14px;
}

.ticket-stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: all var(--transition);
}

.ticket-stat-card:hover,
.ticket-stat-card.active {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md);
}

.ticket-stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.ticket-stat-icon.all { background: var(--color-bg); color: var(--color-black); }
.ticket-stat-icon.open { background: var(--color-primary-light); color: var(--color-primary); }
.ticket-stat-icon.progress { background: #fef3c7; color: var(--status-progress); }
.ticket-stat-icon.done { background: #d1fae5; color: var(--status-solved); }

.ticket-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-black);
    line-height: 1.1;
}

.ticket-stat-label {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    font-weight: 500;
}

.ticket-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    box-shadow: var(--shadow-sm);
}

.ticket-search {
    flex: 1 1 220px;
    min-width: 0;
    position: relative;
}

.ticket-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

.ticket-search input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    min-width: 0;
}

.ticket-view-toggle {
    display: flex;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    padding: 3px;
    border: 1px solid var(--color-border-light);
}

.ticket-view-toggle button {
    padding: 8px 14px;
    background: transparent;
    color: var(--color-text-muted);
    border: none;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
}

.ticket-view-toggle button.active {
    background: var(--color-white);
    color: var(--color-black);
    box-shadow: var(--shadow-sm);
}

.ticket-board {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
}

.ticket-column {
    background: var(--color-bg);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    min-height: 320px;
    display: flex;
    flex-direction: column;
}

.ticket-column--full {
    grid-column: 1 / -1;
    min-height: auto;
}

.ticket-column--collapsed {
    min-height: 0;
}

.ticket-column--collapsed .ticket-column-body {
    display: none;
}

.ticket-column-header--toggle {
    cursor: pointer;
    user-select: none;
    transition: background var(--transition);
}

.ticket-column-header--toggle:hover {
    background: rgba(200, 16, 46, 0.05);
}

.ticket-column-chevron {
    color: var(--color-text-muted);
    font-size: 0.72rem;
    width: 14px;
    transition: transform var(--transition);
}

.ticket-column:not(.ticket-column--collapsed) .ticket-column-chevron {
    transform: rotate(90deg);
    color: var(--color-primary);
}

.ticket-column-hint {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--color-text-muted);
    margin-left: 4px;
}

.ticket-column--solo {
    grid-column: 1 / -1;
}

.ticket-column-header {
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--color-border-light);
    background: var(--color-surface);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.ticket-column-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--color-black);
}

.ticket-column-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ticket-column-dot.offen { background: var(--status-open); }
.ticket-column-dot.inbearbeitung { background: var(--status-progress); }
.ticket-column-dot.gelöst { background: var(--status-solved); }

.ticket-column-count {
    background: var(--color-bg);
    color: var(--color-text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: var(--radius-full);
    border: 1px solid var(--color-border-light);
}

.ticket-column-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    overflow-y: auto;
    max-height: calc(100vh - 340px);
}

.ticket-column-empty {
    text-align: center;
    padding: 32px 16px;
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

.ticket-column-empty i {
    display: block;
    font-size: 1.6rem;
    margin-bottom: 10px;
    opacity: 0.35;
}

.ticket-item {
    background: var(--color-white);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-sm);
    padding: 14px;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
}

.ticket-item:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.ticket-item-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
    gap: 8px;
}

.ticket-item-id {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--color-primary);
    background: var(--color-primary-light);
    padding: 3px 8px;
    border-radius: var(--radius-full);
}

.ticket-item-date {
    font-size: 0.72rem;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.ticket-item-customer {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.ticket-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-black);
    color: var(--color-white);
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ticket-item-customer-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.3;
}

.ticket-item-customer-id {
    font-size: 0.72rem;
    color: var(--color-text-muted);
}

.ticket-item-problem {
    font-size: 0.84rem;
    color: var(--color-text);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 12px;
}

.ticket-item-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 10px;
    border-top: 1px solid var(--color-border-light);
}

.ticket-hours-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
    background: var(--color-bg);
    padding: 4px 10px;
    border-radius: var(--radius-full);
}

.ticket-item-actions {
    display: flex;
    gap: 4px;
}

.ticket-item-actions button {
    width: 30px;
    height: 30px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 0.75rem;
    background: var(--color-bg);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border-light);
}

.ticket-item-actions button:hover {
    background: var(--color-primary-light);
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.ticket-item-actions button.danger:hover {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.ticket-list-view { display: none; }
.ticket-list-view.active { display: block; }
.ticket-board.hidden { display: none; }

/* Gelöst-Spalte: kompakte Liste mit Aufklapp-Details */
.ticket-column-body.solved-list {
    gap: 0;
    padding: 0;
}

.ticket-solved-row {
    border-bottom: 1px solid var(--color-border-light);
}

.ticket-solved-row:last-child {
    border-bottom: none;
}

.ticket-solved-summary {
    display: grid;
    grid-template-columns: 24px 60px 100px minmax(160px, 220px) 1fr auto;
    align-items: center;
    gap: 12px 16px;
    padding: 14px 20px;
    cursor: pointer;
    transition: background var(--transition);
    font-size: 0.85rem;
}

.ticket-solved-chevron { grid-column: 1; }
.ticket-solved-id { grid-column: 2; }
.ticket-solved-date { grid-column: 3; }
.ticket-solved-customer { grid-column: 4; }
.ticket-solved-preview { grid-column: 5; min-width: 0; }
.ticket-solved-hours { grid-column: 6; }

.ticket-solved-summary:hover {
    background: rgba(200, 16, 46, 0.04);
}

.ticket-solved-row.expanded .ticket-solved-summary {
    background: var(--color-primary-light);
}

.ticket-solved-chevron {
    color: var(--color-text-muted);
    font-size: 0.7rem;
    transition: transform var(--transition);
}

.ticket-solved-row.expanded .ticket-solved-chevron {
    transform: rotate(90deg);
    color: var(--color-primary);
}

.ticket-solved-id {
    font-weight: 700;
    color: var(--color-primary);
    font-size: 0.78rem;
}

.ticket-solved-date {
    color: var(--color-text-muted);
    font-size: 0.75rem;
}

.ticket-solved-customer {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.ticket-solved-customer .ticket-avatar {
    width: 26px;
    height: 26px;
    font-size: 0.6rem;
}

.ticket-solved-customer-text {
    min-width: 0;
}

.ticket-solved-customer-name {
    font-weight: 600;
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ticket-solved-preview {
    color: var(--color-text-muted);
    font-size: 0.78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ticket-solved-hours {
    text-align: right;
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.ticket-solved-detail {
    display: none;
    padding: 16px 20px 20px 60px;
    background: var(--color-bg);
    border-top: 1px solid var(--color-border-light);
    animation: ticketDetailIn 0.2s ease;
}

.ticket-solved-detail .ticket-solved-detail-text {
    max-width: none;
}

.ticket-solved-row.expanded .ticket-solved-detail {
    display: block;
}

@keyframes ticketDetailIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.ticket-solved-detail-section {
    margin-bottom: 14px;
}

.ticket-solved-detail-section h4 {
    margin: 0 0 6px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    font-weight: 600;
}

.ticket-solved-detail-text {
    white-space: pre-line;
    font-size: 0.85rem;
    line-height: 1.55;
    color: var(--color-text);
    background: var(--color-white);
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border-light);
}

.ticket-solved-detail-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.ticket-list-table { width: 100%; }
.ticket-list-table tbody tr { cursor: pointer; }
.ticket-list-table .ticket-row-id {
    font-weight: 700;
    color: var(--color-primary);
    font-size: 0.85rem;
}

.ticket-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
}

.ticket-modal-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-size: 0.8rem;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    margin-bottom: 8px;
}

.ticket-status-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ticket-status-pill {
    padding: 8px 16px;
    border-radius: var(--radius-full);
    border: 2px solid var(--color-border);
    background: var(--color-white);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    color: var(--color-text-muted);
}

.ticket-status-pill:hover { border-color: var(--color-text-muted); }

.ticket-status-pill.selected.offen {
    border-color: var(--status-open);
    background: var(--color-primary-light);
    color: var(--status-open);
}

.ticket-status-pill.selected.inbearbeitung {
    border-color: var(--status-progress);
    background: #fef3c7;
    color: #92400e;
}

.ticket-status-pill.selected.gelöst {
    border-color: var(--status-solved);
    background: #d1fae5;
    color: #065f46;
}

.ticket-modal-content {
    max-width: 760px;
    width: min(96vw, 760px);
}

.ticket-priority-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ticket-priority-pill {
    padding: 8px 16px;
    border-radius: var(--radius-full);
    border: 2px solid var(--color-border);
    background: var(--color-white);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    color: var(--color-text-muted);
}

.ticket-priority-pill.selected.dringend {
    border-color: #dc2626;
    background: #fee2e2;
    color: #991b1b;
}

.ticket-priority-pill.selected.normal {
    border-color: #2563eb;
    background: #dbeafe;
    color: #1e40af;
}

.ticket-priority-pill.selected.niedrig {
    border-color: #6b7280;
    background: #f3f4f6;
    color: #374151;
}

.ticket-priority-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.ticket-priority-badge.priority-dringend {
    background: #fee2e2;
    color: #991b1b;
}

.ticket-priority-badge.priority-normal {
    background: #dbeafe;
    color: #1e40af;
}

.ticket-priority-badge.priority-niedrig {
    background: #f3f4f6;
    color: #4b5563;
}

.ticket-timer-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    background: var(--color-bg);
}

.ticket-timer-display {
    font-size: 1.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--color-black);
    margin-top: 4px;
}

.ticket-timer-hint {
    display: block;
    margin-top: 4px;
    color: var(--color-text-muted);
    font-size: 0.75rem;
}

.ticket-timer-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ticket-history-section {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--color-border-light);
}

.ticket-history-section h3 {
    margin: 0 0 12px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ticket-history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 220px;
    overflow-y: auto;
    margin-bottom: 12px;
}

.ticket-history-item {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border-light);
    background: var(--color-surface);
}

.ticket-history-meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-bottom: 4px;
}

.ticket-history-meta strong {
    color: var(--color-black);
    font-size: 0.78rem;
}

.ticket-history-body p {
    margin: 0;
    font-size: 0.84rem;
    white-space: pre-wrap;
}

.ticket-history-body small {
    display: block;
    margin-top: 4px;
    color: var(--color-text-muted);
}

.ticket-comment-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: end;
}

.ticket-recurring-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 18px;
    max-height: 220px;
    overflow-y: auto;
}

.ticket-recurring-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-sm);
    background: var(--color-bg);
}

.ticket-recurring-item.is-inactive {
    opacity: 0.55;
}

.ticket-recurring-item strong {
    display: block;
    font-size: 0.86rem;
}

.ticket-recurring-item small {
    display: block;
    margin-top: 2px;
    color: var(--color-text-muted);
    font-size: 0.74rem;
}

.ticket-recurring-form {
    border-top: 1px solid var(--color-border-light);
    padding-top: 16px;
}

.ticket-auto-assign {
    margin-top: 10px;
}

.ticket-unassigned-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    background: #fef3c7;
    color: #92400e;
    font-size: 0.68rem;
    font-weight: 700;
}

.ticket-form-section {
    margin-bottom: 20px;
}

.ticket-form-section label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.ticket-form-section label i {
    color: var(--color-primary);
    width: 16px;
}

@media (max-width: 1100px) {
    .ticket-board { grid-template-columns: 1fr; }
    .ticket-column,
    .ticket-column--full { grid-column: 1; min-height: auto; }
    .ticket-column-body { max-height: none; }

    .ticket-solved-summary {
        grid-template-columns: 24px 56px 1fr auto;
        grid-template-rows: auto auto;
    }
    .ticket-solved-date { grid-column: 2; grid-row: 2; font-size: 0.72rem; }
    .ticket-solved-customer { grid-column: 3; grid-row: 1; }
    .ticket-solved-hours { grid-column: 4; grid-row: 1; }
    .ticket-solved-preview { grid-column: 2 / -1; grid-row: 2; }
}

@media (max-width: 700px) {
    .ticket-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ── System-Seite ── */
.system-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.system-metric-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.system-metric-card h3 {
    margin: 0 0 12px;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.system-metric-card h3 i {
    color: var(--color-primary);
}

.system-metric-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-black);
    margin-bottom: 10px;
}

.system-metric-sub {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-bottom: 10px;
}

.system-progress {
    height: 8px;
    background: var(--color-bg);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.system-progress-bar {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.5s ease;
}

.system-progress-bar.cpu { background: var(--color-primary); }
.system-progress-bar.ram { background: var(--color-black); }
.system-progress-bar.disk { background: #6b7280; }

.system-info-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 0.82rem;
    color: var(--color-text-muted);
    margin-bottom: 24px;
}

.backup-schedule-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: 16px;
    margin: 20px 0;
}

.backup-schedule-card {
    background: var(--color-bg);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    padding: 18px;
}

.backup-schedule-card h4 {
    margin: 0 0 12px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.backup-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.backup-time-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 12px;
}

.backup-time-fields label {
    font-size: 0.75rem;
    margin-bottom: 4px;
}

.backup-category {
    display: inline-block;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
}

.backup-category.manual { background: var(--color-primary-light); color: var(--color-primary); }
.backup-category.daily { background: #dbeafe; color: #1d4ed8; }
.backup-category.weekly { background: #fef3c7; color: #92400e; }
.backup-category.monthly { background: #d1fae5; color: #065f46; }
.backup-category.startup,
.backup-category.legacy { background: var(--color-bg); color: var(--color-text-muted); }

.backup-selection-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin: 0 0 12px;
    padding: 12px 14px;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    background: var(--color-surface);
}

.backup-selection-info {
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.backup-select-col {
    width: 42px;
    text-align: center;
}

.backup-select-col input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.backup-row-selected {
    background: #fff5f5;
}

@media (max-width: 900px) {
    .system-grid,
    .backup-schedule-grid,
    .logs-overview-grid { grid-template-columns: 1fr; }

    .cli-line {
        grid-template-columns: 1fr;
        gap: 2px;
        padding: 8px 0;
    }

    .cli-autoscroll {
        margin-left: 0;
    }
}

/* ── Modals ── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 3000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.modal-overlay.open {
    display: flex;
}

.modal-content {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    padding: clamp(20px, 4vw, 32px);
    width: min(680px, 100%);
    max-width: 100%;
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-content h2 {
    margin-top: 0;
    margin-bottom: 24px;
    font-size: 1.35rem;
}

.invoice-preview-modal {
    width: min(920px, 100%);
}

#invoicePreviewModal {
    z-index: 3100;
}

.invoice-preview-frame {
    width: 100%;
    height: min(70vh, 720px);
    border: 1px solid var(--color-border, #ddd);
    border-radius: var(--radius-md, 8px);
    background: #f5f5f5;
}

.invoice-preview-loading,
.invoice-preview-error {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 240px;
    color: var(--color-text-muted);
    text-align: center;
    padding: 24px;
}

.invoice-preview-error {
    color: var(--color-danger, #c8102e);
}

.modal-actions {
    margin-top: 28px;
    text-align: right;
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}

.modal-actions button {
    flex: 1 1 auto;
    min-width: min(100%, 140px);
    justify-content: center;
}

/* ── Messages / Lists ── */
.message-list {
    max-height: 320px;
    overflow-y: auto;
}

.message-item {
    padding: 14px 0;
    border-bottom: 1px solid var(--color-border-light);
}

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

.message-date {
    font-weight: 600;
    color: var(--color-text-muted);
    font-size: 0.8rem;
    margin-bottom: 4px;
}

.message-title {
    font-size: 0.95rem;
    color: var(--color-text);
}

.message-meta {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 4px;
}

.no-messages {
    color: var(--color-text-muted);
    font-style: italic;
    text-align: center;
    padding: 24px 0;
}

/* ── Details Panel ── */
.details-content {
    padding: 20px;
    background: var(--color-bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border-light);
}

.details-panel {
    padding: 20px;
    background: var(--color-bg);
    border-radius: var(--radius-md);
    margin: 10px 0;
}

.details-panel .invoice-item,
.details-content ul li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--color-white);
    padding: 12px 16px;
    margin: 8px 0;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border-light);
}

.details-ticket {
    margin: 16px 0;
    padding: 18px;
    background: var(--color-white);
    border-left: 4px solid var(--status-open);
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border-light);
    border-left: 4px solid var(--status-open);
}

.details-ticket.solved { border-left-color: var(--status-solved); }
.details-ticket.progress { border-left-color: var(--status-progress); }

.details-ticket .ticket-text {
    white-space: pre-line;
    background: var(--color-bg);
    padding: 12px;
    border-radius: var(--radius-sm);
    margin: 8px 0;
    line-height: 1.6;
    font-size: 0.9rem;
}

.details-total {
    font-size: 1.35rem;
    font-weight: 700;
    text-align: right;
    color: var(--color-black);
    margin-top: 20px;
}

/* ── Charts ── */
.charts-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 24px;
    margin: 28px 0;
}

.chart-card {
    flex: 1 1 280px;
    min-width: 0;
    max-width: 100%;
    width: 100%;
    text-align: center;
}

.chart-container {
    position: relative;
    width: 100%;
    height: clamp(220px, 40vh, 360px);
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--color-border-light);
    overflow: hidden;
    padding: 16px;
}

.chart-container canvas {
    position: relative;
    z-index: 1;
}

.chart-legend {
    margin-top: 12px;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* ── Gewinn & Verlust ── */
.guv-page {
    width: 100%;
    max-width: 100%;
}

.page-subtitle {
    margin: 4px 0 0;
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.guv-filter-bar label {
    font-weight: 600;
    color: var(--color-text);
    flex: 0 0 auto;
}

.guv-filter-bar input[type="date"] {
    flex: 0 1 180px;
    max-width: 200px;
}

.guv-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.guv-stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.guv-stat-card.income { border-top: 3px solid var(--color-primary); }
.guv-stat-card.expense { border-top: 3px solid var(--color-black); }
.guv-stat-card.result { border-top: 3px solid var(--color-text-muted); }
.guv-stat-card.result.positive { border-top-color: #059669; }
.guv-stat-card.result.negative { border-top-color: #dc2626; }

.guv-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.guv-stat-card.income .guv-stat-icon { background: var(--color-primary-light); color: var(--color-primary); }
.guv-stat-card.expense .guv-stat-icon { background: rgba(17, 17, 17, 0.08); color: var(--color-black); }
.guv-stat-card.result .guv-stat-icon { background: var(--color-bg); color: var(--color-text-muted); }
.guv-stat-card.result.positive .guv-stat-icon { background: #d1fae5; color: #059669; }
.guv-stat-card.result.negative .guv-stat-icon { background: #fee2e2; color: #dc2626; }

.guv-stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.guv-stat-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.guv-stat-meta {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    margin-top: 2px;
}

.guv-legend-income { color: var(--color-primary); margin-right: 16px; }
.guv-legend-expense { color: var(--color-black); }

.guv-section {
    margin-bottom: 32px;
}

.guv-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.guv-section-header h2 {
    margin: 0;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.guv-section-total {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--color-primary);
}

.guv-section-total.expense {
    color: var(--color-black);
}

.guv-amount.income {
    font-weight: 700;
    color: var(--color-primary);
}

.guv-amount.expense {
    font-weight: 700;
    color: var(--color-black);
}

.customer-logo-thumb {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 6px;
    border: 1px solid var(--color-border-light);
    background: #fff;
    display: block;
}

.customer-logo-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    border: 1px dashed var(--color-border-light);
    background: var(--color-surface);
    color: var(--color-text-muted);
    font-size: 0.65rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.1;
}

.customer-logo-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.customer-logo-detail {
    width: 72px;
    height: 72px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid var(--color-border-light);
    background: #fff;
}

.customer-logo-detail-placeholder {
    width: 72px;
    height: 72px;
}

.field-hint {
    margin: 6px 0 0;
    font-size: 0.82rem;
    color: var(--color-text-muted);
}

.orphan-files-banner {
    margin: 0 0 18px;
    padding: 14px 16px;
    border: 1px solid #f0c36d;
    border-radius: var(--radius-md);
    background: #fff8e8;
    color: #5c4a1f;
}

.orphan-files-banner ul {
    margin: 10px 0 0;
    padding-left: 1.2rem;
}

.orphan-files-list li {
    margin: 6px 0;
}

.orphan-files-list .btn-delete {
    margin-left: 10px;
}

.guv-hint {
    margin: 10px 2px 0;
    font-size: 0.82rem;
    color: var(--color-text-muted);
}

.guv-hint a {
    color: var(--color-primary);
}

.guv-result-panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-md);
    border-left: 4px solid var(--color-text-muted);
}

.guv-result-panel.positive { border-left-color: #059669; }
.guv-result-panel.negative { border-left-color: #dc2626; }

.guv-result-panel h2 {
    margin: 0 0 18px;
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.guv-result-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 520px;
}

.guv-result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    font-size: 0.95rem;
}

.guv-result-row strong {
    font-size: 1rem;
    white-space: nowrap;
}

.guv-result-row strong.expense {
    color: var(--color-black);
}

.guv-result-divider {
    height: 1px;
    background: var(--color-border-light);
    margin: 4px 0;
}

.guv-result-row.total {
    font-size: 1.05rem;
    font-weight: 700;
    padding-top: 4px;
}

.guv-result-row.total strong {
    font-size: 1.35rem;
}

.guv-result-panel.positive .guv-result-row.total strong { color: #059669; }
.guv-result-panel.negative .guv-result-row.total strong { color: #dc2626; }

.guv-result-formula {
    margin: 16px 0 0;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.guv-chart-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-align: center;
    font-size: 0.9rem;
    color: var(--color-text-muted);
    background: rgba(255, 255, 255, 0.92);
}

.guv-year-breakdown {
    margin-top: 28px;
}

.guv-year-table .guv-year-row {
    cursor: pointer;
    transition: background var(--transition);
}

.guv-year-table .guv-year-row:hover {
    background: rgba(200, 16, 46, 0.04);
}

.guv-year-table .guv-year-row.active {
    background: rgba(200, 16, 46, 0.08);
}

.guv-year-table .guv-year-row.active td:first-child {
    box-shadow: inset 3px 0 0 var(--color-primary);
}

.guv-year-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background: var(--color-bg);
    font-weight: 700;
    font-size: 0.9rem;
}

.guv-year-row.active .guv-year-badge {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.guv-year-result-label {
    display: block;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 2px;
    opacity: 0.85;
}

.guv-amount.profit-positive,
.profit-positive {
    color: #059669;
    font-weight: 700;
}

.guv-amount.profit-negative,
.profit-negative {
    color: #dc2626;
    font-weight: 700;
}

.guv-year-action {
    color: var(--color-text-muted);
    text-align: center;
    width: 40px;
}

.guv-year-row:hover .guv-year-action {
    color: var(--color-primary);
}

.guv-year-total-row td {
    background: var(--color-bg);
    border-top: 2px solid var(--color-border-light);
}

#incomeChart {
    max-width: 100%;
    width: 300px;
    height: 150px;
}

/* ── Banking ── */
.banking-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.upload-section {
    width: 100%;
    text-align: center;
    margin-bottom: 20px;
}

.upload-card {
    width: 100%;
    max-width: 100%;
    margin: 0 auto 28px;
    padding: clamp(18px, 3vw, 28px);
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--color-border-light);
}

.left-column {
    flex: 1 1 280px;
    min-width: 0;
    background: var(--color-surface);
    padding: 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--color-border-light);
}

.right-column {
    flex: 3 1 360px;
    min-width: 0;
    background: var(--color-surface);
    padding: 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--color-border-light);
}

#fileList {
    list-style: none;
    padding: 0;
    margin: 0;
}

#fileList li {
    margin: 8px 0;
    padding: 12px 14px;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 0.875rem;
    border: 1px solid transparent;
}

#fileList li:hover {
    background: var(--color-primary-light);
    border-color: var(--color-primary);
    color: var(--color-primary-dark);
}

#previewFrame,
#previewEmbed,
.responsive-preview {
    width: 100%;
    height: clamp(280px, 55vh, 600px);
    border: none;
    border-radius: var(--radius-sm);
}

#previewMessage {
    text-align: center;
    color: var(--color-text-muted);
    font-style: italic;
    padding: 40px;
}

/* ── Calendar ── */
#calendar {
    width: 100%;
    max-width: 100%;
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--color-border-light);
    padding: clamp(12px, 2vw, 20px);
    overflow-x: auto;
}

/* ── Belege Upload / OCR ── */
.beleg-upload-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.beleg-upload-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 96px;
    padding: 16px;
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg);
    color: var(--color-text);
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
    font-weight: 600;
}

.beleg-upload-btn i {
    font-size: 1.4rem;
    color: var(--color-primary);
}

.beleg-upload-btn:hover {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

.beleg-upload-btn-camera {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

.beleg-upload-btn-secondary {
    background: var(--color-white);
}

.beleg-preview {
    margin-bottom: 18px;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--color-white);
}

.beleg-preview img {
    display: block;
    width: 100%;
    max-height: 320px;
    object-fit: contain;
    background: #111;
}

.beleg-preview-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-top: 1px solid var(--color-border-light);
    font-size: 0.85rem;
}

.beleg-ocr-status {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    border: 1px solid var(--color-border-light);
    background: var(--color-bg);
}

.beleg-ocr-status.info {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
}

.beleg-ocr-status.success {
    border-color: #86efac;
    background: #f0fdf4;
    color: #166534;
}

.beleg-ocr-status.warn {
    border-color: #fcd34d;
    background: #fffbeb;
    color: #92400e;
}

.beleg-ocr-status.error {
    border-color: #fca5a5;
    background: #fef2f2;
    color: #b91c1c;
}

/* ── Auth / Login ── */

.login-card {
    min-height: calc(100vh - 80px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 0;
}

.login-card-inner {
    width: 100%;
    max-width: 420px;
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 32px;
}

.login-brand {
    text-align: center;
    margin-bottom: 28px;
}

.login-brand img {
    width: 72px;
    height: 72px;
    object-fit: contain;
    margin-bottom: 12px;
}

.login-brand h1 {
    margin: 0 0 8px;
    font-size: 1.35rem;
}

.login-brand p {
    margin: 0;
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-form input {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.login-submit {
    width: 100%;
    justify-content: center;
}

.auth-message {
    margin: 0;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.auth-message.error {
    color: var(--color-primary);
}

.auth-message.success {
    color: #15803d;
}

.sidebar-user {
    margin-bottom: 10px;
}

.sidebar-user-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--color-text);
}

.sidebar-user-role {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: 2px;
}

.sidebar-logout {
    width: 100%;
    justify-content: center;
    margin-bottom: 10px;
    background: var(--color-white);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    font-size: 0.8rem;
    padding: 8px 12px;
}

.sidebar-logout:hover {
    background: var(--color-bg);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.sidebar-copy {
    font-size: 0.72rem;
    color: var(--color-text-muted);
}

.permission-panel {
    margin-top: 16px;
    padding: 16px;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-sm);
    background: var(--color-bg);
}

.permission-panel h3 {
    margin: 0 0 12px;
    font-size: 0.95rem;
}

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

.permission-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    cursor: pointer;
}

.role-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.role-badge.role-admin {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.role-badge.role-user {
    background: var(--color-bg);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border-light);
}

/* ── Logs ── */
.cli-monitor-card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--color-border-light);
    margin-bottom: 24px;
    overflow: hidden;
}

.cli-monitor-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px 24px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--color-border-light);
    background: var(--color-bg);
}

.cli-monitor-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text);
    min-width: 180px;
}

.cli-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #9ca3af;
    flex-shrink: 0;
}

.cli-status-dot.live {
    background: #22c55e;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.15);
}

.cli-status-dot.connecting {
    background: #f59e0b;
    animation: cli-pulse 1.2s infinite;
}

.cli-status-dot.offline,
.cli-status-dot.paused {
    background: var(--color-primary);
}

@keyframes cli-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

.cli-monitor-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    font-size: 0.78rem;
    color: var(--color-text-muted);
}

.cli-monitor-filters label,
.cli-autoscroll {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
}

.cli-autoscroll {
    margin-left: auto;
    font-size: 0.78rem;
    color: var(--color-text-muted);
}

.cli-monitor {
    background: #111111;
    color: #e5e7eb;
    min-height: clamp(260px, 45vh, 420px);
    max-height: 70vh;
    overflow-y: auto;
    padding: 16px 18px;
    font-family: 'Consolas', 'Cascadia Mono', 'Monaco', monospace;
    font-size: 0.82rem;
    line-height: 1.55;
}

.cli-line {
    display: grid;
    grid-template-columns: 74px 54px 68px 1fr;
    gap: 12px;
    padding: 2px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.cli-line:last-child {
    border-bottom: none;
}

.cli-timestamp {
    color: #6b7280;
}

.cli-level {
    font-weight: 700;
}

.cli-source {
    color: #9ca3af;
    text-transform: lowercase;
}

.cli-message {
    white-space: pre-wrap;
    word-break: break-word;
}

.cli-line.level-INFO .cli-level { color: #93c5fd; }
.cli-line.level-WARN .cli-level { color: #fbbf24; }
.cli-line.level-ERROR .cli-level { color: #f87171; }
.cli-line.level-DEBUG .cli-level { color: #a78bfa; }
.cli-line.level-ERROR .cli-message { color: #fecaca; }
.cli-line.source-http .cli-source { color: #60a5fa; }
.cli-line.source-email .cli-source { color: #f472b6; }
.cli-line.cli-line-system .cli-message { color: #9ca3af; font-style: italic; }

.cli-monitor-footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 18px;
    border-top: 1px solid var(--color-border-light);
    background: var(--color-bg);
    font-size: 0.78rem;
    color: var(--color-text-muted);
}

.logs-overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
    gap: 20px;
}

.log-section {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--color-border-light);
    padding: 24px;
    margin-bottom: 20px;
}

.log-section h2 {
    margin: 0 0 14px;
    font-size: 1rem;
}

.log-empty {
    color: var(--color-text-muted) !important;
    font-style: italic;
}

.log-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.log-section li {
    padding: 10px 14px;
    border-bottom: 1px solid var(--color-border-light);
    font-size: 0.875rem;
    font-family: 'Consolas', 'Monaco', monospace;
    color: var(--color-text);
}

.log-section li:last-child {
    border-bottom: none;
}

.log-section li:nth-child(even) {
    background: var(--color-bg);
}

/* ── Misc ── */
.spacer {
    height: 20px;
    border-top: 1px solid var(--color-border);
}

.logo-container {
    text-align: center;
    margin: 25px 0 15px;
}

#uploadMessage {
    margin-top: 15px;
    font-weight: 600;
    text-align: center;
}

#invoicesList li {
    margin-bottom: 10px;
}

div[style*="white-space: pre-line"] {
    font-size: 0.9rem;
}

/* Hide legacy top nav if still present */
body > nav {
    display: none;
}

/* ── Globale Suche ── */
.global-search {
    position: relative;
    z-index: 130;
}

.global-search-sidebar {
    padding: 0 12px 14px;
}

.global-search-mobile {
    flex: 1;
    min-width: 0;
}

.global-search-field {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-sm);
    padding: 0 12px;
    min-height: 40px;
}

.global-search-mobile .global-search-field {
    background: var(--color-bg);
    border-color: var(--color-border-light);
}

.global-search-field i {
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.85rem;
    flex-shrink: 0;
}

.global-search-mobile .global-search-field i {
    color: var(--color-text-muted);
}

.global-search-input {
    flex: 1;
    min-width: 0;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 8px 0 !important;
    color: var(--color-white);
    font-size: 0.85rem !important;
}

.global-search-mobile .global-search-input {
    color: var(--color-text);
}

.global-search-input::placeholder {
    color: rgba(255, 255, 255, 0.45);
}

.global-search-mobile .global-search-input::placeholder {
    color: var(--color-text-muted);
}

.global-search-input:focus {
    outline: none;
}

.global-search-kbd {
    display: none;
    font-size: 0.68rem;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.06);
}

.global-search-sidebar .global-search-kbd {
    display: inline-block;
}

.global-search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--color-white);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: min(60vh, 420px);
    overflow-y: auto;
    padding: 6px;
}

.global-search-mobile .global-search-results {
    position: fixed;
    left: 12px;
    right: 12px;
    top: 58px;
}

.global-search-item {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    gap: 10px;
    align-items: center;
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--color-text);
    text-align: left;
    cursor: pointer;
}

.global-search-item:hover {
    background: var(--color-bg);
}

.global-search-item-icon {
    color: var(--color-primary);
    text-align: center;
}

.global-search-item-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.global-search-item-title {
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.global-search-item-subtitle {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.global-search-item-type {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--color-text-muted);
    letter-spacing: 0.03em;
}

.global-search-empty,
.global-search-loading {
    padding: 14px;
    font-size: 0.82rem;
    color: var(--color-text-muted);
    text-align: center;
}

/* ── Mobile Header / Sidebar Drawer ── */
.mobile-header {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 12px var(--content-padding);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border-light);
    position: sticky;
    top: 0;
    z-index: 120;
    flex-wrap: wrap;
}

.mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-white);
    color: var(--color-text);
    cursor: pointer;
}

.mobile-header-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--color-black);
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 150;
}

.app-shell.sidebar-open {
    overflow: hidden;
}

.app-shell.sidebar-open .sidebar-backdrop {
    display: block;
}

/* ── Responsive ── */
@media (max-width: 1200px) {
    .ticket-board {
        grid-template-columns: 1fr;
    }

    .ticket-column,
    .ticket-column--full {
        grid-column: 1;
        min-height: auto;
    }

    .ticket-column-body {
        max-height: none;
    }
}

@media (max-width: 1024px) {
    .mobile-header {
        display: grid;
        grid-template-columns: auto 1fr;
        grid-template-areas:
            "menu title"
            "search search";
        align-items: center;
    }

    .mobile-menu-btn {
        grid-area: menu;
    }

    .mobile-header-title {
        grid-area: title;
        min-width: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .global-search-mobile {
        grid-area: search;
        width: 100%;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        width: min(85vw, var(--sidebar-width));
        transform: translateX(-105%);
        transition: transform 0.25s ease;
        z-index: 200;
    }

    .app-shell.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .page-header .button-group {
        justify-content: stretch;
    }

    .page-header .button-group button,
    .page-header .page-header-actions > a,
    .page-header .page-header-actions > button,
    .page-header > button {
        width: 100%;
        justify-content: center;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-bar button,
    .filter-bar input,
    .filter-bar select {
        width: 100%;
    }

    .ticket-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .ticket-search {
        width: 100%;
        flex: 1 1 100%;
    }

    .cli-monitor-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .cli-autoscroll {
        margin-left: 0;
    }

    .modal-actions {
        flex-direction: column;
    }

    .modal-actions button {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .charts-row {
        flex-direction: column;
        align-items: stretch;
    }

    .banking-container {
        flex-direction: column;
    }

    .ticket-solved-summary {
        grid-template-columns: 24px 1fr;
        grid-template-rows: auto auto auto;
    }

    .ticket-solved-date { grid-column: 2; grid-row: 2; font-size: 0.72rem; }
    .ticket-solved-customer { grid-column: 2; grid-row: 1; }
    .ticket-solved-hours { grid-column: 2; grid-row: 3; }
    .ticket-solved-preview { grid-column: 1 / -1; }

    .ticket-modal-header {
        flex-direction: column;
    }

    th, td {
        padding: 10px 12px;
        font-size: 0.8rem;
    }

    .login-card-inner {
        padding: 24px 18px;
    }
}

@media (max-width: 768px) {
    .guv-stats {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .ticket-stats {
        grid-template-columns: 1fr 1fr;
    }

    .form-actions {
        grid-template-columns: 1fr;
    }

    .permission-grid {
        grid-template-columns: 1fr;
    }

    #incomeChart {
        width: 100%;
        height: auto;
    }
}

/* ── Page Header Actions ── */
.page-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ── Notifications ── */
.notification-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.notification-wrap-sidebar {
    padding: 12px 16px 0;
}

.notification-bell-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-black);
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
}

.notification-bell-btn:hover,
.notification-bell-btn[aria-expanded="true"] {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: var(--radius-full);
    background: var(--color-primary);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}

.notification-panel {
    position: fixed;
    z-index: 5000;
    width: min(360px, calc(100vw - 24px));
    max-height: min(420px, calc(100vh - 80px));
    overflow: hidden;
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.notification-panel-header {
    padding: 12px 16px;
    font-weight: 700;
    font-size: 0.88rem;
    border-bottom: 1px solid var(--color-border-light);
    background: var(--color-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.notification-push-btn {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: var(--radius-full);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.notification-push-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.notification-push-btn.is-active {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.notification-panel-body {
    overflow-y: auto;
    max-height: 360px;
}

.notification-item {
    display: grid;
    grid-template-columns: 32px 1fr auto;
    gap: 10px;
    align-items: start;
    padding: 12px 16px;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid var(--color-border-light);
    transition: background var(--transition);
}

.notification-item:hover {
    background: rgba(200, 16, 46, 0.04);
}

.notification-item-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-size: 0.82rem;
}

.notification-item-title {
    display: block;
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--color-black);
}

.notification-item-subtitle {
    display: block;
    margin-top: 2px;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    line-height: 1.35;
}

.notification-item-time {
    font-size: 0.68rem;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.notification-empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

/* ── Toast Messages ── */
.toast-container {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 6000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: min(360px, calc(100vw - 32px));
}

.toast {
    display: grid;
    grid-template-columns: 20px 1fr 24px;
    gap: 10px;
    align-items: start;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    box-shadow: var(--shadow-lg);
    font-size: 0.85rem;
    animation: toastIn 0.2s ease;
}

.toast-success { border-left: 4px solid #059669; }
.toast-error { border-left: 4px solid var(--color-primary); }
.toast-warning { border-left: 4px solid #d97706; }
.toast-info { border-left: 4px solid #2563eb; }

.toast-close {
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0;
}

.toast-out {
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Extended Filters ── */
.filter-bar-extended input[type="text"],
.filter-bar-extended input[type="date"],
.filter-bar-extended input[type="number"],
.filter-bar-extended select {
    min-width: 120px;
    padding: 8px 12px;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    font-size: 0.85rem;
}

.filter-bar-extended label {
    font-size: 0.82rem;
    color: var(--color-text-muted);
    font-weight: 600;
}

/* ── Print Styles ── */
@media print {
    .sidebar,
    .sidebar-backdrop,
    .mobile-header,
    .global-search,
    .notification-wrap,
    .notification-panel,
    .toast-container,
    .filter-bar,
    .ticket-toolbar,
    .ticket-stats,
    .charts-row,
    .guv-filter-bar,
    .form-card,
    .upload-card,
    .page-header-actions .btn-print,
    button,
    .modal-overlay,
    .btn-delete,
    .btn-edit,
    .ticket-item-actions,
    .ticket-solved-detail-actions,
    .print-hide {
        display: none !important;
    }

    body,
    .app-shell,
    .app-main,
    .app-content {
        background: #fff !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .app-shell {
        display: block !important;
    }

    .app-content {
        padding: 0 !important;
    }

    .page-header {
        margin-bottom: 16px !important;
    }

    .page-header::after {
        content: "Gedruckt am " attr(data-print-date);
        display: block;
        font-size: 10pt;
        color: #666;
        margin-top: 4px;
    }

    .table-wrapper,
    .ticket-list-view.active,
    .guv-page {
        display: block !important;
        box-shadow: none !important;
        border: none !important;
    }

    .ticket-board,
    .ticket-list-view:not(.active) {
        display: none !important;
    }

    .ticket-list-view.active {
        display: block !important;
    }

    table {
        width: 100% !important;
        border-collapse: collapse !important;
        font-size: 10pt !important;
    }

    th, td {
        border: 1px solid #ccc !important;
        padding: 6px 8px !important;
    }

    th {
        background: #f3f3f3 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    tr {
        page-break-inside: avoid;
    }

    .guv-stats,
    .guv-section {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    a[href]::after {
        content: none !important;
    }
}

/* ── Vertrieb ── */
.vertrieb-page {
    max-width: 1400px;
}

.vertrieb-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.vertrieb-stat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    min-width: 160px;
    flex: 1 1 160px;
    box-shadow: var(--shadow-sm);
}

.vertrieb-stat-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.vertrieb-stat-icon.warning { background: #fef3c7; color: #d97706; }
.vertrieb-stat-icon.danger { background: #fee2e2; color: #dc2626; }
.vertrieb-stat-icon.info { background: #dbeafe; color: #2563eb; }
.vertrieb-stat-icon.success { background: #d1fae5; color: #059669; }

.vertrieb-stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.2;
}

.vertrieb-stat-label {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.vertrieb-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.vertrieb-tab {
    padding: 10px 18px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    background: var(--color-white);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--color-text-muted);
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.vertrieb-tab:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.vertrieb-tab.active {
    background: var(--color-primary);
    color: var(--color-white);
    border-color: var(--color-primary);
}

.vertrieb-tab-panel {
    display: none;
}

.vertrieb-tab-panel.active {
    display: block;
}

.vertrieb-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.vertrieb-card {
    margin-bottom: 0;
}

.vertrieb-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.vertrieb-card-header h2 {
    margin: 0;
    font-size: 1.1rem;
}

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

.vertrieb-table th,
.vertrieb-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--color-border-light);
}

.vertrieb-table tr.selected td {
    background: rgba(200, 16, 46, 0.04);
}

.vertrieb-table tr:hover td {
    background: rgba(200, 16, 46, 0.02);
}

.vertrieb-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.vertrieb-badge.primary { background: var(--color-primary-light); color: var(--color-primary); }
.vertrieb-badge.muted { background: var(--color-bg); color: var(--color-text-muted); }
.vertrieb-badge.warning { background: #fef3c7; color: #b45309; }
.vertrieb-badge.danger { background: #fee2e2; color: #dc2626; }
.vertrieb-badge.success { background: #d1fae5; color: #059669; }
.vertrieb-badge.status-aktiv { background: #d1fae5; color: #059669; }
.vertrieb-badge.status-pausiert { background: #fef3c7; color: #b45309; }
.vertrieb-badge.status-abgeschlossen { background: var(--color-bg); color: var(--color-text-muted); }
.vertrieb-badge.doc-vertrag { background: #dbeafe; color: #1d4ed8; }
.vertrieb-badge.doc-av-vertrag { background: #ede9fe; color: #6d28d9; }
.vertrieb-badge.doc-dsgvo { background: #fce7f3; color: #be185d; }
.vertrieb-badge.doc-sonstiges { background: var(--color-bg); color: var(--color-text-muted); }
.vertrieb-badge.quote-offen { background: #dbeafe; color: #1d4ed8; }
.vertrieb-badge.quote-angenommen { background: #d1fae5; color: #059669; }
.vertrieb-badge.quote-abgelehnt { background: #fee2e2; color: #dc2626; }

.vertrieb-followups {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 480px;
    overflow-y: auto;
}

.vertrieb-followup-item {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 12px;
    padding: 12px;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border-light);
}

.vertrieb-followup-item.overdue {
    border-left: 3px solid #dc2626;
}

.vertrieb-followup-date {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.vertrieb-followup-meta {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-bottom: 4px;
}

.vertrieb-followup-item p {
    margin: 6px 0;
    font-size: 0.88rem;
    line-height: 1.5;
}

.vertrieb-followup-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.vertrieb-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.vertrieb-section h3 {
    margin: 0 0 12px;
    font-size: 1rem;
}

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

.vertrieb-list-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    background: var(--color-bg);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

.vertrieb-item-meta {
    font-size: 0.82rem;
    color: var(--color-text-muted);
    margin-top: 4px;
}

.vertrieb-item-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.vertrieb-note-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.vertrieb-note-content {
    margin: 6px 0 0;
    white-space: pre-line;
    line-height: 1.5;
    font-size: 0.9rem;
}

.vertrieb-projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.vertrieb-project-card {
    padding: 18px;
}

.vertrieb-project-card.over-budget {
    border-left: 4px solid #dc2626;
}

.vertrieb-project-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 10px;
}

.vertrieb-project-header h3 {
    margin: 0 0 4px;
    font-size: 1.05rem;
}

.vertrieb-project-desc {
    font-size: 0.88rem;
    color: var(--color-text-muted);
    margin: 0 0 12px;
}

.vertrieb-project-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    font-size: 0.82rem;
    color: var(--color-text-muted);
    margin: 12px 0;
}

.vertrieb-budget-bar {
    margin: 12px 0;
}

.vertrieb-budget-track {
    height: 8px;
    background: var(--color-bg);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.vertrieb-budget-fill {
    height: 100%;
    background: var(--color-primary);
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
}

.vertrieb-budget-fill.over {
    background: #dc2626;
}

.vertrieb-budget-labels {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 6px;
}

.text-danger { color: #dc2626; font-weight: 600; }

.vertrieb-ticket-picker {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 220px;
    overflow-y: auto;
    padding: 8px;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
}

.vertrieb-ticket-check {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.88rem;
    cursor: pointer;
}

.vertrieb-ticket-check input {
    margin-top: 3px;
}

.vertrieb-empty {
    color: var(--color-text-muted);
    font-style: italic;
    padding: 12px 0;
    margin: 0;
}

.vertrieb-hint {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin: 0 0 12px;
}

.vertrieb-message {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.vertrieb-message.success { background: #d1fae5; color: #065f46; }
.vertrieb-message.error { background: #fee2e2; color: #991b1b; }
.vertrieb-message.info { background: #dbeafe; color: #1e40af; }

.vertrieb-doc-actions {
    display: flex;
    gap: 6px;
    white-space: nowrap;
}

.btn-sm {
    padding: 6px 12px !important;
    font-size: 0.8rem !important;
}

.modal-content-wide {
    max-width: 640px;
}

.details-crm-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.details-crm-list {
    list-style: none;
    padding: 0;
    margin: 0 0 16px;
}

.details-crm-list li {
    background: var(--color-white);
    padding: 10px 14px;
    margin: 6px 0;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border-light);
    font-size: 0.9rem;
}

.details-panel h5 {
    margin: 14px 0 8px;
    font-size: 0.95rem;
    color: var(--color-text-muted);
}

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