:root {
    --primary: #006747;
    --primary-dark: #004f37;
    --accent: #c8933a;
    --accent-hover: #b07d2a;
    --bg: #f5f6f8;
    --surface: #ffffff;
    --border: #e2e5ea;
    --text: #1a1a2e;
    --text-muted: #6b7280;
    --radius: 10px;
    --shadow: 0 1px 4px rgba(0,0,0,0.08);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 16px;
    line-height: 1.5;
}

/* Header */
.header {
    background: var(--primary);
    color: white;
    padding: 0 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.header-inner {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    gap: 1rem;
}
.logo {
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    text-decoration: none;
    white-space: nowrap;
}
nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.logout-link {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 0.875rem;
}
.logout-link:hover { color: white; }

/* Container */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1.25rem 1rem 3rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
    white-space: nowrap;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--primary); color: white; }
.btn-secondary:hover { background: var(--primary-dark); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--border); }
.btn-full { width: 100%; padding: 0.75rem; font-size: 1rem; }

/* Page header */
.page-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.page-header h1 { font-size: 1.4rem; flex: 1; }
.page-header-right { display: flex; align-items: center; gap: 0.5rem; }
.back-link { color: var(--text-muted); text-decoration: none; font-size: 0.9rem; }
.back-link:hover { color: var(--text); }

/* Status badges */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}
.badge-angenommen  { background: #dbeafe; color: #1d4ed8; }
.badge-in-arbeit   { background: #fef3c7; color: #92400e; }
.badge-fertig      { background: #d1fae5; color: #065f46; }
.badge-abgeholt    { background: #f3f4f6; color: #6b7280; }

/* Repair list */
.repair-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.repair-card {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--shadow);
    transition: box-shadow 0.15s, border-color 0.15s;
}
.repair-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: var(--accent);
}
.repair-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
}
.repair-id { font-size: 0.8rem; color: var(--text-muted); font-weight: 600; }
.repair-card-name { font-size: 1.05rem; font-weight: 700; }
.repair-card-watch { font-size: 0.9rem; color: var(--text-muted); margin-top: 0.15rem; }
.repair-card-meta {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Filter bar */
.filter-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.search-input { flex: 1; min-width: 140px; }
.status-select { min-width: 140px; }

/* Forms */
.form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}
.form-section-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin: 1.25rem 0 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border);
}
.form-card > .form-section-title:first-child { margin-top: 0; }
.form-group { margin-bottom: 0.875rem; }
.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: var(--text);
}
.form-input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--surface);
    color: var(--text);
    appearance: auto;
    transition: border-color 0.15s;
}
.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,58,92,0.1);
}
.form-textarea { min-height: 80px; resize: vertical; font-family: inherit; }
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}
@media (max-width: 480px) {
    .form-row { grid-template-columns: 1fr; }
}
.form-actions { margin-top: 1.25rem; }
.form-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

/* Photos */
.photos-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
}
.section-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1rem;
}
.photo-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}
@media (max-width: 500px) {
    .photo-columns { grid-template-columns: 1fr; }
}
.photo-col-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.75rem;
}
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}
.photo-thumb {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: opacity 0.15s;
}
.photo-thumb:hover { opacity: 0.85; }
.photo-upload-input { display: none; }
.photo-upload-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.875rem;
    background: var(--bg);
    border: 1.5px dashed var(--border);
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--primary);
    transition: border-color 0.15s, background 0.15s;
}
.photo-upload-label:hover {
    border-color: var(--accent);
    background: #fdf6ec;
}
.photo-btn-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.photo-upload-label-secondary { color: var(--text-muted); border-style: dashed; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}
.empty-icon { font-size: 3rem; margin-bottom: 0.75rem; }
.empty-state p { margin-bottom: 1.25rem; font-size: 1rem; }

/* KVA */
.kva-kunde { font-size: 1rem; font-weight: 700; }
.kva-kommission { font-weight: 400; color: var(--accent); font-size: 0.9rem; }
.kva-uhr { font-size: 0.875rem; color: var(--text-muted); margin-top: 2px; }

.kva-table { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1.25rem; }
.kva-header {
    display: grid;
    grid-template-columns: 36px 1fr 110px;
    gap: 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: 0 0.25rem;
}
.kva-price-col { text-align: right; }
.kva-row {
    display: grid;
    grid-template-columns: 36px 1fr 110px;
    gap: 0.5rem;
    align-items: center;
}
.kva-checkbox {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
    cursor: pointer;
    justify-self: center;
}
.kva-label-wrap { display: flex; flex-direction: column; gap: 0.25rem; }
.kva-label { font-size: 0.95rem; }
.kva-note { font-size: 0.8rem; color: var(--text-muted); }
.kva-price { text-align: right; font-size: 0.95rem; }

.kva-totals {
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1rem;
}
.kva-total-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-muted);
}
.kva-mwst-row label { display: flex; align-items: center; gap: 0.4rem; cursor: pointer; }
.kva-total-final {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    border-top: 2px solid var(--primary);
    padding-top: 0.5rem;
    margin-top: 0.25rem;
}

/* Alert */
.alert { padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: 0.9rem; }
.alert-error { background: #fee2e2; color: #991b1b; }

/* Login */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
}
.login-box {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    margin: 1rem;
}
.login-logo { font-size: 3rem; text-align: center; margin-bottom: 0.5rem; }
.login-title {
    font-size: 1.3rem;
    font-weight: 700;
    text-align: center;
    color: var(--primary);
    margin-bottom: 1.5rem;
}
