/* NeuraMix / neuramix.at look — dark slate + blue/green */
:root {
  --brand-neura: #5b7eb0;
  --brand-mix: #2e6ea2;
  --brand-ai: #5a9e56;
  --bg: #020617;
  --bg-elevated: #0f172a;
  --card: #0f172a;
  --card-elevated: #1e293b;
  --border: #1e293b;
  --border-strong: #334155;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #2e6ea2;
  --accent-bright: #2563eb;
  --accent-green: #10b981;
  --accent-soft: rgba(46, 110, 162, 0.22);
  --grey: #1e293b;
  --grey-text: #94a3b8;
  --ok: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
  --appbar: rgba(15, 23, 42, 0.92);
  --link: #93c5fd;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 10px 15px -3px rgb(15 23 42 / 0.35), 0 4px 6px -4px rgb(15 23 42 / 0.25);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(circle at 50% 0%, rgba(37, 99, 235, 0.12) 0%, transparent 55%),
    var(--bg);
  color: var(--text);
  line-height: 1.45;
  min-height: 100vh;
}

a { color: var(--link); }
a:hover { color: #bfdbfe; }

.font-display, .brand, h1, h2 {
  font-family: "Space Grotesk", Inter, system-ui, sans-serif;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.gradient-text {
  background: linear-gradient(90deg, #2563eb, #10b981);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

header.appbar {
  background: var(--appbar);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: var(--text);
  border-bottom: 1px solid var(--border-strong);
  padding: 0.75rem 1.5rem;
  display: flex;
  gap: 1.25rem;
  align-items: center;
  flex-wrap: wrap;
}
header.appbar a { color: var(--text); text-decoration: none; opacity: 0.85; }
header.appbar a:hover { opacity: 1; color: #fff; }
header.appbar .brand {
  font-weight: 700;
  margin-right: auto;
  letter-spacing: -0.04em;
}

main, .wrap { max-width: 1100px; margin: 1.5rem auto; padding: 0 1rem; }

.card {
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}

h1, h2 { margin-top: 0; color: #f8fafc; }
.muted { color: var(--muted); }

.msg {
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(37, 99, 235, 0.45);
  color: #dbeafe;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
}
.warn {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.45);
  color: #fde68a;
}

table { width: 100%; border-collapse: collapse; }
th, td {
  border: 1px solid var(--border-strong);
  padding: 0.5rem 0.65rem;
  text-align: left;
  vertical-align: top;
}
th { background: var(--card-elevated); color: #cbd5e1; font-weight: 600; }
td { background: rgba(15, 23, 42, 0.55); }

.cal { width: 100%; table-layout: fixed; }
.cal th { text-align: center; }
.cal td {
  height: 90px;
  vertical-align: top;
  font-size: 0.9rem;
}
.cal .out { background: #020617; color: #475569; }
.cal .blocked { background: var(--grey); color: var(--grey-text); }
.cal .extra { outline: 2px solid var(--accent-bright); outline-offset: -2px; }
.cal .daynum { font-weight: 600; font-size: 0.8rem; color: #cbd5e1; }
.cal .aname { margin-top: 0.35rem; }
.cal a.swap { font-size: 0.75rem; color: var(--link); }

.nav-months { display: flex; gap: 1rem; align-items: center; margin-bottom: 1rem; }

.day-pref-fields {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  column-gap: 0.75rem;
  align-items: center;
}
.day-pref-line { display: contents; }
.day-pref-line > span { white-space: nowrap; }
.day-pref-line select,
.day-pref-line input {
  width: 50%;
  min-width: 0;
  margin: 0 0 0.75rem;
}
.day-pref-line:last-of-type input { margin-bottom: 0; }
.day-pref-empty {
  grid-column: 1 / -1;
  margin: 0 0 0.75rem;
}
.day-pref-actions {
  grid-column: 2;
  justify-self: start;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 2pt;
}

button, .btn {
  background: linear-gradient(135deg, var(--accent-bright), var(--accent));
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.95rem;
  cursor: pointer;
  font-size: 0.9rem;
  text-decoration: none;
  display: inline-block;
  font-weight: 600;
}
button:hover, .btn:hover { filter: brightness(1.08); }
button.secondary, .btn.secondary {
  background: #334155;
  color: #e2e8f0;
}
button.danger, .btn.danger { background: var(--danger); }

form.inline { display: inline; }
.checks label { margin-right: 0.6rem; white-space: nowrap; }
.stack > * { margin-bottom: 0.75rem; }

input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=week], input[type=month], select, textarea {
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  min-width: 12rem;
  background: #020617;
  color: var(--text);
}
input[type=date], input[type=week], input[type=month] { color-scheme: dark; }
.overview-when-controls { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }
.overview-when-controls .overview-off { display: none; }
.overview-when-controls select,
.overview-when-controls input { min-width: 7.5rem; }
input::placeholder { color: #64748b; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(37, 99, 235, 0.45);
  border-color: var(--accent-bright);
}

.flex { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-start; }
.status-draft { color: var(--muted); }
.status-pending { color: var(--warn); }
.status-final { color: var(--ok); font-weight: 600; }

.cal-legend { font-size: 0.85rem; margin-bottom: 0.75rem; color: var(--muted); }
.cal .wunsch {
  margin-top: 0.25rem;
  font-size: 0.78rem;
  color: #c4b5fd;
  background: rgba(139, 92, 246, 0.15);
  border: 1px dashed rgba(167, 139, 250, 0.55);
  border-radius: 4px;
  padding: 0.1rem 0.25rem;
  display: inline-block;
}
.cal .wunsch em { font-style: normal; font-weight: 600; opacity: 0.85; }
.cal .aname { font-weight: 600; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}
.modal-card {
  background: var(--card-elevated);
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  max-width: 32rem;
  width: 100%;
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
}
.modal-card h2 { margin-top: 0; }
.wunsch-list { padding-left: 1.1rem; margin: 0.75rem 0 1.25rem; }
.wunsch-list li { margin-bottom: 0.35rem; }

/* User-area shell */
header.appbar.userbar .user-tabs {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}
header.appbar.userbar .user-tabs a.active {
  font-weight: 700;
  text-decoration: underline;
  opacity: 1;
}
header.appbar.userbar .user-chip {
  color: var(--muted);
  font-size: 0.9rem;
  margin-left: 0.25rem;
}
header.appbar.userbar .logout-form { margin-left: auto; }
header.appbar.userbar .logout-form button {
  background: #334155;
  font-size: 0.85rem;
  padding: 0.3rem 0.7rem;
}

.cal td.mine {
  background: rgba(37, 99, 235, 0.18);
  box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.55);
}
.cal .aname.mine,
button.ts-month-open.aname.mine { color: #93c5fd; font-weight: 700; }
button.ts-month-open {
  background: transparent;
  color: #cbd5e1;
  border: 0;
  border-radius: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  font-weight: 600;
  font-size: 0.8rem;
  line-height: 1.3;
  display: inline;
  text-align: left;
  cursor: pointer;
  box-shadow: none;
  min-height: 0;
}
button.ts-month-open.aname {
  display: block;
  margin-top: 0.35rem;
  font-weight: 600;
}
button.ts-month-open:hover { filter: none; color: #f8fafc; }
.cal th.kw,
.cal td.kw {
  width: 1.7rem;
  padding: 0.15rem 0.1rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: #94a3b8;
  text-align: center;
}
.cal .wunsch.mine-wunsch { border-style: solid; font-weight: 600; }

/* Login */
.login-shell {
  max-width: 440px;
  margin: 2.5rem auto;
}
.login-shell .login-modes {
  display: grid;
  gap: 0.75rem;
  margin: 0 0 1.25rem;
  padding: 0;
  list-style: none;
}
.login-shell .login-modes li {
  background: rgba(30, 41, 59, 0.55);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  font-size: 0.9rem;
}
.login-shell .login-modes strong { color: #f8fafc; display: block; margin-bottom: 0.15rem; }
.field-hint { font-size: 0.8rem; color: var(--muted); margin-top: 0.25rem; }
.login-fields {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  column-gap: 0.75rem;
  row-gap: 0.75rem;
  align-items: center;
}
.login-field-line { display: contents; }
.login-field-line > span { white-space: nowrap; }
.login-field-line input {
  width: 100%;
  min-width: 0;
  margin-bottom: 0;
}
.hint-info {
  position: relative;
  display: inline-block;
  margin-left: 0.28rem;
  vertical-align: middle;
}
.hint-info-btn {
  width: 1.05rem;
  height: 1.05rem;
  min-width: 1.05rem;
  min-height: 1.05rem;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  cursor: help;
}
.hint-info-btn:hover,
.hint-info:focus-within .hint-info-btn {
  color: var(--text);
  border-color: var(--link);
  filter: none;
}
.hint-info-pop {
  display: none;
  position: absolute;
  z-index: 6;
  bottom: calc(100% + 0.4rem);
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 15.5rem;
  padding: 0.45rem 0.65rem;
  background: var(--card-elevated);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  font-size: 0.78rem;
  line-height: 1.4;
  font-weight: 400;
  text-align: left;
  white-space: normal;
}
.hint-info:hover .hint-info-pop,
.hint-info:focus-within .hint-info-pop { display: block; }

/* Platform tenants */
.badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-ok { background: rgba(16, 185, 129, 0.18); color: #6ee7b7; }
.badge-off { background: rgba(148, 163, 184, 0.18); color: #cbd5e1; }
.platform-grid {
  display: grid;
  gap: 1.25rem;
}
@media (min-width: 900px) {
  .platform-grid { grid-template-columns: 1fr 1.4fr; align-items: start; }
}
.platform-admin-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}
.platform-admin-form input { min-width: 9rem; }
.platform-config {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
}
.platform-create-tail {
  display: grid;
  grid-template-columns: max-content minmax(8rem, 1fr);
  column-gap: 0.75rem;
  align-items: center;
}
.platform-field-line,
.platform-create-submit { display: contents; }
.platform-field-line > span { white-space: nowrap; }
.platform-field-line input,
.platform-field-line select {
  min-width: 0;
  width: 100%;
  margin-bottom: 0.75rem;
}
.platform-field-line:last-of-type input,
.platform-field-line:last-of-type select { margin-bottom: 0; }
.platform-create-submit button {
  grid-column: 2;
  justify-self: start;
  margin-top: 5pt;
}
.tenant-open-form { margin: 0; }
button.tenant-open {
  background: none;
  color: inherit;
  border: 0;
  border-radius: 0;
  padding: 0;
  font: inherit;
  font-weight: 700;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  cursor: pointer;
}
button.tenant-open:hover { color: #fff; filter: none; }
.support-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 1rem;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(245, 158, 11, 0.55);
  background: rgba(245, 158, 11, 0.14);
  color: #fde68a;
}
.support-banner form { margin: 0; }
.support-banner strong { color: #fff; }
@media (max-width: 899.98px) {
  .platform-grid { grid-template-columns: minmax(0, 1fr); }
  .platform-grid > .card { min-width: 0; max-width: 100%; }
}
@media (max-width: 720px) {
  .platform-create-tail { grid-template-columns: minmax(0, 1fr); min-width: 0; }
  .platform-field-line > span { white-space: normal; }
  .platform-create-submit button { grid-column: 1; }
}
.platform-config form { margin: 0; }
.platform-dialog {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 0;
  background: #0f172a;
  color: #e2e8f0;
  width: min(28rem, calc(100vw - 1.25rem));
  max-height: calc(100vh - 1.5rem);
  overflow: auto;
}
.platform-dialog::backdrop { background: rgba(2, 6, 23, 0.72); }
.platform-dialog form.stack,
.platform-dialog .tenant-action-panel { padding: 1rem 1.1rem 1.15rem; }
.platform-dialog form.stack { gap: 0.75rem; }
.tenant-action-panel form { margin: 0; }
.platform-dialog h2 { margin: 0; font-family: "Space Grotesk", Inter, system-ui, sans-serif; }
.platform-dialog label { font-size: 0.9rem; }
.platform-dialog input[type="email"],
.platform-dialog input[type="password"] {
  width: 100%;
  margin-top: 0.25rem;
}
.platform-dialog .flex { gap: 0.65rem; flex-wrap: wrap; }
@media (max-width: 720px) {
  .platform-dialog {
    width: min(28rem, calc(100vw - 1rem));
  }
  .platform-config .btn,
  .platform-config button { width: 100%; }
}
.table-scroll { overflow-x: auto; }

code {
  font-family: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85em;
  background: rgba(2, 6, 23, 0.65);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  border: 1px solid var(--border-strong);
}

@media (max-width: 640px) {
  header.appbar.userbar { gap: 0.6rem; }
  header.appbar.userbar .user-tabs {
    width: 100%;
    order: 3;
  }
  .cal td { height: 72px; font-size: 0.8rem; }
}


/* Timeslots calendar (Mo–So, mobile-first, NeuraMix) */
.ts-cal-card { padding: 0.75rem; overflow: hidden; }
.ts-week-strip {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.35rem 0 0.75rem;
  margin: 0 0 0.25rem;
  scrollbar-width: thin;
  position: sticky;
  top: 0;
  z-index: 3;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.92));
}
.ts-week-strip a {
  flex: 0 0 auto;
  min-width: 3.25rem;
  min-height: 2.75rem;
  padding: 0.45rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: rgba(30, 41, 59, 0.7);
  color: #e2e8f0;
  text-decoration: none;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  justify-content: center;
  touch-action: manipulation;
}
.ts-week-strip a.today {
  border-color: rgba(59, 130, 246, 0.75);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.35);
  color: #93c5fd;
}
.ts-week-strip a.weekend { color: #94a3b8; }
.ts-week-strip a.active {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.45), rgba(16, 185, 129, 0.35));
  border-color: rgba(52, 211, 153, 0.55);
}

.ts-cal { width: 100%; }
.ts-cal-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: rgba(2, 6, 23, 0.45);
}
.ts-cal-head,
.ts-cal-body {
  display: grid;
  grid-template-columns: 3rem repeat(var(--ts-cols, 7), minmax(4.5rem, 1fr));
  min-width: calc(3rem + var(--ts-cols, 7) * 4.5rem);
}
.ts-cal--day .ts-cal-head,
.ts-cal--day .ts-cal-body {
  --ts-cols: 1;
  grid-template-columns: 3rem minmax(12rem, 1fr);
  min-width: 0;
}
.ts-cal-gutter { position: relative; }
.ts-cal-day-head {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.4rem 0.25rem;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: #cbd5e1;
  text-decoration: none;
  border-bottom: 1px solid var(--border-strong);
  border-left: 1px solid rgba(51, 65, 85, 0.55);
  background: rgba(15, 23, 42, 0.85);
  position: sticky;
  top: 0;
  z-index: 2;
  touch-action: manipulation;
}
.ts-cal-day-head.today { color: #93c5fd; }
.ts-cal-day-head.weekend { color: #94a3b8; }

.ts-cal-body { position: relative; }
.ts-cal-body > .ts-cal-gutter,
.ts-cal-body > .ts-cal-day {
  position: relative;
  height: 52rem;
  border-left: 1px solid rgba(51, 65, 85, 0.45);
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent calc(100% / 24 - 1px),
    rgba(51, 65, 85, 0.45) calc(100% / 24 - 1px),
    rgba(51, 65, 85, 0.45) calc(100% / 24)
  );
}
.ts-cal-hour {
  position: absolute;
  left: 0;
  right: 0.15rem;
  transform: translateY(-50%);
  font-size: 0.65rem;
  color: #64748b;
  text-align: right;
  pointer-events: none;
}
.ts-slot-hit {
  position: absolute;
  left: 0;
  right: 0;
  border: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
  min-height: 1.5rem;
}
.ts-slot-hit:hover,
.ts-slot-hit:focus-visible {
  background: rgba(59, 130, 246, 0.12);
  outline: none;
}
.ts-cal-block {
  position: absolute;
  left: 0.2rem;
  right: 0.2rem;
  z-index: 1;
  border: 0;
  border-radius: 8px;
  padding: 0.25rem 0.35rem;
  text-align: left;
  background: rgba(51, 65, 85, 0.92);
  color: #e2e8f0;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.35);
  overflow: hidden;
  cursor: pointer;
  touch-action: manipulation;
  min-height: 1.75rem;
}
.ts-cal-block.mine {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.75), rgba(16, 185, 129, 0.55));
  box-shadow: inset 0 0 0 1px rgba(147, 197, 253, 0.55);
  color: #f8fafc;
}
.ts-cal-block-time {
  display: block;
  font-size: 0.68rem;
  opacity: 0.9;
  line-height: 1.2;
}
.ts-cal-block-name {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.slot-dialog {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 0;
  background: #0f172a;
  color: #e2e8f0;
  width: min(28rem, calc(100vw - 1.25rem));
  max-height: calc(100vh - 1.5rem);
  overflow: auto;
}
.slot-dialog::backdrop {
  background: rgba(2, 6, 23, 0.72);
}
.slot-dialog form.stack {
  padding: 1rem 1.1rem 1.15rem;
  gap: 0.75rem;
}
.slot-dialog h2 { margin: 0; font-family: "Space Grotesk", Inter, system-ui, sans-serif; }
.slot-dialog label { font-size: 0.9rem; }
.slot-dialog input[type="text"],
.slot-dialog input[type="time"],
.slot-dialog textarea,
.slot-dialog select {
  width: 100%;
  margin-top: 0.25rem;
}
.slot-dialog .flex { gap: 0.65rem; flex-wrap: wrap; }
.slot-dialog .slot-actions { margin-top: 5pt; gap: 0.45rem; }
.slot-dialog button.slot-dialog-btn {
  min-height: 1.85rem;
  min-width: 0;
  padding: 0.2rem 0.65rem;
  font-size: 0.8rem;
  line-height: 1.2;
  touch-action: manipulation;
}
.slot-dialog button[hidden] { display: none !important; }

.ts-year {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
}
.ts-year-month h3 { margin: 0 0 0.5rem; font-size: 1rem; }
.ts-year-month h3 a { color: #93c5fd; text-decoration: none; }
.ts-view-form label { font-size: 0.85rem; }
.ts-cal-nav { gap: 0.5rem; flex-wrap: wrap; }
.ts-cal-nav h1 { font-size: clamp(1rem, 3.5vw, 1.35rem); }

.ts-cal--week .ts-cal-hour { font-size: 0.7rem; line-height: 1; }
.ts-cal--week .ts-cal-head,
.ts-cal--week .ts-cal-body {
  grid-template-columns: 2.85rem repeat(var(--ts-cols, 7), minmax(calc(4.5rem + 4pt), 1fr));
  min-width: calc(2.85rem + var(--ts-cols, 7) * (4.5rem + 4pt));
}
.ts-cal--week .ts-cal-body > .ts-cal-gutter,
.ts-cal--week .ts-cal-body > .ts-cal-day { height: calc(72rem + 96pt); }

@media (max-width: 720px) {
  .ts-cal-nav .btn { flex: 1 1 auto; text-align: center; min-height: 2.75rem; }
  .ts-cal-head,
  .ts-cal-body {
    grid-template-columns: 2.5rem repeat(var(--ts-cols, 7), minmax(3.6rem, 1fr));
    min-width: calc(2.5rem + var(--ts-cols, 7) * 3.6rem);
  }
  .ts-cal--week .ts-cal-head,
  .ts-cal--week .ts-cal-body {
    grid-template-columns: 2.45rem repeat(var(--ts-cols, 7), minmax(calc(3.6rem + 4pt), 1fr));
    min-width: calc(2.45rem + var(--ts-cols, 7) * (3.6rem + 4pt));
  }
  .ts-cal-body > .ts-cal-gutter,
  .ts-cal-body > .ts-cal-day { height: 42rem; }
  .ts-cal--week .ts-cal-body > .ts-cal-gutter,
  .ts-cal--week .ts-cal-body > .ts-cal-day { height: calc(56rem + 96pt); }
  .slot-dialog {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    margin: 0;
  }
  .ts-cal-card .muted { font-size: 0.85rem; }
}

@media (min-width: 900px) {
  .ts-week-strip { display: none; }
  .ts-cal--week .ts-cal-head,
  .ts-cal--week .ts-cal-body {
    grid-template-columns: 2.85rem repeat(7, minmax(4pt, 1fr));
    min-width: 0;
  }
}


/* Platform tenant switcher / feature rows */
.platform-tenant-switcher select {
  min-width: min(100%, 22rem);
  min-height: 2.75rem;
}
.platform-feature-form { gap: 0.65rem; }
.platform-feature-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: rgba(30, 41, 59, 0.45);
}
.platform-feature-row input { margin-top: 0.2rem; min-width: 1.1rem; min-height: 1.1rem; }
.swap-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  cursor: pointer;
  font-weight: 600;
  margin: 0.15rem 0 0;
}
.swap-switch input[type="checkbox"] {
  position: absolute;
  width: 1px;
  height: 1px;
  min-width: 0;
  min-height: 0;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.swap-switch-ui {
  position: relative;
  flex: 0 0 auto;
  width: 2.8rem;
  height: 1.5rem;
  border-radius: 999px;
  background: #334155;
  border: 1px solid var(--border-strong);
  transition: background 0.15s ease;
}
.swap-switch-ui::after {
  content: "";
  position: absolute;
  top: 0.12rem;
  left: 0.14rem;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  background: #e2e8f0;
  transition: transform 0.15s ease;
}
.swap-switch input:checked + .swap-switch-ui {
  background: linear-gradient(135deg, #2563eb, #10b981);
  border-color: transparent;
}
.swap-switch input:checked + .swap-switch-ui::after {
  transform: translateX(1.28rem);
}
.swap-switch input:focus-visible + .swap-switch-ui {
  outline: 2px solid rgba(147, 197, 253, 0.85);
  outline-offset: 3px;
}
.a.btn, a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #2563eb, #10b981);
  color: #f8fafc !important;
  text-decoration: none;
  font-weight: 600;
  border: none;
}
a.btn.secondary, .btn.secondary {
  background: #334155;
}

.msg-error { color: #fecaca; border-color: rgba(248, 113, 113, 0.45); background: rgba(127, 29, 29, 0.25); }

/* Import preview modal (admin users) */
#import-modal .modal-card {
  max-width: 40rem;
}
.import-candidate-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-height: 14rem;
  overflow: auto;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.65rem;
  width: 100%;
  background: rgba(2, 6, 23, 0.35);
}
.import-candidate {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  width: 100%;
  margin: 0;
  padding: 0.4rem 0.4rem;
  border-radius: var(--radius-sm);
  white-space: normal;
  cursor: pointer;
  line-height: 1.4;
}
.import-candidate:hover {
  background: rgba(37, 99, 235, 0.12);
}
.import-candidate input[type="checkbox"] {
  margin: 0.15rem 0 0;
  flex: 0 0 auto;
  min-width: 1.1rem;
  min-height: 1.1rem;
}
.import-candidate .import-parts {
  flex: 1 1 auto;
  min-width: 0;
  word-break: break-word;
}
.import-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  align-items: center;
  margin: 0.25rem 0 0;
  width: 100%;
}
.import-modal-actions button,
.import-modal-actions .btn {
  min-height: 2.35rem;
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.25;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  text-decoration: none;
  cursor: pointer;
}
.import-modal-actions button:not(.secondary):not(.danger),
.import-modal-actions .btn:not(.secondary):not(.danger) {
  background: linear-gradient(135deg, var(--accent-bright), var(--accent));
  color: #fff;
}
.import-modal-actions button.secondary,
.import-modal-actions .btn.secondary {
  background: #334155;
  color: #e2e8f0;
  border-color: var(--border-strong);
}

/* ------------------------------------------------------------------
   Webappi Go – mobile Webapp (responsive), Desktop (>= 900px) unverändert.
   Breakpoints: <= 899.98px Tablet/Handy, <= 640px Handy, <= 400px schmal (360px).
   ------------------------------------------------------------------ */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

@media (max-width: 899.98px) {
  main, .wrap { margin: 1rem auto; padding: 0 0.75rem; }
  .card { padding: 1rem; }

  /* Tabellen: im Wrapper horizontal scrollen statt Seite zu sprengen */
  .table-scroll { margin: 0 0 0.75rem; }
  .table-scroll > table th { white-space: nowrap; }
  .table-scroll.cal-scroll > table.cal { min-width: 40rem; }

  /* Touch-Ziele >= 44x44 px (Kalender-Zellen-Buttons ausgenommen) */
  button:not(.ts-slot-hit):not(.ts-cal-block):not(.ts-month-open):not(.cal-daybtn):not(.wish-btn):not(.hint-info-btn):not(.slot-dialog-btn),
  .btn,
  a.btn {
    min-height: 44px;
    min-width: 44px;
    touch-action: manipulation;
  }
  button:not(.ts-slot-hit):not(.ts-cal-block):not(.ts-month-open):not(.cal-daybtn):not(.wish-btn):not(.hint-info-btn):not(.slot-dialog-btn),
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .slot-dialog button.slot-dialog-btn {
    min-height: 1.85rem;
    min-width: 0;
    padding: 0.2rem 0.65rem;
    font-size: 0.8rem;
  }
  input[type=text], input[type=email], input[type=password], input[type=number],
  input[type=date], input[type=week], input[type=month], input[type=time],
  input[type=tel], input[type=search], select {
    min-height: 44px;
    max-width: 100%;
    font-size: 1rem; /* verhindert iOS-Zoom beim Fokus */
  }
  textarea { max-width: 100%; font-size: 1rem; }
  input[type=checkbox], input[type=radio] {
    width: 1.3rem;
    height: 1.3rem;
    min-width: 1.3rem;
    margin: 0 0.35rem 0 0;
    vertical-align: middle;
    accent-color: var(--accent-bright);
  }
  label:has(> input[type=checkbox]),
  label:has(> input[type=radio]),
  .checks label {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding-right: 0.35rem;
    cursor: pointer;
  }
  label.import-candidate { min-height: 44px; align-items: center; }

  /* Formulare: Felder umbrechen statt überlaufen */
  .flex > label:not(:has(> input[type=checkbox])):not(:has(> input[type=radio])) { flex: 1 1 10rem; min-width: 0; }
  .flex > label input:not([type=checkbox]):not([type=radio]),
  .flex > label select { width: 100%; min-width: 0; }

  /* User-Bar (/me): Tabs als wischbare Leiste mit großen Zielen */
  header.appbar { padding: 0.5rem 0.75rem; gap: 0.6rem; }
  header.appbar.userbar .user-tabs {
    width: 100%;
    order: 3;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 0.35rem;
    scrollbar-width: none;
  }
  header.appbar.userbar .user-tabs a {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 0.85rem;
    border-radius: var(--radius-sm);
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid var(--border-strong);
  }
  header.appbar.userbar .user-tabs a.active {
    text-decoration: none;
    background: rgba(37, 99, 235, 0.28);
    border-color: rgba(59, 130, 246, 0.65);
    color: #f8fafc;
  }
  header.appbar.userbar .logout-form button {
    min-height: 44px;
    padding: 0 0.85rem;
  }

  /* /me Kalender: Navigation, Ansicht-Form, Finder */
  .ts-view-form > label { flex: 1 1 8.5rem; }
  .ts-view-form > button, .ts-view-form > .btn { flex: 1 1 auto; }
  [data-calui="finder"] form button { width: 100%; }

  /* Admin-Inhalte */
  .admin-main h1 { font-size: 1.35rem; }
  .modal-card { padding: 1rem; max-height: calc(100vh - 2rem); overflow: auto; }
}

@media (max-width: 640px) {
  /* Monat/Woche/Tag-Navigation: Titel oben, Vor/Zurück nebeneinander */
  .nav-months { flex-wrap: wrap; gap: 0.5rem; }
  .nav-months > h1 { order: -1; flex: 1 0 100% !important; font-size: 1.25rem; }
  .nav-months > .btn { flex: 1 1 0; text-align: center; }
  .login-shell { margin: 1rem auto; }
  .login-shell input[type=email],
  .login-shell input[type=password] { width: 100%; min-width: 0; }
  .login-shell button[type=submit] { width: 100%; }
  th, td { padding: 0.45rem 0.5rem; }
  .flex > .btn, .flex > button, .flex > form.inline { flex: 0 1 auto; }
}

@media (max-width: 400px) {
  main, .wrap { padding: 0 0.5rem; }
  .card { padding: 0.85rem; border-radius: 10px; }
  header.appbar.userbar .user-chip { display: none; }
  input[type=text], input[type=email], input[type=password], input[type=number],
  input[type=date], input[type=week], input[type=month], select { min-width: 0; }
  .ts-year { grid-template-columns: 1fr; }
}
