:root{
  --bg:#0d0f10;--brand:#0d0f10;--surface:#141618;--surface2:#1a1d1f;--surface3:#1f2224;
  --border:rgba(255,255,255,0.07);--border2:rgba(255,255,255,0.12);
  --text:#e8e6e0;--text2:#8a8880;--text3:#5a5855;
  --accent:#c8f55a;--accent-dim:rgba(200,245,90,0.12);--accent-dim2:rgba(200,245,90,0.06);
  --red:#f05555;--red-dim:rgba(240,85,85,0.12);
  --amber:#f0a840;--amber-dim:rgba(240,168,64,0.12);
  --blue:#5a9ef0;--blue-dim:rgba(90,158,240,0.12);
  --green:#4cba7a;--green-dim:rgba(76,186,122,0.1);
  --purple:#9b72f0;--purple-dim:rgba(155,114,240,0.1);
  --font:'DM Sans',sans-serif;--serif:'DM Serif Display',serif;--mono:'DM Mono',monospace;
  --radius:10px;--radius-sm:6px;--radius-lg:14px;--row-divider:none}
*{box-sizing:border-box;margin:0;padding:0}
body{font-family:var(--font);background:var(--bg);color:var(--text);min-height:100vh;overflow-x:hidden}

/* Layout */
body{padding-left:240px;margin:0;min-height:100vh}
.app{display:block}
.sidebar{position:fixed;top:0;left:0;width:240px;height:100vh;background:var(--surface);border-right:1px solid var(--border);display:flex;flex-direction:column;z-index:50;overflow:hidden}
.main-area{display:flex;flex-direction:column;min-height:100vh;width:100%;min-width:0}
.topbar{position:sticky;top:0;z-index:40;height:58px;background:var(--surface);border-bottom:1px solid var(--border);padding:0 1.5rem;display:flex;align-items:center;justify-content:space-between;gap:12px}
.content{padding:1.75rem;flex:1;min-width:0}
.skip-link{position:fixed;top:10px;left:10px;z-index:10001;transform:translateY(-140%);background:var(--accent);color:#0d0f10;border-radius:6px;padding:8px 12px;font-size:13px;font-weight:700;text-decoration:none;transition:transform 0.15s}
.skip-link:focus{transform:translateY(0);outline:2px solid #fff;outline-offset:2px}
.content::-webkit-scrollbar{width:8px}
.content::-webkit-scrollbar-track{background:var(--surface2)}
.content::-webkit-scrollbar-thumb{background:var(--border2);border-radius:4px}

.three-col{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:1.25rem;margin-bottom:1.25rem}
.timeline-log-row{display:flex;gap:10px;padding:0.5rem 0;border-bottom:var(--row-divider);font-size:12.5px}
.timeline-log-row:last-child{border-bottom:none}
.tl-date{color:var(--text3);width:110px;flex-shrink:0;font-family:var(--mono);font-size:11.5px}
.tl-event{flex:1;color:var(--text2)}.tl-event strong{color:var(--text);font-weight:500}
.risk-ring-wrap{display:flex;flex-direction:column;align-items:center;padding:0.5rem 0}
.risk-ring{position:relative;display:inline-flex;align-items:center;justify-content:center}
.risk-ring-label{position:absolute;text-align:center}
.risk-ring-num{font-family:var(--serif);font-size:26px;font-weight:400;line-height:1}
.risk-ring-text{font-size:11px;color:var(--text3);margin-top:2px}
.scan-property-header{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:8px}
.scan-property-name{font-size:14px;font-weight:500;color:var(--text)}
.scan-finding{display:flex;gap:8px;font-size:12.5px;color:var(--text2);line-height:1.5;margin:4px 0;align-items:flex-start}
.scan-finding-dot{width:7px;height:7px;border-radius:50%;background:var(--text3);flex-shrink:0;margin-top:5px}
.scan-finding-dot.red{background:var(--red)}.scan-finding-dot.amber{background:var(--amber)}
.content::-webkit-scrollbar-thumb:hover{background:var(--text3)}

/* Sidebar */
.logo-wrap{padding:1.25rem 1.25rem 1rem;border-bottom:1px solid var(--border);flex-shrink:0}
.logo{font-family:var(--serif);font-size:22px;letter-spacing:-0.5px;color:var(--text)}
.logo em{font-style:italic;color:var(--accent)}
.logo-tag{font-size:10px;color:var(--text3);margin-top:2px;letter-spacing:0.05em;text-transform:uppercase}
.nav-section-label{font-size:10px;font-weight:600;letter-spacing:0.1em;text-transform:uppercase;color:var(--text3);padding:1rem 1.25rem 0.4rem}
.nav-item{display:flex;align-items:center;gap:10px;padding:0.6rem 1.25rem;font-size:13.5px;color:var(--text2);cursor:pointer;border-left:2px solid transparent;transition:all 0.15s;user-select:none}
button.nav-item{width:100%;background:transparent;border-top:0;border-right:0;border-bottom:0;font:inherit;text-align:left;color:inherit}
.nav-item:hover{color:var(--text);background:rgba(255,255,255,0.03)}
.nav-item.active{color:var(--accent);background:var(--accent-dim2);border-left-color:var(--accent);font-weight:500}
.nav-item.ll.active{color:var(--blue);background:rgba(90,158,240,0.05);border-left-color:var(--blue)}
.nav-icon{width:15px;height:15px;flex-shrink:0;opacity:0.7}
.nav-item.active .nav-icon{opacity:1}
.nav-badge{margin-left:auto;background:var(--red);color:#fff;font-size:10px;font-weight:600;padding:1px 6px;border-radius:999px}
.sidebar-footer{flex-shrink:0;padding:1.1rem 1.25rem;border-top:1px solid var(--border)}
.scan-status{display:flex;align-items:center;gap:10px;font-size:14px;color:var(--text);font-weight:500;letter-spacing:0.01em}
.scan-dot{width:9px;height:9px;border-radius:50%;background:var(--accent);box-shadow:0 0 10px var(--accent);animation:pulse 2s infinite}
@keyframes pulse{0%,100%{opacity:1}50%{opacity:0.4}}

/* Topbar */
.page-title{font-family:var(--serif);font-size:20px;font-weight:400}
.topbar-actions{display:flex;gap:8px;align-items:center;flex-shrink:0;flex-wrap:nowrap}
.pill{display:inline-flex;align-items:center;gap:6px;padding:5px 12px;border-radius:999px;font-size:12px;font-weight:500;border:1px solid}
.pill-green{background:var(--accent-dim);color:var(--accent);border-color:rgba(200,245,90,0.25)}
.pill-red{background:var(--red-dim);color:var(--red);border-color:rgba(240,85,85,0.25)}
.pill-amber{background:var(--amber-dim);color:var(--amber);border-color:rgba(240,168,64,0.25)}
.pill-blue{background:var(--blue-dim);color:var(--blue);border-color:rgba(90,158,240,0.25)}
.pill-purple{background:var(--purple-dim);color:var(--purple);border-color:rgba(155,114,240,0.25)}

/* Buttons */
.btn{display:inline-flex;align-items:center;gap:7px;padding:7px 16px;border-radius:var(--radius-sm);font-size:13px;font-weight:500;cursor:pointer;transition:all 0.15s;border:none;font-family:var(--font)}
.btn:focus-visible,.web-scan-btn:focus-visible,.nav-item:focus-visible,.tab:focus-visible,.clause-tab:focus-visible,.review-tab:focus-visible,.exp-filter-btn:focus-visible,.link-btn:focus-visible,.upload-zone:focus-visible,[role="switch"]:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.btn-primary{background:var(--accent);color:#0d0f10}.btn-primary:hover{background:#d4f770}
.btn-ghost{background:transparent;color:var(--text2);border:1px solid var(--border2)}.btn-ghost:hover{background:var(--surface3);color:var(--text)}
.btn-danger{background:var(--red-dim);color:var(--red);border:1px solid rgba(240,85,85,0.2)}
.btn-blue{background:var(--blue);color:#fff}.btn-blue:hover{background:#5aaaff}
.web-scan-btn{background:var(--accent-dim);border:1px solid rgba(200,245,90,0.25);color:var(--accent);display:inline-flex;align-items:center;gap:7px;padding:7px 14px;border-radius:var(--radius-sm);font-size:13px;font-weight:500;cursor:pointer;font-family:var(--font);transition:all 0.15s}
.web-scan-btn:hover{background:rgba(200,245,90,0.18)}

/* Cards */
.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg);padding:1.25rem}
.card-title{font-size:11px;font-weight:600;letter-spacing:0.08em;text-transform:uppercase;color:var(--text3);margin-bottom:0.875rem}

/* Metrics */
.metric-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin-bottom:1.5rem}
.metric-card{background:var(--surface2);border:1px solid var(--border);border-radius:var(--radius);padding:1.1rem}
.metric-label{font-size:11.5px;color:var(--text2);margin-bottom:6px}
.metric-val{font-family:var(--serif);font-size:28px;font-weight:400;line-height:1}
.metric-val.red{color:var(--red)}.metric-val.amber{color:var(--amber)}.metric-val.green{color:var(--accent)}.metric-val.blue{color:var(--blue)}
.metric-sub{font-size:11px;color:var(--text3);margin-top:4px}

/* Layout helpers */
.two-col{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(0,1fr);gap:1.25rem}
.col{display:flex;flex-direction:column;gap:1.25rem}

/* Alerts */
.alert-item{display:flex;align-items:flex-start;gap:12px;padding:1rem 0;border-bottom:var(--row-divider)}
.alert-item:last-child{border-bottom:none;padding-bottom:0}
.alert-item:first-child{padding-top:0}
.alert-dot{width:9px;height:9px;border-radius:50%;flex-shrink:0;margin-top:5px}
.dot-red{background:var(--red);box-shadow:0 0 8px rgba(240,85,85,0.5)}
.dot-amber{background:var(--amber);box-shadow:0 0 8px rgba(240,168,64,0.4)}
.dot-green{background:var(--accent);box-shadow:0 0 8px rgba(200,245,90,0.4)}
.dot-blue{background:var(--blue)}
.dot-purple{background:var(--purple)}
.alert-body{flex:1;min-width:0}
.alert-title{font-size:13.5px;font-weight:500;margin-bottom:3px}
.alert-sub{font-size:12px;color:var(--text2);line-height:1.5}
.alert-actions{display:flex;gap:6px;margin-top:8px;flex-wrap:wrap}

/* Occupancy bars */
.occ-row{display:flex;align-items:center;gap:12px;padding:0.55rem 0;border-bottom:var(--row-divider)}
.occ-row:last-child{border-bottom:none}
.occ-name{font-size:13px;width:160px;flex-shrink:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.occ-bar-wrap{flex:1;background:var(--surface3);border-radius:3px;height:5px;overflow:hidden}
.occ-bar{height:5px;border-radius:3px}
.bar-red{background:var(--red)}.bar-amber{background:var(--amber)}.bar-green{background:var(--accent)}
.occ-pct{font-size:12px;font-family:var(--mono);width:36px;text-align:right;flex-shrink:0}
.occ-pct.red{color:var(--red)}.occ-pct.amber{color:var(--amber)}.occ-pct.green{color:var(--accent)}

/* Timeline */
.timeline-row{display:flex;gap:12px;padding:0.65rem 0;border-bottom:var(--row-divider);font-size:12.5px}
.timeline-row:last-child{border-bottom:none}
.t-date{color:var(--text3);width:120px;flex-shrink:0;font-family:var(--mono);font-size:11.5px}
.t-event{flex:1;color:var(--text2)}.t-event strong{color:var(--text);font-weight:500}

/* Tabs */
.tabs{display:flex;border-bottom:1px solid var(--border);margin-bottom:1.25rem}
.tab{padding:0.6rem 1rem;font-size:13px;cursor:pointer;color:var(--text3);border-bottom:2px solid transparent;margin-bottom:-1px;transition:all 0.15s}
.tab:hover{color:var(--text2)}.tab.active{color:var(--accent);border-bottom-color:var(--accent);font-weight:500}

/* Chips */
.chip{font-size:11px;padding:3px 9px;border-radius:999px;border:1px solid var(--border2);color:var(--text2)}
.chip.active{background:rgba(200,245,90,0.08);color:var(--accent);border-color:rgba(200,245,90,0.2)}
.chip.vacant{background:var(--red-dim);color:var(--red);border-color:rgba(240,85,85,0.2);text-decoration:line-through}

/* Property cards */
.prop-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1rem}
.prop-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg);padding:1.25rem;cursor:pointer;transition:border-color 0.15s}
.prop-card:hover{border-color:var(--border2)}.prop-card.violation{border-color:rgba(240,85,85,0.3)}.prop-card.watch{border-color:rgba(240,168,64,0.3)}

/* Savings grid */
.savings-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin:1rem 0}
.savings-item{background:var(--surface3);border-radius:var(--radius-sm);padding:0.875rem;text-align:center}
.savings-num{font-family:var(--serif);font-size:20px;color:var(--accent);margin-bottom:2px}
.savings-label{font-size:11px;color:var(--text3)}

/* Cure bar */
.cure-bar-wrap{background:var(--surface3);border-radius:4px;height:8px;overflow:hidden;margin:8px 0}
.cure-bar{height:8px;border-radius:4px;background:var(--amber)}

/* Clause box */
.clause-box{background:var(--surface2);border:1px solid var(--border);border-radius:var(--radius);padding:1rem;margin-top:0.75rem}
.clause-text{font-size:12px;color:var(--text2);line-height:1.65;font-family:var(--mono)}

/* Table */
.table{width:100%;border-collapse:collapse}
.table th{font-size:11px;font-weight:600;letter-spacing:0.07em;text-transform:uppercase;color:var(--text3);text-align:left;padding:0.5rem 0.75rem;border-bottom:1px solid var(--border)}
.table td{font-size:13px;padding:0.75rem;border-bottom:1px solid var(--border);color:var(--text2);vertical-align:middle}
.table tr:last-child td{border-bottom:none}.table td strong{color:var(--text);font-weight:500}

/* Modal */
.modal-overlay{position:fixed;inset:0;background:rgba(0,0,0,0.7);display:flex;align-items:center;justify-content:center;z-index:100;padding:1.5rem}
/* Standalone modals without a .modal-overlay wrapper — make the root element act as the overlay */
#add-event-modal,#add-savings-modal{position:fixed;inset:0;background:rgba(0,0,0,0.7);z-index:100;padding:1.5rem;max-width:none;max-height:none;width:auto;border:none;border-radius:0;align-items:center;justify-content:center}
#add-event-modal .modal-inner,#add-savings-modal .modal-inner{background:var(--surface);border:1px solid var(--border2);border-radius:var(--radius-lg);width:100%;max-height:85vh;overflow-y:auto;display:flex;flex-direction:column}
.modal{background:var(--surface);border:1px solid var(--border2);border-radius:var(--radius-lg);width:100%;max-width:680px;max-height:85vh;display:flex;flex-direction:column}
.modal-header{padding:1.25rem 1.5rem;border-bottom:1px solid var(--border);display:flex;justify-content:space-between;align-items:center;flex-shrink:0}
.modal-body{padding:1.5rem;overflow-y:auto;flex:1}
.modal-footer{padding:1rem 1.5rem;border-top:1px solid var(--border);display:flex;gap:8px;justify-content:flex-end;flex-shrink:0}
#upgrade-modal[data-hard-gate="true"] button[onclick^="closeUpgradeModal"]{display:none}
.notice-text{font-size:13px;line-height:1.85;color:var(--text2);white-space:pre-wrap}
.analysis-text{font-size:13.5px;line-height:1.8;color:var(--text2)}
.loading-wrap{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:3rem;gap:1rem;color:var(--text2);font-size:13px}
.spinner{width:28px;height:28px;border:2px solid var(--border2);border-top-color:var(--accent);border-radius:50%;animation:spin 0.8s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}

/* Lease Upload */
.upload-input{display:none}
.link-btn{background:none;border:none;padding:0;color:var(--accent);font-size:13px;font-weight:500;cursor:pointer;font-family:inherit;transition:opacity 0.15s}
.link-btn:hover{opacity:0.75}
.upload-zone{border:2px dashed var(--border2);border-radius:var(--radius-lg);padding:3rem 2rem;text-align:center;cursor:pointer;transition:all 0.2s;background:var(--surface2)}
.upload-zone:hover,.upload-zone.dragover{border-color:var(--accent);background:var(--accent-dim2)}
.upload-icon{width:48px;height:48px;border-radius:12px;background:var(--accent-dim);border:1px solid rgba(200,245,90,0.2);display:flex;align-items:center;justify-content:center;margin:0 auto 1rem}
.clause-result-card{background:var(--surface2);border:1px solid rgba(200,245,90,0.2);border-radius:var(--radius-lg);padding:1.25rem}
.clause-field{display:flex;gap:12px;padding:0.7rem 0}
.clause-field:last-child{border-bottom:none}
.clause-field-label{font-size:11.5px;color:var(--text3);width:160px;flex-shrink:0;font-weight:500;text-transform:uppercase;letter-spacing:0.04em;padding-top:2px}
.clause-field-value{font-size:13.5px;color:var(--text);flex:1;line-height:1.6}
.clause-field-value.hl{color:var(--accent);font-weight:500;font-family:var(--mono)}
.parse-step{display:flex;align-items:center;gap:10px;font-size:13px;color:var(--text3);padding:5px 0}
.parse-step.active{color:var(--text)}.parse-step.done{color:var(--accent)}
.parse-step-icon{width:18px;height:18px;border-radius:50%;border:1.5px solid currentColor;display:flex;align-items:center;justify-content:center;font-size:10px;flex-shrink:0}
.parse-step.done .parse-step-icon{background:var(--accent);border-color:var(--accent);color:#0d0f10}
.rent-calc-box{background:var(--surface3);border:1px solid rgba(200,245,90,0.15);border-radius:var(--radius);padding:1.25rem;margin-top:1rem}
.rent-calc-row{display:flex;justify-content:space-between;padding:0.5rem 0;border-bottom:var(--row-divider);font-size:13.5px}
.rent-calc-row:last-child{font-weight:600}
.rent-calc-row span:last-child{font-family:var(--mono);color:var(--accent)}
.parsed-lease-item{background:var(--surface2);border:1px solid var(--border);border-radius:var(--radius);padding:1rem;display:flex;align-items:center;gap:12px;cursor:pointer;transition:border-color 0.15s;margin-bottom:8px}
.parsed-lease-item:hover{border-color:var(--border2)}

.detail-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin-bottom:1rem}
.detail-item{background:var(--surface3);border-radius:var(--radius-sm);padding:0.875rem;text-align:center}
.detail-num{font-family:var(--serif);font-size:18px;margin-bottom:2px}
.detail-label{font-size:10.5px;color:var(--text3)}
.heatmap-grid{display:grid;grid-template-columns:repeat(12,1fr);gap:4px;margin-top:0.75rem}
.heatmap-cell{height:32px;border-radius:4px;display:flex;align-items:center;justify-content:center;font-size:10px;font-family:var(--mono);font-weight:500}
.cell-0{background:var(--surface3);color:var(--text3)}.cell-1{background:rgba(76,186,122,0.15);color:var(--green)}.cell-2{background:rgba(240,168,64,0.2);color:var(--amber)}.cell-3{background:rgba(240,85,85,0.2);color:var(--red)}
.heatmap-months{display:grid;grid-template-columns:repeat(12,1fr);gap:4px;margin-bottom:4px}
.heatmap-month{font-size:9px;font-family:var(--mono);color:var(--text3);text-align:center;text-transform:uppercase}
.lease-bar-wrap{position:relative;height:36px;background:var(--surface3);border-radius:6px;overflow:hidden;margin:4px 0}
.lease-bar{position:absolute;height:100%;border-radius:6px;display:flex;align-items:center;padding:0 10px;font-size:11px;font-weight:500;white-space:nowrap}
.lease-bar.active{background:rgba(90,158,240,0.2);border:1px solid rgba(90,158,240,0.3);color:var(--blue)}
.lease-bar.expiring{background:var(--amber-dim);border:1px solid rgba(240,168,64,0.3);color:var(--amber)}
.lease-bar.critical{background:var(--red-dim);border:1px solid rgba(240,85,85,0.3);color:var(--red)}
.lease-bar.vacant{background:rgba(255,255,255,0.04);border:1px solid var(--border);color:var(--text3)}
.timeline-labels{display:flex;justify-content:space-between;font-size:10px;font-family:var(--mono);color:var(--text3);margin-top:6px}
.timeline-row-label{font-size:11.5px;color:var(--text2);margin-bottom:2px;display:flex;justify-content:space-between}
.risk-score{display:inline-flex;align-items:center;gap:5px;font-size:12px;font-weight:600;font-family:var(--mono)}
.risk-score.high{color:var(--red)}.risk-score.medium{color:var(--amber)}.risk-score.low{color:var(--green)}

/* Web scan */
.scan-modal-overlay{position:fixed;inset:0;background:rgba(0,0,0,0.8);display:flex;align-items:center;justify-content:center;z-index:200;padding:1.5rem}
.scan-modal{background:var(--surface);border:1px solid var(--border2);border-radius:var(--radius-lg);width:100%;max-width:760px;max-height:90vh;display:flex;flex-direction:column}
.scan-header{padding:1.25rem 1.5rem;border-bottom:1px solid var(--border);display:flex;justify-content:space-between;align-items:center;flex-shrink:0}
.scan-body{flex:1;overflow-y:auto;padding:0}
.scan-property-card{background:var(--surface2);border:1px solid var(--border);border-radius:var(--radius);padding:1rem;margin-bottom:1rem}
.anchor-status-row{display:flex;align-items:center;gap:8px;padding:4px 0;border-bottom:var(--row-divider)}
.anchor-status-row:last-child{border-bottom:none}
.anchor-name{font-size:13px;font-weight:500;color:var(--text);min-width:120px}
.anchor-pill{font-size:11px;padding:2px 8px;border-radius:999px;font-weight:600;white-space:nowrap;flex-shrink:0}
.anchor-operating{background:rgba(76,186,122,0.15);color:#4cba7a;border:1px solid rgba(76,186,122,0.3)}
.anchor-closed{background:var(--red-dim);color:var(--red);border:1px solid rgba(240,85,85,0.25);text-decoration:line-through}
.anchor-closing{background:var(--amber-dim);color:var(--amber);border:1px solid rgba(240,168,64,0.25)}
.anchor-unknown{background:var(--surface3);color:var(--text3);border:1px solid var(--border)}
.scan-status-badge{font-size:11px;padding:3px 10px;border-radius:999px;font-weight:600}
.badge-scanning{background:var(--blue-dim);color:var(--blue);border:1px solid rgba(90,158,240,0.3);animation:pulse 1.2s infinite}
.badge-violation{background:var(--red-dim);color:var(--red);border:1px solid rgba(240,85,85,0.25)}
.badge-watch{background:var(--amber-dim);color:var(--amber);border:1px solid rgba(240,168,64,0.25)}
.badge-healthy{background:var(--green-dim);color:var(--green);border:1px solid rgba(76,186,122,0.25)}
.badge-queued{background:var(--surface3);color:var(--text3);border:1px solid var(--border)}
.scan-progress-bar{height:3px;background:var(--surface3);border-radius:2px;overflow:hidden;margin-bottom:1rem}
.scan-progress-fill{height:3px;background:var(--accent);border-radius:2px;transition:width 0.5s}
.scan-finding{display:flex;gap:8px;font-size:12.5px;color:var(--text2);line-height:1.5;margin:4px 0}
.scan-summary-text{font-size:13px;color:var(--text2);line-height:1.7;margin-top:8px;padding:0.75rem;background:var(--surface3);border-radius:6px;border-left:2px solid var(--accent)}

/* ── Review tabs ── */
.review-tab{padding:7px 16px;background:transparent;border:none;border-bottom:2px solid transparent;color:var(--text2);font-size:13px;font-weight:500;cursor:pointer;font-family:var(--font);white-space:nowrap;transition:all 0.15s;margin-bottom:-1px}
.review-tab:hover{color:var(--text)}
.review-tab.active{color:var(--accent);border-bottom-color:var(--accent)}
.clause-field-list{display:grid;grid-template-columns:max-content 1fr;column-gap:1rem;align-items:baseline;font-size:13px}
.review-field{display:contents}
.review-field:last-child > .review-field-label,
.review-field:last-child > .review-field-value{border-bottom:none}
.review-field-label{color:var(--text3);padding:0.6rem 0;align-self:start}
.review-field-value{color:var(--text);font-family:var(--mono);font-size:12.5px;padding:0.6rem 0;text-wrap:balance}
.review-field-value.highlight{color:var(--accent);font-weight:600}
.review-field-value.warn{color:var(--amber)}
.review-field-value.danger{color:var(--red)}

.exp-filter-row{display:flex;gap:8px;margin-bottom:1.25rem;flex-wrap:wrap}
.exp-filter-btn{padding:5px 14px;border-radius:6px;font-size:12px;font-weight:500;cursor:pointer;border:1px solid var(--border);background:transparent;color:var(--text2);transition:all 0.15s;font-family:var(--font)}
.exp-filter-btn.active,.exp-filter-btn:hover{background:var(--accent-dim2);border-color:rgba(200,245,90,0.3);color:var(--accent)}
.exp-table{width:100%;border-collapse:collapse}
.exp-table th{font-size:11px;font-weight:600;letter-spacing:0.07em;text-transform:uppercase;color:var(--text3);padding:0 1rem 0.75rem;text-align:left;border-bottom:1px solid var(--border)}
.exp-table td{padding:0.875rem 1rem;font-size:13.5px;border-bottom:1px solid var(--border);vertical-align:top}
.exp-table tr:last-child td{border-bottom:none}
.exp-table tr:hover td{background:rgba(255,255,255,0.015)}

/* ── Reusable pattern for tables with long-text columns ─────────────────
   Apply this to any <table> that has a column containing paragraph-length
   text (clauses, conditions, notes, descriptions). Two-part pattern:
     1. Set style="table-layout:fixed" on the <table> and add a <colgroup>
        with explicit width values. This forces predictable column widths
        regardless of content — fixes the "long-text column gets squeezed
        because short columns hog space" problem permanently.
     2. Wrap long-text content in <div class="cell-clamp">...</div>. This
        clamps to 3 lines with "..." truncation, and the user can click
        anywhere on the clamped div to expand the full text inline (handled
        by a delegated listener far below in the JS — no per-cell wiring
        required).
   Use everywhere you have variable-length text in a table cell. Scales
   to hundreds of rows because the click handler is delegated at document
   level — one listener total, not one per row. */
.cell-clamp{display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;cursor:pointer;line-height:1.5;position:relative;transition:color 0.15s}
.cell-clamp:hover{color:var(--text)}
.cell-clamp.expanded{-webkit-line-clamp:unset;display:block;overflow:visible}
.cell-clamp::after{content:"";position:absolute;right:0;bottom:0;width:1.5em;height:1.5em;background:linear-gradient(to right,transparent,var(--surface) 70%);pointer-events:none;opacity:0.85}
.cell-clamp.expanded::after{display:none}

.exp-countdown{font-family:var(--mono);font-size:13px;font-weight:600}
.exp-countdown.urgent{color:var(--red)}
.exp-countdown.warn{color:var(--amber)}
.exp-countdown.ok{color:var(--accent)}
.exp-type-badge{display:inline-flex;align-items:center;gap:5px;padding:3px 9px;border-radius:4px;font-size:11px;font-weight:600;letter-spacing:0.04em}
.exp-type-exp{background:rgba(240,85,85,0.12);color:var(--red);border:1px solid rgba(240,85,85,0.2)}
.exp-type-opt{background:rgba(200,245,90,0.1);color:var(--accent);border:1px solid rgba(200,245,90,0.2)}
.exp-type-kick{background:rgba(90,158,240,0.1);color:var(--blue);border:1px solid rgba(90,158,240,0.2)}



/* ── Rent Savings Ledger ── */
.ledger-metric-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:1rem;margin-bottom:1.5rem}
.ledger-metric{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg);padding:1.25rem}
.ledger-metric-val{font-family:var(--serif);font-size:30px;line-height:1;margin-bottom:4px;font-weight:400}
.ledger-metric-label{font-size:11.5px;color:var(--text3)}
.ledger-metric-sub{font-size:11px;color:var(--text3);margin-top:3px}
.ledger-table{width:100%;border-collapse:collapse}
.ledger-table th{font-size:11px;font-weight:600;letter-spacing:0.07em;text-transform:uppercase;color:var(--text3);padding:0 1rem 0.75rem;text-align:left;border-bottom:1px solid var(--border)}
.ledger-table td{padding:0.875rem 1rem;font-size:13.5px;border-bottom:1px solid var(--border);vertical-align:middle}
.ledger-table tr:last-child td{border-bottom:none}
.ledger-table tr:hover td{background:rgba(255,255,255,0.015)}
.ledger-status{display:inline-block;padding:3px 9px;border-radius:4px;font-size:11px;font-weight:600}
.ledger-status-confirmed{background:rgba(76,186,122,0.15);color:#4cba7a;border:1px solid rgba(76,186,122,0.25)}
.ledger-status-active{background:rgba(240,168,64,0.12);color:var(--amber);border:1px solid rgba(240,168,64,0.2)}
.ledger-status-draft{background:var(--surface2);color:var(--text2);border:1px solid var(--border)}
.ledger-status-pending{background:rgba(90,158,240,0.1);color:var(--blue);border:1px solid rgba(90,158,240,0.2)}
.ledger-bar-wrap{width:80px;height:5px;background:var(--surface3);border-radius:3px;overflow:hidden;display:inline-block;vertical-align:middle;margin-right:6px}
.ledger-bar{height:5px;border-radius:3px;background:var(--accent)}
.ledger-add-btn{display:inline-flex;align-items:center;gap:6px;padding:7px 16px;background:var(--accent);color:#0d0f10;border:none;border-radius:8px;font-size:13px;font-weight:600;cursor:pointer;font-family:var(--font);transition:background 0.15s}
.ledger-add-btn:hover{background:#d4f770}
.fee-note{background:var(--surface);border:1px solid rgba(200,245,90,0.2);border-radius:var(--radius);padding:1rem 1.25rem;font-size:13px;color:var(--text2);margin-top:1rem}
.fee-note strong{color:var(--accent)}

@media(max-width:900px){.metric-grid{grid-template-columns:repeat(2,1fr)}.two-col{grid-template-columns:1fr}.prop-grid{grid-template-columns:1fr}.sidebar{width:200px}}

/* ── Mobile: sidebar off-canvas ── */
.mobile-topbar{display:none;position:fixed;top:0;left:0;right:0;height:52px;background:var(--brand);z-index:200;align-items:center;padding:0 1rem;gap:12px;border-bottom:1px solid rgba(255,255,255,0.1)}
.mobile-menu-btn{background:none;border:none;cursor:pointer;display:flex;flex-direction:column;gap:5px;padding:6px;flex-shrink:0}
.mobile-menu-btn span{display:block;width:20px;height:2px;background:#fff;border-radius:2px;transition:all 0.25s}
.mobile-menu-btn.open span:nth-child(1){transform:translateY(7px) rotate(45deg)}
.mobile-menu-btn.open span:nth-child(2){opacity:0}
.mobile-menu-btn.open span:nth-child(3){transform:translateY(-7px) rotate(-45deg)}
.mobile-logo{display:inline-flex;align-items:stretch;border-radius:5px;overflow:hidden;text-decoration:none}
.mobile-logo .ml{background:#fff;color:var(--brand);font-weight:700;font-size:12px;padding:3px 7px 3px 8px}
.mobile-logo .mr{background:var(--accent);color:var(--brand);font-weight:700;font-size:12px;padding:3px 7px}
.sidebar-overlay{display:none;position:fixed;inset:0;background:rgba(0,0,0,0.6);z-index:149;backdrop-filter:blur(2px)}
.sidebar-overlay.open{display:block}

@media(max-width:768px){
  body{padding-left:0 !important}
  .sidebar{transform:translateX(-100%);transition:transform 0.28s cubic-bezier(0.4,0,0.2,1);width:260px !important;z-index:150}
  .sidebar.open{transform:translateX(0)}
  .topbar{display:none}
  .mobile-topbar{display:flex}
  .main-area{padding-top:52px}
  .content{padding:1rem}
  .metric-grid{grid-template-columns:repeat(2,1fr);gap:0.75rem}
  .two-col{grid-template-columns:1fr}
  .prop-grid{grid-template-columns:1fr}
  .three-col{grid-template-columns:1fr}
  .card{padding:1rem}
  .card-title{font-size:13px}
  .table th,.table td{padding:8px 10px;font-size:12px}
  .modal-inner{width:calc(100vw - 2rem);max-height:90vh;overflow-y:auto;margin:1rem}
  .modal{align-items:flex-end;padding:0}
  .modal-inner{border-radius:var(--radius-lg) var(--radius-lg) 0 0;width:100%;max-width:100%}
  .topbar-actions{gap:6px}
  .btn{padding:6px 12px;font-size:12px}
  .metric-val{font-size:22px}
  .occ-bar-wrap{min-width:80px}
  .chart-wrap{overflow-x:auto}
  input,select,textarea{font-size:16px}
  .scan-results-grid{grid-template-columns:1fr !important}
  .upload-two-col{grid-template-columns:1fr !important}
  .settings-grid{grid-template-columns:1fr !important}
  .mobile-page-title{display:block;max-width:42vw;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:13px;color:var(--text2);font-weight:600}
  .topbar-title{font-size:15px}
}

@media(prefers-reduced-motion:reduce){
  *,*::before,*::after{animation-duration:0.01ms !important;animation-iteration-count:1 !important;scroll-behavior:auto !important;transition-duration:0.01ms !important}
}

/* Lease Clauses tabs */
.clause-tab {
  background: transparent;
  border: none;
  color: var(--text3);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.clause-tab:hover { color: var(--text); }
.clause-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.tab-count {
  color: inherit;
  opacity: 0.65;
  font-size: 12px;
  margin-left: 4px;
  font-weight: 400;
}

/* Browser autofill override - prevents Chrome from painting fields yellow/white over the dark theme */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px var(--surface2) inset !important;
  -webkit-text-fill-color: var(--text) !important;
  caret-color: var(--text);
  border-color: var(--border2) !important;
  transition: background-color 5000s ease-in-out 0s;
}


/* ===== Folded in from in-body <style> blocks (app.html decomposition step 1b) ===== */

/* Scoped to the Rent Savings Calculator view */
#view-rent-calculator input[type=range] {
  appearance: none; -webkit-appearance: none; width: 100%; height: 4px;
  background: var(--border2, var(--border)); border-radius: 2px; outline: none;
}
#view-rent-calculator input[type=range]::-webkit-slider-thumb {
  appearance: none; -webkit-appearance: none; width: 16px; height: 16px;
  border-radius: 50%; background: var(--accent); cursor: pointer;
  transition: transform 0.1s ease; border: none;
}
#view-rent-calculator input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.18); }
#view-rent-calculator input[type=range]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%; background: var(--accent);
  cursor: pointer; border: none;
}
#view-rent-calculator input[type=range]::-moz-range-thumb:hover { transform: scale(1.18); }
#view-rent-calculator select:focus { border-color: var(--accent); }

/* Request Lease Plan button states — driven by JS adding classes
   to drive the press + success visual feedback when copying the letter. */
.rp-copy-btn.pressed {
  transform: translateY(2px);
  background: var(--surface-2);
}
.rp-copy-btn.success {
  background: var(--accent);
  color: #0d0f10;
  font-weight: 600;
}

/* Request Lease Plan dropdown options — the closed-state colors come from
   inline style on the <select>, but the open popup uses OS colors by
   default. Setting explicit dark theme on the option children covers
   modern Chrome/Firefox/Edge. Safari ignores option-level styling but
   falls back to its own readable defaults. */
.rp-lease-select option {
  background: #14171a;
  color: #e8eaed;
}
.rp-lease-select option:hover,
.rp-lease-select option:checked {
  background: #1a1d20;
  color: #e8eaed;
}

/* ── Mobile: stack dense data tables into cards (≤640px) ──────────────────────
   Applies to expirations + terminations (.exp-table) and the savings ledger
   (.ledger-table). Pure CSS: rows become cards, the header row hides, and each
   cell is labeled by its column name via ::before (position-based; the
   :not([colspan]) guard skips loading/empty-state rows). No markup/JS changes;
   affects narrow screens only. */
@media (max-width: 640px) {
  .exp-table thead, .ledger-table thead { display: none; }
  .exp-table, .exp-table tbody,
  .ledger-table, .ledger-table tbody { display: block; width: 100%; }

  .exp-table tr, .ledger-table tr {
    display: block;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    padding: 4px 14px;
    margin-bottom: 10px;
  }
  .exp-table tr:hover td, .ledger-table tr:hover td { background: transparent; }

  .exp-table td, .ledger-table td {
    display: block;
    border: none !important;
    padding: 7px 0 !important;
    text-align: left !important;
    vertical-align: top;
  }
  .exp-table td:not([colspan])::before,
  .ledger-table td:not([colspan])::before {
    display: block;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text3);
    margin-bottom: 3px;
  }
  .exp-table td[colspan], .ledger-table td[colspan] { text-align: center !important; }

  /* Expirations (#exp-table) — column labels by position */
  #exp-table td:not([colspan]):nth-child(1)::before { content: "Property / Tenant"; }
  #exp-table td:not([colspan]):nth-child(2)::before { content: "Event Type"; }
  #exp-table td:not([colspan]):nth-child(3)::before { content: "Critical Date"; }
  #exp-table td:not([colspan]):nth-child(4)::before { content: "Days Remaining"; }
  #exp-table td:not([colspan]):nth-child(5)::before { content: "Notice Required"; }
  #exp-table td:not([colspan]):nth-child(6)::before { content: "Monthly Rent"; }
  #exp-table td:not([colspan]):nth-child(7)::before { content: "Status"; }
  /* nth-child(8) = actions column, no label */

  /* Terminations (#term-table) — column labels by position */
  #term-table td:not([colspan]):nth-child(1)::before { content: "Property / Tenant"; }
  #term-table td:not([colspan]):nth-child(2)::before { content: "Type"; }
  #term-table td:not([colspan]):nth-child(3)::before { content: "Trigger / Conditions"; }
  #term-table td:not([colspan]):nth-child(4)::before { content: "Act By / Test Date"; }
  #term-table td:not([colspan]):nth-child(5)::before { content: "Status"; }
  #term-table td:not([colspan]):nth-child(6)::before { content: "Monthly Rent"; }
  #term-table td:not([colspan]):nth-child(7)::before { content: "Notice Required"; }
  #term-table td:not([colspan]):nth-child(8)::before { content: "Penalty / Threshold"; }

  /* Savings ledger (#ledger-table) — column labels by position */
  #ledger-table td:not([colspan]):nth-child(1)::before { content: "Property / Client"; }
  #ledger-table td:not([colspan]):nth-child(2)::before { content: "Violation Type"; }
  #ledger-table td:not([colspan]):nth-child(3)::before { content: "Notice Sent"; }
  #ledger-table td:not([colspan]):nth-child(4)::before { content: "Monthly Savings"; }
  #ledger-table td:not([colspan]):nth-child(5)::before { content: "Annual Savings"; }
  #ledger-table td:not([colspan]):nth-child(6)::before { content: "Duration"; }
  #ledger-table td:not([colspan]):nth-child(7)::before { content: "Status"; }
  /* nth-child(8) = actions column, no label */
}

/* ── Modal chrome normalized to the "Add Termination Right" reference ──────────
   .modal-close and .modal-title were unstyled, so those close buttons rendered
   as the browser's default boxed button. Give the close button the muted,
   borderless × and the title the 16px/600 heading the termination modal uses.
   Card border/shadow + header-divider removal are scoped to the three modals
   called out (Add Critical Date, Select-a-Lease / Draft Notice, Log Savings
   Event) so they read like the termination card. */
.modal-close {
  background: none;
  border: none;
  color: var(--text3);
  font-size: 24px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  transition: color 0.15s;
}
.modal-close:hover { color: var(--text); }

.modal-title { font-size: 16px; font-weight: 600; }

#add-event-modal .modal-inner,
#add-savings-modal .modal-inner,
#lease-picker-modal .modal {
  border-color: var(--border);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

#add-event-modal .modal-header,
#add-savings-modal .modal-header,
#lease-picker-modal .modal-header {
  border-bottom: none;
}
