@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@600;700;800&family=Tajawal:wght@400;500;700&display=swap');

:root{
  --navy: #0A1220;
  --navy-2: #16233B;
  --navy-3: #1E304F;
  --gold: #C9A227;
  --gold-bright: #E8C468;
  --gold-tint: rgba(201,162,39,.15);
  --bg-page: #EEF1F6;
  --card-bg: #FFFFFF;
  --text-navy: #0F1B2E;
  --text-muted: #6B7686;
  --border-light: #E3E7EE;
  --danger: #D9483F;
  --success: #2F9E63;
  --radius: 16px;
}

*{ box-sizing: border-box; }

html,body{
  margin:0; padding:0; height:100%;
  background: var(--bg-page);
  color: var(--text-navy);
  font-family: 'Tajawal', sans-serif;
  direction: ltr;
}

#root{ min-height:100vh; }

::selection{ background: var(--gold); color:#0A1220; }
::-webkit-scrollbar{ width:8px; height:8px; }
::-webkit-scrollbar-thumb{ background:#C7CEDA; border-radius:8px; }
::-webkit-scrollbar-track{ background:transparent; }

button{ font-family:inherit; cursor:pointer; }
input, select, textarea{ font-family:inherit; }
:focus-visible{ outline: 2px solid var(--gold-bright); outline-offset: 2px; }

/* ===== MK-Wortmarke ===== */
.mk-wordmark-big{
  font-family:'Cairo', sans-serif; font-weight:800; font-size:28px; letter-spacing:2px;
  color:#fff; display:flex; flex-direction:column; align-items:center; gap:6px;
}
.mk-wordmark-big small{
  font-family:'Tajawal', sans-serif; font-weight:500; font-size:11px; letter-spacing:6px; color: var(--gold);
}
.mk-fiberline{
  width:120px; height:3px; position:relative;
  background: linear-gradient(90deg, transparent, var(--gold) 20%, var(--gold-bright) 50%, var(--gold) 80%, transparent);
  border-radius:2px;
}
.mk-fiberline::after{
  content:""; position:absolute; top:-3px; left:50%; transform:translateX(-50%);
  width:9px; height:9px; border-radius:50%; background: var(--gold-bright);
  box-shadow:0 0 10px 2px rgba(232,196,104,.65);
}
.mk-wordmark-inline{
  font-family:'Cairo', sans-serif; font-weight:800; font-size:24px; letter-spacing:.5px; color:#fff;
}
.mk-wordmark-inline .k{ color: var(--gold-bright); }
.mk-wordmark-inline .brand{
  font-family:'Tajawal', sans-serif; font-weight:400; font-size:19px; color:#C9D2E0; margin-left:6px;
}

/* ===== Anmeldebildschirm ===== */
.login-screen{
  min-height:100vh; display:flex; align-items:center; justify-content:center; padding:20px;
  background:
    radial-gradient(circle at 20% 15%, rgba(201,162,39,.10), transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(201,162,39,.08), transparent 45%),
    var(--navy);
}
.login-card{
  width:100%; max-width:380px; background: var(--navy-2); border:1px solid var(--navy-3);
  border-radius: var(--radius); padding:36px 28px; box-shadow: 0 24px 60px rgba(0,0,0,.5);
}
.login-card .mk-wordmark-big{ margin-bottom:26px; }
.field{ margin-bottom:16px; }
.field label{ display:block; font-size:13px; color:#A9B3C4; margin-bottom:6px; }
.field input{
  width:100%; padding:12px 14px; background: rgba(255,255,255,.06); border:1px solid var(--navy-3);
  border-radius:10px; color:#fff; font-size:15px;
}
.field input:focus{ border-color: var(--gold); }
.btn-primary{
  width:100%; padding:13px 14px; background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  color:#1A1404; font-weight:700; font-size:15px; border:none; border-radius:10px; margin-top:6px;
  transition: filter .15s ease;
}
.btn-primary:hover{ filter:brightness(1.08); }
.btn-primary:disabled{ opacity:.5; cursor:not-allowed; }
.error-msg{
  background: rgba(217,72,63,.15); border:1px solid rgba(217,72,63,.4); color:#FFB3AD;
  padding:10px 12px; border-radius:10px; font-size:13px; margin-bottom:14px;
}
.install-hint{ margin-top:18px; text-align:center; font-size:12px; color:#8592A6; }

/* ===== Hauptstruktur ===== */
.app-shell{ min-height:100vh; display:flex; flex-direction:column; }

.app-header{ background: var(--navy); padding:16px 20px 14px; flex-shrink:0; }
.header-row-logo{ display:flex; align-items:center; margin-bottom:14px; }
.header-row-search{ margin-bottom:14px; }
.header-search input{
  width:100%; padding:12px 16px; background: rgba(255,255,255,.07); border:1px solid rgba(255,255,255,.1);
  border-radius:12px; color:#fff; font-size:14.5px;
}
.header-search input::placeholder{ color:#8592A6; }
.header-row-nav{ display:flex; gap:8px; flex-wrap:wrap; margin-bottom:14px; }
.nav-pill{
  padding:9px 18px; border-radius:20px; border:none; font-size:14px; font-weight:700;
  background: var(--navy-2); color:#C9D2E0;
}
.nav-pill.active{ background: var(--gold-bright); color:#1A1404; }
.nav-pill:hover:not(.active){ background: var(--navy-3); color:#fff; }
.header-row-user{ display:flex; align-items:center; justify-content:space-between; }
.user-name-chip{ color:#A9B3C4; font-size:13.5px; }
.btn-logout-pill{
  padding:8px 18px; border-radius:20px; border:none; background:#fff; color: var(--navy);
  font-weight:700; font-size:13.5px;
}
.btn-logout-pill:hover{ background:#E8ECF2; }

.main-area{ flex:1; padding:24px 20px 60px; max-width:1100px; width:100%; margin:0 auto; }

.page-header-row{ display:flex; justify-content:space-between; align-items:center; margin-bottom:20px; flex-wrap:wrap; gap:12px; }
.page-title{ font-family:'Cairo',sans-serif; font-weight:800; font-size:28px; margin:0; color: var(--text-navy); }
.btn-gold-pill{
  padding:11px 22px; border-radius:20px; border:none; background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  color:#1A1404; font-weight:700; font-size:14.5px; white-space:nowrap;
}
.btn-gold-pill:hover{ filter:brightness(1.05); }

/* ===== Karten ===== */
.card-grid{ display:grid; grid-template-columns: repeat(auto-fill, minmax(260px,1fr)); gap:18px; }
.entity-card{
  background: var(--card-bg); border-radius: var(--radius); padding:22px;
  box-shadow: 0 2px 14px rgba(15,27,46,.07); position:relative;
}
.entity-card h3{ margin:0 0 16px; font-family:'Cairo',sans-serif; font-size:22px; color: var(--text-navy); }
.gear-btn{
  position:absolute; top:18px; right:18px; width:34px; height:34px; border-radius:50%;
  background: var(--bg-page); border:1px solid var(--border-light); display:flex; align-items:center;
  justify-content:center; font-size:16px; color: var(--text-muted);
}
.gear-btn:hover{ color: var(--gold); border-color: var(--gold); }
.gear-menu{
  position:absolute; top:56px; right:18px; background:#fff; border:1px solid var(--border-light);
  border-radius:12px; box-shadow:0 10px 30px rgba(15,27,46,.15); z-index:20; overflow:hidden; min-width:170px;
}
.gear-menu button{
  display:block; width:100%; text-align:left; padding:11px 16px; background:none; border:none;
  font-size:13.5px; color: var(--text-navy); border-bottom:1px solid var(--border-light);
}
.gear-menu button:last-child{ border-bottom:none; }
.gear-menu button:hover{ background: var(--bg-page); }
.gear-menu button.danger{ color: var(--danger); }

.stats-row{ display:flex; gap:38px; margin-bottom:16px; }
.stat-block b{ display:block; font-size:26px; color: var(--text-navy); font-family:'Cairo',sans-serif; }
.stat-block span{ font-size:12.5px; color: var(--text-muted); }

.tag-chips{ display:flex; gap:8px; flex-wrap:wrap; }
.tag-chip{
  background: var(--gold-tint); color:#8A6A16; font-size:12.5px; font-weight:700;
  padding:5px 13px; border-radius:14px;
}
.tag-chip.removable{ display:flex; align-items:center; gap:6px; }
.tag-chip.removable button{ background:none; border:none; color:#8A6A16; font-weight:800; cursor:pointer; padding:0; }

/* ===== Formulare / Modale Fenster ===== */
.modal-backdrop{
  position:fixed; inset:0; background: rgba(10,18,32,.55); display:flex; align-items:center;
  justify-content:center; z-index:50; padding:16px;
}
.modal{
  background:#fff; border-radius: var(--radius); width:100%; max-width:460px; padding:26px;
  max-height:88vh; overflow:auto; box-shadow:0 30px 80px rgba(0,0,0,.3);
}
.modal h3{ margin-top:0; font-family:'Cairo',sans-serif; color: var(--text-navy); }
.modal .field label{ color: var(--text-muted); }
.modal .field input, .modal .field select{
  width:100%; padding:11px 14px; border:1px solid var(--border-light); border-radius:10px;
  color: var(--text-navy); font-size:14.5px; background:#F8FAFC;
}
.modal .field input:focus, .modal .field select:focus{ border-color: var(--gold); background:#fff; }
.modal-actions{ display:flex; gap:10px; margin-top:20px; }
.btn-secondary{
  flex:1; padding:11px; border-radius:10px; background: var(--bg-page); border:1px solid var(--border-light);
  color: var(--text-navy); font-weight:600;
}
.btn-secondary:hover{ border-color: var(--gold); }
.checkbox-row{ display:flex; align-items:center; gap:10px; margin-bottom:10px; }
.checkbox-row label{ font-size:14px; color: var(--text-navy); }
.tag-editor{ display:flex; gap:8px; margin-bottom:10px; }
.tag-editor input{ flex:1; }
.tag-editor button{
  padding:0 16px; border-radius:10px; border:none; background: var(--gold); color:#1A1404; font-weight:700;
}

/* ===== Kalender ===== */
.calendar-header{ display:flex; align-items:center; justify-content:space-between; margin-bottom:16px; font-weight:700; color:var(--text-navy); }
.calendar-grid{ display:grid; grid-template-columns: repeat(7,1fr); gap:8px; }
.cal-daylabel{ text-align:center; font-size:12px; color:var(--text-muted); padding:6px 0; }
.cal-day{
  aspect-ratio:1; border-radius:10px; border:1px solid var(--border-light); background:#fff;
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px; font-size:13px;
  position:relative; cursor:pointer; color: var(--text-navy);
}
.cal-day:hover{ border-color: var(--gold); }
.cal-day.empty{ background:none; border:none; cursor:default; }
.cal-day .count{ font-size:11px; color:#8A6A16; font-weight:700; }
.cal-day.blocked-full{ background: rgba(217,72,63,.08); border-color: rgba(217,72,63,.35); }
.cal-day.blocked-morning{ background: var(--gold-tint); }
.cal-day.blocked-evening{ background: rgba(47,158,99,.10); }

/* ===== Tabellen ===== */
.table-wrap{ background:#fff; border-radius: var(--radius); overflow:hidden; box-shadow:0 2px 14px rgba(15,27,46,.07); }
.data-table{ width:100%; border-collapse:collapse; font-size:13.5px; }
.data-table th{
  text-align:left; padding:13px 16px; color: var(--text-muted); font-weight:700; font-size:12.5px;
  border-bottom:1px solid var(--border-light); background:#F8FAFC;
}
.data-table td{ padding:12px 16px; border-bottom:1px solid var(--border-light); color: var(--text-navy); }
.data-table tr:last-child td{ border-bottom:none; }
.data-table tr:hover td{ background:#FAFBFD; }
.filters-row{ display:flex; gap:10px; flex-wrap:wrap; margin-bottom:16px; }
.filters-row input, .filters-row select{
  padding:10px 14px; background:#fff; border:1px solid var(--border-light); border-radius:10px;
  color: var(--text-navy); font-size:13.5px;
}
.badge{ padding:4px 11px; border-radius:20px; font-size:11.5px; font-weight:700; }
.badge.status-neu{ background: rgba(47,158,99,.12); color:#1C7A48; }
.badge.status-erledigt{ background:#EEF1F6; color:#6B7686; }
.badge.status-storniert{ background: rgba(217,72,63,.12); color:#B8362D; }
.badge.role-admin{ background: var(--gold-tint); color:#8A6A16; }
.badge.role-aktiv{ background: rgba(47,158,99,.12); color:#1C7A48; }
.badge.role-inaktiv{ background:#EEF1F6; color:#6B7686; }

.icon-btn-flat{
  padding:6px 12px; border-radius:8px; background:#F1F4F9; border:1px solid var(--border-light);
  color: var(--text-muted); font-size:12.5px; font-weight:600;
}
.icon-btn-flat:hover{ color:#8A6A16; border-color: var(--gold); }
.icon-btn-flat.danger:hover{ color: var(--danger); border-color: var(--danger); }

.empty-state{ text-align:center; padding:60px 20px; color: var(--text-muted); background:#fff; border-radius: var(--radius); }

.toast{
  position:fixed; bottom:20px; left:50%; transform:translateX(-50%); background: var(--navy); color:#fff;
  border:1px solid var(--gold); padding:12px 20px; border-radius:10px; font-size:13.5px; z-index:100;
  box-shadow:0 10px 30px rgba(0,0,0,.3);
}

@media (max-width:640px){
  .header-row-nav{ overflow-x:auto; flex-wrap:nowrap; padding-bottom:4px; }
  .stats-row{ gap:24px; }
}
