/* Shared lot drawer and focus queue. Explicit surface/text pairs replace the
   inherited dark-card colors. Scoped selectors own these components despite
   the legacy presentation cascade; no application state is changed here. */
:root {
  --component-ink: #29251f;
  --component-muted: #625a4e;
  --component-paper: #f6f3ed;
  --component-line: #d5cec2;
  --component-accent: #765b35;
}

.top #coreServerBadge {
  position: static !important;
  width: max-content;
  max-width: 100%;
  margin-top: 8px;
  padding: 5px 8px;
  font-size: 10px;
  line-height: 1.4;
  white-space: normal;
  overflow-wrap: anywhere;
  box-shadow: none;
}

#drawer {
  width: min(460px, 100vw) !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--component-ink);
}
#drawer .drawerHead {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px;
  gap: 8px 12px;
  background: #f4eee4 !important;
  color: var(--component-ink) !important;
  padding: 16px 20px !important;
}
#drawer .drawerHead > div { min-width: 0; }
#drawer .drawerHead h2 { font-size: 28px !important; line-height: 1.2; }
#drawer .drawerHead small, #drawer .drawerHead p { color: var(--component-muted) !important; overflow-wrap: anywhere; }
#drawer .drawerHead .close { flex: 0 0 36px !important; }
#drawer .drawerHead #coreServerBadge {
  position: static !important;
  grid-column: 1 / -1;
  justify-self: start;
  width: auto;
  max-width: 100%;
  margin: 0;
  padding: 4px 8px;
  font-size: 9px;
  line-height: 1.4;
  white-space: normal;
  overflow-wrap: anywhere;
  box-shadow: none;
}
#drawer .drawerBody {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: 16px 20px !important;
}
#drawer .qlLotPhoto { height: 120px; margin-bottom: 12px; }
#drawer .lotHero {
  color: var(--component-ink) !important;
  background: var(--component-paper) !important;
  padding: 16px !important;
}
#drawer .lotHero strong {
  color: var(--component-ink) !important;
  font-size: clamp(24px, 6vw, 30px) !important;
  font-weight: 600;
  line-height: 1.3;
  margin-top: 10px;
  overflow-wrap: anywhere;
}
#drawer .lotHero small {
  color: var(--component-muted) !important;
  font-size: 13px !important;
  line-height: 1.5;
  margin-top: 8px;
}
#drawer .lotMeta { display: flex; flex-wrap: wrap; gap: 4px 12px; }
#drawer .lotMeta > span { min-width: 0; overflow-wrap: anywhere; }
#drawer .lotHero .status { background: #4b3d2b !important; color: #fffaf2 !important; border-color: #4b3d2b !important; }
#drawer .lotStats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  align-items: stretch;
  gap: 8px !important;
  margin-top: 10px;
}
#drawer .lotStats > div {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  min-width: 0;
  min-height: 76px;
  padding: 12px;
  background: var(--component-paper) !important;
}
#drawer .lotStats span { color: var(--component-muted) !important; font-size: 12px !important; line-height: 1.5 !important; }
#drawer .lotStats b { color: var(--component-ink); font-size: 14px !important; line-height: 1.4; margin-top: 6px; overflow-wrap: anywhere; }
#drawer .drawerClient { padding: 12px; border-radius: 6px; border-color: var(--component-line); }
#drawer .drawerClient .label { color: var(--component-muted); font-size: 11px; line-height: 1.4; }
#drawer .drawerClient .who { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 10px; margin-top: 8px; }
#drawer .drawerClient .avatar { width: 36px; height: 36px; min-width: 0; border-radius: 6px; }
#drawer .drawerClient .who > div:last-child { min-width: 0; }
#drawer .drawerClient b { display: block; font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
#drawer .drawerClient .who span { display: block; color: var(--component-muted); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
#drawer .timeline .event span { color: var(--component-muted) !important; font-size: 12px; line-height: 1.5; }
#drawer > .drawerActions {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  margin: 0;
  padding: 12px 20px max(12px, env(safe-area-inset-bottom));
  background: #fff;
  border-top: 1px solid var(--component-line);
}
#drawer .actionStack button {
  min-height: 44px !important;
  height: auto;
  padding: 9px 12px !important;
  line-height: 1.4;
  font-size: 13px !important;
  font-weight: 500 !important;
  white-space: normal;
  overflow-wrap: anywhere;
  border: 1px solid transparent !important;
}
#drawer .actionStack .primary { background: #29231d !important; color: #fffaf2 !important; border-color: #29231d !important; }
#drawer .actionStack .green { background: #fff !important; color: #604b2d !important; border-color: #8d7756 !important; }
#drawer .actionStack .neutral { background: var(--component-paper) !important; color: var(--component-ink) !important; border-color: var(--component-paper) !important; }
#drawer .actionStack button:disabled { opacity: 1; background: #ece9e3 !important; color: #625a4e !important; border-color: #d5cec2 !important; cursor: not-allowed; }
#drawer button:focus-visible, #focusDesk button:focus-visible { outline: 2px solid var(--component-accent) !important; outline-offset: 2px; }

/* Each group gets the available row width. Empty groups stay small instead of
   forcing the longest list into a third of the panel and stretching all lanes. */
#dashboardPage #dashboardGrid > section.focusDesk {
  align-self: start;
  min-width: 0;
  min-height: 0;
  height: auto;
  margin-top: 0 !important;
  padding: 20px 24px !important;
  color: var(--component-ink);
  container-type: inline-size;
}
#focusDesk .focusDeskHead {
  min-height: 0;
  padding: 0 0 14px !important;
  margin: 0;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
#focusDesk .focusDeskHead > div { min-width: 0; }
#focusDesk .focusDeskHead h3 { font-size: 26px !important; line-height: 1.25; color: var(--component-ink) !important; }
#dashboardPage #focusDesk .focusDeskHead > div > span { color: var(--component-muted) !important; font-size: 11px !important; }
#focusDesk .focusDeskHead em { color: #604b2d !important; background: #f1ece2 !important; font-size: 12px !important; line-height: 1.4; white-space: normal; }
#focusDesk .focusDeskGrid { display: flex; flex-direction: column; align-items: stretch !important; gap: 0 !important; min-width: 0; }
#focusDesk .focusLane {
  display: grid;
  grid-template-columns: minmax(155px, 190px) minmax(0, 1fr);
  gap: 16px;
  min-width: 0;
  min-height: 0 !important;
  width: 100%;
  padding: 14px 0 !important;
  border: 0 !important;
  border-bottom: 1px solid var(--component-line) !important;
}
#focusDesk .focusLane:last-child { border-bottom: 0 !important; padding-bottom: 0 !important; }
#focusDesk .focusLaneTitle { align-items: flex-start; gap: 10px; min-width: 0; margin: 0; padding-top: 8px; }
#focusDesk .focusLaneTitle b { color: var(--component-ink); font-size: 13px !important; line-height: 1.5; overflow-wrap: anywhere; }
#focusDesk .focusLaneTitle > span { color: var(--component-muted); font-size: 12px !important; line-height: 1.5; flex: 0 0 auto; }
#focusDesk .focusLaneItems { min-width: 0; }
#focusDesk .focusItem {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) minmax(0, max-content) !important;
  gap: 6px 10px;
  align-items: start;
  padding: 10px 0 !important;
  min-width: 0;
  color: var(--component-ink);
  border-color: var(--component-line) !important;
}
#focusDesk .focusItem > i { margin-top: 6px; }
#focusDesk .focusItemContent { min-width: 0; }
#focusDesk .focusItem b { margin: 0; font-size: 14px !important; font-weight: 600 !important; line-height: 1.4 !important; overflow-wrap: anywhere; }
#focusDesk .focusItem span { font-size: 12px !important; line-height: 1.5 !important; letter-spacing: normal !important; color: var(--component-muted) !important; overflow-wrap: anywhere; }
#focusDesk .focusItem .focusAction { margin-top: 2px; }
#focusDesk .focusItem .focusMeta { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 4px; }
#focusDesk .focusMeta > span { display: inline; margin: 0; min-width: 0; }
#focusDesk .focusItem em { grid-column: 3; grid-row: 1; justify-self: end; max-width: 12em; margin: 0; font-size: 11px !important; line-height: 1.5; white-space: normal; overflow-wrap: anywhere; color: #604b2d !important; background: #eee7dd !important; }
#focusDesk .focusEmpty { padding: 8px 0 !important; font-size: 12px !important; line-height: 1.5; color: var(--component-muted) !important; }
@container (max-width: 680px) {
  #focusDesk .focusLane { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  #focusDesk .focusLaneTitle { padding-top: 0; }
}
@container (max-width: 440px) {
  #focusDesk .focusItem { grid-template-columns: 8px minmax(0, 1fr) !important; }
  #focusDesk .focusItem em { grid-column: 2; grid-row: auto; justify-self: start; }
}
@media (max-width: 900px) {
  #drawer { top: auto !important; bottom: 0 !important; width: 100% !important; height: min(94dvh, 960px) !important; border-radius: 14px 14px 0 0 !important; }
  #drawer .drawerHead { padding: 16px !important; }
  #drawer .drawerBody { padding: 14px 16px !important; }
  #drawer > .drawerActions { padding-inline: 16px; }
}
@media (max-width: 600px) {
  #drawer .lotStats { grid-template-columns: minmax(0, 1fr); }
  #drawer .lotStats > div { min-height: 66px; padding: 10px 12px; }
  #dashboardPage #dashboardGrid > section.focusDesk { padding: 16px !important; }
  #focusDesk .focusDeskHead h3 { font-size: 24px !important; }
}
@media (max-height: 600px) {
  #drawer { height: 100dvh !important; }
  #drawer .drawerHead { padding: 10px 16px !important; }
  #drawer .drawerHead h2 { font-size: 24px !important; }
  #drawer > .drawerActions { padding-top: 8px; padding-bottom: max(8px, env(safe-area-inset-bottom)); gap: 4px; }
}
