/* HealthDocs – global styles */

:root {
  --max-width: 980px;
  --pad: 16px;

  --bg: #ffffff;
  --bg-soft: #fafafa;
  --border: #dddddd;

  --text: #111111;
  --text-soft: #555555;

  --primary: #1f2937; /* dunkel, seriös */
  --primary-contrast: #ffffff;

  --radius: 10px;
}

/* Reset / Base */
* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont,
               "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.45;
}

/* Layout */
.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--pad);
}

main {
  padding: 24px 0;
}

/* Header */
header {
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.3px;
}

/* Navigation */
nav a {
  margin-left: 12px;
  text-decoration: none;
  color: var(--primary);
}

/* Footer */
footer {
  background: var(--bg-soft);
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--text-soft);
}

/* Components */
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}

@media (min-width: 800px) {
  .grid {
    grid-template-columns: 2fr 1fr;
  }
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--primary);
  background: var(--primary);
  color: var(--primary-contrast);
  text-decoration: none;
  cursor: pointer;
}

.btn.secondary {
  background: transparent;
  color: var(--primary);
}

/* Tables */
table {
  border-collapse: collapse;
  width: 100%;
}

.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align:left; }
.table thead th { font-size: .9rem; color: var(--text-soft); }
.muted { color: var(--text-soft); }

th, td {
  border: 1px solid var(--border);
  padding: 8px;
  text-align: left;
}

th {
  background: var(--bg-soft);
}

/* Forms */
label {
  display: block;
  font-weight: 500;
}

input, select, textarea {
  width: 100%;
  padding: 8px;
  margin-top: 4px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font: inherit;
}

textarea {
  resize: vertical;
}

/* Header Nav */
.nav { display:flex; align-items:center; gap:12px; }
.nav a { margin-left: 0; }

/* User dropdown menu */
.user-menu { position: relative; }
.user-btn{
  border: 1px solid var(--border);
  background: #fff;
  padding: 8px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  font: inherit;
}
.user-dropdown{
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 200px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0,0,0,0.08);
  overflow: hidden;
  z-index: 50;
}
.user-dropdown a{
  display:block;
  padding: 10px 12px;
  text-decoration:none;
  color: var(--text);
}
.user-dropdown a:hover{ background: var(--bg-soft); }
.user-dropdown .sep{ border-top: 1px solid var(--border); }

/* Dropdown via Klasse öffnen (statt inline display) */
.user-menu.open .user-dropdown { display: block; }

/* Profile panel (TK-style) */
.user-dropdown.profile-panel{
  width: 320px;
  min-width: 320px; /* überschreibt min-width:200px */
  padding: 16px;
  border-radius: 14px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.14);
  overflow: visible; /* wir managen Linien selbst */
}

/* Header area inside panel */
.profile-head{
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}

.profile-head .avatar{
  width: 52px;
  height: 52px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #fff;
  background: var(--primary);
}

.profile-meta .name{
  font-weight: 700;
  line-height: 1.2;
}

.profile-meta .pid{
  margin-top: 4px;
  font-size: .85rem;
  color: var(--text-soft);
}

/* Links list */
.profile-links{
  padding-top: 4px;
}

.profile-links a{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 4px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  color: var(--text);
  text-decoration: none;
}

.profile-links a:last-child{
  border-bottom: none;
}

.profile-links a span{
  color: #999;
  font-size: 1.2rem;
  line-height: 1;
}

/* hover */
.profile-links a:hover{
  background: var(--bg-soft);
  border-radius: 10px;
  padding-left: 10px;
  padding-right: 10px;
}

/* Logout button */
.profile-footer{
  margin-top: 14px;
}

.profile-footer .logout-btn{
  display: block;
  width: 100%;
  text-align: center;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--primary);
  color: var(--primary-contrast);
  text-decoration: none;
  font-weight: 600;
  border: 1px solid var(--primary);
}

.profile-footer .logout-btn:hover{
  filter: brightness(0.95);
}

/* Ensure panel styles win over generic dropdown styles */
.user-dropdown.profile-panel a{ padding: 12px 4px; }
.user-dropdown.profile-panel a:hover{ background: var(--bg-soft); }


/* Dashboard tiles */
.tiles {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 800px) {
  .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.tile {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  padding: 14px;
  text-decoration: none;
  color: var(--text);
  min-height: 110px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
}
.tile:hover { background: var(--bg-soft); }

.tile-icon { font-size: 34px; line-height: 1; }
.tile-title { font-weight: 700; font-size: 1.05rem; }
.tile-sub { color: var(--text-soft); font-size: .9rem; }

.tile-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  line-height: 26px;
  text-align: center;
}
.tile-remove:hover { background: var(--bg-soft); }

.tile-plus {
  display:flex;
  align-items:center;
  justify-content:center;
  font-size: 42px;
  color: var(--text-soft);
}

.tile a.tile-link {
  position: absolute;
  inset: 0;
  z-index: 1;
}

@media (max-width: 420px){
  .user-dropdown.profile-panel{
    width: min(92vw, 360px);
    min-width: 0;
  }
}

/* Small avatar in header */
.avatar-btn{
  padding: 0;
  border: none;
  background: none;
}

.avatar-small{
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--primary-contrast);
  font-weight: 700;
  font-size: .9rem;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.avatar-small:hover{
  filter: brightness(0.95);
}

fieldset label { font-weight: 400; }
fieldset input[type="checkbox"] { width: auto; margin-right: 8px; }