:root {
  --bg: #23262B;
  --card: #2E333A;
  --text: #E8ECF0;
  --muted: #A0A6B0;
  --line: #3A4048;
  --primary: #96E661;
  --primary-text: #1A1D22;
  --danger: #FF5A7A;
  --radius: 12px;
  --sidebar: #2E333A;
}

* { box-sizing: border-box; }
/* display:grid/flex na klasama poništava UA [hidden]{display:none} — mora eksplicitno */
[hidden] { display: none !important; }
html, body {
  margin: 0; padding: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg); color: var(--text);
  min-height: 100%;
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(150,230,97,.12), transparent 50%),
    radial-gradient(ellipse at 80% 90%, rgba(58,110,165,.15), transparent 45%),
    var(--bg);
}

.login-card {
  width: min(400px, 100%);
  background: var(--card);
  border-radius: 16px;
  padding: 28px 24px;
  border: 1px solid var(--line);
}

.login-brand { text-align: center; margin-bottom: 22px; }
.login-brand h1 { margin: 10px 0 4px; font-size: 1.5rem; }
.login-brand p { margin: 0; color: var(--muted); font-size: .85rem; }

.logo-mark {
  width: 52px; height: 52px; margin: 0 auto;
  border-radius: 12px; background: var(--bg);
  display: grid; place-items: center;
  color: var(--primary); font-size: 1.4rem;
}
.logo-mark.sm { width: 40px; height: 40px; margin: 0; font-size: 1.1rem; }

.field { display: block; margin-bottom: 14px; }
.field span { display: block; color: var(--muted); font-size: .8rem; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
  font: inherit;
}
.field textarea { min-height: 100px; resize: vertical; }

.btn {
  border: 0; border-radius: 10px; padding: 12px 16px;
  font: inherit; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn.primary { background: var(--primary); color: var(--primary-text); width: 100%; }
.btn.secondary { background: var(--line); color: var(--text); }
.btn.small { padding: 8px 12px; width: auto; font-size: .9rem; }
.error { color: var(--danger); font-size: .9rem; margin: 0 0 12px; }

.shell { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--sidebar); padding: 20px 14px;
  display: flex; flex-direction: column; gap: 18px;
  border-right: 1px solid var(--line);
}
.side-brand { display: flex; gap: 10px; align-items: center; padding: 0 6px; }
.firma { font-weight: 650; font-size: .9rem; line-height: 1.2; }
.sub { color: var(--muted); font-size: .75rem; margin-top: 2px; }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  background: transparent; border: 0; color: var(--text);
  text-align: left; padding: 10px 12px; border-radius: 8px;
  font: inherit; font-size: 1rem; cursor: pointer;
}
.nav-item:hover, .nav-item.active { background: rgba(150,230,97,.12); }
.nav-item.logout { color: var(--danger); }
.side-foot { border-top: 1px solid var(--line); padding-top: 12px; }
.user { color: var(--muted); font-size: .8rem; margin-bottom: 8px; padding: 0 12px; }

.main { padding: 28px; }
.view h2 { margin: 0; font-size: 1.6rem; }
.lead { color: var(--muted); margin: 8px 0 20px; }
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
}
.tile {
  background: var(--card); border: 0; border-radius: var(--radius);
  padding: 18px 12px; min-height: 110px; color: var(--text);
  cursor: pointer; text-align: center; font: inherit;
}
.tile:hover { outline: 1px solid var(--primary); }
.tile .icon { font-size: 1.6rem; margin-bottom: 8px; }
.tile .t { font-weight: 650; font-size: .95rem; }
.tile .d { color: var(--muted); font-size: .75rem; margin-top: 4px; }

.back {
  background: transparent; border: 0; color: var(--primary);
  font: inherit; cursor: pointer; padding: 0; margin-bottom: 10px;
}
.module-body {
  background: var(--card); border-radius: var(--radius);
  padding: 18px; border: 1px solid var(--line);
}
.module-body:has(.pat-wpf) {
  padding: 0; background: transparent; border: 0;
}
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  text-align: left; padding: 10px 8px;
  border-bottom: 1px solid var(--line); font-size: .92rem;
}
.table th { color: var(--muted); font-weight: 600; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.hint { color: var(--muted); font-size: .85rem; }
.hint.ok { color: var(--primary); }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  background: rgba(150,230,97,.15); color: var(--primary); font-size: .75rem;
}

/* Patienten — WPF order/layout */
.pat-wpf {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 14px;
}
.pat-top {
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
}
.pat-list-block { min-width: 0; }
.pat-items {
  height: 90px;
  overflow: auto;
  background: #2E333A;
  border: 1px solid var(--line);
  border-radius: 4px;
  margin-bottom: 8px;
}
.pat-item {
  display: block; width: 100%; text-align: left;
  border: 0; border-bottom: 1px solid #3A4048;
  background: transparent; color: #fff;
  padding: 8px 10px; font: inherit; font-size: .9rem; cursor: pointer;
}
.pat-item:hover, .pat-item.active { background: #4A5360; }
.pat-search {
  width: 100%; padding: 8px 10px; border-radius: 4px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit;
}
.stam-title {
  margin: 0 0 12px; color: #fff; font-size: 14px; font-weight: 650;
}
.stam-2col, .pflege-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 24px;
}
.wpf-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}
.pflege-2col .wpf-row { grid-template-columns: 130px 1fr; }
.wpf-label { color: var(--muted); font-size: .82rem; }
.wpf-label.inline { white-space: nowrap; margin: 0 6px; }
.wpf-ctrl {
  width: 100%; height: 36px; padding: 6px 10px;
  border: 1px solid var(--line); border-radius: 4px;
  background: #2E333A; color: #fff; font: inherit;
}
textarea.wpf-ctrl { height: auto; min-height: 160px; resize: vertical; }
.geb-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr;
  gap: 6px;
}
.beihilfe-row {
  display: grid;
  grid-template-columns: 1fr auto 70px;
  align-items: center;
}
.beihilfe-row .hoehe { width: 70px; }
.la-head { margin-bottom: 6px; }
.la-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  background: #2E333A;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 12px 10px;
  margin-bottom: 10px;
}
.la-col { display: flex; flex-direction: column; gap: 6px; }
.check { display: flex; align-items: center; gap: 8px; font-size: .88rem; color: #fff; }
.wpf-area { display: flex; flex-direction: column; gap: 8px; }
.wpf-tabs {
  display: flex; flex-wrap: wrap; gap: 0;
  margin: 16px 0 0;
  border-bottom: 1px solid var(--line);
}
.wpf-tabs .tab {
  background: transparent; border: 0; border-bottom: 3px solid transparent;
  color: var(--muted); border-radius: 0; padding: 10px 12px;
  font: inherit; font-size: .82rem; cursor: pointer;
}
.wpf-tabs .tab.active {
  color: #fff; border-bottom-color: var(--primary); background: transparent;
}
.tab-panel { padding: 14px 0 8px; min-height: 220px; }
.pat-footer {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}
.btn-save {
  background: #7B5CFF; color: #fff; border: 0; border-radius: 8px;
  padding: 14px; font-weight: 700; cursor: pointer; font: inherit;
}
.btn-cancel {
  background: #3A4048; color: #fff; border: 0; border-radius: 8px;
  padding: 14px; font-weight: 700; cursor: pointer; font: inherit;
}
.btn-delete {
  background: #C8CDD4; color: #5B616A; border: 0; border-radius: 8px;
  padding: 14px; font-weight: 700; cursor: pointer; font: inherit;
}
.btn-delete:disabled { opacity: .45; cursor: not-allowed; }
.doc-row {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.file-btn { cursor: pointer; margin: 0; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .nav { flex-direction: row; flex: none; width: 100%; }
  .side-foot { width: 100%; display: flex; justify-content: space-between; align-items: center; }
  .pat-top, .stam-2col, .pflege-2col, .pat-footer, .la-box { grid-template-columns: 1fr; }
  .wpf-row, .pflege-2col .wpf-row { grid-template-columns: 1fr; gap: 4px; }
}
