/* EVM shared visual contract. Load after page styles. */
#cfo-filters .field { margin-bottom:0; min-width:150px; }
#cfo-filters .field > label, #cfo-filters .cfo-filter-label { display:block; margin:0 0 6px; color:var(--muted); font-size:var(--text-small); font-weight:400; }
#cfo-filters .form-actions { gap:12px; }
#cfo-filters [hidden] { display:none!important; }
.contractor-deposits-table { width:100%; min-width:0; table-layout:auto; }
.contractor-deposits-table th:first-child, .contractor-deposits-table td:first-child { width:100%; white-space:normal; overflow-wrap:anywhere; }
.contractor-deposits-table th, .contractor-deposits-table td { vertical-align:middle; }
.contractor-deposits-table td.money { text-align:right; white-space:nowrap; }
.document-handover { width: 190px; vertical-align: middle; }
.document-handover-status { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: var(--text-small); white-space: nowrap; margin-bottom: 9px; }
.document-handover-status .nav-icon { width: 16px; height: 16px; flex-basis: 16px; color: var(--accent); }
.document-handover-status.is-done, .document-handover-status.is-done .nav-icon { color: var(--success); }
.document-handover form { margin: 0; }
.document-handover .document-handover-action { min-height: 30px; padding: 5px 9px; font-size: var(--text-caption); background: #f7fafc; color: var(--ink); }
.document-handover .document-handover-action:hover { background: #edf7f8; border-color: var(--accent)!important; }
:root {
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --text-caption: 11px; --text-small: 12px; --text-body: 13px;
  --text-section: 16px; --text-title: 24px;
  --ink: #232753; --brand: #232753; --brand-dark: #171a42;
  --muted: #717a91; --line: #dfe5ef; --canvas: #f5f6fa;
  --accent: #55acbd; --success: #287a5e; --warning: #a96813;
  --radius: 14px; --control-radius: 8px;
  --pc-ink: var(--ink); --pc-muted: var(--muted); --pc-line: var(--line);
}
body { font-family: var(--font-ui); font-size: var(--text-body); line-height: 1.5; }
/* Shared page ending: avoid adding the last card's margin to the page padding. */
.workspace > .content { padding-bottom: 32px; }
.content > :nth-last-child(1 of :not(script, style, [hidden])),
.balance-detail-page > section:last-of-type,
#project-card > [role="tabpanel"] > :last-child { margin-bottom: 0; }
button, input, select, textarea { font-family: inherit; }
.page-title, #project-card .pc-title h1 { font-size: var(--text-title); font-weight: 600; line-height: 1.25; }
.card h2, #project-card h2 { font-size: var(--text-section); font-weight: 600; line-height: 1.3; }
.page-subtitle, .card p { line-height: 1.6; }
.eyebrow { font-size: var(--text-caption); font-weight: 600; color: var(--accent); }
.card { padding: 24px; }
.grid>* , .card, .stat-grid>* { min-width: 0; }
.card-head { margin-bottom: 16px; }
.label, .field label, .field-label, .card label { font-size: var(--text-small); font-weight: 500; text-transform: none; letter-spacing: normal; }
.value, .project-name, .project-code { font-weight: 600; }
.hint, .field .hint, .project-name small, .customer-cell small { font-size: var(--text-caption); }
.amount { font-size: var(--text-title); font-weight: 500; font-variant-numeric: tabular-nums; }
.btn, button[type=submit], button.btn-secondary, button.btn-danger, .actions>button, .form-actions>button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 36px; padding: 8px 12px; border: 1px solid transparent;
  border-radius: var(--control-radius); font-size: var(--text-small);
  font-weight: 400; line-height: 1.3; cursor: pointer;
}
.actions>button, .form-actions>button, button.btn-danger { background: var(--brand); color: white; }
.btn .nav-icon, .btn .pc-icon, button[type=submit] .nav-icon { width: 16px; height: 16px; color: currentColor; }
.form-actions .pc-icon { width: 16px; height: 16px; flex: 0 0 16px; color: currentColor; }
.btn-secondary, .btn-ghost { border-color: var(--line)!important; }
button:disabled, #project-card button:disabled {
  background: #f5f6f8!important; color: #8a92a5!important;
  border-color: var(--line)!important; box-shadow: none; cursor: not-allowed;
}
button:disabled svg { color: inherit!important; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px;
}
.field input:not([type=checkbox]), .field select, .field textarea,
input.control, select.control, textarea.control,
.card input:not([type=checkbox]):not([type=hidden]), .card select, .card textarea {
  min-height: 38px; padding: 8px 11px; border-color: var(--line);
  border-radius: var(--control-radius); font-size: var(--text-body);
}
input[type=checkbox] { accent-color: var(--brand); }
table { font-size: var(--text-small); font-variant-numeric: tabular-nums; }
th { font-size: var(--text-caption); font-weight: 400; text-transform: none; letter-spacing: .02em; }
th, td { padding: 12px; border-bottom-color: var(--line); }
.status { font-size: var(--text-caption); font-weight: 500; }
.project-tab { font-size: var(--text-body); }
.project-toolbar { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.project-toolbar .control { flex: 1 1 150px; max-width: 100%; }
.project-toolbar.document-filters { display: flex; align-items: flex-end; gap: 16px; padding: 18px 20px; }
.document-filters label { display: flex; flex-direction: column; gap: 6px; margin: 0; min-width: 0; }
.document-filters label > span { font-size: var(--text-small); font-weight: 500; color: var(--muted); }
.document-filters .document-filter-scope { flex: 0 1 240px; }
.document-filters .document-filter-search { flex: 1 1 320px; }
.project-toolbar.document-filters .control { flex: none; width: 100%; min-width: 0; height: 38px; }
.document-filter-actions { display: flex; align-items: center; gap: 8px; }
.document-filter-actions .btn { height: 38px; white-space: nowrap; }
.document-filter-actions svg { flex-shrink: 0; color: var(--accent); }
@media (max-width: 640px) {
  .project-toolbar.document-filters { gap: 12px; padding: 16px; }
  .document-filters .document-filter-scope, .document-filters .document-filter-search { flex: 1 1 100%; }
}
.project-toolbar input[name=q] { flex: 2 1 230px; min-width: 0!important; }
.stat-grid>a.card:hover { text-decoration: none; border-color: #abcfd8; }
#project-card { --pc-ink: var(--ink); --pc-muted: var(--muted); --pc-line: var(--line); font-family: var(--font-ui); font-size: var(--text-body); }
#project-card .pc-button { font-size: var(--text-small); border-radius: var(--control-radius); }
#project-card .pc-field span, #project-card .pc-description { font-size: var(--text-caption); }
#project-card .pc-field strong { font-size: var(--text-small); }
.login-page { font-size: 15px; }
.login-submit { font-size: 14px!important; }
.calendar-scroll { overflow-x: auto; }
.calendar-grid { display: grid; grid-template-columns: repeat(7,minmax(100px,1fr)); min-width: 760px; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.calendar-weekday { padding: 10px; background: #f5f8fa; color: var(--muted); text-align: center; }
.calendar-day { padding: 10px; min-height: 110px; background: white; }
.calendar-day.outside { background: #f8fafc; }
.calendar-day time { display: inline-grid; place-items: center; width: 26px; height: 26px; margin-bottom: 6px; }
.calendar-day.today time { background: var(--brand); color: white; border-radius: 50%; }
.calendar-event { display: block; border-left: 3px solid var(--accent); border-radius: 5px; background: #edf7f8; padding: 7px; margin-top: 5px; font-size: 11px; overflow-wrap: anywhere; }
.calendar-event strong, .calendar-event span { display: block; }
.calendar-event span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.calendar-agenda>a { display: grid; grid-template-columns: 190px 80px minmax(0,1fr); gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.calendar-agenda>a:last-child { border: 0; }
.calendar-event:hover { background: #dff0f4; text-decoration: none; }
.pagination-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.pagination-bar [aria-disabled=true] { opacity: .45; cursor: default; }
.number-cell { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.customers-table { width: 100%; min-width: 900px; table-layout: fixed; }
.customers-table .customers-vat,
.customers-table .customers-deposit,
.customers-table .customers-projects,
.customers-table .customers-actions { width: 180px; }
.customers-table th, .customers-table td { text-align: left; vertical-align: middle; padding: 12px 16px; }
.customers-table td:first-child { white-space: normal; overflow-wrap: anywhere; }
.customers-table .customers-action-cell { text-align: right; }
.customers-table .btn { white-space: nowrap; }
.customer-form { max-width: 780px; }
.customer-form .field { margin-bottom: 24px; }
.customer-options { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.customer-options legend { font-size: var(--text-small); font-weight: 600; padding: 0; margin-bottom: 12px; }
.customer-form .customer-option { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; cursor: pointer; }
.customer-option strong, .customer-option small { display: block; }
.customer-option small { margin-top: 4px; color: var(--muted); font-size: 12px; font-weight: 400; }
.customer-form input.customer-switch { appearance: none; width: 38px; min-width: 38px; height: 22px; min-height: 22px; padding: 2px; margin: 0; border: 1px solid #aeb8ca; border-radius: 20px; background: #dce2ed; cursor: pointer; box-shadow: none; }
.customer-form input.customer-switch::before { content: ''; display: block; width: 16px; height: 16px; border-radius: 50%; background: white; box-shadow: 0 1px 3px #0002; }
.customer-form input.customer-switch:checked { background: var(--brand); border-color: var(--brand); }
.customer-form input.customer-switch:checked::before { transform: translateX(16px); }
.customer-form input.customer-switch:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.customer-form .form-actions { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
@media(max-width:540px) { .customer-options { grid-template-columns: minmax(0,1fr); } }
.style-swatches { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.style-swatches>div::before { content: ''; display: block; height: 32px; border-radius: 8px; margin-bottom: 6px; background: var(--sample); }
@media(max-width:700px) {
  .grid { grid-template-columns: minmax(0,1fr); }
  .calendar-agenda>a { grid-template-columns: 1fr; gap: 4px; }
  .sidebar { min-height: 0; height: auto; padding: 10px 12px; overflow: hidden; }
  .sidebar-nav { min-width: 0; flex: 1; overflow-x: auto; padding-bottom: 0; }
  .sidebar .nav-link { flex-shrink: 0; }
  .card { padding: 18px; }
  .page-title { font-size: 22px; }
  .project-toolbar .control { max-width: none!important; flex-basis: 100%; }
}
@media(prefers-reduced-motion:reduce) { *, *::before, *::after { scroll-behavior: auto!important; transition: none!important; } }
/* Project queue counters share the sidebar palette. */
.sidebar .nav-link .nav-count { margin-left:auto; min-width:24px; padding:2px 7px; border-radius:999px; background:#edf7f2; color:#25836a; font-size:12px; font-weight:700; line-height:18px; text-align:center; flex-shrink:0; font-variant-numeric:tabular-nums; }
.sidebar .nav-link .nav-count.nav-count-errors { background:#fceeed; color:#b64040; }
.shipped-projects-table { width:100%; min-width:0; table-layout:fixed; }
.shipped-projects-table th, .shipped-projects-table td { padding:14px 10px; vertical-align:middle; white-space:normal; overflow-wrap:anywhere; }
.shipped-projects-table .number-cell { white-space:normal; overflow-wrap:normal; }
.shipped-projects-table .project-name { white-space:normal; overflow-wrap:anywhere; }
.payment-timing { display:inline-flex; margin-top:8px; padding:3px 8px; border-radius:7px; font-size:12px; font-weight:600; line-height:1.4; white-space:normal; }
.payment-timing-normal { background:#edf7f2; color:#25836a; }
.payment-timing-warning { background:#fff5df; color:#936416; }
.payment-timing-danger { background:#fceeed; color:#b64040; }
.payment-timing-unknown { background:#f1f2f6; color:#747e96; }
