:root {
  --blue: #0093D2;
  --blue-dark: #006fa0;
  --blue-deep: #004d73;
  --blue-light: #e0f3fb;
  --yellow: #FFE500;
  --yellow-dark: #d4bf00;
  --text: #0f1923;
  --text-muted: #607080;
  --bg: #f0f6fa;
  --border: #cde3ef;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --radius: 10px;
  --shadow: 0 1px 8px rgba(0, 100, 160, .10);
  --shadow-lg: 0 6px 28px rgba(0, 100, 160, .18);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Barlow', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Loading Screen ── */
#loadingScreen {
  position: fixed; inset: 0;
  background: var(--blue);
  display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 1rem;
  z-index: 999; transition: opacity .4s;
}
#loadingScreen .spin {
  width: 40px; height: 40px;
  border: 3px solid rgba(255,255,255,.3); border-top-color: var(--yellow);
  border-radius: 50%; animation: spin .7s linear infinite;
}
#loadingScreen p { color: rgba(255,255,255,.7); font-size: .9rem; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Auth Screen ── */
#authScreen {
  min-height: 100vh; display: none; align-items: center; justify-content: center;
  background: linear-gradient(150deg, var(--blue-deep) 0%, var(--blue) 50%, #00b4e6 100%);
  padding: 1rem;
}
.auth-card {
  background: white; border-radius: 18px; padding: 2.5rem 2rem;
  width: 100%; max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25); animation: slideUp .4s ease;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 2rem; }
.auth-brand .bb {
  width: 50px; height: 50px; background: white; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  padding: 4px; overflow: hidden;
}
.auth-brand h1 {
  font-family: 'Barlow Condensed', sans-serif; font-weight: 800; font-size: 1.4rem;
  line-height: 1.1; color: var(--text);
}
.auth-brand h1 small { display: block; font-size: .85rem; font-weight: 500; color: var(--text-muted); }
.auth-step { display: none; }
.auth-step.active { display: block; }
.auth-heading { font-family: 'Barlow Condensed', sans-serif; font-weight: 700; font-size: 1.3rem; margin-bottom: .4rem; }
.auth-sub { font-size: .875rem; color: var(--text-muted); margin-bottom: 1.5rem; line-height: 1.5; }
.auth-sub strong { color: var(--blue); }
.auth-msg { border-radius: 8px; padding: 10px 12px; font-size: .85rem; margin-bottom: 1rem; }
.auth-msg.error { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }

/* ── Form Elements ── */
.fg { margin-bottom: 1rem; }
.fr { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
label {
  display: block; font-size: .78rem; font-weight: 600; color: var(--text);
  margin-bottom: 4px; text-transform: uppercase; letter-spacing: .4px;
}
label .opt { font-weight: 400; text-transform: none; color: var(--text-muted); font-size: .72rem; }
input[type=text], input[type=email], input[type=time], input[type=date], input[type=number], select, textarea {
  width: 100%; padding: 9px 11px; border: 1.5px solid var(--border); border-radius: 8px;
  font-family: 'Barlow', sans-serif; font-size: .875rem; color: var(--text);
  background: white; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,147,210,.12); }
textarea { resize: vertical; min-height: 80px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 8px; border: none; cursor: pointer;
  font-family: 'Barlow', sans-serif; font-size: .875rem; font-weight: 600;
  transition: all .15s; text-decoration: none; white-space: nowrap;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-full { width: 100%; }
.btn-sm { padding: 5px 11px; font-size: .8rem; border-radius: 6px; }
.btn-primary { background: var(--yellow); color: var(--text); }
.btn-primary:hover:not(:disabled) { background: var(--yellow-dark); }
.btn-blue { background: var(--blue); color: white; }
.btn-blue:hover:not(:disabled) { background: var(--blue-dark); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1.5px solid var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--bg); color: var(--text); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover:not(:disabled) { background: #15803d; }
.btn-link {
  background: none; border: none; color: var(--blue); text-decoration: underline;
  cursor: pointer; font-size: .85rem; padding: 0; font-family: 'Barlow', sans-serif;
}

/* ── Header ── */
header {
  background: var(--blue); color: white; height: 58px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.25rem; position: sticky; top: 0; z-index: 50;
  box-shadow: 0 2px 10px rgba(0,0,0,.2);
}
.h-brand { display: flex; align-items: center; gap: 10px; }
.h-logo {
  width: 34px; height: 34px; background: white; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  padding: 3px; overflow: hidden;
}
.brand-logo, .header-logo { width: 100%; height: 100%; object-fit: contain; }
.h-title { font-family: 'Barlow Condensed', sans-serif; font-weight: 700; font-size: 1.25rem; }
.h-right { display: flex; align-items: center; gap: 10px; }
.h-user { font-size: .82rem; opacity: .85; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-logout {
  background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.25);
  color: white; padding: 5px 12px; border-radius: 6px; font-size: .8rem;
  font-weight: 600; cursor: pointer; font-family: 'Barlow', sans-serif;
}
.h-logout:hover { background: rgba(255,255,255,.25); }

/* ── Layout ── */
.container { max-width: 1000px; margin: 0 auto; padding: 1.5rem 1.25rem; }
.view { display: none; }
.view.active { display: block; }
.back-btn {
  display: inline-flex; align-items: center; gap: 6px; color: var(--blue);
  font-weight: 600; font-size: .875rem; cursor: pointer; background: none;
  border: none; padding: 0; margin-bottom: 1.25rem; font-family: 'Barlow', sans-serif;
}
.back-btn:hover { color: var(--blue-dark); }

/* ── Tabs ── */
.tabs-bar {
  display: flex; gap: 3px; background: white; border-radius: 10px; padding: 4px;
  border: 1.5px solid var(--border); width: fit-content; margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}
.tab-btn {
  padding: 8px 16px; border-radius: 7px; border: none; background: transparent;
  cursor: pointer; font-family: 'Barlow', sans-serif; font-weight: 600;
  font-size: .875rem; color: var(--text-muted); transition: all .15s;
}
.tab-btn.active { background: var(--blue); color: white; }
.tab-btn:hover:not(.active) { background: var(--blue-light); color: var(--blue); }

/* ── Section Titles ── */
.sec-title { display: flex; align-items: center; gap: 10px; margin-bottom: 1.25rem; }
.sec-title h2 { font-family: 'Barlow Condensed', sans-serif; font-weight: 800; font-size: 1.35rem; }
.sec-title .bar { width: 4px; height: 26px; background: var(--yellow); border-radius: 2px; flex-shrink: 0; }

/* ── Cards ── */
.card {
  background: white; border-radius: var(--radius); border: 1.5px solid var(--border);
  padding: 1.25rem; box-shadow: var(--shadow);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem; flex-wrap: wrap; gap: .5rem;
}
.card-title { font-family: 'Barlow Condensed', sans-serif; font-weight: 700; font-size: 1.05rem; color: var(--blue); }

/* ── Event Cards ── */
.events-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); gap: 1rem; }
.event-card {
  background: white; border-radius: var(--radius); border: 1.5px solid var(--border);
  overflow: hidden; box-shadow: var(--shadow); cursor: pointer;
  transition: box-shadow .2s, transform .2s;
}
.event-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.ec-top {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
  padding: 1rem 1.1rem; padding-right: 5.5rem; position: relative; color: white;
}
.ec-date { font-size: .75rem; opacity: .8; margin-bottom: 2px; font-weight: 500; }
.ec-name { font-family: 'Barlow Condensed', sans-serif; font-weight: 800; font-size: 1.25rem; line-height: 1.15; }
.ec-loc { font-size: .78rem; opacity: .75; margin-top: 4px; }
.ec-badge {
  position: absolute; top: .9rem; right: 1rem; background: var(--yellow);
  color: var(--text); font-size: .7rem; font-weight: 700; padding: 3px 8px; border-radius: 20px;
}
.ec-body { padding: .9rem 1.1rem; }
.ec-stats { display: flex; gap: 1.25rem; margin-bottom: .65rem; }
.stat-v { font-family: 'Barlow Condensed', sans-serif; font-weight: 800; font-size: 1.4rem; color: var(--blue); line-height: 1; }
.stat-l { font-size: .7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.prog { height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; margin-bottom: .65rem; }
.prog-f { height: 100%; border-radius: 3px; transition: width .4s; background: var(--blue); }
.prog-f.warn { background: var(--warning); }
.prog-f.full { background: var(--danger); }
.cat-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.cat-tag { font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 20px; }
.cat-aufbau { background: #fef3c7; color: #92400e; }
.cat-service { background: #dbeafe; color: #1e40af; }
.cat-kasse { background: #dcfce7; color: #166534; }
.cat-abbau { background: #fce7f3; color: #9d174d; }
.cat-kuche { background: #ede9fe; color: #5b21b6; }
.cat-security { background: #fee2e2; color: #991b1b; }
.cat-sonstiges { background: #f1f5f9; color: #475569; }

/* ── Event Detail Hero ── */
.ev-hero {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
  border-radius: var(--radius); color: white; padding: 1.5rem; margin-bottom: 1.5rem;
  position: relative; overflow: hidden;
}
.ev-hero::after {
  content: ''; position: absolute; right: -30px; top: -30px;
  width: 150px; height: 150px; background: rgba(255,229,0,.1); border-radius: 50%;
}
.ev-hero h1 {
  font-family: 'Barlow Condensed', sans-serif; font-weight: 900; font-size: 1.8rem;
  line-height: 1.1; margin-bottom: .4rem;
}
.ev-hero .meta { font-size: .875rem; opacity: .85; }
.ev-hero .desc { margin-top: .75rem; font-size: .875rem; opacity: .9; line-height: 1.5; }
.ev-hero-actions { display: flex; gap: 6px; margin-top: 1rem; flex-wrap: wrap; }
.ev-hero-stats { display: flex; gap: 1.5rem; margin-top: 1rem; }
.evs-v { font-family: 'Barlow Condensed', sans-serif; font-weight: 800; font-size: 1.6rem; line-height: 1; }
.evs-l { font-size: .72rem; opacity: .75; text-transform: uppercase; letter-spacing: .5px; }

/* ── Shift Cards ── */
.shifts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .75rem; }
.shift-card {
  background: white; border-radius: var(--radius); border: 1.5px solid var(--border);
  padding: 1rem; box-shadow: var(--shadow); transition: border-color .15s;
}
.shift-card.mine { border-color: var(--blue); background: var(--blue-light); }
.shift-card.is-full { opacity: .6; }
.sc-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: .5rem; gap: .5rem; }
.sc-title { font-weight: 700; font-size: .9rem; }
.sc-date { font-size: .73rem; color: var(--text-muted); margin-top: 2px; }
.sc-time { font-family: 'Barlow Condensed', sans-serif; font-weight: 700; font-size: 1.2rem; color: var(--blue); white-space: nowrap; }
.sc-meta { display: flex; align-items: center; justify-content: space-between; margin-top: .5rem; }
.sc-regs { margin-top: .5rem; border-top: 1px solid var(--border); padding-top: .5rem; display: flex; flex-direction: column; gap: 4px; }
.sc-reg-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 0.78rem; }
.sc-people { font-size: .73rem; color: var(--text-muted); margin-top: .4rem; font-style: italic; line-height: 1.4; }
.sc-admin { display: flex; gap: 5px; margin-top: .6rem; padding-top: .6rem; border-top: 1px solid var(--border); }

/* ── Shift Form ── */
.shift-form {
  background: var(--bg); border-radius: var(--radius); border: 1.5px solid var(--blue);
  padding: 1.25rem; margin-bottom: 1.25rem;
}
.shift-form-title {
  font-family: 'Barlow Condensed', sans-serif; font-weight: 700; font-size: 1rem;
  color: var(--blue); margin-bottom: 1rem;
}

/* ── Tables ── */
.tbl-wrap { overflow-x: auto; border-radius: 8px; border: 1.5px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
thead th {
  background: var(--blue); color: white; padding: 9px 12px; text-align: left;
  font-family: 'Barlow Condensed', sans-serif; font-size: .9rem; font-weight: 700;
}
tbody td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--blue-light); }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 20px; font-size: .72rem; font-weight: 700; }
.badge-admin { background: var(--yellow); color: var(--text); }
.badge-user { background: var(--blue-light); color: var(--blue-dark); }

/* ── Empty States ── */
.empty { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-icon { font-size: 2.5rem; margin-bottom: .75rem; opacity: .4; }

/* ── User Rows ── */
.user-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.user-row:last-child { border-bottom: none; }
.u-av {
  width: 34px; height: 34px; border-radius: 50%; background: var(--blue);
  color: white; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem; flex-shrink: 0;
}
.u-info { flex: 1; min-width: 0; }
.u-name { font-weight: 600; font-size: .875rem; }
.u-email { font-size: .75rem; color: var(--text-muted); }

/* ── Modals ── */
.modal-bg {
  display: none; position: fixed; inset: 0;
  background: rgba(0,30,50,.55); z-index: 200;
  align-items: center; justify-content: center;
  padding: 1rem; backdrop-filter: blur(2px);
}
.modal-bg.open { display: flex; }
.modal {
  background: white; border-radius: 14px; width: 100%; max-width: 500px;
  max-height: 92vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.25); animation: mIn .2s ease;
}
@keyframes mIn { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: scale(1); } }
.modal-hd { padding: 1.25rem 1.5rem 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.modal-hd h3 { font-family: 'Barlow Condensed', sans-serif; font-weight: 800; font-size: 1.3rem; color: var(--blue); }
.modal-close { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 1.3rem; line-height: 1; flex-shrink: 0; }
.modal-body { padding: 1rem 1.5rem .5rem; }
.modal-ft { padding: .75rem 1.5rem 1.25rem; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

/* ── Misc ── */
hr { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }
.text-muted { color: var(--text-muted); font-size: .85rem; }
#profileSetup { display: none; min-height: 100vh; align-items: center; justify-content: center; background: var(--bg); padding: 1rem; }

/* ── Toast Notifications ── */
.toast-container {
  position: fixed; top: 70px; right: 1rem; z-index: 300;
  display: flex; flex-direction: column; gap: .5rem; pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px; border-radius: 10px; background: white;
  box-shadow: 0 6px 24px rgba(0,0,0,.18); font-size: .875rem; line-height: 1.4;
  max-width: 380px; animation: toastIn .3s ease; border-left: 4px solid var(--blue);
}
.toast.toast-error { border-left-color: var(--danger); }
.toast.toast-success { border-left-color: var(--success); }
.toast.toast-warning { border-left-color: var(--warning); }
.toast-msg { flex: 1; }
.toast-close { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 1.1rem; line-height: 1; padding: 0; }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(40px); } }

/* ── Responsive ── */
@media (max-width: 600px) {
  .events-grid, .shifts-grid { grid-template-columns: 1fr; }
  .fr { grid-template-columns: 1fr; }
  .tabs-bar { width: 100%; }
  .tab-btn { flex: 1; text-align: center; font-size: .8rem; padding: 8px 4px; }
  .ev-hero h1 { font-size: 1.4rem; }
  .h-logo { width: 30px; height: 30px; }
}
