:root {
  --ink: #172031;
  --muted: #6f7888;
  --line: #e5e8ee;
  --soft: #f6f7f9;
  --panel: #ffffff;
  --navy: #132238;
  --brand: #6f54e8;
  --brand-dark: #5840ca;
  --brand-soft: #f0edff;
  --green: #168b68;
  --green-soft: #eaf8f3;
  --amber: #b66b09;
  --amber-soft: #fff6e5;
  --red: #c03c42;
  --red-soft: #fff0f1;
  --blue: #3477c9;
  --blue-soft: #edf5ff;
  --shadow: 0 18px 55px rgba(24, 31, 45, .12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--soft);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--soft); color: var(--ink); font-size: 14px; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(28px, 3vw, 38px); letter-spacing: -.04em; line-height: 1.08; }
h2 { margin-bottom: 5px; font-size: 20px; letter-spacing: -.025em; }
h3 { margin-bottom: 4px; font-size: 15px; }
.muted { color: var(--muted); }
.hidden, [hidden] { display: none !important; }
.eyebrow { margin: 0 0 8px; color: var(--brand); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }

.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; display: flex; width: 252px; flex-direction: column; color: #e7ebf3; background: var(--navy); }
.brand { display: flex; align-items: center; gap: 11px; height: 84px; padding: 0 23px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-mark { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 12px; color: white; background: linear-gradient(145deg, #8a72f8, #5840cc); box-shadow: 0 8px 22px rgba(93,67,216,.35); font-size: 13px; font-weight: 800; letter-spacing: -.04em; }
.brand-copy { display: flex; flex-direction: column; line-height: 1.05; }
.brand-copy strong { color: white; font-size: 14px; letter-spacing: .04em; }
.brand-copy small { margin-top: 4px; color: #aeb8c8; font-size: 11px; }
.main-nav { flex: 1; padding: 22px 13px; }
.nav-section { padding: 17px 12px 8px; color: #748196; font-size: 10px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.nav-link { display: flex; align-items: center; gap: 11px; min-height: 44px; margin: 2px 0; padding: 10px 12px; border-radius: 10px; color: #aeb8c8; font-size: 13px; font-weight: 600; transition: .18s ease; }
.nav-link:hover { color: white; background: rgba(255,255,255,.06); }
.nav-link.active { color: white; background: rgba(128,103,241,.2); box-shadow: inset 3px 0 var(--brand); }
.nav-symbol { display: grid; width: 22px; place-items: center; font-size: 18px; }
.sidebar-foot { padding: 12px; border-top: 1px solid rgba(255,255,255,.08); }
.account-menu { position: relative; }
.account-menu summary { display: flex; align-items: center; gap: 9px; min-height: 54px; padding: 7px; border-radius: 10px; cursor: pointer; list-style: none; }
.account-menu summary::-webkit-details-marker { display: none; }
.account-menu summary:hover { background: rgba(255,255,255,.06); }
.account-menu summary > span:nth-child(2) { display: flex; min-width: 0; flex: 1; flex-direction: column; }
.account-menu summary strong, .account-menu summary small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu summary strong { color: white; font-size: 12px; }
.account-menu summary small { margin-top: 3px; color: #95a1b3; font-size: 10px; }
.avatar { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border-radius: 50%; color: white; background: #334258; font-weight: 800; }
.chevron { color: #7f8ba0; }
.account-popover { position: absolute; bottom: 62px; left: 0; width: 226px; padding: 8px; border: 1px solid rgba(255,255,255,.1); border-radius: 12px; background: #1b2b42; box-shadow: var(--shadow); }
.account-popover button { width: 100%; padding: 9px 10px; border: 0; border-radius: 7px; color: #dce2ec; background: transparent; text-align: left; cursor: pointer; }
.account-popover button:hover { background: rgba(255,255,255,.08); }
.menu-label { padding: 6px 10px; color: #8794a8; font-size: 10px; font-weight: 700; text-transform: uppercase; }
.menu-rule { height: 1px; margin: 7px 0; background: rgba(255,255,255,.1); }

.main-content { min-height: 100vh; margin-left: 252px; padding: 42px clamp(24px, 4vw, 58px) 70px; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; max-width: 1500px; margin: 0 auto 28px; }
.page-header > div:first-child > p:last-child { max-width: 670px; margin: 0; color: var(--muted); line-height: 1.55; }
.header-actions, .form-actions, .review-actions, .timeline-controls { display: flex; align-items: center; gap: 9px; }
.btn { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; gap: 8px; padding: 9px 15px; border: 1px solid transparent; border-radius: 9px; background: white; color: var(--ink); font-weight: 700; cursor: pointer; transition: .15s ease; }
.btn:hover { transform: translateY(-1px); }
.btn.primary { color: white; background: var(--brand); box-shadow: 0 7px 18px rgba(111,84,232,.22); }
.btn.primary:hover { background: var(--brand-dark); }
.btn.secondary { border-color: var(--line); background: white; }
.btn.danger { color: white; background: var(--red); }
.btn.small { min-height: 32px; padding: 6px 10px; font-size: 12px; }
.btn.large { min-height: 48px; padding-inline: 22px; }
.btn.wide { width: 100%; }
.btn.icon-only { width: 40px; padding: 0; }
.danger-text { color: var(--red) !important; }
.icon-button { display: inline-grid; width: 32px; height: 32px; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 18px; cursor: pointer; }
.icon-button:hover { background: var(--soft); color: var(--ink); }
.toast { position: fixed; z-index: 100; top: 22px; right: 26px; max-width: 430px; padding: 12px 16px; border: 1px solid; border-radius: 10px; background: white; box-shadow: var(--shadow); font-weight: 600; animation: toast-in .25s ease; }
.toast.success { border-color: #bde5d7; color: var(--green); }
.toast.error { border-color: #f0c3c6; color: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; max-width: 1500px; margin: 0 auto 18px; }
.metric-card { display: flex; min-height: 92px; flex-direction: column; justify-content: center; padding: 18px 21px; border: 1px solid var(--line); border-radius: 13px; background: white; }
.metric-card span { color: var(--muted); font-size: 12px; font-weight: 600; }
.metric-card strong { margin-top: 7px; font-size: 26px; letter-spacing: -.04em; }
.panel { max-width: 1500px; margin-inline: auto; border: 1px solid var(--line); border-radius: 14px; background: white; box-shadow: 0 3px 16px rgba(29,39,58,.035); }
.panel-toolbar, .panel-title { display: flex; min-height: 66px; align-items: center; justify-content: space-between; gap: 15px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.search-box { display: flex; width: min(470px, 100%); align-items: center; gap: 9px; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: var(--soft); }
.search-box input { width: 100%; height: 38px; border: 0; outline: 0; background: transparent; }
.record-count { color: var(--muted); font-size: 12px; }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 12px 16px; color: #7e8795; background: #fbfbfc; font-size: 10px; font-weight: 800; letter-spacing: .06em; text-align: left; text-transform: uppercase; }
.data-table td { padding: 14px 16px; border-top: 1px solid var(--line); vertical-align: middle; }
.contractor-table tbody tr:not(.empty-row) { cursor: pointer; transition: .13s ease; }
.contractor-table tbody tr:not(.empty-row):hover { background: #faf9ff; }
.contractor-table tbody tr:focus { outline: 2px solid var(--brand); outline-offset: -2px; }
.person-cell { display: flex; align-items: center; gap: 11px; min-width: 190px; }
.person-cell > span:last-child { display: flex; flex-direction: column; }
.person-cell small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.person-avatar { display: grid; width: 36px; height: 36px; flex: 0 0 auto; place-items: center; border-radius: 10px; color: #5d48c9; background: var(--brand-soft); font-weight: 800; text-transform: uppercase; }
.person-avatar.large { width: 52px; height: 52px; border-radius: 15px; font-size: 18px; }
.person-avatar.small { width: 30px; height: 30px; border-radius: 9px; }
.person-avatar.new { color: var(--green); background: var(--green-soft); }
.identifier-pill, .role-pill { display: inline-flex; align-items: center; padding: 5px 8px; border-radius: 7px; color: #485365; background: #eef1f5; font-size: 10px; font-weight: 700; }
.role-pill { color: #654bcf; background: var(--brand-soft); }
.role-pill.super { color: #9a5c00; background: var(--amber-soft); }
.count-pill { display: inline-grid; min-width: 27px; height: 27px; place-items: center; border-radius: 8px; color: var(--brand); background: var(--brand-soft); font-size: 11px; font-weight: 800; }
.row-arrow { color: var(--brand); font-size: 17px; text-align: right; }
.empty-state { display: flex; min-height: 280px; align-items: center; justify-content: center; flex-direction: column; padding: 35px; text-align: center; }
.empty-state.compact { min-height: 220px; }
.empty-state p { max-width: 470px; color: var(--muted); }
.empty-icon { display: grid; width: 48px; height: 48px; margin-bottom: 14px; place-items: center; border-radius: 14px; color: var(--brand); background: var(--brand-soft); font-size: 24px; }
.draft-strip { display: flex; max-width: 1500px; margin: 0 auto 18px; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 17px; border: 1px solid #ded6ff; border-radius: 12px; background: #f7f5ff; }
.draft-strip > div:first-child { display: flex; flex-direction: column; gap: 3px; }
.draft-strip span { color: var(--muted); font-size: 11px; }
.draft-links { display: flex; gap: 12px; flex-wrap: wrap; }
.draft-links a { color: var(--brand); font-size: 12px; font-weight: 700; }

.drawer-open { overflow: hidden; }
.drawer-layer { position: fixed; z-index: 80; inset: 0; visibility: hidden; opacity: 0; transition: .2s ease; }
.drawer-layer.open { visibility: visible; opacity: 1; }
.drawer-backdrop { position: absolute; inset: 0; width: 100%; border: 0; background: rgba(18,25,38,.46); cursor: default; }
.drawer { position: absolute; inset: 0 0 0 auto; width: min(620px, 96vw); overflow-y: auto; background: white; box-shadow: -20px 0 60px rgba(17,24,38,.2); transform: translateX(100%); transition: .24s ease; }
.drawer-layer.open .drawer { transform: translateX(0); }
.drawer-header { position: sticky; z-index: 2; top: 0; display: flex; align-items: center; gap: 14px; min-height: 100px; padding: 19px 24px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(12px); }
.drawer-header > div:nth-child(2) { min-width: 0; flex: 1; }
.drawer-header h2 { overflow: hidden; margin-bottom: 3px; text-overflow: ellipsis; white-space: nowrap; font-size: 23px; }
.drawer-header p:last-child { margin: 0; color: var(--muted); font-size: 12px; }
.drawer-body { padding: 24px; }
.profile-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.profile-summary > div { display: flex; min-height: 74px; flex-direction: column; gap: 6px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.profile-summary span { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.profile-summary strong { font-size: 12px; }
.edit-disclosure, .archive-disclosure { margin: 12px 0 25px; border: 1px solid var(--line); border-radius: 10px; }
.edit-disclosure summary, .archive-disclosure summary { padding: 12px 14px; color: var(--brand); font-size: 12px; font-weight: 700; cursor: pointer; }
.edit-disclosure .stack-form { padding: 0 14px 14px; }
.drawer-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin: 25px 0 12px; }
.drawer-section-head p { margin: 0; color: var(--muted); font-size: 11px; }
.contract-list { display: flex; flex-direction: column; gap: 10px; }
.contract-card { display: grid; grid-template-columns: 56px minmax(0,1fr) 32px; gap: 12px; padding: 13px; border: 1px solid var(--line); border-radius: 11px; }
.contract-card.archived { background: #fafafa; }
.doc-preview { display: grid; width: 56px; height: 65px; overflow: hidden; place-items: center; border-radius: 7px; color: var(--muted); background: #edf0f4; font-size: 9px; font-weight: 800; }
.doc-preview img { width: 100%; height: 100%; object-fit: cover; }
.contract-card-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.contract-card-title strong { font-size: 12px; line-height: 1.4; }
.contract-card-main > p { margin: 6px 0; color: var(--muted); font-size: 11px; }
.status-pill { flex: 0 0 auto; padding: 4px 6px; border-radius: 6px; color: var(--green); background: var(--green-soft); font-size: 9px; font-weight: 800; }
.status-pill.archived { color: var(--muted); background: #edf0f4; }
.document-links { display: flex; gap: 10px; }
.document-links a { color: var(--brand); font-size: 10px; font-weight: 700; }
.contract-actions { display: flex; align-items: flex-start; flex-direction: column; }
.contract-edit { margin-top: 10px; }
.contract-edit summary { color: var(--muted); font-size: 10px; cursor: pointer; }
.compact-form { padding-top: 10px; }
.compact-form label { font-size: 10px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.empty-inline { padding: 18px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); text-align: center; }

.modal { width: min(510px, calc(100vw - 28px)); max-height: calc(100vh - 32px); overflow-y: auto; padding: 27px; border: 0; border-radius: 16px; box-shadow: var(--shadow); }
.modal::backdrop, .busy-dialog::backdrop { background: rgba(18,25,38,.55); backdrop-filter: blur(2px); }
.small-modal { width: min(430px, calc(100vw - 28px)); }
.modal-close { position: absolute; top: 14px; right: 14px; display: grid; width: 32px; height: 32px; place-items: center; border: 0; border-radius: 8px; color: var(--muted); background: var(--soft); font-size: 19px; cursor: pointer; }
.modal-copy { padding-right: 25px; margin-bottom: 22px; }
.modal-copy p:last-child { margin: 0; color: var(--muted); line-height: 1.5; }
.modal-icon { display: grid; width: 44px; height: 44px; margin-bottom: 16px; place-items: center; border-radius: 13px; color: var(--brand); background: var(--brand-soft); font-size: 22px; }
.stack-form { display: flex; flex-direction: column; gap: 13px; }
.stack-form label, .compact-form label, .form-grid label { display: flex; flex-direction: column; gap: 6px; color: #555f6d; font-size: 11px; font-weight: 700; }
label small { color: var(--muted); font-weight: 500; }
input, textarea, select { width: 100%; border: 1px solid #dce0e7; border-radius: 8px; outline: 0; background: white; color: var(--ink); }
input, select { height: 40px; padding: 0 11px; }
textarea { padding: 10px 11px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(111,84,232,.1); }
.drop-zone { display: flex !important; min-height: 150px; align-items: center; justify-content: center; gap: 6px !important; padding: 20px; border: 1.5px dashed #c8c0ee; border-radius: 12px; color: var(--ink) !important; background: #faf9ff; text-align: center; cursor: pointer; }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-icon { display: grid; width: 34px; height: 34px; margin-bottom: 4px; place-items: center; border-radius: 9px; color: var(--brand); background: white; font-size: 20px; box-shadow: 0 3px 10px rgba(0,0,0,.06); }
.drop-zone small, .form-note { color: var(--muted); font-size: 10px; }
.form-note { margin: 0; text-align: center; }
fieldset { padding: 12px; border: 1px solid var(--line); border-radius: 9px; }
legend { padding: 0 5px; color: var(--muted); font-size: 10px; font-weight: 700; }
.check-row { display: flex !important; align-items: center; flex-direction: row !important; gap: 8px !important; min-height: 30px; }
.check-row input { width: 16px; height: 16px; }
.busy-dialog { width: 250px; padding: 28px; border: 0; border-radius: 14px; text-align: center; }
.busy-dialog[open] { display: flex; align-items: center; flex-direction: column; gap: 8px; }
.busy-dialog span { color: var(--muted); font-size: 11px; }
.spinner { width: 28px; height: 28px; margin-bottom: 7px; border: 3px solid #e3defa; border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.review-shell { max-width: 980px; margin: 0 auto; }
.back-link { display: inline-block; margin-bottom: 25px; color: var(--muted); font-size: 12px; font-weight: 600; }
.review-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 25px; margin-bottom: 22px; }
.review-header > div:first-child > p:last-child { margin: 0; color: var(--muted); }
.source-file { display: flex; max-width: 280px; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: white; }
.source-file > span { display: grid; width: 35px; height: 42px; flex: 0 0 auto; place-items: center; border-radius: 6px; color: var(--muted); background: var(--soft); font-size: 8px; font-weight: 800; }
.source-file > div { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.source-file strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.source-file a { color: var(--brand); font-size: 10px; font-weight: 700; }
.inline-alert { display: flex; gap: 8px; margin-bottom: 15px; padding: 12px 14px; border: 1px solid; border-radius: 9px; font-size: 11px; }
.inline-alert.warning { color: #86540e; border-color: #f1d59e; background: var(--amber-soft); }
.inline-alert.info { color: #2b619b; border-color: #c6ddf5; background: var(--blue-soft); }
.inline-alert.error { color: var(--red); border-color: #efc2c5; background: var(--red-soft); }
.review-grid { display: flex; flex-direction: column; gap: 13px; }
.review-card { padding: 22px; border: 1px solid var(--line); border-radius: 13px; background: white; }
.review-card-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 19px; }
.review-card-head p { margin: 0; color: var(--muted); font-size: 11px; }
.step-number { display: grid; width: 28px; height: 28px; flex: 0 0 auto; place-items: center; border-radius: 8px; color: var(--brand); background: var(--brand-soft); font-size: 11px; font-weight: 800; }
.match-options { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.match-card { position: relative; display: flex; min-height: 67px; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.match-card:has(input:checked) { border-color: var(--brand); background: #faf9ff; box-shadow: 0 0 0 2px rgba(111,84,232,.08); }
.match-card > input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.match-card > span:nth-of-type(2) { display: flex; min-width: 0; flex: 1; flex-direction: column; }
.match-card small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.match-score { color: var(--green); font-size: 10px; font-weight: 800; }
.select-existing { display: flex; flex-direction: column; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); font-size: 10px; font-weight: 700; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.span-2 { grid-column: span 2; }
.review-actions { justify-content: flex-end; padding: 10px 0 30px; }

.legend { display: flex; max-width: 1500px; margin: -12px auto 16px; justify-content: flex-end; gap: 16px; color: var(--muted); font-size: 10px; }
.legend span { display: flex; align-items: center; gap: 5px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }
.legend-dot.invoice { background: #e3a12f; }.legend-dot.pending { background: var(--blue); }.legend-dot.paid { background: var(--green); }.legend-dot.historical { background: #98a1ae; }
.timeline-panel { max-width: 1500px; margin: 0 auto; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: white; box-shadow: 0 3px 16px rgba(29,39,58,.035); }
.timeline-scroll { overflow: auto; scrollbar-color: #c8cdd6 transparent; }
.payment-table { min-width: 2140px; border-collapse: separate; border-spacing: 0; }
.payment-table th, .payment-table td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.payment-table thead th { position: sticky; z-index: 3; top: 0; height: 68px; background: #fafbfc; }
.payment-table .sticky-name { position: sticky; z-index: 4; left: 0; width: 235px; min-width: 235px; background: white; box-shadow: 5px 0 9px rgba(30,38,51,.035); }
.payment-table thead .sticky-name { z-index: 5; padding: 0 18px; color: var(--muted); background: #fafbfc; font-size: 10px; text-align: left; text-transform: uppercase; }
.payment-table tbody .sticky-name { height: 112px; padding: 14px; text-align: left; }
.payment-table tbody .sticky-name > span:last-child { display: inline-flex; max-width: 165px; flex-direction: column; vertical-align: middle; }
.payment-table tbody .sticky-name .person-avatar { display: inline-grid; margin-right: 8px; vertical-align: middle; }
.payment-table tbody .sticky-name small { overflow: hidden; margin-top: 4px; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.month-head { position: relative; width: 105px; min-width: 105px; color: var(--muted); text-align: center; }
.month-head span { display: block; color: var(--ink); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.month-head strong { display: block; margin-top: 3px; font-size: 9px; }
.month-head em { position: absolute; bottom: 0; left: 50%; padding: 2px 6px; border-radius: 5px 5px 0 0; color: white; background: var(--brand); font-size: 7px; font-style: normal; transform: translateX(-50%); }
.month-head.current { background: #f5f2ff; }
.payment-cell { width: 105px; min-width: 105px; height: 112px; padding: 6px; background: #fbfcfd; text-align: center; vertical-align: middle; }
.payment-cell.current { background: #faf9ff; }
.payment-cell.overdue { background: #fff8f4; }
.no-obligation { color: #d2d6dc; }
.cell-card { position: relative; display: flex; min-height: 92px; align-items: center; justify-content: center; flex-direction: column; gap: 6px; padding: 6px 4px; border: 1px solid; border-radius: 9px; background: white; }
.invoice_required .cell-card { border-color: #efd9ae; }.payment_pending .cell-card { border-color: #cbdff7; }.paid .cell-card { border-color: #bfe2d6; }
.cell-status { display: flex; align-items: center; gap: 4px; font-size: 9px; font-weight: 800; }
.invoice_required .cell-status { color: var(--amber); }.payment_pending .cell-status { color: var(--blue); }.paid .cell-status { color: var(--green); }
.cell-status i { display: grid; width: 16px; height: 16px; place-items: center; border-radius: 50%; background: currentColor; color: white; font-size: 8px; font-style: normal; }
.cell-action { display: inline-flex; min-height: 24px; align-items: center; justify-content: center; padding: 4px 7px; border: 1px solid var(--line); border-radius: 6px; color: var(--brand); background: white; font-size: 8px; font-weight: 800; cursor: pointer; }
.cell-action input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.cell-action.primary { border-color: var(--brand); color: white; background: var(--brand); }
.cell-action.subtle { border: 0; color: var(--muted); background: transparent; }
.cell-doc-actions { display: flex; align-items: center; justify-content: center; gap: 4px; }
.cell-doc-actions a, .cell-doc-actions button { display: inline-flex; min-height: 20px; align-items: center; border: 0; color: var(--brand); background: transparent; font-size: 8px; font-weight: 700; cursor: pointer; }
.cell-doc-actions form { display: inline; }
.historical-label { position: absolute; right: 3px; bottom: 2px; color: var(--muted); font-size: 6px; text-transform: uppercase; }
.timeline-foot { display: flex; max-width: 1500px; margin: 9px auto 0; justify-content: space-between; color: var(--muted); font-size: 9px; }

.admin-grid { display: grid; grid-template-columns: minmax(280px, .7fr) minmax(600px, 1.8fr); gap: 16px; max-width: 1500px; margin: 0 auto; align-items: start; }
.admin-section { margin: 0; }
.panel-title h2 { margin: 0; }.panel-title p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.admin-list { padding: 8px; }
.admin-list-item { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 9px; }
.admin-list-item:hover { background: var(--soft); }
.admin-list-item > div { display: flex; min-width: 0; flex: 1; flex-direction: column; }
.admin-list-item small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.org-initial { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border-radius: 9px; color: var(--brand); background: var(--brand-soft); font-weight: 800; }
.delete-user-form { margin-top: 15px; text-align: center; }

.danger-page { max-width: 650px; margin: 7vh auto; padding: 40px; border: 1px solid #efc6c9; border-radius: 16px; background: white; box-shadow: 0 5px 25px rgba(65,22,25,.06); text-align: center; }
.danger-symbol { display: grid; width: 50px; height: 50px; margin: 0 auto 15px; place-items: center; border-radius: 50%; color: white; background: var(--red); font-size: 24px; font-weight: 800; }
.danger-page > p:not(.eyebrow) { color: var(--muted); line-height: 1.6; }
.danger-summary { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin: 22px 0; }
.danger-summary > div { display: flex; flex-direction: column; gap: 5px; padding: 12px; border-radius: 9px; background: var(--soft); }
.danger-summary span { color: var(--muted); font-size: 9px; text-transform: uppercase; }
.danger-summary strong { font-size: 11px; }

.auth-body { display: grid; min-height: 100vh; place-items: center; padding: 20px; background: radial-gradient(circle at 25% 15%, #f1edff 0, transparent 34%), linear-gradient(145deg,#f7f8fa,#edf0f5); }
.login-card, .choose-card { width: min(440px, 100%); padding: 40px; border: 1px solid rgba(255,255,255,.8); border-radius: 18px; background: rgba(255,255,255,.92); box-shadow: 0 25px 80px rgba(25,33,48,.12); }
.login-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 45px; }
.login-brand .brand-copy strong { color: var(--ink); }.login-brand .brand-copy small { color: var(--muted); }
.login-card h1 { font-size: 33px; }.login-lede { margin-bottom: 24px; color: var(--muted); line-height: 1.6; }
.provider-buttons { display: flex; flex-direction: column; gap: 9px; }
.btn.social { width: 100%; min-height: 48px; justify-content: flex-start; border-color: var(--line); font-weight: 600; }
.provider-icon { display: grid; width: 25px; height: 25px; margin-right: 8px; place-items: center; border-radius: 7px; font-weight: 800; }
.provider-icon.google { color: #4285f4; background: #eef4ff; }.provider-icon.microsoft { color: #1877c9; background: #edf6fc; font-size: 18px; }
.login-foot { margin: 22px 0 0; color: var(--muted); font-size: 10px; text-align: center; }
.choose-card { width: min(500px,100%); }.org-choices { display: flex; flex-direction: column; gap: 8px; margin: 24px 0; }
.org-choice { display: flex; width: 100%; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: white; cursor: pointer; }
.org-choice strong { flex: 1; text-align: left; }

@media (max-width: 1050px) {
  .admin-grid { grid-template-columns: 1fr; }
  .payments-header { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 760px) {
  .sidebar { position: static; width: 100%; height: auto; }
  .brand { height: 66px; }.main-nav { display: flex; overflow-x: auto; padding: 8px; }.nav-section { display: none; }.nav-link { flex: 0 0 auto; }
  .sidebar-foot { display: none; }.main-content { margin-left: 0; padding: 25px 15px 50px; }
  .page-header { align-items: flex-start; flex-direction: column; }.header-actions { width: 100%; }.header-actions .btn { flex: 1; }
  .metric-grid { grid-template-columns: 1fr 1fr; }.metric-card:last-child { grid-column: span 2; }
  .data-table { min-width: 760px; }.drawer { width: 100vw; }.profile-summary { grid-template-columns: 1fr; }
  .review-header { align-items: flex-start; flex-direction: column; }.match-options, .form-grid { grid-template-columns: 1fr; }.span-2 { grid-column: auto; }
  .review-actions { align-items: stretch; flex-direction: column-reverse; }.review-actions .btn { width: 100%; }
  .legend { justify-content: flex-start; flex-wrap: wrap; }.timeline-foot { flex-direction: column; gap: 4px; }
  .danger-page { padding: 25px 18px; }.danger-summary { grid-template-columns: 1fr; }
}
