:root {
  --ink: #1c1c1c;
  --muted: #6b6b6b;
  --line: #e2e2e2;
  --accent: #1f5c8b;
  --bg: #fafafa;
  --shell: #0f151d;   /* dark header/footer, matches the engineering wiki */
  --cyan: #35c9d6;    /* wiki accent */
}

* { box-sizing: border-box; }

/* Match Material for MkDocs (the engineering wiki) root scaling, so the
   header/footer track the wiki's size at every viewport width. rem is used
   ONLY in the header/footer; the rest of the app is px, so nothing else moves. */
html { font-size: 125%; }
@media screen and (min-width: 100em) { html { font-size: 137.5%; } }
@media screen and (min-width: 125em) { html { font-size: 150%; } }

/* Smooth cross-page navigation in Chromium (Chrome/Edge): the browser crossfades
   between pages instead of flashing white, and the named header/footer stay put
   while only the content swaps. Unsupported browsers just navigate normally. */
@view-transition { navigation: auto; }
header { view-transition-name: site-header; }

html, body { height: 100%; }
body {
  margin: 0;
  height: 100vh;
  overflow: hidden;                 /* the header + sidebar stay put; only content scrolls */
  display: flex;
  flex-direction: column;
  font: 15px/1.5 Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

/* Header matches Material for MkDocs (the engineering wiki) exactly:
   2.4rem bar, 2rem logo, .9rem/700 title, 1rem gap, ~.55rem left inset. */
header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 20px 8px 12px;
  background: var(--shell);
  color: #e6edf3;
  z-index: 20;
}
.brand { display: flex; align-items: center; color: #fff; text-decoration: none; }
.brand-logo { height: 32px; width: auto; display: block; }
.brand span { margin-left: 12px; font-size: 18px; font-weight: 700; }

.user-block { display: flex; align-items: center; gap: 16px; }
.user-meta { display: flex; flex-direction: column; line-height: 1.2; text-align: right; }
.user-name { color: #fff; font-size: 14px; font-weight: 600; }
.user-role { color: rgba(230, 237, 243, .6); font-size: 12px; text-transform: capitalize; }
.signout { color: #cfe9ec; text-decoration: none; font-size: 14px; }
.signout:hover { color: var(--cyan); }

/* App shell: frozen header (above) + frozen sidebar + scrollable content pane. */
.layout { flex: 1 1 auto; display: flex; min-height: 0; overflow: hidden; }
.sidebar {
  flex: 0 0 190px;
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 14px 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.sidebar-logo { margin-top: auto; padding: 10px 2px 8px; }
.sidebar-logo img { display: block; width: 100%; margin: 0 auto;
  -webkit-user-drag: none; user-select: none; pointer-events: none; }
.loadbar { height: 5px; width: 100%; max-width: 150px; margin: 0 auto 8px; background: #e6eaee;
  border-radius: 3px; overflow: hidden; }
.loadbar[hidden] { display: none; }
.loadbar-fill { height: 100%; width: 40%; background: var(--accent); border-radius: 3px;
  animation: loadbar-slide 1.1s ease-in-out infinite; }
@keyframes loadbar-slide { 0% { transform: translateX(-110%); } 100% { transform: translateX(360%); } }
.tab {
  display: block;
  padding: 10px 22px;
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  border-left: 3px solid transparent;
}
.tab:hover { background: #f4f6f8; }
.tab.active { border-left-color: var(--accent); background: #eef4f9; color: var(--accent); font-weight: 600; }

.preview-control { margin-top: 20px; padding: 14px 22px 0; border-top: 1px solid var(--line); }
.preview-label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 6px; }
.preview-control select { width: 100%; padding: 6px 8px; font-size: 13px; border: 1px solid var(--line); border-radius: 6px; }

.preview-banner {
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 20px;
  background: #fff3cd; border-bottom: 1px solid #f0dca8; color: #6b5300; font-size: 13px;
}
.preview-banner .link-btn { color: #6b5300; text-decoration: underline; font-weight: 600; padding: 0; }

.reset-form { margin-top: 8px; }
.settings-form input:disabled, .settings-form select:disabled {
  background: #f4f6f8; color: var(--muted); cursor: not-allowed;
}

main {
  flex: 1 1 auto;
  min-width: 0;
  overflow: auto;
  padding: 28px 32px;
}


h1 { font-size: 22px; margin: 0 0 20px; }
h2 { font-size: 15px; margin: 28px 0 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

a { color: var(--accent); }

.btn {
  display: inline-block;
  padding: 8px 14px;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 6px;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: #17466b; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.num { text-align: right; }

.empty, .crumb { color: var(--muted); }

.toolbar { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; flex-wrap: wrap; }

.search {
  flex: 1;
  max-width: 420px;
  padding: 9px 12px;
  font-size: 15px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
}

.error {
  padding: 10px 14px;
  background: #fdecea;
  border: 1px solid #f5c2bd;
  border-radius: 6px;
  color: #8a1c12;
}

.success {
  padding: 10px 14px;
  background: #e9f7ef;
  border: 1px solid #b7e1c6;
  border-radius: 6px;
  color: #1c6b3f;
}

.form select {
  padding: 8px 10px;
  font-size: 15px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
}
.form select[size] { padding: 0; }
.form select[size] option { padding: 6px 10px; }
.hint { color: var(--muted); font-size: 12px; }

.form.wide { max-width: 620px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 14px; font-weight: 600; color: var(--ink); }

.locked {
  margin-top: 4px; padding: 8px 12px; border-radius: 6px;
  background: #e9f7ef; border: 1px solid #b7e1c6; color: #1c6b3f; font-size: 14px;
}
.locked-check { font-weight: 700; margin-right: 4px; }

.filelist {
  border: 1px solid var(--line); border-radius: 6px; max-height: 300px;
  overflow-y: auto; background: #fff;
}
.filegroup:not(:last-child) { border-bottom: 1px solid var(--line); }
.filegroup-head {
  padding: 7px 12px; background: #f6f8fa; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  border-bottom: 1px solid var(--line); position: sticky; top: 0;
}
.fileitem {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px 9px 16px;
  font-size: 14px; cursor: pointer;
}
.fileitem:hover { background: #f6f8fa; }
.fileitem input { margin: 0; flex: 0 0 auto; }
.fileitem-name { flex: 1; }

.dest { font-size: 14px; }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50;
}
.modal-overlay[hidden] { display: none; }
.modal-box {
  background: #fff; border-radius: 10px; padding: 24px; max-width: 460px; width: 100%;
  box-shadow: 0 12px 40px rgba(0,0,0,.2);
}
.modal-box h2 { margin: 0 0 16px; font-size: 18px; text-transform: none; letter-spacing: 0; color: var(--ink); }
.summary { display: grid; grid-template-columns: 90px 1fr; gap: 8px 16px; margin: 0 0 20px; }
.summary dt { color: var(--muted); font-size: 13px; }
.summary dd { margin: 0; font-size: 14px; }
.summary ul { margin: 0; padding-left: 18px; }
.link-btn { background: none; border: 0; color: var(--accent); cursor: pointer; font-size: 14px; padding: 8px; }

.inline-form { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 12px; align-items: center; }
.inline-form input, .inline-form select {
  padding: 8px 10px; font-size: 14px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink);
}
.row-form { display: inline; margin: 0; }
.row-form select { padding: 4px 8px; font-size: 13px; border: 1px solid var(--line); border-radius: 6px; }

.form { display: flex; flex-direction: column; gap: 14px; max-width: 460px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
.form input {
  padding: 8px 10px;
  font-size: 15px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
}
.req { color: #b23; font-size: 12px; }
.actions { display: flex; align-items: center; gap: 16px; }

.meta { display: grid; grid-template-columns: 140px 1fr; gap: 6px 16px; margin: 0 0 8px; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; }

/* Project file lists */
.file-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 6px; max-width: 560px; }
.doc-section { margin-top: 28px; max-width: 560px; }
.doc-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.doc-head h2 { margin: 0; }
.bulk-bar { display: none; align-items: center; gap: 14px; margin-left: auto; }
.doc-section.selecting .bulk-bar { display: flex; }
.bulk-count { font-size: 12px; color: var(--muted); }
.file-check { display: none; flex: 0 0 auto; width: 17px; height: 17px; cursor: pointer; accent-color: var(--accent); }
.doc-section.selecting .file-check { display: inline-block; }
.doc-section.selecting .file-card, .doc-section.selecting .file-link { cursor: pointer; }
.file-card { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; background: #fff;
  transition: border-color .12s, box-shadow .12s; }
.file-card:hover { border-color: var(--accent); box-shadow: 0 1px 6px rgba(0,0,0,.06); }
.file-link { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; text-decoration: none; }
.file-card:hover .file-name { text-decoration: underline; }
.file-text { display: flex; flex-direction: column; min-width: 0; }
.file-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.file-meta { font-size: 12px; color: var(--muted); }
.file-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.kebab-wrap { position: relative; }
.kebab-btn { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 20px;
  line-height: 1; padding: 2px 8px; border-radius: 6px; }
.kebab-btn:hover { background: #eef1f3; color: var(--ink); }
.kebab-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 60; min-width: 148px;
  background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 28px rgba(0,0,0,.14);
  padding: 6px; display: flex; flex-direction: column; }
.kebab-menu[hidden] { display: none; }
.kebab-item { background: none; border: 0; text-align: left; padding: 8px 10px; border-radius: 6px;
  font-size: 14px; color: var(--ink); cursor: pointer; }
.kebab-item:hover { background: #f2f5f7; }
.kebab-item.danger { color: #d64545; }
.kebab-item.danger:hover { background: #fdecec; }
.danger-btn { background: #d64545; }
.danger-btn:hover { background: #b02a2a; }
.btn-block { display: block; width: 100%; max-width: 560px; text-align: center;
  box-sizing: border-box; margin: 6px 0 24px; }
.innergy-btn { background: #e1523d; }
.innergy-btn:hover { background: #c8442f; }

/* Innergy upload dialog */
.innergy-box { max-width: 560px; }
.innergy-field { margin-bottom: 16px; }
.innergy-field .field-label { font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); margin-bottom: 6px; }
.innergy-box input[type="text"] { width: 100%; padding: 8px 10px; font-size: 14px; border: 1px solid var(--line);
  border-radius: 6px; margin-bottom: 6px; box-sizing: border-box; }
.innergy-box select { width: 100%; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; padding: 2px; }

/* Opportunity picker (create form) + linked-opportunity control */
.opp-select { width: 100%; max-width: 460px; border: 1px solid var(--line); border-radius: 6px;
  font-size: 13px; padding: 2px; margin-top: -6px; }
.opp-chosen { font-size: 14px; color: var(--ink); }
.linked-opp { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; margin: 0;
  font-size: 12px; color: var(--muted); }
.linked-opp strong { color: var(--ink); }
.linked-opp-actions { display: flex; align-items: center; gap: 12px; }
.radio-row { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 4px 0; }
.radio-row .hint { display: inline; }
.mini-link { background: none; border: 0; color: var(--accent); cursor: pointer; font-size: 13px;
  padding: 0; text-decoration: underline; font-family: inherit; }
.mini-link.danger { color: #d64545; }
.inline-form-min { display: inline; margin: 0; }
.opp-selected { margin-top: 8px; font-size: 14px; color: var(--ink); }
.opp-link { color: var(--accent); text-decoration: none; margin-left: 8px; white-space: nowrap; }
.opp-link:hover { text-decoration: underline; }
.check-list { list-style: none; margin: 0; padding: 0; max-height: 220px; overflow-y: auto;
  border: 1px solid var(--line); border-radius: 8px; }
.check-group { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
  background: #f5f7f8; padding: 6px 12px; }
.check-row { border-top: 1px solid var(--line); }
.check-row label { display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer;
  font-size: 14px; margin: 0; }
.check-row label:hover { background: #f7f9fa; }
.check-empty { padding: 12px; color: var(--muted); font-size: 14px; }

/* Users & access */
.role-legend { display: flex; flex-direction: column; gap: 10px; margin: 14px 0 24px; max-width: 640px; }
.role-legend-item { display: flex; align-items: center; gap: 12px; }
.role-legend-desc { font-size: 14px; color: var(--muted); }
.role-badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 11px;
  border-radius: 999px; min-width: 82px; text-align: center; }
.role-estimator { background: #e9edf1; color: #55606b; }
.role-director { background: #dbe9fb; color: #1f5bb0; }
.role-admin { background: #fdeecd; color: #8a6314; }
.users-table { max-width: 720px; }
.users-table td { vertical-align: middle; }
.users-table .col-actions { width: 44px; text-align: right; }

/* Role permissions matrix */
.perm-form { max-width: 560px; margin: 4px 0 26px; }
.perm-table { width: 100%; border-collapse: collapse; margin-bottom: 14px; font-size: 14px; }
.perm-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); padding: 6px 10px; border-bottom: 1px solid var(--line); font-weight: 600; }
.perm-table th:not(:first-child), .perm-table .perm-cell { text-align: center; width: 84px; }
.perm-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); }
.perm-cell input { width: 16px; height: 16px; cursor: pointer; }
.perm-cell input:disabled { cursor: default; opacity: .6; }

/* Generate-budget action + dialog */
.primary-actions { margin: 2px 0 22px; display: flex; align-items: center; gap: 12px; }
.btn-stop { background: #55606b; }
.btn-stop:hover { background: #3f474f; }
.gen-box { max-width: 560px; }
.gen-label { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 4px 0 6px; }
.gen-instructions { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); margin-top: 18px; }
.gen-instructions-label { color: var(--muted); }
.gen-instructions .optional { font-weight: 400; font-size: 12px; }
.gen-instructions textarea { padding: 8px 10px; font-size: 14px; border: 1px solid var(--line);
  border-radius: 6px; color: var(--ink); font-family: inherit; resize: vertical; }
.gen-instructions textarea:focus { outline: none; border-color: var(--accent); }
.gen-box .actions { margin-top: 20px; }
.warn { background: #fef3cd; color: #8a6d00; border-radius: 6px; padding: 8px 12px;
  font-size: 13px; margin: 0 0 14px; }
.file-ext { flex: 0 0 auto; font-size: 10px; font-weight: 700; letter-spacing: .04em; color: #fff;
  background: #8a97a6; border-radius: 4px; padding: 3px 6px; min-width: 36px; text-align: center; }
.ext-pdf { background: #e4572e; }
.ext-png, .ext-jpg, .ext-jpeg, .ext-gif, .ext-webp { background: #3a7bd5; }
.ext-md, .ext-txt { background: #5a6b7b; }
.ext-xlsx, .ext-xls, .ext-csv { background: #1d8a4e; }
.ext-docx, .ext-doc { background: #2b579a; }
.drive-link { flex: 0 0 auto; font-size: 12px; color: var(--muted); text-decoration: none; }
.drive-link:hover { text-decoration: underline; }

/* Drag-and-drop upload */
.upload-form { display: flex; flex-direction: column; gap: 12px; max-width: 560px; }
.dropzone { position: relative; display: block; border: 2px dashed var(--line); border-radius: 12px;
  background: #fafbfc; padding: 30px 24px; text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s; }
.dropzone:hover { border-color: var(--accent); background: #f4fbfc; }
.dropzone.is-drag { border-color: var(--accent); background: #eaf9fb; }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dz-prompt { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--muted); }
.dz-prompt strong { color: var(--ink); font-size: 15px; }
.dz-prompt svg { width: 32px; height: 32px; }
.dz-hint { font-size: 13px; }
.dz-files { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.dz-files[hidden] { display: none; }
.dz-files li { font-size: 13px; color: var(--ink); background: #eef1f3; border-radius: 6px; padding: 6px 10px; }

/* In-window file viewer */
.viewer-box { max-width: 960px; height: 85vh; display: flex; flex-direction: column; padding: 16px; }
.viewer-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.viewer-actions { display: flex; align-items: center; gap: 14px; }
.viewer-actions a { color: var(--accent); font-size: 14px; text-decoration: none; }
.viewer-actions a:hover { text-decoration: underline; }
#viewer-frame { flex: 1; width: 100%; border: 1px solid var(--line); border-radius: 6px; background: #fff; }

/* Project header + summary card */
.project-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 0 0 8px; }
.project-head h1 { margin: 0; }
.status-badge { font-size: 12px; font-weight: 600; padding: 3px 11px; border-radius: 999px;
  background: #eef1f3; color: var(--muted); text-transform: none; letter-spacing: 0; white-space: nowrap; }
.status-in-progress { background: #fef3cd; color: #8a6d00; }
.status-closed-won { background: #d8f5e3; color: #12703c; }
.status-closed-lost { background: #fde0e0; color: #b02a2a; }
.status-inactive { background: #e9edf1; color: #66707a; }
.status-open { background: #d8f5e3; color: #12703c; }
.status-closed { background: #e9edf1; color: #66707a; }
.status-generating { background: #fef3cd; color: #8a6d00; }
.col-actions { width: 44px; text-align: right; }
.gen-status { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600;
  color: #8a6d00; background: #fef3cd; padding: 3px 11px; border-radius: 999px; }
.spinner { width: 12px; height: 12px; border: 2px solid rgba(138,109,0,.25); border-top-color: #8a6d00;
  border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.project-summary { border: 1px solid var(--line); border-radius: 12px; background: #fff;
  padding: 18px 20px; margin: 0 0 22px; max-width: 720px; }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 16px 24px; }
.summary-item { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.summary-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.summary-value { font-size: 15px; color: var(--ink); }
.summary-total .summary-value { font-size: 20px; font-weight: 700; color: #12703c; }
.summary-foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.summary-folder { font-family: Consolas, monospace; }

/* Collapsible budget document */
.budget-doc { border: 1px solid var(--line); border-radius: 12px; background: #fff; margin: 0 0 24px; overflow: hidden; }
.budget-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; cursor: pointer; list-style: none; user-select: none; }
.budget-summary::-webkit-details-marker { display: none; }
.budget-summary:hover { background: #f7f9fa; }
.budget-summary-main { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--ink); }
.chevron { width: 18px; height: 18px; color: var(--accent); transition: transform .15s; flex: 0 0 auto; }
.budget-doc[open] .chevron { transform: rotate(90deg); }
.budget-summary-total { font-weight: 700; color: #12703c; }
.when-open { display: none; }
.budget-doc[open] .when-closed { display: none; }
.budget-doc[open] .when-open { display: inline; }
.budget-doc-body { padding: 0 20px 20px; border-top: 1px solid var(--line); }
.budget-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 6px; }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.gen-notes-used { background: #f5f7f8; border-left: 3px solid var(--accent); padding: 8px 12px;
  margin: 12px 0; font-size: 13px; color: var(--ink); border-radius: 0 6px 6px 0; }

/* Edit-budget chat (two-pane: budget preview on the left, chat on the right) */
.edit-budget-box { max-width: 1060px; width: 94vw; }
.eb-head { display: flex; align-items: center; justify-content: space-between; }
.eb-head h2 { margin: 0; }
.eb-x { background: none; border: 0; font-size: 26px; line-height: 1; color: var(--muted);
  cursor: pointer; padding: 0 4px; }
.eb-x:hover { color: var(--ink); }
.eb-body { display: flex; gap: 18px; align-items: stretch; margin-top: 12px; }
.eb-preview { flex: 1 1 55%; min-width: 0; max-height: 72vh; overflow-y: auto; border: 1px solid var(--line);
  border-radius: 8px; padding: 16px 18px; background: #fff; font-size: 12.5px; }
.eb-side { flex: 1 1 45%; min-width: 0; display: flex; flex-direction: column; }
.eb-chat { margin: 10px 0; flex: 1 1 auto; max-height: 40vh; overflow-y: auto; display: flex;
  flex-direction: column; gap: 8px; }
.eb-chat:empty { display: none; }
.eb-msg { padding: 8px 12px; border-radius: 10px; font-size: 14px; line-height: 1.4; max-width: 85%;
  white-space: pre-wrap; word-wrap: break-word; }
.eb-user { align-self: flex-end; background: var(--accent); color: #fff; }
.eb-bot { align-self: flex-start; background: #eef1f3; color: var(--ink); }
.eb-error { align-self: flex-start; background: #fdecea; color: #b3261e; }
.eb-spin { display: inline-block; width: 13px; height: 13px; vertical-align: -2px; margin-right: 7px;
  border: 2px solid rgba(0,0,0,.18); border-top-color: var(--accent); border-radius: 50%;
  animation: spin .8s linear infinite; }
.edit-budget-box textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px;
  font-family: inherit; font-size: 14px; resize: vertical; box-sizing: border-box; }
@media (max-width: 760px) {
  .eb-body { flex-direction: column; }
  .eb-preview { max-height: 40vh; }
}

/* Notes / comments */
.notes-h { display: flex; align-items: center; gap: 8px; }
.notes-icon { width: 20px; height: 20px; color: var(--accent); }
.comment-form { display: flex; flex-direction: column; gap: 8px; max-width: 560px; margin: 0 0 16px; }
.comment-form textarea { padding: 8px 10px; font-size: 14px; border: 1px solid var(--line);
  border-radius: 6px; font-family: inherit; resize: vertical; }
.comment-form textarea:focus { outline: none; border-color: var(--accent); }
.comment-form .btn { align-self: flex-start; }
.comment-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column;
  gap: 8px; max-width: 560px; }
.comment { border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; background: #fff; }
.comment-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.comment-who { font-weight: 600; color: var(--ink); font-size: 14px; }
.comment-when { font-size: 12px; color: var(--muted); }
.comment-when::before { content: "· "; }
.comment-del-btn { margin-left: auto; }
.comment-text { font-size: 14px; color: var(--ink); white-space: pre-wrap; word-break: break-word; }

/* Activity feed as an aligned table (scrolls past ~10 rows) */
.activity-scroll { max-height: 440px; overflow-y: auto; }
.activity-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.activity-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); padding: 6px 16px 6px 0; border-bottom: 1px solid var(--line); font-weight: 600;
  position: sticky; top: 0; background: #f7f8fa; z-index: 1; }
.activity-table td { padding: 9px 16px 9px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.act-when { white-space: nowrap; color: var(--muted); }
.act-who { white-space: nowrap; color: var(--ink); }
.act-action { white-space: nowrap; font-weight: 600; color: var(--ink); }
.act-detail { color: var(--muted); word-break: break-word; }
.budget-rendered { color: var(--ink); line-height: 1.5; }
.budget-rendered h1 { font-size: 22px; margin: 4px 0 2px; }
.budget-rendered h2 { font-size: 16px; margin: 20px 0 8px; border-bottom: 2px solid var(--accent);
  padding-bottom: 4px; text-transform: none; letter-spacing: 0; }
.budget-rendered h3 { font-size: 14px; margin: 14px 0 6px; }
.budget-rendered table { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 14px; }
.budget-rendered th, .budget-rendered td { border: 1px solid var(--line); padding: 6px 9px; text-align: left; }
.budget-rendered th { background: var(--ink); color: #fff; }
.budget-rendered tr:nth-child(even) td { background: #f5f7f8; }
.budget-rendered td:last-child, .budget-rendered th:last-child { text-align: right; }
.budget-rendered code { background: #f0f2f4; padding: 1px 4px; border-radius: 3px; font-size: 13px; }
.budget-rendered ul, .budget-rendered ol { padding-left: 20px; }

.topnav { display: flex; align-items: center; gap: 16px; }
.who { color: var(--muted); font-size: 13px; }

.login { max-width: 420px; }
.login .btn { margin-top: 6px; }

.settings-form label { gap: 3px; }
.field-help { color: var(--muted); font-size: 12px; }

.edit-form { display: flex; flex-direction: column; gap: 12px; }
.code-edit {
  width: 100%; min-height: 540px; padding: 12px;
  font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  border: 1px solid var(--line); border-radius: 6px; color: var(--ink);
  background: #fff; resize: vertical; white-space: pre;
}

.history { list-style: none; margin: 10px 0 0; padding: 0; }
.history li {
  display: flex; align-items: center; gap: 14px;
  padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px;
}
.history li:last-child { border-bottom: 0; }
.history .ts { color: var(--muted); font-variant-numeric: tabular-nums; }
.revert-form { margin: 0 0 0 auto; }

.activity { list-style: none; margin: 0; padding: 0; }
.activity li { padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.activity .ts { color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 10px; }
.activity .act {
  display: inline-block; min-width: 66px; font-weight: 600; text-transform: capitalize;
}
.activity .by { color: var(--ink); }
.activity .detail { color: var(--muted); }
code {
  font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: #f0f0f0;
  padding: 1px 5px;
  border-radius: 4px;
}
