:root { --sidebar: 284px; --gold: #B68A35; --gold-soft: #FBF3DF; }

.sync-auth-note { color: var(--primary); }
.sync-banner { display: flex; gap: .8rem; align-items: flex-start; margin-bottom: 1rem; padding: .9rem 1rem; border: 1px solid color-mix(in srgb, var(--active) 25%, var(--border)); border-radius: 14px; background: var(--soft); }
.sync-banner > span { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 10px; background: var(--active); color: white; font-weight: 900; flex: 0 0 auto; }
.sync-banner strong { color: var(--primary); }
.sync-banner p { margin: .2rem 0 0; color: var(--muted); font-size: .86rem; line-height: 1.45; }

.today-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, .34fr); gap: 1rem; align-items: start; }
.today-primary { display: grid; gap: 1rem; }
.today-aside { position: sticky; top: 86px; }
.today-empty { margin-bottom: 1rem; padding: clamp(2rem, 7vw, 5rem); text-align: center; border: 1px dashed var(--border); border-radius: 24px; background: linear-gradient(145deg, var(--surface), var(--surface-2)); }
.today-empty h2 { margin: .8rem 0 .35rem; color: var(--primary); font: 700 clamp(1.5rem, 3vw, 2.2rem) Georgia, serif; }
.today-empty p { margin: 0 auto; max-width: 580px; color: var(--muted); }
.today-sun { width: 62px; height: 62px; margin: auto; display: grid; place-items: center; border-radius: 20px; background: var(--gold-soft); color: var(--gold); font-size: 2rem; }
.today-section { box-shadow: none; }
.today-section.attention { border-color: color-mix(in srgb, var(--gold) 35%, var(--border)); }
.count-pill { min-width: 28px; height: 28px; padding: 0 8px; display: grid; place-items: center; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: .78rem; font-weight: 850; }
.compact-list { display: grid; }
.compact-row { width: 100%; min-height: 72px; padding: .7rem 1rem; display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 18px; gap: .8rem; align-items: center; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: var(--text); text-align: left; }
.compact-row:last-child { border-bottom: 0; }
.compact-row:hover { background: var(--surface-2); }
.compact-copy { min-width: 0; display: grid; gap: .14rem; }
.compact-copy strong { overflow: hidden; color: var(--primary); text-overflow: ellipsis; white-space: nowrap; }
.compact-copy small { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.row-kicker { color: var(--muted); font-size: .69rem; font-weight: 850; text-transform: uppercase; letter-spacing: .06em; }
.compact-row time { color: var(--muted); font-size: .78rem; white-space: nowrap; }
.row-arrow { color: var(--muted); font-size: 1.3rem; }
.row-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--active); }
.row-dot.attention, .row-dot.warning { background: var(--gold); }
.row-dot.danger { background: var(--danger); }
.row-dot.next { background: var(--sand); }
.alert-panel .compact-row { grid-template-columns: 10px minmax(0, 1fr); }
.alert-panel .compact-row span:nth-child(2) { display: grid; gap: .2rem; }
.alert-panel small { color: var(--muted); }

.work-board { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.panel-body.flush { padding: 0; }
.work-list { display: grid; }
.work-row { min-height: 72px; padding: .65rem .85rem; display: flex; align-items: center; justify-content: space-between; gap: .8rem; border-bottom: 1px solid var(--border); }
.work-row:last-child { border-bottom: 0; }
.work-main { min-width: 0; flex: 1; display: flex; align-items: center; gap: .75rem; border: 0; background: transparent; color: var(--text); text-align: left; }
.work-main > span:last-child { min-width: 0; display: grid; gap: .22rem; }
.work-main strong { overflow: hidden; color: var(--primary); text-overflow: ellipsis; white-space: nowrap; }
.work-main small { color: var(--muted); }
.status-mark { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-2); color: var(--active); font-weight: 900; flex: 0 0 auto; }
.status-mark.completed { background: var(--soft); }
.choice-grid { display: grid; gap: .75rem; }
.choice-card { min-height: 78px; padding: 1rem; display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); text-align: left; }
.choice-card:hover { border-color: var(--active); background: var(--soft); }
.choice-card strong { color: var(--primary); }
.choice-card span { color: var(--muted); }

.customer-link { display: grid; gap: .15rem; border: 0; background: transparent; text-align: left; }
.history-summary { display: flex; gap: 1rem; align-items: center; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.history-summary .profile-avatar.small { width: 52px; height: 52px; margin: 0; border-radius: 15px; font-size: 1rem; }
.history-summary strong { color: var(--primary); font: 700 1.2rem Georgia, serif; }
.history-summary p { margin: .3rem 0 0; color: var(--muted); }
.history-actions { padding: 1rem 0; }
.timeline { position: relative; display: grid; gap: .4rem; }
.timeline-row { display: grid; grid-template-columns: 16px 1fr; gap: .75rem; padding: .55rem 0; }
.timeline-row > span { width: 10px; height: 10px; margin-top: .45rem; border-radius: 50%; background: var(--active); box-shadow: 0 0 0 4px var(--soft); }
.timeline-row strong { color: var(--primary); }
.import-drop { margin-bottom: 1rem; padding: 1.2rem; border: 1px dashed var(--sand); border-radius: 16px; background: var(--surface-2); text-align: center; }
.import-drop p { color: var(--muted); }
.import-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; margin: 1rem 0; }
.import-stats > div { padding: .8rem; display: grid; border: 1px solid var(--border); border-radius: 13px; background: var(--surface); text-align: center; }
.import-stats strong { color: var(--primary); font: 700 1.6rem Georgia, serif; }
.import-stats span { color: var(--muted); font-size: .76rem; }
.compact-table { max-height: 320px; overflow: auto; }

.document-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.document-card { padding: 1rem; border: 1px solid var(--border); border-radius: 17px; background: var(--surface); box-shadow: var(--shadow); }
.document-card-top { display: flex; align-items: center; justify-content: space-between; gap: .7rem; }
.document-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; background: var(--soft); color: var(--active); font-size: 1.2rem; }
.document-card h2 { margin: 1rem 0 .25rem; color: var(--primary); font: 700 1.35rem Georgia, serif; }
.document-card > strong { font-size: .82rem; color: var(--muted); }
.document-card > p { margin: .75rem 0; }
.document-meta { margin: .8rem 0; padding-top: .8rem; display: flex; justify-content: space-between; border-top: 1px solid var(--border); color: var(--muted); font-size: .82rem; }
.document-meta strong { color: var(--primary); }
.document-payment-summary { margin: .2rem 0 .85rem; padding: .65rem .75rem; display: grid; gap: .35rem; border-radius: 12px; background: var(--surface-2); }
.document-payment-summary > div { display: flex; justify-content: space-between; gap: .75rem; color: var(--muted); font-size: .82rem; }
.document-payment-summary .outstanding-balance { color: #A52121; font-weight: 900; }
.badge.overdue { background: #FDECEC; color: #A52121; border-color: #F3C7C7; }
.document-payment-summary .settled-balance { color: var(--primary); font-weight: 800; }
.document-payment-summary .balance-neutral { color: var(--muted); font-weight: 800; }
.modal:has(.document-form), .modal:has(.document-preview-shell) { width: min(100%, 1120px); }
.document-form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; }
.line-editor { overflow: hidden; border: 1px solid var(--border); border-radius: 15px; }
.line-row { display: grid; grid-template-columns: 130px minmax(190px, 1fr) 90px 110px 110px 38px; gap: .55rem; align-items: center; padding: .65rem; border-bottom: 1px solid var(--border); }
.line-row:last-child { border-bottom: 0; }
.line-row > strong { color: var(--primary); text-align: right; font-size: .83rem; }
.document-total { display: grid; align-content: center; gap: .22rem; padding: .7rem .8rem; border-radius: 12px; background: var(--surface-2); color: var(--muted); font-size: .8rem; }
.document-total strong { color: var(--primary); font-size: 1rem; }
.visibility-grid { display: flex; flex-wrap: wrap; gap: .65rem 1rem; padding: .8rem; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-2); }
.visibility-grid label { color: var(--muted); font-size: .84rem; text-transform: capitalize; }
.document-preview-shell { height: min(66vh, 780px); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: white; }
.document-preview-shell iframe { width: 100%; height: 100%; border: 0; background: white; }

.insight-hero { margin-bottom: 1rem; padding: clamp(1.2rem, 4vw, 2rem); display: flex; justify-content: space-between; align-items: center; border-radius: 22px; background: linear-gradient(135deg, #173d2e, #2d6a4f); color: white; }
.insight-hero span, .insight-hero small { display: block; opacity: .8; }
.insight-hero strong { display: block; margin: .35rem 0; font: 700 clamp(2rem, 5vw, 3.6rem) Georgia, serif; }
.insight-sun { font-size: 3.5rem; color: #F2C35B; }
.insight-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.insight-panel { margin-top: 1rem; box-shadow: none; }
.progress-row { display: flex; justify-content: space-between; gap: 1rem; padding: .8rem 0; border-bottom: 1px solid var(--border); }
.progress-row:last-child { border-bottom: 0; }
.progress-row strong { color: var(--primary); }

.assistant-float { position: fixed; z-index: 60; right: 24px; bottom: 24px; display: grid; justify-items: end; gap: 12px; pointer-events: none; }
.assistant-launcher { min-height: 52px; padding: 0 18px 0 13px; display: flex; align-items: center; gap: 9px; border: 1px solid color-mix(in srgb, var(--active) 48%, var(--border)); border-radius: 999px; background: var(--primary); color: white; box-shadow: 0 14px 40px rgba(12, 39, 28, .28); font: 800 .92rem/1 system-ui, sans-serif; cursor: pointer; pointer-events: auto; }
.assistant-launcher:hover { background: var(--active); transform: translateY(-1px); }
.assistant-launcher:focus-visible, .assistant-close:focus-visible, .assistant-suggestions button:focus-visible { outline: 3px solid color-mix(in srgb, var(--gold) 70%, white); outline-offset: 3px; }
.assistant-launcher > span { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.16); font-size: 1rem; }

/* Keep the floating Assistant clearly visible when --primary becomes near-white in dark mode. */
html[data-theme="dark"] .assistant-launcher {
  background: #2D6A4F;
  color: #FFFFFF;
  border-color: #70C38E;
  box-shadow: 0 14px 42px rgba(0,0,0,.42), 0 0 0 1px rgba(112,195,142,.16);
}
html[data-theme="dark"] .assistant-launcher:hover { background: #377B59; }
html[data-theme="dark"] .assistant-launcher > span { background: rgba(255,255,255,.18); color: #F2C35B; }
.assistant-panel { width: min(410px, calc(100vw - 32px)); max-height: min(620px, calc(100vh - 110px)); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden; border: 1px solid var(--border); border-radius: 22px; background: var(--surface); box-shadow: 0 24px 80px rgba(8, 27, 19, .28); pointer-events: auto; }
.assistant-panel[hidden] { display: none; }
.assistant-panel-head { min-height: 72px; padding: 12px 14px; display: grid; grid-template-columns: 42px minmax(0, 1fr) 38px; gap: 10px; align-items: center; border-bottom: 1px solid var(--border); background: linear-gradient(135deg, var(--primary), var(--active)); color: white; }
.assistant-panel-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; background: rgba(255,255,255,.15); color: #F2C35B; font-size: 1.25rem; }
.assistant-panel-head div { min-width: 0; display: grid; gap: 3px; }
.assistant-panel-head strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.assistant-panel-head small { overflow: hidden; opacity: .78; text-overflow: ellipsis; white-space: nowrap; }
.assistant-close { width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 12px; background: rgba(255,255,255,.1); color: white; font-size: 1.65rem; line-height: 1; cursor: pointer; }
.assistant-close:hover { background: rgba(255,255,255,.2); }
.assistant-panel-body { min-height: 0; padding: 16px; overflow-y: auto; }
.assistant-intro { margin: 0 0 14px; color: var(--muted); font-size: .9rem; line-height: 1.55; }
.assistant-suggestions { display: flex; flex-wrap: wrap; gap: 7px; }
.assistant-suggestions button { padding: 8px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); color: var(--primary); font: 750 .78rem/1.25 system-ui, sans-serif; cursor: pointer; }
.assistant-suggestions button:hover { border-color: var(--active); background: var(--soft); }
.assistant-chat-answer { margin-top: 14px; padding: 13px; display: grid; gap: 12px; border: 1px solid color-mix(in srgb, var(--active) 25%, var(--border)); border-radius: 15px 15px 4px 15px; background: var(--soft); color: var(--primary); font-size: .9rem; line-height: 1.5; }
.assistant-chat-answer[hidden] { display: none; }
.assistant-chat-answer .btn { justify-self: start; }
.assistant-chat-form { padding: 12px; display: grid; grid-template-columns: minmax(0, 1fr) 46px; gap: 8px; border-top: 1px solid var(--border); background: var(--surface); }
.assistant-chat-form .input { min-width: 0; }
.assistant-chat-form .btn { width: 46px; min-width: 46px; padding: 0; font-size: 1.2rem; }
.browser-notice { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .8rem; padding: .9rem; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-2); }
.browser-notice strong { color: var(--primary); }
.browser-notice p { margin: .25rem 0 0; color: var(--muted); font-size: .82rem; }

@media (max-width: 1180px) {
  .today-layout { grid-template-columns: 1fr; }
  .today-aside { position: static; }
  .document-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .insight-grid { grid-template-columns: repeat(2, 1fr); }
  .line-row { grid-template-columns: 110px minmax(160px, 1fr) 80px 90px 90px 38px; }
}
@media (max-width: 900px) {
  :root { --sidebar: 284px; }
  .work-board, .document-form-grid { grid-template-columns: 1fr; }
  .line-row { grid-template-columns: 1fr 1fr; }
  .line-row [data-line="description"] { grid-column: 1 / -1; }
  .line-row > strong { text-align: left; }
}
@media (max-width: 600px) {
  .compact-row { grid-template-columns: 10px minmax(0, 1fr) 16px; }
  .compact-row time { grid-column: 2; }
  .work-row, .browser-notice { align-items: flex-start; flex-direction: column; }
  .document-grid, .insight-grid, .import-stats { grid-template-columns: 1fr; }
  .assistant-float { right: 12px; bottom: 12px; }
  .assistant-panel { width: calc(100vw - 24px); max-height: calc(100dvh - 84px); border-radius: 18px; }
  .line-row { grid-template-columns: 1fr; }
  .line-row [data-line="description"] { grid-column: auto; }
  .document-preview-shell { height: 58vh; }
}


/* V2 document lifecycle: mirrors mobile Documents → History → Trash. */
.document-card-actions { padding-top: .1rem; }
.document-card-actions .btn:last-child { margin-left: auto; }
.document-manage-summary { display: grid; gap: .8rem; padding: 1rem; border: 1px solid var(--border); border-radius: 16px; background: var(--surface-2); }
.document-manage-summary > div { display: flex; align-items: center; gap: .8rem; }
.document-manage-summary > div > div { min-width: 0; display: grid; gap: .2rem; }
.document-manage-summary > div strong { color: var(--primary); }
.document-manage-summary small, .document-manage-summary p { margin: 0; color: var(--muted); }
.document-manage-actions { margin-top: 1rem; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .65rem; }

@media (max-width: 760px) {
  .document-grid { grid-template-columns: 1fr; }
  .document-card-actions { align-items: stretch; }
  .document-card-actions .btn { flex: 1 1 140px; }
  .document-card-actions .btn:last-child { margin-left: 0; }
  .document-manage-actions { flex-direction: column; }
  .document-manage-actions .btn { width: 100%; }
}


/* BizSolèy V2.0.0 mobile-parity document lifecycle */
.revision-chip { display:inline-flex; align-items:center; width:max-content; margin-top:.5rem; padding:.2rem .55rem; border:1px solid var(--border); border-radius:999px; background:var(--soft); color:var(--active); font-size:.74rem; font-weight:900; }
.revision-chip.strong { margin:0; }
.revision-history { margin-top:1rem; padding:1rem; border:1px solid var(--border); border-radius:16px; background:var(--surface); }
.revision-history-head { display:flex; justify-content:space-between; gap:1rem; align-items:flex-start; flex-wrap:wrap; }
.revision-history-head h3 { margin:0; color:var(--primary); font:700 1.05rem Georgia,serif; }
.revision-history-head p { margin:.25rem 0 0; color:var(--muted); font-size:.82rem; }
.revision-list { display:grid; gap:.65rem; margin-top:.85rem; }
.revision-row { display:flex; justify-content:space-between; align-items:center; gap:1rem; padding:.75rem; border:1px solid var(--border); border-radius:12px; background:var(--surface-2); }
.revision-row > div { min-width:0; display:grid; gap:.18rem; }
.revision-row strong { color:var(--primary); }
.revision-row small, .revision-row span, .revision-empty { color:var(--muted); font-size:.8rem; }
.correction-notice p { margin:.35rem 0 0; }
.receipt-payment-fields { padding:.85rem; border:1px solid var(--border); border-radius:14px; background:var(--surface-2); }
.field small { display:block; margin-top:.28rem; color:var(--muted); font-size:.76rem; }
@media (max-width:640px){ .revision-row{align-items:flex-start;flex-direction:column}.revision-row .btn{width:100%}.revision-history-head{flex-direction:column}.revision-chip.strong{align-self:flex-start} }
