:root {
  --bg: #f4f5f9;
  --surface: #ffffff;
  --surface-2: #f1f3f8;
  --surface-3: #e8ebf3;
  --border: #e3e6ee;
  --text: #151a2d;
  --muted: #6a7089;
  --faint: #9aa0b6;
  --primary: #4f46e5;
  --primary-2: #7c3aed;
  --primary-soft: #eef0ff;
  --primary-text: #4338ca;
  --success: #16a34a;
  --success-soft: #e8f8ee;
  --danger: #dc2626;
  --danger-soft: #fdeceb;
  --warn: #c2410c;
  --warn-soft: #fff1e6;
  --shadow: 0 1px 2px rgba(20, 24, 45, .05), 0 4px 16px rgba(20, 24, 45, .05);
  --shadow-lg: 0 12px 40px rgba(20, 24, 45, .18);
  --radius: 16px;
  --radius-sm: 10px;
  --sidebar: 252px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1020;
    --surface: #151a2e;
    --surface-2: #1b2138;
    --surface-3: #252c47;
    --border: #262d48;
    --text: #e9ebf5;
    --muted: #9298b3;
    --faint: #686f8e;
    --primary: #6d65f4;
    --primary-soft: #23264a;
    --primary-text: #b4b0ff;
    --success: #22c55e;
    --success-soft: #133024;
    --danger: #f05252;
    --danger-soft: #3a1a20;
    --warn: #fb923c;
    --warn-soft: #3a2415;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .2);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
a { color: var(--primary-text); }
button, input, select, textarea { font: inherit; color: inherit; }
.ic { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- boot / auth ---------- */
.boot { display: grid; place-items: center; height: 100vh; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1200px 600px at 10% -10%, rgba(99, 102, 241, .22), transparent 60%),
              radial-gradient(900px 500px at 110% 110%, rgba(124, 58, 237, .18), transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 410px; background: var(--surface); border: 1px solid var(--border); border-radius: 22px; padding: 32px 28px; box-shadow: var(--shadow-lg); }
.auth-card .brand-lg { text-align: center; margin-bottom: 24px; }
.auth-card .brand-lg .logo { margin: 0 auto 14px; width: 56px; height: 56px; border-radius: 16px; font-size: 24px; }
.auth-card h1 { font-size: 24px; }
.auth-card p.lead { margin: 6px 0 0; color: var(--muted); }
.auth-card form { display: grid; gap: 14px; }

.logo { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; color: #fff; font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--primary-2)); box-shadow: 0 6px 16px rgba(79, 70, 229, .35); }
.logo svg { width: 60%; height: 60%; }

/* ---------- forms ---------- */
label.f { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
input[type=text], input[type=password], input[type=email], input[type=tel], input[type=number], input[type=date], input[type=time], select, textarea {
  width: 100%; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-size: 15px; font-weight: 500; outline: none; transition: border-color .15s, box-shadow .15s; min-height: 42px;
}
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stack { display: grid; gap: 14px; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--primary); flex: none; }
.form-err { color: var(--danger); font-size: 14px; min-height: 0; margin: 0; }
.form-err:empty { display: none; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; min-height: 40px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; font-size: 14px; cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s, box-shadow .15s; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 30%, transparent); }
.btn.primary:hover { background: color-mix(in srgb, var(--primary) 88%, #000); }
.btn.success { background: var(--success); border-color: var(--success); color: #fff; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.soft-danger { color: var(--danger); }
.btn.soft-danger:hover { background: var(--danger-soft); }
.btn.sm { min-height: 32px; padding: 5px 11px; font-size: 13px; border-radius: 8px; }
.btn.icon { padding: 0; width: 36px; min-height: 36px; }
.btn.sm.icon { width: 32px; min-height: 32px; }
.btn.block { width: 100%; }
.btn.lg { min-height: 50px; font-size: 16px; padding: 12px 22px; border-radius: 13px; }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 8px; font-weight: 600; font-size: 13.5px; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg.full { display: flex; }
.seg.full button { flex: 1; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tchip { border: 1px dashed var(--border); background: var(--surface-2); color: var(--muted); padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.tchip:hover { border-color: var(--primary); color: var(--primary-text); }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 14px; z-index: 40; transition: transform .25s ease; }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 20px; }
.brand b { display: block; font-size: 16px; }
.brand small { display: block; color: var(--muted); font-size: 12px; }
.nav { flex: 1; overflow-y: auto; display: grid; align-content: start; gap: 2px; }
.nav .sec { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); padding: 16px 12px 6px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14.5px; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.on { background: var(--primary-soft); color: var(--primary-text); }
.nav a .badge { margin-left: auto; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 12px 8px 4px; border-top: 1px solid var(--border); margin-top: 10px; }
.side-user .who { flex: 1; min-width: 0; }
.side-user .who b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .who small { color: var(--muted); font-size: 12px; }
.main { flex: 1; min-width: 0; margin-left: var(--sidebar); }
.topbar { display: none; }
.view { max-width: 1240px; margin: 0 auto; padding: 28px 32px 60px; }
/* zusammengefasste Menüpunkte: Unterpunkte im Menü + Reiter über der Seite */
.nav a.grp { background: transparent; color: var(--text); }
.nav .subnav { display: grid; gap: 2px; margin: 0 0 4px 22px; padding-left: 12px; border-left: 2px solid var(--border); }
.nav .subnav a { padding: 8px 10px; font-size: 14px; font-weight: 600; }
.vtabs-wrap { max-width: 1240px; margin: 0 auto; padding: 22px 32px 0; }
.vtabs-wrap.wide { max-width: 1640px; }
.vtabs-wrap:empty { display: none; }
.vtabs-wrap:not(:empty) + .view { padding-top: 16px; }
.vtabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 12px; max-width: 100%; overflow-x: auto; }
.vtabs a { padding: 8px 16px; border-radius: 9px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.vtabs a.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.backdrop { display: none; }
.bottomnav { display: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 26px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h3 { font-size: 15.5px; display: flex; align-items: center; gap: 8px; }
.card-body { padding: 16px 20px; }
.grid-dash { display: grid; grid-template-columns: 1.55fr 1fr; gap: 20px; align-items: start; }
.col { display: grid; gap: 20px; }
#dashTop:empty, #dashMods:empty { display: none; }
.empty { text-align: center; color: var(--muted); padding: 26px 12px; font-size: 14px; }
.empty .ic { width: 30px; height: 30px; color: var(--faint); display: block; margin: 0 auto 8px; }

/* hero */
.hero { position: relative; overflow: hidden; color: #fff; border-radius: 22px; padding: 26px 28px;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 60%, #a855f7 100%); box-shadow: 0 16px 40px rgba(79, 70, 229, .32); }
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 240px; height: 240px; border-radius: 50%;
  border: 34px solid rgba(255, 255, 255, .08); box-shadow: 0 0 0 40px rgba(255, 255, 255, .04); }
.hero .eyebrow { font-size: 12.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; opacity: .8; }
.hero h2 { font-size: 30px; margin-top: 8px; font-weight: 800; }
.hero .time { font-size: 20px; font-weight: 600; margin-top: 4px; opacity: .95; }
.hero .meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; position: relative; z-index: 1; }
.hero .pill { background: rgba(255, 255, 255, .17); backdrop-filter: blur(6px); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; display: inline-flex; gap: 6px; align-items: center; }
.hero .pill.live { background: #fff; color: #4f46e5; }
.hero .pill.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .3); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); } }
.hero.empty-hero { background: linear-gradient(135deg, #334155, #475569); box-shadow: var(--shadow); }
.hero .btn { position: relative; z-index: 1; margin-top: 18px; background: #fff; color: #4f46e5; border-color: #fff; }
.hero .mates { display: flex; margin-top: 16px; align-items: center; gap: 10px; font-size: 13px; opacity: .95; position: relative; z-index: 1; }
.hero .mates .avatars .av { border: 2px solid #6d4ee9; }

/* clock card */
.clock { display: flex; align-items: center; gap: 18px; padding: 20px; flex-wrap: wrap; }
.clock .face { width: 58px; height: 58px; border-radius: 16px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.clock .face .ic { width: 28px; height: 28px; }
.clock.on .face { background: var(--success-soft); color: var(--success); }
.clock .txt { flex: 1; min-width: 150px; }
.clock .txt b { font-size: 16px; display: block; }
.clock .timer { font-size: 28px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat .lbl { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat .val { font-size: 24px; font-weight: 800; margin-top: 4px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .val small { font-size: 14px; font-weight: 600; color: var(--muted); }
.bar { height: 6px; background: var(--surface-3); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-2)); border-radius: 99px; }
.bar.over i { background: var(--warn); }

/* lists */
.list { display: grid; }
.li { display: flex; align-items: center; gap: 14px; padding: 12px 20px; border-top: 1px solid var(--border); }
.li:first-child { border-top: 0; }
.li .grow { flex: 1; min-width: 0; }
.li .t { font-weight: 600; font-size: 14.5px; }
.li .s { color: var(--muted); font-size: 13px; }
.datebox { width: 48px; flex: none; text-align: center; border-radius: 12px; background: var(--surface-2); padding: 6px 0; line-height: 1.1; }
.datebox b { display: block; font-size: 18px; }
.datebox small { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--muted); }
.datebox.today { background: var(--primary-soft); color: var(--primary-text); }

.av { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; color: var(--primary-text); font-weight: 700; font-size: 13px; flex: none; background: var(--primary-soft); }
.u18 { display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 6px; font-size: 11px; font-weight: 800; letter-spacing: .03em;
  background: #fde68a; color: #92400e; white-space: nowrap; vertical-align: 1px; }
.u18.sm { font-size: 9.5px; padding: 0 4px; border-radius: 4px; margin-left: 2px; }
.stat.money .val { color: var(--success); }
.swp { color: var(--warn); font-weight: 800; margin-left: 2px; }
.dpref { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.dpref button { border: 1.5px solid var(--border); background: var(--surface); border-radius: 10px; padding: 7px 0; font-weight: 700; cursor: pointer; color: var(--text); }
.dpref button small { display: block; font-size: 10.5px; font-weight: 600; color: var(--muted); }
.dpref button[data-v="pref"] { border-color: var(--success); background: var(--success-soft); }
.dpref button[data-v="pref"] small, b.ok { color: var(--success); }
.dpref button[data-v="no"] { border-color: var(--danger); background: var(--danger-soft); }
.dpref button[data-v="no"] small, b.no { color: var(--danger); }
.tchip.on { border-style: solid; border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.ap-day { border-top: 1px solid var(--border); padding: 10px 0; }
.ap-day:first-child { border-top: 0; }
.ap-slot { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; flex-wrap: wrap; }
.ap-slot .when { min-width: 150px; font-weight: 700; font-size: 13.5px; }
.ap-people { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.ap-p { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--surface-2); }
.ap-p.new { background: var(--primary-soft); color: var(--primary-text); }
.ap-p.empty { background: var(--warn-soft); color: var(--warn); }
.ap-p small { font-weight: 500; opacity: .8; }
.oh { display: grid; gap: 6px; }
.oh-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.oh-row input[type=time] { width: 112px; min-height: 36px; padding: 6px 8px; }
.oh-row.off input[type=time] { opacity: .35; }
.oh-row .oh-state { min-width: 70px; }
.today-open { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.bc-body { white-space: pre-wrap; font-size: 15px; line-height: 1.55; margin: 0; }
.swap-card { border-color: color-mix(in srgb, var(--warn) 35%, var(--border)); }
.swap-card .card-head { background: var(--warn-soft); border-radius: var(--radius) var(--radius) 0 0; }
.swap-card .card-head h3 { color: var(--warn); }
.badge .ic { width: 12px; height: 12px; }
.sl { display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 6px; font-size: 11px; font-weight: 800; letter-spacing: .02em;
  background: var(--primary); color: #fff; white-space: nowrap; vertical-align: 1px; }
.sl.sm { font-size: 9.5px; padding: 0 4px; border-radius: 4px; margin-left: 2px; }
.wmark.nosl { background: var(--warn-soft); color: var(--warn); margin-left: auto; white-space: nowrap; }
.lead-card { border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.lead-card .card-head { background: var(--primary-soft); border-radius: var(--radius) var(--radius) 0 0; }
.lead-card .card-head h3 { color: var(--primary-text); }
.av.sm { width: 26px; height: 26px; font-size: 11px; }
.av.lg { width: 48px; height: 48px; font-size: 17px; }
.avatars { display: flex; }
.avatars .av { margin-left: -8px; border: 2px solid var(--surface); }
.avatars .av:first-child { margin-left: 0; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.primary { background: var(--primary-soft); color: var(--primary-text); }
.badge.green { background: var(--success-soft); color: var(--success); }
.badge.red { background: var(--danger-soft); color: var(--danger); }
.badge.orange { background: var(--warn-soft); color: var(--warn); }
.badge.count { background: var(--danger); color: #fff; min-width: 20px; justify-content: center; padding: 1px 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--primary)); flex: none; display: inline-block; }

.notice { display: flex; gap: 12px; align-items: center; padding: 14px 18px; border-radius: var(--radius); background: var(--warn-soft); color: var(--warn); font-weight: 600; font-size: 14px; text-decoration: none; }
.notice .ic { width: 20px; height: 20px; }
.notice.info { background: var(--primary-soft); color: var(--primary-text); }
.blockline { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--danger-soft); color: var(--danger); font-size: 13.5px; }
.blockline .ic { width: 20px; height: 20px; margin-top: 1px; }
.blockline b { color: var(--danger); }
.warnline { color: var(--warn); font-size: 13px; font-weight: 600; display: flex; gap: 6px; align-items: center; }

/* ---------- calendar ---------- */
.cal-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.month-nav { display: flex; align-items: center; gap: 6px; }
.month-nav h2 { font-size: 20px; min-width: 190px; text-align: center; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); border-radius: var(--radius); overflow: hidden; background: var(--border); gap: 1px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.cal .wd { background: var(--surface-2); padding: 9px 10px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.cal .day { background: var(--surface); min-height: 118px; padding: 7px; display: flex; flex-direction: column; gap: 4px; cursor: pointer; transition: background .12s; min-width: 0; }
.cal .day:hover { background: var(--surface-2); }
.cal .day.out { background: var(--surface-2); }
.cal .day.out .dn { opacity: .45; }
.cal .day.past .dn { color: var(--faint); }
.cal .dn { font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.cal .dn span.n { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; }
.cal .day.today .dn span.n { background: var(--primary); color: #fff; }
.chip { display: flex; flex-wrap: wrap; align-items: center; column-gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 7px; border-radius: 7px; line-height: 1.35;
  background: color-mix(in srgb, var(--c) 14%, var(--surface)); color: var(--text); border-left: 3px solid var(--c); min-width: 0; }
.chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1 1 auto; min-width: 0; }
.chip .tm { color: var(--muted); font-weight: 500; flex: 0 0 auto; font-size: 11.5px; }
.chip.mine { box-shadow: inset 0 0 0 1.5px var(--c); }
.chip.wish { background: transparent; border: 1.5px dashed var(--c); border-left-width: 1.5px; color: var(--muted); }
/* Kostenstellen / eingearbeitet */
.ccdot { width: 8px; height: 8px; border-radius: 50%; background: var(--cc); flex: none; display: inline-block; }
.chip .tm .ccdot { width: 7px; height: 7px; margin-right: 3px; vertical-align: 0; }
.chip .tm { flex: 0 1 auto; min-width: 0; text-overflow: clip; letter-spacing: -.2px; }
.ccb { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap;
  color: color-mix(in srgb, var(--cc) 80%, var(--text)); background: color-mix(in srgb, var(--cc) 14%, transparent); }
.ccb::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--cc); }
.ccb.none { --cc: #94a3b8; color: var(--muted); font-weight: 600; }
.tgl { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1.5px solid var(--border); border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 14px; user-select: none; }
.tgl input { accent-color: var(--cc); width: 16px; height: 16px; margin: 0; }
.tgl:has(input:checked) { border-color: var(--cc); background: color-mix(in srgb, var(--cc) 12%, transparent); color: color-mix(in srgb, var(--cc) 80%, var(--text)); }
.drag-group { display: grid; gap: 6px; }
.drag-title, .team-group { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-top: 4px; }
.drag-title .cnt, .team-group .cnt { margin-left: auto; background: var(--surface-2); border-radius: 99px; padding: 0 8px; font-size: 11.5px; }
.team-group { font-size: 13px; margin: 0 0 10px; }
.team-group .cnt { margin-left: 4px; }
.drag-item.untrained { opacity: .42; border-style: dashed; }
.drag-item.untrained:hover { opacity: .8; }
.chip.warn { box-shadow: inset 0 0 0 1.5px var(--warn); }
.seg button .ccdot { vertical-align: 0; }
.chip[draggable=true] { cursor: grab; }
.chip.open { background: transparent; border: 1.5px dashed var(--faint); border-left: 3px solid var(--faint); color: var(--muted); }
.chip.open.applied { border-color: var(--success); color: var(--success); }
.cal .day.drop { background: var(--primary-soft); box-shadow: inset 0 0 0 2px var(--primary); }
.view.wide { max-width: 1640px; }
.plan-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 18px; align-items: start; }
.plan-main { min-width: 0; }
.plan-side { position: sticky; top: 16px; padding: 14px; display: grid; gap: 12px; max-height: calc(100vh - 32px); overflow: auto; }
.side-opts { display: grid; gap: 10px; }
.drag-list { display: grid; gap: 6px; }
.drag-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  cursor: grab; user-select: none; font-weight: 600; font-size: 14px; transition: border-color .12s, box-shadow .12s; }
.drag-item:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.drag-item:active { cursor: grabbing; }
.drag-item small { display: block; color: var(--muted); font-weight: 500; font-size: 11.5px; }
.drag-item.open-item { border-style: dashed; color: var(--muted); }
@media (max-width: 1280px) {
  .plan-layout { grid-template-columns: 1fr; }
  .plan-side { position: static; max-height: none; }
  .side-opts { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
  .drag-list { display: flex; flex-wrap: wrap; }
}
.more { font-size: 11.5px; color: var(--muted); font-weight: 600; padding-left: 4px; }
.wmarks { display: flex; gap: 4px; flex-wrap: wrap; }
.wmark { font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 99px; background: var(--primary-soft); color: var(--primary-text); }
.wmark.off { background: var(--danger-soft); color: var(--danger); }
.dots { display: none; gap: 3px; flex-wrap: wrap; }
.agenda { display: none; }

.mini-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.mini-cal .wd { text-align: center; font-size: 11px; font-weight: 700; color: var(--faint); padding: 4px 0; }
.mini-cal button { aspect-ratio: 1; border: 1px solid transparent; background: var(--surface-2); border-radius: 10px; font-weight: 700; font-size: 14px; cursor: pointer; position: relative; color: var(--text); }
.mini-cal button:hover:not(:disabled) { border-color: var(--primary); }
.mini-cal button:disabled { opacity: .3; cursor: default; background: transparent; }
.mini-cal button.sel { background: var(--primary); color: #fff; box-shadow: 0 4px 10px color-mix(in srgb, var(--primary) 35%, transparent); }
.mini-cal button.sel.off { background: var(--danger); }
.mini-cal button.has::after { content: ""; position: absolute; bottom: 5px; left: 50%; transform: translateX(-50%); width: 5px; height: 5px; border-radius: 50%; background: var(--primary); }
.mini-cal button.shift::before { content: ""; position: absolute; top: 5px; right: 5px; width: 5px; height: 5px; border-radius: 50%; background: var(--success); }
.mini-cal button.sel::after { background: #fff; }
.mini-cal .blank { aspect-ratio: 1; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 11px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tfoot td { font-weight: 800; background: var(--surface-2); border-top: 1px solid var(--border); }
.tbl .r { text-align: right; }
.tbl .acts { text-align: right; white-space: nowrap; }
.pos { color: var(--success); font-weight: 700; }
.neg { color: var(--danger); font-weight: 700; }

/* ---------- team / roles ---------- */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.ucard { padding: 18px; display: flex; gap: 14px; align-items: flex-start; }
.ucard .grow { flex: 1; min-width: 0; }
.ucard .t { font-weight: 700; font-size: 15.5px; }
.ucard .s { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ucard.inactive { opacity: .6; }
.perm-list { display: grid; gap: 4px; }
.perm { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; cursor: pointer; }
.perm:hover { background: var(--surface-2); }
.perm input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--primary); flex: none; }
.perm b { display: block; font-size: 14px; }
.perm small { color: var(--muted); font-size: 12.5px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--border); cursor: pointer; background: var(--c); }
.swatch.on { box-shadow: 0 0 0 2px var(--text); }
.swatches input[type=color] { width: 34px; height: 34px; padding: 0; border: 0; background: none; cursor: pointer; }
.tpl-row { display: grid; grid-template-columns: 1.4fr 1fr 1fr auto; gap: 10px; align-items: center; }

/* ---------- modal / toast ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(10, 12, 25, .5); backdrop-filter: blur(3px); z-index: 100; display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal { width: 100%; max-width: 520px; max-height: calc(100vh - 32px); background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: pop .18s ease-out; border: 1px solid var(--border); }
.modal.wide { max-width: 720px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); gap: 12px; }
.modal-head h3 { font-size: 18px; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.modal-foot .left { margin-right: auto; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.sec-title { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 4px 0 8px; }
.rowline { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.rowline:first-of-type { border-top: 0; }
.rowline .grow { flex: 1; min-width: 0; }

#toasts { position: fixed; z-index: 200; bottom: 24px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: #151a2d; color: #fff; padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 600; font-size: 14px; display: flex; gap: 10px; align-items: center; animation: pop .2s; }
.toast.err { background: var(--danger); }
.toast.ok .ic { color: #4ade80; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .grid-dash { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .shell.nav-open .sidebar { transform: none; }
  .shell.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(10, 12, 25, .45); z-index: 35; }
  .main { margin-left: 0; }
  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30; padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top));
    background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
  .topbar b { font-size: 16px; flex: 1; }
  .view { padding: 18px 16px 110px; }
  .vtabs-wrap { padding: 14px 16px 0; }
  .vtabs { display: flex; }
  .vtabs a { flex: 1; justify-content: center; padding: 8px 10px; }
  .page-head h1 { font-size: 22px; }
  .bottomnav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--border);
    padding: 6px 6px max(6px, env(safe-area-inset-bottom)); }
  .bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 600; border-radius: 10px; position: relative; }
  .bottomnav a .ic { width: 22px; height: 22px; }
  .bottomnav a.on { color: var(--primary-text); }
  .bottomnav a .badge.count { position: absolute; top: 0; left: 55%; font-size: 10px; }
  #toasts { bottom: 90px; }
  .hero { padding: 22px; }
  .hero h2 { font-size: 25px; }
  .cal .day { min-height: 64px; padding: 4px; }
  .cal .wd { padding: 6px 4px; font-size: 11px; text-align: center; }
  .cal .chip, .cal .more, .cal .wmarks { display: none; }
  .cal .dots { display: flex; justify-content: center; }
  .cal .dn { justify-content: center; }
  .cal .dn .wcount, .cal .dn .nosl { display: none; }
  .agenda { display: grid; gap: 12px; margin-top: 18px; }
  .grid2 { grid-template-columns: 1fr; }
  .grid2.keep { grid-template-columns: 1fr 1fr; }
  .tpl-row { grid-template-columns: 1fr 1fr; }
  .tpl-row > :first-child { grid-column: 1 / -1; }
  .modal-bg { align-items: end; padding: 0; }
  .modal { max-width: none !important; border-radius: 20px 20px 0 0; max-height: 92vh; }
  .modal-foot { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .hide-m { display: none !important; }
  .plan-side { display: none; }
  .li { padding: 12px 16px; }
}
@media (max-width: 520px) {
  .stats { gap: 10px; }
  .stat { padding: 14px; }
  .stat .val { font-size: 20px; }
  .month-nav h2 { min-width: 0; font-size: 17px; }
  .page-head .actions { width: 100%; }
  .tbl th, .tbl td { padding: 10px 10px; }
}
