/* ASK DAVID composes existing rooms beside a persistent conversation. */
.atlas-app[data-embed='david'] .dw {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 410px;
  grid-template-rows: minmax(0, 1fr);
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}
.dw [hidden] {
  display: none !important;
}
.dw-left {
  min-width: 0;
  overflow: auto;
  padding: 24px;
}
.dw-heading,
.dw-chat-heading,
.dw-widget > header,
.dw-room-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.dw-heading {
  align-items: flex-start;
  margin-bottom: 16px;
}
.dw-heading h1 {
  margin: 4px 0;
  font-size: 26px;
}
.dw-eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.dw-status {
  color: var(--muted);
  font-size: 13px;
  min-height: 18px;
}
.dw-settings {
  max-width: 260px;
  font-size: 13px;
}
.dw-settings summary {
  cursor: pointer;
  padding: 8px;
}
.dw-settings[open] {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.dw-settings label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px;
}
.dw-settings input {
  width: auto;
}
.dw-widgets {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.dw-widget {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  background: var(--surface);
  overflow: auto;
  max-height: 550px;
}
.dw-widget[data-size='M'] {
  grid-column: span 2;
}
.dw-widget[data-size='L'] {
  grid-column: 1 / -1;
}
.dw-widget h2 {
  font-size: 16px;
  margin: 0 0 8px;
}
.dw-widget > header {
  flex-wrap: wrap;
}
.dw-widget .room-card {
  margin: 0;
}
/* Approval actions remain readable even when a saved layout chooses a small card. */
.dw-widget[data-widget='widget-approvals'] .ur-table,
.dw-widget[data-widget='widget-approvals'] .ur-table tbody,
.dw-widget[data-widget='widget-approvals'] .ur-table tr,
.dw-widget[data-widget='widget-approvals'] .ur-table td {
  display: block;
  width: auto;
  min-width: 0;
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
}
.dw-widget[data-widget='widget-approvals'] .ur-table thead {
  display: none;
}
.dw-widget[data-widget='widget-approvals'] .ur-table tr {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.dw-widget[data-widget='widget-approvals'] .pending-actions button,
.dw-widget[data-widget='widget-approvals'] .approval-inbox button {
  white-space: normal;
  word-break: normal;
  overflow-wrap: normal;
  min-width: min(100%, 96px);
}
.dw-widget [data-david-todo] > h1 {
  display: none;
}
.dw-widget [data-david-todo] > form {
  display: grid;
  gap: 8px;
}
.dw-widget [data-david-todo] textarea {
  min-height: 65px;
}
.dw-widget .todo-compact {
  padding: 0;
  border: 0;
}
.dw-widget .todo-compact > p {
  display: none;
}
.todo-add summary {
  cursor: pointer;
  padding: 8px 0;
  color: var(--cyan);
}
.todo-add label {
  display: grid;
  gap: 5px;
  margin-bottom: 8px;
}
.todo-add input,
.todo-add textarea {
  box-sizing: border-box;
  width: 100%;
  border: 1px solid var(--line);
  padding: 8px;
  color: inherit;
  background: var(--surface);
  border-radius: 8px;
}
.todo-widget-row {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.todo-widget-row span {
  color: var(--muted);
}
.today-compact {
  display: grid;
  gap: 12px;
  padding-top: 8px;
}
.dw .today-mobile-tabs {
  display: none;
}
.dw-icons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  padding-bottom: 24px;
}
.dw-icon {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
}
.dw-open {
  width: 100%;
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 10px;
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  min-height: 92px;
}
.dw-symbol {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  color: var(--cyan);
  background: color-mix(in srgb, var(--cyan) 12%, transparent);
  font-size: 24px;
}
.dw-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
}
.dw-controls button,
.dw-controls select {
  font: inherit;
  font-size: 12px;
  color: inherit;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 7px;
  cursor: pointer;
}
.dw-controls select {
  background: var(--surface);
}
.dw-chat {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  border-left: 1px solid var(--line);
  background: var(--surface);
}
.dw-chat-heading {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}
.dw-chat .chat-transcript {
  min-height: 0;
  max-height: none;
  overflow: auto;
  padding: 16px;
}
.dw-chat .chat-composer {
  margin: 0;
  min-width: 0;
  padding: 12px;
}
.dw-chat textarea {
  min-width: 0;
}
.dw-toggle {
  font-size: 12px;
}
.dw-reopen {
  display: none;
}
.dw-room-nav {
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.dw-room .atlas-workspace {
  display: block;
}
.dw-room {
  min-width: 0;
}
.dw[data-chat='collapsed'] {
  grid-template-columns: minmax(0, 1fr) 48px !important;
}
.dw[data-chat='collapsed'] .dw-chat {
  display: none;
}
.dw[data-chat='collapsed'] .dw-reopen {
  display: block;
  writing-mode: vertical-rl;
  border-radius: 0;
}
@media (max-width: 999px) and (min-width: 600px) {
  .atlas-app[data-embed='david'] .dw:not([data-chat='open']) {
    grid-template-columns: minmax(0, 1fr) 48px;
  }
  .dw:not([data-chat='open']) .dw-chat {
    display: none;
  }
  .dw:not([data-chat='open']) .dw-reopen {
    display: block;
    writing-mode: vertical-rl;
    border-radius: 0;
  }
  .dw-widgets {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 599px) {
  .atlas-app[data-embed='david'] .dw {
    display: block;
    position: relative;
  }
  .dw-left {
    height: 100dvh;
    padding: 16px 16px 70px;
    box-sizing: border-box;
  }
  .dw-widgets {
    display: block;
  }
  .dw-widget {
    margin-bottom: 12px;
  }
  .dw-heading {
    flex-wrap: wrap;
  }
  .dw-chat {
    height: 100dvh;
    border: 0;
  }
  .dw[data-view='chat'] .dw-left,
  .dw[data-view='chat'] .dw-reopen {
    display: none;
  }
  .dw[data-view='chat'] .dw-chat {
    display: grid;
  }
  .dw[data-view='workspace'] .dw-chat {
    display: none;
  }
  .dw[data-view='workspace'] .dw-reopen {
    display: block;
    position: absolute;
    bottom: 16px;
    right: 16px;
    writing-mode: horizontal-tb;
    border-radius: 24px;
  }
}
