/* ---------- Tokens ---------- */
:root{
  --bg: oklch(97.5% 0.006 80);
  --surface: oklch(99% 0.004 80);
  --surface-2: oklch(95% 0.008 80);
  --line: oklch(89% 0.008 80);
  --line-2: oklch(82% 0.01 80);
  --ink: oklch(20% 0.012 60);
  --ink-2: oklch(38% 0.012 60);
  --ink-3: oklch(58% 0.012 60);
  --accent: oklch(48% 0.14 268);
  --accent-ink: oklch(96% 0.02 268);
  --accent-soft: oklch(94% 0.04 268);
  --accent-line: oklch(82% 0.07 268);
  --warn: oklch(58% 0.16 35);
  --warn-soft: oklch(94% 0.04 35);
  --ok: oklch(52% 0.13 155);
  --ok-soft: oklch(94% 0.04 155);
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 0 oklch(0% 0 0 / 0.04), 0 1px 2px oklch(0% 0 0 / 0.04);
  --shadow-md: 0 4px 10px -2px oklch(0% 0 0 / 0.06), 0 2px 4px -2px oklch(0% 0 0 / 0.05);
  --shadow-lg: 0 22px 40px -16px oklch(0% 0 0 / 0.18), 0 8px 16px -8px oklch(0% 0 0 / 0.08);
}

*{ box-sizing: border-box; }
html, body{ margin:0; padding:0; height:100%; }
body{
  font-family: 'Manrope', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button{ font: inherit; color: inherit; }
input, select, textarea{ font: inherit; color: inherit; }
.mono{ font-family: 'JetBrains Mono', ui-monospace, monospace; }
.serif{ font-family: 'Fraunces', serif; font-optical-sizing: auto; }

/* ---------- Layout ---------- */
.app{
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

/* ---------- Top bar ---------- */
.topbar{
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.brand{
  display: flex; align-items: center; gap: 10px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.brand-mark{
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--surface);
  display: grid; place-items: center;
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 16px;
  position: relative;
  overflow: hidden;
}
.brand-mark::after{
  content:""; position:absolute; inset:auto -10% -50% auto;
  width: 80%; height: 80%;
  background: var(--accent);
  border-radius: 50%;
  opacity: 0.85;
}
.brand-mark span{ position:relative; z-index:1; }
.brand-name{ font-size: 15px; }
.brand-sub{ font-size: 11px; color: var(--ink-3); font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; }

.tabs{
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  padding: 4px;
  border-radius: 10px;
}
.tab{
  border: 0;
  background: transparent;
  padding: 7px 14px;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--ink-2);
  border-radius: 7px;
  cursor: pointer;
  display:flex; align-items:center; gap:8px;
}
.tab.is-active{
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.tab .pill{
  font-size: 11px;
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 99px;
  font-weight: 600;
  color: var(--ink-2);
}
.tab.is-active .pill{ background: var(--accent-soft); color: var(--accent); }

.user-chip{
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 6px 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  cursor: pointer;
}
.user-chip:hover{ background: var(--surface-2); }

.conn-pill{
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px 5px 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-2);
  cursor: pointer;
}
.conn-pill:hover{ background: var(--surface-2); }
.conn-dot{ width:7px; height:7px; border-radius:50%; background: var(--ink-3); }
.conn-dot.on{ background: var(--ok); box-shadow: 0 0 0 3px oklch(52% 0.13 155 / 0.18); }
.conn-pill + .menu-wrap{ margin-left: 0; }
.avatar{
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 700; font-size: 12px;
}
.avatar.lg{ width: 40px; height: 40px; font-size: 14px; }
.user-chip .name{ font-weight: 600; font-size: 13px; }
.user-chip .role{ font-size: 11px; color: var(--ink-3); }

/* ---------- Page ---------- */
.page{
  padding: 24px;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
}
.page-head{
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.page-title{
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 32px;
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1.05;
}
.page-sub{
  color: var(--ink-3);
  font-size: 13.5px;
  margin-top: 6px;
}
.head-actions{ display:flex; gap: 10px; align-items:center; }

/* ---------- Buttons ---------- */
.btn{
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  color: var(--ink);
  white-space: nowrap;
}
.btn:hover{ background: var(--surface-2); }
.btn.primary{
  background: var(--ink);
  color: var(--surface);
  border-color: var(--ink);
}
.btn.primary:hover{ background: oklch(28% 0.012 60); }
.btn.accent{
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.btn.accent:hover{ filter: brightness(1.07); }
.btn.ghost{ border-color: transparent; background: transparent; }
.btn.ghost:hover{ background: var(--surface-2); }
.btn.danger{ color: var(--warn); }
.btn.danger:hover{ background: var(--warn-soft); }
.btn.sm{ padding: 5px 10px; font-size: 12.5px; }
.btn.icon{ padding: 7px; }

/* ---------- Card / list ---------- */
.card{
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.card-head{
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.card-title{ font-weight: 700; font-size: 14px; letter-spacing: -0.005em; }
.card-body{ padding: 18px; }

/* Filters row */
.filters{
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.search{
  display: flex; align-items: center; gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 12px;
  min-width: 220px;
  flex: 1;
  max-width: 360px;
}
.search input{
  border: 0; outline: 0; background: transparent;
  width: 100%; font-size: 13.5px;
}
.search svg{ color: var(--ink-3); flex: 0 0 auto; }

.chip-group{ display:flex; gap: 6px; flex-wrap: wrap; }
.chip{
  font-size: 12.5px;
  padding: 6px 10px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
}
.chip.is-active{
  background: var(--ink);
  color: var(--surface);
  border-color: var(--ink);
}
.chip.subtle{ background: var(--surface-2); border-color: transparent; color: var(--ink-2); cursor: default; }

/* ---------- Meeting rows ---------- */
.day-group{ margin-top: 22px; }
.day-group:first-child{ margin-top: 0; }
.day-header{
  display: flex; align-items: baseline; gap: 12px;
  margin-bottom: 10px;
  padding: 0 4px;
}
.day-label{
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.01em;
}
.day-date{ color: var(--ink-3); font-size: 13px; }
.day-count{ margin-left: auto; color: var(--ink-3); font-size: 12.5px; font-weight: 600; }

.row{
  display: grid;
  grid-template-columns: 88px 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  margin-bottom: 8px;
  transition: border-color .15s ease, transform .15s ease;
}
.row:hover{ border-color: var(--line-2); }
.row.is-live{ border-color: var(--ok); background: linear-gradient(0deg, var(--ok-soft), transparent 60%), var(--surface); }
.row.is-past{ opacity: 0.65; }

.skipped-banner{
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: oklch(95% 0.02 60);
  border: 1px solid oklch(85% 0.04 60);
  border-radius: var(--radius);
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.skipped-banner .skipped-label{
  font-size: 12px;
  font-weight: 700;
  color: oklch(40% 0.09 60);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.skipped-chip{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 4px 4px 4px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
}
.skipped-chip .restore{
  border: 0;
  background: var(--surface-2);
  width: 20px; height: 20px;
  border-radius: 50%;
  display:grid; place-items:center;
  cursor: pointer;
  color: var(--ink-2);
}
.skipped-chip .restore:hover{ background: var(--accent-soft); color: var(--accent); }

.time{
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13px;
  line-height: 1.3;
}
.time .start{ font-weight: 600; color: var(--ink); font-size: 14px; }
.time .end{ color: var(--ink-3); font-size: 12px; }
.time .dot{ display: inline-block; width: 4px; height: 4px; border-radius: 50%; background: var(--ink-3); margin: 0 6px; vertical-align: middle; }

.row-main .title{
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.005em;
  display: flex; align-items: center; gap: 8px;
}
.row-main .meta{
  display: flex; gap: 10px; flex-wrap: wrap;
  color: var(--ink-3); font-size: 12.5px; margin-top: 4px;
  align-items: center;
}
.row-main .meta .sep{ width: 3px; height: 3px; border-radius: 50%; background: var(--line-2); }
.row-main .link{
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent);
  font-size: 12px;
  text-decoration: none;
  font-weight: 500;
}
.row-actions{ display:flex; gap: 6px; align-items:center; }

.tag{
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--surface-2);
  color: var(--ink-2);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.tag.weekly{ background: var(--accent-soft); color: var(--accent); }
.tag.once{ background: oklch(94% 0.04 60); color: oklch(40% 0.09 60); }
.tag.live{ background: var(--ok); color: var(--surface); }
.tag.live::before{ content:""; display:inline-block; width:6px; height:6px; border-radius:50%; background: var(--surface); margin-right: 5px; animation: pulse 1.4s infinite; vertical-align: middle; }
@keyframes pulse{ 0%,100%{opacity:1;} 50%{opacity:0.4;} }
.tag.warn{ background: var(--warn-soft); color: var(--warn); }
.tag.ok{ background: var(--ok-soft); color: var(--ok); }

/* ---------- Empty ---------- */
.empty{
  text-align: center;
  padding: 64px 24px;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.empty h3{ font-family: 'Fraunces', serif; font-weight: 500; margin: 0 0 6px; font-size: 22px; letter-spacing: -0.01em; }
.empty p{ color: var(--ink-3); margin: 0 0 16px; }

/* ---------- Modal ---------- */
.modal-backdrop{
  position: fixed; inset: 0;
  background: oklch(20% 0.012 60 / 0.45);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  animation: fade .15s ease;
}
@keyframes fade{ from{opacity:0;} to{opacity:1;} }
.modal{
  background: var(--surface);
  border-radius: 16px;
  border: 1px solid var(--line);
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: pop .2s cubic-bezier(.2,.9,.3,1.2);
  max-height: calc(100vh - 48px);
  display:flex; flex-direction:column;
}
@keyframes pop{ from{transform: translateY(8px) scale(0.98); opacity:0;} to{transform:none; opacity:1;} }
.modal-head{
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title{ font-family: 'Fraunces', serif; font-size: 22px; font-weight: 500; letter-spacing: -0.01em; }
.modal-body{ padding: 20px; overflow:auto; }
.modal-foot{
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end; gap: 8px;
  background: var(--surface-2);
}

/* ---------- Form ---------- */
.field{
  display: block;
  margin-bottom: 14px;
}
.field-label{
  display: block;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--ink-2);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}
.field-hint{ font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.input, .select, .textarea{
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus, .select:focus, .textarea:focus{
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.textarea{ resize: vertical; min-height: 80px; }
.row-2{ display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-3{ display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

.seg{
  display: inline-flex;
  background: var(--surface-2);
  padding: 3px;
  border-radius: 8px;
}
.seg button{
  border: 0;
  background: transparent;
  padding: 6px 12px;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--ink-2);
  border-radius: 6px;
  cursor: pointer;
}
.seg button.is-active{
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.day-picker{ display: flex; gap: 6px; }
.day-pill{
  width: 36px; height: 36px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  font-weight: 600; font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
  display:grid; place-items:center;
}
.day-pill.is-on{
  background: var(--ink); color: var(--surface); border-color: var(--ink);
}

.checkbox-list{
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  max-height: 180px;
  overflow: auto;
  padding: 4px;
}
.checkbox-row{
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  cursor: pointer;
  font-size: 13px;
}
.checkbox-row input{ accent-color: var(--accent); }
.checkbox-row.is-on{ border-color: var(--accent); background: var(--accent-soft); }

/* ---------- Login ---------- */
.auth{
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  background: var(--bg);
}
.auth-side{
  background: var(--ink);
  color: var(--surface);
  padding: 40px 44px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.auth-side .brand{ color: var(--surface); }
.auth-side .brand-mark{ background: var(--surface); color: var(--ink); }
.auth-headline{
  font-family: 'Fraunces', serif;
  font-weight: 400;
  font-size: 46px;
  line-height: 1.05;
  letter-spacing: -0.02em;
  max-width: 460px;
  margin: 0;
}
.auth-headline em{ color: oklch(82% 0.07 268); font-style: italic; font-weight: 400; }
.auth-side .deco{
  position: absolute; inset: auto -60px -120px auto;
  width: 360px; height: 360px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, oklch(58% 0.16 268), oklch(30% 0.08 268));
  opacity: 0.55;
  filter: blur(2px);
}
.auth-footer{ color: oklch(75% 0.012 60); font-size: 12.5px; }
.auth-main{
  display: grid; place-items: center;
  padding: 40px;
}
.auth-card{
  width: 100%;
  max-width: 380px;
}
.auth-card h2{
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 28px;
  margin: 0 0 4px;
  letter-spacing: -0.015em;
}
.auth-card p.sub{ color: var(--ink-3); margin: 0 0 28px; }
.role-hint{
  margin-top: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.role-hint .title{ font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); margin-bottom: 8px; }
.role-hint .row{
  display: grid; grid-template-columns: 70px 1fr; gap: 8px; padding: 4px 0;
  font-size: 12.5px;
  border: 0;
  margin: 0;
  background: transparent;
}
.role-hint .tag-mini{ font-weight: 700; }
.role-hint .em{ font-family: 'JetBrains Mono', monospace; font-size: 12px; cursor: pointer; color: var(--accent); }

@media (max-width: 820px){
  .auth{ grid-template-columns: 1fr; }
  .auth-side{ display: none; }
}

/* ---------- Admin layout ---------- */
.admin-grid{
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 20px;
}
@media (max-width: 980px){ .admin-grid{ grid-template-columns: 1fr; } }

.list-row{
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.list-row:last-child{ border-bottom: 0; }
.list-row .name{ font-weight: 600; font-size: 13.5px; }
.list-row .email{ font-size: 12px; color: var(--ink-3); font-family: 'JetBrains Mono', monospace; }
.list-row .courses{ display:flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.list-row .ck{ font-size: 11px; padding: 1px 7px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); font-weight: 600; }

.stat-grid{ display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
@media(max-width: 700px){ .stat-grid{ grid-template-columns: repeat(2, 1fr); } }
.stat{
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.stat .k{ color: var(--ink-3); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.stat .v{ font-family: 'Fraunces', serif; font-size: 32px; font-weight: 500; margin-top: 4px; letter-spacing: -0.02em; }
.stat .d{ color: var(--ink-3); font-size: 12px; margin-top: 2px; }

/* ---------- Toast ---------- */
.toast-wrap{
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px;
  z-index: 200;
  pointer-events: none;
}
.toast{
  background: var(--ink);
  color: var(--surface);
  padding: 10px 16px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toast-in .25s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes toast-in{ from{transform: translateY(20px); opacity:0;} to{transform:none; opacity:1;} }

/* ---------- Menu ---------- */
.menu-wrap{ position: relative; }
.menu{
  position: absolute; right: 0; top: calc(100% + 6px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  padding: 6px;
  z-index: 50;
}
.menu button{
  width: 100%; text-align: left;
  display: flex; align-items: center; gap: 8px;
  border: 0; background: transparent;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--ink);
}
.menu button:hover{ background: var(--surface-2); }
.menu button.danger{ color: var(--warn); }
.menu hr{ border:0; border-top: 1px solid var(--line); margin: 4px 0; }

/* ---------- Misc ---------- */
.divider{ height:1px; background: var(--line); margin: 14px 0; }
a{ color: var(--accent); }
.spacer{ flex: 1; }

.scroll-thin::-webkit-scrollbar{ width: 8px; height: 8px; }
.scroll-thin::-webkit-scrollbar-thumb{ background: var(--line-2); border-radius: 99px; }
