/* Shared workspace rhythm. Permission gates remain in the existing page logic. */
:root {
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --text-small: 12px;
  --text-body: 14px;
  --text-title: 22px;
  --r-control: 9px;
  --r: 12px;
  --r-lg: 18px;
  --shadow-panel: 0 12px 32px rgba(0, 0, 0, .16);
  --focus-ring: 0 0 0 3px rgba(85, 150, 225, .38);
}
html { scroll-padding-top: 120px; }
body { min-width: 0; }
.workspace-back { display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; padding: 5px 7px; border: 1px solid var(--border); border-radius: var(--r-control); background: transparent; color: var(--gray-1); cursor: pointer; font-size: 12px; }
.workspace-back svg, .wn-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.workspace-back[hidden], .wn-panel[hidden], .wn-dot[hidden] { display: none !important; }
.wn-wrap { position: relative; flex-shrink: 0; }
.wn-button { position: relative; display: flex; align-items: center; justify-content: center; gap: 5px; padding: 5px 8px; border: 1px solid var(--border); border-radius: var(--r-control); background: transparent; color: var(--gray-2); font-size: 12px; cursor: pointer; white-space: nowrap; }
.wn-button:hover { color: var(--white); background: var(--card-hover); }
.wn-dot { position: absolute; right: 0; top: 0; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.wn-panel { position: fixed; width: 380px; max-width: calc(100vw - 24px); overflow-y: auto; padding: 16px; box-sizing: border-box; color: var(--gray-1); background: var(--card); border: 1px solid var(--border-hover); border-radius: var(--r); box-shadow: var(--shadow-panel); z-index: 250; text-align: left; }
.wn-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.wn-heading h2 { font-size: 17px; color: var(--white); margin: 0; }
.wn-close { padding: 3px 8px; border: 0; border-radius: 6px; background: transparent; color: var(--gray-2); font-size: 22px; cursor: pointer; }
.wn-day { border-top: 1px solid var(--border); margin-top: 12px; padding-top: 14px; }
.wn-day h3 { margin: 0 0 6px; font-size: 12px; color: var(--gray-2); }
.wn-unseen h3 { color: var(--accent); }
.wn-day-title { font-size: 14px; font-weight: 600; margin: 0 0 10px; color: var(--white); }
.wn-day ul { margin: 0; padding-left: 18px; }
.wn-day li { font-size: 12px; line-height: 1.6; margin-bottom: 8px; }
.wn-full { display: block; margin-top: 18px; padding: 10px 0 0; border-top: 1px solid var(--border); color: var(--accent); font-size: 13px; }
/* Below the windows (460), so the note never covers a button in an open ticket. */
.wn-toast { position: fixed; bottom: 20px; left: 20px; z-index: 440; width: 300px; max-width: calc(100vw - 40px); box-sizing: border-box; padding: 16px 40px 16px 16px; border: 1px solid var(--border-hover); border-radius: var(--r); background: var(--card); color: var(--gray-1); box-shadow: var(--shadow-panel); }
.wn-toast p { margin: 0 0 10px; font-size: 13px; line-height: 1.5; }
.wn-popup { width: 560px; max-width: calc(100vw - 32px); max-height: calc(100dvh - 48px); box-sizing: border-box; margin: auto; padding: 0; overflow: hidden; color: var(--gray-1); background: var(--card); border: 1px solid var(--border-hover); border-radius: var(--r); box-shadow: 0 24px 80px rgba(0,0,0,0.5); font-family: var(--font); }
.wn-popup[open] { display: flex; flex-direction: column; }
.wn-popup::backdrop { background: rgba(4,10,20,0.6); }
.wn-popup .wn-heading { padding: 20px 22px 0; }
.wn-popup .wn-heading h2 { font-size: 20px; border: 0; padding: 0; margin: 0; }
.wn-popup-body { padding: 0 22px 6px; overflow-y: auto; }
.wn-popup-body .wn-day:first-child { border-top: 0; margin-top: 6px; }
.wn-popup-body .wn-day li { font-size: 13.5px; }
.wn-popup-body .wn-day-title { font-size: 15px; }
.wn-more { font-size: 12.5px; color: var(--gray-2); margin: 12px 0 0; }
.wn-popup-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 22px 18px; border-top: 1px solid var(--border); }
.wn-popup-foot .wn-full { margin: 0; border: 0; padding: 0; }
.wn-popup-foot .wn-see { padding: 10px 20px; font-size: 14px; }
.wn-toast .wn-close { position: absolute; right: 6px; top: 6px; }
.wn-see { border: 0; border-radius: 6px; padding: 8px 10px; background: var(--accent); color: #071321; font-weight: 600; font-size: 12px; cursor: pointer; }
body.eb-impersonating { padding-top: var(--workspace-banner-height, 36px); }
body.eb-impersonating > .header { top: var(--workspace-banner-height, 36px); }
body.eb-impersonating .ebc-panel { top: var(--workspace-banner-height, 36px); height: calc(100dvh - var(--workspace-banner-height, 36px)); }
.impersonate-banner { min-height: 28px; }
.impersonate-banner .exit-btn { min-height: 22px; flex-shrink: 0; }
@media (max-width: 600px) { .impersonate-banner { min-height: 36px; } .impersonate-banner .exit-btn { min-height: 30px; } }
.workspace-more { position: relative; flex-shrink: 0; }
.workspace-more > button { border: 1px solid var(--border-hover); background: var(--card); color: var(--gray-1); font: inherit; cursor: pointer; }
.workspace-overflow { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; padding: 8px; border: 1px solid var(--border-hover); border-radius: var(--r); background: var(--card); box-shadow: var(--shadow-panel); z-index: 250; }
.header .workspace-overflow .nav-tab { width: 100%; justify-content: flex-start; }
.workspace-more[hidden], .workspace-overflow[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
:is(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
button { touch-action: manipulation; }
button:active:not(:disabled) { transform: scale(.98); }
button:disabled { cursor: not-allowed; }
.header { gap: 8px 12px; flex-wrap: wrap; padding: 8px 20px; }
.header-left { min-width: 0; flex-wrap: wrap; flex: 1; }
.header-right { margin-left: auto; }
.header-title { font-size: 20px; white-space: nowrap; }
.header .nav-tab { min-height: 32px; display: inline-flex; align-items: center; justify-content: center; }
.header :is(button, .user-icon-btn, .help-btn, .theme-toggle) { min-width: 32px; min-height: 32px; }
.app-footer { font-size: var(--text-small); line-height: 1.6; padding: 20px 24px; color: var(--gray-2); }
.dashboard-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 24px; border-top: 1px solid var(--border); font-size: 11px; }
.empty-state { line-height: 1.6; color: var(--gray-2); padding: 32px 20px; }
.workspace-assistant, .workspace-primary {
  border: 1px solid var(--accent);
  border-radius: var(--r-control);
  background: var(--accent-soft);
  color: var(--white);
  min-height: 32px;
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.tasks-header { padding: 8px 20px; gap: 8px; }
.tasks-controls { width: 100%; flex-wrap: wrap; gap: 6px; }
.tasks-controls :is(button, select) { min-height: 32px; }
.tasks-controls :is(.refresh-btn, .filter-btn) { min-width: 32px; }
.workspace-search { flex: 1 1 150px; min-width: 120px; display: flex; }
.workspace-search #globalSearch {
  width: 100%; max-width: none; min-width: 0; min-height: 32px;
  padding: 6px 10px; border-color: var(--border-hover);
  border-radius: var(--r-control); font-size: 12px; background: var(--card);
}
.workspace-search #globalSearch::placeholder { color: var(--gray-2); }
#taskRefreshStatus { font-size: 11px; line-height: 1.5; }
#taskRefreshStatus:empty { display: none; }
.dashboard-read-status { display: flex; gap: 8px; align-items: center; padding: 8px 20px; font-size: 12px; color: var(--gray-1); border-bottom: 1px solid var(--border); }
.dashboard-read-status[hidden] { display: none; }
.dashboard-read-status button { flex-shrink: 0; }
.view-toggle { max-width: 100%; flex-wrap: wrap; }
.task-list { min-width: 0; }
[data-workspace="client-dashboard"] .card { min-width: 0; overflow-wrap: anywhere; }
[data-workspace="users"] .users-table-wrap { overflow-x: auto; }
[data-workspace="mockup-analytics"] .card { min-width: 0; overflow-x: auto; }
[data-workspace="mockup-analytics"] .filter-left { min-width: 0; max-width: 100%; flex-wrap: wrap; }
[data-workspace="mockup-analytics"] .filter-left .toggle-group { max-width: 100%; flex-wrap: wrap; }
.tasks-title-wrap { flex-wrap: wrap; }
[data-workspace="ac-board"] .task-actions > button { min-height: 30px; }
[data-workspace="ac-board"] .task-actions > .assign-btn:not(:first-child) {
  background: transparent;
  color: var(--gray-1);
  border: 1px solid var(--border-hover);
  box-shadow: none;
}
[data-workspace="ac-board"] .task-actions > .assign-btn:not(:first-child):hover {
  background: var(--card-hover);
  border-color: var(--accent);
  transform: none;
}
@media (min-width: 769px) {
  .header { flex-wrap: nowrap; align-items: center; }
  .header-right { padding-top: 0; }
  .header .nav-toggle { flex: 1 1 auto; min-width: 0; width: auto; flex-wrap: nowrap; gap: 2px; margin-left: 0; }
  .header .nav-tab { padding: 6px 9px; font-size: 12px; }
  .header.workspace-header { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; }
  .workspace-header > .header-left { flex-wrap: nowrap; }
  .workspace-header > .header-right { grid-column: 3; grid-row: 1; }
  .workspace-header > .nav-toggle { grid-column: 2; grid-row: 1; min-width: 0; flex-wrap: nowrap; }
  .workspace-header .nav-tab { flex-shrink: 0; }
  .workspace-header .header-sub { max-width: 155px; }
  .tasks-controls .view-toggle { flex-wrap: nowrap; flex-shrink: 0; }
  .tasks-controls .view-btn { padding: 6px 10px; }
  .tasks-controls .ss-filter-select { max-width: 130px; }
}
@media (max-width: 768px) {
  .header { padding: 10px 14px; }
  .header :is(button, .nav-tab, .user-icon-btn, .help-btn, .theme-toggle), .tasks-controls :is(button, select) { min-height: 44px; min-width: 44px; }
  .workspace-search { flex: 1 0 100%; }
  .workspace-search #globalSearch { min-height: 44px; }
  body.eb-impersonating > .header { top: 0; }
  .header-left { flex: 1 0 auto; }
  .header-title { font-size: 20px; }
  .header .nav-toggle { max-height: calc(100dvh - 85px); overflow-y: auto; }
  .header .nav-tab { justify-content: flex-start; }
  .tasks-header { padding: 16px; }
  [data-workspace="ac-board"] .task-actions > button { min-height: 44px; }
  .tasks-controls { gap: 8px; }
  .tasks-controls .view-toggle { flex: 1 0 100%; }
  .tasks-controls .view-btn { flex: 1; padding: 8px; }
  .workspace-assistant { margin-left: auto; }
  #taskRefreshStatus { order: 2; flex-basis: 100%; max-width: none !important; }
  .kpi-bar { flex-wrap: wrap; height: auto; }
  .kpi-bar .kpi-item { min-width: 82px; flex: 1 0 25%; }
  .kpi-divider { display: none; }
  .selection-bar { flex-wrap: wrap; padding: 10px 14px; gap: 8px; }
  .selection-bar .sel-count { flex: 1 0 100%; }
  .selection-bar .sel-btn { min-height: 44px; padding: 8px 12px; }
  :is(.modal, .modal-content) { max-width: calc(100vw - 24px); }
  :is(.page-wrap, .main-content, .content, .container) { min-width: 0; }
  .filter-left { min-width: 0; max-width: 100%; flex-wrap: wrap; gap: 10px; }
  .filter-left .toggle-group { flex-wrap: wrap; border-radius: var(--r); max-width: 100%; }
  .filter-left .toggle-btn { min-height: 44px; flex: 1 1 auto; padding: 10px 12px; }
  [data-workspace="architecture"] .label { white-space: normal; overflow-wrap: anywhere; }
  [data-workspace="architecture"] :is(.backend-grid, .ext-grid) > * { min-width: 0; overflow-wrap: anywhere; }
  [data-workspace="architecture"] .info-row { grid-template-columns: minmax(0, 1fr) !important; }
  [data-workspace="architecture"] .ep-list li { flex-wrap: wrap; overflow-wrap: anywhere; }
  :is([data-workspace="book"], [data-workspace="mockup-analytics"]) .card { min-width: 0; overflow-x: auto; }
  [data-workspace="mockup-analytics"] .main { min-width: 0; }
  .app-footer { padding: 18px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
  button:active:not(:disabled) { transform: none; }
}

/* Workload views (v5.80): Timeline | Team sit in the same toolbar strip, in the same place,
   on both pages, so switching views never moves the control. workspace.js slides the
   highlight and preloads the other view; each page opts in to the cross-fade. */
.view-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 20px; background: var(--card); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.view-switch { position: relative; display: inline-flex; border: 1px solid var(--border); border-radius: var(--r-pill); padding: 3px; background: rgba(255,255,255,0.02); view-transition-name: workload-views; }
.view-switch a { position: relative; z-index: 1; display: inline-flex; align-items: center; color: var(--gray-2); font: 550 13px var(--font); padding: 6px 14px; border-radius: var(--r-pill); text-decoration: none; white-space: nowrap; transition: color 0.2s var(--ease); }
.view-switch a:hover { color: var(--white); }
.view-switch a[aria-current="page"] { color: #fff; }
.view-switch a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.view-switch .vs-thumb { position: absolute; top: 3px; bottom: 3px; left: 0; width: 0; border-radius: var(--r-pill); background: var(--accent); pointer-events: none; }
.view-switch:not(.vs-ready) .vs-thumb { display: none; }
.view-switch:not(.vs-ready) a[aria-current="page"] { background: var(--accent); }
.view-switch.vs-animate .vs-thumb { transition: transform 0.2s var(--ease), width 0.2s var(--ease); }
@media (max-width: 768px) {
  .view-bar { padding: 10px 12px; gap: 8px; }
  .view-switch a { padding: 5px 10px; font-size: 12px; }
}

@media (max-width: 699px) {
  .wn-toast { bottom: 148px; }
  .workspace-back span, .wn-button span { display: none; }
  .header.workspace-header { flex-wrap: nowrap; gap: 4px; padding: 8px; }
  .workspace-header > .header-left { flex: 1 1 auto; flex-wrap: nowrap; gap: 4px; }
  .workspace-header > .header-right { gap: 2px; }
  .workspace-header .header-title { font-size: 14px; }
  .workspace-header .logo { height: 26px; }
  .workspace-header .header-left > div:not(.nav-toggle) { min-width: 0; }
  .workspace-header .header-title { overflow: hidden; text-overflow: ellipsis; }
  .workspace-header :is(.workspace-back, .wn-button, .nb-bell, .theme-toggle, .help-btn, .user-icon-btn, .hamburger) { min-width: 32px; min-height: 40px; width: 32px; padding-left: 3px; padding-right: 3px; }
}
