/* Inselbuden Apps – Dashboard
   Schlichtes, freundliches Admin-Theme (Sand / Nordsee-Blau). */

:root {
    --bg:        #f4f1ea;
    --panel:     #ffffff;
    --ink:       #2b2b2b;
    --muted:     #7d7666;
    --line:      #e4ddcf;
    --navy:      #1f3a4d;
    --navy-2:    #2c5168;
    --sand:      #c9a86a;
    --sand-dk:   #a9863f;
    --ok-bg:     #e6f4ea; --ok-ink: #2f7d46;
    --err-bg:    #fbe7e7; --err-ink: #b3261e;
    --info-bg:   #e8eef3; --info-ink: #1f3a4d;
    --radius:    12px;
    --shadow:    0 1px 3px rgba(31,58,77,.08), 0 1px 2px rgba(31,58,77,.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
}
a { color: var(--navy-2); }
h1 { font-size: 1.5rem; margin: 0 0 .2rem; }
h2 { font-size: 1.15rem; margin: 1.6rem 0 .6rem; }
h3 { font-size: .95rem; margin: 1rem 0 .4rem; }
code { background: #f0ece2; padding: .05em .35em; border-radius: 5px; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.num { text-align: right; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
    width: 240px; flex: 0 0 240px;
    background: var(--navy); color: #eaf0f4;
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
}
.sidebar-brand {
    display: flex; align-items: center; gap: .6rem;
    padding: 1.1rem 1.1rem .8rem; font-weight: 700; font-size: 1.02rem;
    border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-brand .logo { width: 36px; height: 36px; object-fit: contain; background: #fff; border-radius: 8px; padding: 3px; }
.nav { padding: .6rem; display: flex; flex-direction: column; gap: .15rem; flex: 1; }
.nav-item {
    color: #d7e1e8; text-decoration: none; padding: .55rem .7rem; border-radius: 8px;
    font-size: .92rem;
}
.nav-item:hover { background: rgba(255,255,255,.08); }
.nav-item.active { background: var(--sand); color: #2b2b2b; font-weight: 600; }
.nav-item.disabled { color: #8aa0ad; cursor: default; }
.nav-item.disabled em { font-style: normal; opacity: .7; font-size: .8em; }
.sidebar-foot { padding: .9rem 1.1rem; border-top: 1px solid rgba(255,255,255,.1); font-size: .85rem; }
.user { display: flex; flex-direction: column; margin-bottom: .5rem; }
.user-name { font-weight: 600; }
.user-role { color: #9fb4c0; font-size: .8rem; }
.logout { color: #d7e1e8; text-decoration: none; font-size: .85rem; }
.logout:hover { text-decoration: underline; }
.main { flex: 1; padding: 1.6rem 2rem; max-width: 1100px; }

/* ---------- Head / buttons ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; }
.head-actions { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; }
.back { font-size: .85rem; text-decoration: none; color: var(--muted); display: inline-block; margin-bottom: .2rem; }
.btn {
    display: inline-block; border: 1px solid var(--line); background: #fff; color: var(--ink);
    padding: .5rem .9rem; border-radius: 8px; cursor: pointer; font-size: .9rem; text-decoration: none;
    transition: background .12s, border-color .12s;
}
.btn:hover { background: #faf7f0; }
.btn-sm { padding: .3rem .6rem; font-size: .82rem; }
.btn-primary { background: var(--sand); border-color: var(--sand-dk); color: #2b2b2b; font-weight: 600; }
.btn-primary:hover { background: var(--sand-dk); color: #fff; }
.btn-secondary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-secondary:hover { background: var(--navy-2); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn:disabled { opacity: .6; cursor: default; }

/* ---------- Cards / stats ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.card h2:first-child { margin-top: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .8rem; margin-bottom: .4rem; }
.stat { text-align: center; padding: 1.1rem .6rem; }
.stat-num { font-size: 2rem; font-weight: 700; color: var(--navy); }
.stat-label { color: var(--muted); font-size: .82rem; margin-top: .2rem; }

/* ---------- Tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .8rem; }
.tile { display: flex; flex-direction: column; gap: .25rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
.tile:hover { border-color: var(--sand); }
.tile-name { font-weight: 600; }
.tile-name em { font-style: normal; color: var(--sand-dk); font-size: .8em; }
.tile-desc { color: var(--muted); font-size: .85rem; }
.tile-disabled { opacity: .65; }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { text-align: left; padding: .55rem .7rem; border-bottom: 1px solid var(--line); }
.table th { background: #faf7f0; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.table tr:last-child td { border-bottom: none; }
.table-objects tr:hover td { background: #faf8f2; }
.link-strong { font-weight: 600; text-decoration: none; }
.link-strong:hover { text-decoration: underline; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: .12rem .5rem; border-radius: 20px; font-size: .76rem; font-weight: 600; }
.badge-type { background: #eef1f4; color: var(--navy); }
.badge-ok { background: var(--ok-bg); color: var(--ok-ink); }
.badge-off { background: #efe9dd; color: var(--muted); }
.badge-sofa { background: #e7eef7; color: #1f3a4d; }
.badge-loft { background: #f3ecd9; color: #8a6d3b; }
.badge-mini { font-size: .68rem; margin-left: .35rem; vertical-align: middle; }
.bed-badges { margin: 0 0 .6rem; }
.bed-flags label { display: inline-flex; align-items: center; gap: .25rem; font-size: .78rem; margin-right: .55rem; color: var(--ink); white-space: nowrap; }
.bed-flags input { width: auto; }
#manualBeds select { min-width: 150px; }
#manualBeds td { vertical-align: top; }
.count-badge { background: var(--sand); color: #2b2b2b; border-radius: 20px; font-size: .8rem; padding: .05rem .55rem; vertical-align: middle; }

/* ---------- Forms ---------- */
.filterbar { display: flex; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.filterbar input[type=search] { flex: 1; min-width: 200px; }
input, select, textarea { font: inherit; padding: .45rem .55rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); width: 100%; }
input[type=checkbox] { width: auto; }
textarea { resize: vertical; }
.form label, .object-form label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .7rem; }
.form input { margin-top: .25rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .2rem .9rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: .2rem .9rem; }
.object-form label.block { display: block; }
.object-form label input, .object-form label textarea, .object-form label select { margin-top: .25rem; }
.form-actions { display: flex; gap: .6rem; align-items: center; margin: 1rem 0 .4rem; }

/* Equipment grid */
.eq-group { color: var(--navy); border-bottom: 1px solid var(--line); padding-bottom: .2rem; }
.eq-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .35rem .9rem; margin-bottom: .6rem; }
.eq-flag { display: flex !important; align-items: center; gap: .45rem; color: var(--ink) !important; margin-bottom: .25rem !important; font-size: .9rem; }
.eq-flag input { margin: 0; }
.eq-num { font-size: .82rem; }
.eq-num input { margin-top: .15rem; }

/* ---------- Alerts ---------- */
.alert { padding: .7rem .9rem; border-radius: 8px; margin-bottom: 1rem; font-size: .9rem; }
.alert-ok { background: var(--ok-bg); color: var(--ok-ink); }
.alert-error { background: var(--err-bg); color: var(--err-ink); }
.alert-info { background: var(--info-bg); color: var(--info-ink); }
.alert hr { border: none; border-top: 1px solid rgba(0,0,0,.1); margin: .5rem 0; }

/* ---------- Misc ---------- */
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.rawbox { margin-top: 1rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem 1rem; }
.rawbox summary { cursor: pointer; color: var(--muted); font-size: .88rem; }
.rawbox pre { overflow: auto; max-height: 420px; font-size: .78rem; background: #2b2b2b; color: #e6e6e6; padding: 1rem; border-radius: 8px; }

/* ---------- Auth ---------- */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(160deg, #1f3a4d, #2c5168); }
.auth-card { background: #fff; padding: 2rem; border-radius: 16px; width: 360px; max-width: 92vw; box-shadow: 0 12px 40px rgba(0,0,0,.25); text-align: center; }
.auth-logo { width: 76px; height: 76px; object-fit: contain; margin-bottom: .3rem; }
.auth-card .brand, .brand { font-size: 1.3rem; margin: .1rem 0 .2rem; color: var(--navy); }
.auth-card .form { text-align: left; margin-top: 1rem; }
.auth-card .btn-primary, .form .btn-primary { width: 100%; margin-top: .4rem; }

@media (max-width: 760px) {
    .layout { flex-direction: column; }
    .sidebar { width: auto; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; }
    .sidebar-brand { border: none; }
    .nav { flex-direction: row; flex-wrap: wrap; flex: 1; }
    .sidebar-foot { border: none; }
    .main { padding: 1rem; }
    .grid-2, .grid-4 { grid-template-columns: 1fr 1fr; }
}
