:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #1c2330;
  --muted: #6b7280;
  --line: #e3e6eb;
  --accent: #b4881f;       /* "Goldenes Roß" */
  --accent-dark: #8c6814;
  --brand: #072b39;        /* Selaga-Markenblau */
  --ok: #1b873f;
  --err: #c0392b;
  --u: #2f6fed; --f: #7a4fd0; --k: #c0392b;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--ink); -webkit-text-size-adjust: 100%;
}
.topbar {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  background: #fff; color: var(--brand); padding: .45rem 1rem;
  border-bottom: 2px solid var(--accent);
}
.brand { display: flex; align-items: center; gap: .55rem; text-decoration: none; }
.brand .logo { height: 34px; width: auto; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text strong { color: var(--brand); font-size: 1rem; letter-spacing: .2px; }
.brand-text small { color: var(--accent-dark); font-size: .66rem; text-transform: uppercase; letter-spacing: 1.8px; }
.topbar nav { margin-left: auto; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.topbar nav a { color: var(--brand); text-decoration: none; font-size: .95rem; }
.topbar nav a:hover { color: var(--accent-dark); }
.topbar .who { color: var(--muted); font-size: .85rem; }
.inline { display: inline; margin: 0; }
button.link { background: none; border: none; color: var(--accent-dark); cursor: pointer; font-size: .95rem; padding: 0; }
main { max-width: 760px; margin: 0 auto; padding: 1rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 1rem; margin-bottom: 1rem; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
h1 { font-size: 1.3rem; margin: .2rem 0 1rem; }
h2 { font-size: 1.05rem; margin: 0 0 .6rem; }
label { display: block; font-size: .8rem; color: var(--muted); margin-bottom: .2rem; }
input, select, button { font-size: 1rem; font-family: inherit; }
input, select {
  width: 100%; padding: .6rem; border: 1px solid #cbd2dd; border-radius: 8px; background: #fff;
}
.row { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin-bottom: .7rem; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .7rem; margin-bottom: .7rem; }
.btn {
  display: inline-block; background: var(--accent); color: #fff; border: none;
  padding: .7rem 1.1rem; border-radius: 8px; cursor: pointer; font-weight: 600; text-decoration: none;
}
.btn:hover { background: var(--accent-dark); }
.btn.secondary { background: #5b6472; }
.btn.danger { background: var(--err); }
.btn.full { width: 100%; }
.cat-buttons { display: flex; gap: .5rem; flex-wrap: wrap; margin: .3rem 0 .8rem; }
.cat-buttons button {
  flex: 1; min-width: 64px; padding: .55rem; border-radius: 8px; border: 1px solid #cbd2dd;
  background: #fff; cursor: pointer;
}
.cat-buttons button.active { color: #fff; border-color: transparent; }
.cat-buttons button[data-cat="U"].active { background: var(--u); }
.cat-buttons button[data-cat="F"].active { background: var(--f); }
.cat-buttons button[data-cat="K"].active { background: var(--k); }
.cat-buttons button[data-cat=""].active { background: var(--accent); }
.hint { font-size: .8rem; color: var(--muted); }
.msg { padding: .6rem .8rem; border-radius: 8px; margin: .6rem 0; font-size: .92rem; }
.msg.ok { background: #e7f6ec; color: var(--ok); }
.msg.err { background: #fdecea; color: var(--err); }
.entries { list-style: none; padding: 0; margin: 0; }
.entries li {
  display: flex; align-items: center; gap: .6rem; padding: .55rem .3rem;
  border-bottom: 1px solid var(--line); cursor: pointer;
}
.entries li:hover { background: #faf7ef; }
.entries .d { font-weight: 600; width: 3.4rem; }
.entries .t { color: var(--muted); font-size: .9rem; flex: 1; }
.entries .h { font-weight: 600; }
.badge { font-size: .72rem; padding: .12rem .4rem; border-radius: 999px; color: #fff; }
.badge.U { background: var(--u); } .badge.F { background: var(--f); } .badge.K { background: var(--k); } .badge.frei { background: #6b7280; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .5rem .4rem; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.toolbar { display: flex; gap: .6rem; align-items: end; flex-wrap: wrap; margin-bottom: 1rem; }
.toolbar .grow { flex: 1; }
.login-wrap { max-width: 380px; margin: 8vh auto; }
.tag { font-size: .72rem; padding: .1rem .4rem; border-radius: 6px; background: #eef0f4; color: var(--muted); }
.inactive td { opacity: .5; }

/* Branding "Zum Goldenen Roß" / Selaga */
.login-head { text-align: center; margin-bottom: 1.1rem; }
.login-head .ross { height: 112px; width: auto; }
.login-head .estab { font-size: 1.55rem; margin: .45rem 0 .15rem; color: var(--brand); letter-spacing: .3px; }
.login-head .estab-sub { font-size: .76rem; color: var(--muted); text-transform: uppercase; letter-spacing: 2.5px; margin: 0; }
.brand-foot {
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  text-align: center; font-size: .74rem; color: var(--muted); margin-top: 1.4rem;
}
.brand-foot .selaga { height: 19px; width: auto; opacity: .9; }

/* --- Belegungsplan-Grid --- */
.grid-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.plan-grid { border-collapse: collapse; font-size: .72rem; min-width: 100%; }
.plan-grid th, .plan-grid td {
  border: 1px solid var(--line); padding: .15rem .25rem; text-align: center;
  white-space: nowrap;
}
.plan-grid th.day small { display: block; font-weight: 400; color: var(--muted); }
.plan-grid .room-col {
  text-align: left; position: sticky; left: 0; background: var(--card);
  min-width: 7.5rem; font-weight: 500; z-index: 1;
}
.plan-grid .we { background: #f0f1f4; }
.plan-grid td.frei { cursor: pointer; min-width: 1.6rem; height: 1.7rem; }
.plan-grid td.frei:hover { background: #fdf3d7; }
.plan-grid td.belegt {
  background: #f5d98f; cursor: pointer; overflow: hidden; max-width: 0;
  text-overflow: ellipsis; text-align: left; padding-left: .35rem; font-weight: 500;
}
.plan-grid .objekt-row td {
  background: var(--brand); color: #fff; text-align: left; font-weight: 600;
  position: sticky; left: 0;
}

/* --- Anreise/Abreise-Ticker --- */
.ticker-wrap {
  overflow: hidden; background: var(--brand); color: #fff; border-radius: 8px;
  margin-bottom: .8rem; padding: .35rem 0; white-space: nowrap;
}
.ticker {
  display: inline-block; padding-left: 100%;
  animation: ticker-scroll 25s linear infinite; font-size: .85rem;
}
@keyframes ticker-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* Booking.com-Reservierungen (extern, schreibgeschützt) */
.plan-grid td.extern {
  background: #c0392b; color: #fff; cursor: default; overflow: hidden;
  max-width: 0; text-overflow: ellipsis; text-align: left; padding-left: .35rem;
  font-size: .62rem; font-weight: 600;
}

/* Zweiter Ticker: Barzahlung fällig (Warnfarbe) */
.ticker-bar { background: var(--err); }
.ticker-bar .ticker { font-weight: 700; }

/* Interne Buchung, die eine Booking.com-Sperre anreichert */
.plan-grid td.belegt.bcom { background: #e8b84b; }
.bcom-tag {
  display: inline-block; background: #c0392b; color: #fff; font-size: .55rem;
  font-weight: 700; padding: 0 .2rem; border-radius: 3px; margin-left: .25rem;
  vertical-align: middle;
}
