:root {
    --deep: #063852;
    --sea: #0a7ea4;
    --teal: #0fb9b1;
    --foam: #eaf6f8;
    --sand: #f7f3ea;
    --ink: #1c2b33;
    --danger: #c0392b;
    --ok: #1e8e5a;
    --radius: 10px;
    --shadow: 0 2px 10px rgba(6, 56, 82, 0.12);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--foam);
    color: var(--ink);
}

header.topbar {
    background: linear-gradient(135deg, var(--deep), var(--sea));
    color: #fff;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 20;
}

header.topbar h1 {
    font-size: 1.1rem;
    margin: 0;
    letter-spacing: 0.3px;
}

header.topbar .user-info {
    font-size: 0.85rem;
    opacity: 0.9;
    display: flex;
    gap: 10px;
    align-items: center;
}

nav.tabs {
    display: flex;
    background: #fff;
    border-bottom: 1px solid #dce8ec;
    position: sticky;
    top: 54px;
    z-index: 19;
    overflow-x: auto;
}

nav.tabs button {
    flex: 1;
    min-width: 90px;
    padding: 12px 8px;
    border: none;
    background: none;
    font-size: 0.85rem;
    color: #567;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
}

nav.tabs button.active {
    color: var(--sea);
    border-bottom-color: var(--teal);
    font-weight: 600;
}

main {
    max-width: 900px;
    margin: 0 auto;
    padding: 18px;
    padding-bottom: 80px;
}

.view { display: none; }
.view.active { display: block; }

.card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    margin-bottom: 16px;
}

.card h2 {
    margin-top: 0;
    font-size: 1.1rem;
    color: var(--deep);
}

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

label {
    display: block;
    font-size: 0.78rem;
    color: #567;
    margin-bottom: 4px;
    font-weight: 600;
}

input, select, textarea {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid #cfe0e6;
    border-radius: 7px;
    font-size: 0.95rem;
    background: #fff;
    font-family: inherit;
}

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

.field { margin-bottom: 12px; }

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.checkbox-row input { width: auto; }

fieldset {
    border: 1px dashed #b9d4dc;
    border-radius: var(--radius);
    padding: 14px;
    margin: 16px 0;
}
fieldset legend {
    font-weight: 700;
    color: var(--sea);
    padding: 0 6px;
    font-size: 0.9rem;
}

button.btn {
    background: var(--sea);
    color: #fff;
    border: none;
    padding: 11px 18px;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    font-weight: 600;
}
a.btn { display: inline-block; text-decoration: none; background: var(--sea); color: #fff; border: 1px solid var(--sea); padding: 11px 18px; border-radius: 8px; font-size: 0.95rem; font-weight: 600; }
a.btn:hover { background: var(--deep); }
a.btn.secondary { background: #fff; color: var(--sea); }
a.btn.secondary:hover { background: #eef7fa; }
a.btn.small { padding: 6px 12px; font-size: 0.8rem; }
button.btn:hover { background: var(--deep); }
button.btn.secondary { background: #fff; color: var(--sea); border: 1px solid var(--sea); }
button.btn.danger { background: var(--danger); }
button.btn.small { padding: 6px 12px; font-size: 0.8rem; }
button.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin: 14px 0;
}
.stat-box {
    background: var(--sand);
    border-radius: var(--radius);
    padding: 14px;
    text-align: center;
}
.stat-box .num { font-size: 1.6rem; font-weight: 700; color: var(--deep); }
.stat-box .label { font-size: 0.75rem; color: #789; margin-top: 2px; }

.dive-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid #eef4f6;
    cursor: pointer;
}
.dive-list-item:hover { background: var(--foam); }
.dive-list-item .left { display: flex; flex-direction: column; }
.dive-list-item .site { font-weight: 600; color: var(--deep); }
.dive-list-item .meta { font-size: 0.8rem; color: #789; }
.badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    background: var(--teal);
    color: #fff;
    margin-left: 6px;
}
.badge.training { background: #e08e00; }

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px;
    margin-top: 10px;
}
.photo-grid img {
    width: 100%;
    height: 90px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
}
.photo-thumb-wrap { position: relative; }
.photo-thumb-wrap .remove-photo {
    position: absolute; top: -6px; right: -6px;
    background: var(--danger); color: #fff; border: none;
    border-radius: 50%; width: 20px; height: 20px; font-size: 12px; cursor: pointer;
}

#map, #detail-map { height: 260px; border-radius: var(--radius); margin-top: 10px; }

.msg { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 0.9rem; }
.msg.error { background: #fdecea; color: var(--danger); }
.msg.ok { background: #e8f7ef; color: var(--ok); }

.auth-wrap {
    max-width: 380px;
    margin: 60px auto;
    padding: 0 16px;
}
.auth-wrap h1 { text-align: center; color: var(--deep); }
.auth-switch { text-align: center; margin-top: 12px; font-size: 0.9rem; }
.auth-switch a { color: var(--sea); cursor: pointer; text-decoration: underline; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filters input, .filters select { width: auto; min-width: 130px; }

.empty-state { text-align: center; color: #789; padding: 40px 10px; }

.stars { color: #e0a300; font-size: 1rem; }

.weight-bar-wrap {
    background: #e3eef1;
    border-radius: 20px;
    height: 22px;
    overflow: hidden;
    margin: 10px 0;
    position: relative;
}
.weight-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--teal), var(--sea));
    transition: width 0.3s;
}
.weight-bar.over { background: linear-gradient(90deg, #e08e00, var(--danger)); }
.weight-bar-label {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem; font-weight: 700; color: var(--deep);
}

.pack-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 4px;
    border-bottom: 1px solid #eef4f6;
}
.pack-item.packed { opacity: 0.55; }
.pack-item.packed .pack-name { text-decoration: line-through; }
.pack-item input[type="checkbox"] { width: 20px; height: 20px; flex-shrink: 0; }
.pack-name { flex: 1; font-weight: 600; }
.pack-meta { font-size: 0.78rem; color: #789; }
.pack-item .remove-item {
    background: none; border: none; color: var(--danger); font-size: 1.1rem; cursor: pointer; padding: 0 6px;
}

.category-group { margin-bottom: 18px; }
.category-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--sea);
    font-weight: 700;
    margin: 14px 0 4px;
}

.trip-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px;
    border-bottom: 1px solid #eef4f6;
    cursor: pointer;
}
.trip-card:hover { background: var(--foam); }
.trip-card .site { font-weight: 700; color: var(--deep); }
.climate-tag {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 700;
    color: #fff;
}
.climate-tag.kalt { background: #2f7ec4; }
.climate-tag.tropen { background: #e08e00; }
.climate-tag.beide { background: var(--teal); }
.climate-tag.travel-flug { background: #6a4fb0; }
.climate-tag.travel-nichtflug { background: #567; }
.climate-tag.travel-beide { background: #9aa; }

.admin-user-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 12px 4px;
    border-bottom: 1px solid #eef4f6;
}
.admin-user-row .info { flex: 1; min-width: 180px; }
.admin-user-row .name { font-weight: 700; color: var(--deep); }
.admin-user-row .sub { font-size: 0.78rem; color: #789; }
.admin-user-row .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.badge.locked { background: var(--danger); }
.badge.admin { background: #6a4fb0; }
.badge.demo { background: #c96a1c; }

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(6, 56, 82, 0.55);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.modal-overlay.show { display: flex; }
.modal-box {
    background: #fff;
    border-radius: var(--radius);
    width: 100%;
    max-width: 480px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    padding: 18px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.25);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.modal-header h2 { margin: 0; font-size: 1.05rem; color: var(--deep); }
.modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: #789;
    line-height: 1;
}
.site-picker-list {
    overflow-y: auto;
    flex: 1;
    border-top: 1px solid #eef4f6;
}
.site-picker-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 4px;
    border-bottom: 1px solid #eef4f6;
    cursor: pointer;
}
.site-picker-item:hover { background: var(--foam); }
.site-picker-item input[type="checkbox"] { width: 18px; height: 18px; flex-shrink: 0; }
.site-picker-item .info { flex: 1; min-width: 0; }
.site-picker-item .name { font-weight: 700; color: var(--deep); }
.site-picker-item .sub { font-size: 0.78rem; color: #789; }
.site-picker-item.already-imported { opacity: 0.5; }

@media (max-width: 480px) {
    main { padding: 12px; }
    header.topbar h1 { font-size: 0.95rem; }
}

/* ---------- Demo-Modus ---------- */

#demo-banner {
    background: #fff2df;
    color: #a3611c;
    padding: 10px 16px;
    font-size: 0.85rem;
    text-align: center;
    font-weight: 600;
}

/* ---------- PWA-Install-Hinweis ---------- */

.install-tip {
    width: 100%;
    margin-top: 14px;
    background: rgba(15, 185, 177, 0.08);
    border: 1px solid rgba(15, 185, 177, 0.25);
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 12px;
    color: #55666d;
}
.install-tip summary {
    cursor: pointer;
    color: var(--teal);
    font-weight: 600;
    list-style: none;
}
.install-tip summary::-webkit-details-marker { display: none; }
.install-tip summary::before { content: "💡 "; }
.install-tip[open] summary { margin-bottom: 10px; }
.install-tip ul { margin: 6px 0 0; padding-left: 18px; line-height: 1.6; }

/* ===== TaucherApps-Shell ===== */
.ta-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-bottom: 18px; }
.ta-tile { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; display: flex; flex-direction: column; gap: 6px;
           text-decoration: none; color: var(--ink); border: 2px solid transparent; min-height: 138px; }
.ta-tile .ic { font-size: 1.9rem; line-height: 1; }
.ta-tile .ic img { width: 48px; height: 48px; border-radius: 11px; display: block; box-shadow: 0 1px 4px rgba(6,56,82,.2); }
.ta-tile.locked .ic img, .ta-tile.soon .ic img { filter: grayscale(.5); }
.ta-tile .nm { font-weight: 700; color: var(--deep); }
.ta-tile .tx { font-size: 0.8rem; color: #678; flex: 1; }
.ta-tile.open:hover { border-color: var(--teal); }
.ta-tile.locked { opacity: 0.8; background: #f3f8f9; cursor: pointer; }
.ta-tile.soon { opacity: 0.5; background: #f3f8f9; }
.ta-tile .st { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: var(--sea); }
.ta-tile.locked .st { color: #a66; }
.ta-tile.soon .st { color: #889; }
.ta-user-row { border: 1px solid #dce8ec; border-radius: 8px; padding: 12px; margin-bottom: 10px; background: #fcfeff; }
.ta-user-row .head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.ta-mods { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 8px 0; }
.ta-mods label { display: inline-flex; align-items: center; gap: 5px; font-weight: normal; margin: 0; font-size: 0.82rem; color: var(--ink); }
.ta-mods input { width: auto; }
.ta-code { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 700; letter-spacing: 1px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.ta-tabs-mini { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.ta-tabs-mini button.active { background: var(--sea); color: #fff; }

/* Online-Ampel */
.ampel { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: -1px; margin: 0 2px 0 6px; background: #c0392b; box-shadow: 0 0 0 2px rgba(0,0,0,.06); }
.ampel.gruen { background: #22b455; box-shadow: 0 0 0 3px rgba(34,180,85,.25); }
.ampel.gelb { background: #f0b400; }
.ampel.rot { background: #c0392b; }
.ampel.gross { width: 18px; height: 18px; flex: 0 0 18px; margin: 0; }
.online-summary { display: flex; gap: 10px; flex-wrap: wrap; margin: 6px 0 12px; }
.online-summary .chip { padding: 8px 14px; border-radius: 999px; background: #eef5f7; font-weight: 700; color: var(--deep); }
.online-row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid #e3edf0; }
.online-row .info { flex: 1; min-width: 0; }
.online-row .name { font-weight: 700; color: var(--deep); }
.online-row .sub { font-size: .8rem; color: var(--grey, #6b7c85); }
.online-row .zeit { text-align: right; font-size: .85rem; white-space: nowrap; }
