:root {
  color-scheme: light;
  --bg: #EFF0F3;
  --sidebar-bg: #FFFFFF;
  --surface: #FFFFFF;
  --surface-hover: #F8F9FA;
  --border: #EAECF0;
  --border-subtle: #F0F2F5;
  --fg: #111827;
  --muted: #6B7280;
  --faint: #9CA3AF;
  --accent: #111827;
  --accent-hover: #1F2937;
  --accent-fg: #FFFFFF;
  --accent-soft: #F1F3F5;
  --accent-border: #E5E7EB;
  --accent-glow: 0 2px 8px rgba(17, 24, 39, 0.12);
  --ok: #16A34A;
  --ok-soft: #E6F4EA;
  --warn: #D97706;
  --warn-soft: #FEF3C7;
  --bad: #DC2626;
  --bad-soft: #FCE8E6;
  --radius: 18px;
  --radius-sm: 10px;
  --radius-btn: 12px;
  --sidebar-w: 17rem;
  --sidebar-w-collapsed: 4.5rem;
  --topbar-h: 4.25rem;
  --font: "Plus Jakarta Sans", "Noto Sans KR", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
  --shadow-lg: 0 10px 30px -4px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.45;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input { font: inherit; color: inherit; }
button {
  border: 0;
  outline: none;
  box-shadow: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
button:focus, button:focus-visible {
  outline: none !important;
}
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-fill, .icon-fill path { fill: currentColor; stroke: none; }

.skip-link {
  position: absolute;
  left: .75rem;
  top: -4rem;
  z-index: 50;
  padding: .5rem .85rem;
  background: var(--accent);
  color: #FFFFFF;
  border-radius: 9999px;
  font-size: .8rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: var(--accent-glow);
  transition: top .15s ease;
}
.skip-link:focus { top: .75rem; }

/* Login screen */
.login-screen {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: var(--bg);
}
.login-card {
  width: min(26rem, 100%);
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 2.25rem 2rem 2rem;
  box-shadow: 0 20px 45px -12px rgba(0,0,0,0.06);
}
.login-brand { padding: 0 0 1.25rem; }
.login-card h1 {
  margin: 0 0 .4rem;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--fg);
}
.login-card p { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.5; }
.login-actions { display: grid; gap: .65rem; margin-top: 1.5rem; }
.login-actions .btn {
  min-height: 2.75rem;
  width: 100%;
  background: #111827;
  color: #FFFFFF !important;
  border-radius: 9999px;
  border: 1px solid #111827;
  font-weight: 700;
  box-shadow: none;
  transition: all .15s ease;
}
.login-actions .btn:hover {
  background: #1F2937 !important;
  color: #FFFFFF !important;
  border-color: #1F2937 !important;
  filter: none !important;
  transform: translateY(-1px);
}
.login-error {
  margin-top: .85rem;
  padding: .65rem .85rem;
  border-radius: 12px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  background: var(--bad-soft);
  color: #B91C1C;
  font-size: .85rem;
  font-weight: 550;
}

/* App Shell */
.shell[hidden] { display: none !important; }
body:not(.is-authed) .shell { display: none !important; }
body.is-authed .shell { display: grid; }
body.is-login .shell,
html.is-login .shell { display: none !important; }
body.is-login .login-screen,
html.is-login .login-screen { display: grid; }

.shell {
  min-height: 100%;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  background: var(--bg);
  transition: grid-template-columns 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.shell.is-sidebar-collapsed {
  grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr);
}

/* Sidebar - Shakuro Light Theme */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 1.15rem 1rem 1rem;
  z-index: 20;
  color: #4B5563;
  overflow-x: hidden;
  transition: padding 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}
.window-controls {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: .15rem .35rem .85rem;
}
.window-dot {
  width: 11px;
  height: 11px;
  border-radius: 9999px;
  display: inline-block;
}
.window-dot.dot-red { background: #FF5F56; border: 1px solid rgba(0,0,0,0.1); }
.window-dot.dot-yellow { background: #FFBD2E; border: 1px solid rgba(0,0,0,0.1); }
.window-dot.dot-green { background: #27C93F; border: 1px solid rgba(0,0,0,0.1); }

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .2rem .25rem .85rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  min-width: 0;
}

.sidebar-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.sidebar-toggle-btn:hover {
  background: #F3F4F6;
  color: var(--fg);
  border-color: var(--border);
}

.sidebar-toggle-btn svg {
  width: .95rem;
  height: .95rem;
  stroke: currentColor;
  stroke-width: 2;
}

.sidebar-toggle-btn .icon-collapse { display: block; }
.sidebar-toggle-btn .icon-expand { display: none; }
.brand-mark {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #111827;
  color: #FFFFFF;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: -.04em;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-row { display: flex; align-items: center; gap: .3rem; }
.brand-text strong { font-size: .92rem; font-weight: 800; color: var(--fg); letter-spacing: -.02em; }
.chevron-mini { width: .75rem; height: .75rem; stroke: var(--muted); stroke-width: 2; flex-shrink: 0; }
.brand-text span { color: var(--muted); font-size: .7rem; font-weight: 550; }

/* Quick Navigation */
.quick-nav {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  padding: .2rem 0 .65rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: .55rem;
}
.quick-link {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .38rem .65rem;
  border-radius: 10px;
  color: #4B5563;
  font-size: .78rem;
  font-weight: 600;
  text-decoration: none;
  transition: all .15s ease;
}
.quick-link svg { width: .78rem; height: .78rem; stroke: #6B7280; stroke-width: 1.6; flex-shrink: 0; }
.quick-link:hover { background: #F3F4F6; color: #111827; text-decoration: none; }

/* Nav Sections & Tree Items */
.side-nav { flex: 1; overflow-y: auto; padding: 0 .1rem; }
.side-nav::-webkit-scrollbar { width: 4px; }
.side-nav::-webkit-scrollbar-thumb { background: #E5E7EB; border-radius: 9999px; }

.nav-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .4rem .55rem .25rem;
  margin-top: .35rem;
}
.nav-label {
  margin: 0;
  color: #9CA3AF;
  font-size: .65rem;
  font-weight: 750;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.nav-add-btn {
  display: grid;
  place-items: center;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 6px;
  color: #9CA3AF;
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s ease;
  line-height: 1;
}
.nav-add-btn:hover { background: #E5E7EB; color: #111827; }

.nav-tree-group {
  border-left: 1.5px solid #E5E7EB;
  margin: .15rem 0 .65rem 1.05rem;
  padding-left: .5rem;
  display: flex;
  flex-direction: column;
  gap: .2rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .45rem .75rem;
  border-radius: 10px;
  color: #4B5563;
  text-decoration: none;
  font-size: .82rem;
  font-weight: 600;
  border: 1px solid transparent;
  transition: all .15s ease;
}
.nav-link svg {
  width: .85rem;
  height: .85rem;
  flex: 0 0 auto;
  stroke: #6B7280;
  stroke-width: 1.7;
  transition: stroke .15s ease, transform .15s ease;
}
.nav-link-text { flex: 1; min-width: 0; }
.nav-link:hover { background: #F4F5F7; color: #111827; text-decoration: none; }
.nav-link.is-active {
  background: #F1F3F5 !important;
  color: #111827 !important;
  font-weight: 700;
  border-color: transparent;
  box-shadow: none;
}
.nav-link.is-active svg { stroke: #111827 !important; }

.nav-badge {
  margin-left: auto;
  font-size: .65rem;
  font-weight: 700;
  border-radius: 6px;
  padding: .1rem .45rem;
}
.nav-badge.badge-rose {
  background: #E8F0FE;
  color: #1A73E8;
  border: 1px solid #D2E3FC;
}
.nav-badge.badge-muted { background: #F3F4F6; color: #4B5563; }
.nav-link.is-active .nav-badge {
  background: #E5E7EB;
  color: #111827;
}
.nav-link.is-active .nav-badge.badge-rose {
  background: #E8F0FE !important;
  color: #1A73E8 !important;
  border-color: #D2E3FC !important;
}

.sidebar-foot {
  padding: .75rem .35rem 0;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: .55rem;
}
.mini-status {
  display: flex;
  align-items: center;
  gap: .45rem;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 600;
}
.sidebar-settings-link {
  display: flex;
  align-items: center;
  gap: .45rem;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 600;
  cursor: pointer;
  transition: color .15s ease;
}
.sidebar-settings-link svg { width: .8rem; height: .8rem; stroke: currentColor; stroke-width: 1.6; }
.sidebar-settings-link:hover { color: var(--fg); }

/* Minimized / Collapsed Sidebar Styles */
.shell.is-sidebar-collapsed .sidebar {
  padding: 1rem .45rem;
  align-items: center;
}

.shell.is-sidebar-collapsed .window-controls {
  display: none;
}

.shell.is-sidebar-collapsed .sidebar-head {
  flex-direction: column;
  align-items: center;
  gap: .55rem;
  padding: 0 0 .65rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: .55rem;
  width: 100%;
}

.shell.is-sidebar-collapsed .brand {
  padding: 0;
  justify-content: center;
}

.shell.is-sidebar-collapsed .brand-mark {
  cursor: pointer;
}

.shell.is-sidebar-collapsed .brand-text {
  display: none;
}

.shell.is-sidebar-collapsed .sidebar-toggle-btn {
  background: #F3F4F6;
  color: var(--fg);
  border-color: var(--border);
  width: 2.25rem;
  height: 2.25rem;
}

.shell.is-sidebar-collapsed .sidebar-toggle-btn:hover {
  background: #E5E7EB;
  color: #111827;
}

.shell.is-sidebar-collapsed .sidebar-toggle-btn .icon-collapse {
  display: none;
}

.shell.is-sidebar-collapsed .sidebar-toggle-btn .icon-expand {
  display: block;
}

.shell.is-sidebar-collapsed .quick-nav {
  display: none;
}

.shell.is-sidebar-collapsed .nav-section-head {
  display: none;
}

.shell.is-sidebar-collapsed .nav-tree-group {
  border-left: none;
  margin: .25rem 0;
  padding-left: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.shell.is-sidebar-collapsed .nav-link {
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  justify-content: center;
  border-radius: 10px;
  margin: 0 auto .25rem auto;
}

.shell.is-sidebar-collapsed .nav-link svg {
  width: 1.15rem;
  height: 1.15rem;
}

.shell.is-sidebar-collapsed .nav-link-text {
  display: none;
}

.shell.is-sidebar-collapsed .nav-badge {
  display: none;
}

.shell.is-sidebar-collapsed .sidebar-foot {
  padding: .65rem 0 0;
  align-items: center;
  width: 100%;
}

.shell.is-sidebar-collapsed .mini-status {
  justify-content: center;
  padding: .25rem 0;
}

.shell.is-sidebar-collapsed .mini-status span:not(.dot) {
  display: none;
}

.shell.is-sidebar-collapsed .sidebar-settings-link {
  justify-content: center;
  padding: .4rem;
  border-radius: 8px;
}

.shell.is-sidebar-collapsed .sidebar-settings-link span {
  display: none;
}

.shell.is-sidebar-collapsed .sidebar-settings-link svg {
  width: 1.15rem;
  height: 1.15rem;
}

.shell.is-sidebar-collapsed main {
  padding: 1.25rem 1.25rem 2.5rem;
}

/* Stage & Topbar */
.stage { min-width: 0; display: flex; flex-direction: column; background: var(--bg); }
.topbar {
  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding: .75rem 2rem;
  border-bottom: 1px solid var(--border);
  background: #FFFFFF;
  position: sticky;
  top: 0;
  z-index: 10;
}

/* Search Pill */
.top-search-pill {
  display: flex;
  align-items: center;
  gap: .65rem;
  background: #F9FAFB;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .42rem .85rem;
  width: min(22rem, 100%);
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
  transition: all .15s ease;
}
.top-search-pill:focus-within {
  background: #FFFFFF;
  border-color: #111827;
  box-shadow: 0 0 0 2px rgba(17, 24, 39, 0.08);
}
.top-search-pill .search-icon { width: 1rem; height: 1rem; stroke: #9CA3AF; flex-shrink: 0; }
.top-search-pill input {
  border: none;
  background: transparent;
  outline: none;
  font-size: .82rem;
  color: var(--fg);
  width: 100%;
}
.search-hint {
  font-size: .68rem;
  font-weight: 700;
  color: #9CA3AF;
  background: #F3F4F6;
  border: 1px solid #E5E7EB;
  border-radius: 6px;
  padding: .1rem .4rem;
}

/* Collaboration Pills */
.top-collab-group {
  display: flex;
  align-items: center;
  gap: .45rem;
}
.collab-add-btn {
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 8px;
  border: 1px dashed var(--border);
  background: #FFFFFF;
  color: var(--muted);
  font-size: .95rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all .15s ease;
}
.collab-add-btn:hover { border-color: #111827; color: #111827; }
.collab-pill {
  display: flex;
  align-items: center;
  gap: .4rem;
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .2rem .65rem .2rem .25rem;
  font-size: .78rem;
  font-weight: 650;
  color: var(--fg);
}
.collab-avatar {
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 6px;
  background: #F3F4F6;
  color: #111827;
  font-size: .68rem;
  font-weight: 800;
  display: grid;
  place-items: center;
}
.collab-pill.brand-c {
  background: #F3F4F6;
  color: #374151;
  border-color: #E5E7EB;
  padding: .25rem .65rem;
  font-weight: 800;
}
.live-status-pill {
  display: flex;
  align-items: center;
  gap: .4rem;
  background: #EDF7ED;
  color: #2E7D32;
  border: 1px solid #C8E6C9;
  border-radius: 8px;
  padding: .2rem .65rem;
  font-size: .72rem;
  font-weight: 750;
  letter-spacing: .02em;
}
.live-dot {
  width: .45rem;
  height: .45rem;
  border-radius: 9999px;
  background: #2E7D32;
  animation: live-pulse 1.8s infinite;
}
@keyframes live-pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(46, 125, 50, 0.6); }
  70% { transform: scale(1); box-shadow: 0 0 0 5px rgba(46, 125, 50, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(46, 125, 50, 0); }
}

.top-actions { display: flex; align-items: center; gap: .65rem; }
.icon-btn {
  display: none;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  color: var(--fg);
  padding: 0;
  place-items: center;
}
.icon-btn svg { width: 1.15rem; height: 1.15rem; }
.icon-btn:hover { background: var(--surface-hover); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.25rem;
  padding: 0 1.1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #FFFFFF;
  color: var(--fg);
  cursor: pointer;
  text-decoration: none;
  font-size: .84rem;
  font-weight: 600;
  box-shadow: none;
  transition: all .15s ease;
}
.btn:hover { background: #F9FAFB; text-decoration: none; border-color: #D1D5DB; }
.btn-primary {
  background: #111827 !important;
  color: #FFFFFF !important;
  border-color: #111827 !important;
  font-weight: 700;
  box-shadow: none;
}
.btn-primary:hover {
  background: #1F2937 !important;
  border-color: #1F2937 !important;
  color: #FFFFFF !important;
}
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn-ghost:hover { background: rgba(0,0,0,0.04); }

.user-chip {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .25rem .75rem .25rem .35rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #FFFFFF;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
  max-width: 16rem;
}
.avatar {
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #F3F4F6;
  color: #111827;
  font-size: .75rem;
  font-weight: 800;
}
.user-meta { min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.user-meta strong {
  font-size: .8rem;
  font-weight: 700;
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-meta small { color: var(--muted); font-size: .68rem; font-weight: 550; }

/* Main Stage Canvas */
main { padding: 1.5rem 2rem 2.5rem; }
.view { display: grid; gap: 1.5rem; }
[hidden] { display: none !important; }

/* Overview Page Floating Card Layout */
#view-overview {
  display: grid;
  gap: 1.5rem;
}

.overview-hero {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.6rem 2rem;
  box-shadow: var(--shadow);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.hero-eyebrow {
  font-size: .72rem;
  font-weight: 750;
  color: #6B7280;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin: 0 0 .35rem;
}
.hero-title {
  font-size: 1.95rem;
  font-weight: 850;
  color: var(--fg);
  letter-spacing: -.035em;
  margin: 0 0 .75rem;
}
.hero-metric-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}
.hero-stat {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--fg);
  letter-spacing: -.02em;
}
.hero-trend {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  background: #E6F4EA;
  color: #137333;
  border: 1px solid #CEEAD6;
  border-radius: 6px;
  padding: .2rem .65rem;
  font-size: .78rem;
  font-weight: 750;
}
.hero-trend svg { width: .85rem; height: .85rem; stroke: currentColor; stroke-width: 2.5; }
.hero-tag {
  background: #F3F4F6;
  color: #4B5563;
  border-radius: 6px;
  padding: .2rem .65rem;
  font-size: .78rem;
  font-weight: 600;
}

/* KPI Cards Section */
.kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
}
.card {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem 1.5rem;
  box-shadow: var(--shadow);
}
.kpi {
  min-height: 8.5rem;
  display: flex;
  flex-direction: column;
  transition: all .2s ease;
  border-radius: 18px;
}
.kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.kpi-label { margin: 0; color: var(--muted); font-size: .8rem; font-weight: 650; }
.kpi-badge {
  font-size: .68rem;
  font-weight: 700;
  background: #E8F0FE;
  color: #1A73E8;
  border: 1px solid #D2E3FC;
  border-radius: 6px;
  padding: .12rem .55rem;
}
.kpi-badge.gold {
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #FDE68A;
}
.kpi-value {
  margin: .65rem 0 auto;
  display: flex;
  align-items: center;
  gap: .55rem;
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--fg);
}
.kpi-hint { margin: 0; color: var(--muted); font-size: .78rem; font-weight: 550; }

.kpi.is-ok { background: #FFFFFF; }
.kpi.is-warn { background: #FFFFFF; }
.kpi.is-bad { background: #FFFFFF; }

.dot {
  width: .55rem;
  height: .55rem;
  border-radius: 9999px;
  background: var(--faint);
  box-shadow: 0 0 0 3px rgba(156, 163, 175, 0.16);
  flex: 0 0 auto;
}
.dot.ok { background: #16A34A; box-shadow: 0 0 0 3px #E6F4EA; }
.dot.warn { background: #D97706; box-shadow: 0 0 0 3px #FEF3C7; }
.dot.bad { background: #DC2626; box-shadow: 0 0 0 3px #FCE8E6; }

/* Panel & Platform Grid */
.panel { display: grid; gap: .95rem; }
.panel-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: .25rem;
}
.panel-title-wrap h2 { margin: 0 0 .2rem; font-size: 1.15rem; font-weight: 800; color: var(--fg); letter-spacing: -.02em; }
.panel-title-wrap p { margin: 0; color: var(--muted); font-size: .82rem; }
.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .35rem .85rem;
  font-size: .78rem;
  font-weight: 650;
  color: #4B5563;
  cursor: pointer;
}
.filter-pill svg { width: .85rem; height: .85rem; stroke: currentColor; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: 1rem;
}
.plugin-card {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.35rem;
  display: flex;
  flex-direction: column;
  gap: .85rem;
  transition: all .2s ease;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
}
.plugin-card:hover {
  background: #FFFFFF;
  border-color: #CBD5E1;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px -4px rgba(0, 0, 0, 0.05);
  text-decoration: none;
}
.plugin-card.is-featured {
  border-color: #E5E7EB;
  background: #FFFFFF;
}
.plugin-card-header {
  display: flex;
  align-items: center;
  gap: .85rem;
}
.plugin-card-icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 12px;
  background: #F3F4F6;
  display: grid;
  place-items: center;
  color: var(--fg);
  flex-shrink: 0;
}
.plugin-card-icon.is-rose {
  background: #F1F3F5;
  color: #111827;
  border: 1px solid #E5E7EB;
}
.plugin-card-icon svg { width: 1.35rem; height: 1.35rem; stroke: currentColor; stroke-width: 2; }
.plugin-card-titles { flex: 1; min-width: 0; }
.plugin-card-titles h3 { margin: 0 0 .15rem; font-size: 1.05rem; font-weight: 750; color: var(--fg); }
.plugin-card-titles p { margin: 0; color: var(--muted); font-size: .78rem; word-break: break-all; }
.plugin-card-arrow {
  color: #9CA3AF;
  font-size: 1.15rem;
  font-weight: 700;
  transition: transform .15s ease, color .15s ease;
}
.plugin-card:hover .plugin-card-arrow {
  transform: translateX(3px);
  color: var(--fg);
}
.plugin-card .row { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: auto; }
.tag {
  font-size: .68rem;
  font-weight: 700;
  color: #4B5563;
  background: #F3F4F6;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .15rem .5rem;
}
.tag-rose {
  background: #E8F0FE;
  color: #1A73E8;
  border-color: #D2E3FC;
  font-weight: 700;
}
.tag-dark {
  background: #F3F4F6;
  color: #374151;
  border-color: #E5E7EB;
  font-weight: 700;
}
}
.tag-dark {
  background: #F3F4F6;
  color: #374151;
  border-color: #E5E7EB;
  font-weight: 700;
}
.tag-accent {
  background: #EEF2FF;
  color: #4F46E5;
  border-color: #E0E7FF;
  font-weight: 700;
}
.empty {
  border: 1px dashed var(--border);
  color: var(--muted);
  padding: 1.5rem;
  border-radius: var(--radius);
  text-align: center;
}

/* Split Section (Session & Probes) */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
.split .card {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.meta-list {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: .65rem .75rem;
  margin: 1rem 0 0;
}
.meta-list dt { color: var(--muted); font-size: .85rem; font-weight: 550; }
.meta-list dd { margin: 0; font-size: .88rem; font-weight: 700; color: var(--fg); word-break: break-all; }

.probe-list { display: grid; gap: .75rem; margin-top: 1rem; }
.probe {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  align-items: center;
  padding: .85rem 1.15rem;
  background: #FFFFFF;
  border: 1px solid #ECEEF2;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}
.probe-left { display: flex; align-items: center; gap: .75rem; }
.probe-icon-dot {
  width: .65rem;
  height: .65rem;
  border-radius: 9999px;
  background: var(--faint);
  flex-shrink: 0;
}
.probe-icon-dot.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.probe-icon-dot.bad { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.probe strong { font-size: .9rem; font-weight: 700; color: var(--fg); display: block; }
.probe small { color: var(--muted); display: block; font-size: .75rem; }
.probe-status-pill {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  border-radius: 9999px;
  padding: .25rem .75rem;
  font-size: .78rem;
  font-weight: 700;
}
.probe-status-pill.ok { background: rgba(16, 185, 129, 0.12); color: #059669; }
.probe-status-pill.bad { background: rgba(239, 68, 68, 0.12); color: #DC2626; }

.code {
  margin: 1rem 0 0;
  padding: 1rem 1.15rem;
  background: #F8F9FA;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: auto;
  font-family: var(--mono);
  font-size: .82rem;
  color: #1F2937;
  white-space: pre-wrap;
  word-break: break-word;
}

.backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: oklch(0.1 0.02 260 / 0.55);
  z-index: 15;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* VOCAT Embedded View Integration */
#view-vocat {
  display: block;
}
#view-vocat[hidden] {
  display: none !important;
}
#vocat-root {
  min-height: calc(100vh - var(--topbar-h) - 3.5rem);
}
#view-forbidden[hidden] {
  display: none !important;
}

/* Logout Overlay & Spinner */
body.is-logout {
  overflow: hidden;
  user-select: none;
}

.logout-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 1.5rem;
}

.logout-overlay[hidden] {
  display: none !important;
}

.logout-dialog {
  background: var(--surface, #FFFFFF);
  color: var(--fg, #111827);
  border: 1px solid var(--border, #EAECF0);
  border-radius: var(--radius, 18px);
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.15);
  padding: 2.5rem 2rem;
  max-width: 22rem;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: logout-fade-in 0.2s ease-out;
}

@keyframes logout-fade-in {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.logout-spin {
  width: 2.25rem;
  height: 2.25rem;
  margin: 0 auto 1.25rem auto;
  border: 3px solid rgba(17, 24, 39, 0.12);
  border-top-color: var(--accent, #111827);
  border-radius: 50%;
  animation: logout-spin 0.8s linear infinite;
  box-sizing: border-box;
  will-change: transform;
}

@keyframes logout-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.logout-dialog h1 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--fg, #111827);
  line-height: 1.3;
}

.logout-dialog p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted, #6B7280);
  line-height: 1.45;
}

.logout-fallback {
  margin-top: 1.25rem !important;
  font-size: 0.85rem !important;
}

.logout-fallback a {
  color: var(--muted, #6B7280);
  text-decoration: underline;
}

.logout-fallback a:hover {
  color: var(--fg, #111827);
}

/* Responsive */
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0;
    transform: translateX(-105%);
    width: min(18rem, 86vw);
    transition: transform .18s ease;
  }
  .sidebar.is-open { transform: none; }
  .sidebar-toggle-btn { display: none !important; }
  .icon-btn { display: grid; }
  .backdrop { display: block; }
  .top-search-pill { display: none; }
  .top-collab-group { display: none; }
  .kpis, .split { grid-template-columns: 1fr; }
  main { padding: 1rem .9rem 2rem; }
  .overview-hero { padding: 1.25rem; border-radius: 20px; }
  .user-chip { max-width: 42vw; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
