:root {
    --bg-primary: #f2f2f4;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f5f5f7;
    --bg-card: #ffffff;
    --bg-card-hover: #f5f5f7;
    --text-primary: #1d1d1f;
    --text-secondary: #6e6e73;
    --text-muted: #aeaeb2;
    --accent-primary: #0071e3;
    --accent-secondary: #0071e3;
    --success: #1a9e4a;
    --warning: #b07d2a;
    --danger: #c0392b;
    --info: #0071e3;
    --orange: #b07d2a;
    --border: rgba(0, 0, 0, 0.1);
    --border-focus: rgba(0, 113, 227, 0.45);
    --border-radius: 14px;
    --border-radius-small: 10px;
    --border-radius-tiny: 8px;
    --shadow-base: 0 2px 12px rgba(0, 0, 0, 0.07);
    --shadow-elevated: 0 8px 28px rgba(0, 0, 0, 0.12);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    font-weight: 400;
    padding: max(2rem, env(safe-area-inset-top))
             max(2rem, env(safe-area-inset-right))
             max(2rem, env(safe-area-inset-bottom))
             max(2rem, env(safe-area-inset-left));
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0;
}

.header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.header h1 {
    font-size: 2.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
}

.header p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

.back-button-container {
    margin-bottom: 1.5rem;
}

.back-button {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius-small);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-family: 'Inter', sans-serif;
    min-height: 44px;
    box-shadow: var(--shadow-base);
}

.back-button:hover {
    background: var(--bg-card-hover);
    border-color: rgba(0, 0, 0, 0.18);
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 1.25rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-base);
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius-tiny);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: filter 0.15s, opacity 0.15s, background 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-family: 'Inter', sans-serif;
    min-height: 44px;
}

.btn:hover { filter: brightness(0.95); }

.btn-primary { background: var(--accent-primary); color: white; }
.btn-primary:hover { filter: brightness(0.92); }

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

.btn-secondary:hover {
    background: var(--bg-card-hover);
    filter: none;
}

.btn-success { background: var(--success); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-danger  { background: var(--danger);  color: white; }

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    min-height: 36px;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    filter: none;
}

.calendar-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 1.25rem 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-base);
}

.nav-btn {
    background: var(--accent-primary);
    color: white;
    border: none;
    padding: 0;
    border-radius: var(--border-radius-tiny);
    cursor: pointer;
    font-size: 1.25rem;
    font-weight: 600;
    transition: filter 0.15s;
    min-width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-btn:hover { filter: brightness(0.92); }

.month-year {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    flex: 1;
}

.calendar {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-base);
}

.calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
}

.calendar-header div {
    padding: 1rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
}

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

.calendar-day {
    background: var(--bg-secondary);
    min-height: 130px;
    padding: 0.75rem;
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
    overflow: hidden;
}

.calendar-day:hover { background: var(--bg-card-hover); }

.calendar-day.other-month {
    background: var(--bg-primary);
    color: var(--text-muted);
    opacity: 0.5;
}

.calendar-day.today {
    background: rgba(0, 113, 227, 0.08);
    box-shadow: inset 3px 0 0 var(--accent-primary);
}

.calendar-day.today .day-number {
    color: var(--accent-primary);
    font-weight: 700;
    font-size: 1.15rem;
}

.calendar-day.today:hover {
    background: rgba(0, 113, 227, 0.12);
}

.calendar-day.has-appointments { background: rgba(0, 113, 227, 0.03); }

.calendar-day.has-appointments::after {
    content: '';
    position: absolute;
    top: 7px;
    left: 7px;
    width: 6px;
    height: 6px;
    background: var(--warning);
    border-radius: 50%;
}

.calendar-day.has-appointments:hover { background: var(--bg-card-hover); }

.calendar-day.day-full {
    background: rgba(192, 57, 43, 0.05);
    border-left: 2px solid var(--danger);
    opacity: 0.85;
}

.calendar-day.day-full:hover {
    cursor: not-allowed;
    background: rgba(192, 57, 43, 0.08);
}

.calendar-day.day-locked {
    background: rgba(192, 57, 43, 0.06);
    border-left: 2px solid var(--danger);
    opacity: 0.75;
}

.calendar-day.day-locked:hover { cursor: not-allowed; }

.day-number {
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 1rem;
    color: var(--text-primary);
}

.appointment-indicator {
    background: var(--accent-primary);
    color: white;
    font-size: 0.7rem;
    padding: 0.2rem 0.45rem;
    border-radius: 4px;
    margin-bottom: 0.2rem;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
    max-width: 100%;
}

.appointment-indicator.attended    { background: var(--success); }
.appointment-indicator.not-attended { background: var(--danger); }
.appointment-indicator.archived    { background: var(--text-muted); }

.appointment-count {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    background: var(--warning);
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

.day-locked-indicator {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    background: var(--danger);
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.limit-info {
    position: absolute;
    bottom: 0.4rem;
    left: 0.4rem;
    background: rgba(0, 113, 227, 0.12);
    color: var(--accent-secondary);
    font-size: 0.65rem;
    padding: 0.2rem 0.45rem;
    border-radius: 4px;
    font-weight: 600;
}

.limit-info.limit-full {
    background: rgba(192, 57, 43, 0.12);
    color: var(--danger);
}

.limit-info.locked {
    background: rgba(192, 57, 43, 0.12);
    color: var(--danger);
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Auslastungs-Balken unten am Tag */
.capacity-bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: rgba(0, 0, 0, 0.04);
    overflow: hidden;
    border-bottom-left-radius: inherit;
    border-bottom-right-radius: inherit;
}
.capacity-bar-fill {
    height: 100%;
    width: 0;
    transition: width 0.5s ease-out, background-color 0.2s ease;
    animation: capacityFillIn 0.6s ease-out;
}
@keyframes capacityFillIn {
    from { width: 0; }
}
.capacity-bar-fill.level-empty { background: transparent; }
.capacity-bar-fill.level-low   { background: #22c55e; } /* grün */
.capacity-bar-fill.level-mid   { background: #eab308; } /* gelb */
.capacity-bar-fill.level-high  { background: #f97316; } /* orange */
.capacity-bar-fill.level-full  { background: #ef4444; } /* rot */

/* Bei reduzierter Bewegung: keine Animation */
@media (prefers-reduced-motion: reduce) {
    .capacity-bar-fill {
        animation: none;
        transition: none;
    }
}

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 0;
    width: 95%;
    max-width: 900px;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.97);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-elevated);
}

.modal.show .modal-content { transform: scale(1); }

.modal-header {
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
}

.close {
    color: var(--text-secondary);
    font-size: 22px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    padding: 0.4rem;
    border-radius: var(--border-radius-tiny);
    transition: color 0.2s, background 0.2s;
    background: transparent;
    min-width: 36px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-body::-webkit-scrollbar { width: 8px; }
.modal-body::-webkit-scrollbar-track { background: var(--bg-tertiary); border-radius: 4px; }
.modal-body::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.15); border-radius: 4px; }
.modal-body::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.25); }

.day-appointments {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.appointment-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-small);
    padding: 1.5rem;
    transition: background 0.15s;
    position: relative;
    border-top: 3px solid var(--accent-primary);
    box-shadow: var(--shadow-base);
}

.appointment-card:hover { background: var(--bg-card-hover); }
.appointment-card.attended    { border-top-color: var(--success); }
.appointment-card.not-attended { border-top-color: var(--danger); }
.appointment-card.pending     { border-top-color: var(--warning); }
.appointment-card.archived    { opacity: 0.65; border-top-color: var(--text-muted); }

.appointment-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.25rem;
}

.customer-name {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
}

.appointment-time {
    background: rgba(0, 113, 227, 0.1);
    color: var(--accent-primary);
    padding: 0.35rem 0.75rem;
    border-radius: var(--border-radius-tiny);
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid rgba(0, 113, 227, 0.2);
}

.status-badge {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.status-pending {
    background: rgba(176, 125, 42, 0.12);
    color: var(--warning);
    border: 1px solid rgba(176, 125, 42, 0.25);
}

.status-attended {
    background: rgba(26, 158, 74, 0.12);
    color: var(--success);
    border: 1px solid rgba(26, 158, 74, 0.25);
}

.status-not-attended {
    background: rgba(192, 57, 43, 0.1);
    color: var(--danger);
    border: 1px solid rgba(192, 57, 43, 0.25);
}

.status-archived {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.appointment-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.detail-item {
    background: var(--bg-tertiary);
    padding: 1rem;
    border-radius: var(--border-radius-tiny);
    border: 1px solid var(--border);
}

.detail-label {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.detail-value {
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1.4;
    font-weight: 500;
    word-wrap: break-word;
    white-space: pre-line;
}

.price-value {
    color: var(--success);
    font-weight: 700;
    font-size: 1.15rem;
}

.price-value::after {
    content: ' €';
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.problem-description { grid-column: 1 / -1; }
.notes-item          { grid-column: 1 / -1; }

.appointment-actions {
    display: flex;
    gap: 0.6rem;
    margin-top: 1.25rem;
    flex-wrap: wrap;
}

.form-group { margin-bottom: 1.5rem; }

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    background: var(--bg-tertiary);
    border: 1.5px solid var(--border);
    border-radius: var(--border-radius-tiny);
    padding: 0.875rem 1rem;
    color: var(--text-primary);
    font-size: 16px;
    transition: border-color 0.2s;
    font-family: 'Inter', sans-serif;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.1);
}

.form-group textarea {
    min-height: 110px;
    resize: vertical;
}

.form-group select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236e6e73' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1rem;
    padding-right: 3rem;
    cursor: pointer;
}

.form-group select:focus {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230071e3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
}

.form-group select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.form-row { display: flex; gap: 1.5rem; }
.form-row .form-group { flex: 1; }

.form-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    appearance: none;
    background: var(--bg-tertiary);
    border: 1.5px solid var(--border);
    border-radius: 5px;
    cursor: pointer;
    position: relative;
    transition: border-color 0.2s, background 0.2s;
}

.form-group input[type="checkbox"]:checked {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.form-group input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    font-size: 12px;
}

.form-group input[type="checkbox"]:focus { box-shadow: none; }

.form-group label[style*="cursor: pointer"] { transition: color 0.2s; }
.form-group label[style*="cursor: pointer"]:hover { color: var(--text-primary); }

.modal-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    background: var(--bg-tertiary);
}

.loading {
    display: none;
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
}

.loading::after {
    content: '';
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top: 3px solid var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 1rem;
}

@keyframes spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.empty-day {
    text-align: center;
    padding: 3.5rem 2rem;
    color: var(--text-secondary);
}

.empty-day-icon { font-size: 3.5rem; margin-bottom: 1.5rem; opacity: 0.5; }

.empty-day h3 {
    font-size: 1.4rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    font-weight: 600;
}

.empty-day p {
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    max-width: 380px;
    margin-left: auto;
    margin-right: auto;
}

.limit-warning {
    background: rgba(176, 125, 42, 0.08);
    color: var(--warning);
    padding: 0.875rem 1.25rem;
    border-radius: var(--border-radius-tiny);
    margin: 1.25rem 0;
    font-size: 0.95rem;
    font-weight: 500;
    border: 1px solid rgba(176, 125, 42, 0.25);
}

.limit-warning.limit-reached {
    background: rgba(192, 57, 43, 0.07);
    color: var(--danger);
    border-color: rgba(192, 57, 43, 0.25);
}

.day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-tiny);
    border: 1px solid var(--border);
}

.limit-info-detailed {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--success);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.limit-info-detailed.limit-reached { color: var(--danger); }

.toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius-tiny);
    color: white;
    font-weight: 500;
    z-index: 2001;
    animation: toastSlideIn 0.3s ease;
    border: none;
    box-shadow: var(--shadow-elevated);
    max-width: 380px;
    font-size: 0.95rem;
}

.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
.toast.warning { background: var(--warning); }

@keyframes toastSlideIn {
    from { transform: translateX(110%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

.toast-container { max-width: 380px; }

.btn:focus,
.nav-btn:focus,
.back-button:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

.calendar-day:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: -2px;
}

@media (max-width: 768px) {
    body {
        padding: max(1rem, env(safe-area-inset-top))
                 max(1rem, env(safe-area-inset-right))
                 max(1rem, env(safe-area-inset-bottom))
                 max(1rem, env(safe-area-inset-left));
    }

    .header h1 { font-size: 2rem; }
    .header p  { font-size: 1rem; padding: 0 1rem; }

    .back-button { width: 100%; justify-content: center; padding: 1rem; }

    .controls { flex-direction: column; align-items: stretch; gap: 0.75rem; padding: 1rem; }
    .controls > * { width: 100%; }

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

    .calendar-nav { flex-direction: column; gap: 1rem; text-align: center; padding: 1rem; }
    .nav-btn { min-width: 50px; height: 50px; }
    .month-year { font-size: 1.5rem; }

    .calendar-header div { padding: 0.75rem 0.25rem; font-size: 0.8rem; }
    .calendar-day { min-height: 95px; padding: 0.4rem; }
    .day-number { font-size: 0.9rem; margin-bottom: 0.4rem; }
    .calendar-day.today .day-number { font-size: 1rem; }

    .appointment-indicator { font-size: 0.6rem; padding: 0.15rem 0.3rem; margin-bottom: 0.15rem; }
    .appointment-count { width: 20px; height: 20px; font-size: 0.65rem; top: 0.4rem; right: 0.4rem; }
    .day-locked-indicator { width: 20px; height: 20px; font-size: 0.7rem; top: 0.4rem; right: 0.4rem; }
    .limit-info { font-size: 0.6rem; padding: 0.15rem 0.35rem; bottom: 0.35rem; left: 0.35rem; }

    .modal-content { width: 95%; margin: 1rem; max-height: 90vh; }
    .modal-header { padding: 1.25rem; }
    .modal-header h2 { font-size: 1.2rem; }
    .modal-body { padding: 1.25rem; max-height: 65vh; }
    .modal-footer { padding: 1.25rem; flex-direction: column; }
    .modal-footer .btn { width: 100%; }

    .appointment-card { padding: 1.25rem; }
    .customer-name { font-size: 1.1rem; }
    .appointment-time { padding: 0.3rem 0.6rem; font-size: 0.85rem; }

    .status-badge { position: static; margin-bottom: 0.75rem; align-self: flex-start; }
    .appointment-header { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
    .appointment-details { grid-template-columns: 1fr; gap: 0.75rem; }
    .detail-item { padding: 0.875rem; }
    .form-row { flex-direction: column; gap: 0; }
    .appointment-actions { flex-direction: column; gap: 0.5rem; }
    .appointment-actions .btn { width: 100%; }
    .day-header { flex-direction: column; gap: 0.75rem; padding: 1rem; }
    .day-header .btn { width: 100%; }

    .toast-container { bottom: 1rem !important; right: 1rem !important; left: 1rem !important; max-width: none !important; }
    .toast { max-width: none !important; }

    .empty-day { padding: 2.5rem 1rem; }
    .empty-day-icon { font-size: 3rem; }
    .empty-day h3 { font-size: 1.2rem; }
    .empty-day p { font-size: 0.95rem; }
}

@media (max-width: 480px) {
    body {
        padding: max(0.75rem, env(safe-area-inset-top))
                 max(0.75rem, env(safe-area-inset-right))
                 max(0.75rem, env(safe-area-inset-bottom))
                 max(0.75rem, env(safe-area-inset-left));
    }

    .header h1 { font-size: 1.75rem; }
    .header p  { font-size: 0.95rem; }

    .calendar-day { min-height: 80px; padding: 0.35rem; }
    .day-number { font-size: 0.85rem; }
    .appointment-indicator { font-size: 0.55rem; }
    .appointment-count { width: 18px; height: 18px; font-size: 0.6rem; }

    .modal-header h2 { font-size: 1.1rem; }
    .customer-name { font-size: 1rem; }
    .month-year { font-size: 1.25rem; }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .container { padding: 0; }
    .calendar-day { min-height: 115px; }
    .appointment-details { grid-template-columns: repeat(2, 1fr); }
}

@media (max-height: 600px) and (orientation: landscape) {
    .modal-content { max-height: 95vh; }
    .modal-body { max-height: 60vh; }
    .header h1 { font-size: 1.75rem; }
    .calendar-day { min-height: 85px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (hover: none) and (pointer: coarse) {
    .calendar-day:hover { transform: none; }
    .calendar-day:active { transform: scale(0.98); }
    .btn:active { transform: scale(0.96); }
}

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .appointment-indicator,
    .status-badge {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

  /* Drag & Drop Styles für Termin-Umsortierung */
        .appointment-card[draggable="true"] {
            position: relative;
            cursor: grab;
            transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
        }
        .appointment-card[draggable="true"]:active {
            cursor: grabbing;
        }
        .appointment-card .drag-handle {
            position: absolute;
            top: 50%;
            left: 8px;
            transform: translateY(-50%);
            color: rgba(0, 0, 0, 0.25);
            font-size: 1.1rem;
            letter-spacing: -2px;
            user-select: none;
            pointer-events: none;
            opacity: 0;
            transition: opacity 0.15s ease;
        }
        .appointment-card[draggable="true"]:hover .drag-handle {
            opacity: 1;
        }
        .appointment-card.dragging {
            opacity: 0.4;
            cursor: grabbing;
        }
        .appointment-card.drag-over-top {
            box-shadow: 0 -3px 0 0 var(--accent, #0a84ff);
        }
        .appointment-card.drag-over-bottom {
            box-shadow: 0 3px 0 0 var(--accent, #0a84ff);
        }
        .reorder-toast {
            position: fixed;
            bottom: 24px;
            left: 50%;
            transform: translateX(-50%) translateY(20px);
            background: rgba(16, 185, 129, 0.95);
            color: #fff;
            padding: 10px 20px;
            border-radius: 10px;
            font-size: 0.9rem;
            font-weight: 500;
            box-shadow: 0 8px 24px rgba(0,0,0,0.15);
            opacity: 0;
            transition: opacity 0.2s ease, transform 0.2s ease;
            z-index: 10000;
            pointer-events: none;
        }
        .reorder-toast.show {
            opacity: 1;
            transform: translateX(-50%) translateY(0);
        }
        .reorder-toast.error {
            background: rgba(239, 68, 68, 0.95);
        }
        
        /* Drag & Drop im Kalender (Tag zu Tag verschieben) */
        .appointment-indicator[draggable="true"] {
            cursor: grab;
            position: relative;
            transition: box-shadow 0.15s ease;
        }
        @keyframes wiggleIndicator {
            0%, 100% { transform: translateX(0) rotate(0deg); }
            20%      { transform: translateX(-2px) rotate(-0.8deg); }
            40%      { transform: translateX(2px) rotate(0.8deg); }
            60%      { transform: translateX(-2px) rotate(-0.6deg); }
            80%      { transform: translateX(2px) rotate(0.6deg); }
        }
        .appointment-indicator[draggable="true"]:hover {
            box-shadow: 0 2px 6px rgba(10, 132, 255, 0.25);
            animation: wiggleIndicator 0.6s ease-in-out 0.3s infinite;
        }
        .appointment-indicator[draggable="true"]:active {
            cursor: grabbing;
            animation: none;
        }
        .appointment-indicator.dragging {
            opacity: 0.4;
            animation: none;
        }
        /* Respektiere Nutzer, die reduzierte Bewegung bevorzugen */
        @media (prefers-reduced-motion: reduce) {
            .appointment-indicator[draggable="true"]:hover {
                animation: none;
                transform: translateY(-1px);
            }
        }
        .calendar-day.drop-target-valid {
            background: rgba(16, 185, 129, 0.15) !important;
            outline: 2px dashed rgba(16, 185, 129, 0.6);
            outline-offset: -2px;
        }
        .calendar-day.drop-target-invalid {
            background: rgba(239, 68, 68, 0.1) !important;
            outline: 2px dashed rgba(239, 68, 68, 0.5);
            outline-offset: -2px;
            cursor: not-allowed;
        }
        
        /* Move-Time-Modal */
        .move-time-modal {
            position: fixed;
            inset: 0;
            z-index: 10001;
            display: none;
            align-items: center;
            justify-content: center;
        }
        .move-time-modal.show {
            display: flex;
        }
        .move-time-backdrop {
            position: absolute;
            inset: 0;
            background: rgba(0, 0, 0, 0.45);
            backdrop-filter: blur(2px);
        }
        .move-time-dialog {
            position: relative;
            background: #fff;
            color: #111;
            border-radius: 14px;
            padding: 24px;
            min-width: 340px;
            max-width: 90vw;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
            animation: moveTimeIn 0.15s ease;
        }
        @keyframes moveTimeIn {
            from { opacity: 0; transform: translateY(10px) scale(0.98); }
            to { opacity: 1; transform: translateY(0) scale(1); }
        }
        .move-time-dialog h3 {
            margin: 0 0 6px 0;
            font-size: 1.1rem;
            font-weight: 600;
        }
        .move-time-subtitle {
            margin: 0 0 18px 0;
            color: #666;
            font-size: 0.9rem;
        }
        .move-time-field label {
            display: block;
            font-size: 0.85rem;
            font-weight: 500;
            margin-bottom: 6px;
            color: #333;
        }
        .move-time-field select {
            width: 100%;
            padding: 10px 12px;
            border: 1px solid #d0d0d5;
            border-radius: 8px;
            font-size: 0.95rem;
            background: #fff;
            color: #111;
        }
        .move-time-field select:focus {
            outline: none;
            border-color: var(--accent, #0a84ff);
            box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.15);
        }
        .move-time-hint {
            margin-top: 8px;
            font-size: 0.82rem;
            color: #888;
            min-height: 1.2em;
        }
        .move-time-hint.error {
            color: #dc2626;
        }
        .move-time-actions {
            display: flex;
            gap: 10px;
            justify-content: flex-end;
            margin-top: 20px;
        }
        .move-time-actions .btn {
            min-width: 100px;
        }
        #moveTimeConfirm:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }