
:root{
  --sidebar-width:232px;
  --content-width:1180px;
  --bg:#f6f5f3;
  --panel:#ffffff;
  --sidebar:#76726f;
  --sidebar-soft:#8c8885;
  --accent:#ead58a;
  --company-accent:#76726f;
  --text:#1f1f1f;
  --muted:#6f6a63;
  --border:#e6e2db;
  --input:#f8f7f5;
  --radius-xl:30px;
  --radius-lg:22px;
  --radius-md:18px;
}
*{box-sizing:border-box}
body{
  margin:0;
  overflow-y:scroll;
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif;
  background:linear-gradient(180deg,#ece9e0 0,#f6f5f3 140px);
  color:var(--text);
}
button,input,select,textarea{font:inherit}
.layout{
  display:grid;
  grid-template-columns:var(--sidebar-width) minmax(0,var(--content-width));
  gap:16px;
  width:min(calc(var(--sidebar-width) + var(--content-width) + 48px), 100%);
  max-width:min(calc(var(--sidebar-width) + var(--content-width) + 48px), 100%);
  margin:18px auto;
  padding:0 16px;
  justify-content:center;
}
.sidebar{
  width:var(--sidebar-width);
  min-width:var(--sidebar-width);
  max-width:var(--sidebar-width);
  background:var(--sidebar);
  border-radius:34px;
  padding:14px;
  min-height:calc(100vh - 36px);
  height:calc(100vh - 36px);
  position:sticky;
  top:18px;
  display:flex;
  flex-direction:column;
  overflow:hidden;
}
.main{display:flex;flex-direction:column;gap:16px;width:100%;max-width:var(--content-width);min-width:0}
.hero,.card{width:100%;max-width:100%;background:var(--panel);border:1px solid var(--border);border-radius:32px;padding:22px}
.hero{min-height:168px}
@media (max-width:980px){
  .layout{grid-template-columns:1fr;width:100%;max-width:100%;}
  .sidebar{width:100%;min-width:0;max-width:none;position:static;min-height:auto;height:auto;}
  .main{max-width:100%;}
}

.workspace-card{background:rgba(255,255,255,.12);border-radius:24px;padding:18px 18px 14px;color:#fff;margin-bottom:14px}
.sidebar-nav{display:flex;flex-direction:column;gap:10px;flex:1}
.workspace-card-simple{padding:18px 18px}
.workspace-title-solo{font-size:24px;margin:0}

.workspace-title{font-size:12px;font-weight:600;line-height:1.1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-bottom:0;color:rgba(255,255,255,.78)}
.workspace-subtitle{font-size:22px;font-weight:700;line-height:1.05;letter-spacing:-0.01em;margin-top:8px;color:#fff}

.workspace-top{font-size:12px;letter-spacing:.28em;text-transform:uppercase;opacity:.85;margin-bottom:10px}
.workspace-sub{font-size:15px;opacity:.85}
.nav-btn{width:100%;display:flex;justify-content:space-between;align-items:center;border:none;background:rgba(255,255,255,.08);color:#fff;padding:14px 16px;border-radius:18px;cursor:pointer;font-weight:700}
.nav-btn.active{background:var(--accent);color:var(--text)}
.main{display:flex;flex-direction:column;gap:16px}
.hero,.card{background:var(--panel);border:1px solid var(--border);border-radius:32px;padding:22px}
.hero{min-height:168px}
.badge{display:inline-flex;padding:8px 14px;border-radius:999px;background:var(--accent);font-weight:800;font-size:14px;margin-bottom:10px}
.page-title{font-size:24px;font-weight:900;margin:0}
.grid-2{display:grid;grid-template-columns:1fr 1fr;gap:14px}
.label{display:block;font-size:13px;color:var(--muted);margin-bottom:6px;font-weight:600}
.input,.select,.textarea{width:100%;height:42px;border:1px solid var(--border);background:var(--input);border-radius:16px;padding:0 14px;color:var(--text)}
.textarea{height:110px;padding:12px 14px;resize:vertical}
.header-row{display:grid;grid-template-columns:1fr 1fr;gap:14px}
.company-combo{display:grid;grid-template-columns:1fr 190px;gap:10px;align-items:end}
.items-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:14px}
.table{border:1px solid var(--border);border-radius:26px;overflow:hidden;background:#faf9f7}
.index-pill{height:38px;border:1px solid var(--border);background:#f3f1ed;border-radius:14px;display:flex;align-items:center;justify-content:center}
.money-wrap{position:relative}.money-wrap .currency{position:absolute;left:12px;top:10px;color:var(--text)}
.money-wrap .input{padding-left:28px}
.totals-row{display:grid;grid-template-columns:1fr 1fr 1fr 1.1fr;gap:16px;margin-top:14px;align-items:end}
.amount-box{display:grid;grid-template-columns:150px 1fr;gap:12px;align-items:center}
.amount-label{font-size:18px;white-space:nowrap}
.summary-box,.due-box{background:var(--sidebar);color:#fff;border-radius:20px;padding:16px 18px;display:flex;justify-content:space-between;align-items:center;font-size:18px;font-weight:800}
.due-box{margin-top:12px}
.actions{display:flex;justify-content:flex-end;gap:12px;padding-top:4px}
.btn{height:50px;border-radius:18px;border:1px solid var(--border);padding:0 20px;background:#fff;cursor:pointer;font-weight:700}
.btn.primary{background:var(--sidebar);border-color:var(--sidebar);color:#fff}
.list-row{display:grid;grid-template-columns:140px 1.4fr 1fr 120px 120px 260px;gap:12px;align-items:center;padding:16px 18px;border-top:1px solid #efebe5}
.list-row:first-child{border-top:none}

.list-header{display:grid;grid-template-columns:140px 1.4fr 1fr 120px 120px 260px;gap:12px;align-items:center;padding:14px 18px;margin-bottom:2px;border-radius:22px;background:#f6f3ee;color:#7a7369;font-size:12px;font-weight:800;letter-spacing:.06em;text-transform:uppercase;}
.status,.invoice-status-badge{display:inline-flex;justify-content:center;padding:8px 12px;border-radius:999px;font-size:13px;font-weight:800}
.invoice-status-badge.paid{background:#e7f6ea;color:#1f6b32}.invoice-status-badge.unpaid{background:#f6eaea;color:#8d2d2d}
.row-actions{display:flex;flex-wrap:wrap;gap:8px}
.small-btn{height:36px;border-radius:14px;padding:0 12px;border:1px solid var(--border);background:#fff;cursor:pointer}
.menu{position:relative;display:inline-block}
.search-row{display:flex;gap:12px;align-items:center;margin-bottom:12px}.search-row .input{max-width:340px}
@media (max-width: 980px){.layout{grid-template-columns:1fr}.sidebar{position:static;min-height:auto}.company-combo,.grid-2,.header-row,.totals-row,.list-header,.list-row{grid-template-columns:1fr}.row-actions{justify-content:flex-start}}


/* r3 adjustments */
.hero{min-height:104px;padding:18px 22px}
.page-title{font-size:18px;font-weight:900}
.badge{margin-bottom:8px}
.header-row.top-align{grid-template-columns:1fr 1fr;align-items:end}
.company-inline-row{display:grid;grid-template-columns:minmax(0,1fr) 156px;gap:12px;align-items:end}
.action-cell{display:flex;justify-content:center;align-items:center}
.summary-box,.due-box{background:var(--company-accent);color:var(--text)}
@media (max-width:980px){.company-inline-row{grid-template-columns:1fr}.header-row.top-align,.grid-2,.totals-row{grid-template-columns:1fr}}

.page-title{font-size:48px;}
.hero{padding:28px 40px 34px;}
.company-inline-row{grid-template-columns:minmax(0,1fr) 138px;}
.row-actions .strong{background:var(--company-accent);border-color:var(--company-accent);}
.download-note{margin-top:18px;padding:18px 20px;border-radius:20px;background:#faf9f7;color:var(--muted);border:1px solid var(--border);}

/* r5 header/layout refinements */
.page-title{font-size:16px;line-height:1.1;font-weight:800;}
.hero{padding:22px 32px 26px;min-height:136px;}
.invoice-header-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px;align-items:end;}
.invoice-header-company-wrap{grid-column:1/2;}
.invoice-header-company-grid{display:grid;grid-template-columns:minmax(0,1fr) 184px;gap:12px;align-items:end;}
.pdf-preview-wrap{margin-top:18px;border:1px solid var(--border);border-radius:22px;overflow:hidden;background:#f7f5f2;}
.pdf-preview{display:block;width:100%;height:920px;border:0;background:white;}
@media (max-width:980px){.invoice-header-grid{grid-template-columns:1fr}.invoice-header-company-wrap{grid-column:auto}.invoice-header-company-grid{grid-template-columns:1fr}.show-info-switch{width:auto;justify-content:flex-start}.pdf-preview{height:72vh}}

.add-btn{
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  cursor: pointer;
  font-size: 18px;
}

.action-cell{
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

.add-btn:hover{
  transform: translateY(-1px);
}


.switch-toggle{display:inline-flex;align-items:center;gap:10px;white-space:nowrap;min-height:44px;}
.switch-label{font-size:14px;font-weight:700;color:var(--text);}
.switch-toggle input{position:absolute;opacity:0;pointer-events:none;}
.switch-ui{position:relative;display:inline-flex;align-items:center;justify-content:space-between;width:72px;height:38px;padding:0 10px;border-radius:999px;background:#e7e1d8;border:1px solid #d9d1c5;cursor:pointer;box-sizing:border-box;}
.switch-knob{position:absolute;top:3px;left:3px;width:30px;height:30px;border-radius:999px;background:#fff;box-shadow:0 2px 6px rgba(0,0,0,.12);transition:transform .18s ease;}
.switch-on,.switch-off{position:relative;z-index:1;font-size:11px;font-weight:800;letter-spacing:.04em;}
.switch-on{color:#8f877c;}
.switch-off{color:#6c645a;}
.switch-toggle input:checked + .switch-ui{background:var(--company-accent);border-color:var(--company-accent);}
.switch-toggle input:checked + .switch-ui .switch-knob{transform:translateX(34px);}
.switch-toggle input:checked + .switch-ui .switch-on{color:#fff;}
.switch-toggle input:checked + .switch-ui .switch-off{color:rgba(255,255,255,.72);}

.form-switch-control{height:44px;min-height:44px;display:inline-flex;align-items:center;gap:10px;white-space:nowrap;}
.show-info-field{display:flex;align-items:end;justify-content:flex-start;}
.show-info-switch{width:100%;justify-content:space-between;}
.billing-inline-switch{justify-content:flex-start;}
.billing-remark-switch{min-width:154px;}

.status,.invoice-status-badge{display:inline-flex;align-items:center;justify-content:center;min-width:72px;padding:6px 10px;border-radius:999px;font-size:12px;font-weight:800;letter-spacing:.04em;text-transform:uppercase;}
.invoice-status-badge.unpaid{background:#fff1f1;color:#b42318;border:1px solid #f4b5b0;}
.invoice-status-badge.paid{background:#eefbf3;color:#16794a;border:1px solid #9fd5b8;}
.invoice-status-badge.draft{background:#f2f4f7;color:#475467;border:1px solid #d0d5dd;}
.invoice-status-badge.partial{background:#fff6ed;color:#c4320a;border:1px solid #f7c79d;}

.clients-card{padding:22px;}
.clients-search-row{margin-bottom:14px;}
.clients-search-row .input{max-width:360px;}
.clients-list-wrap{display:flex;flex-direction:column;gap:12px;}
.client-main{min-width:0;display:flex;flex-direction:column;gap:6px;}
.client-name{font-size:16px;font-weight:700;color:var(--text);}
.client-meta{font-size:13px;color:var(--muted);}
.clients-actions{overflow:visible;}
.clients-actions .icon-btn{font-size:18px;}
.client-invoice-filters{display:flex;gap:10px;flex-wrap:wrap;justify-content:flex-end;}
.clients-invoices-headline{align-items:flex-start;}

.client-invoices-top-actions{display:flex;align-items:center;justify-content:flex-end;gap:12px;flex-wrap:wrap;}
.client-invoice-filters .small-btn.strong{background:var(--company-accent);border-color:var(--company-accent);color:var(--text);font-weight:800;}
.client-invoice-filters .small-btn:not(.strong){background:#f6f3ee;color:var(--muted);}

.settings-tabs-card{padding:14px 16px}
.settings-tabs{display:flex;gap:12px;flex-wrap:wrap}
.settings-tab{border:1px solid var(--line);background:var(--soft);color:var(--text);padding:12px 18px;border-radius:999px;font-size:14px;font-weight:700;cursor:pointer;transition:.18s ease}
.settings-tab:hover{background:#f1eee8}
.settings-tab.active{background:var(--gold);border-color:transparent}

.unified-list-card{padding:22px;}
.unified-list-headline{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:14px;}
.list-subtitle{font-size:13px;color:var(--muted);font-weight:700;margin:-2px 0 14px;}
.unified-list-wrap{display:flex;flex-direction:column;gap:12px;}
.unified-row-card{display:grid;grid-template-columns:220px minmax(0,1fr) auto;gap:18px;align-items:center;padding:18px 20px;border:1px solid var(--border);border-radius:22px;background:#fff;}
.unified-left{min-width:0;}
.unified-middle{min-width:0;display:flex;flex-direction:column;gap:8px;}
.unified-right{display:flex;align-items:center;justify-content:flex-end;gap:8px;}
.unified-name{font-size:18px;font-weight:800;color:var(--text);line-height:1.2;word-break:break-word;}
.unified-meta-top{display:flex;flex-wrap:wrap;gap:12px 18px;font-size:13px;color:var(--muted);}
.unified-meta-top span{display:inline-flex;align-items:center;min-height:18px;}
.unified-meta-bottom{font-size:14px;color:var(--text);line-height:1.35;word-break:break-word;}
.company-row-card .small-btn[disabled]{opacity:.6;cursor:not-allowed;}
@media (max-width:980px){.unified-row-card{grid-template-columns:1fr;align-items:start;}.unified-right{justify-content:flex-start;}}

.form-card{padding:24px;}

.invoice-status-badge.estimate{background:#eef2f6;color:#475467;border:1px solid #cfd7e3;}
.settings-split-card{margin-top:14px;padding-top:14px;border-top:1px solid var(--line);}
.settings-split-top{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:14px;}
.settings-grid-3{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:var(--ui-section-gap);}
.settings-pair{display:flex;flex-direction:column;gap:6px;}
.settings-pair-wide{grid-column:span 2;}
@media (max-width:980px){.settings-grid-3,.ui-form-grid-3{grid-template-columns:1fr;}.settings-pair-wide{grid-column:span 1;}.settings-split-top{flex-direction:column;align-items:stretch;}.settings-company-controls{grid-template-columns:1fr;}}

.settings-block-title{margin:18px 0 8px;font-size:13px;font-weight:700;color:var(--muted);text-transform:uppercase;letter-spacing:.06em;}

.settings-public-card,.settings-template-card{margin-bottom:18px}
.settings-template-card .settings-split-top{display:grid;grid-template-columns:120px minmax(0,320px);gap:14px;align-items:center;margin-bottom:18px}
.settings-company-controls{display:grid;grid-template-columns:110px minmax(0,1fr);gap:12px;align-items:center;}
.settings-color-grid{align-items:end;}
.settings-color-preview-wrap{display:flex;align-items:end;height:100%;}
.settings-color-preview{width:100%;min-height:42px;border-radius:14px;border:1px solid var(--border);background:linear-gradient(135deg,var(--preview-bg,#76726f) 0%,var(--preview-soft,#ead58a) 100%);display:flex;align-items:center;justify-content:center;font-weight:700;color:#fff;box-shadow:0 8px 18px rgba(0,0,0,.08);}

.remarks-wrap{display:none;margin-top:14px}.remarks-wrap.is-on{display:block}

.center-label{text-align:center;display:block;}
.show-info-field{display:flex;flex-direction:column;align-items:stretch;}
.remarks-wrap .textarea{min-height:88px;height:auto;resize:vertical;}

.totals-row .amount-box{align-self:end;}

.totals-row-v1210{display:flex;align-items:center;gap:16px;flex-wrap:nowrap;margin-top:14px}
.totals-row-v1210 .inline-field{display:flex;align-items:center;gap:8px;min-width:0}
.totals-row-v1210 .amount-box{display:flex;align-items:center;gap:8px;grid-template-columns:none}
.totals-row-v1210 .amount-label{display:flex;align-items:center;justify-content:center;line-height:1;min-height:44px;margin:0;white-space:nowrap;font-size:16px;font-weight:600;color:var(--text)}
.totals-row-v1210 .money-wrap{display:flex;align-items:center;gap:0}
.totals-row-v1210 .money-wrap .currency{height:44px;display:flex;align-items:center;padding:0 10px;border:1px solid var(--border);border-right:none;border-radius:18px 0 0 18px;background:var(--input);color:var(--text);font-weight:700}
.totals-row-v1210 .money-wrap .input{width:118px;min-width:118px;border-radius:0 18px 18px 0}
.totals-row-v1210 .payment-field .amount-label{min-width:auto}
.inline-summary-box{min-width:176px;padding:12px 16px;display:flex;justify-content:space-between;align-items:center}
.remarks-wrap{display:none;margin-top:10px}
.remarks-wrap.is-on{display:block}
.remark-textarea{min-height:92px;height:auto;resize:vertical;width:100%}
.due-row-v1210{display:flex;justify-content:flex-end;margin-top:12px}
.due-row-v1210 .due-box{min-width:196px;margin-top:0}
@media (max-width: 980px){
  .totals-row-v1210{flex-wrap:wrap}
  .totals-row-v1210 .inline-field,.inline-summary-box{width:100%}
  .totals-row-v1210 .money-wrap{flex:1}
  .totals-row-v1210 .money-wrap .input{width:100%;min-width:0}
  .due-row-v1210{justify-content:stretch}
  .due-row-v1210 .due-box{width:100%}
}

.totals-stack-v1210{margin-top:14px;display:flex;flex-direction:column;gap:12px}

.amount-row-1-v1210{display:flex;align-items:center;gap:16px;flex-wrap:nowrap}
.amount-right-v1211{margin-left:auto;display:flex;align-items:center;gap:16px;min-width:0}
.amount-group-v1210{display:flex;align-items:center;gap:8px;min-width:0}
.amount-group-v1210 .amount-label{margin:0;line-height:1;display:flex;align-items:center;white-space:nowrap}
.amount-input-v1210{width:132px;min-width:132px}
.amount-input-v1210 .input{width:100%;min-width:132px}
.amount-money-v1211 .input{text-align:right}
.amount-money-v1211 .currency{min-width:auto}
.amount-group-wide-v1210 .amount-label{min-width:auto;justify-content:flex-start}
.amount-summary-v1210{min-width:248px;width:248px;padding:16px 18px;margin-left:0;justify-content:space-between}
.amount-summary-v1210 span:last-child{text-align:right;min-width:100px}
.remarks-row-v1210{display:none}
.remarks-row-v1210.is-on{display:block}
.remarks-row-v1210 .remark-textarea{width:100%;min-height:92px;height:auto;resize:vertical}
.amount-row-3-v1210{display:flex;justify-content:flex-end}
.amount-due-v1210{min-width:248px;width:248px;margin-top:0}.amount-due-v1210 span:last-child{text-align:right;min-width:100px}
@media (max-width:1100px){.amount-row-1-v1210{gap:12px}.amount-right-v1211{gap:12px}}
@media (max-width:860px){.amount-row-1-v1210{flex-direction:column;align-items:stretch}.amount-right-v1211{margin-left:0;display:grid;grid-template-columns:1fr;gap:12px}.amount-group-v1210{justify-content:space-between}.amount-summary-v1210,.amount-due-v1210{min-width:0;width:100%}.amount-row-3-v1210{justify-content:stretch}}

.btn.is-busy{opacity:.65;pointer-events:none;cursor:not-allowed;}

.sidebar-stats{display:flex;flex-direction:column;gap:10px;margin-top:14px}
.sidebar-stat{display:flex;justify-content:space-between;align-items:center;padding:10px 12px;border-radius:16px;font-size:12px;border:1px solid rgba(255,255,255,.12);background:rgba(255,255,255,.06);color:#fff}
.sidebar-stat strong{font-size:13px}
.badge-soft{background:rgba(234,213,138,.18);border-color:rgba(234,213,138,.28)}
.badge-invoiced{background:rgba(59,130,246,.16);border-color:rgba(59,130,246,.30)}
.badge-paid{background:rgba(34,197,94,.12);border-color:rgba(34,197,94,.25)}
.badge-unpaid{background:rgba(239,68,68,.12);border-color:rgba(239,68,68,.25)}
.muted-pill{display:inline-flex;align-items:center;padding:6px 10px;border-radius:999px;background:#f3efe8;border:1px solid #e6e2db;color:#6f6a63;font-size:12px}
.placeholder-box{background:#faf8f5;border:1px solid #e6e2db;border-radius:20px;padding:16px;color:#6f6a63}
.accounting-cards{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;margin-top:12px}
.accounting-card{background:#faf8f5;border:1px solid #e6e2db;border-radius:22px;padding:16px;display:flex;flex-direction:column;gap:8px}
.accounting-card strong{font-size:22px;color:#1f1f1f}
.accounting-card.muted{opacity:.85}
@media (max-width: 980px){.accounting-cards{grid-template-columns:1fr 1fr}}

.item-library-head,.item-library-row{display:grid;grid-template-columns:minmax(0,1.6fr) 140px 110px 120px;gap:12px;align-items:center}
.item-library-head{padding:0 18px 12px;color:var(--muted);font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:.04em}
.item-library-row{padding:16px 18px}
.item-library-cell{min-width:0}
.item-library-name{font-weight:700;color:var(--text)}
@media (max-width:980px){.item-library-head{display:none}.item-library-row{grid-template-columns:1fr 1fr}.item-library-cell.row-actions{justify-content:flex-start}}

.settings-pair .btn.danger-btn{width:100%;}

.settings-pair-reset{display:flex;align-items:flex-end}
.settings-pair-reset .btn{margin-top:24px}
.address-invoices-header{display:flex;justify-content:space-between;align-items:flex-start;gap:16px}
.address-invoice-filters{display:flex;gap:10px;flex-wrap:wrap;justify-content:flex-end;align-items:center}
.address-invoice-filters .settings-tab{background:var(--company-accent-soft, var(--gold));border-color:transparent}
.address-invoice-filters .settings-tab.active{background:var(--company-accent, var(--gold));color:var(--text)}
.address-invoice-filters .settings-tab:last-child{background:#fff;border:1px solid var(--border)}
@media (max-width:980px){.address-invoices-header{flex-direction:column;align-items:flex-start}.address-invoice-filters{justify-content:flex-start}}

.workspace-subtitle-v13{font-size:clamp(2rem,2.9vw,2.4rem);line-height:1.02;}
.items-head-v13{display:flex;align-items:center;justify-content:space-between;gap:14px;flex-wrap:wrap;}
.btn-ghost{background:#fff;border:1px solid var(--border);color:var(--text);}
.btn-import-clipboard{padding:10px 14px;border-radius:12px;font-weight:700;}
.import-clipboard-panel{margin:14px 0 18px;padding:16px;border:1px dashed var(--border);border-radius:16px;background:#fcfbf7;}
.import-clipboard-textarea{min-height:160px;}
.import-clipboard-help{margin-top:8px;color:var(--muted);font-size:13px;}
.import-clipboard-actions{justify-content:flex-start;margin-top:12px;}
.form-help{color:var(--muted);font-size:13px;line-height:1.5;}

.hero-company-select{gap:10px;justify-content:flex-start;flex-wrap:wrap}
.hero-company-dropdown{min-width:260px;max-width:420px;background:var(--company-accent,#ead58a);border-color:var(--company-accent,#ead58a);font-weight:800}
.settings-template-card .settings-split-top.settings-company-top{grid-template-columns:120px minmax(0,420px)}
.settings-company-controls{grid-template-columns:max-content minmax(0,1fr)}
.settings-fit-btn{width:auto;white-space:nowrap;padding-left:16px;padding-right:16px}
.settings-block-title-row{display:flex;align-items:center;justify-content:space-between;gap:12px}
@media (max-width:980px){.hero-company-dropdown{min-width:0;max-width:none;width:100%}.settings-block-title-row{flex-direction:column;align-items:stretch}}

.company-unified-select{
  width:auto;
  min-width:240px;
  max-width:420px;
  background:var(--company-accent,#ead58a);
  border-color:var(--company-accent,#ead58a);
  color:var(--text);
  font-weight:800;
}
.settings-company-controls{display:flex;align-items:center;gap:10px;flex-wrap:wrap;}
.settings-company-controls .btn,.settings-fit-btn{width:auto;display:inline-flex;align-items:center;justify-content:center;white-space:nowrap;padding-left:16px;padding-right:16px;flex:0 0 auto;}
@media (max-width:980px){
  .company-unified-select{min-width:0;max-width:none;width:100%;}
  .settings-company-controls{align-items:stretch;}
}

.company-unified-select{
  font-size:16px;
  line-height:1.2;
  font-weight:800;
}
.settings-template-card .settings-split-top.settings-company-top{
  grid-template-columns:100px minmax(0, 1fr);
}
.settings-company-controls{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:nowrap;
}
.settings-company-controls .company-unified-select{
  flex:0 1 320px;
}
.settings-company-controls .btn,.settings-fit-btn{
  width:auto;
  flex:0 0 auto;
  white-space:nowrap;
}
@media (max-width:980px){
  .settings-template-card .settings-split-top.settings-company-top{grid-template-columns:1fr;}
  .settings-company-controls{flex-wrap:wrap;}
  .settings-company-controls .company-unified-select{flex:1 1 100%;min-width:0;max-width:none;width:100%;}
}

.settings-company-top-right{grid-template-columns:minmax(0,1fr) auto;align-items:start;}
.settings-company-controls-top-right{justify-content:flex-end;width:100%;}
.settings-company-controls-top-right .company-unified-select{flex:0 1 320px;}
@media (max-width:980px){
  .settings-company-top-right{grid-template-columns:1fr;}
  .settings-company-controls-top-right{justify-content:stretch;}
}

.settings-rules-topline{margin-bottom:14px;}
.settings-block-title-inline{margin:0;display:flex;align-items:center;min-height:46px;}
.settings-company-controls-top-right .btn,.settings-company-controls-top-right .company-unified-select{height:46px;}

.layout.layout-dual{grid-template-columns:320px 1fr;align-items:start}
.sidebar-stack{display:grid;grid-template-columns:76px minmax(0,1fr);gap:12px;position:sticky;top:18px;height:calc(100vh - 36px)}
.sidebar-rail{width:76px;min-width:76px;max-width:76px;padding:12px 10px;gap:10px;justify-content:flex-start;align-items:stretch}
.sidebar-main{min-width:0;max-width:none;width:auto}
.rail-btn{border:none;background:rgba(255,255,255,.08);color:#fff;border-radius:18px;padding:12px 8px;cursor:pointer;display:flex;flex-direction:column;align-items:center;gap:6px;font-weight:800;min-height:68px}
.rail-btn span{font-size:20px;line-height:1}
.rail-btn small{font-size:11px;line-height:1.1}
.rail-btn.active{background:#fff;color:var(--sidebar)}
.section-nav .nav-btn{justify-content:space-between}
@media (max-width: 980px){.layout.layout-dual{grid-template-columns:1fr}.sidebar-stack{position:static;height:auto;grid-template-columns:1fr;gap:12px}.sidebar-rail{width:100%;max-width:none;min-width:0;display:grid;grid-template-columns:repeat(4,1fr)}.rail-btn{min-height:auto;padding:10px 8px}.sidebar-main{width:100%}}

.textarea-6rows{min-height:132px;line-height:1.45;}
.lang-pill-group{display:flex;gap:8px;align-items:center;flex-wrap:wrap;}
.lang-pill{height:38px;padding:0 16px;border:1px solid var(--border);background:#fff;border-radius:999px;cursor:pointer;font-weight:700;color:var(--text);}
.lang-pill.active{background:var(--company-accent);border-color:var(--company-accent);color:#fff;}
.order-item-editor{display:flex;flex-direction:column;gap:10px;}
.order-item-row{display:grid;grid-template-columns:44px minmax(0,1fr) 40px;gap:10px;align-items:center;}
.order-item-index{height:40px;display:flex;align-items:center;justify-content:center;border-radius:12px;background:#f5f2ea;border:1px solid var(--border);font-weight:800;color:var(--muted);}
.order-item-input{min-width:0;}
@media (max-width:980px){.order-item-row{grid-template-columns:40px minmax(0,1fr) 38px;}}

.order-item-row-grid{grid-template-columns:54px minmax(0,1fr) 120px;}
.order-item-head{padding:0 4px 6px;color:var(--muted);font-size:12px;font-weight:800;text-transform:uppercase;letter-spacing:.04em;}
.order-item-actions{display:flex;gap:8px;align-items:center;justify-content:flex-end;}
.order-item-actions .small-btn[disabled]{opacity:.45;cursor:not-allowed;}
.textarea-6rows{min-height:140px;height:auto;}

.order-view-card{padding:26px 24px 28px;}
.order-view-top{display:flex;justify-content:space-between;gap:18px;align-items:flex-start;flex-wrap:wrap;}
.order-view-kicker{font-size:12px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);margin-bottom:8px;}
.order-view-title{margin:0;font-size:30px;line-height:1.05;}
.order-view-status-row{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin-top:12px;}
.order-view-chip{display:inline-flex;align-items:center;padding:8px 12px;border-radius:999px;background:#f7f5f2;border:1px solid var(--border);font-size:13px;font-weight:700;color:var(--muted);}
.order-view-top-actions{display:flex;gap:10px;flex-wrap:wrap;justify-content:flex-end;}
.order-view-section{padding:20px 20px 18px;}
.order-view-section-title{font-size:15px;font-weight:800;margin-bottom:14px;}
.order-view-meta-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;margin-top:16px;}
.order-view-two-col{display:grid;grid-template-columns:1.1fr .9fr;gap:16px;margin-top:16px;}
.order-view-fields-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;}
.order-view-field{padding:14px 15px;border:1px solid #dde5ef;background:var(--ui-field-card-bg,#fff);border-radius:16px;min-height:84px;}
.order-view-field-wide{grid-column:1/-1;}
.order-view-label{font-size:11px;font-weight:900;letter-spacing:.04em;text-transform:uppercase;color:#6b7280;margin-bottom:8px;}
.order-view-value{font-size:16px;line-height:1.45;white-space:pre-wrap;word-break:break-word;}
.order-view-summary-box{padding:18px 20px;border-radius:20px;background:linear-gradient(180deg,#fffefc 0%,#faf7f2 100%);border:1px solid var(--border);font-size:18px;line-height:1.7;min-height:144px;white-space:pre-wrap;word-break:break-word;}
.order-view-note-box{padding:16px 18px;border-radius:18px;background:#faf9f7;border:1px solid var(--border);font-size:15px;line-height:1.65;min-height:120px;white-space:pre-wrap;word-break:break-word;}
.order-view-items{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;}
.order-view-item-card{display:flex;gap:12px;align-items:flex-start;padding:14px 16px;border-radius:18px;border:1px solid var(--border);background:#fff;}
.order-view-item-num{width:32px;height:32px;border-radius:999px;background:#f3ead3;display:flex;align-items:center;justify-content:center;font-weight:800;flex:0 0 auto;}
.order-view-item-text{font-size:15px;line-height:1.55;word-break:break-word;}
.order-view-empty{padding:18px;border-radius:16px;background:#faf9f7;border:1px dashed var(--border);color:var(--muted);}
@media (max-width: 980px){
  .order-view-meta-grid,.order-view-two-col,.order-view-fields-grid,.order-view-items{grid-template-columns:1fr;}
  .order-view-title{font-size:24px;}
  .order-view-summary-box{min-height:unset;}
}

.order-view-items-section{margin-top:28px;}
.order-edit-access-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;}
.order-edit-access-wide{grid-column:1/-1;}
.mini-label{display:block;margin-bottom:6px;font-size:11px;font-weight:900;letter-spacing:.04em;text-transform:uppercase;color:#6b7280;}
.order-edit-card .input,.order-edit-card .select,.order-edit-card .textarea{background:#fff;}
@media (max-width:980px){.order-edit-access-grid{grid-template-columns:1fr;}}

.assign-modal-backdrop{position:fixed;inset:0;background:rgba(17,24,39,.42);display:flex;align-items:center;justify-content:center;padding:24px;z-index:1000;}
.assign-modal-card{width:min(680px,100%);background:#fff;border-radius:26px;padding:22px 22px 20px;box-shadow:0 28px 80px rgba(15,23,42,.24);border:1px solid var(--border);}
.assign-modal-head{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;margin-bottom:18px;}
.assign-modal-kicker{font-size:12px;font-weight:800;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);margin-bottom:6px;}
.assign-modal-title{margin:0;font-size:24px;line-height:1.1;}
.assign-modal-sub{margin-top:6px;color:var(--muted);font-size:14px;}
.assign-modal-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;}
.assign-modal-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:18px;}
@media (max-width:760px){.assign-modal-card{padding:18px 16px 16px;border-radius:22px;}.assign-modal-grid{grid-template-columns:1fr;}}
.ai-status-busy{color:#8a5a00;font-weight:700;}
.ai-status-ok{color:#1f7a4d;font-weight:700;}
.ai-status-error{color:#c63b3b;font-weight:700;}

.delete-emoji{color:#c63b3b;}
.order-item-actions .small-btn[disabled],.order-item-actions .danger-btn[disabled]{opacity:.45;cursor:not-allowed;}

.textarea-12rows{min-height:280px;line-height:1.45;}
.order-edit-summary-head{display:flex;align-items:center;justify-content:space-between;gap:14px;flex-wrap:nowrap;}
.order-edit-summary-head .lang-pill-group{flex-wrap:nowrap;white-space:nowrap;flex-shrink:0;}
.order-new-card{padding:26px 24px 28px;}
.order-new-top{margin-bottom:20px;}
.order-new-layout{display:grid;grid-template-columns:minmax(0,1.35fr) minmax(360px,.65fr);gap:22px;align-items:start;}
.order-new-main,.order-new-side{min-width:0;}
.order-new-request{min-height:190px;}
.order-new-side-grid{display:grid;grid-template-columns:1fr;gap:12px;}
.order-new-side-grid .order-view-field{margin:0;}
.order-new-side-grid .order-view-field-wide{grid-column:1 / -1;}
.order-new-side .order-view-label{margin-bottom:6px;}
@media (max-width:1100px){
  .order-new-layout{grid-template-columns:1fr;}
  .order-edit-summary-head{align-items:flex-start;flex-direction:column;}
  .order-edit-summary-head .lang-pill-group{flex-wrap:wrap;}
}

.main > .hero.hero-compact.hero-company-select{min-height:auto;padding:18px 28px;display:flex;align-items:center;gap:10px;justify-content:flex-start;flex-wrap:wrap;box-sizing:border-box;}
.main > .hero.hero-compact.hero-company-select .company-unified-select{height:46px;min-width:260px;max-width:420px;border-radius:18px;font-size:18px;font-weight:800;}

.order-status-board-panel{padding:18px;border:1px solid var(--border);border-radius:28px;background:var(--panel);overflow:hidden;}
.order-status-columns{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;align-items:start;padding:2px;}
.order-status-column{min-width:0;background:#faf8f5;border:1px solid var(--border);border-radius:24px;padding:14px 10px 12px;display:flex;flex-direction:column;gap:10px;}
.order-status-column-head{display:flex;gap:10px;align-items:flex-start;padding:4px 4px 8px;min-height:58px;}
.order-status-column-icon{width:38px;height:38px;display:flex;align-items:center;justify-content:center;border-radius:14px;background:var(--company-accent-soft,#f3ead3);border:1px solid var(--border);font-size:18px;flex:0 0 auto;}
.order-status-column-head h3{margin:0;font-size:16px;line-height:1.18;color:var(--text);white-space:normal;}
.order-status-column-head p{margin:4px 0 0;color:var(--muted);font-size:11px;line-height:1.25;font-weight:800;}
.order-status-column-list{display:flex;flex-direction:column;gap:10px;overflow:visible;padding:2px;}
.invoice-status-badge{min-width:0;max-width:100%;font-size:8.5px;padding:3px 6px;border-radius:999px;line-height:1.1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-transform:none;letter-spacing:0;}
.order-status-empty{width:100%;padding:12px;border:1px dashed var(--border);border-radius:14px;background:#fff;color:var(--muted);font-size:12px;font-weight:700;text-align:center;}

.order-new-shell{display:flex;flex-direction:column;gap:18px;}
.order-new-request-box,.order-new-edit-box{width:100%;}
.order-new-request-head{align-items:flex-start;}
.order-new-request-title-row{margin-top:16px;margin-bottom:10px;}
.order-new-request-textarea{min-height:210px;}
.order-new-edit-box{padding:26px 24px 28px;}
.order-new-edit-box .order-view-top{margin-bottom:20px;}
.order-new-edit-box.ai-filled{box-shadow:0 0 0 3px rgba(28,126,214,.12), 0 16px 40px rgba(34,28,16,.08);}
@media (max-width:760px){.order-new-request-head{gap:12px;}.order-new-request-head .client-invoices-top-actions{width:100%;justify-content:flex-start;}.order-new-edit-box{padding:18px;}}

.order-new-request-head{align-items:center;margin-bottom:10px;}
.order-new-request-textarea{min-height:170px;}
.order-new-edit-top{align-items:flex-start;margin-bottom:14px;}
.order-new-title{display:flex;align-items:baseline;gap:10px;flex-wrap:wrap;font-size:26px;}
.order-new-wo-hint{font-size:12px;line-height:1.2;color:var(--muted);font-weight:800;letter-spacing:.02em;white-space:nowrap;}
.order-new-company-top{margin-left:auto;min-width:260px;max-width:360px;width:30%;display:flex;flex-direction:column;gap:6px;}
.order-new-company-top .order-view-label{margin:0;font-size:11px;}
.order-new-company-top .input,.order-new-company-top .select{height:46px;border-radius:18px;font-weight:800;}
.order-new-meta-grid{grid-template-columns:repeat(5,minmax(0,1fr));gap:10px;margin-top:8px;padding:14px;}
.order-new-meta-grid .order-view-field{min-height:68px;padding:10px 12px;border-radius:14px;}
.order-new-meta-grid .order-view-label{font-size:10px;margin-bottom:6px;}
.order-new-compact-section{padding:14px;}
.order-new-edit-box .order-view-two-col{gap:12px;margin-top:12px;}
.order-new-property-grid{gap:10px;}
.order-new-property-grid .order-view-field{min-height:62px;padding:10px 12px;border-radius:14px;}
.order-new-property-grid .order-view-label{font-size:10px;margin-bottom:6px;}
.order-new-access-field{min-height:0;}
.order-new-access-field .order-edit-access-grid{gap:8px;}
.order-new-access-field .textarea{min-height:52px;}
.order-new-access-field .mini-label{font-size:10px;margin-bottom:5px;}
@media (max-width:1180px){.order-new-meta-grid{grid-template-columns:repeat(2,minmax(0,1fr));}.order-new-company-top{width:auto;min-width:240px;}}
@media (max-width:760px){.order-new-edit-top{flex-direction:column;}.order-new-company-top{width:100%;max-width:none;min-width:0;}.order-new-meta-grid{grid-template-columns:1fr;}.order-new-title{font-size:22px;}.order-new-wo-hint{display:block;}}

.order-company-select.company-unified-select{height:46px;border-radius:18px;min-width:260px;max-width:420px;padding-left:18px;padding-right:18px;font-size:18px;font-weight:800;background:var(--company-accent,#ead58a);border-color:var(--company-accent,#ead58a);color:var(--text);}
.order-new-company-top .order-company-select.company-unified-select{width:100%;}
.order-view-label{white-space:nowrap;}
.order-new-meta-grid .order-view-label{font-size:9.5px;letter-spacing:.025em;white-space:nowrap;}
@media (max-width:760px){.order-company-select.company-unified-select{min-width:0;max-width:none;width:100%;}}

:root{--card-title-size:18px;--card-title-line:1.2;}
.order-new-title{margin:0;display:flex;align-items:baseline;gap:8px;flex-wrap:wrap;}
.order-new-wo-hint{font-size:11px;font-weight:800;color:var(--muted);letter-spacing:0;}
.order-view-section-title{margin-bottom:10px;}

.order-new-company-top.no-company-label{justify-content:flex-end;gap:0;}
.order-new-company-top.no-company-label .order-company-select{width:100%;}
.order-new-company-top.no-company-label .order-view-label{display:none;}

:root{--global-search-width:280px;--global-search-height:38px;}
.title-right-control{align-self:center;}
.order-summary-template-box{min-height:150px;line-height:1.45;}
.order-status-color-editor{display:flex;flex-direction:column;gap:10px;margin-top:8px;}
.order-status-color-row{display:grid;grid-template-columns:minmax(160px,220px) minmax(0,1fr);gap:12px;align-items:center;padding:12px;border:1px solid var(--border);border-radius:16px;background:#faf8f5;}
.order-status-color-label{font-weight:900;color:var(--text);font-size:14px;}
.order-status-color-controls{display:flex;align-items:center;justify-content:flex-end;gap:12px;flex-wrap:wrap;}
.order-status-color-controls label{display:flex;align-items:center;gap:6px;font-size:11px;font-weight:900;text-transform:uppercase;color:var(--muted);}
.order-status-color-controls input[type="color"]{width:42px;height:34px;border:1px solid var(--border);border-radius:10px;padding:2px;background:#fff;}
.order-status-color-preview{display:inline-flex;align-items:center;justify-content:center;min-width:92px;height:34px;border:1px solid var(--border);border-radius:999px;font-size:12px;font-weight:900;}
@media (max-width:760px){
  .order-status-color-row{grid-template-columns:1fr;}
  .order-status-color-controls{justify-content:flex-start;}
}

:root{--same-level-card-title-size:18px;--same-level-card-title-line:1.2;--same-level-card-head-height:44px;}
.order-new-title-block{display:flex;align-items:center;min-height:var(--same-level-card-head-height);}
.order-new-wo-hint{font-size:11px;line-height:1.2;}
.order-status-color-controls-textonly{justify-content:flex-end;}
.order-status-color-controls-textonly label{min-width:94px;justify-content:flex-end;}
.ai-token-readout{display:flex;align-items:center;font-weight:900;background:#f8fafc;color:var(--text);cursor:default;user-select:text;}
.ai-token-readout::after{content:' auto';font-size:11px;font-weight:800;color:var(--muted);margin-left:8px;text-transform:uppercase;letter-spacing:.04em;}

:root{
  --global-search-width:280px;
  --global-search-height:38px;
  --same-level-card-title-size:18px;
  --same-level-card-head-height:44px;
}
.order-new-request-head,.order-view-top.order-new-edit-top{
  min-height:var(--same-level-card-head-height);
  height:auto;
  align-items:center;
}
.order-new-title{
  font-size:var(--same-level-card-title-size);
  line-height:var(--same-level-card-head-height);
  min-height:var(--same-level-card-head-height);
  display:flex;
  align-items:center;
}
.order-new-request-head .client-invoices-top-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:8px;
}
.order-new-request-head .client-invoices-top-actions .btn,.order-new-request-head .client-invoices-top-actions .small-btn,#wo_import_image,#wo_ai_analyze{
  height:var(--same-level-card-head-height);
  min-height:var(--same-level-card-head-height);
  padding:0 18px;
  border-radius:16px;
  font-size:var(--same-level-card-title-size);
  line-height:1;
  font-weight:900;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  white-space:nowrap;
}
.order-new-company-top.no-company-label,.order-new-title-block{
  min-height:var(--same-level-card-head-height);
  display:flex;
  align-items:center;
}
.order-new-company-top.no-company-label .order-company-select.company-unified-select,.order-company-select.company-unified-select{
  height:var(--same-level-card-head-height);
  min-height:var(--same-level-card-head-height);
  border-radius:16px;
  font-size:var(--same-level-card-title-size);
  line-height:1.2;
  font-weight:900;
  display:flex;
  align-items:center;
}
#hide_paid{
  pointer-events:auto;
}
.title-right-control,.switch-toggle.title-right-control{
  height:var(--same-level-card-head-height);
  min-height:var(--same-level-card-head-height);
  display:inline-flex;
  align-items:center;
}
@media (max-width:760px){
  .order-new-request-head .client-invoices-top-actions{width:100%;justify-content:flex-start;flex-wrap:wrap;}
  .order-new-request-head .client-invoices-top-actions .btn,#wo_import_image,#wo_ai_analyze{font-size:16px;}
}

.order-status-column-process-complete .order-status-column-subhead{font-size:12px;font-weight:900;color:var(--muted);text-transform:uppercase;letter-spacing:.04em;margin:2px 4px 0;}
.order-status-completed-fold{border-top:1px solid var(--border);padding-top:10px;margin-top:8px;}
.order-status-completed-fold summary{cursor:pointer;font-size:12px;font-weight:900;color:var(--text);margin:0 4px 10px;}

.invoice-status-badge{max-width:100%;min-width:0;font-size:8.5px;padding:3px 6px;line-height:1.1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-transform:none;letter-spacing:0;}
.order-status-column-process-complete .order-status-column-subhead{display:none;}
.order-status-completed-fold summary{white-space:normal;line-height:1.25;}

.order-status-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  max-width:100%;
  min-width:0;
  padding:4px 8px;
  border:1px solid var(--order-stat-border);
  border-radius:999px;
  background:var(--order-stat-bg);
  color:var(--order-stat-text);
  font-size:11px;
  line-height:1.1;
  font-weight:900;
  letter-spacing:0;
  text-transform:none;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  box-sizing:border-box;
}
.order-view-status-row .order-status-badge,.order-list-status .order-status-badge,.order-status-inline .order-status-badge{font-size:12px;padding:6px 10px;}
.wo-summary-toggle{margin-top:4px;border:0;background:transparent;color:var(--company-accent,#7b5b24);font-size:10px;font-weight:900;padding:0;cursor:pointer;}
.wo-summary-toggle:hover{text-decoration:underline;}
/* Keep invoice status styles isolated from order status badges */

.icon-btn,.small-btn.icon-btn,.add-btn{
  box-sizing:border-box;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  line-height:1;
  text-align:center;
  vertical-align:middle;
}
.icon-btn{
  width:34px;
  min-width:34px;
  height:34px;
  border-radius:11px;
  font-size:17px;
  padding:0;
  border:1px solid var(--border);
  background:#fff;
  color:var(--text);
}
.icon-btn.strong,.small-btn.icon-btn.strong{
  background:var(--company-accent-soft,#f3ead3);
  border-color:var(--company-accent,#b8914b);
}
.icon-btn.danger-btn,.danger-btn.delete-emoji{
  background:#fff7f7;
  border-color:#ead6d6;
  color:#c63b3b;
}
.icon-btn[disabled],.small-btn.icon-btn[disabled]{opacity:.42;cursor:not-allowed;}

.icon-btn:not(.danger-btn):not(.delete-emoji),.small-btn.icon-btn:not(.danger-btn):not(.delete-emoji),.add-btn:not(.danger-btn):not(.delete-emoji){
  background:transparent;
  border-color:transparent;
  box-shadow:none;
}
.icon-btn.strong:not(.danger-btn):not(.delete-emoji),.small-btn.icon-btn.strong:not(.danger-btn):not(.delete-emoji){
  background:transparent;
  border-color:transparent;
  color:var(--text);
}
.icon-btn:not(.danger-btn):not(.delete-emoji):hover,.small-btn.icon-btn:not(.danger-btn):not(.delete-emoji):hover,.add-btn:not(.danger-btn):not(.delete-emoji):hover{
  background:rgba(0,0,0,.045);
  border-color:transparent;
}
.danger-btn.delete-emoji,.icon-btn.danger-btn{
  background:#fff7f7;
  border-color:#ead6d6;
  color:#c63b3b;
}
.wo-summary-toggle,.wo-summary-toggle:visited,.wo-summary-toggle:hover,.wo-summary-toggle:active{
  color:#111;
}
.order-status-select{font-weight:800;}
.assign-modal-grid{grid-template-columns:repeat(2,minmax(0,1fr));}
@media (max-width:760px){.assign-modal-grid{grid-template-columns:1fr;}}

.invoice-status-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:84px;
  border-radius:999px;
  border:1px solid transparent;
  padding:6px 10px;
  font-size:11px;
  line-height:1;
  font-weight:900;
  letter-spacing:.02em;
  text-transform:uppercase;
  white-space:nowrap;
}
.invoice-status-badge.paid{background:#eefbf3;color:#16794a;border-color:#9fd5b8;}
.invoice-status-badge.unpaid{background:#fff1f1;color:#b42318;border-color:#f4b5b0;}
.invoice-status-badge.draft{background:#f2f4f7;color:#475467;border-color:#d0d5dd;}
.invoice-status-badge.partial{background:#fff4e5;color:#9a5b00;border-color:#f7c67a;}
.invoice-status-badge.estimate{background:#f5f0ff;color:#6941c6;border-color:#c7b6f3;}
.wo-summary-toggle,.wo-summary-toggle:hover,.wo-summary-toggle:active{
  color:#111;
}
.icon-btn:not(.danger-btn):not(.delete-emoji),.small-btn.icon-btn:not(.danger-btn):not(.delete-emoji),.add-btn:not(.danger-btn):not(.delete-emoji){
  background:transparent;
  border-color:transparent;
  box-shadow:none;
}
.icon-btn:not(.danger-btn):not(.delete-emoji):hover,.small-btn.icon-btn:not(.danger-btn):not(.delete-emoji):hover,.add-btn:not(.danger-btn):not(.delete-emoji):hover{
  background:rgba(0,0,0,.045);
  border-color:transparent;
}
.icon-btn.danger-btn,.danger-btn.delete-emoji{
  background:#fff7f7;
  border-color:#ead6d6;
  color:#c63b3b;
}
.order-status-other-fold summary{
  color:#344054;
}

:root{
  --ui-bg:var(--bg,#f6f5f3);
  --ui-surface:var(--panel,#ffffff);
  --ui-sidebar:var(--sidebar,#76726f);
  --ui-primary:var(--company-accent,var(--sidebar,#76726f));
  --ui-primary-soft:var(--company-accent-soft,#f3ead3);
  --ui-text:var(--text,#1f1f1f);
  --ui-muted:var(--muted,#6f6a63);
  --ui-border:var(--border,#e6e2db);
  --ui-input:var(--ui-form-control-bg,#fff);
  --ui-danger:#c63b3b;
  --ui-danger-bg:#fff7f7;
  --ui-danger-border:#ead6d6;
  --ui-success:#16794a;
  --ui-success-bg:#eefbf3;
  --ui-warning:#9a5b00;
  --ui-warning-bg:#fff4e5;
  --ui-radius-sm:12px;
  --ui-radius-md:16px;
  --ui-radius-lg:22px;
  --ui-radius-xl:32px;
  --ui-shadow-sm:0 6px 18px rgba(31,31,31,.06);
  --ui-shadow-md:0 14px 32px rgba(31,31,31,.10);
  --ui-focus:0 0 0 3px rgba(118,114,111,.16);
}

button,input,select,textarea{font:inherit;}
button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,a:focus-visible{outline:0;box-shadow:var(--ui-focus);}

/* Buttons */
.btn,.small-btn,.btn-ghost,.btn-import-clipboard{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  border:1px solid var(--ui-border);
  border-radius:var(--ui-radius-md);
  background:#fff;
  color:var(--ui-text);
  cursor:pointer;
  font-weight:800;
  text-decoration:none;
  transition:background .16s ease,border-color .16s ease,box-shadow .16s ease,transform .12s ease;
}
.btn{min-height:46px;padding:0 18px;}
.small-btn{min-height:36px;padding:0 12px;}
.btn:hover,.small-btn:hover,.btn-ghost:hover,.btn-import-clipboard:hover{background:#f8f7f5;border-color:#d8d1c7;}
.btn:active,.small-btn:active,.icon-btn:active{transform:translateY(1px);}
.btn.primary,.btn-primary{background:var(--ui-primary);border-color:var(--ui-primary);color:#fff;}
.btn.primary:hover,.btn-primary:hover{filter:brightness(.96);}
.btn-secondary{background:var(--ui-primary-soft);border-color:var(--ui-primary);color:var(--ui-text);}
.btn-danger,.danger-btn{background:var(--ui-danger-bg);border-color:var(--ui-danger-border);color:var(--ui-danger);}
.btn[disabled],.small-btn[disabled],.icon-btn[disabled]{opacity:.48;cursor:not-allowed;}

/* Icon / emoji buttons */
.icon-btn,.small-btn.icon-btn,.add-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:34px;
  min-width:34px;
  height:34px;
  padding:0;
  border-radius:11px;
  border:1px solid transparent;
  background:transparent;
  color:var(--ui-text);
  line-height:1;
  text-align:center;
  cursor:pointer;
  transition:background .16s ease,border-color .16s ease,transform .12s ease;
}
.icon-btn:hover,.small-btn.icon-btn:hover,.add-btn:hover{background:rgba(0,0,0,.045);}
.icon-btn-danger,.icon-btn.danger-btn,.delete-emoji,.danger-btn.delete-emoji{background:var(--ui-danger-bg);border-color:var(--ui-danger-border);color:var(--ui-danger);}
.icon-btn-danger:hover,.icon-btn.danger-btn:hover,.danger-btn.delete-emoji:hover{background:#ffefef;border-color:#e7c5c5;}

/* Form controls */
.input,.select,.textarea,.form-control{
  width:100%;
  border:1px solid var(--ui-border);
  background:var(--ui-input);
  color:var(--ui-text);
  border-radius:var(--ui-radius-md);
  min-height:42px;
  padding:0 14px;
  transition:border-color .16s ease,box-shadow .16s ease,background .16s ease;
}
.textarea,textarea.form-control{min-height:110px;padding:12px 14px;resize:vertical;}
.input:focus,.select:focus,.textarea:focus,.form-control:focus{border-color:var(--ui-primary);background:#fff;}
.label,.form-label{display:block;color:var(--ui-muted);font-size:13px;font-weight:800;margin-bottom:6px;}
.form-help{color:var(--ui-muted);font-size:12px;line-height:1.45;}

/* Cards / panels */
.card,.hero,.panel-card{background:var(--ui-surface);border:1px solid var(--ui-border);border-radius:var(--ui-radius-xl);box-shadow:none;}
.card-section,.sub-card{background:#fff;border:1px solid var(--ui-border);border-radius:var(--ui-radius-lg);padding:16px;}

/* Tables */
.table,.table-card,.data-table{border:1px solid var(--ui-border);border-radius:var(--ui-radius-lg);overflow:hidden;background:#fff;}
.list-header{background:#f6f3ee;color:#7a7369;font-size:12px;font-weight:900;letter-spacing:.04em;text-transform:uppercase;}
.list-row,.data-table-row{border-top:1px solid #efebe5;}
.list-row:first-child,.data-table-row:first-child{border-top:0;}

/* Badges */
.badge,.ui-badge,.status-badge{display:inline-flex;align-items:center;justify-content:center;border-radius:999px;font-weight:900;line-height:1;white-space:nowrap;}
.ui-badge,.status-badge{padding:6px 10px;font-size:12px;border:1px solid transparent;}
.invoice-status-badge,.estimate-status-badge,.order-status-badge{display:inline-flex;align-items:center;justify-content:center;border-radius:999px;font-weight:900;white-space:nowrap;box-sizing:border-box;}
.invoice-status-badge.paid{background:var(--ui-success-bg);color:var(--ui-success);border-color:#9fd5b8;}
.invoice-status-badge.unpaid{background:#fff1f1;color:#b42318;border-color:#f4b5b0;}
.invoice-status-badge.draft{background:#f2f4f7;color:#475467;border-color:#d0d5dd;}
.invoice-status-badge.partial{background:var(--ui-warning-bg);color:var(--ui-warning);border-color:#f7c67a;}
.estimate-status-badge{background:#f5f0ff;color:#6941c6;border-color:#c7b6f3;}

.page-toolbar,.section-toolbar{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;}
.company-unified-select{border-color:var(--ui-border);background:var(--ui-input);}
.is-search-hidden,[data-search-hidden="1"]{display:none;}

@media (max-width:760px){
  .page-toolbar,.section-toolbar{align-items:stretch;}
  .page-toolbar > *,.section-toolbar > *{min-width:0;}
  .btn,.small-btn{max-width:100%;}
}

.settings-company-controls .company-unified-select{
  flex:0 1 220px;
}

.icon-btn,.small-btn.icon-btn,.add-btn:not(.btn):not(.small-btn){
  border:1px solid var(--ui-border,#ded7cd);
  background:#fff;
  box-shadow:0 1px 4px rgba(31,31,31,.06);
}
.icon-btn:not(.danger-btn):not(.delete-emoji):hover,.small-btn.icon-btn:not(.danger-btn):not(.delete-emoji):hover,.add-btn:not(.danger-btn):not(.delete-emoji):hover{
  background:#f8f7f5;
  border-color:#d8d1c7;
  box-shadow:0 2px 7px rgba(31,31,31,.08);
}
.icon-btn.strong:not(.danger-btn):not(.delete-emoji),.small-btn.icon-btn.strong:not(.danger-btn):not(.delete-emoji){
  border-color:var(--company-accent,#b8914b);
  background:var(--company-accent-soft,#f3ead3);
}

.icon-btn,.small-btn.icon-btn,.emoji-btn,button.add-btn:not(.btn):not(.small-btn),button.add-btn:not(.danger-btn):not(.delete-emoji){
  box-sizing:border-box;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:34px;
  min-width:34px;
  max-width:34px;
  height:34px;
  min-height:34px;
  padding:0;
  border:1px solid #d8dee8;
  border-radius:10px;
  background:#ffffff;
  color:#1f2933;
  font-size:16px;
  line-height:1;
  text-decoration:none;
  box-shadow:none;
  cursor:pointer;
}
.icon-btn.strong:not(.danger-btn):not(.delete-emoji),.small-btn.icon-btn.strong:not(.danger-btn):not(.delete-emoji),.icon-btn.primary:not(.danger-btn):not(.delete-emoji),.small-btn.icon-btn.primary:not(.danger-btn):not(.delete-emoji),.emoji-btn.primary:not(.danger-btn):not(.delete-emoji),button.add-btn.strong:not(.danger-btn):not(.delete-emoji),button.add-btn.primary:not(.danger-btn):not(.delete-emoji){
  border:1px solid #d8dee8;
  background:#ffffff;
  color:#1f2933;
  box-shadow:none;
}
.icon-btn:not(.danger-btn):not(.delete-emoji):not(.icon-btn-danger):hover,.small-btn.icon-btn:not(.danger-btn):not(.delete-emoji):not(.icon-btn-danger):hover,.emoji-btn:not(.danger-btn):not(.delete-emoji):not(.icon-btn-danger):hover,button.add-btn:not(.danger-btn):not(.delete-emoji):hover{
  background:#f3f6fb;
  border-color:#b8c2d3;
  color:#1f2933;
  box-shadow:none;
}
.icon-btn.danger-btn,.small-btn.icon-btn.danger-btn,.icon-btn.delete-emoji,.small-btn.icon-btn.delete-emoji,.icon-btn-danger,.danger-btn.delete-emoji,button.add-btn.danger-btn,button.add-btn.delete-emoji{
  border:1px solid #fecaca;
  background:#fff1f2;
  color:#dc2626;
  box-shadow:none;
}
.icon-btn.danger-btn:hover,.small-btn.icon-btn.danger-btn:hover,.icon-btn.delete-emoji:hover,.small-btn.icon-btn.delete-emoji:hover,.icon-btn-danger:hover,.danger-btn.delete-emoji:hover,button.add-btn.danger-btn:hover,button.add-btn.delete-emoji:hover{
  background:#ffe4e6;
  border-color:#fca5a5;
  color:#dc2626;
  box-shadow:none;
}

.settings-tabs-card{
  border-radius:16px;
}
.settings-tabs{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  align-items:center;
}
.settings-tab{
  min-height:36px;
  border:1px solid #d8dee8;
  background:#fff;
  border-radius:12px;
  padding:9px 14px;
  font-size:14px;
  font-weight:700;
  line-height:1.2;
}
.settings-tab.active{
  background:#eef4ff;
  border-color:#b9cdf8;
  color:#1d4ed8;
}
.unified-list-card,.form-card{
  border-radius:16px;
  padding:18px;
}
.unified-list-wrap{
  display:flex;
  flex-direction:column;
  gap:10px;
}
.unified-name{
  font-weight:800;
  color:#1f2933;
  font-size:15px;
}
.client-meta,.unified-meta-bottom{
  color:#6b7280;
  font-size:12px;
  margin-top:5px;
}
.unified-meta-top{
  display:flex;
  flex-wrap:wrap;
  gap:8px 14px;
  color:#374151;
  font-size:13px;
}
.icon-btn.danger,button.icon-btn.danger,a.icon-btn.danger{
  border-color:#fecaca;
  background:#fff1f2;
  color:#dc2626;
  box-shadow:0 1px 2px rgba(220,38,38,.08);
}
.icon-btn.danger:hover,button.icon-btn.danger:hover,a.icon-btn.danger:hover{
  background:#ffe4e6;
  border-color:#fca5a5;
  color:#dc2626;
}
.form-card .grid-2{
  gap:14px;
}
.form-card .actions{
  margin-top:18px;
  justify-content:flex-end;
}
@media (max-width: 860px){
  .row-actions.icon-actions,.clients-actions{
    justify-content:flex-start;
  }
}

.data-tabs-card .settings-tabs{gap:10px;}
.data-master-card,.clients-card.unified-list-card{
  border-radius:16px;
  padding:18px;
  border:1px solid #e5eaf2;
  background:#fff;
}
.data-master-card .unified-left,.clients-card.unified-list-card .unified-left{
  min-width:0;
}
.data-master-card .unified-name,.clients-card.unified-list-card .unified-name{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.system-id-field,.input.system-id-field[readonly]{
  background:#f8fafc;
  color:#64748b;
  border-color:#d8dee8;
  cursor:not-allowed;
  font-weight:700;
}
.data-nav-card .settings-tab[data-back-nav]{
  color:#374151;
  background:#fff;
}
@media (max-width: 860px){
  .data-master-card .unified-name,.clients-card.unified-list-card .unified-name{
    white-space:normal;
  }
}

.order-status-board{
  padding:18px;
  border:1px solid var(--ui-border);
  border-radius:24px;
  background:#fff;
  box-shadow:0 10px 26px rgba(16,24,40,.045);
  overflow:visible;
}
.order-status-board .list-page-header{
  align-items:center;
  margin:0 0 14px;
  padding:0 2px 12px;
  border-bottom:1px solid var(--ui-border);
}
.order-status-board .list-page-title-group{
  display:flex;
  align-items:center;
  gap:10px;
  flex:1 1 auto;
  min-width:0;
}
.order-status-board .ui-page-title{
  min-height:38px;
  display:flex;
  align-items:center;
  font-size:20px;
  line-height:1.1;
  font-weight:950;
  white-space:nowrap;
}
.order-status-board .list-page-search{
  width:260px;
  min-width:220px;
  max-width:300px;
  height:38px;
  min-height:38px;
  border-radius:14px;
}
.order-status-board .list-page-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:8px;
  margin-left:auto;
  flex:0 0 auto;
}
.order-status-board .order-status-columns{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:14px;
  align-items:start;
  padding:0;
}
.order-status-board .order-status-column{
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:10px;
  border:1px solid var(--ui-border);
  border-radius:20px;
  background:#fbfaf8;
  padding:12px;
  box-shadow:none;
}
.order-status-board .order-status-column-head{
  display:flex;
  align-items:flex-start;
  gap:10px;
  min-height:0;
  padding:0 0 10px;
  border-bottom:1px solid #eee7dc;
}
.order-status-board .order-status-column-icon{
  width:34px;
  height:34px;
  flex:0 0 34px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:12px;
  font-size:16px;
  background:#fff;
  border:1px solid var(--ui-border);
}
.order-status-board .order-status-column-head h3{
  font-size:15px;
  line-height:1.15;
  font-weight:950;
  margin:0;
  color:var(--text,#2b2b2b);
}
.order-status-board .order-status-column-head p{
  font-size:11px;
  line-height:1.2;
  font-weight:800;
  margin:3px 0 0;
  color:var(--ui-muted,var(--muted,#6f6a63));
}
.order-status-board .order-status-column-list{
  display:flex;
  flex-direction:column;
  gap:10px;
  padding:0;
  overflow:visible;
}
.order-status-board .order-status-empty{
  width:100%;
  padding:12px;
  border:1px dashed var(--ui-border);
  border-radius:14px;
  background:#fff;
  color:var(--ui-muted,var(--muted,#6f6a63));
  font-size:12px;
  font-weight:700;
  text-align:center;
}
.order-status-board .order-status-card{
  width:100%;
  display:flex;
  flex-direction:column;
  align-items:stretch;
  gap:8px;
  border:1px solid #e8e1d8;
  border-radius:16px;
  background:#fff;
  padding:10px;
  box-shadow:0 4px 12px rgba(16,24,40,.04);
  box-sizing:border-box;
}
.order-status-board .order-status-card.is-completed{
  background:#fbfaf8;
  opacity:.9;
}
.order-status-board .order-card-header{
  display:grid;
  grid-template-columns:minmax(0,1.15fr) minmax(96px,.65fr) minmax(96px,.65fr);
  gap:6px 8px;
  align-items:center;
  padding-bottom:8px;
  border-bottom:1px solid #f0ebe4;
}
.order-status-board .order-card-number{
  grid-column:1;
  grid-row:1;
  font-size:10px;
  line-height:1.1;
  font-weight:950;
  color:var(--ui-muted,var(--muted,#6f6a63));
  letter-spacing:.04em;
  text-transform:uppercase;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.order-status-board .order-card-status{
  grid-column:2/4;
  grid-row:1;
  display:flex;
  align-items:center;
  justify-content:flex-end;
  min-width:0;
  max-width:100%;
  overflow:hidden;
}
.order-status-board .order-card-status .order-status-badge{
  max-width:100%;
  font-size:9px;
  padding:3px 7px;
  line-height:1.1;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.order-status-board .order-card-address{
  grid-column:1/3;
  grid-row:2;
  font-size:14px;
  line-height:1.18;
  font-weight:950;
  color:var(--text,#2b2b2b);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.order-status-board .order-card-date-scheduled{grid-column:3;grid-row:2;text-align:right;}
.order-status-board .order-card-phone{
  grid-column:1;
  grid-row:3;
  font-size:13px;
  line-height:1.18;
  font-weight:900;
  color:var(--text,#2b2b2b);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.order-status-board .order-card-date-estimated{grid-column:2;grid-row:3;}
.order-status-board .order-card-date-completed{grid-column:3;grid-row:3;text-align:right;}
.order-status-board .order-card-date{
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:2px;
}
.order-status-board .order-card-date span{
  font-size:8px;
  line-height:1;
  font-weight:950;
  color:var(--ui-muted,var(--muted,#6f6a63));
  letter-spacing:.04em;
  text-transform:uppercase;
}
.order-status-board .order-card-date strong{
  min-height:1.18em;
  font-size:10px;
  line-height:1.18;
  font-weight:850;
  color:var(--text,#2b2b2b);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.order-status-board .order-card-body{
  display:grid;
  grid-template-columns:minmax(0,1fr) 119px;
  align-items:end;
  gap:8px;
}
.order-status-board .order-card-summary{
  min-width:0;
  min-height:2.72em;
  font-size:11px;
  line-height:1.36;
  color:var(--text,#2b2b2b);
  overflow-wrap:anywhere;
  word-break:normal;
  white-space:pre-wrap;
}
.order-status-board .order-card-summary-wrap.is-foldable.is-collapsed .order-card-summary{
  max-height:calc(1.36em * 2);
  overflow:hidden;
}
.order-status-board .order-card-summary-toggle{
  margin-top:4px;
  padding:0;
  border:0;
  background:transparent;
  color:#111;
  font-size:10px;
  font-weight:950;
  cursor:pointer;
}
.order-status-board .order-card-actions{
  display:grid;
  grid-template-columns:repeat(4,26px);
  grid-auto-rows:26px;
  gap:5px;
  width:119px;
  min-width:119px;
  max-width:119px;
  align-items:center;
  justify-items:center;
  justify-content:end;
  align-self:end;
  white-space:normal;
}
.order-status-board .order-card-action-btn,.order-status-board .order-card-actions .ui-action-btn{
  --ui-action-size:26px;
  --ui-action-radius:8px;
  width:26px;
  min-width:26px;
  max-width:26px;
  height:26px;
  min-height:26px;
  max-height:26px;
  border-radius:8px;
  font-size:12px;
  line-height:1;
}
.order-status-board .order-card-actions .ui-action-btn[disabled]{
  opacity:.42;
  cursor:not-allowed;
}
.order-status-board .order-status-completed-fold{
  border-top:1px solid #eee7dc;
  margin-top:8px;
  padding-top:10px;
}
.order-status-board .order-status-completed-fold summary{
  margin:0 0 10px;
  color:var(--text,#2b2b2b);
  font-size:12px;
  line-height:1.25;
  font-weight:950;
  cursor:pointer;
}
.order-status-board .order-status-other-fold summary{color:var(--ui-muted,var(--muted,#6f6a63));}
@media (max-width:1180px){
  .order-status-board .order-status-columns{grid-template-columns:1fr;}
  .order-status-board .list-page-title-group{flex-wrap:wrap;}
  .order-status-board .list-page-search{width:100%;max-width:none;min-width:0;flex:1 1 260px;}
}
@media (max-width:760px){
  .order-status-board{padding:12px;border-radius:18px;}
  .order-status-board .list-page-header{align-items:stretch;flex-direction:column;}
  .order-status-board .list-page-title-group{width:100%;flex-direction:column;align-items:stretch;}
  .order-status-board .list-page-search{width:100%;min-width:0;max-width:none;}
  .order-status-board .list-page-actions{justify-content:flex-start;margin-left:0;}
  .order-status-board .order-card-header{grid-template-columns:minmax(0,1fr) minmax(0,1fr);}
  .order-status-board .order-card-status{grid-column:2;}
  .order-status-board .order-card-address{grid-column:1/-1;grid-row:2;}
  .order-status-board .order-card-date-scheduled{grid-column:1;grid-row:3;text-align:left;}
  .order-status-board .order-card-phone{grid-column:1/-1;grid-row:4;}
  .order-status-board .order-card-date-estimated{grid-column:1;grid-row:5;}
  .order-status-board .order-card-date-completed{grid-column:2;grid-row:5;text-align:right;}
  .order-status-board .order-card-body{grid-template-columns:1fr;}
  .order-status-board .order-card-actions{justify-self:end;}
}

.order-form-shell{
  display:flex;
  flex-direction:column;
  gap:18px;
}
.order-form-editor-panel,.order-edit-shell{
  width:100%;
  max-width:100%;
  box-sizing:border-box;
}
.order-form-editor-head,.order-edit-hero{
  align-items:center;
}
.order-edit-title-block{
  min-width:0;
}
.order-form-meta-grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:14px;
  align-items:stretch;
}
.order-form-meta-grid.order-new-meta-grid{
  grid-template-columns:repeat(5,minmax(0,1fr));
}
.order-form-two-col{
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(0,1fr);
  gap:16px;
  align-items:stretch;
}
.order-form-property-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:14px;
}
.order-form-summary-section,.order-form-property-section,.order-form-items-section,.order-form-request-section,.order-form-notes-section{
  min-width:0;
}
.order-form-request-head{
  margin-bottom:12px;
}
.order-form-items-section{
  margin-top:4px;
}
.order-form-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:10px;
  flex-wrap:wrap;
  margin-top:22px;
  padding:14px 0 4px;
  border-top:1px solid #eef2f7;
  background:linear-gradient(180deg,rgba(255,255,255,.72) 0%,#fff 38%);
}
.order-form-actions .btn{
  min-height:40px;
  height:40px;
  border-radius:12px;
  font-weight:900;
}
.order-list-panel{
  min-width:0;
}
.order-list-card{
  align-items:center;
}
.order-list-card-left,.order-list-card-middle{
  min-width:0;
}
.order-list-card-middle .unified-meta-top,.order-list-card-middle .unified-meta-bottom{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
}
.order-list-actions{
  justify-content:flex-start;
  flex-wrap:nowrap;
}
@media (max-width:1180px){
  .order-form-meta-grid,.order-form-meta-grid.order-new-meta-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
}
@media (max-width:900px){
  .order-form-two-col,.order-form-property-grid{
    grid-template-columns:1fr;
  }
  .order-form-editor-head,.order-edit-hero{
    align-items:stretch;
  }
  .order-list-actions{
    flex-wrap:wrap;
  }
  .order-form-actions{
    justify-content:flex-start;
  }
}
@media (max-width:640px){
  .order-form-meta-grid,.order-form-meta-grid.order-new-meta-grid{
    grid-template-columns:1fr;
  }
  .order-form-actions{
    position:static;
  }
}

.order-status-stat-button{
  appearance:none;
  cursor:pointer;
  text-align:left;
  transition:transform .12s ease, box-shadow .12s ease, filter .12s ease;
}
.order-status-stat-button.is-active{
  outline:2px solid rgba(37,99,235,.45);
  outline-offset:2px;
  box-shadow:0 0 0 4px rgba(37,99,235,.10),0 8px 18px rgba(16,24,40,.08);
}
.order-status-clear-filter,.order-status-active-filter-chip button{
  border:1px solid var(--ui-border);
  background:#fff;
  color:var(--ui-text);
  border-radius:999px;
  height:34px;
  padding:0 12px;
  font-size:12px;
  font-weight:850;
  cursor:pointer;
  white-space:nowrap;
}
.order-status-clear-filter:hover,.order-status-active-filter-chip button:hover{
  background:#f7f8fb;
  border-color:#b8c2d3;
}
.order-status-active-filter-chip{
  display:inline-flex;
  align-items:center;
  gap:8px;
  align-self:flex-start;
  border:1px solid #bfdbfe;
  background:#eff6ff;
  color:#1d4ed8;
  border-radius:999px;
  padding:5px 6px 5px 12px;
  font-size:12px;
  font-weight:900;
}
.order-status-active-filter-chip button{
  height:26px;
  padding:0 9px;
  color:#1d4ed8;
  border-color:#bfdbfe;
}
@media (max-width:1180px){
  .order-status-clear-filter{width:auto;}
  .order-status-active-filter-chip{max-width:100%;flex-wrap:wrap;}
}

.order-list-title-stack{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}
.order-list-filter-page .order-status-active-filter-chip{
  margin-top:0;
}

.order-form-page,.order-detail-page{
  display:flex;
  flex-direction:column;
  gap:18px;
}
.order-form-page .order-view-card,.order-detail-page.order-view-card,.order-edit-card,.order-new-edit-box{
  border:1px solid var(--border);
  border-radius:22px;
  background:#fff;
  box-shadow:0 12px 32px rgba(34,28,16,.06);
}
.order-page-head,.order-view-card > .order-view-top{
  padding:18px 18px;
  margin:-6px -4px 18px;
  border:1px solid rgba(216,222,232,.8);
  border-radius:20px;
  background:linear-gradient(180deg,#ffffff 0%,#f8fafc 100%);
}
.order-page-actions,.order-view-top-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:10px;
  flex-wrap:wrap;
}
.order-page-actions .btn,.order-view-top-actions .btn{
  min-height:38px;
  border-radius:12px;
  font-weight:800;
}
.order-view-card .order-view-kicker{
  color:var(--muted);
  letter-spacing:.08em;
}
.order-view-card .order-view-title,.order-new-title{
  font-size:26px;
  line-height:1.12;
}
.order-view-card .order-view-section,.order-panel,.order-request-panel{
  border:1px solid var(--border);
  border-radius:20px;
  background:#fff;
  box-shadow:0 8px 22px rgba(34,28,16,.04);
}
.order-view-card .order-view-section-title{
  display:flex;
  align-items:center;
  gap:8px;
  min-height:30px;
  font-size:17px;
  font-weight:900;
  color:var(--text);
}
.order-view-meta-grid{
  grid-template-columns:repeat(4,minmax(0,1fr));
}
.order-form-page-edit .order-view-meta-grid{
  grid-template-columns:repeat(4,minmax(0,1fr));
}
.order-new-meta-grid{
  grid-template-columns:repeat(5,minmax(0,1fr));
}
.order-view-two-col{
  grid-template-columns:minmax(0,1fr) minmax(0,1fr);
  align-items:stretch;
}
.order-view-fields-grid,.order-new-property-grid{
  grid-template-columns:repeat(2,minmax(0,1fr));
}
.order-edit-card .input,.order-edit-card .select,.order-edit-card .textarea,.order-new-edit-box .input,.order-new-edit-box .select,.order-new-edit-box .textarea{
  border-radius:12px;
  border-color:#cfd8e6;
}
.order-edit-summary-head{
  min-height:42px;
  padding-bottom:8px;
  border-bottom:1px solid #eef2f7;
  margin-bottom:12px;
}
.order-edit-summary-head .lang-pill-group{
  gap:8px;
}
.order-edit-summary-head .lang-pill{
  height:34px;
  padding:0 14px;
  border-radius:999px;
}
.textarea-12rows,#wo_maintenance_summary_text{
  min-height:310px;
  line-height:1.6;
}
.order-view-summary-box,.order-view-note-box{
  border-radius:18px;
  background:#fbfcfe;
  border-color:#dde5ef;
}
.order-view-items{
  grid-template-columns:repeat(2,minmax(0,1fr));
}
.order-view-item-card{
  border-radius:16px;
  border-color:#dde5ef;
  background:#fff;
}
.order-form-actions{
  position:sticky;
  bottom:0;
  z-index:5;
  display:flex;
  justify-content:flex-end;
  gap:10px;
  flex-wrap:wrap;
  margin-top:22px;
  padding:14px 0 4px;
  background:linear-gradient(180deg,rgba(255,255,255,.72) 0%,#fff 38%);
  border-top:1px solid #eef2f7;
}
.order-form-actions .btn{
  min-height:40px;
  border-radius:12px;
  font-weight:900;
}
.order-new-shell.order-form-page-new{
  gap:18px;
}
.order-new-request-box{
  padding:20px;
}
.order-new-request-textarea{
  min-height:190px;
  border-radius:16px;
}
.order-new-company-top.no-company-label{
  min-width:220px;
  max-width:300px;
}
.order-new-wo-hint{
  color:#6b7280;
}
.order-edit-access-grid{
  align-items:start;
}
@media (max-width:1180px){
  .order-view-meta-grid,.order-form-page-edit .order-view-meta-grid,.order-new-meta-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
}
@media (max-width:900px){
  .order-view-two-col,.order-view-fields-grid,.order-new-property-grid,.order-view-items{
    grid-template-columns:1fr;
  }
  .order-page-head,.order-view-card > .order-view-top{
    margin:0 0 16px;
  }
  .order-page-actions,.order-view-top-actions,.order-form-actions{
    justify-content:flex-start;
  }
}
@media (max-width:640px){
  .order-view-meta-grid,.order-form-page-edit .order-view-meta-grid,.order-new-meta-grid{
    grid-template-columns:1fr;
  }
  .order-view-card .order-view-title,.order-new-title{
    font-size:22px;
  }
  .order-form-actions{
    position:static;
  }
}

:root{
  --ui-page-gap:16px;
  --ui-card-radius:24px;
  --ui-card-padding:18px;
  --ui-card-border:var(--border);
  --ui-card-shadow:0 10px 26px rgba(16,24,40,.045);
  --ui-section-radius:18px;
  --ui-section-padding:16px;
  --ui-section-gap:14px;
  --ui-header-min-height:52px;
  --ui-title-size:20px;
  --ui-section-title-size:16px;
  --ui-label-size:13px;
  --ui-control-height:42px;
  --ui-control-radius:14px;
  --ui-form-control-bg:#fff;
  --ui-form-control-focus-bg:#fff;
  --ui-field-card-bg:#fff;
  --ui-button-height:38px;
  --ui-button-radius:12px;
  --ui-action-size:34px;
  --ui-action-radius:10px;
  --global-top-height:74px;
  --global-top-select-width:280px;
  --global-top-stat-height:42px;
}

.main{gap:16px;}
.page-standard{width:100%;max-width:100%;min-width:0;display:flex;flex-direction:column;gap:var(--ui-page-gap);}

/* Global top toolbar */
.global-top-toolbar{width:100%;max-width:100%;min-height:var(--global-top-height);box-sizing:border-box;display:grid;grid-template-columns:minmax(220px,var(--global-top-select-width)) minmax(0,1fr);align-items:center;gap:14px;padding:14px 18px;border:1px solid var(--ui-card-border);border-radius:var(--ui-card-radius);background:linear-gradient(180deg,#ffffff,#fbfaf8);box-shadow:var(--ui-card-shadow);}
.global-top-toolbar.no-stats{grid-template-columns:minmax(220px,var(--global-top-select-width)) minmax(0,1fr);}
.global-top-company-wrap{min-width:0;display:flex;align-items:center;}
.global-top-company-select.company-unified-select,.global-top-company-select{width:100%;min-width:0;max-width:none;height:var(--ui-control-height);min-height:var(--ui-control-height);box-sizing:border-box;border-radius:14px;padding:0 38px 0 14px;font-size:14px;line-height:1;font-weight:850;letter-spacing:.01em;background:var(--company-accent,#ead58a);border-color:var(--company-accent,#ead58a);color:var(--text,#2b2b2b);}
.global-top-stats{min-width:0;display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:wrap;}
.global-top-stat-card,.global-top-clear-filter{height:var(--global-top-stat-height);min-height:var(--global-top-stat-height);box-sizing:border-box;border:1px solid var(--order-stat-border,#e6ded4);border-radius:14px;background:var(--order-stat-bg,#f6f3ee);color:var(--order-stat-text,#6f665a);display:inline-flex;align-items:center;justify-content:space-between;gap:10px;min-width:112px;padding:7px 11px;font-weight:900;cursor:default;box-shadow:none;text-decoration:none;}
button.global-top-stat-card,.global-top-clear-filter{cursor:pointer;}
.global-top-stat-card.is-active{outline:2px solid rgba(29,78,216,.20);outline-offset:2px;}
.global-top-stat-label{font-size:10px;line-height:1.1;font-weight:950;color:inherit;white-space:nowrap;text-transform:uppercase;letter-spacing:.02em;}
.global-top-stat-value{font-size:17px;line-height:1;font-weight:950;color:inherit;white-space:nowrap;}
.global-top-clear-filter{min-width:auto;background:#fff;color:#1d4ed8;border-color:#bfdbfe;justify-content:center;white-space:nowrap;}
.global-top-stat-total,.global-top-stat-invoiced{--order-stat-bg:#f3f0e7;--order-stat-text:#6d5f37;--order-stat-border:#e1d8bc;}
.global-top-stat-paid{--order-stat-bg:#eaf7ef;--order-stat-text:#16743a;--order-stat-border:#bfe4cc;}
.global-top-stat-unpaid{--order-stat-bg:#fff1f0;--order-stat-text:#b42318;--order-stat-border:#ffd0cc;}

/* Page panels / cards */
.ui-panel,.ui-card,.page-standard > .card,.page-standard > .hero,.page-standard > .order-view-card{width:100%;max-width:100%;box-sizing:border-box;border:1px solid var(--ui-card-border);border-radius:var(--ui-card-radius);background:var(--panel,#fff);box-shadow:var(--ui-card-shadow);padding:var(--ui-card-padding);overflow:visible;}
.page-standard > .order-new-shell{width:100%;max-width:100%;box-sizing:border-box;}
.ui-section,.section-card,.card-section,.sub-card,.page-standard > .order-new-shell > .order-new-panel,.page-standard > .order-new-shell > .order-new-request-box,.page-standard > .order-new-shell > .order-new-edit-box{width:100%;max-width:100%;box-sizing:border-box;border:1px solid var(--ui-card-border);border-radius:var(--ui-section-radius);background:var(--panel,#fff);box-shadow:0 8px 22px rgba(34,28,16,.035);padding:var(--ui-section-padding);overflow:visible;}
.ui-panel-header,.ui-section-header,.list-page-header,.page-header,.page-subheader{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:var(--ui-header-min-height);margin-bottom:14px;}
.ui-panel-title-group,.ui-section-title-group,.list-page-title-group,.page-header-left,.page-subheader-left{min-width:0;display:flex;align-items:center;gap:10px;flex-wrap:wrap;flex:1 1 auto;}
.ui-panel-actions,.ui-section-actions,.list-page-actions,.page-header-actions,.page-subheader-actions{margin-left:auto;display:flex;align-items:center;justify-content:flex-end;gap:10px;flex-wrap:wrap;}
.ui-page-title,.ui-panel-title,.page-header .ui-page-title,.page-subheader .ui-page-title{margin:0;font-size:var(--ui-title-size);line-height:1.2;font-weight:950;color:var(--text,#2b2b2b);white-space:nowrap;}
.ui-section-title,.ui-subtitle,.order-view-section-title{margin:0;font-size:var(--ui-section-title-size);line-height:1.25;font-weight:950;color:var(--text,#2b2b2b);}

/* List headers */

/* Table column baseline for migrated list tables. */
.billing-list-table{width:100%;table-layout:fixed;min-width:960px;}
.billing-list-table thead th,.billing-list-table tbody td{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.billing-list-table thead th{vertical-align:middle;}
.billing-list-table col.billing-col-docno{width:126px;}
.billing-list-table col.billing-col-address{width:270px;}
.billing-list-table col.billing-col-client{width:140px;}
.billing-list-table col.billing-col-total{width:92px;}
.billing-list-table col.billing-col-status{width:96px;}
.billing-list-table col.billing-col-actions{width:252px;}
.billing-list-estimate{min-width:850px;}
.billing-list-estimate col.billing-col-actions{width:220px;}
.accounting-list-panel .list-page-header{margin-bottom:14px;padding-bottom:12px;border-bottom:1px solid #eef2f7;}
.accounting-list-panel .accounting-table-wrap{padding-bottom:0;}
.accounting-list-panel .accounting-table{width:100%;min-width:760px;}
.accounting-list-panel .accounting-table th,.accounting-list-panel .accounting-table td{text-align:left;}

/* Form baseline */
.ui-form-grid,.form-grid-standard{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--ui-section-gap);align-items:start;}
.ui-form-grid-3{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:var(--ui-section-gap);align-items:start;}
.form-row-spaced{margin-top:var(--ui-section-gap);}
.ui-form-row,.form-row-standard{display:flex;align-items:flex-end;gap:var(--ui-section-gap);flex-wrap:wrap;}
.ui-field,.field-standard{min-width:0;display:flex;flex-direction:column;gap:6px;}
.ui-field-full{grid-column:1/-1;}
.ui-label,.label,.form-label{display:block;color:var(--muted,#6f6a63);font-size:var(--ui-label-size);font-weight:850;margin:0 0 6px;line-height:1.25;}
.ui-input,.ui-select,.ui-textarea,.input,.select,.textarea,.form-control{box-sizing:border-box;width:100%;min-height:var(--ui-control-height);border:1px solid var(--ui-card-border);background:var(--ui-form-control-bg);color:var(--text,#2b2b2b);border-radius:var(--ui-control-radius);padding:0 14px;font-size:14px;line-height:1.35;transition:border-color .16s ease,box-shadow .16s ease,background .16s ease;}
.ui-textarea,.textarea,textarea.form-control{min-height:112px;padding:12px 14px;resize:vertical;}
.ui-input:focus,.ui-select:focus,.ui-textarea:focus,.input:focus,.select:focus,.textarea:focus,.form-control:focus{border-color:var(--company-accent,#c9a74c);background:var(--ui-form-control-focus-bg);box-shadow:0 0 0 3px rgba(201,167,76,.14);outline:0;}
.ui-help,.form-help,.form-help-spaced{color:var(--muted,#6f6a63);font-size:12px;line-height:1.45;}
.form-help-spaced{margin-top:10px;}
.ui-title-reset{margin:0;}
.ui-meta-spaced{margin-top:6px;}
.ui-empty-state{padding:18px;color:var(--muted,#6f6a63);}
.ui-error-state{padding:24px;color:#991b1b;}
.ui-hidden-file{display:none;}
.ui-mt-0{margin-top:0;}
.ui-mt-8{margin-top:8px;}
.ui-mt-14{margin-top:14px;}
.ui-mt-18{margin-top:18px;}
.ui-mb-16{margin-bottom:16px;}
.template-warning-title{margin-bottom:8px;color:#b45309;font-size:18px;}
.template-warning-message,.template-warning-help{display:block;color:#92400e;}
.template-warning-help{margin-top:6px;}
.template-status-note{display:block;margin:6px 0 10px;}
.template-status-note.is-ready{color:var(--muted,#6f6a63);}
.template-status-note.is-warning{color:#92400e;}
.ui-form-actions,.invoice-generator-actions{display:flex;align-items:center;justify-content:flex-end;gap:10px;flex-wrap:wrap;margin-top:18px;}
.form-page-header{padding-bottom:12px;border-bottom:1px solid #eef2f7;}

/* Buttons and global emoji actions */
.btn,.small-btn,.settings-tab,.nav-btn{box-sizing:border-box;}
.btn.btn-secondary{min-height:var(--ui-button-height);height:var(--ui-button-height);border-radius:var(--ui-button-radius);font-size:13px;font-weight:850;}
.ui-action-btn{appearance:none;-webkit-appearance:none;box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;flex:0 0 var(--ui-action-size);width:var(--ui-action-size);min-width:var(--ui-action-size);max-width:var(--ui-action-size);height:var(--ui-action-size);min-height:var(--ui-action-size);max-height:var(--ui-action-size);padding:0;margin:0;border:1px solid #d8dee8;border-radius:var(--ui-action-radius);background:#fff;color:#1f2933;font-size:16px;font-weight:800;line-height:1;text-align:center;text-decoration:none;box-shadow:0 1px 2px rgba(16,24,40,.04);cursor:pointer;}
.ui-action-btn:hover{background:#f3f6fb;border-color:#b8c2d3;color:#1f2933;box-shadow:none;}
.ui-action-btn[disabled]{opacity:.45;cursor:not-allowed;}
.ui-action-strong{border-color:#bfd3ff;background:#eef5ff;color:#1d4ed8;}
.ui-action-danger{border-color:#fecaca;background:#fff1f2;color:#dc2626;box-shadow:0 1px 2px rgba(220,38,38,.08);}
.ui-action-danger:hover{background:#ffe4e6;border-color:#fca5a5;color:#dc2626;}

.ui-flyout{position:relative;display:inline-flex;align-items:center;justify-content:center;overflow:visible;z-index:90;}
.ui-flyout > .ui-action-btn{position:relative;z-index:1;}
.ui-flyout-popover{position:absolute;top:calc(100% + 8px);left:50%;transform:translateX(-50%);display:none;min-width:124px;padding:8px;background:#fff;border:1px solid var(--ui-card-border,var(--border));border-radius:14px;box-shadow:0 16px 32px rgba(15,23,42,.18);z-index:1000;}
.ui-flyout:hover .ui-flyout-popover,.ui-flyout:focus-within .ui-flyout-popover{display:block;}
.ui-flyout-popover button{display:block;width:100%;border:0;background:transparent;color:var(--text,#2b2b2b);padding:9px 10px;border-radius:10px;text-align:center;font-size:13px;font-weight:850;cursor:pointer;}
.ui-flyout-popover button:hover{background:#f3f6fb;}

/* Billing / Invoice component baseline.
   Outer cards use shared ui-panel; invoice item rows,totals,list table,and action menus remain billing-specific. */
.billing-list-actions{display:flex;align-items:center;justify-content:flex-start;gap:7px;flex-wrap:nowrap;overflow:visible;}
.billing-list-table tbody tr.billing-list-row{position:relative;z-index:1;}
.billing-list-table tbody td.billing-list-actions-cell{position:relative;overflow:visible;}
.billing-list-actions-cell{position:relative;overflow:visible;}
.billing-list-docno strong,.billing-list-total{font-size:15px;font-weight:700;line-height:1.2;}
.billing-list-address,.billing-list-client{font-size:14px;font-weight:600;}

.billing-flyout{position:relative;display:inline-flex;align-items:center;justify-content:center;overflow:visible;z-index:90;}
.billing-flyout > .ui-action-btn{position:relative;z-index:1;}
.billing-flyout:hover .billing-flyout-popover,.billing-flyout:focus-within .billing-flyout-popover{display:block;}
.billing-flyout-trigger{position:relative;z-index:1;}
.billing-flyout-popover{position:absolute;top:calc(100% + 8px);left:50%;transform:translateX(-50%);display:none;min-width:124px;padding:8px;background:#fff;border:1px solid var(--ui-card-border);border-radius:14px;box-shadow:0 16px 32px rgba(15,23,42,.18);z-index:1000;}
.billing-list-row.is-last-row .billing-flyout-popover{top:auto;bottom:calc(100% + 8px);}
.billing-flyout-item{display:block;width:100%;border:0;background:transparent;color:var(--text,#2b2b2b);padding:9px 10px;border-radius:10px;text-align:center;font-size:13px;font-weight:850;cursor:pointer;}
.billing-flyout-item:hover{background:#f3f6fb;}
@media (max-width:980px){.billing-list-table{min-width:900px;}.billing-list-estimate{min-width:820px;}}
.billing-generator-panel{display:flex;flex-direction:column;gap:0;}
.billing-generator-grid{gap:var(--ui-section-gap);align-items:end;}
.billing-generator-header-grid{grid-template-columns:repeat(2,minmax(0,1fr));}
.billing-generator-address-grid{grid-template-columns:repeat(2,minmax(0,1fr));}
.billing-generator-section-header{padding-bottom:12px;border-bottom:1px solid #eef2f7;margin-bottom:14px;}
.billing-generator-import-panel{margin:0 0 18px;padding:16px;border:1px dashed var(--ui-card-border);border-radius:16px;background:#fff;}
.billing-generator-note{margin-top:8px;color:var(--muted,#6f6a63);font-size:13px;line-height:1.45;}
.billing-generator-import-actions{justify-content:flex-start;margin-top:12px;}
.billing-generator-actions{padding-top:0;}

.billing-items-table{border:1px solid var(--ui-card-border);border-radius:22px;overflow:hidden;background:#fff;}
.billing-items-head,.billing-item-row{display:grid;grid-template-columns:56px minmax(260px,1fr) 86px 112px 118px 96px;gap:10px;align-items:center;padding:12px 14px;}
.billing-items-head{background:#f3f5f8;color:var(--muted,#6f6a63);font-size:12px;font-weight:950;letter-spacing:.04em;text-transform:uppercase;text-align:center;}
.billing-item-row{background:#fff;border-top:1px solid #edf1f5;}
.billing-item-index{height:36px;border-radius:12px;background:#f8fafc;border-color:#dfe6ef;font-weight:900;}
.billing-item-input{height:40px;min-height:40px;border-radius:12px;font-size:14px;}
.billing-item-actions{justify-content:flex-start;gap:7px;flex-wrap:nowrap;}
.billing-money-field .currency{top:9px;left:12px;color:var(--muted,#6f6a63);font-weight:850;}
.billing-money-field .input{text-align:right;}
.billing-totals-panel{margin-top:14px;display:flex;flex-direction:column;gap:12px;}
.billing-totals-main-row{display:flex;align-items:center;gap:16px;flex-wrap:nowrap;}
.billing-amount-right{margin-left:auto;display:flex;align-items:center;gap:16px;min-width:0;}
.billing-amount-group{display:flex;align-items:center;gap:8px;min-width:0;}
.billing-amount-group .amount-label{margin:0;line-height:1;display:flex;align-items:center;white-space:nowrap;}
.billing-subtotal-box,.billing-total-due-box{min-width:248px;width:248px;padding:16px 18px;justify-content:space-between;}
.billing-total-due-row{display:flex;justify-content:flex-end;}
.billing-remarks-row{display:none;margin-top:0;}
.billing-remarks-row.is-on{display:block;}
.billing-generator-items-panel .billing-generator-import-actions{justify-content:flex-start;margin-top:12px;}

@media (max-width:980px){
  .billing-generator-header-grid,.billing-generator-address-grid{grid-template-columns:1fr;}
  .billing-items-head,.billing-item-row{grid-template-columns:1fr;text-align:left;}
  .billing-item-actions{justify-content:flex-start;}
  .billing-totals-main-row{flex-direction:column;align-items:stretch;}
  .billing-amount-right{margin-left:0;display:grid;grid-template-columns:1fr;gap:12px;}
  .billing-subtotal-box,.billing-total-due-box{min-width:0;width:100%;}
  .billing-total-due-row{justify-content:stretch;}
}

/* Order/New Order page-specific layout remains dedicated but uses shared card/form variables. */
.order-page-panel{padding:var(--ui-card-padding);border:1px solid var(--ui-card-border);border-radius:var(--ui-card-radius);background:var(--panel,#fff);box-shadow:var(--ui-card-shadow);overflow:visible;}
.order-page-header{min-height:var(--ui-header-min-height);padding:0 2px 12px;border-bottom:1px solid #eef2f7;margin-bottom:14px;}
.order-new-shell{display:flex;flex-direction:column;gap:16px;}
.order-new-shell.ui-form-page{width:100%;max-width:100%;box-sizing:border-box;}
.order-new-panel.ui-panel{padding:var(--ui-card-padding);border-radius:var(--ui-card-radius);}
.order-new-panel .ui-section{padding:var(--ui-section-padding);border-radius:var(--ui-section-radius);}
.order-new-panel .order-view-section{box-shadow:0 8px 22px rgba(34,28,16,.035);}
.order-new-panel .order-view-meta-grid,.order-new-panel .order-new-meta-grid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:14px;margin-bottom:16px;}
.order-new-panel .order-view-two-col{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:16px;align-items:stretch;}
.order-new-panel .order-view-fields-grid,.order-new-panel .order-new-property-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;}
.order-new-panel .order-edit-summary-head{margin:0 0 12px;}
.order-new-panel .lang-pill-group{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:nowrap;}
.order-new-panel .lang-pill{height:34px;padding:0 14px;border-radius:999px;white-space:nowrap;}
.order-new-panel .textarea-12rows,.order-new-panel #wo_maintenance_summary_text{min-height:310px;line-height:1.6;}
.order-new-panel .order-view-items-section{margin-top:24px;}
.order-new-panel .order-form-actions{display:flex;justify-content:flex-end;gap:10px;flex-wrap:wrap;margin-top:22px;padding:14px 0 4px;border-top:1px solid #eef2f7;background:linear-gradient(180deg,rgba(255,255,255,.72) 0%,#fff 38%);}
.order-new-panel .order-form-actions .btn{min-height:40px;height:40px;border-radius:12px;font-weight:900;}
.order-status-active-filter-chip{display:inline-flex;align-items:center;gap:8px;max-width:100%;min-height:30px;padding:5px 6px 5px 12px;border:1px solid #bfdbfe;border-radius:999px;background:#eff6ff;color:#1d4ed8;font-size:12px;font-weight:900;}
.order-status-active-filter-chip button{height:24px;padding:0 9px;border:1px solid #bfdbfe;border-radius:999px;background:#fff;color:#1d4ed8;font-size:12px;font-weight:900;}
.order-list-filter-page .clients-list-wrap,.order-status-board-panel .order-status-columns{margin-top:0;}
.order-new-request-box .form-help-spaced{margin-top:8px;}

@media (max-width:1180px){.order-new-panel .order-view-meta-grid,.order-new-panel .order-new-meta-grid{grid-template-columns:repeat(2,minmax(0,1fr));}}
@media (max-width:900px){
  .global-top-toolbar{grid-template-columns:1fr;align-items:stretch;}
  .global-top-stats{justify-content:flex-start;}
  .global-top-stat-card{min-width:calc(50% - 4px);}
  .ui-panel-header,.ui-section-header,.list-page-header,.page-header,.page-subheader{align-items:stretch;flex-direction:column;}
  .ui-panel-actions,.ui-section-actions,.list-page-actions,.page-header-actions,.page-subheader-actions{width:100%;justify-content:flex-start;margin-left:0;}
  .ui-page-title,.ui-panel-title{white-space:normal;flex-wrap:wrap;font-size:18px;}
  .ui-form-grid,.form-grid-standard,.ui-form-grid-3,.order-new-panel .order-view-two-col,.order-new-panel .order-view-fields-grid,.order-new-panel .order-new-property-grid{grid-template-columns:1fr;}
  .order-new-panel .lang-pill-group{justify-content:flex-start;flex-wrap:wrap;}
}
@media (max-width:640px){.global-top-stat-card{min-width:100%;}.order-new-panel .order-view-meta-grid,.order-new-panel .order-new-meta-grid{grid-template-columns:1fr;}.order-new-panel .order-form-actions{position:static;justify-content:flex-start;}}

.settings-nav-card,.data-nav-panel{
  padding:14px 16px;
  border:1px solid var(--ui-card-border);
  border-radius:var(--ui-section-radius);
  background:var(--panel,#fff);
  box-shadow:0 6px 18px rgba(16,24,40,.035);
}
.settings-nav-tabs,.data-nav-tabs{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:10px;
}
.settings-nav-tabs .settings-tab,.data-nav-tabs .settings-tab{
  min-height:36px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius:12px;
  font-size:14px;
  font-weight:850;
  line-height:1.15;
}
.data-list-panel{
  padding:var(--ui-card-padding);
  border:1px solid var(--ui-card-border);
  border-radius:var(--ui-card-radius);
  background:var(--panel,#fff);
  box-shadow:var(--ui-card-shadow);
}
.data-list-wrap{
  display:flex;
  flex-direction:column;
  gap:10px;
}
.data-list-row{
  display:grid;
  grid-template-columns:minmax(180px,1.05fr) minmax(260px,2fr) minmax(116px,auto);
  gap:14px;
  align-items:center;
  min-height:76px;
  padding:14px;
  border:1px solid var(--ui-card-border);
  border-radius:14px;
  background:#fff;
  box-shadow:0 1px 2px rgba(16,24,40,.04);
}
.data-list-left,.data-list-middle{
  min-width:0;
}
.data-list-panel .unified-name{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.data-list-panel .unified-meta-top,.data-list-panel .unified-meta-bottom{
  min-width:0;
}
.data-list-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:7px;
  flex-wrap:nowrap;
}
.data-empty-state{
  border:1px dashed var(--ui-card-border);
  border-radius:14px;
  background:#fff;
  min-height:72px;
  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center;
  font-size:14px;
  font-weight:750;
  color:var(--muted,#6f6a63);
}
.data-action-btn{
  flex:0 0 var(--ui-action-size);
}
.data-list-actions .ui-action-danger{
  color:#dc2626;
}
.data-form-section,.settings-section-panel{
  padding:var(--ui-card-padding);
  border:1px solid var(--ui-card-border);
  border-radius:var(--ui-card-radius);
  background:var(--panel,#fff);
  box-shadow:var(--ui-card-shadow);
}
.settings-section-panel + .settings-section-panel,.data-form-section + .data-form-section{
  margin-top:18px;
}
.data-form-section .form-page-header,.settings-section-panel .form-page-header{
  margin-bottom:16px;
}
.settings-section-panel .settings-grid-3,.settings-form-panel .ui-form-grid,.data-form-section .ui-form-grid{
  gap:var(--ui-section-gap);
}
.settings-section-panel .settings-pair,.settings-form-panel .ui-field,.data-form-section .ui-field{
  min-width:0;
}
.settings-form-panel .ui-label,.data-form-section .ui-label{
  display:block;
  margin-bottom:7px;
}
.settings-form-panel .ui-input,.settings-form-panel .ui-select,.settings-form-panel .ui-textarea,.data-form-section .ui-input,.data-form-section .ui-select,.data-form-section .ui-textarea{
  width:100%;
}
.settings-form-panel .ui-form-actions,.data-form-section .ui-form-actions{
  margin-top:18px;
  justify-content:flex-end;
}
.settings-form-panel .ui-help,.data-form-section .ui-help,.settings-section-panel .form-help,.data-form-section .form-help{
  color:var(--muted,#6f6a63);
}
@media (max-width: 860px){
  .data-list-row{
    grid-template-columns:1fr;
  }
  .data-list-actions{
    justify-content:flex-start;
  }
  .data-list-panel .unified-name{
    white-space:normal;
  }
}

/* Deep cleanup component layer */
.table-scroll{width:100%;overflow-x:auto;overflow-y:visible;padding-bottom:12px;}
.data-table{width:100%;border-collapse:separate;border-spacing:0;table-layout:fixed;background:#fff;}
.data-table thead th{padding:14px 16px;background:#f6f3ee;color:#7a7369;font-size:12px;font-weight:900;letter-spacing:.04em;text-transform:uppercase;text-align:left;border-top:1px solid #ebe6de;border-bottom:1px solid #ebe6de;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.data-table thead th:first-child{border-left:1px solid #ebe6de;border-top-left-radius:18px;border-bottom-left-radius:18px;}
.data-table thead th:last-child{border-right:1px solid #ebe6de;border-top-right-radius:18px;border-bottom-right-radius:18px;}
.data-table tbody td{padding:18px 16px;border-bottom:1px solid #ece6de;vertical-align:middle;text-align:left;min-width:0;color:var(--text,#2b2b2b);font-size:14px;font-weight:650;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.data-table tbody tr:last-child td{border-bottom:0;}

.billing-list-panel{overflow:visible;}
.billing-list-wrap{padding-bottom:72px;}
.billing-list-table{width:100%;min-width:960px;table-layout:fixed;}
.billing-list-table col.billing-col-docno{width:126px;}
.billing-list-table col.billing-col-address{width:270px;}
.billing-list-table col.billing-col-client{width:140px;}
.billing-list-table col.billing-col-total{width:92px;}
.billing-list-table col.billing-col-status{width:96px;}
.billing-list-table col.billing-col-actions{width:252px;}
.billing-list-estimate{min-width:850px;}
.billing-list-estimate col.billing-col-actions{width:220px;}
.billing-list-docno strong,.billing-list-total{font-size:15px;font-weight:750;line-height:1.2;}
.billing-list-actions-cell{position:relative;overflow:visible;}
.billing-list-actions{display:flex;align-items:center;justify-content:flex-start;gap:7px;flex-wrap:nowrap;overflow:visible;}
.billing-list-status .invoice-status-badge{min-width:72px;}
.billing-empty-state{padding:18px;color:var(--muted,#6f6a63);}

.list-page-header,.page-header,.page-subheader,.ui-panel-header,.ui-section-header{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:var(--ui-header-min-height,52px);margin-bottom:14px;}
.list-page-title-group,.page-header-left,.page-subheader-left,.ui-panel-title-group,.ui-section-title-group{min-width:0;display:flex;align-items:center;gap:10px;flex-wrap:wrap;flex:1 1 auto;}
.list-page-actions,.page-header-actions,.page-subheader-actions,.ui-panel-actions,.ui-section-actions{margin-left:auto;display:flex;align-items:center;justify-content:flex-end;gap:10px;flex-wrap:wrap;}
.ui-page-title,.ui-panel-title,.page-header .ui-page-title,.page-subheader .ui-page-title{margin:0;font-size:var(--ui-title-size,20px);line-height:1.2;font-weight:950;color:var(--text,#2b2b2b);white-space:nowrap;}
.ui-section-title,.ui-subtitle,.order-view-section-title{margin:0;font-size:var(--ui-section-title-size,16px);line-height:1.25;font-weight:950;color:var(--text,#2b2b2b);}
.list-page-search,.page-header-search,.order-title-search{width:260px;min-width:220px;max-width:320px;height:var(--ui-button-height,38px);min-height:var(--ui-button-height,38px);border-radius:var(--ui-button-radius,12px);font-size:13px;font-weight:850;}

.order-status-board-panel{padding:18px;border:1px solid var(--border);border-radius:28px;background:var(--panel);overflow:hidden;}
.order-status-columns{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;align-items:start;padding:2px;}
.order-status-column{min-width:0;background:#faf8f5;border:1px solid var(--border);border-radius:24px;padding:14px 10px 12px;display:flex;flex-direction:column;gap:10px;}
.order-status-column-head{display:flex;gap:10px;align-items:flex-start;padding:4px 4px 8px;min-height:58px;}
.order-status-column-icon{width:38px;height:38px;display:flex;align-items:center;justify-content:center;border-radius:14px;background:var(--company-accent-soft,#f3ead3);border:1px solid var(--border);font-size:18px;flex:0 0 auto;}
.order-status-column-head h3{margin:0;font-size:16px;line-height:1.18;color:var(--text);white-space:normal;}
.order-status-column-head p{margin:4px 0 0;color:var(--muted);font-size:11px;line-height:1.25;font-weight:800;}
.order-status-column-list{display:flex;flex-direction:column;gap:10px;overflow:visible;padding:2px;}
.order-status-empty{width:100%;padding:12px;border:1px dashed var(--border);border-radius:14px;background:#fff;color:var(--muted);font-size:12px;font-weight:700;text-align:center;}
.order-status-completed-fold{border-top:1px solid var(--border);padding-top:10px;margin-top:8px;}
.order-status-completed-fold summary{cursor:pointer;font-size:12px;font-weight:900;color:var(--text);margin:0 4px 10px;white-space:normal;line-height:1.25;}
.order-status-other-fold summary{color:#344054;}
.order-status-active-filter-chip{display:inline-flex;align-items:center;gap:8px;max-width:100%;min-height:30px;padding:5px 6px 5px 12px;border:1px solid #bfdbfe;border-radius:999px;background:#eff6ff;color:#1d4ed8;font-size:12px;font-weight:900;}
.order-status-active-filter-chip button{height:24px;padding:0 9px;border:1px solid #bfdbfe;border-radius:999px;background:#fff;color:#1d4ed8;font-size:12px;font-weight:900;}


@media (max-width:1180px){
  .order-status-columns{grid-template-columns:1fr;}
}
@media (max-width:900px){
  .list-page-header,.page-header,.page-subheader,.ui-panel-header,.ui-section-header{align-items:stretch;flex-direction:column;}
  .list-page-actions,.page-header-actions,.page-subheader-actions,.ui-panel-actions,.ui-section-actions{width:100%;justify-content:flex-start;margin-left:0;}
  .list-page-search,.page-header-search,.order-title-search{width:100%;min-width:0;max-width:none;}
  .ui-page-title,.ui-panel-title{white-space:normal;font-size:18px;}
}
@media (max-width:980px){
  .billing-list-table{min-width:900px;}
  .billing-list-estimate{min-width:820px;}
}

/* v2.1.4 order/doc and flyout fixes */
.billing-list-table tbody tr.billing-list-row:hover,
.billing-list-table tbody tr.billing-list-row:focus-within{
  z-index:6000;
}
.billing-list-table tbody tr.billing-list-row:hover .billing-list-actions-cell,
.billing-list-table tbody tr.billing-list-row:focus-within .billing-list-actions-cell{
  z-index:6100;
}
.billing-flyout:hover,
.billing-flyout:focus-within,
.ui-flyout:hover,
.ui-flyout:focus-within{
  z-index:7000;
}
.billing-flyout-popover,
.ui-flyout-popover{
  z-index:9000;
}
.billing-list-panel,
.billing-list-wrap,
.billing-list-actions-cell,
.billing-list-actions{
  overflow:visible;
}
.order-doc-action-btn{font-size:15px;}
.order-linked-docs-section{margin-top:14px;}
.order-linked-docs-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;}
.order-linked-doc-row{display:grid;grid-template-columns:86px minmax(0,1fr) auto;gap:10px;align-items:center;padding:12px 14px;border:1px solid var(--ui-border,var(--border));border-radius:16px;background:#fff;}
.order-linked-doc-row span{font-size:12px;font-weight:800;color:var(--ui-muted,var(--muted));text-transform:uppercase;letter-spacing:.03em;}
.order-linked-doc-row strong{min-width:0;font-size:15px;font-weight:850;color:var(--ui-text,var(--text));white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.order-edit-top-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap;}
.order-edit-top-actions .order-company-select{min-width:220px;}
.order-form-page-edit .order-form-request-section{margin-bottom:16px;}
@media (max-width:760px){
  .order-linked-docs-grid{grid-template-columns:1fr;}
  .order-linked-doc-row{grid-template-columns:1fr;align-items:stretch;}
  .order-edit-top-actions .order-company-select{min-width:0;width:100%;}
}


/* v2.1.5 edit order layout and stable flyout hover */
.billing-list-table tbody tr.billing-list-row.has-open-flyout,
.billing-list-table tbody tr.billing-list-row:hover,
.billing-list-table tbody tr.billing-list-row:focus-within{
  z-index:8000;
}
.billing-flyout,
.ui-flyout{
  isolation:isolate;
}
.billing-flyout-popover,
.ui-flyout-popover{
  top:100%;
  margin-top:0;
  pointer-events:auto;
}
.billing-list-row.is-last-row .billing-flyout-popover{
  top:auto;
  bottom:100%;
  margin-bottom:0;
}
.billing-flyout-popover::before,
.ui-flyout-popover::before{
  content:"";
  position:absolute;
  left:0;
  right:0;
  height:10px;
  top:-10px;
}
.billing-list-row.is-last-row .billing-flyout-popover::before{
  top:auto;
  bottom:-10px;
}
.billing-flyout:hover .billing-flyout-popover,
.billing-flyout:focus-within .billing-flyout-popover,
.ui-flyout:hover .ui-flyout-popover,
.ui-flyout:focus-within .ui-flyout-popover{
  display:block;
}
.order-form-request-notes-row{
  margin-top:14px;
  align-items:stretch;
}
.order-form-request-notes-row > section{
  margin:0;
  min-width:0;
}
.order-form-page-edit .order-form-request-section-inline,
.order-form-page-edit .order-form-notes-section{
  display:flex;
  flex-direction:column;
  height:100%;
}
.order-form-page-edit .order-form-request-section-inline textarea,
.order-form-page-edit .order-form-notes-section textarea{
  flex:1 1 auto;
  min-height:154px;
}
.order-form-page-edit .order-form-request-section-inline .order-form-request-head{
  gap:10px;
  align-items:center;
}
.order-form-page-edit .order-form-request-section-inline .client-invoices-top-actions{
  flex-wrap:nowrap;
  gap:8px;
}
.order-form-page-edit .order-linked-docs-section{
  margin-top:14px;
  margin-bottom:0;
}
.order-edit-top-actions{
  flex-wrap:nowrap;
  white-space:nowrap;
}
.order-edit-top-actions .order-company-select{
  width:auto;
  min-width:fit-content;
  max-width:260px;
  height:var(--ui-button-height);
  min-height:var(--ui-button-height);
  flex:0 1 auto;
}
.order-form-page-edit #wo_access_note{
  min-height:58px;
  height:auto;
}
@media (max-width:900px){
  .order-form-request-notes-row{grid-template-columns:1fr;}
  .order-edit-top-actions{flex-wrap:wrap;}
  .order-edit-top-actions .order-company-select{max-width:100%;}
}


/* Send AI review modal */
.send-review-overlay{position:fixed;inset:0;z-index:20000;display:flex;align-items:center;justify-content:center;background:rgba(15,23,42,.38);padding:20px;box-sizing:border-box;}
.send-review-dialog{width:min(980px,100%);max-height:92vh;overflow:auto;background:#fff;border:1px solid var(--ui-card-border,var(--border));border-radius:24px;box-shadow:0 24px 70px rgba(15,23,42,.28);padding:22px;box-sizing:border-box;}
.send-review-head{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;margin-bottom:14px;padding-bottom:12px;border-bottom:1px solid #eef2f7;}
.send-review-note{padding:10px 12px;border-radius:14px;background:#f8fafc;border:1px solid #e5e7eb;color:var(--muted,#6f6a63);font-size:13px;line-height:1.4;margin-bottom:14px;}
.send-review-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;}
.send-review-block{min-width:0;display:flex;flex-direction:column;gap:8px;}
.send-review-label{font-size:12px;font-weight:900;text-transform:uppercase;letter-spacing:.03em;color:var(--muted,#6f6a63);}
.send-review-block textarea{min-height:250px;font-size:14px;line-height:1.45;}
.send-review-actions{display:flex;align-items:center;justify-content:flex-end;gap:10px;flex-wrap:wrap;margin-top:16px;}
@media (max-width:760px){.send-review-grid{grid-template-columns:1fr;}.send-review-dialog{padding:16px;border-radius:20px;}.send-review-block textarea{min-height:180px;}}


/* Unified global company selector and edit-order header */
:root{--global-top-select-width:224px;--company-select-compact-width:224px;}
.global-top-toolbar,
.global-top-toolbar.no-stats{
  display:flex;
  grid-template-columns:none;
  align-items:center;
  gap:14px;
}
.global-top-company-wrap{
  flex:0 0 var(--company-select-compact-width);
  width:var(--company-select-compact-width);
  max-width:var(--company-select-compact-width);
  min-width:var(--company-select-compact-width);
}
.global-top-company-select.company-unified-select,
.global-top-company-select{
  width:var(--company-select-compact-width);
  max-width:var(--company-select-compact-width);
  min-width:0;
  font-size:14px;
  padding-left:12px;
  padding-right:32px;
}
.global-top-stats{flex:1 1 auto;min-width:0;}
.main > .hero.hero-compact.hero-company-select .company-unified-select,
.hero-company-dropdown,
.settings-company-controls .company-unified-select,
.settings-company-controls-top-right .company-unified-select,
#invoice_settings_company,
.order-company-select.company-unified-select{
  width:var(--company-select-compact-width);
  max-width:var(--company-select-compact-width);
  min-width:0;
}
.order-edit-hero{
  display:flex;
  flex-direction:row;
  align-items:center;
  justify-content:space-between;
  flex-wrap:nowrap;
  gap:12px;
}
.order-edit-hero .order-edit-title-block{flex:1 1 auto;min-width:0;}
.order-edit-top-actions,
.page-header-actions.order-edit-top-actions,
.order-edit-top-actions.no-company-label{
  display:flex;
  flex-direction:row;
  align-items:center;
  justify-content:flex-end;
  flex-wrap:nowrap;
  gap:8px;
  width:auto;
  max-width:none;
  min-width:auto;
  flex:0 0 auto;
  margin-left:auto;
}
.order-edit-top-actions .order-edit-company-select,
.order-edit-top-actions .order-company-select{
  flex:0 0 var(--company-select-compact-width);
  width:var(--company-select-compact-width);
  max-width:var(--company-select-compact-width);
  min-width:0;
  height:var(--ui-button-height);
  min-height:var(--ui-button-height);
  font-size:14px;
  border-radius:12px;
  padding-left:12px;
  padding-right:32px;
}
.order-edit-top-actions .btn{flex:0 0 auto;white-space:nowrap;height:var(--ui-button-height);min-height:var(--ui-button-height);}
@media (max-width:860px){
  .global-top-toolbar,.global-top-toolbar.no-stats{flex-wrap:wrap;}
  .global-top-company-wrap{flex:0 0 var(--company-select-compact-width);}
  .order-edit-hero{flex-wrap:wrap;}
  .order-edit-top-actions,.page-header-actions.order-edit-top-actions{width:100%;justify-content:flex-start;flex-wrap:nowrap;}
}
@media (max-width:520px){
  .global-top-company-wrap,
  .global-top-company-select.company-unified-select,
  .global-top-company-select,
  .order-edit-top-actions .order-edit-company-select,
  .order-edit-top-actions .order-company-select{width:100%;max-width:100%;flex-basis:100%;}
  .order-edit-top-actions,.page-header-actions.order-edit-top-actions{flex-wrap:wrap;}
}


/* v2.1.18 unified settings controls, AI Settings layout, and yearly sidebar stats */
.badge-paid-yearly{background:rgba(34,197,94,.17);border-color:rgba(34,197,94,.30)}
.badge-unpaid-yearly{background:rgba(239,68,68,.17);border-color:rgba(239,68,68,.30)}

/* One canonical ON/OFF switch style for all current and future switches. */
.ui-onoff-switch{display:inline-flex;align-items:center;gap:10px;white-space:nowrap;min-height:44px;}
.ui-onoff-switch.switch-toggle-no-label{gap:0;min-height:38px;}
.ui-onoff-switch.switch-toggle-no-label .switch-label{display:none;}
.ui-onoff-switch .switch-ui{width:72px;height:38px;flex:0 0 72px;}
.ui-onoff-switch .switch-knob{width:30px;height:30px;}
.ui-onoff-switch input:checked + .switch-ui .switch-knob{transform:translateX(34px);}

/* Danger buttons use one light-red style. Icon delete buttons share the same compact red system. */
.btn.danger-btn,.btn-danger{
  background:#fff1f2;
  border-color:#fecaca;
  color:#dc2626;
}
.btn.danger-btn:hover,.btn-danger:hover{
  background:#ffe4e6;
  border-color:#fca5a5;
  color:#dc2626;
}
.btn.danger-btn:focus-visible,.btn-danger:focus-visible{box-shadow:0 0 0 3px rgba(220,38,38,.18);}
.icon-btn.danger-btn,.small-btn.icon-btn.danger-btn,.icon-btn.delete-emoji,.small-btn.icon-btn.delete-emoji,.icon-btn-danger,.danger-btn.delete-emoji,button.add-btn.danger-btn,button.add-btn.delete-emoji,.ui-action-danger{
  background:#fff1f2;
  border-color:#fecaca;
  color:#dc2626;
}
.icon-btn.danger-btn:hover,.small-btn.icon-btn.danger-btn:hover,.icon-btn.delete-emoji:hover,.small-btn.icon-btn.delete-emoji:hover,.icon-btn-danger:hover,.danger-btn.delete-emoji:hover,button.add-btn.danger-btn:hover,button.add-btn.delete-emoji:hover,.ui-action-danger:hover{
  background:#ffe4e6;
  border-color:#fca5a5;
  color:#dc2626;
}

.settings-ai-page{display:flex;flex-direction:column;gap:16px;}
.settings-ai-page > .form-page-header{margin-bottom:2px;}
.settings-ai-card,.settings-ai-list-card{
  padding:18px;
  border:1px solid var(--ui-card-border,#e7e1d8);
  border-radius:18px;
  background:#fff;
  box-shadow:none;
}
.settings-ai-card-title{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin:0 0 14px;
  font-size:15px;
  font-weight:900;
  color:var(--text,#2d2924);
}
.settings-ai-card-title span{display:inline-flex;align-items:center;min-height:28px;}
.settings-ai-grid-3{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;align-items:end;}
.settings-ai-api-key-row{margin-top:14px;}
.settings-ai-actions{margin-top:2px;padding-top:2px;}

.settings-ai-review-list-grid{
  display:grid;
  grid-template-columns:minmax(260px,1.05fr) minmax(230px,.95fr) minmax(230px,.95fr);
  gap:12px;
  align-items:center;
}
.settings-ai-list-row{
  min-width:0;
  min-height:42px;
  padding:0;
  border:0;
  background:transparent;
  display:flex;
  align-items:center;
  gap:10px;
}
.settings-ai-list-switch-row{justify-content:flex-start;}
.settings-ai-list-select-row{display:grid;grid-template-columns:minmax(108px,.86fr) minmax(112px,1fr);gap:10px;align-items:center;}
.settings-ai-list-label{color:var(--text,#2d2924);font-size:13px;font-weight:900;line-height:1.22;margin:0;}
.settings-ai-inline-compact-switch{width:auto;min-height:38px;height:38px;gap:0;flex:0 0 auto;}
.settings-ai-row-select{width:100%;min-height:38px;height:38px;background:transparent;}
.settings-ai-plain-select{background:transparent;}

.settings-ai-memory-list-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:14px;align-items:center;}
.settings-ai-memory-switch-row{justify-content:flex-start;width:max-content;max-width:100%;}
.settings-ai-memory-switch-row .settings-ai-list-label{flex:0 0 auto;white-space:normal;}
.settings-ai-memory-switch-row .settings-ai-inline-compact-switch{margin-left:2px;}
.settings-ai-memory-list-row .btn{min-height:38px;}

.order-status-color-row,.order-status-color-controls input[type="color"]{background:transparent;}

@media (max-width:1100px){
  .settings-ai-review-list-grid{grid-template-columns:1fr;}
  .settings-ai-list-select-row{grid-template-columns:minmax(160px,.55fr) minmax(160px,.45fr);}
}
@media (max-width:980px){
  .settings-ai-grid-3{grid-template-columns:1fr;}
}
@media (max-width:680px){
  .settings-ai-memory-list-row{grid-template-columns:1fr;}
  .settings-ai-list-select-row{grid-template-columns:1fr;}
}

/* v2.2b1 Customer Portal foundation */
.portal-app-shell {
  min-height: 100vh;
  background: #f5f7fb;
  color: #101828;
}
.portal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 34px;
  background: linear-gradient(135deg, #ffffff, #edf4ff);
  border-bottom: 1px solid #dbe5f5;
  position: sticky;
  top: 0;
  z-index: 20;
}
.portal-topbar h1,
.portal-dashboard-head h2,
.portal-login-card h1 {
  margin: 0;
  letter-spacing: -0.02em;
}
.portal-kicker {
  color: #2563eb;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 800;
  margin-bottom: 4px;
}
.portal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.portal-main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 46px;
}
.portal-login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at top left, #eaf2ff 0, #f7f9fc 42%, #ffffff 100%);
}
.portal-login-card {
  width: min(460px, 100%);
  padding: 30px;
  border-radius: 24px;
}
.ui-form-stack {
  display: grid;
  gap: 16px;
}
.portal-dashboard-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 24px;
  border-radius: 24px;
}
.portal-client-selector,
.portal-single-client {
  min-width: 260px;
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: #475467;
}
.portal-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}
.portal-stat-card {
  background: #fff;
  border: 1px solid #e4e7ec;
  border-radius: 20px;
  padding: 18px;
  box-shadow: 0 10px 24px rgba(16, 24, 40, 0.06);
}
.portal-stat-card span {
  display: block;
  color: #667085;
  font-size: 13px;
  margin-bottom: 6px;
}
.portal-stat-card strong {
  font-size: 28px;
}
.portal-list-card {
  padding: 18px;
  border-radius: 22px;
  margin-top: 16px;
}
.portal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.portal-table th,
.portal-table td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid #edf0f5;
}
.portal-table th {
  color: #667085;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.portal-client-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid #e4e7ec;
  border-radius: 16px;
  background: #f9fafb;
}
.portal-client-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}
.portal-user-form {
  padding-top: 6px;
}
.ui-error-inline {
  min-height: 18px;
  color: #b42318;
  font-size: 13px;
}
.small-text {
  font-size: 12px;
}
.clean-table {
  width: 100%;
  border-collapse: collapse;
}
.clean-table th,
.clean-table td {
  padding: 12px 10px;
  border-bottom: 1px solid #edf0f5;
  text-align: left;
  vertical-align: top;
}
.clean-table th {
  color: #667085;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
@media (max-width: 860px) {
  .portal-topbar,
  .portal-dashboard-head {
    flex-direction: column;
    align-items: stretch;
  }
  .portal-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 560px) {
  .portal-stat-grid {
    grid-template-columns: 1fr;
  }
  .portal-table {
    font-size: 12px;
  }
}

/* v2.2b1.3 portal dashboard shortcuts and user display */
.portal-head-side {
  display: grid;
  gap: 12px;
  min-width: min(360px, 100%);
}
.portal-user-chip,
.portal-user-summary {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  background: rgba(255,255,255,.78);
  border: 1px solid #dbe5f5;
  border-radius: 16px;
  color: #475467;
  font-size: 12px;
}
.portal-user-chip strong,
.portal-user-summary strong {
  color: #101828;
  font-size: 14px;
}
.portal-user-chip small,
.portal-user-summary small {
  color: #667085;
  font-size: 11px;
}
.portal-action-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}
.portal-action-card {
  text-align: left;
  border: 1px solid #dbe5f5;
  background: #fff;
  border-radius: 20px;
  padding: 18px;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(16, 24, 40, 0.06);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.portal-action-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(16, 24, 40, 0.09);
  border-color: #b9cff4;
}
.portal-action-card.primary {
  background: linear-gradient(135deg, #eff6ff, #ffffff);
  border-color: #9cc2ff;
}
.portal-action-card span {
  display: block;
  color: #2563eb;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 800;
  margin-bottom: 8px;
}
.portal-action-card strong {
  display: block;
  color: #101828;
  font-size: 18px;
  margin-bottom: 6px;
}
.portal-action-card small {
  color: #667085;
  font-size: 12px;
}
.portal-order-form {
  margin-top: 18px;
}
.btn-sm {
  padding: 6px 10px;
  min-height: 30px;
  font-size: 12px;
}
@media (max-width: 980px) {
  .portal-action-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .portal-action-grid { grid-template-columns: 1fr; }
  .portal-actions { flex-wrap: wrap; justify-content: flex-start; }
}

/* v2.2b1.6 Public Portal: match Order page two-part layout */
.portal-layout{
  grid-template-columns:var(--sidebar-width) minmax(0,var(--content-width));
  align-items:start;
}
.portal-layout .portal-sidebar{
  background:var(--sidebar);
  color:#fff;
}
.portal-sidebar-title-card .workspace-subtitle{
  word-break:break-word;
  white-space:normal;
  line-height:1.08;
}
.portal-sidebar-user-card,
.portal-sidebar-client-card{
  background:rgba(255,255,255,.10);
  border:1px solid rgba(255,255,255,.14);
  border-radius:22px;
  padding:14px;
  margin-bottom:12px;
  color:#fff;
}
.portal-sidebar-user-card span,
.portal-sidebar-client-card span,
.portal-sidebar .portal-single-client span,
.portal-sidebar .portal-client-selector span{
  display:block;
  font-size:11px;
  letter-spacing:.08em;
  text-transform:uppercase;
  color:rgba(255,255,255,.72);
  margin-bottom:6px;
  font-weight:800;
}
.portal-sidebar-user-card strong,
.portal-sidebar .portal-single-client strong{
  display:block;
  color:#fff;
  font-size:17px;
  line-height:1.25;
}
.portal-sidebar .portal-client-selector,
.portal-sidebar .portal-single-client{
  min-width:0;
  color:#fff;
  gap:4px;
}
.portal-sidebar .portal-client-selector .input,
.portal-sidebar .portal-client-selector .ui-input{
  height:42px;
  color:#1f1f1f;
  background:#fff;
  border-color:rgba(255,255,255,.32);
}
.portal-sidebar-nav{
  margin-top:2px;
}
.portal-sidebar-footer{
  margin-top:auto;
  padding-top:12px;
}
.portal-logout-btn{
  background:rgba(255,255,255,.08);
}
.portal-content{
  min-width:0;
}
.portal-page-standard{
  display:flex;
  flex-direction:column;
  gap:16px;
}
.portal-order-content-panel{
  margin:0;
}
.portal-order-stats{
  margin:14px 0 16px;
}
.portal-order-stat-card{
  cursor:default;
}
.portal-order-list-wrap{
  margin-top:10px;
}
.portal-layout .portal-dashboard-head{
  border-radius:32px;
}
.portal-layout .portal-list-card{
  margin-top:0;
}
.portal-layout .portal-action-grid,
.portal-layout .portal-home-secondary-actions,
.portal-layout .portal-topbar{
  display:none;
}
@media (max-width:980px){
  .portal-layout{grid-template-columns:1fr;}
  .portal-layout .portal-sidebar{position:static;height:auto;min-height:auto;width:100%;max-width:none;min-width:0;}
  .portal-sidebar-footer{margin-top:12px;}
}

/* v2.2b1.7 Public Portal sidebar final structure */
.portal-main-client-name{
  font-size:20px;
  line-height:1.1;
  word-break:break-word;
}
.portal-sidebar-user-client-card{
  background:rgba(255,255,255,.10);
  border:1px solid rgba(255,255,255,.14);
  border-radius:22px;
  padding:14px;
  margin-bottom:12px;
  color:#fff;
}
.portal-sidebar-user-line{
  padding-bottom:12px;
  margin-bottom:12px;
  border-bottom:1px solid rgba(255,255,255,.13);
}
.portal-sidebar-user-line span,
.portal-sidebar-client-line span,
.portal-sidebar-user-client-card .portal-single-client span,
.portal-sidebar-user-client-card .portal-client-selector span{
  display:block;
  font-size:11px;
  letter-spacing:.08em;
  text-transform:uppercase;
  color:rgba(255,255,255,.72);
  margin-bottom:6px;
  font-weight:800;
}
.portal-sidebar-user-line strong,
.portal-sidebar-user-client-card .portal-single-client strong{
  display:block;
  color:#fff;
  font-size:17px;
  line-height:1.25;
}
.portal-nav-btn,
.portal-logout-btn{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  justify-content:center;
  gap:3px;
  min-height:54px;
}
.portal-nav-btn .portal-nav-label,
.portal-logout-btn .portal-nav-label{
  font-size:15px;
  font-weight:850;
}
.portal-nav-btn small,
.portal-logout-btn small{
  font-size:11px;
  opacity:.70;
  font-weight:700;
}
.portal-data-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:16px;
  margin-top:14px;
}
.portal-data-panel{
  border:1px solid var(--line);
  border-radius:24px;
  padding:16px;
  background:#fff;
  min-width:0;
}
.portal-data-panel h3{
  margin:3px 0 14px;
  font-size:18px;
}
.portal-data-list{
  display:flex;
  flex-direction:column;
  gap:10px;
}
.portal-data-row{
  grid-template-columns:minmax(180px,.9fr) minmax(0,1.4fr);
}
@media (max-width:980px){
  .portal-data-grid{grid-template-columns:1fr;}
}

/* v2.2b1.8 Public Portal cleanup: no Current Client, Order Status uses native board UI */
.portal-sidebar-user-line{
  padding-bottom:0;
  margin-bottom:0;
  border-bottom:0;
}
.portal-order-status-board,
.portal-billing-list-panel{
  margin:0;
}
.portal-billing-list-panel .list-page-header,
.portal-order-status-board .list-page-header{
  margin-bottom:16px;
}
.portal-order-form-page{
  margin:0;
}

/* v2.2b1.9 Public Portal internal-page parity */
.portal-layout-isomorphic.layout-dual{
  grid-template-columns:320px 1fr;
  align-items:start;
}
.portal-sidebar-stack{
  display:grid;
  grid-template-columns:1fr;
  gap:12px;
  position:sticky;
  top:18px;
  height:calc(100vh - 36px);
}
.portal-layout-isomorphic .portal-sidebar.sidebar-main{
  width:100%;
  max-width:none;
  min-width:0;
}
.portal-layout-isomorphic .portal-content .page-standard{
  width:100%;
  max-width:100%;
  min-width:0;
}
.portal-global-top-toolbar .portal-top-placeholder{
  min-height:1px;
}
.portal-layout-isomorphic .order-status-board,
.portal-layout-isomorphic .order-list-panel,
.portal-layout-isomorphic .billing-list-panel,
.portal-layout-isomorphic .data-list-panel,
.portal-layout-isomorphic .data-master-card{
  margin:0;
}
.portal-layout-isomorphic .portal-order-form.internal-ui-form{
  gap:16px;
}
@media (max-width:980px){
  .portal-layout-isomorphic.layout-dual{grid-template-columns:1fr;}
  .portal-sidebar-stack{position:static;height:auto;}
}

/* v2.2b1.10 Public Portal polish: exact internal sidebar width, no secondary labels, top frame on every page */
.portal-layout-isomorphic.layout-dual{
  grid-template-columns:var(--sidebar-width) minmax(0,var(--content-width));
  width:min(calc(var(--sidebar-width) + var(--content-width) + 48px),100%);
  max-width:min(calc(var(--sidebar-width) + var(--content-width) + 48px),100%);
}
.portal-sidebar-stack{
  width:var(--sidebar-width);
  min-width:var(--sidebar-width);
  max-width:var(--sidebar-width);
  grid-template-columns:1fr;
}
.portal-layout-isomorphic .portal-sidebar.sidebar-main{
  width:var(--sidebar-width);
  min-width:var(--sidebar-width);
  max-width:var(--sidebar-width);
}
.portal-sidebar-title-card{margin-bottom:12px;}
.portal-sidebar-title-card .workspace-subtitle{display:none;}
.portal-nav-btn,.portal-logout-btn{
  flex-direction:row;
  align-items:center;
  justify-content:space-between;
  min-height:50px;
}
.portal-nav-btn small,.portal-logout-btn small{display:none;}
.portal-global-top-toolbar.no-stats{grid-template-columns:minmax(220px,var(--global-top-select-width)) minmax(0,1fr);}
.portal-top-static-title{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  justify-content:center;
  gap:2px;
  height:var(--ui-control-height);
  min-height:var(--ui-control-height);
  padding:6px 12px;
  cursor:default;
  overflow:hidden;
}
.portal-top-static-title span{
  font-size:10px;
  line-height:1;
  font-weight:950;
  text-transform:uppercase;
  letter-spacing:.05em;
  opacity:.72;
}
.portal-top-static-title strong{
  display:block;
  max-width:100%;
  font-size:14px;
  line-height:1.15;
  font-weight:950;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.portal-top-empty{min-height:1px;}
.portal-invoice-view-card{margin:0;}
.portal-invoice-view-card .pdf-preview-wrap{margin-top:16px;}
@media (max-width:980px){
  .portal-layout-isomorphic.layout-dual{grid-template-columns:1fr;width:100%;max-width:100%;}
  .portal-sidebar-stack,
  .portal-layout-isomorphic .portal-sidebar.sidebar-main{width:100%;min-width:0;max-width:none;}
}


/* v2.2b1.11 Public Portal polish: compact Current User and company-aware top frame */
.portal-sidebar-user-client-card{
  padding:8px 10px;
  border-radius:14px;
  margin-bottom:10px;
}
.portal-sidebar-user-line{
  display:flex;
  align-items:center;
  justify-content:flex-start;
  gap:6px;
  padding:0;
  margin:0;
  border-bottom:0;
  min-height:24px;
}
.portal-sidebar-user-line span{
  display:inline;
  margin:0;
  font-size:9px;
  line-height:1;
  letter-spacing:.04em;
  white-space:nowrap;
}
.portal-sidebar-user-line strong{
  display:inline-block;
  font-size:12px;
  line-height:1.05;
  font-weight:850;
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.portal-top-static-title span{
  letter-spacing:.06em;
}


/* v2.2b1.14 global action alignment + company-colored portal */
.action-cell,
.row-actions,
.list-actions,
.clients-actions,
.data-list-actions,
.billing-list-actions,
.order-list-actions,
.order-item-actions,
.order-card-actions,
.order-status-board .order-card-actions,
.order-status-board .order-card-action-row{
  justify-content:flex-start !important;
  text-align:left !important;
}
.billing-list-actions-cell,
.action-cell,
td.list-actions,
td.clients-actions,
td.data-list-actions,
td.billing-list-actions-cell{
  text-align:left !important;
}
.order-status-board .order-card-actions{
  justify-self:start !important;
}
.portal-layout-isomorphic .portal-sidebar.sidebar-main{
  background:var(--company-accent-bg,var(--sidebar));
}
.portal-layout-isomorphic .nav-btn.active,
.portal-layout-isomorphic .portal-nav-btn.active,
.portal-layout-isomorphic .portal-logout-btn.active{
  background:var(--company-accent-soft,var(--accent));
  color:var(--text,#1f1f1f);
}
.portal-layout-isomorphic .btn.primary,
.portal-layout-isomorphic .ui-action-strong{
  background:var(--company-accent-bg,var(--sidebar));
  border-color:var(--company-accent-bg,var(--sidebar));
}
.portal-global-top-toolbar .portal-top-static-title,
.portal-global-top-toolbar .global-top-company-select{
  background:var(--company-accent-soft,var(--accent));
  border-color:var(--company-accent-soft,var(--accent));
}


/* v2.2b2.1 portal order AI input + action alignment fixes */
.portal-ai-input-help{
  margin:-8px 0 14px;
  padding:10px 14px;
  border:1px dashed var(--company-accent-soft,#dbeafe);
  border-radius:14px;
  background:rgba(255,255,255,.78);
  color:var(--muted,#666);
  font-size:13px;
  font-weight:750;
}
.portal-layout-isomorphic .order-list-card .order-list-actions,
.portal-layout-isomorphic .unified-right.order-list-actions,
.portal-layout-isomorphic .clients-actions.order-list-actions{
  justify-content:flex-start !important;
  justify-self:start !important;
  text-align:left !important;
  margin-left:0 !important;
}
.portal-layout-isomorphic .order-list-card{
  grid-template-columns:220px minmax(0,1fr) minmax(96px,auto);
}
.portal-layout-isomorphic .order-view-top-actions,
.portal-layout-isomorphic .order-page-actions{
  justify-content:flex-start !important;
}

/* v2.2b2.2 Public Portal Order Status card actions */
.portal-layout-isomorphic .order-status-board .order-card-actions,
.portal-layout-isomorphic .order-status-board .portal-order-status-actions{
  grid-template-columns:repeat(6,26px);
  width:auto !important;
  min-width:0 !important;
  max-width:none !important;
  justify-content:flex-start !important;
  justify-items:start !important;
  justify-self:start !important;
  margin-left:0 !important;
}
.portal-layout-isomorphic .order-status-board .order-card-send-flyout{
  width:26px;
  height:26px;
}
.portal-layout-isomorphic .order-status-board .order-card-send-flyout > .ui-action-btn{
  width:26px;
  min-width:26px;
  max-width:26px;
  height:26px;
  min-height:26px;
  max-height:26px;
}
.portal-picture-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(180px,1fr));
  gap:14px;
}
.portal-picture-card{
  display:flex;
  align-items:center;
  gap:12px;
  padding:14px;
  border:1px solid var(--line,#e7e2d8);
  border-radius:16px;
  background:#fff;
  color:inherit;
  text-decoration:none;
}
.portal-picture-thumb{
  width:48px;
  height:48px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:14px;
  background:var(--company-accent-soft,#eef2ff);
  font-size:22px;
}
.portal-picture-meta{
  display:flex;
  min-width:0;
  flex-direction:column;
  gap:4px;
}
.portal-picture-meta span{
  color:var(--muted,#6b7280);
  font-size:12px;
}
@media (max-width:760px){
  .portal-layout-isomorphic .order-status-board .order-card-actions,
  .portal-layout-isomorphic .order-status-board .portal-order-status-actions{
    justify-self:start !important;
  }
}

/* v2.2b2.3 Public Portal Order Status alignment with internal cards */
.portal-layout-isomorphic .order-status-board .order-card-actions,
.portal-layout-isomorphic .order-status-board .portal-order-status-actions{
  display:grid !important;
  grid-template-columns:repeat(4,26px) !important;
  grid-auto-rows:26px !important;
  width:119px !important;
  min-width:119px !important;
  max-width:119px !important;
  gap:5px !important;
  justify-content:flex-start !important;
  justify-items:center !important;
  justify-self:start !important;
  align-items:center !important;
  white-space:normal !important;
}
.portal-layout-isomorphic .order-status-board .order-card-send-flyout{
  width:26px;
  height:26px;
}
.portal-layout-isomorphic .order-status-board .order-card-send-flyout > .ui-action-btn{
  width:26px;
  min-width:26px;
  max-width:26px;
  height:26px;
  min-height:26px;
  max-height:26px;
}

/* v2.2b2.4: Portal pages inherit internal app sizing and component specs unless explicitly overridden by a customer-only requirement. */

/* v2.2b4 portal Property Address file list fixes + payment request panel */
.portal-address-files-panel .billing-list-wrap,
.portal-address-files-panel .table-scroll,
.portal-address-files-panel .file-list-table,
.portal-address-files-panel .portal-file-actions,
.portal-address-files-panel .billing-list-actions-cell{
  overflow:visible;
}
.portal-address-files-panel .file-list-panel,
.portal-address-files-panel{
  overflow:visible;
}
.portal-file-list-table{
  width:100%;
  min-width:780px;
  table-layout:fixed;
}
.portal-file-list-table col.file-col-index{width:44px;}
.portal-file-list-table col.file-col-type{width:94px;}
.portal-file-list-table col.file-col-docno{width:160px;}
.portal-file-list-table col.file-col-date{width:118px;}
.portal-file-list-table col.file-col-total{width:110px;}
.portal-file-list-table col.file-col-status{width:96px;}
.portal-file-list-table col.file-col-actions{width:190px;}
.portal-file-list-table th,
.portal-file-list-table td{
  white-space:nowrap;
}
.portal-file-list-table .file-list-index{
  width:44px;
  max-width:44px;
  text-align:left;
  font-weight:850;
}
.portal-file-list-table .billing-list-status .invoice-status-badge{
  min-width:0;
  max-width:86px;
  padding-left:8px;
  padding-right:8px;
}
.portal-address-files-panel .portal-file-actions{
  display:flex;
  align-items:center;
  justify-content:flex-start;
  gap:7px;
  flex-wrap:nowrap;
  position:relative;
  z-index:20;
}
.portal-address-files-panel tr:hover,
.portal-address-files-panel tr:focus-within{
  position:relative;
  z-index:8000;
}
.portal-address-files-panel .ui-flyout:hover,
.portal-address-files-panel .ui-flyout:focus-within{
  z-index:9000;
}
.portal-address-files-panel .ui-flyout-popover{
  z-index:12000;
}
.portal-payment-request-panel,
.portal-estimate-response-panel{
  padding:16px;
  border:1px solid var(--ui-card-border,var(--border));
  border-radius:18px;
  background:#fff;
}
.portal-payment-latest{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:12px;
  margin-top:12px;
}
.portal-payment-latest strong{
  display:block;
  margin-bottom:5px;
  font-size:12px;
  color:var(--muted,#6f6a63);
  text-transform:uppercase;
  letter-spacing:.03em;
}
.portal-payment-request-actions{
  justify-content:flex-start;
}
@media (max-width:900px){
  .portal-payment-latest{grid-template-columns:1fr 1fr;}
}
.invoice-status-badge.muted{
  background:#f8fafc;
  color:#667085;
  border:1px solid #d0d5dd;
}


/* v2.2b4.3: Portal Order Status direct estimate / paid-invoice actions.
   Card action grid still follows internal card sizing: left aligned, max 4 icons per row. */
.portal-layout-isomorphic .order-status-board .portal-order-status-actions .order-estimate-action-btn,
.portal-layout-isomorphic .order-status-board .portal-order-status-actions .order-invoice-paid-action-btn{
  font-weight:900;
}
.portal-layout-isomorphic .order-status-board .portal-order-status-actions .ui-flyout-popover{
  z-index:14000;
}


/* v2.2b4.5 internal Users edit + actions alignment fix */
.users-list-table-wrap{
  width:100%;
  overflow-x:auto;
  overflow-y:visible;
}
.users-list-table{
  width:100%;
  min-width:980px;
  table-layout:fixed;
}
.users-list-table col.users-col-user{width:210px;}
.users-list-table col.users-col-type{width:132px;}
.users-list-table col.users-col-clients{width:auto;}
.users-list-table col.users-col-portal{width:150px;}
.users-list-table col.users-col-status{width:92px;}
.users-list-table col.users-col-actions{width:104px;}
.users-list-table th,
.users-list-table td{
  vertical-align:middle;
}
.users-list-table th:last-child,
.users-list-table td.users-list-actions{
  text-align:left !important;
}
.users-list-actions{
  display:flex !important;
  align-items:center !important;
  justify-content:flex-start !important;
  gap:7px !important;
  flex-wrap:nowrap !important;
  white-space:nowrap !important;
  overflow:visible !important;
}
.users-list-actions .ui-action-btn{
  flex:0 0 var(--ui-action-size);
}
.users-list-user strong,
.users-list-type,
.users-list-portal,
.users-list-status{
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.users-list-clients{
  white-space:normal;
  line-height:1.35;
}

/* v2.2b5 Portal Schedule + Pictures */
.portal-schedule-request-list{
  display:flex;
  flex-direction:column;
  gap:10px;
  margin-top:12px;
}
.portal-schedule-request-row{
  display:grid;
  grid-template-columns:minmax(150px,1fr) minmax(180px,2fr) auto auto;
  gap:12px;
  align-items:center;
  padding:10px 12px;
  border:1px solid var(--line,#e7e2d8);
  border-radius:14px;
  background:#fff;
}
.portal-schedule-decision-actions{
  justify-content:flex-start;
}
.portal-inline-form{
  padding-top:12px;
  border-top:1px dashed var(--line,#e7e2d8);
}
.portal-picture-thumb{
  overflow:hidden;
}
.portal-picture-thumb img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}
.portal-picture-upload-form{
  margin-top:14px;
}
@media (max-width:760px){
  .portal-schedule-request-row{
    grid-template-columns:1fr;
    align-items:start;
  }
}

/* v2.2b5.2 Portal picture uploader: drag/drop + file picker */
.portal-picture-upload-form{
  margin-top:16px;
  padding:16px;
  border:1px solid var(--line,#e7e2d8);
  border-radius:18px;
  background:linear-gradient(180deg,#fff,rgba(248,250,252,.92));
}
.portal-picture-dropzone{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:8px;
  min-height:148px;
  padding:22px;
  border:2px dashed var(--company-accent-soft,#dbe4ff);
  border-radius:18px;
  background:var(--company-accent-soft,#f3f6ff);
  color:var(--ink,#171717);
  text-align:center;
  cursor:pointer;
  transition:border-color .16s ease, background .16s ease, transform .16s ease, box-shadow .16s ease;
}
.portal-picture-dropzone:hover,
.portal-picture-dropzone.is-dragging{
  border-color:var(--company-accent,#2563eb);
  background:#fff;
  box-shadow:0 12px 28px rgba(15,23,42,.08);
  transform:translateY(-1px);
}
.portal-picture-dropzone strong{
  font-size:15px;
  line-height:1.25;
}
.portal-picture-dropzone small{
  color:var(--muted,#6b7280);
  font-size:12px;
}
.portal-picture-drop-icon{
  width:42px;
  height:42px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:14px;
  background:#fff;
  box-shadow:0 8px 18px rgba(15,23,42,.08);
  font-size:20px;
}
.portal-picture-file-input{
  position:absolute;
  width:1px;
  height:1px;
  opacity:0;
  pointer-events:none;
}
.portal-picture-file-list{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:12px;
}
.portal-picture-file-empty{
  color:var(--muted,#6b7280);
  font-size:12px;
  padding:8px 0;
}
.portal-picture-file-pill{
  display:flex;
  align-items:center;
  gap:7px;
  max-width:100%;
  padding:8px 10px;
  border:1px solid var(--line,#e7e2d8);
  border-radius:999px;
  background:#fff;
  font-size:12px;
}
.portal-picture-file-index{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:20px;
  height:20px;
  border-radius:999px;
  background:var(--company-accent-soft,#eef2ff);
  color:var(--company-accent,#2563eb);
  font-weight:700;
}
.portal-picture-file-name{
  max-width:220px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-weight:600;
}
.portal-picture-file-size{
  color:var(--muted,#6b7280);
}
.portal-picture-meta-form{
  margin-top:14px;
}
.portal-picture-upload-actions{
  justify-content:flex-start;
  margin-top:8px;
}
.portal-picture-grid{
  grid-template-columns:repeat(auto-fill,minmax(220px,1fr));
  gap:16px;
}
.portal-picture-card{
  flex-direction:column;
  align-items:stretch;
  gap:10px;
  padding:12px;
  border-radius:18px;
  overflow:hidden;
}
.portal-picture-thumb{
  width:100%;
  height:150px;
  border-radius:14px;
}
.portal-picture-meta strong{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
@media (max-width:760px){
  .portal-picture-upload-form{padding:12px;}
  .portal-picture-dropzone{min-height:128px;padding:18px 12px;}
  .portal-picture-grid{grid-template-columns:1fr;}
  .portal-picture-file-name{max-width:150px;}
}

/* v2.2b7.1 Portal Links */
.portal-links-table-wrap { overflow-x: auto; }
.portal-links-table { table-layout: fixed; width: 100%; }
.portal-links-col-client { width: 240px; }
.portal-links-col-url { width: auto; }
.portal-links-col-actions { width: 110px; }
.portal-links-url a { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; color: var(--company-accent-bg, #2563eb); font-weight: 700; text-decoration: none; }
.portal-links-url a:hover { text-decoration: underline; }
.portal-links-actions { text-align: left; white-space: nowrap; }
.portal-links-client strong { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
