/* Geometry, surfaces and type match the ERP project workspace (surface-theme.css). */
.workspace-shell {
  --sidebar-size: 260px;
  --nav-surface: #202a4b;
  --nav-text: #c4cbe2;
  display: grid;
  grid-template-columns: var(--sidebar-size) minmax(0, 1fr);
  align-items: start;
  min-height: 100dvh;
  padding-left: 18px;
}
.workspace-shell.is-compact { --sidebar-size: 72px; }
.workspace-column { min-width: 0; }

.sidebar {
  position: sticky;
  top: 18px;
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 36px);
  min-width: 0;
  margin: 18px 0;
  color: var(--nav-text);
  background: var(--nav-surface);
  border-radius: var(--radius);
  box-shadow: 0 16px 36px -22px rgb(22 30 62 / 55%);
}
.sidebar button, .sidebar a { color: inherit; font-family: inherit; }
.sidebar :focus-visible { outline: 2px solid #aaa7ff; outline-offset: 2px; }
.sidebar-brand {
  position: relative;
  display: flex;
  flex: none;
  align-items: center;
  height: 100px;
  padding: 16px 54px 16px 20px;
}
.sidebar-identity {
  min-width: 0;
  max-width: 100%;
  color: #fff;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -.02em;
}
.client-name {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
}
.client-short, .client-logo { display: none; }
.sidebar-identity.has-logo {
  display: grid;
  grid-template: minmax(0,1fr) / minmax(0,1fr);
  place-items: center;
  width: 180px;
  height: 52px;
  padding: 7px 9px;
  background: #fff;
  border-radius: 8px;
}
.has-logo .client-name, .has-logo .client-short { display: none; }
.has-logo .client-logo { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.sidebar-toggle {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  width: 100%;
  padding: 0 22px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
}
.sidebar-toggle:focus-visible { outline-offset: -4px; }
.toggle-indicator {
  display: grid;
  flex: none;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #303b5c;
}
.toggle-indicator .icon { transform: rotate(180deg); }
.sidebar-nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 7px;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #4c5778 transparent;
  padding: 16px 12px;
}
.sidebar-nav [hidden], .nav-scrim[hidden] { display: none; }
.nav-item {
  position: relative;
  isolation: isolate;
  display: flex;
  flex: none;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 12px 16px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-decoration: none;
  text-align: left;
  font-size: .95rem;
  font-weight: 400;
  line-height: 20px;
}
.sidebar .nav-item:hover { color: #fff; transform: none; }
.sidebar .nav-item:focus-visible { outline: 2px solid #a7a5ff; outline-offset: -2px; }
.sidebar .nav-item.selected {
  background: #615de2;
  color: #fff;
  box-shadow: 0 7px 16px -9px rgb(12 14 42 / 55%);
}
.sidebar .nav-item.selection-moving { background: transparent; box-shadow: none; transition: none; }
.nav-pill {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: #615de2;
  pointer-events: none;
}
.selection-moving .nav-pill { box-shadow: 0 7px 16px -9px rgb(12 14 42 / 55%); }
.sw-sidebar-flyout {
  position: fixed;
  z-index: 90;
  display: flex;
  align-items: center;
  width: max-content;
  box-sizing: border-box;
  margin: 0;
  padding: 0 18px 0 0;
  border: 0;
  border-radius: var(--sw-flyout-radius);
  color: #fff;
  background: #303b62;
  box-shadow: 0 6px 16px rgb(20 28 57 / 18%);
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}
.sw-sidebar-flyout.is-active { background: #615de2; }
.sw-sidebar-flyout.is-keyboard { outline: 2px solid #a7a5ff; outline-offset: 2px; }
.sw-sidebar-flyout-icon { display: grid; place-items: center; flex: 0 0 var(--sw-flyout-anchor); }
.sw-sidebar-flyout-icon svg { width: 20px; height: 20px; }
.sw-sidebar-flyout-label { overflow: hidden; text-overflow: ellipsis; }
@keyframes sw-sidebar-reveal {
  from { clip-path: inset(0 calc(100% - var(--sw-flyout-anchor)) 0 0 round var(--sw-flyout-radius)); }
  to { clip-path: inset(0 0 0 0 round var(--sw-flyout-radius)); }
}
.nav-text, .top-title { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.nav-group, .nav-group-items { display: flex; flex: none; flex-direction: column; gap: 7px; }
.nav-group { margin-top: 12px; }
.nav-group-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 24px;
  border: 0;
  padding: 3px 16px;
  color: #b0bbd6;
  background: transparent;
  border-radius: 6px;
  font-size: .72rem;
  font-weight: 600;
  text-align: left;
}
.sidebar .nav-group-toggle:hover { color: var(--nav-text); background: #ffffff0a; }
.sidebar .nav-group-toggle:focus-visible { outline: 2px solid #aaa3ff; outline-offset: -2px; }
.nav-group-toggle[aria-expanded="true"] .icon { transform: rotate(90deg); }
.sidebar-foot {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 51px;
  margin: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--nav-text);
  background: #18213d;
  font-size: .78rem;
  white-space: nowrap;
}
.sidebar-foot img { display: block; height: auto; filter: brightness(0) invert(1); }
.sidebar-foot .logo-full { width: 108px; max-width: 100%; }
.sidebar-foot .logo-symbol { display: none; width: 27px; }
.sidebar-nav-end { flex:none; border-top:1px solid #ffffff25; padding:7px 12px 12px; }
.sidebar-nav-end .nav-item { width:100%; }
.sidebar:has(.sidebar-nav-end) .sidebar-foot { margin-bottom:5px; }
.is-compact .sidebar-nav-end { padding-inline:8px; }
.preview-status { display: inline-flex; align-items: center; gap: 5px; font-size: .7rem; }
.is-compact .sidebar-brand { justify-content: center; padding-inline: 8px; }
.is-compact .sidebar-identity.has-logo { width: 46px; height: 46px; padding: 3px; }
.is-compact .sidebar-identity:not(.has-logo) .client-short { display: inline; font-size: 17px; }
.is-compact .client-name, .is-compact .logo-full, .is-compact .nav-text, .is-compact .preview-status { display: none; }
.is-compact .sidebar-foot .logo-symbol { display: block; }
.is-compact .toggle-indicator { display: none; }
.is-compact .sidebar-nav { padding-inline: 8px; }
.is-compact .nav-item, .is-compact .sidebar-foot { justify-content: center; padding-inline: 0; }
.is-compact .nav-group { margin: 0; }
.is-compact .nav-group::before { content: ''; display: block; border-top: 1px solid #ffffff25; margin: 14px 10px 7px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 82px;
  padding: 0 28px;
  background: var(--surface);
  border: 0;
  box-shadow: none;
}
.top-left, .header-tools, .header-clock { display: flex; align-items: center; }
.top-left { gap: 10px; min-width: 0; }
.top-title { color: var(--ink); font-size: 20px; font-weight: 600; letter-spacing: -.5px; }
.header-tools { flex: none; gap: 14px; }
.header-clock {
  gap: 8px;
  height: 36px;
  padding: 3px 12px;
  border: 1px solid #e0e6ef;
  border-radius: 12px;
  background: #f1f5f9;
  font-size: .82rem;
  min-width: 130px;
  justify-content: center;
  color: var(--second);
  font-variant-numeric: tabular-nums;
}
.header-clock .icon { color: var(--accent); }
.mobile-button, .nav-scrim { display: none; }

.main { padding: 4px 28px 32px; }
.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 150px;
  margin-bottom: 20px;
  padding: 24px;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--card-shadow);
}
.page-heading > div { min-width: 0; }
.page-heading h1 { font-size: 24px; line-height: 1.35; letter-spacing: -.7px; overflow-wrap: anywhere; }
.page-heading > .btn { flex: none; }
.kicker { margin: 0 0 9px; color: var(--accent); font-size: .72rem; font-weight: 600; letter-spacing: .04em; }
.subheading { margin-top: 9px; color: var(--muted); font-size: .84rem; }
.project-row { text-decoration: none; color: var(--ink); }
.chip { text-decoration: none; }

.portfolio-dashboard { container-type: inline-size; }
.portfolio-layout {
  display: grid;
  grid-template-columns: minmax(0,1fr) clamp(275px,30%,335px);
  grid-template-areas: 'heading calendar' 'metrics calendar' 'projects attention';
  gap: 18px;
}
.portfolio-layout :is(.page-heading,.metrics,.panel) { margin-bottom: 0; }
.portfolio-layout .page-heading { grid-area: heading; min-height: 140px; }
.portfolio-layout .range-calendar { grid-area: calendar; align-self: start; }
.portfolio-layout .metrics { grid-area: metrics; }
.portfolio-layout .project-panel { grid-area: projects; align-self: start; }
.portfolio-layout .attention-panel { grid-area: attention; align-self: start; overflow-wrap: anywhere; }
.portfolio-results { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.portfolio-dates { color: var(--second); font-size: .8rem; font-variant-numeric: tabular-nums; }
@container (max-width: 970px) {
  .portfolio-layout .metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@container (max-width: 700px) {
  .portfolio-layout { grid-template-columns: minmax(0,1fr); grid-template-areas: 'heading' 'calendar' 'metrics' 'projects' 'attention'; gap: 14px; }
  .portfolio-layout .page-heading { min-height: 0; }
}

@media (prefers-reduced-motion: no-preference) {
  .workspace-shell { transition: grid-template-columns 250ms cubic-bezier(.4,0,.2,1); }
  .nav-item { transition: background-color 160ms ease, color 160ms ease, box-shadow 200ms ease; }
  .sw-sidebar-flyout { animation: sw-sidebar-reveal 200ms cubic-bezier(.2,.8,.2,1) both; }
  .nav-group-toggle .icon { transition: transform 200ms ease; }
}
@media (min-width: 1600px) { .main { padding-inline: 36px; } }
@media (max-width: 1100px) { .header-clock { display: none; } }
@media (max-width: 768px) {
  .workspace-shell { display: block; padding: 0; }
  .sidebar {
    display: none;
    position: fixed;
    z-index: 10;
    inset: 8px auto 8px 8px;
    width: min(260px,calc(100vw - 48px));
    height: calc(100dvh - 16px);
    margin: 0;
  }
  .drawer-open .sidebar { display: flex; }
  body:has(.drawer-open) { overflow: hidden; }
  .nav-scrim:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 9; border: 0; background: rgb(25 34 63 / 40%); }
  .sidebar-brand { height: 84px; }
  .mobile-button {
    display: grid;
    flex: none;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    color: var(--ink);
    background: #e4e8f3;
  }
  .menu-lines { position: relative; width: 16px; height: 12px; border-block: 1.6px solid currentColor; }
  .menu-lines::before { content: ''; position: absolute; top: calc(50% - .8px); left: 0; right: 0; height: 1.6px; background: currentColor; }
  .topbar { min-height: 70px; gap: 8px; padding-inline: 14px; }
  .top-title { font-size: 16px; }
  .header-tools { gap: 6px; }
  .main { padding: 4px 14px 24px; }
  .page-heading { flex-wrap: wrap; min-height: 0; padding: 20px; }
  .page-heading h1 { font-size: 21px; }
}
@media (max-width: 768px) and (prefers-reduced-motion: no-preference) {
  .drawer-open .sidebar { animation: cd-drawer 220ms cubic-bezier(.22,1,.36,1); }
}
@media print {
  .workspace-shell { display: block; padding: 0; }
  .sidebar,.topbar,.nav-scrim { display: none !important; }
  .main,.page-heading { margin: 0; padding: 0; }
  .page-heading { box-shadow: none; min-height: auto; }
}
