/* Mobile-first Styling für das Scooter-QC-Formular. */

:root {
    --color-bg: #f4f6f5;
    --color-surface: #ffffff;
    --color-text: #1c1f1e;
    --color-muted: #6b7370;
    --color-border: #dde2e0;
    /* Markenfarbe. Als Hintergrund/Rahmen/Akzent verwendet; für Fließtext
       (Links) wird die dunklere Variante genutzt, da #99c221 auf Weiß als
       Textfarbe zu wenig Kontrast hat. */
    --color-primary: #99c221;
    --color-primary-dark: #6f8f17;
    --color-primary-text: #1c1f1e;
    --color-danger: #c0392b;
    --color-danger-bg: #fbeae8;
    --color-ok-bg: #eef6dc;
    --color-ok-text: #4c6b0f;
    --color-open-bg: #fdf1dd;
    --color-open-text: #8a5b00;
    --radius: 10px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.4;
}

a {
    color: var(--color-primary-dark);
}

:focus-visible {
    outline: 3px solid var(--color-primary-dark);
    outline-offset: 2px;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--color-surface);
    border-top: 4px solid var(--color-primary);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.page {
    max-width: 640px;
    margin: 0 auto;
    padding: 16px;
}

.auth-page {
    max-width: 400px;
    margin: 10vh auto 0;
    padding: 24px;
    background: var(--color-surface);
    border-radius: var(--radius);
}

h1 {
    font-size: 1.4rem;
    margin: 0 0 12px;
}

.section-title {
    font-size: 1.1rem;
    margin: 24px 0 10px;
}

.subtitle {
    color: var(--color-muted);
    margin-top: -8px;
}

.muted {
    color: var(--color-muted);
    font-size: 0.9rem;
}

.link-muted {
    color: var(--color-muted);
    text-decoration: none;
    font-size: 0.9rem;
}

.error {
    background: var(--color-danger-bg);
    color: var(--color-danger);
    padding: 10px 12px;
    border-radius: var(--radius);
    margin: 10px 0;
}

.success {
    background: var(--color-ok-bg);
    color: var(--color-ok-text);
    padding: 10px 12px;
    border-radius: var(--radius);
    margin: 10px 0;
}

.stacked-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 16px 0;
}

.stacked-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.95rem;
}

.stacked-form label.checkbox-label {
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--color-primary);
}

input[type="text"],
input[type="password"],
input[type="search"],
textarea {
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 1rem;
    width: 100%;
    background: var(--color-surface);
    color: var(--color-text);
}

textarea {
    resize: vertical;
    font-family: inherit;
}

.btn-primary,
.btn-secondary {
    display: inline-block;
    text-align: center;
    padding: 12px 18px;
    border-radius: var(--radius);
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.btn-primary {
    background: var(--color-primary);
    color: var(--color-primary-text);
}

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

.btn-primary:disabled {
    background: #d3d9c8;
    color: var(--color-muted);
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--color-surface);
    color: var(--color-text);
    border: 2px solid var(--color-primary);
}

.btn-secondary:hover {
    background: var(--color-ok-bg);
}

.btn-huge {
    display: block;
    width: 100%;
    padding: 18px;
    font-size: 1.15rem;
    margin: 16px 0;
}

.btn-small {
    padding: 6px 10px;
    font-size: 0.85rem;
    border-radius: 6px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    cursor: pointer;
}

.admin-link {
    display: block;
    text-align: center;
    margin-bottom: 8px;
}

.scan-box {
    background: var(--color-surface);
    border-radius: var(--radius);
    padding: 16px;
}

#reader {
    margin-top: 12px;
    border-radius: var(--radius);
    overflow: hidden;
}

.manual-toggle {
    text-align: center;
    font-size: 0.9rem;
    margin: 14px 0 0;
}

.status-text {
    text-align: center;
    color: var(--color-muted);
    min-height: 1.2em;
}

.measurements {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 16px 0;
}

.measure-group {
    background: var(--color-surface);
    border-radius: var(--radius);
    padding: 12px 16px 16px;
}

.measure-group .section-title {
    margin: 0 0 10px;
}

.measure-inputs {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.measure-inputs input {
    font-size: 1.1rem;
}

.diff-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding: 8px 12px;
    border-radius: var(--radius);
    background: var(--color-bg);
    font-weight: 600;
}

.diff-value {
    font-size: 1.1rem;
}

.diff-value.diff-over {
    color: var(--color-danger);
}

.diff-row:has(.diff-value.diff-over) {
    background: var(--color-danger-bg);
}

.status-banner {
    text-align: center;
    font-weight: 700;
    font-size: 1.05rem;
    padding: 12px;
    border-radius: var(--radius);
    margin: 0 0 16px;
    min-height: 1.4em;
}

.status-banner:empty {
    display: none;
}

.status-banner.status-good {
    background: var(--color-ok-bg);
    color: var(--color-ok-text);
}

.status-banner.status-bad {
    background: var(--color-danger-bg);
    color: var(--color-danger);
}

.notes-box,
.photo-box {
    background: var(--color-surface);
    border-radius: var(--radius);
    padding: 16px;
    margin: 16px 0;
}

.photo-btn {
    display: inline-block;
    cursor: pointer;
    margin-bottom: 12px;
}

.camera-view {
    margin-bottom: 12px;
}

.camera-view video {
    width: 100%;
    border-radius: var(--radius);
    background: #000;
    max-height: 60vh;
    object-fit: cover;
}

.camera-controls {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.camera-controls .btn-primary,
.camera-controls .btn-secondary {
    flex: 1;
}

.photo-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.photo-thumb {
    width: 100px;
    height: 100px;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--color-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    text-align: center;
    padding: 4px;
    color: var(--color-muted);
}

.photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-thumb.photo-error {
    color: var(--color-danger);
}

.table-scroll {
    overflow-x: auto;
}

.recent-table {
    width: 100%;
    min-width: 560px;
    border-collapse: collapse;
    background: var(--color-surface);
    border-radius: var(--radius);
    overflow: hidden;
    font-size: 0.9rem;
}

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

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

.badge-ok {
    background: var(--color-ok-bg);
    color: var(--color-ok-text);
}

.badge-open {
    background: var(--color-open-bg);
    color: var(--color-open-text);
}

.badge-bad {
    background: var(--color-danger-bg);
    color: var(--color-danger);
}

.admin-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.admin-row {
    background: var(--color-surface);
    border-radius: var(--radius);
    padding: 8px 12px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.admin-row.inactive {
    opacity: 0.5;
}

.inline-form {
    display: flex;
    align-items: center;
    gap: 6px;
}

.admin-text-input {
    padding: 6px 8px;
    min-width: 160px;
}

.admin-add-form {
    background: var(--color-surface);
    border-radius: var(--radius);
    padding: 16px;
}

@media (min-width: 480px) {
    .btn-huge {
        font-size: 1.25rem;
    }
}
