/* Shared navy, cream and gold palette; dense rows without hiding phone actions. */
:root{--ink:#0B3053;--green:#876439;--deep:#0B3053;--muted:#687781;--line:#DFE1DF;--soft:#ECEAE5;--accent:#876439;color:var(--ink)}
button:focus-visible,input:focus-visible{outline-color:#876439}.nav-item.active,.nav-item:hover{background:#EDF0F3;color:var(--deep)}
.button.primary:hover{background:#17486F}.button.secondary{background:#ECEAE5;border-color:#E3DFD7}.button,.sidebar .nav-item,.template-panel,.document-table-wrap,.badge{border-radius:5px}
.nav-item,.button,.text-button,.tab{font-size:13px}.muted,.eyebrow,.legacy-note,.save-state,.doc-name small,.document-table th,.badge{font-size:12px}
.list-view,.editor-view{padding-top:24px}.page-head{margin-bottom:18px}.page-head h1{font-size:25px}.document-table td{padding-block:12px;font-size:13px}.document-table th{padding-block:10px}
.doc-name{min-width:0}.doc-name>span:last-child{min-width:0}.doc-name strong{font-size:14px;overflow-wrap:anywhere}.doc-name .doc-update{display:none}.doc-icon{flex-shrink:0;background:#F1EBE0;color:#876439;border-radius:4px}
.document-table .badge{background:#E9EDF2;color:#0B3053}.template-choice{background:#FAF9F6}.template-choice:hover{border-color:#876439;background:#F8F6F1}.template-choice strong{font-size:14px}.template-choice p{font-size:12px}
.editor-toolbar button,.sheet-tab,.sheet-actions input,.sheet-filters select,.sheet-grid,.sheet-grid td input,.sheet-grid select,.sheet-foot,.editor-bottom{font-size:13px}.sheet-grid th{background:#ECEAE5;color:#0B3053}.sheet-grid td input:focus{box-shadow:inset 0 0 0 2px #876439}.sheet-tab.active{background:#E9EDF2;color:#0B3053}
.panel-content label,.panel-content input,.panel-content textarea,.panel-content select,.panel-row,.ai-result,.comment-box{font-size:13px}.editor-toolbar .ai-button{background:#F1EBE0;color:#876439}
@media(max-width:700px){
 .sidebar{position:relative}.sidebar nav{gap:2px}.nav-item{font-size:13px;min-height:40px}.list-view,.editor-view{padding:18px 12px 30px}
 .document-table-wrap{overflow:visible;min-height:180px}.document-table{min-width:0;width:100%;table-layout:fixed}.document-table th,.document-table td{padding:12px 8px}
 .document-table th:first-child,.document-table td:first-child{padding-left:12px;width:auto}.document-table th:nth-child(n+2):nth-child(-n+5),.document-table td:nth-child(n+2):nth-child(-n+5){display:none}
 .document-table th:last-child,.document-table td:last-child{width:30px;padding:8px}.doc-name{gap:9px}.doc-icon{width:29px;height:32px}.doc-name strong{font-size:14px}.doc-name .doc-update{display:block}.doc-name small{font-size:12px}
 .head-actions{flex-wrap:wrap}.search{flex:1;min-width:160px}.search input{font-size:13px}.button{font-size:13px;min-height:40px}.list-tools{gap:8px}.tabs{gap:12px}.tab{min-height:40px}
 .editor-toolbar button{min-height:40px}.sheet-actions{flex-wrap:wrap}.sheet-actions input{min-width:120px}.sheet-filters select{font-size:13px}.editor-bottom{font-size:12px}
 .sheet-grid td input{font-size:14px}.editor-title{overflow-wrap:anywhere}.doc-editor{padding:10px}.template-grid{gap:8px}
}

/* Breakdown records reuse the full document editor, with a free-form initial template. */
.breakdown-doc-tools{display:flex;align-items:center;gap:14px;flex-wrap:wrap;padding:9px 0;border-bottom:1px solid var(--line,#e0e3e7)}
.breakdown-document-note{font-size:12px;color:#677787;padding:12px 0}
.doc-outline{float:left;position:sticky;top:18px;width:175px;padding:12px 12px 12px 0}
.doc-outline strong{display:block;font-size:12px;color:#83909b;margin-bottom:12px}
.doc-outline button{display:block;border:0;background:none;text-align:left;color:#536576;font-size:12px;line-height:1.6;padding:7px 0;cursor:pointer;width:100%}
.doc-outline button:hover{color:#0b3053;text-decoration:underline}
.editor-view:has(.doc-outline:not([hidden])) .doc-editor{margin-left:190px;max-width:900px;padding:20px 28px}
.doc-editor .ql-editor h2{border-bottom:1px solid #e1e5e8;padding-bottom:7px;margin-top:24px!important;color:#0b3053;font-size:19px!important}
.doc-editor .ql-editor h3{color:#3f5365;font-size:16px!important;margin-top:18px!important}
.editor-view:has(.doc-outline:not([hidden])) .attachments{clear:both}
.doc-editor .ql-editor{overflow-y:visible}
/* Keep Quill's float clearing inside its toolbar, away from the outline float. */
.doc-editor .ql-toolbar{display:flow-root}
.doc-editor .ql-editor{line-height:1.8;font-size:14px}
.doc-editor .ql-editor table{width:100%;table-layout:fixed;border-collapse:collapse;margin:12px 0 16px}
.doc-editor .ql-editor td{border:1px solid #dce1e6!important;padding:9px 10px!important;vertical-align:top;overflow-wrap:anywhere;white-space:pre-wrap;line-height:1.7}
.doc-editor .ql-editor tr:first-child td{background:#edf0f3;color:#0b3053;font-weight:600}
.doc-editor .ql-editor td:focus-within{background:#faf8f2}
.doc-editor .ql-editor p{margin-bottom:7px}
.doc-editor .ql-editor h1,.doc-editor .ql-editor h2{scroll-margin-top:115px}
.doc-editor .ql-editor td:nth-child(1){width:17%}
.doc-editor .ql-editor td:last-child{width:34%}
.table-commands{display:flex;gap:8px;flex-wrap:wrap;margin-top:18px}
.editor-view:has(.doc-outline:not([hidden])) .doc-editor{max-width:1120px;padding:18px}
@media(max-width:700px){.doc-editor .ql-editor{overflow-x:auto}.doc-editor .ql-editor table{min-width:650px}.doc-editor .ql-editor td{font-size:13px}}
@media(max-width:1100px){.doc-outline{float:none;position:static;width:100%;display:flex;gap:12px;overflow-x:auto;white-space:nowrap;padding:4px 0 12px}.doc-outline strong{display:none}.doc-outline button{width:auto;flex-shrink:0}.editor-view:has(.doc-outline:not([hidden])) .doc-editor{margin-left:0;max-width:none}}
@media(max-width:600px){.breakdown-doc-tools{gap:10px}.breakdown-doc-tools .muted{display:none}.editor-view:has(.doc-outline:not([hidden])) .doc-editor{padding:12px}.doc-editor .ql-editor{padding:12px 4px;font-size:14px;line-height:1.8}.breakdown-document-note{line-height:1.6}}

/* Controls live outside contenteditable: they never become document content. */
.doc-editor .has-table-controls .ql-editor table{margin-bottom:52px}
.table-row-controls-layer{position:absolute;inset:0;pointer-events:none;z-index:0}
.table-row-controls{position:absolute;display:flex;align-items:center;gap:6px;white-space:nowrap;pointer-events:auto;height:32px;background:white;overflow-x:auto}
.table-row-controls button{border:1px solid #dce1e6;border-radius:3px;background:#f8f9fa;color:#0b3053;padding:5px 9px;font:12px/1.4 inherit;white-space:nowrap;min-height:30px}
.table-row-controls button:first-child{background:#edf0f3;font-weight:600}
.table-row-controls button:hover{border-color:#876439;background:#f8f6f1}
.table-row-controls span{color:#74818b;font-size:11px;padding:0 4px}
@media(max-width:600px){.table-row-controls{gap:4px}.table-row-controls button{font-size:12px;padding:5px 7px}.table-row-controls span{display:none}}

.option-actions{display:flex;gap:6px;flex-wrap:wrap;margin:8px 0}.option-actions button{font-size:12px;padding:7px 9px;border:1px solid var(--line);border-radius:4px;background:#f8fafc;color:var(--ink)}
#option-import:not(:empty){padding:10px;margin:8px 0;background:#f5f7fa;border-radius:5px}#option-import textarea,#option-import select,#option-import input[type=search]{width:100%;min-width:0;box-sizing:border-box}#option-source-values{max-height:190px;overflow:auto}#option-source-values label{overflow-wrap:anywhere}#option-import [role=status]{font-size:12px;color:var(--muted)}
.document-scopes{margin-bottom:14px;flex-wrap:wrap}.document-filters{display:flex;align-items:flex-end;gap:12px;flex-wrap:wrap;margin:0 0 12px}.document-filters label{font-size:12px;color:var(--muted);display:grid;gap:5px}.document-filters select{font:inherit;font-size:13px;padding:8px 12px;min-height:38px;max-width:100%;border:1px solid var(--line);border-radius:4px;background:#fff;color:var(--ink)}
@media(max-width:600px){.document-filters{gap:8px}.document-filters label{flex:1;min-width:100px}.document-filters select{width:100%}.document-scopes{gap:18px}.list-tools .tabs{flex-wrap:wrap}}
