/* Farben und Schriften wie hotel-hbs.de (Waldgrün, Messing, Creme) */
:root {
  --bg: #f6f2ea;
  --surface: #ffffff;
  --text: #26221e;
  --muted: #6d655c;
  --border: #e2dbcf;
  --input-border: #c9c0b2;
  --primary: #1f3a34;
  --primary-hover: #2c5148;
  --accent: #a9803c;
  --accent-dark: #8a6628;
  --danger: #a12a22;
  --ok-bg: #e5f3ea; --ok-fg: #1e6b45;
  --warn-bg: #fdf1d3; --warn-fg: #8a5a00;
  --err-bg: #fbe6e3; --err-fg: #a12a22;
  --info-bg: #ece5d8; --info-fg: #1f3a34;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(38, 34, 30, .06), 0 6px 20px rgba(38, 34, 30, .06);
  --serif: Georgia, 'Iowan Old Style', 'Times New Roman', serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--sans); font-size: 16px; line-height: 1.55;
  background: var(--bg); color: var(--text);
}
a { color: var(--primary-hover); text-underline-offset: 2px; }
a:hover { color: var(--accent-dark); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.2rem); margin: 0 0 1rem; }
h2 { font-size: 1.25rem; margin: 0 0 .75rem; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
code { background: #f0ebe1; padding: 1px 5px; border-radius: 4px; word-break: break-all; }

/* Kopfzeile */
.topbar {
  display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;
  padding: .75rem 1.25rem; background: var(--primary); color: #fff;
  position: sticky; top: 0; z-index: 10;
}
.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--accent); color: #e7cf9c;
  display: grid; place-items: center; font-family: var(--serif); font-size: 1.25rem; flex: none;
}
.brand strong { display: block; font-family: var(--serif); font-size: 1.15rem; font-weight: 600; line-height: 1.15; }
.brand small { display: block; font-size: .78rem; opacity: .75; }
.brand-lg { justify-content: center; text-align: left; }
.brand-lg .brand-mark { color: var(--accent-dark); }
#nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
#nav a { padding: 8px 12px; border-radius: 8px; text-decoration: none; color: #e9efe9; font-size: .95rem; }
#nav a:hover { background: rgba(255, 255, 255, .1); color: #fff; }
#nav a.active { background: rgba(255, 255, 255, .14); color: #fff; }
.topbar #user-menu-btn { color: #fff; border: 1px solid rgba(255, 255, 255, .4); }
.topbar #user-menu-btn:hover { background: rgba(255, 255, 255, .12); }
.user-box { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); min-width: 180px; overflow: hidden;
}
.menu button { display: block; width: 100%; padding: .6rem 1rem; border: 0; background: none; text-align: left; color: var(--text); cursor: pointer; font: inherit; }
.menu button:hover { background: var(--bg); }

.banner { padding: .5rem 1.25rem; font-size: .9rem; }
.banner.ok { background: #e8efec; color: var(--primary); border-bottom: 1px solid var(--border); }
.banner.warn { background: var(--warn-bg); color: #5f3f00; border-bottom: 1px solid #ecd391; }
.banner a { color: inherit; font-weight: 600; }

.container { max-width: 1180px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
.head-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.head-row h1 { margin: 0; }

/* Formulare */
label { display: block; font-weight: 500; margin-bottom: .8rem; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  display: block; width: 100%; margin-top: 5px; padding: 10px 12px; min-height: 44px; font: inherit; color: var(--text);
  background: #fff; border: 1px solid var(--input-border); border-radius: 8px;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary-hover); outline: none; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
textarea { resize: vertical; min-height: 120px; }
input:disabled { opacity: .5; }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; margin: 0; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px;
  padding: 10px 18px; border-radius: 8px; border: 1px solid #b9c4bd; background: #fff;
  color: var(--primary); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s;
}
.btn:hover { background: #eef2ee; color: var(--primary); }
.btn:disabled, .btn.disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn.primary { background: var(--primary); border-color: transparent; color: #fff; }
.btn.primary:hover { background: var(--primary-hover); color: #fff; }
.btn.danger { background: #fff; color: var(--danger); border-color: #dfb1ac; }
.btn.danger:hover { background: var(--err-bg); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: #ece5d8; }
.btn.small { min-height: 34px; padding: 5px 12px; font-size: .875rem; }
.btn.block { width: 100%; }
.btn.ai { background: var(--accent); color: #fff; border-color: transparent; }
.btn.ai:hover { background: var(--accent-dark); color: #fff; }
.danger-text { color: var(--danger) !important; }
.actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; flex-wrap: wrap; }
.actions.left { justify-content: flex-start; }

.alert { padding: 12px 14px; border-radius: 8px; margin: .6rem 0; font-size: .95rem; border: 1px solid; }
.alert.error { background: var(--err-bg); border-color: #efbdb7; color: #7c1f19; }
.alert.ok { background: var(--ok-bg); border-color: #b5dcc4; color: #154d32; }
.alert.warn { background: var(--warn-bg); border-color: #ecd391; color: #5f3f00; }
.alert.info { background: var(--info-bg); border-color: #d9cfbd; color: var(--info-fg); }

/* Upload */
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: .25rem; text-align: center;
  border: 2px dashed var(--border); border-radius: var(--radius); padding: 1.6rem 1rem; cursor: pointer; font-weight: 400;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: #fbf8f2; }
.dropzone input { display: none; }
.dz-icon { font-size: 1.8rem; color: var(--accent); line-height: 1; }
.progress { position: relative; height: 26px; background: var(--bg); border-radius: 8px; overflow: hidden; margin: .75rem 0; }
.progress div { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--primary); opacity: .25; transition: width .2s; }
.progress span { position: relative; display: block; text-align: center; font-size: .85rem; line-height: 26px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .6rem; margin: .9rem 0 .5rem; }
.media-item { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #000; }
.media-item img, .media-item video { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-item .num { position: absolute; top: 6px; left: 6px; background: rgba(0,0,0,.6); color: #fff; font-size: .75rem; border-radius: 99px; padding: 1px 8px; }
.media-item .tag, .post-thumb .tag { position: absolute; top: 6px; right: 6px; background: rgba(0,0,0,.6); color: #fff; font-size: .72rem; border-radius: 6px; padding: 1px 6px; }
.media-tools { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; padding: 4px; background: linear-gradient(transparent, rgba(0,0,0,.65)); opacity: 0; transition: opacity .15s; }
.media-item:hover .media-tools, .media-item:focus-within .media-tools { opacity: 1; }
@media (hover: none) { .media-tools { opacity: 1; } }
.media-tools button { background: rgba(255,255,255,.9); border: 0; border-radius: 6px; width: 30px; height: 26px; cursor: pointer; font-size: .8rem; }
.media-tools button:disabled { opacity: .3; }

/* Text / KI */
.ai-box { background: var(--bg); border-radius: 10px; padding: .75rem; margin-bottom: .75rem; }
.ai-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.ai-row + .ai-row { margin-top: .5rem; }
.ai-row input { flex: 1; margin: 0 !important; min-width: 200px; }
.ai-row select { width: auto !important; margin: 0 !important; }
.counter { text-align: right; font-size: .8rem; color: var(--muted); margin: .25rem 0 1rem; }
.counter.over { color: var(--danger); font-weight: 600; }
.targets { display: flex; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.schedule { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.schedule input[type=datetime-local] { width: auto !important; margin: 0 !important; }

/* Beiträge */
.post { display: flex; gap: 1rem; }
.post-thumb { position: relative; width: 120px; height: 120px; flex-shrink: 0; border-radius: 10px; overflow: hidden; background: var(--bg); }
.post-thumb img { width: 100%; height: 100%; object-fit: cover; }
.post-body { flex: 1; min-width: 0; }
.post-meta { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; font-size: .88rem; }
.post-caption { white-space: pre-wrap; margin: .5rem 0; max-height: 7.5em; overflow: hidden; font-size: .93rem; }
.platforms { display: flex; flex-direction: column; gap: .3rem; }
.platform { font-size: .88rem; }
.platform .pname { font-weight: 600; display: inline-block; min-width: 80px; }
.perror { color: var(--err-fg); background: var(--err-bg); padding: .3rem .5rem; border-radius: 6px; margin-top: .2rem; font-size: .82rem; }
.post-actions { display: flex; gap: .4rem; margin-top: .6rem; flex-wrap: wrap; }
@media (max-width: 560px) { .post { flex-direction: column; } .post-thumb { width: 100%; height: 200px; } }
.empty { text-align: center; padding: 2.5rem; }

.badge { display: inline-block; padding: 1px 9px; border-radius: 99px; font-size: .78rem; font-weight: 600; }
.badge.green { background: var(--ok-bg); color: var(--ok-fg); }
.badge.red { background: var(--err-bg); color: var(--err-fg); }
.badge.amber { background: var(--warn-bg); color: var(--warn-fg); }
.badge.blue { background: var(--info-bg); color: var(--info-fg); }
.badge.gray { background: var(--bg); color: var(--muted); }

/* Tabelle */
.table-wrap { overflow-x: auto; padding: 0; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: .7rem 1rem; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.table tr:last-child td { border-bottom: 0; }
.table tr.disabled td { opacity: .55; }
.row-actions { text-align: right !important; }

/* Einstellungen */
.conn { display: flex; gap: 2rem; flex-wrap: wrap; margin-bottom: .5rem; }
.conn-item { display: flex; gap: .7rem; align-items: center; }
.conn-item img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.page-list { display: grid; gap: .5rem; margin-top: .6rem; }
.page-opt { display: flex; gap: .7rem; align-items: center; text-align: left; padding: .6rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); cursor: pointer; font: inherit; }
.page-opt:hover { border-color: var(--primary); }
.page-opt img { width: 40px; height: 40px; border-radius: 50%; }
details { margin-top: 1rem; }

/* Dialog / Toast */
dialog { border: 0; border-radius: var(--radius); padding: 1.4rem; width: min(440px, 92vw); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(10,15,25,.45); }
dialog h3 { margin-top: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }
.toast { position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%); padding: .7rem 1.1rem; border-radius: 10px; color: #fff; background: var(--primary); box-shadow: 0 6px 24px rgba(0,0,0,.2); z-index: 100; max-width: 92vw; }
.toast.error { background: var(--danger); }

/* Login */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; width: min(380px, 100%); box-shadow: var(--shadow); text-align: center; }
.login-card form { text-align: left; margin-top: 1.2rem; }
