/* Shared shell for the staff panel (dashboard / studio / planner). */

:root {
  color-scheme: light dark;
  --d-ink: light-dark(#14201c, #e8eeea);
  --d-muted: light-dark(#74847d, #8f9f97);
  --d-line: light-dark(#e6ece8, #2e3c36);
  --d-bg: light-dark(#f2f5f3, #101614);
  --d-card: light-dark(#ffffff, #1a221e);
  --d-green: light-dark(#1d4a35, #2f6d4f);
  --d-green-2: light-dark(#2f6d4f, #245c42);
  --d-green-fg: light-dark(#1d4a35, #9fd8b9);
  --d-mint: light-dark(#9fd8b9, #4a9a72);
  --d-mint-soft: light-dark(#e3f2e9, #1c3028);
  --d-on-green: #fff;
  --d-radius: 18px;
  --d-track-a: light-dark(#eef3ef, #24302b);
  --d-track-b: light-dark(#ffffff, #1a221e);
  --d-info-bg: light-dark(#e7effc, #1c2a44);
  --d-info-fg: light-dark(#2a5fc4, #8cb4ff);
  --d-warn-bg: light-dark(#fdf1dc, #3a2e14);
  --d-warn-fg: light-dark(#a06b09, #e8c07a);
  --d-err-bg: light-dark(#fbe7e5, #3a1c1a);
  --d-err-fg: light-dark(#b3261e, #f0a8a3);
  --d-danger: light-dark(#b3261e, #f0a8a3);
  /* Align shared styles.css tokens so .msg / links follow the panel theme. */
  --ink: var(--d-ink);
  --muted: var(--d-muted);
  --bg: var(--d-bg);
  --bg-elev: var(--d-card);
  --line: var(--d-line);
  --accent: var(--d-green-fg);
  --danger: var(--d-danger);
  --danger-soft: light-dark(rgba(179, 38, 30, 0.1), rgba(240, 168, 163, 0.12));
  --ok: var(--d-green-fg);
  --ok-soft: light-dark(rgba(27, 122, 74, 0.1), rgba(159, 216, 185, 0.12));
}
:root[data-theme="light"] {
  color-scheme: light;
}
:root[data-theme="dark"] {
  color-scheme: dark;
}

body {
  background: var(--d-bg);
  color: var(--d-ink);
}

.dash {
  --side-w: 250px;
  display: grid;
  grid-template-columns: var(--side-w) 1fr;
  min-height: 100vh;
}
.dash.side-collapsed {
  --side-w: 64px;
}
/* While dragging the resize handle: no text selection, iframes must not eat events. */
body.side-resizing {
  user-select: none;
  cursor: col-resize;
}
body.side-resizing iframe {
  pointer-events: none;
}

/* ── Sidebar ─────────────────────────────── */
.side {
  background: var(--d-card);
  border-right: 1px solid var(--d-line);
  padding: 1.4rem 0.85rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}
.side-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  min-height: 34px;
}
.side .brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--d-ink);
  text-decoration: none;
  padding: 0 0.4rem;
  white-space: nowrap;
  min-width: 0;
  overflow: hidden;
}
.side-toggle {
  flex: none;
  width: 28px;
  height: 28px;
  border: 1px solid var(--d-line);
  border-radius: 50%;
  background: var(--d-card);
  color: var(--d-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  line-height: 1;
  padding: 0;
}
.side-toggle:hover {
  background: var(--d-mint-soft);
  color: var(--d-green-fg);
}
.side-close {
  display: none;
  flex: none;
  width: 36px;
  height: 36px;
  border: 1px solid var(--d-line);
  border-radius: 50%;
  background: var(--d-card);
  color: var(--d-muted);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  line-height: 1;
  padding: 0;
}
.side-close:hover {
  background: var(--d-mint-soft);
  color: var(--d-ink);
}

.mobile-bar {
  display: none;
}
.side-backdrop {
  display: none;
}
.side-resize {
  position: absolute;
  top: 0;
  right: 0;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  z-index: 5;
}
.side-resize:hover,
body.side-resizing .side-resize {
  background: var(--d-mint);
  opacity: 0.55;
}

/* Collapsed rail: icons only, tooltips via title. Desktop only. */
@media (min-width: 1025px) {
.side-collapsed .side {
  padding: 1.4rem 0.6rem;
  align-items: center;
}
.side-collapsed .side .brand,
.side-collapsed .side .side-label,
.side-collapsed .side .side-menu a > span {
  display: none;
}
.side-collapsed .side-head {
  justify-content: center;
}
.side-collapsed .side-menu {
  width: 100%;
}
.side-collapsed .side-menu a {
  justify-content: center;
  padding: 0.6rem 0;
  border-left: 0;
  border-radius: 10px;
}
.side-collapsed .who {
  justify-content: center;
  padding: 0.2rem;
  border-radius: 12px;
}
.side-collapsed .who-meta {
  display: none;
}
.side-collapsed .side-foot {
  align-items: center;
  width: 100%;
}
.side-collapsed .theme-toggle {
  width: auto;
  justify-content: center;
  padding: 0.45rem;
  border-radius: 12px;
}
.side-collapsed .theme-toggle-label,
.side-collapsed .theme-switch {
  display: none;
}
}
.side .brand i {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2.5px solid var(--d-green-fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-style: normal;
  font-size: 0.85rem;
  color: var(--d-green-fg);
}
.side-label {
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--d-muted);
  padding: 0 0.6rem;
  margin-top: 0.55rem;
}
.side-body > .side-label:first-child {
  margin-top: 0;
}
.side-menu {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.side-menu a {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.65rem 0.75rem;
  min-height: 44px;
  border-radius: 10px;
  color: var(--d-muted);
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
  border-left: 3px solid transparent;
}
.side-menu a:hover {
  background: var(--d-mint-soft);
  color: var(--d-ink);
  text-decoration: none;
}
.side-menu a.active {
  background: var(--d-mint-soft);
  color: var(--d-green-fg);
  border-left-color: var(--d-green-fg);
  font-weight: 600;
}
.side-menu svg {
  width: 18px;
  height: 18px;
  flex: none;
}
/* ── Main / topbar ───────────────────────── */
.main {
  padding: 1.3rem 1.6rem 3rem;
  min-width: 0;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.3rem;
}
.search {
  flex: 1;
  max-width: 380px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--d-card);
  border: 1px solid var(--d-line);
  border-radius: 999px;
  padding: 0.5rem 1rem;
}
.search input {
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  width: 100%;
  color: var(--d-ink);
}
.search svg {
  width: 16px;
  height: 16px;
  color: var(--d-muted);
  flex: none;
}
.who {
  flex: none;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  background: var(--d-bg);
  border: 1px solid var(--d-line);
  border-radius: 14px;
  padding: 0.45rem 0.7rem 0.45rem 0.4rem;
  color: inherit;
  text-decoration: none;
}
.who:hover {
  background: var(--d-mint-soft);
  text-decoration: none;
  color: inherit;
}
.who .avatar {
  width: 34px;
  height: 34px;
}
.who-meta {
  min-width: 0;
  overflow: hidden;
}
.who b {
  display: block;
  font-size: 0.78rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.who-meta span {
  font-size: 0.7rem;
  color: var(--d-muted);
}

.side-foot {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 0;
}
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border: 1px solid var(--d-line);
  background: var(--d-bg);
  border-radius: 14px;
  padding: 0.4rem 0.65rem 0.4rem 0.45rem;
  color: var(--d-ink);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
}
.theme-toggle:hover {
  background: var(--d-mint-soft);
}
.theme-toggle svg {
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--d-green-fg);
}
.theme-toggle .theme-icon-sun {
  display: none;
}
.theme-toggle[aria-pressed="true"] .theme-icon-sun {
  display: block;
}
.theme-toggle[aria-pressed="true"] .theme-icon-moon {
  display: none;
}
.theme-toggle-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.theme-switch {
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: var(--d-line);
  position: relative;
  flex: none;
  transition: background 0.15s ease;
}
.theme-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--d-card);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  transition: transform 0.15s ease;
}
.theme-toggle[aria-pressed="true"] .theme-switch {
  background: var(--d-green);
}
.theme-toggle[aria-pressed="true"] .theme-switch::after {
  transform: translateX(16px);
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
  flex-wrap: wrap;
}
.page-head h1 {
  font-family: var(--font-display);
  font-size: 1.7rem;
  margin: 0;
}
.page-head p {
  margin: 0.15rem 0 0;
  color: var(--d-muted);
  font-size: 0.9rem;
}
.page-head .actions a,
.page-head .actions button {
  display: inline-block;
  border-radius: 999px;
  padding: 0.55rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  font-family: inherit;
  cursor: pointer;
}
.page-head .actions .primary {
  background: var(--d-green);
  color: var(--d-on-green);
  border: 0;
}
.page-head .actions .ghost {
  border: 1px solid var(--d-line);
  background: var(--d-card);
  color: var(--d-ink);
  margin-left: 0.5rem;
}

/* ── Cards, rows, avatars, badges ────────── */
.panel-card {
  background: var(--d-card);
  border: 1px solid var(--d-line);
  border-radius: var(--d-radius);
  padding: 1rem 1.1rem;
  min-width: 0;
}
.panel-card h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  margin: 0 0 0.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.panel-card h2 a,
.panel-card h2 button {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--d-line);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  color: var(--d-ink);
  background: var(--d-card);
  text-decoration: none;
  cursor: pointer;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
  background: var(--d-green);
}

.rows {
  display: flex;
  flex-direction: column;
}
.row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.15rem;
  border-bottom: 1px solid var(--d-line);
  min-width: 0;
}
.row:last-child {
  border-bottom: 0;
}
.row .grow {
  min-width: 0;
  flex: 1;
}
.row b {
  display: block;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row small {
  color: var(--d-muted);
  font-size: 0.74rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.pbadge {
  font-size: 0.68rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  white-space: nowrap;
  flex: none;
}
.pbadge.ok { background: var(--d-mint-soft); color: var(--d-green-fg); }
.pbadge.info { background: var(--d-info-bg); color: var(--d-info-fg); }
.pbadge.warn { background: var(--d-warn-bg); color: var(--d-warn-fg); }
.pbadge.err { background: var(--d-err-bg); color: var(--d-err-fg); }

.muted-empty {
  color: var(--d-muted);
  font-size: 0.85rem;
  padding: 0.6rem 0;
}

@media (max-width: 1024px) {
  body.nav-lock {
    overflow: hidden;
  }
  .dash,
  .dash.side-collapsed {
    display: flex;
    flex-direction: column;
    grid-template-columns: none;
    min-height: 100dvh;
    overflow-x: hidden;
  }
  .mobile-bar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    position: sticky;
    top: 0;
    z-index: 30;
    min-height: 52px;
    padding: env(safe-area-inset-top, 0px) 0.75rem 0;
    background: var(--d-card);
    border-bottom: 1px solid var(--d-line);
  }
  .mobile-bar .brand {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--d-ink);
    text-decoration: none;
    min-width: 0;
  }
  .mobile-bar .brand i {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid var(--d-green-fg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-style: normal;
    font-size: 0.75rem;
    color: var(--d-green-fg);
  }
  .mobile-page {
    margin-left: auto;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--d-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 46%;
  }
  .mobile-menu-btn {
    flex: none;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--d-ink);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
  }
  .mobile-menu-btn:hover,
  .mobile-menu-btn[aria-expanded="true"] {
    background: var(--d-mint-soft);
  }
  .mobile-menu-btn svg {
    width: 22px;
    height: 22px;
  }
  .side {
    position: fixed;
    top: 0;
    left: 0;
    width: min(320px, 88vw);
    height: 100dvh;
    z-index: 50;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    padding: 1.1rem 0.9rem max(0.9rem, env(safe-area-inset-bottom, 0px));
    padding-left: max(0.9rem, env(safe-area-inset-left, 0px));
    pointer-events: none;
    box-shadow: none;
    overflow: hidden;
  }
  .dash.nav-open .side {
    transform: translateX(0);
    pointer-events: auto;
    box-shadow: 8px 0 32px rgba(16, 22, 20, 0.28);
  }
  .side-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(10, 16, 14, 0.45);
    z-index: 40;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
  }
  .dash.nav-open .side-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
  .side-toggle,
  .side-resize {
    display: none;
  }
  .side-close {
    display: inline-flex;
  }
  .side-head {
    justify-content: space-between;
  }
  .main {
    flex: 1;
    min-width: 0;
    padding: 1rem 1rem 2.4rem;
  }
  .page-head {
    align-items: stretch;
    flex-direction: column;
    gap: 0.75rem;
  }
  .page-head h1 {
    font-size: 1.4rem;
  }
  .page-head .actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .page-head .actions .ghost {
    margin-left: 0;
  }
  .page-head .actions a,
  .page-head .actions button {
    flex: 1 1 auto;
    text-align: center;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
  }
  .search {
    display: none;
  }
}

@media (max-width: 640px) {
  .main {
    padding: 0.8rem 0.75rem 2rem;
  }
  .page-head h1 {
    font-size: 1.28rem;
  }
  .panel-card {
    padding: 0.85rem 0.85rem;
    border-radius: 14px;
  }
}
