/* =========================================================
   HÜBNER HÖRGERÄTE – INTRANET · Styles
   Design: clean, schwarz-weiß, viel Weißraum (Logo-Look).
   Gold nur noch als ganz feiner Marken-Akzent.
   ========================================================= */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

:root {
  --ink:       #18181B;   /* Text (fast schwarz) */
  --ink-soft:  #52525B;   /* sekundärer Text */
  --muted:     #8A8A93;   /* dezenter Text */
  --bg:        #FAFAFA;   /* Seitenhintergrund */
  --surface:   #FFFFFF;   /* Karten */
  --cream:     #F4F4F5;   /* dezente Flächen / Hover / Balken-Spur */
  --line:      #E7E7EA;   /* Rahmen */
  --line-soft: #F1F1F3;   /* feine Trennlinien */

  /* Marken-Akzent: dezentes Gold, sehr sparsam eingesetzt */
  --gold:      #B0883C;
  --gold-dark: #8C6B2C;
  --gold-soft: #F7F1E5;

  --green:     #16A34A;
  --red:       #DC2626;

  --radius:    16px;
  --radius-sm: 10px;
  --shadow:    0 1px 2px rgba(24,27,31,.04), 0 6px 24px rgba(24,27,31,.05);
  --shadow-lg: 0 18px 50px rgba(24,27,31,.16);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); }
a:hover { border-color: var(--ink); }
.hidden { display: none !important; }
::selection { background: var(--ink); color: #fff; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  font-family: var(--font); font-weight: 600; font-size: 0.9rem; line-height: 1;
  padding: 11px 18px; border-radius: var(--radius-sm);
  border: 1px solid var(--ink); cursor: pointer; transition: all .15s ease;
  background: var(--ink); color: #fff; white-space: nowrap;
}
.btn:hover { background: #000; border-color: #000; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--cream); border-color: var(--ink); transform: none; }
.btn-danger { background: var(--red); border-color: var(--red); }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }
.btn-sm { padding: 7px 12px; font-size: 0.82rem; border-radius: 8px; }

/* ---------- Formulare ---------- */
label { display: block; font-weight: 500; margin-bottom: 6px; font-size: 0.85rem; color: var(--ink-soft); }
input, select, textarea {
  width: 100%; font-family: var(--font); font-size: 0.95rem; color: var(--ink);
  padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(24,24,27,.08);
}
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--ink); }
textarea { resize: vertical; min-height: 80px; }
.field { margin-bottom: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* =========================================================
   LOGIN
   ========================================================= */
#login-view {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
  background:
    radial-gradient(1200px 600px at 50% -10%, #fff, transparent),
    var(--bg);
}
.login-card {
  width: 100%; max-width: 400px; background: var(--surface);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 40px 34px; border: 1px solid var(--line);
}
.login-logo { text-align: center; margin-bottom: 10px; }
.login-logo-img { height: 84px; width: auto; filter: brightness(0); }
.login-sub { text-align: center; color: var(--muted); margin-bottom: 28px; font-size: 0.9rem; }
.login-card .btn { width: 100%; margin-top: 6px; padding: 13px; }

/* =========================================================
   APP-LAYOUT (Sidebar + Content)
   ========================================================= */
#app-view { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px; flex-shrink: 0; background: var(--surface); color: var(--ink-soft);
  display: flex; flex-direction: column; padding: 22px 16px;
  position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--line);
}
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 24px; }
.brand-logo { height: 40px; width: auto; filter: brightness(0); }
.brand-sub { font-weight: 700; font-size: 1.05rem; color: var(--muted); letter-spacing: -0.01em; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--ink-soft); text-decoration: none; font-weight: 500; cursor: pointer; margin-bottom: 2px;
  font-size: 0.92rem; transition: background .12s, color .12s; border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--cream); color: var(--ink); }
.nav-item.active { background: var(--cream); color: var(--ink); font-weight: 600; box-shadow: inset 3px 0 0 var(--gold); }
.nav-item .ico { font-size: 1.05rem; width: 22px; text-align: center; filter: grayscale(.2); }
.sidebar-spacer { flex: 1; }
.sidebar-user { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 12px; font-size: 0.85rem; }
.sidebar-user .name { color: var(--ink); font-weight: 600; }
.sidebar-user .role { color: var(--muted); font-size: 0.78rem; }
.sidebar-user .btn { margin-top: 12px; width: 100%; }

.content { flex: 1; min-width: 0; padding: 40px 44px; max-width: 1160px; }
.page-head { margin-bottom: 30px; }
.page-head h1 { font-size: 1.8rem; font-weight: 800; letter-spacing: -0.03em; }
.page-head p { color: var(--muted); margin-top: 5px; }

/* Mobile-Topbar (nur < 820px sichtbar) */
.topbar { display: none; }
.sidebar-backdrop { display: none; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow); margin-bottom: 22px;
}
.card h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: 16px; letter-spacing: -0.01em; }
.card h3 { font-size: 0.98rem; font-weight: 600; margin-bottom: 12px; }

/* ---------- KPI-Kacheln ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 22px; }
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow);
}
.kpi .label { color: var(--muted); font-size: 0.74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.kpi .value { font-size: 2.1rem; font-weight: 800; margin-top: 8px; letter-spacing: -0.03em; }
.kpi .delta { font-size: 0.85rem; font-weight: 600; margin-top: 6px; }
.delta.up { color: var(--green); }
.delta.down { color: var(--red); }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.data th, table.data td { text-align: left; padding: 12px 12px; border-bottom: 1px solid var(--line-soft); }
table.data th { font-weight: 600; color: var(--muted); font-size: 0.74rem; text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--line); }
table.data tr:hover td { background: var(--cream); }
.muted { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 44px 20px; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.76rem; font-weight: 600; border: 1px solid transparent; }
.badge.gold { background: var(--gold-soft); color: var(--gold-dark); border-color: #EBDFC4; }
.badge.green { background: #E7F6EE; color: var(--green); }
.badge.gray { background: var(--cream); color: var(--ink-soft); }

/* ---------- Toggle ---------- */
.switch { position: relative; display: inline-block; width: 42px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; background: #D4D4D8; border-radius: 999px; transition: .2s; cursor: pointer; }
.switch .slider::before { content: ""; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .slider { background: var(--ink); }
.switch input:checked + .slider::before { transform: translateX(18px); }

/* ---------- Toast ---------- */
#toast {
  position: fixed; bottom: 24px; right: 24px; background: var(--ink); color: #fff;
  padding: 14px 20px; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  font-weight: 500; opacity: 0; transform: translateY(10px); transition: .2s; z-index: 1000; max-width: 360px;
}
#toast.show { opacity: 1; transform: translateY(0); }
#toast.err { background: var(--red); }
#toast.ok { background: var(--green); }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(24,24,27,.45); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 900; }
.modal { background: var(--surface); border-radius: var(--radius); padding: 28px; width: 100%; max-width: 520px; box-shadow: var(--shadow-lg); max-height: 90vh; overflow-y: auto; border: 1px solid var(--line); }
.modal h2 { margin-bottom: 18px; font-weight: 700; letter-spacing: -0.01em; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }

.form-error { color: var(--red); font-size: 0.9rem; margin-top: 10px; font-weight: 500; min-height: 1.2em; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }

/* ---------- Chat ---------- */
.chat-verlauf { height: 55vh; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; background: var(--bg); }
.chat-zeile { display: flex; }
.chat-zeile.r { justify-content: flex-end; }
.chat-zeile.l { justify-content: flex-start; }
.chat-bubble { max-width: 72%; padding: 8px 12px; border-radius: 14px; font-size: 0.92rem; box-shadow: var(--shadow); }
.chat-bubble.eigen { background: var(--ink); color: #fff; border-bottom-right-radius: 4px; }
.chat-bubble.fremd { background: #fff; color: var(--ink); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.chat-name { font-size: 0.72rem; font-weight: 700; color: var(--gold-dark); margin-bottom: 2px; }
.chat-text { white-space: pre-wrap; word-break: break-word; }
.chat-zeit { font-size: 0.66rem; opacity: .6; text-align: right; margin-top: 3px; }
.chat-del { cursor: pointer; opacity: .55; margin-left: 6px; }
.chat-del:hover { opacity: 1; }
.emoji-palette { position: absolute; bottom: 58px; left: 14px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 8px; display: grid; grid-template-columns: repeat(6, 1fr); gap: 2px; z-index: 20; }
.emoji-pick { background: none; border: none; font-size: 1.3rem; cursor: pointer; padding: 4px; border-radius: 8px; }
.emoji-pick:hover { background: var(--cream); }

/* Ungelesen-Badge (Chat-Menü + beim Namen) */
.nav-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--red); color: #fff; font-size: 0.66rem; font-weight: 700; line-height: 1; }
.nav-item .nav-badge { margin-left: auto; }

/* ---------- Mobile / Tablet (Drawer-Navigation) ---------- */
@media (max-width: 820px) {
  .topbar {
    display: flex; align-items: center; gap: 14px;
    position: fixed; top: 0; left: 0; right: 0; height: 56px; z-index: 100;
    background: var(--surface); color: var(--ink); padding: 0 14px;
    border-bottom: 1px solid var(--line);
  }
  .hamburger {
    background: none; border: none; color: var(--ink); font-size: 1.5rem;
    line-height: 1; cursor: pointer; padding: 4px 8px; border-radius: 8px;
  }
  .hamburger:hover { background: var(--cream); }
  .topbar-brand { display: flex; align-items: center; gap: 9px; }
  .topbar .brand-logo { height: 28px; }
  .topbar .brand-sub { font-size: 0.98rem; }

  .sidebar {
    position: fixed; top: 0; left: 0; height: 100vh; width: 270px; max-width: 84vw;
    transform: translateX(-100%); transition: transform .25s ease; z-index: 200;
    overflow-y: auto; box-shadow: var(--shadow-lg);
  }
  #app-view.nav-open .sidebar { transform: translateX(0); }

  .sidebar-backdrop {
    display: block; position: fixed; inset: 0; z-index: 150;
    background: rgba(24,24,27,.45); opacity: 0; pointer-events: none; transition: opacity .25s ease;
  }
  #app-view.nav-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }

  .content { padding: 74px 16px 28px; max-width: none; }
  .page-head h1 { font-size: 1.5rem; }
  .card { padding: 18px 16px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .toolbar { align-items: flex-start; }

  .chart-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .chart-inner { min-width: 540px; }

  .modal { padding: 20px 18px; }
  .modal-actions { flex-direction: column-reverse; gap: 8px; }
  .modal-actions .btn { width: 100%; }

  .kpi .value { font-size: 1.8rem; }
  .chat-verlauf { height: 62vh; }
  .chat-bubble { max-width: 85%; }
}
