/* Final shared treatment for the working interface. Exported documents keep their own styles. */
:root { --office-rail:204px; }
html[data-theme=light] {
  --paper:#f1f2f1; --surface:#fafbf9; --raised:#ffffff; --inset:#e9edeb;
  --hover:#e6eceb; --ink:#283136; --muted:#607078; --line:#d7dfdd;
  --field:#ffffff; --field-line:#aab8ba; --accent:#3e6b86; --accent-hover:#355f78;
  --selected:#e0ebef; --focus:#507c98; --link:#376783;
  --rail:#202629; --rail-raised:#303b41;
  --office-shadow:0 2px 3px #162a3604,0 8px 24px #162a3606;
  --rc-highlight:#ffffff; --rc-control-shadow:0 2px 0 #263e5012,0 3px 7px #263e500a;
}
html[data-theme=dark] {
  --paper:#101214; --surface:#191c1f; --raised:#22272b; --inset:#141719;
  --hover:#293137; --ink:#d9e0e4; --muted:#a1adb5; --line:#313a40;
  --field:#14181b; --field-line:#52616a; --accent:#426d87; --accent-hover:#507f99;
  --selected:#253c49; --focus:#94b8cd; --link:#a1c4da;
  --rail:#121619; --rail-raised:#253138;
  --office-shadow:0 2px 4px #00000018,0 9px 25px #00000015;
  --rc-highlight:#ffffff08; --rc-control-shadow:0 2px 0 #00000035,0 4px 9px #00000022;
}
html[data-theme] body { font-family:"Segoe UI Variable","Segoe UI",system-ui,sans-serif; text-rendering:optimizeLegibility; }
html[data-theme] body main[tabindex="-1"]:focus { outline:none; box-shadow:none; }
html body:not(.auth-locked) main { padding:24px clamp(16px,2.4vw,36px) 32px; }
html body:not(.auth-locked) :is(.page-head,.dashboard-intro,.kb-topline) {
  padding-bottom:17px; margin-bottom:20px; border-bottom-color:var(--line);
}
html body :is(.page-head,.dashboard-intro,.kb-topline) h1 {
  font-size:26px; line-height:1.25; font-weight:650; letter-spacing:-.65px;
}
html body :is(.page-head,.dashboard-intro,.kb-topline) p {
  font-size:13px; line-height:1.6; max-width:900px;
}
html body #main :is(.panel,.card,.dashboard-tile,.kb-workspace,.cmp-workspace) {
  border-radius:12px; border-color:var(--line); box-shadow:inset 0 1px var(--rc-highlight),var(--office-shadow);
}
html body #main .panel { padding:20px; margin-bottom:16px; }
html body #main .panel>.panel { padding:15px; box-shadow:none; }
html body #main :is(.panel>h2,.section-head h2) { font-size:18px; margin-bottom:13px; }
html body #main .section-head { margin:24px 0 14px; align-items:center; }
html body #main :is(.toolbar,.work-tabs,.crm-toolbar,.actions) { gap:9px; }
html body #main :is(.source-label,.muted) { line-height:1.6; }

/* Navigation retains the compact rail and the existing collapsed state. */
html[data-theme] body .sidebar { border-right-color:var(--line); }
html body .sidebar .brand { padding-top:10px; padding-bottom:20px; }
html body .sidebar :is(#main-nav,#crm-main-nav) { gap:4px; }
html body .sidebar :is(#main-nav,#crm-main-nav) a {
  min-height:38px; padding:6px 9px; border-radius:8px; font-weight:500;
}
html body .sidebar #main-nav details>summary { padding-top:14px; padding-bottom:7px; }
html body .sidebar .workspace-switch { border-color:var(--line); padding:4px; margin-bottom:15px; }
html body .sidebar .workspace-switch button[aria-pressed=true] {
  box-shadow:inset 0 1px #ffffff0c,0 2px 5px #00000028;
}
html body .theme-controls { border-color:var(--line); border-radius:9px; }
html body .account-menu summary { border-radius:8px; }
html body .account-options { padding:8px; border-radius:12px; }
html body .account-picture { border-width:1px; }
html body .office-tab-strip { gap:5px; border-bottom-color:var(--line); }
html body .office-tab-strip button { border-radius:7px; font-weight:500; }
html body .office-tab-group { align-self:center; border-radius:7px; }
html[data-theme] body .office-tab-strip button[aria-pressed=true] {
  background:var(--rail-raised); box-shadow:inset 0 -2px var(--focus); border-color:transparent;
}
html body .office-navigation { gap:6px; }
html body .office-navigation-button { border-radius:8px; min-height:34px; }

/* Small highlights give controls depth without large hover jumps. */
html[data-theme] body #main :is(.primary,.secondary,.quiet,.kb-create,.doc-source button,.cmp-tabs button) {
  min-height:36px; padding:7px 13px; border-radius:8px; font-size:14px;
  transition:background-color .16s,border-color .16s,box-shadow .16s;
}
html[data-theme] body #main :is(.primary,.kb-create) {
  background:linear-gradient(#ffffff0b,#00000008),var(--accent);
  border-color:color-mix(in srgb,var(--accent) 78%,#000);
  box-shadow:inset 0 1px #ffffff22,var(--rc-control-shadow);
}
html[data-theme] body #main :is(.secondary,.quiet) {
  background:linear-gradient(var(--rc-highlight),transparent),var(--raised);
  border-color:var(--line); box-shadow:inset 0 1px var(--rc-highlight),0 1px 2px #0000000c;
}
html[data-theme] body #main :is(.primary,.secondary,.quiet,.kb-create):disabled {
  opacity:.48; box-shadow:none; cursor:default;
}
html body #main :is(input,select,textarea):not([type=checkbox]):not([type=radio]):not([type=file]) {
  min-height:36px; padding:8px 11px; font-size:14px; line-height:1.45;
  border-radius:8px!important; /* Earlier field rules fix this property with !important. */
}
html body #main label { font-size:13px; line-height:1.5; }
html body #main label :is(input,select,textarea) { margin-top:6px; margin-bottom:13px; }
html body #main :is(.form-two,.crm-form-grid) { column-gap:16px; }
html body #main textarea { line-height:1.65; }
html[data-theme] body :is(button,a,summary,[tabindex]):focus-visible { outline-offset:3px; }
html[data-theme] body dialog:not(:has(.docx-wrapper)):not(:has(#docx-pages)) {
  border-radius:16px; padding:24px; box-shadow:0 24px 80px #00000055;
}
html body dialog>h2 { font-size:21px; line-height:1.3; margin-bottom:17px; }
html body dialog .actions { justify-content:flex-end; gap:9px; }

/* Overview and illustration slots leave room for live information. */
html body #main .dashboard-intro { position:relative; overflow:hidden; min-height:115px; padding-right:310px; }
.rc-overview-art { position:absolute; right:4px; bottom:-14px; width:300px; height:132px; object-fit:contain; pointer-events:none; }
html body #main :is(.dashboard-primary,.dashboard-nav,.cards) { gap:16px; }
html body #main :is(.dashboard-primary .dashboard-tile,.dashboard-nav .dashboard-tile) { padding:20px; gap:8px 13px; }
html body #main .dashboard-tile .dashboard-icon { width:36px; height:36px; border-radius:10px; }
html body #main .dashboard-tile :is(h2,h3) { font-size:18px; line-height:1.3; }
html body #main .dashboard-tile p { line-height:1.6; font-size:13px; }
html body #main .dashboard-tile .dashboard-link { font-size:12px; margin-top:9px; }
html body #main .task-dashboard { padding:15px 18px; border-radius:10px; gap:18px; }
html body #main .dashboard-reference { padding-block:20px; }
.rc-empty-state { display:grid; justify-items:center; gap:10px; padding:30px 20px; text-align:center; color:var(--muted); }
.rc-empty-state[hidden] { display:none; }
.rc-empty-state img { display:block; width:100px; height:90px; object-fit:contain; }
.rc-empty-state :is(h2,h3,p) { margin:0; max-width:440px; }
.rc-empty-state p { font-size:13px; line-height:1.6; }

/* Readable tables and independently scrolling boards. */
html body #main :is(.work-table,.crm-audit-table,.kb-list-table table) { font-size:14px; }
html body #main :is(.work-table,.crm-audit-table,.kb-list-table) :is(th,td) { padding:11px 12px; }
html body #main :is(.work-table,.crm-audit-table,.kb-list-table) th { font-size:11px; font-weight:600; }
html body #main .table-scroll { border-radius:10px; }
html body #main :is(.work-table,.crm-audit-table) td :is(.primary,.secondary,.quiet) {
  min-height:30px; padding:5px 9px; font-size:12px;
}
html body #main :is(.kb-column,.crm-column) { border-radius:11px; }
html body #main .kb-column { padding:11px 9px 7px; }
html body #main .kb-column-cards { gap:10px; }
html body #main :is(.kb-card,.crm-deal) { border-radius:9px; padding:12px; box-shadow:0 2px 4px #0000000c; }
html body #main :is(.kb-card-title,.crm-deal a) { line-height:1.5; }
html body #main .kb-card-foot { padding-top:9px; }
html body #main .kb-command { padding:12px 14px; }
html body #main .kb-filterbar { padding:12px 14px 5px; }
html body #main .kb-overview button { padding:13px 15px; border-radius:10px; }
html body #main .crm-card-statusbar { padding:13px 16px; border-radius:11px; }
html body #main :is(.crm-card-client,.crm-card-history,.crm-next-task) { border-radius:11px; }
html body #main .crm-card-client section { padding-block:16px; }
html body #main :is(.pill,.status-pill,.badge-outline) { border-radius:6px; line-height:1.45; }

/* The original sheet remains a scannable source alongside application reservations. */
html body #main .stock-source-bookings {
  margin:0 0 18px; padding:0; border:1px solid var(--line); border-radius:12px;
  background:var(--surface); box-shadow:inset 0 1px var(--rc-highlight),var(--office-shadow); overflow:hidden;
}
.stock-source-bookings>summary {
  padding:15px 18px; cursor:pointer; font-size:14px; font-weight:600; color:var(--ink);
}
.stock-source-bookings[open]>summary { border-bottom:1px solid var(--line); }
.stock-source-bookings>p { margin:12px 18px; font-size:12px; color:var(--muted); }
.stock-source-list { display:grid; grid-template-columns:repeat(auto-fit,minmax(270px,1fr)); gap:1px; background:var(--line); }
.stock-source-list article { min-width:0; padding:15px 18px; background:var(--surface); }
.stock-source-list article header { height:auto; backdrop-filter:none; display:flex; flex-direction:column; align-items:flex-start; gap:4px; min-height:0; padding:0; margin-bottom:7px; background:none; border:0; box-shadow:none; }
.stock-source-list article :is(h3,strong) { font-size:13px; line-height:1.5; margin:0; }
.stock-source-list article p { font-size:13px; margin:4px 0; line-height:1.6; overflow-wrap:anywhere; }
.stock-source-list :is(.stock-source-meta,small) { color:var(--muted); font-size:12px; }

@media (hover:hover) {
  html[data-theme] body #main :is(.primary,.kb-create):hover:not(:disabled) { background:var(--accent-hover); box-shadow:inset 0 1px #ffffff22,var(--rc-control-shadow); }
  html[data-theme] body #main :is(.secondary,.quiet):hover:not(:disabled) { background:var(--hover); border-color:var(--field-line); }
  html[data-theme] body #main :is(.dashboard-tile,.card[data-rc-tone]):hover { border-color:color-mix(in srgb,var(--section-color,var(--focus)) 48%,var(--line)); box-shadow:var(--office-shadow); }
}
@media (max-width:900px) {
  html body:not(.auth-locked) main { padding:19px 17px 26px; }
  html body #main .dashboard-intro { padding-right:155px; }
  .rc-overview-art { width:140px; height:105px; }
}
@media (max-width:760px) {
  html body:not(.auth-locked) main { padding:17px 13px 26px; }
  html body :is(.page-head,.dashboard-intro,.kb-topline) h1 { font-size:23px; }
  html body #main .dashboard-intro { min-height:0; padding-right:0; }
  .rc-overview-art { display:none; }
  html body #main .panel { padding:16px; }
  html body #main :is(.dashboard-primary,.dashboard-nav,.cards) { gap:11px; }
  html body #main :is(.dashboard-primary .dashboard-tile,.dashboard-nav .dashboard-tile) { padding:15px; gap:8px 11px; }
  html body #main .dashboard-tile :is(h2,h3) { font-size:16px; }
  html[data-theme] body #main :is(.primary,.secondary,.quiet,.kb-create,.doc-source button,.cmp-tabs button) { min-height:44px; padding:10px 13px; }
  html body #main :is(input,select,textarea):not([type=checkbox]):not([type=radio]):not([type=file]) { min-height:44px; font-size:16px; }
  html[data-theme] body .sidebar :is(#main-nav,#crm-main-nav) a[data-rc-tone] { min-height:44px; }
  html body .sidebar .workspace-switch button { min-height:44px; height:44px; }
  html body .office-navigation-button { min-height:44px; }
  html body #main :is(.work-table,.crm-audit-table) td :is(.primary,.secondary,.quiet) { min-height:44px; }
  html[data-theme] body dialog:not(:has(.docx-wrapper)):not(:has(#docx-pages)) { padding:18px; }
  .stock-source-list { grid-template-columns:1fr; }
  .stock-source-list article { padding:14px 16px; }
  .rc-empty-state { padding:24px 15px; }
}
@media (prefers-reduced-motion:reduce) {
  html[data-theme] body #main :is(.primary,.secondary,.quiet,.kb-create,.dashboard-tile),
  html body .sidebar .workspace-switch button { transition:none; }
}
@media print {
  .rc-overview-art,.rc-empty-state img { display:none; }
  html body #main .panel { box-shadow:none; }
}

/* Small illustrations identify an empty archive or an unsuccessful search. */
html body #main .empty {
  text-align:center; color:var(--muted); line-height:1.6; padding:24px 20px;
}
html body #main .empty::before {
  content:''; display:block; width:128px; height:96px; margin:0 auto 12px;
  background:url('./assets/pro/empty-workspace.svg') center/contain no-repeat;
}
html body #main #price-list .empty::before {
  background-image:url('./assets/pro/empty-search.svg');
}
@media print { html body #main .empty::before { display:none; } }

.stock-source-list article header>* { overflow-wrap:anywhere; }
html body #main #kb-clear {
  min-height:36px; padding:7px 13px; border:1px solid var(--line); border-radius:8px;
  color:var(--ink); background:var(--raised); align-self:end; font-size:13px;
}
html body #main .kb-filterbar input:not([type=checkbox]) { align-self:end; }
html body #main .kb-staff-pill {
  background:color-mix(in srgb,var(--staff-color) 14%,var(--surface))!important;
  color:var(--ink)!important;
  border-color:color-mix(in srgb,var(--staff-color) 40%,var(--line));
}
html body #main .kb-staff-pill span { color:var(--ink)!important; }
html body dialog:not(:has(.docx-wrapper)):not(:has(#docx-pages)) :is(.primary,.secondary,.quiet) {
  min-height:36px; border-radius:8px; padding:7px 13px;
}
@media (max-width:760px) {
  html body #main #kb-clear { min-height:44px; }
  html body dialog:not(:has(.docx-wrapper)):not(:has(#docx-pages)) :is(input,select,textarea):not([type=checkbox]):not([type=radio]):not([type=file]) {
    min-height:44px; font-size:16px;
  }
  html body dialog:not(:has(.docx-wrapper)):not(:has(#docx-pages)) :is(.primary,.secondary,.quiet) { min-height:44px; }
}

html body #main .kb-advanced-filters { margin:0 14px 12px; border-bottom:1px solid var(--line); }
html body #main .kb-advanced-filters>summary { cursor:pointer; padding:10px 0; color:var(--muted); font-size:12px; }
html body #main .kb-advanced-filters>.kb-filter-inputs { display:flex; flex-wrap:wrap; gap:10px; padding-block:5px 12px; justify-content:flex-start; }
html body #main .kb-advanced-filters label { flex:1 1 140px; min-width:0; }
html body #main .kb-advanced-filters label :is(input,select) { width:100%; margin-bottom:0; }
html body #main .kb-advanced-filters #kb-direction-select { flex:0 1 155px; align-self:end; }
@media (max-width:760px) {
  html body #main .kb-filterbar .kb-filter-inputs { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
  html body #main .kb-filterbar #kb-search { grid-column:1/-1; width:100%; }
  html body #main .kb-filter-inputs :is(input,select,label) { min-width:0; max-width:100%; width:100%; }
  html body #main .kb-advanced-filters>.kb-filter-inputs { display:grid; grid-template-columns:1fr 1fr; }
  html body #main .kb-advanced-filters>summary { min-height:44px; padding-block:12px; }
  html body #main .kb-advanced-filters #kb-direction-select { min-height:44px; }
}

@media (max-width:760px) {
  html body #main .kb-filterbar { flex-direction:column; align-items:stretch; }
  html body #main .kb-filterbar .kb-filter-inputs { flex:none; width:100%; }
  html body #main .kb-scope { flex:none; align-items:center; gap:3px; }
  html body #main .kb-scope button { min-height:44px; }
}

html body.conversation-panel #main .chat-shell { grid-template-columns:minmax(180px,34%) minmax(0,1fr); }
html body.conversation-panel .chat-shell.room-open .chat-rooms { display:flex; }
html body.conversation-panel .back-rooms { display:none; }
html body .office-drawer:not([hidden]):has(iframe:not([hidden])) { width:min(960px,calc(100vw - 64px)); }
@media(max-width:760px) {
 html body .office-drawer:not([hidden]):has(iframe:not([hidden])) { width:100%; }
 html body.conversation-panel #main .chat-shell { grid-template-columns:1fr; }
 html body.conversation-panel .chat-shell.room-open .chat-rooms { display:none; }
 html body.conversation-panel .back-rooms { display:inline-flex; }
}
