/* Blog-aligned workspace appearance and existing responsive navigation layout. */
:root {
  --mist-frame: #f5f5f7;
  --mist-surface: #ffffff;
  --mist-border: transparent;
  --mist-shadow: 0 1px 3px rgb(0 0 0 / .025), 0 5px 18px rgb(0 0 0 / .035);
  --bg-page: #f5f5f7;
  --bg-card: #ffffff;
  --bg-card-solid: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-raised: rgba(0, 0, 0, .03);
  --bg-hover: rgba(0, 0, 0, .04);
  --text-primary: #1d1d1f;
  --text-secondary: #424245;
  --text-muted: #78787e;
  --hairline: rgba(0, 0, 0, .06);
  --hairline-strong: rgba(0, 0, 0, .10);
  --accent-blue: var(--accent);
  --shadow-card: var(--mist-shadow);
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Helvetica Neue", sans-serif;
}
html[data-palette="blue"] { --accent: #0071e3; --accent-soft: rgba(0, 113, 227, .10); }
html[data-theme="dark"] {
  --mist-frame: #0a0a0c;
  --mist-surface: #131316;
  --mist-border: transparent;
  --mist-shadow: 0 1px 3px rgb(0 0 0 / .10), 0 5px 18px rgb(0 0 0 / .12);
  --bg-page: #0a0a0c;
  --bg-card: #131316;
  --bg-card-solid: #16161a;
  --bg-sidebar: #131316;
  --bg-raised: rgba(255, 255, 255, .042);
  --bg-hover: rgba(255, 255, 255, .06);
  --text-primary: #f5f5f7;
  --text-secondary: #d2d2d7;
  --text-muted: #a0a0a7;
  --hairline: rgba(255, 255, 255, .06);
  --hairline-strong: rgba(255, 255, 255, .12);
}

body { background: var(--bg-page); }
.admin-layout {
  max-width: 1580px;
  width: calc(100% - 48px);
  margin: 24px auto;
  min-height: calc(100dvh - 48px);
  flex-direction: column;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--bg-page);
  box-shadow: none;
}
.fixed-sidebar {
  position: relative; inset: auto;
  width: 100%; height: auto; overflow: visible;
  display: grid; grid-template-columns: auto minmax(0, 1fr) 220px;
  align-items: center; gap: 12px 20px;
  padding: 14px 18px;
  border: 1px solid var(--mist-border);
  border-radius: 22px;
  background: var(--mist-surface);
  box-shadow: var(--mist-shadow);
  z-index: 40;
}
.sider-head { padding: 0; border: 0; gap: 10px; }
.brand-name { font-size: 16px; letter-spacing: -.5px; }
.brand-sub { font-size: 10px; color: var(--text-muted); }
.app-icon { border-radius: 13px; background: var(--bg-raised); color: var(--accent); box-shadow: none; }
.sidebar-search-wrap { grid-column: 3; grid-row: 1; margin: 0; background: var(--bg-card); border: 1px solid var(--mist-border); height: 34px; border-radius: 13px; }
.sidebar-nav { grid-column: 2; grid-row: 1; display: flex; flex-direction: row; justify-content: center; gap: 6px; overflow: visible; padding: 0; scrollbar-gutter: auto; }
.sider-scene-block, .sider-scene-block:first-child { margin: 0; padding: 0; border: 0; min-width: 0; }
.sider-scene-label { font-size: 9px; letter-spacing: .5px; padding: 0 12px 3px; color: var(--text-muted); }
.menu-group { position: relative; }
.sidebar-nav .menu-parent { min-height: 34px; height: auto; gap: 8px; padding: 7px 12px; border-radius: 23px; font-size: 12px; white-space: nowrap; }
.menu-item-main { gap: 8px; }
.sidebar-nav .menu-item, .sidebar-nav .menu-subitem, .sidebar-bottom-pinned .menu-item { color: var(--text-secondary); }
.sidebar-nav .menu-parent.has-active-route { background: var(--accent-soft); color: var(--accent); }
.menu-item-main svg { color: inherit; }
.sidebar-nav .menu-submenu, .sidebar-nav .menu-group.is-expanded > .menu-submenu {
  display: none; position: absolute; top: 100%; left: 0; width: 250px;
  max-height: min(65dvh, 560px); overflow-y: auto;
  margin: 0; padding: 10px; border: 1px solid var(--mist-border);
  border-radius: 17px; background: var(--bg-card-solid);
  box-shadow: var(--shadow-card); z-index: 45;
}
.sidebar-nav .menu-group.is-expanded.is-menu-open > .menu-submenu { display: flex; }
.sidebar-nav .menu-subitem { border-radius: 10px; justify-content: flex-start; min-height: 36px; height: auto; padding: 8px 12px; flex-shrink: 0; }
.sidebar-nav .menu-subitem.is-active { background: var(--accent-soft); color: var(--accent); }
.sidebar-bottom-pinned { grid-column: 1/-1; display: flex; align-items: center; gap: 14px; background: none; padding: 9px 0 0; border-top: 1px solid var(--hairline); }
.sider-pinned-links { display: flex; gap: 8px; padding: 0; }
.sider-pinned-links .menu-item { width: auto; background: var(--bg-card); border-radius: 12px; padding: 7px 11px; font-size: 11px; }
.sider-bot-wrap { margin-left: auto; padding: 0; max-width: 260px; }
.bot-pill { padding: 6px 10px; background: var(--bg-card); border-color: var(--mist-border); }
.sidebar-footer { border: 0; padding: 0; gap: 14px; }
.sidebar-account-name { font-size: 12px; }
.sidebar-role-pill { font-size: 9px; }
.icon-circle-btn { background: var(--bg-card); border-color: var(--mist-border); }
.main-stage, body.is-sider-collapsed .main-stage { margin-left: 0; width: 100%; }
.main-topbar { position: relative; top: auto; z-index: 20; background: none; border: 0; padding: 20px 10px; }
.stage-body { width: 100%; padding: 0; }
.view-panel { gap: 16px; }
.surface, html[data-theme] .surface, html[data-theme] .section-card, html[data-theme] .kpi-card, html[data-theme] .quick-card, html[data-theme] .comment-card, html[data-theme] .invite-card {
  background: var(--mist-surface); border: 1px solid var(--mist-border); box-shadow: var(--mist-shadow); border-radius: 24px;
}
.surface.section-card { padding: 20px; border-radius: 24px; }
.kpi-card { padding: 19px 22px; }
.kpi-value { font-weight: 500; font-size: 29px; }
.kpi-label { color: var(--text-secondary); }
.kpi-sub { color: var(--text-muted); }
.bot-hero { padding: 18px 22px; }
.bot-bubble { background: var(--accent-soft); color: var(--accent); }
.btn, .icon-circle-btn, .sider-collapse-btn { border-radius: 12px; border-color: var(--mist-border); background: var(--bg-card); }
.btn-primary, .btn-primary:hover { background: var(--accent); color: #fff; border-color: transparent; box-shadow: none; }
.btn-ghost { background: var(--bg-card); }
.seg-control { border: 1px solid var(--mist-border); background: var(--bg-raised); border-radius: 20px; }
.seg-btn { border-radius: 16px; }
.seg-btn.is-active, [data-chart-mode][aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); box-shadow: none; }
.input, html[data-theme] .input, .select, .textarea { border-radius: 12px; }
html[data-theme] .card-block, html[data-theme] .live-preview-shell { background: var(--bg-card); border: 1px solid var(--mist-border); border-radius: 16px; }
.data-table td { padding: 13px 12px; }
.data-table th { color: var(--text-muted); }
.data-table tbody tr:hover { background: var(--bg-hover); }
.chart-bars { height: 180px; }
.c-bar { border-radius: 8px 8px 0 0; background: var(--accent); border: 1px solid var(--mist-border); }
.engine-card { border-color: var(--mist-border); background: var(--bg-card); border-radius: 16px; box-shadow: none; }
.studio-zen-shell { height: calc(100dvh - 238px); min-height: 600px; }
.la-top, .la-status { background: var(--bg-card); }
.la-canvas-scroll { background: var(--bg-card); }
.studio-drawer { border-color: var(--mist-border); background: var(--bg-card-solid); box-shadow: 0 8px 30px #253a5714; }
.apple-setting-drawer { background: var(--bg-card-solid); border-color: var(--mist-border); border-radius: 22px; overflow-y: auto; }
.login-shell { background: var(--bg-page); }
.login-card { background: var(--mist-surface); border-radius: 27px; border-color: var(--mist-border); }
body.is-sider-collapsed .fixed-sidebar { width: 100%; padding: 14px 18px; }
body.is-sider-collapsed .sidebar-nav { display: none; }
body.is-sider-collapsed .sider-head > div:last-child, body.is-sider-collapsed .sidebar-search-wrap, body.is-sider-collapsed .menu-item-main > span, body.is-sider-collapsed .bot-status-txt, body.is-sider-collapsed .bot-tag, body.is-sider-collapsed .sidebar-account-info { display: block !important; }
body.is-sider-collapsed .sider-head { padding: 0; }
body.is-sider-collapsed .sider-pinned-links { display: flex; padding: 0; }
body.is-sider-collapsed .sidebar-footer-actions { flex-direction: row; }
body.is-sider-collapsed .sidebar-footer { padding: 0; }
@media (max-width: 1250px) {
  .admin-layout { margin: 14px; width: calc(100% - 28px); }
  .fixed-sidebar { grid-template-columns: auto 1fr; gap: 12px; }
  .sidebar-search-wrap { grid-column: 2; justify-self: end; width: 220px; }
  .sidebar-nav { grid-column: 1/-1; grid-row: 2; justify-content: flex-start; }
  .sidebar-bottom-pinned { flex-wrap: wrap; }
}
@media (max-width: 900px) {
  .admin-layout { margin: 8px; width: calc(100% - 16px); padding: 9px; border-radius: 24px; }
  .fixed-sidebar, body.is-sider-collapsed .fixed-sidebar { position: fixed; top: 8px; bottom: 8px; left: 8px; width: min(330px, calc(100vw - 24px)); height: auto; display: flex; flex-direction: column; align-items: stretch; padding: 16px; overflow: hidden; transform: translateX(calc(-100% - 12px)); }
  .fixed-sidebar.is-open { transform: translateX(0); }
  .sidebar-nav { display: block; flex: 1; min-height: 0; overflow-y: auto; }
  body.is-sider-collapsed .sidebar-nav { display: block; }
  .sidebar-search-wrap { width: 100%; }
  .sider-scene-block { margin-top: 14px; }
  .sider-scene-label, body.is-sider-collapsed .sider-scene-label { display: block !important; }
  .sidebar-nav .menu-submenu, .sidebar-nav .menu-group.is-expanded > .menu-submenu, body.is-sider-collapsed .menu-group.is-expanded > .menu-submenu { display: none !important; position: static; width: 100%; max-height: none; box-shadow: none; margin-top: 4px; }
  .sidebar-nav .menu-group.is-expanded.is-menu-open > .menu-submenu, body.is-sider-collapsed .menu-group.is-expanded.is-menu-open > .menu-submenu { display: flex !important; }
  .sidebar-nav .menu-subitem, body.is-sider-collapsed .menu-subitem { white-space: normal; text-align: left; font-size: 12px; padding: 9px 12px; }
  .sidebar-nav .menu-item-main > span { display: block !important; }
  .sidebar-bottom-pinned { flex: 0 0 auto; flex-wrap: wrap; gap: 10px; }
  .sider-bot-wrap { margin-left: 0; }
  .sidebar-footer { margin-left: auto; }
  .sidebar-footer .sidebar-account-info { display: none !important; }
  .main-topbar { padding: 10px 2px 17px; }
  .studio-zen-shell { height: calc(100dvh - 180px); }
}
@media (max-width: 640px) {
  .surface.section-card { padding: 16px; border-radius: 20px; }
  .topbar-right { gap: 5px; }
  .main-topbar { gap: 10px; }
  .breadcrumb { font-size: 12px; }
  .bot-hero { flex-wrap: wrap; padding: 16px; }
  .la-top { height: auto; min-height: 50px; padding: 10px; }
  .studio-zen-shell { min-height: 580px; }
}

@media (min-width: 901px) {
  .sidebar-nav.is-searching { grid-column: 1/-1; grid-row: 2; align-items: flex-start; justify-content: stretch; }
  .sidebar-nav.is-searching .sider-scene-block { flex: 1; }
  .sidebar-nav.is-searching .menu-submenu { position: static; width: 100%; box-shadow: none; max-height: 40dvh; }
  body.is-sider-collapsed .sidebar-nav.is-searching { display: flex; }
}
/* Header status and account controls share a compact alignment rhythm. */
.sidebar-bottom-pinned .sider-bot-wrap {
  flex: 0 1 238px;
  min-width: 0;
}
.sidebar-bottom-pinned .bot-pill {
  height: 40px;
  padding: 6px 10px;
  gap: 10px;
  border-radius: 13px;
  background: var(--bg-card);
}
.sidebar-bottom-pinned .bot-pill-left { gap: 8px; overflow: hidden; }
.sidebar-bottom-pinned .bot-pill-left svg { flex-shrink: 0; }
.sidebar-bottom-pinned .bot-status-txt { font-size: 11px; }
.sidebar-bottom-pinned .bot-tag { font-size: 9px; padding: 2px 6px; letter-spacing: .3px; }
.sidebar-bottom-pinned .sidebar-footer {
  justify-content: flex-start;
  gap: 14px;
  min-width: 0;
  padding: 0 0 0 14px;
  border-left: 1px solid var(--hairline-strong);
}
.sidebar-bottom-pinned .sidebar-account-info { gap: 2px; max-width: 150px; }
.sidebar-bottom-pinned .sidebar-account-name { font-size: 12px; line-height: 18px; font-weight: 600; }
.sidebar-bottom-pinned .sidebar-role-pill {
  border: 0;
  background: transparent;
  padding: 0;
  gap: 4px;
  font-size: 9px;
  line-height: 16px;
  color: var(--text-muted);
}
.sidebar-bottom-pinned .sidebar-footer-actions { gap: 6px; }
.sidebar-bottom-pinned .icon-circle-btn {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: inline-grid;
  place-items: center;
  color: var(--text-secondary);
}
.sidebar-bottom-pinned .icon-circle-btn:hover { color: var(--accent); background: var(--bg-hover); }
@media (max-width: 900px) {
  .sidebar-bottom-pinned .sider-bot-wrap { flex: 1 1 175px; }
  .sidebar-bottom-pinned .sidebar-footer { padding-left: 10px; gap: 0; flex: 0 0 auto; }
  .sidebar-bottom-pinned .bot-tag { display: none !important; }
}

/* Reuse the existing profile form inside an accessible native modal. */
.profile-modal {
  width: min(880px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  margin: auto;
  padding: 18px;
  border: 1px solid var(--mist-border);
  border-radius: 26px;
  background: var(--bg-card-solid);
  color: var(--text-primary);
  box-shadow: 0 2px 6px rgb(0 0 0 / .05), 0 16px 45px rgb(0 0 0 / .12);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.profile-modal::backdrop { background: rgb(0 0 0 / .25); backdrop-filter: blur(6px); }
.profile-modal-toolbar { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.profile-modal #adminPersonalForm { margin: 0; box-shadow: none; }
.profile-modal .bento-split { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
.profile-modal .preview-sticky { position: static; }
body:has(.profile-modal[open]) { overflow: hidden; }
@media (max-width: 700px) {
  .profile-modal { padding: 10px; max-height: calc(100dvh - 24px); }
  .profile-modal .bento-split { grid-template-columns: minmax(0, 1fr); }
}

/* Neutral nested surfaces and pill controls echo the public blog. */
.fixed-sidebar { border-radius: 22px; }
.app-icon { background: var(--accent-soft); color: var(--accent); }
.sidebar-search-wrap, .sider-pinned-links .menu-item,
.sidebar-bottom-pinned .bot-pill, .sidebar-bottom-pinned .icon-circle-btn {
  background: var(--bg-raised);
  border-color: transparent;
}
.sider-pinned-links .menu-item, .sidebar-nav .menu-parent { border-radius: 99px; }
.sidebar-nav .menu-subitem:hover { background: var(--bg-hover); }
.topbar-right .btn { border-radius: 99px; }
.surface.section-card, .surface, html[data-theme] .surface { border-radius: 22px; }
html[data-theme] .card-block, html[data-theme] .live-preview-shell { background: var(--bg-raised); }
.btn-ghost { background: var(--bg-raised); }
.profile-modal { border-radius: 22px; }
.profile-modal #adminPersonalForm { background: transparent; }
.profile-modal .profile-modal-toolbar .btn { background: var(--bg-raised); }
html[data-theme="dark"] .sidebar-nav .menu-parent.has-active-route { background: var(--accent-soft); color: var(--accent); }
/* Restore the fixed left navigation while retaining the blog appearance. */
.admin-layout { display: flex; flex-direction: row; width: 100%; max-width: none; margin: 0; min-height: 100dvh; padding: 0; }
.fixed-sidebar, body.is-sider-collapsed .fixed-sidebar {
  position: fixed; top: 0; bottom: 0; left: 0;
  width: 260px; height: 100dvh;
  display: flex; flex-direction: column; align-items: stretch;
  gap: 16px; padding: 20px 12px 14px;
  overflow: hidden; border: 0; border-right: 1px solid var(--hairline);
  border-radius: 0; background: var(--bg-sidebar); box-shadow: none;
}
.sider-head { flex-shrink: 0; padding: 0 8px; }
.sidebar-search-wrap { width: 100%; flex-shrink: 0; }
.sidebar-nav, .sidebar-nav.is-searching, body.is-sider-collapsed .sidebar-nav, body.is-sider-collapsed .sidebar-nav.is-searching {
  display: block; flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden;
  padding: 0 2px; scrollbar-gutter: stable;
}
.sider-scene-block, .sider-scene-block:first-child { margin: 0 0 15px; padding: 0 0 15px; border: 0; border-bottom: 1px solid var(--hairline); }
.sider-scene-block:last-child { border-bottom: 0; }
.sidebar-nav .menu-parent { width: 100%; padding: 10px; border-radius: 12px; }
.sidebar-nav .menu-submenu, .sidebar-nav.is-searching .menu-submenu,
.sidebar-nav .menu-group.is-expanded > .menu-submenu,
body.is-sider-collapsed .menu-group.is-expanded > .menu-submenu {
  display: none !important; position: static; width: auto; max-height: none;
  margin: 4px 0 0 13px; padding: 3px 0 0 8px;
  border: 0; border-radius: 0; box-shadow: none; background: transparent; overflow: visible;
}
.sidebar-nav .menu-group.is-expanded.is-menu-open > .menu-submenu,
body.is-sider-collapsed .menu-group.is-expanded.is-menu-open > .menu-submenu { display: flex !important; }
.sidebar-nav .menu-subitem { font-size: 12px; padding: 9px 10px; white-space: normal; }
.sidebar-bottom-pinned { display: flex; flex-direction: column; align-items: stretch; flex: 0 0 auto; gap: 12px; padding-top: 12px; }
.sider-pinned-links, body.is-sider-collapsed .sider-pinned-links { display: flex; padding: 0; gap: 6px; }
.sider-pinned-links .menu-item { flex: 1; justify-content: center; }
.sidebar-bottom-pinned .sider-bot-wrap { flex: none; margin: 0; max-width: none; }
.sidebar-bottom-pinned .sidebar-footer { flex: none; border: 0; border-top: 1px solid var(--hairline); padding: 12px 0 0; margin: 0; justify-content: space-between; gap: 8px; }
.sidebar-bottom-pinned .sidebar-account-info { display: flex !important; }
.main-stage { margin-left: 260px; width: calc(100% - 260px); padding: 0 24px 24px; }
.main-topbar { padding: 20px 0; }
.studio-zen-shell { height: calc(100dvh - 100px); }
body.is-sider-collapsed .fixed-sidebar { width: 88px; padding-inline: 7px; }
body.is-sider-collapsed .main-stage { margin-left: 88px; width: calc(100% - 88px); }
body.is-sider-collapsed .sider-head > div:last-child,
body.is-sider-collapsed .sidebar-search-wrap,
body.is-sider-collapsed .menu-item-main > span,
body.is-sider-collapsed .bot-status-txt,
body.is-sider-collapsed .bot-tag,
body.is-sider-collapsed .sidebar-footer .sidebar-account-info { display: none !important; }
body.is-sider-collapsed .sider-head { padding: 0; justify-content: center; }
body.is-sider-collapsed .sidebar-nav .menu-parent { justify-content: center; }
body.is-sider-collapsed .sidebar-nav .menu-submenu { margin-left: 0; padding-left: 0; }
body.is-sider-collapsed .sidebar-nav .menu-subitem { font-size: 10px; text-align: center; padding: 8px 2px; }
body.is-sider-collapsed .sider-pinned-links { flex-direction: column; }
body.is-sider-collapsed .sidebar-bottom-pinned .sidebar-footer { justify-content: center; }
body.is-sider-collapsed .sidebar-footer-actions { flex-direction: column; }
@media (max-width: 900px) {
  .main-stage, body.is-sider-collapsed .main-stage { margin-left: 0; width: 100%; padding: 0 12px 16px; }
  .fixed-sidebar, body.is-sider-collapsed .fixed-sidebar { width: min(300px, calc(100vw - 30px)); transform: translateX(-101%); }
  .fixed-sidebar.is-open { transform: translateX(0); }
  body.is-sider-collapsed .sidebar-search-wrap,
  body.is-sider-collapsed .menu-item-main > span,
  body.is-sider-collapsed .sider-head > div:last-child { display: block !important; }
  body.is-sider-collapsed .sidebar-nav .menu-subitem { font-size: 12px; text-align: left; padding: 9px 10px; }
  body.is-sider-collapsed .sider-pinned-links, body.is-sider-collapsed .sidebar-footer-actions { flex-direction: row; }
  .main-topbar { padding: 14px 0; }
}
@media (min-width: 901px) {
  body.is-sider-collapsed .sidebar-nav .menu-group.is-expanded.is-menu-open > .menu-submenu { display: none !important; }
  body.is-sider-collapsed .menu-right,
  body.is-sider-collapsed .menu-chevron,
  body.is-sider-collapsed .menu-count { display: none !important; }
  body.is-sider-collapsed .sidebar-nav .menu-parent { min-height: 42px; }
  body.is-sider-collapsed .sidebar-nav .menu-item-main { justify-content: center; }
}
