/* App content sits on one page surface. Structure comes from spacing and dividers. */
#app .sidebar { background: transparent; border-right: 0; }
#app .card, #modal .card { padding: 0; background: transparent; border: 0; border-radius: 0; box-shadow: none; }
#app .empty { border: 0; border-radius: 0; padding: 36px 0; text-align: left; }
#app .project {
  padding: 24px 0; min-height: 0; border-bottom: 1px solid var(--line);
  background: transparent; border-radius: 0; box-shadow: none;
}
#app .project:hover, #app .note-list button:hover { box-shadow: none; }
#app .project[hidden] { display: none; }
#app .project:hover h2, #app .note-list button:hover strong { color: var(--accent); }
#app .project .sep { display: none; }
#app .project .mono { margin-top: 18px; }
#app .grid { gap: 16px 32px; }
#app .workspace { gap: 32px; }
#app .area-panel { padding: 0 20px 0 0; border-right: 1px solid var(--line); }
#app .tree { padding: 0; }
#app .tree button { border-radius: 0; }
#app .tree button.selected { background: transparent; color: var(--accent); }
#app .area-row { display: flex; align-items: center; gap: 4px; min-width: 0; }
#app .area-row .area-select { flex: 1; min-width: 0; }
#app .area-row .area-edit {
  flex: none; display: grid; place-items: center; width: 44px; height: 44px;
  margin: 0; padding: 12px; color: var(--muted);
}
#app .area-row .area-edit:hover { color: var(--accent); }
#app .area-edit svg { width: 18px; height: 18px; }
#app .note-list { gap: 0; }
#app .note-list button {
  padding: 22px 0; border: 0; border-bottom: 1px solid var(--line);
  border-radius: 0; background: transparent; box-shadow: none;
}
#app .tabs { padding: 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; }
#app .tabs button { padding: 12px 16px; border-radius: 0; border-bottom: 2px solid transparent; }
#app .tabs .selected { background: transparent; border-bottom-color: var(--accent); }
#app .badge { padding: 0 8px 0 0; border: 0; border-radius: 0; background: transparent; }
#app .repo { padding: 18px 0; margin: 0; background: transparent; border-radius: 0; border-bottom: 1px solid var(--line); }
#app .table-wrap { padding: 0; }
#app .search, #app .chat-search input {
  padding: 12px 0; background: transparent; border: 0;
  border-bottom: 1px solid var(--line); border-radius: 0;
}
#app .search:focus, #app .chat-search input:focus { border-bottom-color: var(--accent); }
#app .notice, #modal .notice { padding: 0; background: transparent; border: 0; }
#modal .grant { padding: 24px 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; }
#modal pre { border: 0; border-radius: 4px; }
dialog { border: 0; border-radius: 10px; background: var(--bg); }
.token-copy-field { display: flex; align-items: center; gap: 12px; }
.token-copy-field input { flex: 1; min-width: 0; }
.token-copy-field button { flex: none; font-size: .8rem; }

/* Conversation panes have no enclosing card, inset panels or coloured headers. */
#app .chat-layout { grid-template-rows: minmax(0,1fr); border: 0; border-radius: 0; background: transparent; }
#app .chat-sidebar { min-height: 0; padding-right: 24px; background: transparent; border-right: 1px solid var(--line); }
#app .chat-search { padding: 0 0 14px; }
#app .chat-folders { display: flex; gap: 22px; margin-bottom: 12px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
#app .chat-folders button { padding: 10px 0; background: transparent; border: 0; border-bottom: 2px solid transparent; border-radius: 0; color: var(--muted); }
#app .chat-folders button[aria-selected=true] { color: var(--accent); border-bottom-color: var(--accent); }
#app .chat-search { flex-shrink: 0; }
#app .chat-thread-list { padding: 0 0 12px; scrollbar-width: thin; scrollbar-color: #364550 transparent; }
#app .chat-thread { padding: 18px 0; border-radius: 0; border-bottom: 1px solid var(--line); }
#app .chat-thread:hover { background: #ffffff03; }
#app .chat-thread.selected { background: transparent; }
#app .chat-thread.selected strong { color: var(--accent); }
#app .chat-detail { padding-left: 24px; background: transparent; }
#app .chat-header { padding: 0 0 16px; background: transparent; }
#app .chat-messages { padding: 16px 0 20px; background: transparent; }
#app .chat-bubble { border: 0; box-shadow: none; }
#app .chat-composer { padding: 14px 0 8px; background: transparent; border: 0; }
#app .chat-composer textarea { border-radius: 12px; }
#app .chat-composer textarea:focus { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Fit the actual viewport after the page heading, keeping both panes scrollable. */
@media (min-width: 751px) {
  #app .chat-main { display: flex; flex-direction: column; min-height: 0; height: 100vh; height: 100dvh; }
  #app .chat-topbar { flex-shrink: 0; }
  #app .chat-main .chat-layout { flex: 1; min-height: 0; height: auto; overflow: visible; }
  #app .chat-shell .sidebar { height: 100vh; height: 100dvh; overflow-y: auto; overscroll-behavior: contain; }
}

/* A canvas and its floating tools remain distinct, without stacked outlines. */
#app .graph-shell { border: 0; border-radius: 0; }
#app .graph-command { border: 0; border-radius: 8px; box-shadow: none; }
#app .graph-selection { border: 0; border-radius: 8px; box-shadow: none; }

@media (max-width: 750px) {
  #app .grid { gap: 0; }
  #app .project { padding: 24px 0; }
  #app .area-panel { padding: 0; border: 0; border-bottom: 1px solid var(--line); }
  #app .area-panel summary { padding: 15px 0; }
  #app .area-panel details[open] summary { border-bottom: 0; }
  #app .tree { padding: 0 0 14px; }
  #app .tabs { gap: 0; }
  #app .tabs button { padding: 12px 2px; }
  #app .sessions-table tr, #app .audit-table tr {
    padding: 22px 0; margin-bottom: 0; background: transparent;
    border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
  }
  #app .sessions-table td:last-child { border-top: 0; margin-top: 0; padding-top: 12px; }
  #app .chat-sidebar { padding-right: 0; border-right: 0; }
  #app .chat-detail { padding-left: 0; }
  #app .chat-layout.has-active { background: var(--bg); }
  #app .chat-header { padding: calc(12px + env(safe-area-inset-top)) 12px 12px; }
  #app .chat-messages { padding: 12px 15px 20px; }
  #app .chat-composer {
    padding: 10px max(12px,env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left));
    background: var(--bg);
  }
  dialog { border-radius: 0; }
}

/* A single action menu works with pointer, keyboard and the mobile header. */
.chat-context-menu { position: fixed; z-index: 1000; min-width: 220px; max-width: calc(100vw - 16px); padding: 6px; background: var(--panel, #151d25); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 36px #0005; }
.chat-context-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px; text-align: left; background: transparent; border: 0; border-radius: 6px; color: var(--text); }
.chat-context-menu button:hover, .chat-context-menu button:focus-visible { background: #ffffff0c; outline: 1px solid var(--accent); }
.chat-context-menu svg, #app .chat-menu-button svg { width: 20px; height: 20px; flex-shrink: 0; }
#app .chat-menu-button { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; flex-shrink: 0; background: transparent; border: 0; }
#modal .chat-members { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 18px; overflow-wrap: anywhere; color: var(--muted); }
#modal .chat-add-members { border: 0; padding: 0; margin: 24px 0; min-width: 0; }
#modal .chat-add-members legend { font-weight: 600; padding: 0; }
#modal .chat-add-members .checks { max-height: 35dvh; overflow-y: auto; }
@media (max-width: 750px) { #app .chat-header .chat-resolve { display: none; } }

.note-filters { display: flex; align-items: center; gap: 18px; margin-bottom: 20px; }
#app .note-filters .search { margin: 0; flex: 1; min-width: 0; }
.note-filters select { width: auto; max-width: 220px; background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
.note-status { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: .82rem; margin: 5px 12px 5px 0; }
.note-status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.note-status.in_progress { color: var(--cyan); }
.note-status.completed { color: var(--accent); }
.note-workflow { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; margin-top: 18px; }
.note-workflow .note-status { margin: 0; }
.note-workflow button { margin-left: auto; font-size: .85rem; }
@media (max-width: 550px) { .note-filters { align-items: stretch; flex-direction: column; gap: 10px; } .note-filters select { width: 100%; max-width: none; } }
