/* ============ SlotPlan — clean, light only ============ */

:root {
  --accent-h: 155;
  --density: 1;
  --day-w: 110px;

  --bg: #ffffff;
  --bg-soft: #fafafa;
  --bg-hover: #f5f5f5;
  --bg-sunken: #f4f4f2;
  --line: #eceae5;
  --line-soft: #f3f1ec;
  --line-strong: #d8d6d1;

  --fg: #1a1a1a;
  --fg-2: #333333;
  --fg-3: #4a4a4a;
  --fg-4: #666666;

  --accent:      oklch(0.56 0.14 var(--accent-h));
  --accent-dim:  oklch(0.50 0.14 var(--accent-h));
  --accent-soft: oklch(0.94 0.04 var(--accent-h));
  --accent-bg:   oklch(0.97 0.02 var(--accent-h));

  --danger:  oklch(0.56 0.18 25);
  --warn:    oklch(0.62 0.14 75);
  --muted:   #9a9a9a;

  --radius-sm: 4px;
  --radius:    6px;
  --radius-lg: 10px;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-2: 0 4px 14px rgba(0, 0, 0, 0.06);
  --shadow-3: 0 12px 32px -10px rgba(0, 0, 0, 0.14);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans Thai', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --row-h: calc(46px * var(--density));
  --half-w: calc(var(--day-w) / 2);
  --sidebar-w: 236px;
  --rightbar-w: 380px;
  --header-h: 56px;
  --timeline-head-h: 60px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
#root {
  width: 100%;
  height: 100%;
  background: var(--bg);
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; padding: 0; }
input, textarea, select { font: inherit; color: inherit; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #e0ddd8; border-radius: 10px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #cfcdc8; background-clip: content-box; }

.mono { font-family: var(--font-mono); }
.num  { font-variant-numeric: tabular-nums; }

/* ============ App shell ============ */
.app {
  display: grid;
  grid-template-rows: var(--header-h) 1fr;
  height: 100vh; width: 100vw;
  overflow: hidden;
}

/* Top header */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: relative; z-index: 20;
}
.topbar .brand {
  display: flex; align-items: center; gap: 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--fg);
  height: 100%;
}
.topbar .brand-mark {
  width: 26px; height: 26px;
  border-radius: 7px;
  background: var(--accent);
  display: grid; place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
}
.topbar .crumbs {
  display: flex; align-items: center; gap: 10px;
  color: var(--fg-3);
  font-size: 13px;
  padding-left: 6px;
}
.topbar .crumbs .sep { color: var(--fg-4); }
.topbar .crumbs .current { color: var(--fg); font-weight: 500; }
.topbar .search {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-soft);
  border: 1px solid transparent;
  padding: 7px 11px;
  border-radius: var(--radius);
  width: 300px;
  color: var(--fg-3);
  transition: border-color .12s, background .12s;
}
.topbar .search:hover { background: var(--bg-hover); }
.topbar .search:focus-within {
  border-color: var(--accent);
  background: var(--bg);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 14%, transparent);
}
.topbar .search input {
  border: 0; background: transparent; outline: none; flex: 1;
  font-size: 13px;
  color: var(--fg);
}
.topbar .search input::placeholder { color: var(--fg-3); }
.topbar .search kbd {
  font-family: var(--font-mono);
  font-size: 10.5px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--fg-3);
}
.topbar .iconbtn {
  width: 34px; height: 34px;
  border-radius: var(--radius);
  display: grid; place-items: center;
  color: var(--fg-2);
  transition: background .12s, color .12s;
  position: relative;
}
.topbar .iconbtn:hover { background: var(--bg-hover); color: var(--fg); }
.topbar .iconbtn .dot {
  position: absolute; top: 8px; right: 8px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--bg);
}
.topbar .user {
  display: flex; align-items: center; gap: 9px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  cursor: pointer;
}
.topbar .user:hover { background: var(--bg-hover); }
.topbar .user .label { font-size: 13px; color: var(--fg); font-weight: 500; line-height: 1.1; }
.topbar .user .role  { font-size: 13px; color: var(--fg-3); line-height: 1.2; }
.topbar .user .role.mgr { color: var(--accent); font-weight: 500; }

/* Avatars */
.avatar {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 10.5px; font-weight: 600;
  color: #fff;
  flex: none;
  letter-spacing: -0.02em;
}
.avatar.sm { width: 20px; height: 20px; font-size: 11px; }
.avatar.md { width: 30px; height: 30px; font-size: 13px; }
.avatar.lg { width: 40px; height: 40px; font-size: 14px; }
.avatar-badge-wrap {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: inherit;
}
.avatar-link-badges {
  position: absolute;
  right: -4px;
  bottom: -3px;
  display: inline-flex;
  align-items: center;
  gap: 1px;
  z-index: 2;
  pointer-events: auto;
}
.avatar-link-badge {
  width: 11px;
  height: 11px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  border: 1.5px solid var(--bg);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.22);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 7px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
}
.avatar-link-badge.line { background: #06c755; }
.avatar-link-badge.discord { background: #5865f2; }
.avatar.sm .avatar-link-badge {
  width: 9px;
  height: 9px;
  border-width: 1px;
  font-size: 6px;
}
.avatar.sm .avatar-link-badges {
  right: -4px;
  bottom: -3px;
}

.app-body {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100%;
  min-height: 0; overflow: hidden;
}
.app-body.no-sidebar {
  grid-template-columns: 1fr;
}
.app-body.with-right {
  grid-template-columns: var(--sidebar-w) 1fr var(--rightbar-w);
}
.app-body.no-sidebar.with-right {
  grid-template-columns: 1fr var(--rightbar-w);
}

/* ============ Sidebar ============ */
.sidebar {
  background: var(--bg);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  min-height: 0; overflow: hidden;
}
.sidebar-section { display: flex; flex-direction: column; min-height: 0; padding-top: 18px; }
.sidebar-section.grow { flex: 1; min-height: 0; overflow: hidden; }
.sidebar-section + .sidebar-section { border-top: 1px solid var(--line-soft); }
.sidebar-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px 8px;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-3);
  font-weight: 600;
  flex: none;
}
.sidebar-head .count {
  font-size: 13px;
  color: var(--fg-3);
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}
.sidebar-head .add {
  color: var(--fg-3);
  width: 22px; height: 22px;
  border-radius: 5px;
  display: grid; place-items: center;
}
.sidebar-head .add:hover { background: var(--bg-hover); color: var(--fg); }

.sidebar-list {
  padding: 0 8px 14px;
  overflow-y: auto;
  min-height: 0;
}
.pill {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--fg);
  position: relative;
  user-select: none;
}
.pill:hover { background: var(--bg-hover); }
.pill.active { background: var(--accent-bg); }
.pill.active .name { color: var(--accent); font-weight: 500; }
.pill .swatch {
  width: 9px; height: 9px; border-radius: 50%; flex: none;
}
.pill .name { flex: 1; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill .meta { font-size: 13px; color: var(--fg-3); }
.pill .role-tag {
  font-size: 12px;
  color: var(--fg-3);
  font-weight: 500;
}
.pill.me .role-tag { color: var(--accent); font-weight: 600; }
