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

:root {
    --red: #e74c3c;
    --orange: #f39c12;
    --green: #27ae60;
    --purple: #8e44ad;
    --blue: #2980b9;
    --gray: #95a5a6;
    --bg: #f5f6fa;
    --card: #ffffff;
    --text: #2c3e50;
    --text-light: #7f8c8d;
    --border: #dcdde1;
    --accent: #3498db;
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

.header {
    background: var(--text);
    color: #fff;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left { display: flex; align-items: center; gap: 12px; }
.header h1 { font-size: 1.1rem; font-weight: 600; }

.hamburger {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
}

.header-right { display: flex; gap: 4px; }

.lang-btn {
    padding: 4px 10px;
    border: 1px solid rgba(255,255,255,0.3);
    background: transparent;
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.lang-btn:hover, .lang-btn.active { background: rgba(255,255,255,0.2); }

.tabs {
    display: flex;
    gap: 0;
    background: #fff;
    border-bottom: 2px solid var(--border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab {
    padding: 10px 16px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-light);
    white-space: nowrap;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

.tab:hover { color: var(--text); background: var(--bg); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.content { max-width: 960px; margin: 0 auto; padding: 20px; }

.tab-content { display: none; }
.tab-content.active { display: block; }

.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.card h2 { font-size: 1.1rem; margin-bottom: 12px; color: var(--text); }
.card h3 { font-size: 1rem; margin-bottom: 8px; color: var(--text); }

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin: 8px 0;
}

.progress-fill {
    height: 100%;
    background: var(--green);
    border-radius: 4px;
    transition: width 0.3s;
}

.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
}

.status-missing, .status-open, .status-not-started { background: var(--red); }
.status-in-progress, .status-in-arbeit { background: var(--orange); }
.status-done, .status-erledigt, .status-completed { background: var(--green); }
.status-needs-apostille, .status-apostille { background: var(--purple); }
.status-needs-translation, .status-translation { background: var(--blue); }
.status-available, .status-vorhanden { background: var(--green); }
.status-pending { background: var(--orange); }
.status-clarified { background: var(--green); }

select, input[type="text"], input[type="date"], input[type="time"], textarea {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: inherit;
    width: 100%;
    transition: border-color 0.2s;
}

select:focus, input:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
}

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

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: inherit;
    transition: opacity 0.2s;
}

.btn:hover { opacity: 0.85; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-success { background: var(--green); color: #fff; }
.btn-small { padding: 4px 10px; font-size: 0.8rem; }

.step-item, .doc-item, .apo-item, .note-item, .child-step-item {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 8px;
    align-items: start;
    background: #fff;
}

.step-item { grid-template-columns: 40px 1fr 140px 120px 100px; }
.doc-item { grid-template-columns: 1fr 150px 1fr 110px; }
.apo-item { grid-template-columns: 1fr 100px 130px 100px 130px 40px; }
.note-item { grid-template-columns: 1fr 110px 100px 40px; }

.step-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: #fff;
    background: var(--gray);
    flex-shrink: 0;
}

.step-num.done { background: var(--green); }
.step-num.in-progress { background: var(--orange); }

.section-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 20px 0 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--border);
}

.filter-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 4px 12px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.filter-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.calendar-header-cell {
    text-align: center;
    font-weight: 600;
    font-size: 0.8rem;
    padding: 8px 0;
    color: var(--text-light);
}

.calendar-day {
    min-height: 60px;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
    position: relative;
}

.calendar-day:hover { background: var(--bg); }
.calendar-day.today { border-color: var(--accent); border-width: 2px; }
.calendar-day.other-month { opacity: 0.4; }

.calendar-day-num { font-weight: 600; margin-bottom: 2px; }

.calendar-event {
    font-size: 0.7rem;
    padding: 1px 4px;
    border-radius: 3px;
    color: #fff;
    margin-bottom: 1px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cat-standesamt { background: var(--blue); }
.cat-visum { background: var(--orange); }
.cat-uebersetzung { background: var(--green); }
.cat-apostille { background: var(--purple); }
.cat-sonstiges { background: var(--gray); }

.calendar-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.calendar-nav button {
    background: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 6px 14px;
    cursor: pointer;
    font-size: 1rem;
}

.calendar-nav h3 { font-size: 1.1rem; }

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 200;
    justify-content: center;
    align-items: center;
}

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

.modal {
    background: #fff;
    border-radius: var(--radius);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 1rem; }

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
}

.modal-body { padding: 20px; }
.modal-body label { display: block; font-size: 0.85rem; font-weight: 600; margin: 10px 0 4px; }
.modal-body label:first-child { margin-top: 0; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

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

.dashboard-stat {
    text-align: center;
    padding: 16px;
}

.dashboard-stat .num {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
}

.dashboard-stat .label {
    font-size: 0.85rem;
    color: var(--text-light);
}

.upcoming-list { list-style: none; }

.upcoming-list li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
}

.upcoming-list li:last-child { border-bottom: none; }

.timeline-list { list-style: none; position: relative; padding-left: 20px; }

.timeline-list::before {
    content: "";
    position: absolute;
    left: 6px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    padding: 8px 0 16px 16px;
}

.timeline-item::before {
    content: "";
    position: absolute;
    left: -18px;
    top: 12px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid #fff;
}

.timeline-item.auto::before { background: var(--gray); }

.timeline-date { font-size: 0.8rem; color: var(--text-light); }
.timeline-text { font-size: 0.9rem; }

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

.child-tab {
    padding: 8px 20px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.child-tab.active { border-color: var(--accent); color: var(--accent); }
.child-content { display: none; }
.child-content.active { display: block; }

.visa-status-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
    font-size: 0.95rem;
}

.add-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.add-row input { flex: 1; }

@media (max-width: 768px) {
    .hamburger { display: block; }

    .tabs {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 52px;
        left: 0;
        right: 0;
        background: #fff;
        z-index: 99;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    }

    .tabs.open { display: flex; }
    .tab { text-align: left; padding: 12px 20px; border-bottom: 1px solid var(--border); border-left: 3px solid transparent; }
    .tab.active { border-bottom: 1px solid var(--border); border-left-color: var(--accent); }

    .content { padding: 12px; }

    .step-item { grid-template-columns: 32px 1fr; }
    .step-item select, .step-item input[type="date"] { grid-column: 1 / -1; }
    .step-item textarea { grid-column: 1 / -1; }

    .doc-item { grid-template-columns: 1fr; }
    .apo-item { grid-template-columns: 1fr 1fr; }
    .note-item { grid-template-columns: 1fr; }

    .calendar-day { min-height: 40px; font-size: 0.75rem; }
    .calendar-event { font-size: 0.6rem; }

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

@media print {
    .header, .tabs, .hamburger, .btn, .modal-overlay, .add-row, .filter-bar { display: none !important; }
    .tab-content { display: block !important; page-break-inside: avoid; margin-bottom: 20px; }
    .card { box-shadow: none; border: 1px solid #ccc; }
    body { background: #fff; }
    .content { max-width: 100%; }
    .status-badge { border: 1px solid #000; color: #000; background: #fff; }
    .status-done::before, .status-erledigt::before, .status-completed::before { content: "✓ "; }
    .status-open::before, .status-missing::before { content: "○ "; }
    .status-in-progress::before, .status-in-arbeit::before, .status-pending::before { content: "◐ "; }
}
