:root {
    --bg-dark: #0f1923;
    --bg-card: #1a2735;
    --bg-sidebar: #152028;
    --bg-input: #1e2d3d;
    --text: #e0e6ed;
    --text-dim: #8899aa;
    --accent: #f39c12;
    --accent-hover: #e67e22;
    --success: #2ecc71;
    --danger: #e74c3c;
    --border: #2a3a4a;
    --radius: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    min-height: 100vh;
}

/* Login */
.login-container {
    max-width: 400px;
    margin: 15vh auto;
    padding: 2rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo h1 { font-size: 1.8rem; color: var(--accent); }
.login-logo p { color: var(--text-dim); }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: .3rem; font-size: .85rem; color: var(--text-dim); }
.form-group input, .form-group select {
    width: 100%; padding: .6rem .8rem;
    background: var(--bg-input); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius);
    font-size: .9rem;
}
.form-group input:focus, .form-group select:focus {
    outline: none; border-color: var(--accent);
}
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 120px; }

/* Buttons */
.btn {
    padding: .5rem 1rem; border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--bg-input); color: var(--text); cursor: pointer; font-size: .85rem;
    transition: all .2s;
}
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 600; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-success { background: var(--success); color: #000; border-color: var(--success); font-weight: 600; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-sm { padding: .3rem .6rem; font-size: .8rem; }
.btn-full { width: 100%; }
.btn-group { display: flex; gap: .5rem; flex-wrap: wrap; }
.error-text { color: var(--danger); margin-top: .5rem; font-size: .85rem; }

/* Layout */
#main-layout { display: flex; height: 100vh; }

#sidebar {
    width: 240px; min-width: 240px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
}
.sidebar-header { padding: 1.2rem; border-bottom: 1px solid var(--border); }
.sidebar-header h2 { font-size: 1.1rem; color: var(--accent); }
.sidebar-sub { font-size: .75rem; color: var(--text-dim); }

.nav-menu { list-style: none; padding: .5rem 0; flex: 1; }
.nav-link {
    display: block; padding: .7rem 1.2rem; color: var(--text-dim);
    text-decoration: none; font-size: .9rem; transition: all .2s;
    border-left: 3px solid transparent;
}
.nav-link:hover, .nav-link.active {
    color: var(--text); background: rgba(243, 156, 18, .08);
    border-left-color: var(--accent);
}

.sidebar-footer {
    padding: 1rem; border-top: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
    font-size: .8rem; color: var(--text-dim);
}

#content { flex: 1; overflow-y: auto; padding: 0; }
.page-content { padding: 1.5rem; height: 100%; }

/* Dashboard */
.dashboard-layout { display: flex; height: 100%; gap: 1rem; }
.dashboard-map-area { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.dashboard-sidebar { width: 360px; min-width: 300px; display: flex; flex-direction: column; overflow: hidden; }

.stats-bar { display: flex; gap: .8rem; margin-bottom: 1rem; }
.stat-card {
    flex: 1; background: var(--bg-card); padding: .8rem;
    border-radius: var(--radius); border: 1px solid var(--border);
    text-align: center;
}
.stat-num { display: block; font-size: 1.6rem; font-weight: 700; color: var(--accent); }
.stat-label { font-size: .75rem; color: var(--text-dim); }

.map-container {
    flex: 1; min-height: 300px;
    border-radius: var(--radius); overflow: hidden;
    border: 1px solid var(--border);
}

.filter-bar { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .8rem; }
.filter-bar select, .filter-bar input {
    flex: 1; min-width: 80px; padding: .4rem; font-size: .8rem;
    background: var(--bg-input); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius);
}

.ticket-list { flex: 1; overflow-y: auto; }
.ticket-item {
    padding: .6rem .8rem; margin-bottom: .4rem;
    background: var(--bg-card); border-radius: var(--radius);
    border-left: 3px solid var(--border);
    cursor: pointer; transition: background .2s; font-size: .85rem;
}
.ticket-item:hover { background: var(--bg-input); }
.ticket-item .t-kunde { font-weight: 600; }
.ticket-item .t-meta { color: var(--text-dim); font-size: .75rem; margin-top: .2rem; }

/* Routen */
.routen-controls { margin-bottom: 1rem; }
.routen-layout { display: flex; gap: 1rem; height: calc(100% - 180px); }
.routen-map { flex: 1; display: flex; flex-direction: column; }
.routen-tickets { width: 320px; overflow-y: auto; }
.route-info {
    display: flex; gap: 1.5rem; padding: .8rem;
    background: var(--bg-card); border-radius: var(--radius);
    margin-top: .5rem; font-size: .9rem;
}

/* Table */
.data-table {
    width: 100%; border-collapse: collapse;
    background: var(--bg-card); border-radius: var(--radius);
    overflow: hidden;
}
.data-table th, .data-table td {
    padding: .6rem .8rem; text-align: left;
    border-bottom: 1px solid var(--border); font-size: .85rem;
}
.data-table th { background: var(--bg-sidebar); color: var(--text-dim); font-weight: 600; }
.data-table tr:hover { background: rgba(243, 156, 18, .05); }
.table-scroll { max-height: 400px; overflow: auto; margin-bottom: 1rem; }

/* Upload */
.upload-zone {
    border: 2px dashed var(--border); border-radius: var(--radius);
    padding: 3rem; text-align: center; cursor: pointer;
    transition: border-color .2s; margin-bottom: 1rem;
}
.upload-zone:hover { border-color: var(--accent); }

/* Modal */
.modal {
    position: fixed; inset: 0; background: rgba(0,0,0,.6);
    display: flex; align-items: center; justify-content: center; z-index: 9999;
}
.modal-content {
    background: var(--bg-card); padding: 2rem;
    border-radius: var(--radius); border: 1px solid var(--border);
    min-width: 350px; max-width: 90vw;
}

/* Status badges */
.badge {
    display: inline-block; padding: .15rem .5rem; border-radius: 12px;
    font-size: .75rem; font-weight: 600;
}
.badge-offen { background: rgba(243,156,18,.2); color: var(--accent); }
.badge-geplant { background: rgba(52,152,219,.2); color: #3498db; }
.badge-angefragt { background: rgba(155,89,182,.2); color: #9b59b6; }
.badge-bestaetigt { background: rgba(46,204,113,.2); color: var(--success); }
.badge-erledigt { background: rgba(149,165,166,.2); color: #95a5a6; }

/* Leaflet overrides */
.leaflet-container { background: var(--bg-dark) !important; }

/* Responsive */
@media (max-width: 900px) {
    #sidebar { width: 60px; min-width: 60px; }
    .sidebar-header h2, .sidebar-sub, .nav-link span, .sidebar-footer span { display: none; }
    .nav-link { text-align: center; padding: .7rem .5rem; border-left: none; border-bottom: 2px solid transparent; }
    .nav-link:hover, .nav-link.active { border-left: none; border-bottom-color: var(--accent); }
    .dashboard-layout { flex-direction: column; }
    .dashboard-sidebar { width: 100%; min-width: 0; max-height: 40vh; }
    .routen-layout { flex-direction: column; }
    .routen-tickets { width: 100%; }
}

/* Techniker Marker */
.tech-marker {
    background: var(--accent); color: #000; padding: 2px 8px;
    border-radius: 12px; font-size: 11px; font-weight: 700;
    white-space: nowrap; border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,.4);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
