/* style.css - gemeinsames Design für alle Seiten der Anwendung */

:root {
    --bg: #f4f1ea;
    --panel: #ffffff;
    --ink: #2b2b28;
    --muted: #8a8578;
    --accent: #b5562f;
    --accent-dark: #8f431f;
    --grid-gap: 14px;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
    background: var(--bg);
    color: var(--ink);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 16px 60px;
}

.wrapper {
    width: 100%;
    max-width: 640px;
}

.steps {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 22px;
    font-size: 13px;
    color: var(--muted);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.steps span {
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid #d8d3c5;
}

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

.steps span.done {
    background: #e7e2d3;
    color: var(--ink);
}

h1 {
    font-size: 22px;
    margin: 0 0 4px;
    text-align: center;
}

.subtitle {
    text-align: center;
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 24px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--grid-gap);
}

.grid button {
    aspect-ratio: 1 / 1;
    border: 1px solid #d8d3c5;
    background: var(--panel);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--ink);
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.2;
    transition: transform 0.08s ease, background 0.15s ease, color 0.15s ease;
}

.grid button:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.grid button:active {
    transform: scale(0.96);
}

.grid button.custom-field {
    background: #efe9d8;
    font-weight: 600;
    border-style: dashed;
    border-color: var(--accent-dark);
    color: var(--accent-dark);
}

.grid button.custom-field:hover {
    background: var(--accent-dark);
    color: #fff;
}

.freitext-box {
    margin-top: 24px;
    background: var(--panel);
    border: 1px solid #d8d3c5;
    border-radius: var(--radius);
    padding: 18px;
}

.freitext-box label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--muted);
}

.freitext-box input[type="text"],
.freitext-box input[type="date"] {
    width: 100%;
    padding: 12px;
    font-size: 15px;
    border: 1px solid #d8d3c5;
    border-radius: 6px;
    box-sizing: border-box;
    height: 48px;
}

.freitext-box .actions {
    margin-top: 14px;
    display: flex;
    gap: 10px;
}

.btn {
    padding: 10px 18px;
    border-radius: 6px;
    border: none;
    font-size: 14px;
    cursor: pointer;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-secondary {
    background: #e7e2d3;
    color: var(--ink);
}

.auswahl-info {
    text-align: center;
    margin-bottom: 18px;
    font-size: 14px;
    color: var(--muted);
}

.auswahl-info strong {
    color: var(--ink);
}

/* ---- Gestern-Schalter (Schritt 3) ---- */

.gestern-schalter {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    font-size: 14px;
    color: var(--muted);
}

.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch .slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #d8d3c5;
    border-radius: 999px;
    transition: background-color 0.2s ease;
}

.switch .slider::before {
    content: "";
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: #fff;
    border-radius: 50%;
    transition: transform 0.2s ease;
}

.switch input:checked + .slider {
    background-color: var(--accent);
}

.switch input:checked + .slider::before {
    transform: translateX(20px);
}

#gesternLabel {
    font-weight: 600;
}

a.back-link {
    display: inline-block;
    margin-top: 24px;
    color: var(--muted);
    text-decoration: none;
    font-size: 13px;
}

a.back-link:hover {
    color: var(--accent);
}

/* ---- Übersichtsseite ---- */

.filter-bar {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 26px;
    flex-wrap: wrap;
}

.filter-bar input[type="date"] {
    padding: 8px 10px;
    border: 1px solid #d8d3c5;
    border-radius: 6px;
    font-size: 14px;
}

.tag-cluster {
    background: var(--panel);
    border: 1px solid #d8d3c5;
    border-radius: var(--radius);
    margin-bottom: 18px;
    overflow: hidden;
}

.tag-cluster h2 {
    background: #efe9d8;
    margin: 0;
    padding: 10px 16px;
    font-size: 15px;
    color: var(--accent-dark);
    display: flex;
    justify-content: space-between;
}

.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tag-cluster table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.tag-cluster th, .tag-cluster td {
    text-align: left;
    padding: 8px 16px;
    border-bottom: 1px solid #eee6d8;
}

.tag-cluster th {
    color: var(--muted);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
}

.tag-cluster tr:last-child td {
    border-bottom: none;
}

.empty-state {
    text-align: center;
    color: var(--muted);
    padding: 40px 0;
}

.edit-link {
    color: var(--muted);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 6px;
    transition: color 0.15s ease, background 0.15s ease;
}

.edit-link:hover {
    color: var(--accent);
    background: #efe9d8;
}

.tag-cluster th:last-child,
.tag-cluster td:last-child {
    width: 32px;
    text-align: center;
    padding-left: 8px;
    padding-right: 12px;
}

/* ---- Schmale Bildschirme (z. B. iPhone im Hochformat) ----
   Tabelle wird zu gestapelten Karten umgebaut, kein Scrollen nötig. */
@media (max-width: 480px) {
    .tag-cluster table,
    .tag-cluster thead,
    .tag-cluster tbody,
    .tag-cluster tr,
    .tag-cluster th,
    .tag-cluster td {
        display: block;
        width: auto;
    }

    .tag-cluster tr {
        position: relative;
        padding: 10px 44px 10px 16px;
        border-bottom: 1px solid #eee6d8;
    }

    .tag-cluster tr:first-child {
        display: none; /* Kopfzeile ausblenden, Labels kommen über ::before */
    }

    .tag-cluster td {
        padding: 2px 0;
        border-bottom: none;
        white-space: normal;
    }

    .tag-cluster td:nth-of-type(1)::before { content: "Kunde: "; color: var(--muted); }
    .tag-cluster td:nth-of-type(2)::before { content: "Tätigkeit: "; color: var(--muted); }
    .tag-cluster td:nth-of-type(3)::before { content: "Dauer: "; color: var(--muted); }

    .tag-cluster td:last-child {
        position: absolute;
        top: 10px;
        right: 10px;
        padding: 0;
    }
}
