/* Enterprise workspace only. Chat, voice, login and pinned exports are untouched. */
body[data-view]:not([data-view="chat"]) #application {
  --page: #f5f5f7;
  --surface: #fff;
  --ink: #202124;
  --muted: #686b73;
  --line: #e3e4e8;
  --soft: #f0f1f4;
  --background: var(--page);
  --foreground: var(--ink);
  --border: var(--line);
  --primary: var(--accent);
  --muted-foreground: var(--muted);
  color: var(--ink);
  background: var(--page);
  min-width: 0;

  #panel { max-width: 1240px; padding: 44px clamp(20px, 4vw, 64px) 100px; min-width: 0; }
  #panel > * { min-width: 0; }
  :is(.enterprise-management,.enterprise-integrations,.access-management,.work-records) { max-width: none; padding: 0; }
  :is(.management-heading,.access-heading,.work-records > header) { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 20px; padding: 0 0 28px; margin: 0 0 28px; border: 0; border-bottom: 1px solid var(--line); }
  .work-records > header { display: block; }
  :is(.management-heading,.access-heading,.work-records > header,.enterprise-integrations) h2 { font-size: clamp(26px, 3vw, 34px); line-height: 1.18; font-weight: 600; letter-spacing: -.045em; }
  :is(.management-heading,.access-heading,.work-records > header) p { max-width: 65ch; margin-top: 10px; color: var(--muted); font-size: 14px; line-height: 1.7; }
  .management-heading > div { flex: 1 1 280px; min-width: 0; }
  :is(h2,h3,h4,p,small,label) { overflow-wrap: anywhere; }
  :is(.management-grid,.access-form-grid) { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 22px; }
  :is(.management-grid,.access-form-grid) > * { min-width: 0; }
  [data-slot="card"] { min-width: 0; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: 0 3px 12px #18203404; }
  [data-slot="card-header"] { min-width: 0; }
  [data-slot="badge"] { max-width: 100%; white-space: normal; line-height: 1.45; flex-shrink: 1; }
  [data-slot="button"] { min-height: 42px; height: auto; white-space: normal; line-height: 1.4; padding-block: 10px; }
  :is(.management-actions,.management-form .flex,.access-toolbar,.access-editor-footer,.access-review-actions) { flex-wrap: wrap; }
  :is(.management-form,.access-form-grid,.work-record-editor) :is(input,textarea,select), .management-search {
    width: 100%; min-width: 0; max-width: 100%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 11px; padding: 12px 14px; min-height: 44px; font: inherit;
  }
  :is(input,select,textarea,button,summary,a):focus-visible { outline: 3px solid color-mix(in srgb,var(--accent) 65%,transparent); outline-offset: 3px; }
  button { transition: background-color 160ms, border-color 160ms, box-shadow 160ms; }
  button:disabled { cursor: not-allowed; }
  [data-slot="button"][data-variant="default"] { color: #fff; background: var(--accent); box-shadow: 0 2px 4px #0000000a; }
  [data-slot="button"][data-variant="outline"] { color: var(--ink); background: var(--surface); box-shadow: none; }
  [data-slot="badge"] { border-color: var(--line); color: var(--muted); }
  [data-slot="badge"].integration-connected { color: #18775a; background: #eaf6f1; border-color: #c3e5d9; }
  .management-source { padding: 22px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
  .management-source summary { line-height: 1.6; }
  .management-source[open] { border-color: color-mix(in srgb,var(--accent) 35%,var(--line)); }
  :is(.management-alert,.management-feedback) { line-height: 1.6; background: var(--surface); }
  .management-alert { color: #ad382a; }
  .management-feedback { color: var(--accent-text); }
  .management-prose { font-size: 14px; line-height: 1.8; }
  .management-table { border-radius: 10px; }
  .brand-sample { max-width: 100%; }
  .access-person { gap: 16px; padding: 24px 8px; }
  .access-list { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 0 20px; }
  .access-person:last-child { border-bottom: 0; }
  .access-account { margin: 0 auto; max-width: 620px; }
  .access-password-form { max-width: none; padding: 28px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); }
  .access-editor { border-radius: 20px; }
  .access-secret { max-height: calc(100dvh - 48px); overflow-y: auto; }
  .work-records { color: var(--ink); gap: 22px; }
  .work-records > header { margin-bottom: 0; }
  .work-record-controls { gap: 12px; }
  .work-record-controls label { flex: 1 1 150px; min-width: 0; }
  .work-records :is(input,select,textarea) { background: var(--surface); color: var(--ink); border-color: var(--line); min-height: 44px; max-width: 100%; }
  .work-records button { min-height: 44px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 10px 16px; }
  .work-records button:hover:not(:disabled) { background: var(--soft); border-color: var(--accent); }
  .work-records > .work-record-controls { background: var(--surface); padding: 16px 20px; border: 1px solid var(--line); border-radius: 16px; margin: 0; }
  :is(.work-record-card,.work-record-editor) { border: 1px solid var(--line); background: var(--surface); border-radius: 18px; padding: 24px; }
  .work-records :is(th,td) { border-color: var(--line); white-space: nowrap; }
  .work-records table { display: block; max-width: 100%; overflow-x: auto; }
  .work-records [role="alert"] { color: var(--accent-text); }
  .work-records .work-record-sharing input { min-height: 18px; width: 18px; flex-shrink: 0; }
  .integration-grid { grid-template-columns: repeat(auto-fit,minmax(min(100%,270px),1fr)); gap: 20px; }
  .integration-card { overflow: hidden; transition: box-shadow 180ms, border-color 180ms; }
  .integration-card:hover { box-shadow: 0 10px 32px #1820340a; border-color: color-mix(in srgb,var(--muted) 30%,var(--line)); }
  .integration-card [data-slot="card-header"] { padding: 24px 24px 0; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
  .integration-card [data-slot="card-header"] [data-slot="badge"] { font-size: 11px; font-weight: 500; padding: 5px 9px; }
  .integration-card h3 { font-size: 19px; font-weight: 600; }
  .integration-card [data-slot="card-content"] { padding: 20px 24px 0; }
  .integration-card [data-slot="card-footer"] { margin-top: auto; padding: 20px 24px 24px; }
  .integration-card p.flex svg { flex-shrink: 0; }
  .integration-logo { width: 54px; height: 54px; border-radius: 15px; background: #fff; color: #686b73; border: 1px solid #e8e9ed; box-shadow: 0 2px 5px #18203405; }
  .integration-logo img { width: 32px; height: 32px; object-fit: contain; }
  .integration-summary { border: 1px solid var(--line); background: var(--surface); border-radius: 18px; padding: 24px; align-items: center; }
  .integration-summary p { line-height: 1.65; }
  .integration-toolbar { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; margin: 24px 0; }
  .integration-search { display: flex; align-items: center; gap: 10px; flex: 1 1 220px; max-width: 380px; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; color: var(--muted); }
  .integration-search:focus-within { border-color: var(--accent); }
  .integration-search input { width: 100%; min-width: 0; min-height: 46px; background: transparent; border: 0; color: var(--ink); font-size: 14px; }
  .integration-filters { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--soft); }
  .integration-filters button { min-height: 38px; padding: 8px 12px; display: flex; gap: 8px; align-items: center; border-radius: 9px; color: var(--muted); background: transparent; font-size: 12px; }
  .integration-filters button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 2px 6px #0000000a; }
  .integration-filters span { font-size: 11px; opacity: .7; font-variant-numeric: tabular-nums; }
  .integration-empty { display: grid; justify-items: center; gap: 12px; padding: 48px 20px; border: 1px dashed var(--line); border-radius: 18px; color: var(--muted); text-align: center; }
  .integration-empty button { color: var(--accent-text); padding: 12px; background: transparent; }
  .integration-dialog-heading > div { min-width: 0; }
  .integration-dialog-heading > button { flex-shrink: 0; }
  .integration-dialog { box-shadow: 0 32px 100px #0003; }
  .channels-heading { flex-wrap: wrap; }
  .channels-layout { box-shadow: 0 8px 32px #18203406; }
  .channels-list { overflow-y: auto; }
  .channel-composer-actions { flex-wrap: wrap; }
  .channel-support-content { max-height: min(220px,24dvh); }
  .page-heading { height: auto; min-height: 64px; flex-wrap: wrap; }
}
:root[data-theme="dark"] body[data-view]:not([data-view="chat"]) #application {
  --page: #17181b; --surface: #202226; --ink: #f2f3f5; --muted: #a5a8b0; --line: #35373e; --soft: #292c32;
  .management-alert { color: #ffafa2; }
}
body:is([data-view="records"],[data-view="access"],[data-view="account"]) .page-heading { display: none; }
body[data-view="channels"] #application #panel { height: calc(100dvh - 32px); padding-block: 32px; }
@media (max-width: 1000px) {
  body[data-view]:not([data-view="chat"]) #application {
    .access-person { flex-wrap: wrap; }
    .access-person-name { flex-basis: 55%; }
    .access-person-actions { max-width: none; margin-left: auto; }
    .channels-layout { grid-template-columns: 170px minmax(0,1fr); }
  }
}
@media (max-width: 767px) {
  body[data-view]:not([data-view="chat"]) #application {
    #panel { padding: 28px 20px 88px; }
    :is(.management-grid,.access-form-grid) { grid-template-columns: minmax(0,1fr); }
    .management-heading > div { flex-basis: 100%; }
    .management-heading { gap: 16px; }
    .management-heading > button { width: 100%; }
    .integration-toolbar { align-items: stretch; }
    .integration-search { max-width: none; flex-basis: 100%; }
    .integration-filters { width: 100%; }
    .integration-filters button { flex: 1; justify-content: center; }
    .access-toolbar { align-items: stretch; }
    .access-search { flex-basis: 100%; max-width: none; }
    .access-password-form { padding: 20px; }
    .access-person-actions { justify-content: flex-start; width: 100%; margin: 0; }
    .access-person-actions button { min-height: 44px; }
    .channels-layout { grid-template-columns: minmax(0,1fr); }
    .channels-list { max-height: 150px; }
    .channels-heading { gap: 12px; }
    .channel-composer { padding: 12px 16px; }
    .channel-composer-buttons { width: 100%; }
    .channel-composer-buttons button { flex: 1; white-space: normal; }
    :is(.work-record-card,.work-record-editor) { padding: 18px; }
    :is(.management-form,.work-records,.access-management,.access-account) :is(input,textarea,select) { font-size: 16px; }
  }
  body[data-view="channels"] #application #panel { height: calc(100dvh - 44px); padding: 16px 12px 20px; }
}
@media (prefers-reduced-motion: no-preference) {
  body[data-view]:not([data-view="chat"]) #panel > :is(.enterprise-management,.enterprise-integrations,.access-management,.access-account,.work-records) { animation: workspace-arrive 240ms cubic-bezier(.2,.7,.2,1) both; }
  body[data-view]:not([data-view="chat"]) .integration-dialog[open] { animation: workspace-arrive 180ms ease-out; }
}
@keyframes workspace-arrive { from { opacity: 0; translate: 0 5px; } to { opacity: 1; translate: 0 0; } }
@media (prefers-reduced-motion: reduce) {
  body[data-view]:not([data-view="chat"]) #application button,
  body[data-view]:not([data-view="chat"]) #application .integration-card { transition: none; }
}
body[data-view="computer"] #application {
  .page-heading { max-width: 1240px; margin: auto; padding: 44px clamp(20px,4vw,64px) 0; }
  .page-heading h1 { font-size: 34px; font-weight: 600; letter-spacing: -.045em; }
  #panel { padding-top: 20px; display: grid; gap: 24px; }
  .intro { max-width: 70ch; font-size: 14px; line-height: 1.8; margin: 0 0 8px; }
  :is(.computer-pairing,.document-card) { border: 1px solid var(--line); background: var(--surface); border-radius: 20px; padding: 28px; min-width: 0; margin: 0; }
  h2 { font-size: 20px; font-weight: 600; letter-spacing: -.025em; margin: 0 0 10px; }
  p { color: var(--muted); font-size: 14px; line-height: 1.7; }
  .computer-controls { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
  :is(input,textarea,select) { min-height: 44px; min-width: 0; max-width: 100%; padding: 12px 14px; background: var(--page); color: var(--ink); border: 1px solid var(--line); border-radius: 11px; }
  .computer-controls input { flex: 1 1 220px; }
  button { min-height: 44px; padding: 12px 16px; background: var(--soft); border: 1px solid var(--line); border-radius: 11px; white-space: normal; font-size: 13px; }
  button.primary { background: var(--accent); border-color: var(--accent); color: white; }
  .document-card { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
  .document-card :is(h2,p,details,pre) { width: 100%; }
  .document-card pre { overflow-x: auto; padding: 16px; background: var(--page); border-radius: 12px; }
  .document-card details { border-top: 1px solid var(--line); padding-top: 16px; }
  .document-card summary { cursor: pointer; margin-bottom: 16px; }
  .computer-empty { padding: 40px 24px; border: 1px dashed var(--line); border-radius: 18px; text-align: center; color: var(--muted); line-height: 1.7; }
}
/* Empty channels must fit the transcript, including small phones and short windows. */
body[data-view="channels"] #application .channel-empty {
  min-height: 0;
  height: 100%;
  padding: 12px 0;
}
@media (max-width: 380px), (max-height: 700px) {
  body[data-view="channels"] #application .channel-empty > svg { display: none; }
  body[data-view="channels"] #application .channel-empty h4 { font-size: 15px; }
  body[data-view="channels"] #application .channel-empty p { font-size: 12px; }
}
/* Keep the workspace notice out of the content and account controls reachable. */
body[data-view]:not([data-view="chat"]) .disclaimer {
  position: static;
  inset: auto;
  margin: 12px 28px 16px;
  padding: 0;
}
@media (min-width: 768px) {
  body[data-view]:not([data-view="chat"]) .ivi-sidebar { overflow: hidden; gap: 16px; }
  body[data-view]:not([data-view="chat"]) .ivi-sidebar > :is(.sidebar-brand,.workspace,.sidebar-footer) { flex-shrink: 0; }
  body[data-view]:not([data-view="chat"]) .ivi-sidebar nav { flex: 1; min-height: 0; overflow-y: auto; gap: 4px; scrollbar-width: thin; }
  body[data-view]:not([data-view="chat"]) .ivi-sidebar nav button { min-height: 44px; padding-block: 10px; flex-shrink: 0; }
  body[data-view]:not([data-view="chat"]) .sidebar-footer { padding-top: 8px; }
}
