:root {
  --bg: #FFFFFF;
  --surface: #fff;
  --surface-2: #fafafa;
  --ink: #262626;
  --muted: #7e7e7e;
  --line: #e9e9e9;
  --navy: #2c2c2c;
  --navy-2: #212121;
  --green: #269b73;
  --green-soft: #e9f7f1;
  --blue: #4a4a4a;
  --blue-soft: #f6f6f6;
  --amber: #d38a22;
  --amber-soft: #fff5e5;
  --red: #d85e59;
  --red-soft: #fff0ef;
  --violet: #765ac4;
  --violet-soft: #f2efff;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(38,38,38,.065),0 1px 2px rgba(38,38,38,.04);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { min-height: 100%; margin: 0; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
button,input,select,textarea { font: inherit; }
button,a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid #474747; outline-offset: 2px; }
[hidden] { display: none !important; }
.app-body { background: var(--bg); }
.app-shell { display: grid; grid-template-columns: 246px minmax(0,1fr); min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 40; display: flex; flex-direction: column; width: 270px; padding: 12px 14px 18px; overflow-y: auto;
  background: linear-gradient(180deg,#f5f5f7 0%,#eeeeef 100%);
  color: #4f6079;
  border-right: 1px solid #e6e6e8;
}
.brand {
  display: flex; align-items: center; gap: 12px; margin: 0 0 22px; padding: 14px 16px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 6px 18px rgba(38,38,38, 69%);
}
.brand-mark { display: grid; width: 39px; height: 39px; flex: 0 0 39px; border-radius: 12px; background: linear-gradient(145deg,#eef7f4,#a9dccb); color: #1d3c32; font-size: 12px; font-weight: 800; place-items: center; box-shadow: inset 0 0 0 1px rgba(255,255,255,.45); }
.brand strong,.brand small { display: block; }
.brand strong { font-size: 20px; letter-spacing: -.55px; line-height: 1; }
.brand small { margin-top: 10px; color: rgba(79,96,121,.6); font-size: 12px; letter-spacing: .7px; text-transform: uppercase; }
.nav-label { margin: 4px 12px 9px; color: rgba(79,96,121,.45); font-size: 12px; font-weight: 800; letter-spacing: 1.15px; text-transform: uppercase; }
.nav-list { display: grid; gap: 2px; }
.nav-link { display: flex; align-items: center; height: 48px; padding: 0 14px; gap: 14px; border-radius: 14px; color: #55647c; font-size: 14px; transition: .18s ease; }
.nav-link:hover { background: rgba(79,96,121,.08); color: #33405a; }
.nav-link.active { background: #d6d6d8; color: #f4f4f6; box-shadow: inset 3px 0 #2c2c2c; }
.nav-icon { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; flex: 0 0 20px; }
.nav-icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-bottom { margin-top: auto; padding-top: 20px; }
.profile-card { display: flex; align-items: center; padding: 10px; gap: 14px; border-radius: 13px; background: rgba(79,96,121,.06); color: #4f6079; }
.profile-card.active { box-shadow: inset 0 0 0 1px rgba(79,96,121,.3); }
.profile-card > span:nth-child(2) { min-width: 0; }
.profile-card strong,.profile-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-card strong { font-size: 14px; }
.profile-card small { margin-top: 4px; color: rgba(79, 96, 121, 0.55); font-size: 13px; }
.avatar { display: grid; width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%; background: #d8ece5; color: #25483d; font-size: 13px; font-weight: 800; place-items: center; }
.avatar.mini { width: 26px; height: 26px; flex-basis: 26px; font-size: 11px; }
.avatar.large { width: 68px; height: 68px; flex-basis: 68px; font-size: 18px; }
.sidebar-overlay { display: none; }
.main-shell { grid-column: 2; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; height: 72px; padding: 0 clamp(20px,3vw,42px); gap: 18px; border-bottom: 1px solid rgba(224,224,224,.88); background: rgba(255,255,255,.9); backdrop-filter: blur(18px) saturate(150%); }
.menu-button { display: none !important; }
.global-search { position: relative; width: min(370px,40vw); }
.global-search .nav-icon { position: absolute; left: 13px; top: 50%; color: #949494; transform: translateY(-50%); pointer-events: none; }
.global-search input { width: 100%; height: 42px; padding: 0 15px 0 41px; border: 1px solid var(--line); border-radius: 12px; outline: 0; background: #fafafa; color: var(--ink); font-size: 12px; transition: .18s ease; }
.global-search input:focus { border-color: #aeaeae; background: #fff; box-shadow: 0 0 0 3px rgba(74,74,74,.1); }
.topbar-actions { display: flex; align-items: center; margin-left: auto; gap: 10px; }
.icon-button { position: relative; display: inline-grid; width: 42px; height: 42px; padding: 0; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: #707070; place-items: center; }
.icon-button i { position: absolute; right: 8px; top: 7px; width: 7px; height: 7px; border: 2px solid #fff; border-radius: 50%; background: var(--red); }
.notification-count{position:absolute;right:-5px;top:-6px;display:grid;min-width:18px;height:18px;padding:0 4px;border:2px solid #fff;border-radius:999px;background:var(--red);color:#fff;font-size:8px;place-items:center}
.icon-button.small { width: 32px; height: 32px; border-radius: 9px; }
.icon-button.danger { border-color: #f3dad8; background: var(--red-soft); color: #bd4b47; }
.content { max-width: 1600px; min-height: calc(100vh - 112px); margin: 0 auto; padding: 31px clamp(20px,3vw,42px) 46px; }
.app-footer { display: flex; justify-content: space-between; padding: 0 clamp(20px,3vw,42px) 24px; color: #9b9b9b; font-size: 12px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 25px; gap: 20px; }
.page-head h1 { margin: 0; color: #2d2d2d; font-size: clamp(27px,3vw,36px); letter-spacing: -1.3px; line-height: 1.05; }
.page-head p { margin: 8px 0 0; color: var(--muted); font-size: 17px; }
.page-date { color: var(--muted); font-size: 11px; }
.button-group,.row-actions,.customer-actions { display: flex; align-items: center; gap: 8px; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 0 16px; gap: 8px; border: 1px solid transparent; border-radius: 11px; background: none; color: #5e5e5e; font-size: 11px; font-weight: 700; transition: .18s ease; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(41,41,41,.09); }
.btn.primary { background: var(--navy); color: #fff; }
.btn.secondary { border-color: var(--line); background: #fff; }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--red-soft); color: #b94642; }
.btn.compact { min-height: 36px; padding: 0 12px; font-size: 12px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.kpi-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 15px; margin-bottom: 18px; }
.kpi { position: relative; min-height: 134px; padding: 20px; overflow: hidden; }
.kpi-link{transition:transform .18s ease,box-shadow .18s ease}.kpi-link:hover{transform:translateY(-2px);box-shadow:0 14px 34px rgba(38,38,38,.1)}
.kpi::after { position: absolute; right: -27px; bottom: -42px; width: 112px; height: 112px; border-radius: 50%; background: var(--soft,#484848); content: ""; }
.kpi span { display: block; color: var(--muted); font-size: 13px; }
.kpi b { position: relative; z-index: 1; display: block; margin-top: 15px; color: #2d2d2d; font-size: 26px; letter-spacing: -.7px; }
.kpi small { position: relative; z-index: 1; display: block; margin-top: 9px; color: #939393; font-size: 12px; }
.kpi.blue { --soft: var(--blue-soft); }.kpi.violet{--soft:var(--violet-soft)}.kpi.amber{--soft:var(--amber-soft)}.kpi.green{--soft:var(--green-soft)}.kpi.red{--soft:var(--red-soft)}
.dashboard-grid,.report-grid,.settings-grid { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(300px,.75fr); gap: 18px; margin-bottom: 18px; }
.report-grid,.settings-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
.panel { padding: 21px; }
.panel + .panel,.table-panel + .table-panel { margin-top: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 19px; gap: 12px; }
.panel-head h2 { margin: 0; color: #353535; font-size: 14px; }
.panel-head p { margin: 8px 0 0; color: #939393; font-size: 12px; }
.panel-head a { color: var(--blue); font-size: 12px; font-weight: 700; }
.funnel-list { display: grid; gap: 13px; }
.funnel-row { display: grid; grid-template-columns: 98px minmax(80px,1fr) 100px; align-items: center; gap: 12px; color: #666666; font-size: 12px; }
.funnel-row > div,.mini-progress { height: 8px; overflow: hidden; border-radius: 999px; background: #f0f0f0; }
.funnel-row i,.mini-progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg,#2f2f2f,#76a493); }
.funnel-row b { color: #505050; font-size: 13px; text-align: right; }
.activity-list { display: grid; }
.activity-item { display: grid; grid-template-columns: 35px minmax(0,1fr) auto; align-items: center; min-height: 62px; padding: 8px 0; gap: 10px; border-bottom: 1px solid #f0f0f0; }
.activity-item:last-child { border-bottom: 0; }
.activity-symbol { display: grid; width: 33px; height: 33px; border-radius: 10px; background: var(--blue-soft); color: var(--blue); font-size: 11px; font-weight: 800; place-items: center; }
.activity-item strong,.activity-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-item strong { color: #484848; font-size: 13px; }.activity-item small{margin-top:5px;color:#959595;font-size:12px}.activity-item time{color:#7d8790;font-size:12px;line-height:1.55;text-align:right}
.table-panel { overflow: hidden; }
.table-panel.panel { overflow: hidden; }
.table-summary { display: flex; justify-content: space-between; padding: 15px 17px; border-bottom: 1px solid var(--line); color: #868686; font-size: 12px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 850px; }
th,td { padding: 13px 15px; border-bottom: 1px solid #f0f0f0; text-align: left; vertical-align: middle; }
th { background: #fbfbfb; color: #939393; font-size: 12px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase; white-space: nowrap; }
td { color: #5e5e5e; font-size: 13px; }
tbody tr { transition: background .15s ease; }tbody tr:hover{background:#fcfcfc}tbody tr:last-child td{border-bottom:0}
td strong { color: #474747; font-size: 13px; }.subtext{display:block;margin-top:4px;color:#9b9b9b;font-size:12px}
.company { display: flex; align-items: center; min-width: 165px; gap: 10px; }
.company-button { padding: 0; border: 0; background: transparent; color: inherit; text-align: left; }
.company > span,.company-logo { display: grid; width: 34px; height: 34px; flex: 0 0 34px; border-radius: 10px; background: #f0f0f0; color: #585858; font-size: 12px; font-weight: 800; place-items: center; }
.company strong,.company small { display: block; }.company small{margin-top:4px;color:#969696;font-size:12px;font-weight:400}
.company-logo.large { width: 44px; height: 44px; flex-basis: 44px; border-radius: 13px; font-size: 11px; }
.pill { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; border-radius: 999px; background: #f1f1f1; color: #6e6e6e; font-size: 11px; font-weight: 800; white-space: nowrap; }
.pill.new,.pill.contacted,.pill.open,.pill.active,.pill.sent{background:var(--blue-soft);color:#444444}.pill.qualified,.pill.won,.pill.accepted,.pill.completed,.pill.resolved{background:var(--green-soft);color:#2c7e62}.pill.meeting,.pill.demo{background:var(--violet-soft);color:#7058ad}.pill.proposal,.pill.negotiation,.pill.under-review,.pill.scheduled,.pill.medium,.pill.expiring{background:var(--amber-soft);color:#a56917}.pill.lost,.pill.unqualified,.pill.declined,.pill.expired,.pill.critical,.pill.high,.pill.inactive{background:var(--red-soft);color:#b74d49}.pill.hot{background:#fff0ef;color:#b74d49}.pill.warm{background:var(--amber-soft);color:#a56917}.pill.cold,.pill.low{background:var(--blue-soft);color:#444444}
.table-link { color: var(--blue); font-weight: 700; }.completed-row{opacity:.66}.check-button{display:grid;width:27px;height:27px;padding:0;border:1px solid #e0e0e0;border-radius:8px;background:#fff;color:transparent;place-items:center}.check-button.checked{border-color:#75b69e;background:var(--green);color:#fff}
.toolbar { display: flex; align-items: center; margin-bottom: 15px; gap: 9px; flex-wrap: wrap; }
.control,.form-grid input,.form-grid select,.form-grid textarea,.stack-form input { width: 100%; border: 1px solid #e3e3e3; border-radius: 10px; outline: 0; background: #fbfbfb; color: #444444; font-size: 13px; transition: .18s ease; }
.control { width: auto; min-width: 145px; height: 40px; padding: 0 12px; }.control.grow{min-width:260px;max-width:450px;flex:1}
.control:focus,.form-grid input:focus,.form-grid select:focus,.form-grid textarea:focus,.stack-form input:focus { border-color: #aeaeae; background: #fff; box-shadow: 0 0 0 3px rgba(74,74,74,.09); }
.kanban { display: grid; grid-template-columns: repeat(9,minmax(235px,1fr)); gap: 12px; padding-bottom: 16px; overflow-x: auto; }
.kanban-column { min-height: 540px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #f2f2f2; transition: .18s ease; }
.kanban-column.drag-over { border-color: #77b79f; background: #eaf7f2; }
.kanban-column > header { display: flex; align-items: center; justify-content: space-between; color: #525252; font-size: 14px; font-weight: 800; }.kanban-column>header>span{display:flex;align-items:center;gap:11px}.kanban-column>header>b{display:grid;width:22px;height:22px;border-radius:50%;background:#fff;color:#838383;font-size:14px;place-items:center}
.stage-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #999999; }.stage-dot.new,.stage-dot.contacted{background:var(--blue)}.stage-dot.qualified,.stage-dot.won{background:var(--green)}.stage-dot.meeting,.stage-dot.demo{background:var(--violet)}.stage-dot.proposal,.stage-dot.negotiation{background:var(--amber)}.stage-dot.lost{background:var(--red)}
.kanban-value { margin: 7px 0 12px; color: #949494; font-size: 11px; }
.kanban-cards { display: grid; gap: 9px; }.kanban-empty{padding:28px 8px;border:1px dashed #dbdbdb;border-radius:10px;color:#a2a2a2;font-size:12px;text-align:center}
.deal-note{margin:0 0 10px;padding:8px 9px;border-radius:8px;background:#f7f7f8;color:#6a6a6a;font-size:11px;line-height:1.4;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:default}
.deal-update-btn{width:100%;margin-top:2px}
.deal-card { padding: 13px; border: 1px solid #e4e4e4; border-radius: 11px; background: #fff; box-shadow: 0 4px 13px rgba(42,42,42,.05); cursor: grab; }.deal-card:active{cursor:grabbing}.deal-card.dragging{opacity:.45}.deal-top,.deal-card footer{display:flex;align-items:center;justify-content:space-between}.deal-top>span:last-child{color:#969696;font-size:12px}.deal-card h3{margin:12px 0 0;color:#424242;font-size:11px}.deal-card p{margin:5px 0 12px;color:#939393;font-size:12px}.deal-card footer strong{font-size:12px}
.customer-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 15px; }.customer-card{padding:19px}.customer-empty{grid-column:1/-1}.customer-top{display:flex;align-items:center;gap:11px}.customer-top h2{margin:0;color:#414141;font-size:12px}.customer-top p{margin:5px 0 0;color:#929292;font-size:12px}.push{margin-left:auto}.customer-meta,.detail-grid{display:grid;grid-template-columns:1fr 1fr;margin-top:17px;gap:10px}.customer-meta>div,.detail-grid>div{padding:10px;border-radius:10px;background:#f8f8f8}.customer-meta small,.customer-meta strong,.detail-grid small,.detail-grid strong{display:block}.customer-meta small,.detail-grid small{color:#9c9c9c;font-size:12px}.customer-meta strong,.detail-grid strong{margin-top:5px;color:#575757;font-size:12px}.progress{height:6px;margin-top:16px;overflow:hidden;border-radius:999px;background:#f0f0f0}.progress span{display:block;height:100%;border-radius:inherit;background:var(--green)}.progress-label{margin:6px 0 12px;color:#949494;font-size:12px;text-align:right}.customer-actions{justify-content:flex-end;padding-top:12px;border-top:1px solid var(--line)}
.legend-list{display:grid;gap:9px}.legend-list>div{display:flex;justify-content:space-between;padding:10px;border-radius:9px;background:#f8f8f8;color:#6a6a6a;font-size:12px}.legend-list span{display:flex;align-items:center;gap:7px}.legend-list strong{font-size:12px}.mini-progress{width:130px}
.settings-grid{align-items:start}.profile-large{display:flex;align-items:center;gap:16px}.profile-large h2{margin:0;font-size:17px}.profile-large p{margin:5px 0 10px;color:var(--muted);font-size:10px}
.compact-kpis .kpi{min-height:116px}
.forecast-bars{display:grid;gap:15px}.forecast-bar{display:grid;grid-template-columns:72px minmax(120px,1fr) 160px;align-items:center;gap:12px;color:#7a7a7a;font-size:11px}.forecast-bar>div{position:relative;height:12px;overflow:hidden;border-radius:999px;background:#f0f0f0}.forecast-bar i,.forecast-bar em{position:absolute;inset:0 auto 0 0;border-radius:inherit}.forecast-bar i{background:#ebebeb}.forecast-bar em{background:linear-gradient(90deg,#4a4a4a,#75aa98)}.forecast-bar b{color:#4e4e4e;text-align:right}.forecast-bar small{color:#9b9b9b;font-weight:400}
.risk-score{display:grid;width:34px;height:34px;border-radius:50%;font-size:10px;font-weight:800;place-items:center}.risk-score.high{background:var(--red-soft);color:#b74d49}.risk-score.medium{background:var(--amber-soft);color:#9c681b}.risk-score.low{background:var(--green-soft);color:#2b7b60}
.automation-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:15px;margin-bottom:18px}.automation-card{padding:18px}.automation-top{display:flex;align-items:center;gap:11px}.automation-top>span:nth-child(2){min-width:0;flex:1}.automation-top h2{margin:0;color:#393939;font-size:13px}.automation-top p{margin:5px 0 0;color:#959595;font-size:11px}.automation-icon,.notification-symbol{display:grid;width:38px;height:38px;flex:0 0 38px;border-radius:11px;background:var(--violet-soft);color:var(--violet);place-items:center}.automation-flow{display:grid;grid-template-columns:1fr auto 1fr;align-items:center;margin:17px 0 10px;padding:11px;border-radius:10px;background:#f8f8f8;color:#797979;font-size:10px;gap:8px}.automation-flow strong{color:#4a4a4a;text-align:right}.automation-value{min-height:32px;margin:0;color:#888888;font-size:11px;line-height:1.5}.automation-card footer{display:flex;align-items:center;justify-content:space-between;margin-top:14px;padding-top:12px;border-top:1px solid var(--line);color:#9b9b9b;font-size:10px}
.notification-list{display:grid}.notification-item{display:grid;grid-template-columns:42px minmax(0,1fr) auto;align-items:center;padding:16px 8px;gap:13px;border-bottom:1px solid var(--line)}.notification-item:last-child{border-bottom:0}.notification-item.unread{margin:0 -8px;padding-left:16px;padding-right:16px;border-radius:12px;background:#f9f9f9}.notification-item strong{font-size:12px}.notification-item p{margin:5px 0;color:#707070;font-size:11px;line-height:1.5}.notification-item small{color:#a0a0a0;font-size:10px}.notification-item>div{display:flex;align-items:center;gap:6px}.notification-item form{display:inline-flex}
.empty { padding: 36px 15px; color: #9a9a9a; font-size: 13px; text-align: center; }
.alert { margin-bottom: 16px; padding: 12px 14px; border: 1px solid transparent; border-radius: 11px; font-size: 13px; line-height: 1.5; }.alert.success{border-color:#cbe9de;background:var(--green-soft);color:#267258}.alert.error{border-color:#f2d2d0;background:var(--red-soft);color:#a9433f}.alert.warning{border-color:#f3dfb7;background:var(--amber-soft);color:#926014}.alert a{text-decoration:underline;font-weight:800}
.modal { position: fixed; inset: 0; z-index: 100; display: grid; padding: 20px; background: rgba(20,20,20,.5); backdrop-filter: blur(6px); place-items: center; }.modal-card{width:min(620px,100%);max-height:calc(100vh - 40px);overflow-y:auto;border-radius:20px;background:#fff;box-shadow:0 25px 70px rgba(23,23,23,.25)}.modal-card.wide{width:min(760px,100%)}
.modal-head,.modal-foot{display:flex;align-items:center;justify-content:space-between;padding:19px 22px;gap:14px;border-bottom:1px solid var(--line)}.modal-head h2{margin:0;color:#353535;font-size:16px}.modal-head p{margin:5px 0 0;color:#939393;font-size:12px}.modal-close{display:grid;width:35px;height:35px;padding:0;border:0;border-radius:10px;background:#f4f4f4;color:#707070;font-size:20px;place-items:center}.modal-foot{justify-content:flex-end;border-top:1px solid var(--line);border-bottom:0}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; padding: 21px 22px; gap: 15px; }.form-grid label,.stack-form label{display:grid;gap:7px;color:#727272;font-size:12px;font-weight:800;letter-spacing:.2px}.form-grid label.full{grid-column:1/-1}.form-grid input,.form-grid select{height:41px;padding:0 11px}.form-grid textarea{min-height:72px;padding:10px 11px;resize:vertical}
.import-hint{padding:13px 15px;border:1px dashed var(--line);border-radius:12px;background:var(--surface-2)}.import-hint p{margin:0 0 7px;color:var(--muted);font-size:12px;line-height:1.6}.import-hint p:last-child{margin-bottom:0}.import-hint a{color:var(--blue);font-weight:700;text-decoration:underline}
.stack-form{display:grid;gap:14px}.stack-form input{height:42px;padding:0 11px}.stack-form .btn{justify-self:start}
.permission-summary{display:inline-flex;padding:6px 9px;border-radius:8px;background:#f4f4f4;color:#606060;font-size:11px;font-weight:700;white-space:nowrap}
.permission-section{grid-column:1/-1;overflow:hidden;border:1px solid var(--line);border-radius:14px;background:#fcfcfc}
.permission-heading{display:grid;grid-template-columns:minmax(0,1fr) 176px;align-items:center;padding:14px 16px;border-bottom:1px solid var(--line);background:#f8f8f8;gap:12px}
.permission-heading strong,.permission-heading small,.permission-row strong,.permission-row small{display:block}.permission-heading strong{color:#393939;font-size:13px}.permission-heading small{margin-top:4px;color:#939393;font-size:11px;font-weight:500}.permission-legend{display:grid;grid-template-columns:1fr 1fr;color:#828282;font-size:10px;text-align:center;text-transform:uppercase}
.permission-matrix{display:grid}.permission-row{display:grid;grid-template-columns:minmax(0,1fr) 88px 88px;align-items:center;min-height:58px;padding:8px 16px;border-bottom:1px solid #ececec;gap:0}.permission-row:last-child{border-bottom:0}.permission-row>span:first-child strong{color:#505050;font-size:12px}.permission-row>span:first-child small{margin-top:3px;color:#9b9b9b;font-size:10px;font-weight:400}
.permission-check{display:grid!important;justify-items:center;gap:4px!important;color:#828282!important;font-size:9px!important;font-weight:700!important}.permission-check input{width:18px!important;height:18px!important;margin:0;accent-color:var(--navy)}.permission-check input:disabled{cursor:not-allowed;opacity:.55}.permission-na{color:#b2b2b2;text-align:center}.permission-note{margin:0;padding:11px 16px;border-top:1px solid var(--line);background:#fff;color:#7f7f7f;font-size:11px;line-height:1.5}.deal-card[draggable="false"]{cursor:default}
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 150; min-width: 250px; padding: 13px 16px; border-radius: 11px; background: #2c2c2c; color: #fff; box-shadow: 0 14px 35px rgba(28,28,28,.24); font-size: 13px; }
.install-page { display: grid; min-height: 100vh; padding: 25px; background: linear-gradient(135deg,#edf3f1,#f8f8f8); place-items: center; }.install-card{width:min(520px,100%);padding:32px;border:1px solid var(--line);border-radius:22px;background:#fff;box-shadow:var(--shadow)}.install-card-wide{width:min(760px,100%)}.install-card>.brand-mark{margin-bottom:18px}.install-card h1{margin:0;font-size:27px;letter-spacing:-1px}.install-card>p{margin:9px 0 24px;color:var(--muted);font-size:11px;line-height:1.6}.install-card>small{display:block;margin-top:18px;color:#969696;font-size:12px;line-height:1.6}.install-card code{padding:2px 5px;border-radius:4px;background:#f1f1f1}.requirement-list{display:grid;grid-template-columns:repeat(3,1fr);gap:7px;margin:0 0 20px}.requirement{display:flex;align-items:center;gap:7px;padding:8px 9px;border:1px solid #dfe7e4;border-radius:9px;background:#f8faf9;color:#616161;font-size:12px;font-weight:700}.requirement b{display:grid;width:17px;height:17px;border-radius:50%;place-items:center}.requirement.passed b{background:#dff3eb;color:#267258}.requirement.failed{border-color:#f2d2d0;background:#fff8f7;color:#a9433f}.requirement.failed b{background:#f9dedc}.install-form fieldset{margin:0;padding:16px;border:1px solid var(--line);border-radius:14px}.install-form legend{padding:0 7px;color:#383838;font-size:10px;font-weight:800}.install-grid{display:grid;grid-template-columns:2fr 1fr;gap:13px}.install-grid label.full{grid-column:1/-1}.install-form .btn[disabled]{cursor:not-allowed;opacity:.55}
.login-page { overflow: hidden; background: #fefefe; }.login-stage{position:fixed;inset:0;display:grid;grid-template-columns:minmax(0,57.1%) minmax(520px,42.9%);overflow:hidden}.login-media{position:relative;overflow:hidden;background:#d7d4cf}.login-media video{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:100% 50%}.login-scrim{position:absolute;inset:0;background:linear-gradient(180deg,transparent 52%,rgba(255,255,255,.12) 100%)}.login-promise{position:absolute;left:4%;bottom:5%;z-index:2}.promise-badge{display:inline-flex;align-items:center;height:37px;padding:0 16px;gap:9px;border-radius:999px;background:#2f2a27;color:#fff;box-shadow:0 6px 18px rgba(0,0,0,.16);font-size:12px}.promise-badge b{font-size:17px}.login-promise h1{margin:27px 0 0;color:#000;font-size:clamp(43px,4.7vw,69px);font-weight:650;letter-spacing:-2.2px;line-height:1.04}.login-pane{position:relative;padding:14px 14px 13px 1px}.login-card{display:flex;flex-direction:column;justify-content:center;width:100%;height:100%;padding:54px clamp(38px,7vw,62px);border:1px solid rgba(0,0,0,.04);border-radius:26px;background:rgba(254,254,254,.93);box-shadow:1px 10px 14px rgba(14,14,14,.14),0 1px 3px rgba(14,14,14,.05);backdrop-filter:blur(28px)}.login-brand{display:flex;align-items:center;gap:11px;margin-bottom:42px}.login-brand strong,.login-brand small{display:block}.login-brand strong{font-size:16px}.login-brand small{margin-top:4px;color:#949494;font-size:12px;letter-spacing:.5px;text-transform:uppercase}.login-copy{text-align:center}.login-copy h2{margin:0;color:#323232;font-size:41px;letter-spacing:-2.2px}.login-copy p{margin:12px 0 31px;color:#797979;font-size:17px}.login-copy b{color:#535353}.login-form{display:grid;gap:10px}.login-form label{display:grid;gap:7px;color:#686868;font-size:12px;font-weight:800}.login-form input{height:59px;padding:0 17px;border:0;border-radius:12px;outline:0;background:#f7f8f8;color:#313131;font-size:16px}.login-form label:first-of-type input{border:1.5px solid #acacae;background:#fafafa}.login-form input:focus{box-shadow:0 0 0 3px rgba(63,63,63,.12)}.login-button{display:flex;align-items:center;justify-content:center;height:64px;margin-top:23px;gap:10px;border:0;border-radius:999px;background:linear-gradient(180deg,#2c2c2c,#2f2f2f);color:#fff;box-shadow:0 8px 20px rgba(23,23,23,.16);font-size:15px}.login-button:disabled{opacity:.5;cursor:not-allowed}.login-button span{font-size:20px}.login-divider{display:flex;align-items:center;margin:32px 0 22px;gap:14px}.login-divider i{height:1px;flex:1;background:#c5c7c9}.login-divider b{color:#777;font-size:12px;letter-spacing:.7px}.login-help{margin:0;color:#777;font-size:11px;text-align:center}
@media (max-width:1180px){.kpi-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.customer-grid,.automation-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.login-stage{grid-template-columns:48% 52%}.login-promise h1{font-size:48px}.login-card{padding:44px}}
@media (max-width:900px){.app-shell{grid-template-columns:1fr}.sidebar{transform:translateX(-100%);transition:transform .24s ease}.app-shell.sidebar-open .sidebar{transform:none}.sidebar-overlay{position:fixed;inset:0;z-index:35;display:block;visibility:hidden;border:0;background:rgba(18,18,18,.4);opacity:0;transition:.2s ease}.app-shell.sidebar-open .sidebar-overlay{visibility:visible;opacity:1}.main-shell{grid-column:1}.menu-button{display:inline-grid!important}.dashboard-grid,.report-grid,.settings-grid{grid-template-columns:1fr}.login-page{overflow:auto}.login-stage{position:relative;display:block;min-height:100vh}.login-media{height:38vh;min-height:300px}.login-media video{object-position:64% 48%}.login-scrim{background:linear-gradient(180deg,rgba(9,9,9,.02),rgba(9,9,9,.75))}.login-promise{left:28px;bottom:58px}.login-promise h1{margin-top:17px;color:#fff;font-size:42px;line-height:.96;text-shadow:0 2px 18px rgba(0,0,0,.3)}.login-pane{z-index:3;margin-top:-28px;padding:0}.login-card{min-height:calc(62vh + 28px);border:0;border-radius:28px 28px 0 0;box-shadow:0 -10px 28px rgba(25,25,25,.1)}.login-brand{margin-bottom:28px}}
@media (max-width:650px){.topbar{height:64px;padding:0 13px;gap:9px}.global-search{flex:1;width:auto}.global-search input{height:40px}.topbar-actions .btn span:last-child{display:none}.topbar-actions .btn{width:40px;min-height:40px;padding:0}.topbar-actions .icon-button{display:inline-grid}.content{padding:23px 13px 36px}.app-footer{padding:0 13px 18px}.page-head{align-items:flex-start;flex-direction:column}.page-head>.btn,.page-head>.button-group{align-self:stretch}.page-head>.btn{width:100%}.button-group .btn{flex:1}.kpi-grid,.customer-grid,.automation-grid{grid-template-columns:1fr}.kpi{min-height:120px}.toolbar{align-items:stretch;flex-direction:column}.control,.control.grow{width:100%;max-width:none}.form-grid{grid-template-columns:1fr}.form-grid label.full{grid-column:auto}.modal{padding:0;place-items:end center}.modal-card,.modal-card.wide{width:100%;max-height:92vh;border-radius:22px 22px 0 0}.funnel-row{grid-template-columns:85px minmax(70px,1fr) 80px}.forecast-bar{grid-template-columns:62px minmax(80px,1fr)}.forecast-bar b{grid-column:2;text-align:left}.notification-item{grid-template-columns:36px minmax(0,1fr)}.notification-item>div{grid-column:2}.permission-heading{grid-template-columns:1fr}.permission-legend{display:none}.permission-row{grid-template-columns:minmax(0,1fr) 68px 68px;padding:9px 12px}.permission-check span{display:none}.login-media{height:300px}.login-promise{left:22px;right:22px;bottom:50px}.promise-badge{height:31px;font-size:10px}.login-promise h1{font-size:clamp(30px,9.5vw,38px)}.login-card{padding:35px 24px}.login-copy h2{font-size:34px}.login-copy p{font-size:14px}.login-form input{height:56px}.install-card{padding:24px}.requirement-list,.install-grid{grid-template-columns:1fr}.install-grid label.full{grid-column:auto}}
@media print{.sidebar,.topbar,.app-footer,.page-head .btn{display:none!important}.app-shell,.main-shell{display:block}.content{max-width:none;padding:0}.card{box-shadow:none}.app-body{background:#fff}}
@media (prefers-reduced-motion:reduce){*{scroll-behavior:auto!important;transition:none!important;animation:none!important}}

/* Long-form modal scrolling: the overlay owns vertical scrolling so wheel,
   trackpad, touch and keyboard scrolling work consistently in every browser. */
.modal {
  display: block;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.modal-card,
.modal-card.wide {
  max-height: none;
  margin: 0 auto;
  overflow: visible;
}
.modal-head {
  position: sticky;
  top: 0;
  z-index: 4;
}
.modal-foot {
  position: sticky;
  bottom: 0;
  z-index: 4;
  background: var(--surface, #fff);
}
@media (max-width:650px) {
  .modal { padding: 12px 0 0; }
  .modal-card,
  .modal-card.wide { min-height: calc(100dvh - 12px); }
}
.login-brand {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 32px;
}

.login-brand-logo {
  display: block;
  width: auto;
  max-width: 230px;
  height: 58px;
  object-fit: contain;
}@media (max-width: 600px) {
  .login-brand-logo {
    max-width: 190px;
    height: 50px;
  }
}
.brand-logo {
  width: 180px;
  height: 62px;
  object-fit: contain;
  object-position: left center;
}

/* CoreFlow colourful professional theme */
:root {
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #fbfbfb;
  --ink: #212121;
  --muted: #808080;
  --line: #ececec;
  --navy: #4f4f4f;
  --navy-2: #373737;
  --green: #0eaa79;
  --green-soft: #e7faf3;
  --blue: #494949;
  --blue-soft: #f4f4f4;
  --amber: #e89013;
  --amber-soft: #fff6df;
  --red: #e64d68;
  --red-soft: #fff0f3;
  --violet: #7c3aed;
  --violet-soft: #f2ecff;
  --cyan: #0891b2;
  --cyan-soft: #e8faff;
  --radius: 17px;
  --shadow: 0 12px 34px rgba(71,71,71,.08), 0 2px 7px rgba(39,39,39,.04);
}

html,
.app-body {
  background:
    radial-gradient(circle at 88% 3%, rgba(139,92,246,.10), transparent 25rem),
    radial-gradient(circle at 28% 95%, rgba(6,182,212,.08), transparent 28rem),
    var(--bg);
}

::selection { background: #e2e2e2; color: #393939; }
:focus-visible { outline-color: #565656; }

.sidebar {
  background:
    radial-gradient(circle at 15% 5%, rgba(9, 9, 9, 0.884), transparent 15rem),
    radial-gradient(circle at 100% 70%, rgba(10, 1, 18, 0.896), transparent 18rem),
    linear-gradient(165deg,#090909 0%,#101010 48%,#090909 100%);
  color: #fff;
  box-shadow: 12px 0 38px rgba(46,46,46,.14);
}

.brand-mark {
  background: linear-gradient(145deg,#67e8f9,#a78bfa 52%,#f0abfc);
  color: #2e2e2e;
  box-shadow: 0 8px 22px rgba(34,211,238,.22), inset 0 0 0 1px rgba(255,255,255,.58);
}

.brand small { color: rgba(240,240,240,.68); }
.nav-label { color: rgba(226,226,226,.58); }
.nav-link { color: rgba(246,246,246,.76); }
.nav-link:hover {
  background: rgba(255,255,255,.10);
  color: #fff;
  transform: translateX(2px);
}
.nav-link.active {
  background: linear-gradient(90deg,rgba(103,232,249,.22),rgba(167,139,250,.14));
  color: #fff;
  box-shadow: inset 3px 0 #67e8f9, 0 8px 22px rgba(26,26,26,.12);
}
.nav-link.active .nav-icon { color: #67e8f9; }
.profile-card {
  background: rgba(255,255,255,.09);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(226,226,226,.10);
}
.profile-card:hover { background: rgba(255,255,255,.13); }
.profile-card small { color: rgba(240,240,240,.62); }
.profile-card.active { box-shadow: inset 0 0 0 1px rgba(103,232,249,.38); }
.avatar {
  background: linear-gradient(145deg,#cffafe,#eaeaea);
  color: #3e3e3e;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.65);
}

.topbar {
  border-color: rgba(226,226,226,.58);
  background: rgba(255,255,255,.82);
  box-shadow: 0 5px 24px rgba(79,79,79,.05);
  backdrop-filter: blur(20px) saturate(170%);
}
.global-search input,
.control,
.form-grid input,
.form-grid select,
.form-grid textarea,
.stack-form input {
  border-color: #e8e8e8;
  background: #fbfbfb;
}
.global-search input:focus,
.control:focus,
.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus,
.stack-form input:focus {
  border-color: #5d5d5d;
  box-shadow: 0 0 0 4px rgba(86,86,86,.11);
}
.icon-button {
  border-color: #eaeaea;
  background: linear-gradient(145deg,#fff,#fbfbfb);
  color: #565656;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.icon-button:hover {
  border-color: #e2e2e2;
  box-shadow: 0 7px 18px rgba(79,79,79,.12);
  transform: translateY(-1px);
}

.page-head h1 {
  background: linear-gradient(100deg,#212121,#474747 72%,#7c3aed);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.btn.primary,
.login-button {
  background: linear-gradient(135deg,#4f4f4f,#7c3aed 58%,#0891b2);
  box-shadow: 0 9px 22px rgba(79,79,79,.23);
}
.btn.primary:hover,
.login-button:hover { box-shadow: 0 12px 28px rgba(79,79,79,.30); }
.btn.secondary {
  border-color: #e8e8e8;
  background: rgba(255,255,255,.88);
  color: #4f4f4f;
}
.btn.ghost:hover { background: #f6f6f6; color: #4f4f4f; }

.card {
  border-color: rgba(233,233,233,.92);
  box-shadow: var(--shadow);
}
.card:hover { border-color: rgba(226,226,226,.92); }
.kpi {
  isolation: isolate;
  border-top: 3px solid var(--kpi-accent,#565656);
  background: linear-gradient(145deg,#fff 48%,var(--soft,#f6f6f6));
}
.kpi::before {
  position: absolute;
  top: 16px;
  right: 17px;
  z-index: -1;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--kpi-accent,#565656);
  box-shadow: 0 0 0 7px var(--soft,#f6f6f6);
  content: "";
}
.kpi::after { opacity: .68; }
.kpi.blue { --kpi-accent:#494949; }
.kpi.violet { --kpi-accent:#7c3aed; }
.kpi.amber { --kpi-accent:#e89013; }
.kpi.green { --kpi-accent:#0eaa79; }
.kpi.red { --kpi-accent:#e64d68; }
.kpi b { color: #2d2d2d; }
.kpi-link:hover { box-shadow: 0 17px 38px rgba(79,79,79,.14); }

.panel-head a,
.table-link { color: #4f4f4f; }
.funnel-row i,
.mini-progress i,
.progress span,
.forecast-bar em {
  background: linear-gradient(90deg,#4f4f4f,#8b5cf6 52%,#06b6d4);
}
.activity-symbol,
.automation-icon,
.notification-symbol {
  background: linear-gradient(145deg,#f0f0f0,#ede9fe);
  color: #4d4d4d;
}
.activity-item:nth-child(3n+2) .activity-symbol { background: var(--cyan-soft); color: var(--cyan); }
.activity-item:nth-child(3n+3) .activity-symbol { background: var(--green-soft); color: var(--green); }

th {
  background: linear-gradient(180deg,#fdfdfd,#fafafa);
  color: #757575;
}
tbody tr:hover { background: #fbfbfb; }
.company > span,
.company-logo {
  background: linear-gradient(145deg,#f0f0f0,#cffafe);
  color: #474747;
}
.check-button.checked { border-color: #0eaa79; background: linear-gradient(145deg,#10b981,#059669); }

.pill.new,.pill.contacted,.pill.open,.pill.active,.pill.sent { background:#f3f3f3; color:#424242; }
.pill.qualified,.pill.won,.pill.accepted,.pill.completed,.pill.resolved { background:#e4f9f1; color:#087b58; }
.pill.meeting,.pill.demo { background:#f0eaff; color:#6d35c4; }
.pill.proposal,.pill.negotiation,.pill.under-review,.pill.scheduled,.pill.medium,.pill.expiring { background:#fff3d6; color:#9d6207; }
.pill.lost,.pill.unqualified,.pill.declined,.pill.expired,.pill.critical,.pill.high,.pill.inactive,.pill.hot { background:#ffe9ee; color:#c23854; }
.pill.cold,.pill.low { background:#f3f3f3; color:#087b98; }

.kanban-column { border-color: #e9e9e9; background: linear-gradient(180deg,#fbfbfb,#f7f7f7); }
.kanban-column:nth-child(3n+2) { background: linear-gradient(180deg,#fafafa,#f6f6f6); }
.kanban-column:nth-child(3n+3) { background: linear-gradient(180deg,#faf7ff,#f6f2fc); }
.kanban-column.drag-over { border-color: #565656; background: #f6f6f6; }
.deal-card { border-color: #eaeaea; box-shadow: 0 6px 16px rgba(79,79,79,.06); }
.deal-card:hover { border-color: #e2e2e2; box-shadow: 0 10px 24px rgba(79,79,79,.11); }

.customer-meta > div,
.detail-grid > div,
.legend-list > div,
.automation-flow { background: #fbfbfb; }
.notification-item.unread { background: linear-gradient(90deg,#f6f6f6,#f9f9f9); }
.permission-section { border-color: #e8e8e8; background: #fdfdfd; }
.permission-heading { background: linear-gradient(90deg,#f6f6f6,#f9f9f9); }
.permission-check input { accent-color: #525252; }
.permission-summary { background:#f6f6f6; color:#4f4f4f; }

.modal { background: rgba(46,46,46,.48); }
.modal-card { box-shadow: 0 30px 85px rgba(46,46,46,.28); }
.modal-head { background: linear-gradient(90deg,#fdfdfd,#fafafa); }
.modal-close { background:#f6f6f6; color:#4f4f4f; }
.toast { background: linear-gradient(135deg,#373737,#4f4f4f); box-shadow: 0 15px 38px rgba(55,55,55,.32); }

.install-page {
  background:
    radial-gradient(circle at 12% 20%,rgba(34,211,238,.18),transparent 25rem),
    radial-gradient(circle at 88% 80%,rgba(168,85,247,.16),transparent 28rem),
    #fafafa;
}
.login-page { background:#f6f6f6; }
.login-stage { background: linear-gradient(135deg,#ecfeff,#f6f6f6 48%,#f9f9f9); }
.login-scrim { background: linear-gradient(180deg,rgba(55,55,55,.04) 35%,rgba(46,46,46,.36) 100%); }
.promise-badge { background: linear-gradient(135deg,#373737,#6d28d9); }
.login-card {
  border-color: rgba(226,226,226,.48);
  background: rgba(255,255,255,.91);
  box-shadow: 1px 12px 34px rgba(55,55,55,.17),0 1px 3px rgba(40,40,40,.05);
}
.login-copy h2 {
  background: linear-gradient(100deg,#282828,#4f4f4f,#7c3aed);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.login-form input { background:#fbfbfb; }
.login-form label:first-of-type input { border-color:#656565; background:#fdfdfd; }
.login-form input:focus { box-shadow:0 0 0 4px rgba(86,86,86,.12); }

@media (max-width:900px) {
  .login-scrim { background:linear-gradient(180deg,rgba(46,46,46,.04),rgba(46,46,46,.76)); }
}

@media print {
  .page-head h1 {
    background:none;
    color:#2d2d2d;
    -webkit-text-fill-color:#2d2d2d;
  }
}

/* =========================================================
   Indigo Glass — premium indigo & white theme
   Matches the brand login page: indigo (#4f4f4f) on white,
   with soft glassmorphism (frosted, translucent surfaces)
   ========================================================= */

:root {
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #fbfbfb;
  --ink: #2e2e2e;
  --muted: #848484;
  --line: #ededed;

  --navy: #4f4f4f;
  --navy-2: #3e3e3e;

  --green: #0eaa79;
  --green-soft: #e7faf3;
  --blue: #494949;
  --blue-soft: #f6f6f6;
  --amber: #d38a22;
  --amber-soft: #fff6df;
  --red: #e11d48;
  --red-soft: #fff0f3;
  --violet: #7c3aed;
  --violet-soft: #f2ecff;

  --indigo: #4f4f4f;
  --indigo-dark: #3e3e3e;
  --indigo-soft: #5d5d5d;
  --indigo-pale: #f6f6f6;

  --radius: 18px;
  --shadow: 0 14px 38px rgba(71,71,71,.10), 0 2px 6px rgba(46,46,46,.05);
}

/* Base surfaces */
html,
body,
.app-body {
  background:
    radial-gradient(circle at 92% 0%, rgba(93,93,93,.10), transparent 26rem),
    radial-gradient(circle at 6% 96%, rgba(79,79,79,.07), transparent 28rem),
    var(--bg);
}

::selection { background: #e2e2e2; color: #2e2e2e; }
:focus-visible { outline-color: var(--indigo); }

/* ---------------------------------------------------------
   Sidebar / branding
   --------------------------------------------------------- */

.sidebar {
  background: linear-gradient(180deg, #f5f5f7 0%, #eeeeef 100%);
  color: #4f6079;
  box-shadow: 4px 0 24px rgba(38,38,38,.05);
}

.brand { min-height: 57px; padding: 0 28px 3px; gap: 12px; }

.brand-logo,
.login-brand-logo {
  display: block;
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: left center;
}

.brand-logo {
  width: 185px;
  max-width: 100%;
  height: 52px;
  padding: 1px 12px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 4px -1px rgba(46,46,46,.16);
}

.brand-mark {
  background: linear-gradient(145deg, #f6f6f6, #e2e2e2);
  color: #3e3e3e;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.6);
}

.brand small { color: rgba(79,96,121,.6); }
.nav-label { color: rgba(79,96,121,.45); }
.nav-link { color: #55647c; }

.nav-link:hover {
  background: rgba(79,96,121,.08);
  color: #33405a;
  transform: translateX(1px);
}

.nav-link.active {
  background: #55647c;
  color: #f4f4f6;
  box-shadow: inset 3px 0 #2c2c2c;
}

.nav-link.active .nav-icon { color: #f4f4f6; }

.profile-card {
  background: rgba(79,96,121,.06);
  color: #4f6079;
  box-shadow: inset 0 0 0 1px rgba(79,96,121,.08);
}

.profile-card.active { box-shadow: inset 0 0 0 1px rgba(79,96,121,.3); }
.profile-card small { color: rgba(79,96,121,.55); }

.avatar {
  background: linear-gradient(145deg,#f0f0f0,#e2e2e2);
  color: #3e3e3e;
}

/* ---------------------------------------------------------
   Topbar / controls — glass
   --------------------------------------------------------- */

.topbar {
  border-color: rgba(237,237,237,.9);
  background: rgba(255,255,255,.72);
  box-shadow: 0 6px 26px rgba(79,79,79,.06);
  backdrop-filter: blur(20px) saturate(170%);
  -webkit-backdrop-filter: blur(20px) saturate(170%);
}

.global-search input,
.control,
.form-grid input,
.form-grid select,
.form-grid textarea,
.stack-form input {
  border-color: #ededed;
  background: rgba(251,251,251,.9);
}

.global-search input:focus,
.control:focus,
.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus,
.stack-form input:focus {
  border-color: var(--indigo-soft);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(79,79,79,.12);
}

.icon-button {
  border-color: #ededed;
  background: rgba(255,255,255,.85);
  color: var(--indigo);
}

.icon-button:hover {
  border-color: #e2e2e2;
  color: var(--indigo-dark);
  box-shadow: 0 7px 18px rgba(79,79,79,.14);
}

/* ---------------------------------------------------------
   Typography / buttons
   --------------------------------------------------------- */

.page-head h1 {
  background: linear-gradient(100deg,#2e2e2e,#4f4f4f 70%,#5d5d5d);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.page-head p,
.page-date { color: var(--muted); }

.btn.primary,
.login-button {
  background: linear-gradient(135deg, var(--indigo), var(--indigo-dark));
  color: #fff;
  box-shadow: 0 10px 24px rgba(79,79,79,.28);
}

.btn.primary:hover,
.login-button:hover { box-shadow: 0 13px 30px rgba(79,79,79,.34); }

.btn.secondary {
  border-color: #ededed;
  background: rgba(255,255,255,.9);
  color: var(--indigo);
}

.btn.ghost:hover { background: var(--indigo-pale); color: var(--indigo-dark); }

.btn.danger { background: var(--red-soft); color: #be123c; }

/* ---------------------------------------------------------
   Cards / KPIs — glassmorphism
   --------------------------------------------------------- */

.card {
  border: 1px solid rgba(237,237,237,.85);
  background: rgba(255,255,255,.78);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  box-shadow: var(--shadow);
}

.card:hover { border-color: rgba(226,226,226,.9); }

.kpi {
  border-top: 3px solid var(--kpi-accent, var(--indigo));
  background: linear-gradient(145deg, rgba(255,255,255,.88) 50%, var(--soft, var(--indigo-pale)));
}

.kpi::before {
  position: absolute;
  top: 16px;
  right: 17px;
  z-index: 1;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--kpi-accent, var(--indigo));
  box-shadow: 0 0 0 7px var(--soft, var(--indigo-pale));
  content: "";
}

.kpi::after { opacity: .5; }

.kpi.blue   { --kpi-accent: #494949; --soft: #f4f4f4; }
.kpi.violet { --kpi-accent: #7c3aed; --soft: #f2ecff; }
.kpi.amber  { --kpi-accent: #d38a22; --soft: #fff6df; }
.kpi.green  { --kpi-accent: #0eaa79; --soft: #e7faf3; }
.kpi.red    { --kpi-accent: #e11d48; --soft: #fff0f3; }

.kpi b { color: #383838; }

.kpi-link:hover { box-shadow: 0 17px 38px rgba(79,79,79,.16); }

/* ---------------------------------------------------------
   Data visualization / accents
   --------------------------------------------------------- */

.panel-head a,
.table-link { color: var(--indigo); }

.funnel-row i,
.mini-progress i,
.progress span,
.forecast-bar em {
  background: linear-gradient(90deg, var(--indigo), var(--indigo-soft));
}

.activity-symbol,
.automation-icon,
.notification-symbol {
  background: var(--indigo-pale);
  color: var(--indigo);
}

.activity-item:nth-child(3n+2) .activity-symbol { background: var(--blue-soft); color: var(--blue); }
.activity-item:nth-child(3n+3) .activity-symbol { background: var(--violet-soft); color: var(--violet); }

/* ---------------------------------------------------------
   Tables
   --------------------------------------------------------- */

th { background: rgba(246,246,246,.6); color: #727272; }
tbody tr:hover { background: rgba(246,246,246,.5); }

.company > span,
.company-logo { background: var(--indigo-pale); color: var(--indigo-dark); }

.check-button.checked { border-color: var(--indigo); background: linear-gradient(145deg,var(--indigo),var(--indigo-dark)); }

/* ---------------------------------------------------------
   Status pills
   --------------------------------------------------------- */

.pill.new,.pill.contacted,.pill.open,.pill.active,.pill.sent { background:#f3f3f3; color:#474747; }
.pill.qualified,.pill.won,.pill.accepted,.pill.completed,.pill.resolved { background:#e4f9f1; color:#087b58; }
.pill.meeting,.pill.demo { background:#f0eaff; color:#6d35c4; }
.pill.proposal,.pill.negotiation,.pill.under-review,.pill.scheduled,.pill.medium,.pill.expiring { background:#fff3d6; color:#9d6207; }
.pill.lost,.pill.unqualified,.pill.declined,.pill.expired,.pill.critical,.pill.high,.pill.inactive,.pill.hot { background:#ffe4ea; color:#be123c; }
.pill.warm { background:#fff3d6; color:#9d6207; }
.pill.cold,.pill.low { background:#f3f3f3; color:#474747; }

/* ---------------------------------------------------------
   Kanban
   --------------------------------------------------------- */

.kanban-column { border-color: #ededed; background: linear-gradient(180deg,#fbfbfb,#f8f8f8); }
.kanban-column:nth-child(3n+2) { background: linear-gradient(180deg,#fafafa,#f0ecff); }
.kanban-column:nth-child(3n+3) { background: linear-gradient(180deg,#fafafa,#f6f6f6); }
.kanban-column.drag-over { border-color: var(--indigo); background: var(--indigo-pale); }

.deal-card {
  border-color: #ededed;
  background: rgba(255,255,255,.9);
  box-shadow: 0 6px 16px rgba(79,79,79,.07);
}

.deal-card:hover { border-color: #e2e2e2; box-shadow: 0 10px 24px rgba(79,79,79,.14); }

.stage-dot.new,.stage-dot.contacted { background: var(--blue); }
.stage-dot.qualified,.stage-dot.won { background: var(--green); }
.stage-dot.meeting,.stage-dot.demo { background: var(--violet); }
.stage-dot.proposal,.stage-dot.negotiation { background: var(--indigo); }
.stage-dot.lost { background: var(--red); }

/* ---------------------------------------------------------
   Secondary panels
   --------------------------------------------------------- */

.customer-meta > div,
.detail-grid > div,
.legend-list > div,
.automation-flow { background: rgba(246,246,246,.55); }

.notification-item.unread { background: linear-gradient(90deg,#f6f6f6,#f9f9f9); }

.permission-section { border-color: #ededed; background: rgba(255,255,255,.7); }
.permission-heading { background: linear-gradient(90deg,#f6f6f6,#f9f9f9); }
.permission-check input { accent-color: var(--indigo); }
.permission-summary { background:#f6f6f6; color: var(--indigo); }

/* ---------------------------------------------------------
   Modal / toast
   --------------------------------------------------------- */

.modal { background: rgba(46,46,46,.5); backdrop-filter: blur(4px); }

.modal-card {
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  box-shadow: 0 30px 80px rgba(46,46,46,.28);
}

.modal-head { background: linear-gradient(90deg,#fdfdfd,#fafafa); }
.modal-close { background:#f6f6f6; color: var(--indigo); }
.toast { background: linear-gradient(135deg,#3e3e3e,#4f4f4f); box-shadow: 0 15px 38px rgba(55,55,55,.32); }

/* ---------------------------------------------------------
   Login / install — indigo glass, matches the login page
   --------------------------------------------------------- */

.install-page {
  background:
    radial-gradient(circle at 12% 20%, rgba(79,79,79,.13), transparent 25rem),
    radial-gradient(circle at 88% 80%, rgba(93,93,93,.16), transparent 28rem),
    #fafafa;
}

.login-page { background: #ffffff; }

.login-stage {
  background:
    radial-gradient(circle at 0% 0%, rgba(79,79,79,.10), transparent 32%),
    linear-gradient(145deg, #fafafa 0%, #ffffff 55%, #f6f6f6 100%);
}

.login-scrim {
  background: linear-gradient(180deg, rgba(46,46,46,.15), rgba(46,46,46,.94) 100%);
}

.promise-badge {
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.3);
}

.login-card {
  border: 1px solid rgba(255,255,255,.7);
  background: rgba(255,255,255,.62);
  box-shadow: 0 24px 60px -20px rgba(71,71,71,.24), inset 0 1px 0 rgba(255,255,255,.9);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
}

.login-copy h2 {
  background: linear-gradient(100deg,#2e2e2e,#4f4f4f,#5d5d5d);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.login-form input { background: rgba(255,255,255,.7); }
.login-form label:first-of-type input { border-color:#e2e2e2; background: rgba(255,255,255,.8); }
.login-form input:focus { box-shadow:0 0 0 4px rgba(79,79,79,.12); }

/* Keep logo clearly visible on the light login surface. */
.login-brand {
  min-height: 62px;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 32px;
}

.login-brand-logo {
  width: 220px;
  max-width: min(220px, 72vw);
  height: 58px;
  padding: 5px 10px;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(71,71,71,.14);
}

/* Responsive */
@media (max-width: 900px) {
  .login-scrim { background: linear-gradient(180deg, rgba(46,46,46,.05), rgba(46,46,46,.82)); }
}

@media (max-width: 650px) {
  .brand-logo { width: 160px; height: 48px; }
  .login-brand-logo { width: 190px; max-width: 78vw; height: 50px; }
}

@media print {
  .page-head h1 {
    background: none;
    color: #2d2d2d;
    -webkit-text-fill-color: #2d2d2d;
  }
}
/* Dynamics 365-style sales business process flow */
.bpf-bar{display:flex;align-items:center;gap:10px;margin:0 0 18px;padding:12px 14px;border:1px solid var(--border,#e5e7eb);border-radius:14px;background:var(--surface,#fff);overflow:auto}
.bpf-step{min-width:150px;display:grid;grid-template-columns:30px 1fr;column-gap:9px;align-items:center}
.bpf-step span{grid-row:1 / span 2;width:30px;height:30px;border-radius:50%;display:grid;place-items:center;background:#eef2f7;font-weight:700}
.bpf-step strong{font-size:13px}.bpf-step small{font-size:11px;opacity:.65}.bpf-arrow{opacity:.4;font-style:normal;font-size:20px}
.form-help{font-size:12px;opacity:.72;margin:0}

/* Final pipeline UI refresh: all stages visible without horizontal scrolling */
.pipeline-page{}
.bpf-bar{display:grid;grid-template-columns:repeat(9,minmax(0,1fr));gap:6px;align-items:stretch;margin:0 0 18px;padding:8px;border:1px solid var(--border,#e5e7eb);border-radius:16px;background:var(--surface,#fff);overflow:visible}
.bpf-step{min-width:0;display:grid;grid-template-columns:28px 1fr;grid-template-rows:auto auto;column-gap:7px;align-items:center;padding:9px 8px;border-radius:11px;background:var(--surface-muted,#f7f8fa)}
.bpf-step>span{grid-row:1/3;width:28px;height:28px;border-radius:50%;display:grid;place-items:center;background:#fff;border:1px solid var(--border,#e5e7eb);font-size:11px;font-weight:800}
.bpf-step strong{font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.bpf-step small{font-size:9px;color:var(--muted,#8b8f98);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.bpf-arrow{display:none}
.kanban{display:grid;grid-template-columns:repeat(9,minmax(0,1fr));gap:8px;padding:0 0 8px;overflow:visible}
.kanban-column{min-width:0;min-height:520px;padding:9px;border-radius:15px;background:#f7f8fa;border:1px solid #e6e8ec;box-shadow:0 2px 8px rgba(20,25,30,.04)}
.kanban-column>header{font-size:11px}.kanban-column>header>span{gap:6px;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.kanban-column>header>b{width:20px;height:20px;flex:none;font-size:11px}.kanban-value{margin:5px 0 9px;font-size:10px;font-weight:700}
.kanban-cards{gap:7px}.deal-card{padding:9px;border-radius:11px;box-shadow:0 2px 8px rgba(20,25,30,.06);cursor:grab}.deal-card:hover{transform:translateY(-1px);box-shadow:0 6px 14px rgba(20,25,30,.10)}.deal-top{gap:4px}.deal-top .pill{font-size:9px;padding:3px 6px}.deal-top>span:last-child{font-size:10px}.deal-card h3{margin:8px 0 3px;font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.deal-card p{margin:3px 0 7px;font-size:10px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.deal-card p small{font-size:9px}.deal-card footer strong{font-size:10px}.deal-note{font-size:9px!important;line-height:1.35;white-space:normal!important;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;min-height:24px}.deal-actions{display:grid;grid-template-columns:1fr 1fr;gap:5px;margin-top:8px}.deal-actions .btn{width:100%;min-width:0;padding:6px 4px;font-size:9px;white-space:nowrap}.deal-actions .pipeline-history-btn:only-child{grid-column:1/-1}
.pipeline-history-modal{max-height:88vh;display:flex;flex-direction:column}.pipeline-history-summary{display:flex;gap:8px;flex-wrap:wrap;padding:0 24px 14px;border-bottom:1px solid var(--border,#e5e7eb)}.pipeline-history-summary span{padding:7px 10px;border-radius:8px;background:var(--surface-muted,#f6f7f9);font-size:12px}.pipeline-history-summary b{margin-right:4px}.pipeline-history{overflow:auto;padding:18px 24px 24px}.pipeline-history-item{display:grid;grid-template-columns:32px 1fr;gap:11px;position:relative;padding-bottom:18px}.pipeline-history-item:not(:last-child):after{content:"";position:absolute;left:15px;top:32px;bottom:0;border-left:2px solid var(--border,#e5e7eb)}.history-icon{width:30px;height:30px;border-radius:50%;display:grid;place-items:center;background:var(--surface-muted,#f6f7f9);font-size:10px;font-weight:800;z-index:1}.history-top{display:flex;justify-content:space-between;gap:14px}.history-top strong{font-size:13px}.history-top time{font-size:11px;color:var(--muted,#6b7280);white-space:nowrap}.history-meta{display:flex;gap:5px;flex-wrap:wrap;margin-top:5px}.history-meta span{font-size:10px;color:var(--muted,#6b7280);padding:2px 6px;border-radius:999px;background:var(--surface-muted,#f6f7f9)}.pipeline-history-item p{margin:7px 0 0;font-size:12px;line-height:1.5}.pipeline-history-loading,.pipeline-history-empty{text-align:center;padding:48px 20px;color:var(--muted,#6b7280)}
@media(max-width:1200px){.bpf-bar,.kanban{grid-template-columns:repeat(3,minmax(0,1fr))}.kanban-column{min-height:360px}.bpf-step{min-height:48px}}
@media(max-width:700px){.bpf-bar,.kanban{grid-template-columns:repeat(2,minmax(0,1fr))}.deal-actions{grid-template-columns:1fr}.pipeline-history-summary{padding-left:14px;padding-right:14px}.pipeline-history{padding:14px}.history-top{display:block}.history-top time{display:block;margin-top:3px}}

/* Larger pipeline cards - prevent text/button overlap */
.kanban{
  grid-template-columns:repeat(9,minmax(270px,1fr));
  gap:16px;
  align-items:start;
}
.kanban-column{
  min-width:270px;
  padding:14px;
}
.kanban-cards{
  gap:14px;
}
.deal-card{
  width:100%;
  min-width:0;
  min-height:190px;
  box-sizing:border-box;
  padding:16px;
  overflow:hidden;
}
.deal-card h3{
  margin:9px 0 6px;
  line-height:1.3;
  overflow-wrap:anywhere;
  word-break:break-word;
}
.deal-card p{
  overflow-wrap:anywhere;
  word-break:break-word;
}
.deal-card footer{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-top:12px;
}
.deal-actions{
  display:flex;
  flex-direction:column;
  gap:8px;
  margin-top:12px;
}
.deal-actions .btn{
  width:100%;
  min-height:36px;
  white-space:nowrap;
  box-sizing:border-box;
}
.deal-note{
  overflow:hidden;
  line-height:1.4;
}
@media (max-width:1200px){
  .kanban{grid-template-columns:repeat(3,minmax(280px,1fr));overflow-x:visible}
  .kanban-column{min-width:0}
}
@media (max-width:760px){
  .kanban{grid-template-columns:1fr;gap:14px}
  .deal-card{min-height:0}
}
/* Final pipeline layout: all stages fit on screen without horizontal scrolling */
.bpf-bar{
  display:grid !important;
  grid-template-columns:repeat(3,minmax(0,1fr)) !important;
  gap:10px !important;
  overflow:visible !important;
}
.bpf-step{min-width:0 !important;width:100%;box-sizing:border-box}
.kanban{
  display:grid !important;
  grid-template-columns:repeat(3,minmax(0,1fr)) !important;
  gap:16px !important;
  width:100%;
  overflow:visible !important;
  align-items:start;
}
.kanban-column{
  min-width:0 !important;
  width:100%;
  box-sizing:border-box;
  min-height:420px;
}
.deal-card{
  width:100%;
  min-width:0;
  min-height:200px;
  box-sizing:border-box;
}
@media(max-width:1000px){
  .bpf-bar,.kanban{grid-template-columns:repeat(2,minmax(0,1fr)) !important}
}
@media(max-width:650px){
  .bpf-bar,.kanban{grid-template-columns:1fr !important}
}

/* Customer Master in Support & AMC */
.customer-master-panel{margin-bottom:20px}
.customer-master-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;padding:0 20px 20px}
.customer-master-card{border:1px solid var(--border,#e5e7eb);border-radius:12px;padding:16px;background:var(--surface,#fff);min-width:0}
.customer-master-top{display:flex;align-items:center;gap:10px}
.customer-master-name{min-width:0;flex:1}
.customer-master-name strong{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.customer-master-name small{display:block;color:var(--muted,#6b7280);margin-top:3px}
.customer-master-contact{display:flex;flex-direction:column;gap:3px;margin:14px 0;font-size:13px}
.customer-master-contact span{color:var(--muted,#6b7280);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.customer-master-stats{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.customer-master-stats div{background:var(--surface-muted,#f6f7f9);padding:9px;border-radius:8px}
.customer-master-stats small{display:block;color:var(--muted,#6b7280);font-size:10px}
.customer-master-stats b{display:block;margin-top:3px;font-size:15px}
.customer-master-bottom{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:13px;font-size:11px;color:var(--muted,#6b7280)}
.customer-master-bottom .row-actions{display:flex;gap:5px;align-items:center}
.customer-master-empty{grid-column:1/-1;text-align:center;padding:30px;color:var(--muted,#6b7280)}
@media(max-width:1100px){.customer-master-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:700px){.customer-master-grid{grid-template-columns:1fr}.customer-master-bottom{align-items:flex-start;flex-direction:column}}
.ticket-effort-summary{display:flex;gap:10px;flex-wrap:wrap;padding:0 24px 16px;border-bottom:1px solid var(--border,#e5e7eb)}
.ticket-effort-summary span{padding:8px 12px;border-radius:8px;background:var(--surface-muted,#f6f7f9);font-size:13px}


/* Profile page uses the exact same canonical dashboard sidebar.
   Keep sidebar styling shared so profile.php and dashboard.php render identically. */
.profile-page .sidebar,
body.profile-page .sidebar {
  /* Intentionally inherits the dashboard/sidebar rules above. */
}

/* =========================================================
   V24: Functional sidebar + dark application theme
   ========================================================= */
.nav-list { gap: 12px; }
.nav-group { display: grid; gap: 3px; }
.nav-group-label {
  margin: 5px 12px 5px;
  color: rgba(79,96,121,.52);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 1.1px;
  text-transform: uppercase;
}
.nav-admin-group { margin-top: 6px; padding-top: 10px; border-top: 1px solid rgba(79,96,121,.12); }

html[data-theme="dark"] {
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #464646;
  --ink: #ffffff;
  --muted: #d2d2d2;
  --line: #5a5a5a;
  --navy: #b8b8b8;
  --navy-2: #8f8f8f;
  --green: #bdbdbd;
  --green-soft: #4b4b4b;
  --blue: #c2c2c2;
  --blue-soft: #4b4b4b;
  --amber: #d0d0d0;
  --amber-soft: #4b4b4b;
  --red-soft: #4b3838;
  --violet-soft: #4b4b4b;
  --shadow: 0 12px 34px rgba(0,0,0,.38);
  color: #fff;
  background: #252525;
}
html[data-theme="dark"] body,
html[data-theme="dark"] .app-body,
html[data-theme="dark"] .main-shell,
html[data-theme="dark"] .content,
html[data-theme="dark"] .app-footer {
  background: #252525 !important;
  color: #fff;
}
html[data-theme="dark"] .sidebar {
  background: #202020 !important;
  color: #fff;
  border-right-color: #4a4a4a;
}
html[data-theme="dark"] .brand { background: #363636; box-shadow: none; }
html[data-theme="dark"] .brand-logo { background: #fff; }
html[data-theme="dark"] .nav-group-label,
html[data-theme="dark"] .nav-label { color: #b8b8b8; }
html[data-theme="dark"] .nav-link { color: #f2f2f2; }
html[data-theme="dark"] .nav-link:hover { background: #383838; color: #fff; }
html[data-theme="dark"] .nav-link.active {
  background: #4a4a4a;
  color: #fff;
  box-shadow: inset 3px 0 #c9c9c9, 0 8px 20px rgba(0,0,0,.20);
}
html[data-theme="dark"] .nav-link.active .nav-icon { color: #fff; }
html[data-theme="dark"] .nav-admin-group { border-top-color: #4a4a4a; }
html[data-theme="dark"] .topbar {
  background: rgba(37,37,37,.96) !important;
  border-bottom-color: #4a4a4a;
  color: #fff;
}
html[data-theme="dark"] .topbar h1,
html[data-theme="dark"] .page-head h1,
html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] strong,
html[data-theme="dark"] b,
html[data-theme="dark"] label,
html[data-theme="dark"] th,
html[data-theme="dark"] td,
html[data-theme="dark"] p,
html[data-theme="dark"] span,
html[data-theme="dark"] small,
html[data-theme="dark"] .muted,
html[data-theme="dark"] .page-head p {
  color: #fff;
}
html[data-theme="dark"] .card,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .table-panel,
html[data-theme="dark"] .kpi,
html[data-theme="dark"] .modal-card,
html[data-theme="dark"] .dashboard-edit-menu,
html[data-theme="dark"] .theme-menu,
html[data-theme="dark"] .dropdown-menu {
  background: #454545 !important;
  color: #fff !important;
  border-color: #616161 !important;
  box-shadow: 0 14px 34px rgba(0,0,0,.38);
}
html[data-theme="dark"] .card *,
html[data-theme="dark"] .panel *,
html[data-theme="dark"] .kpi *,
html[data-theme="dark"] .modal-card * {
  color: #c76161;
}
html[data-theme="dark"] .kpi::after { background: rgba(255,255,255,.08); }
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .control,
html[data-theme="dark"] .global-search input {
  background: #303030 !important;
  color: #fff !important;
  border-color: #626262 !important;
}
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color: #bdbdbd; }
html[data-theme="dark"] option { background: #303030; color: #fff; }
html[data-theme="dark"] .btn.primary,
html[data-theme="dark"] .btn.secondary,
html[data-theme="dark"] .btn.ghost,
html[data-theme="dark"] .btn.danger,
html[data-theme="dark"] .icon-button {
  background: #4a4a4a;
  color: #fff;
  border-color: #707070;
}
html[data-theme="dark"] .btn:hover,
html[data-theme="dark"] .icon-button:hover { background: #5a5a5a; }
html[data-theme="dark"] a { color: #fff; }
html[data-theme="dark"] .table-wrap,
html[data-theme="dark"] table { color: #fff; }
html[data-theme="dark"] tr { border-color: #626262; }
html[data-theme="dark"] .app-footer { color: #fff; }
html[data-theme="dark"] ::selection { background: #707070; color: #fff; }

/* V25 — charcoal + Coreenact orange dark theme.
   All rules are scoped to data-theme="dark" so the approved light theme is unchanged. */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #292929;
  --surface-muted: #262626;
  --ink: #f7f7f7;
  --text: #f7f7f7;
  --muted: #a9a9a9;
  --line: #383838;
  --border: #383838;
  --navy: #f97316;
  --navy-2: #ea580c;
  --blue: #fb923c;
  --blue-soft: #3a281d;
  --green: #22c55e;
  --green-soft: #173522;
  --amber: #f59e0b;
  --amber-soft: #3d2d13;
  --red: #ef4444;
  --red-soft: #3b2020;
  --violet-soft: #33243e;
  --shadow: 0 14px 38px rgba(0,0,0,.42);
  background: #141414;
  color: #f7f7f7;
}
html[data-theme="dark"] body,
html[data-theme="dark"] .app-body,
html[data-theme="dark"] .main-shell,
html[data-theme="dark"] .content,
html[data-theme="dark"] .app-footer { background:#141414!important; color:#f7f7f7; }
html[data-theme="dark"] .sidebar { background:#191919!important; border-right-color:#303030; }
html[data-theme="dark"] .brand { background:#202020; border:1px solid #303030; }
html[data-theme="dark"] .brand-logo { background:#fff; border-color:#f97316; }
html[data-theme="dark"] .nav-group-label,
html[data-theme="dark"] .nav-label { color:#858585; }
html[data-theme="dark"] .nav-link { color:#d6d6d6; }
html[data-theme="dark"] .nav-link:hover { background:#292929; color:#fff; }
html[data-theme="dark"] .nav-link:hover .nav-icon { color:#fb923c; }
html[data-theme="dark"] .nav-link.active {
  background:linear-gradient(90deg,rgba(249,115,22,.22),rgba(249,115,22,.07));
  color:#fff;
  box-shadow:inset 3px 0 #f97316;
}
html[data-theme="dark"] .nav-link.active .nav-icon { color:#fb923c; }
html[data-theme="dark"] .nav-admin-group { border-top-color:#303030; }
html[data-theme="dark"] .topbar { background:rgba(20,20,20,.94)!important; border-bottom-color:#303030; }
html[data-theme="dark"] .topbar h1,
html[data-theme="dark"] .page-head h1,
html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] strong,
html[data-theme="dark"] b,
html[data-theme="dark"] label,
html[data-theme="dark"] th,
html[data-theme="dark"] td { color:#f5f5f5; }
html[data-theme="dark"] p,
html[data-theme="dark"] small,
html[data-theme="dark"] .muted,
html[data-theme="dark"] .subtext,
html[data-theme="dark"] .page-head p { color:#a9a9a9; }
html[data-theme="dark"] .page-kicker,
html[data-theme="dark"] .eyebrow,
html[data-theme="dark"] .section-kicker,
html[data-theme="dark"] .modal-eyebrow { color:#fb923c; }
html[data-theme="dark"] .card,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .table-panel,
html[data-theme="dark"] .kpi,
html[data-theme="dark"] .modal-card,
html[data-theme="dark"] .dashboard-edit-menu,
html[data-theme="dark"] .theme-menu,
html[data-theme="dark"] .dropdown-menu,
html[data-theme="dark"] .opportunity-card,
html[data-theme="dark"] .customer-master-card,
html[data-theme="dark"] .deal-card {
  background:#202020!important;
  color:#f7f7f7!important;
  border-color:#383838!important;
  box-shadow:0 14px 34px rgba(0,0,0,.3);
}
html[data-theme="dark"] .card *,
html[data-theme="dark"] .panel *,
html[data-theme="dark"] .kpi *,
html[data-theme="dark"] .modal-card * { color:inherit; }
html[data-theme="dark"] .card p,
html[data-theme="dark"] .card small,
html[data-theme="dark"] .panel p,
html[data-theme="dark"] .panel small,
html[data-theme="dark"] .modal-card p,
html[data-theme="dark"] .modal-card small { color:#a9a9a9; }
html[data-theme="dark"] .kpi::before,
html[data-theme="dark"] .opp-card-accent { background:#f97316; }
html[data-theme="dark"] .kpi::after { background:rgba(249,115,22,.10); }
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .control,
html[data-theme="dark"] .global-search input {
  background:#191919!important;
  color:#f7f7f7!important;
  border-color:#414141!important;
}
html[data-theme="dark"] input:focus,
html[data-theme="dark"] select:focus,
html[data-theme="dark"] textarea:focus,
html[data-theme="dark"] .control:focus,
html[data-theme="dark"] .global-search input:focus {
  border-color:#f97316!important;
  box-shadow:0 0 0 3px rgba(249,115,22,.16)!important;
}
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color:#777; }
html[data-theme="dark"] option { background:#202020; color:#f7f7f7; }
html[data-theme="dark"] .btn.primary,
html[data-theme="dark"] .login-button { background:linear-gradient(135deg,#f97316,#ea580c)!important; color:#fff!important; border-color:#f97316!important; }
html[data-theme="dark"] .btn.secondary,
html[data-theme="dark"] .btn.ghost,
html[data-theme="dark"] .icon-button { background:#292929; color:#e5e5e5; border-color:#414141; }
html[data-theme="dark"] .btn.secondary:hover,
html[data-theme="dark"] .btn.ghost:hover,
html[data-theme="dark"] .icon-button:hover { background:#343434; border-color:#f97316; color:#fb923c; }
html[data-theme="dark"] .btn.danger { background:#3b2020; color:#fca5a5; border-color:#623030; }
html[data-theme="dark"] a,
html[data-theme="dark"] .table-link { color:#fb923c; }
html[data-theme="dark"] thead,
html[data-theme="dark"] th { background:#292929!important; }
html[data-theme="dark"] td { background:#202020; border-color:#343434; }
html[data-theme="dark"] tbody tr:hover td { background:#27221f; }
html[data-theme="dark"] .table-wrap,
html[data-theme="dark"] table { color:#ededed; border-color:#383838; }
html[data-theme="dark"] .modal-head,
html[data-theme="dark"] .modal-foot,
html[data-theme="dark"] .permission-note,
html[data-theme="dark"] .opportunity-card>footer,
html[data-theme="dark"] .opp-value,
html[data-theme="dark"] .bpf-detail-tabs,
html[data-theme="dark"] .activity-toggle { background:#252525!important; border-color:#383838!important; }
html[data-theme="dark"] .bpf-tab.active { background:#35261c; color:#fb923c; box-shadow:inset 0 -3px #f97316; }
html[data-theme="dark"] .bpf-tab.active>span,
html[data-theme="dark"] .company-avatar { background:linear-gradient(135deg,#f97316,#c2410c); color:#fff; }
html[data-theme="dark"] .stage-guidance { background:linear-gradient(135deg,#35261c,#24201d); border-color:#6d3a1d; }
html[data-theme="dark"] .pill.proposal,
html[data-theme="dark"] .pill.negotiation,
html[data-theme="dark"] .pill.medium,
html[data-theme="dark"] .pill.scheduled { background:#3d2d13; color:#fbbf24; }
html[data-theme="dark"] .pill.won,
html[data-theme="dark"] .pill.completed,
html[data-theme="dark"] .pill.active,
html[data-theme="dark"] .pill.resolved { background:#173522; color:#86efac; }
html[data-theme="dark"] .pill.lost,
html[data-theme="dark"] .pill.critical,
html[data-theme="dark"] .pill.high { background:#3b2020; color:#fca5a5; }
html[data-theme="dark"] .toast { background:#292929; border:1px solid #f97316; color:#fff; }
html[data-theme="dark"] ::selection { background:#f97316; color:#fff; }

/* V25.2 — page-level contrast safeguards and Customers & Delivery */
html[data-theme="dark"] .page-head h1,
html[data-theme="dark"] .page-head>div>h1 { color:#f7f7f7!important; }
html[data-theme="dark"] .page-head p,
html[data-theme="dark"] .page-head>div>p { color:#b3b3b3!important; }
html[data-theme="dark"] .customer-card { background:#202020!important; border-color:#3c3c3c!important; }
html[data-theme="dark"] .customer-top h2 { color:#f7f7f7!important; }
html[data-theme="dark"] .customer-top p { color:#b3b3b3!important; }
html[data-theme="dark"] .customer-meta>div,
html[data-theme="dark"] .detail-grid>div,
html[data-theme="dark"] .legend-list>div,
html[data-theme="dark"] .deal-note {
  background:#292929!important;
  border:1px solid #3d3d3d;
  color:#d4d4d4!important;
}
html[data-theme="dark"] .customer-meta small,
html[data-theme="dark"] .detail-grid small { color:#a7a7a7!important; }
html[data-theme="dark"] .customer-meta strong,
html[data-theme="dark"] .detail-grid strong { color:#f5f5f5!important; }
html[data-theme="dark"] .progress,
html[data-theme="dark"] .forecast-bar>div { background:#3b3b3b!important; }
html[data-theme="dark"] .progress span { background:linear-gradient(90deg,#f97316,#fb923c)!important; }
html[data-theme="dark"] .progress-label { color:#b3b3b3!important; }
html[data-theme="dark"] .customer-actions { border-top-color:#3a3a3a; }
html[data-theme="dark"] .company-logo { background:#35261c!important; color:#fb923c!important; border-color:#6d3a1d!important; }

/* V25.3 — ERP-wide compatibility for module-owned light-only styles */
html[data-theme="dark"] .content h1,
html[data-theme="dark"] .content h2,
html[data-theme="dark"] .content h3,
html[data-theme="dark"] .content h4 { color:#f7f7f7!important; }
html[data-theme="dark"] .content p { color:#b0b0b0; }

html[data-theme="dark"] :is(
  .vendor-card,.vendor-kpi,.user-stat,.permission-popover,.user-account-panel,
  .permission-workspace,.permission-group,.permission-card,.reset-user-summary,
  .metric-card,.report-nav,.filter-card,.insight-card,.result-card,
  .flow-hero,.flow-health,.process-panel,.flow-stage,.procure-stage,
  .ik,.icard,.wh,.purchase-kpi,.flow-card,.purchase-card,
  .history-summary,.lead-history-event,.pipeline-history-item,
  .opportunity-info-grid>div,.timeline-card,.activity-card,.support-card
) { background:#202020!important; border-color:#3b3b3b!important; color:#ededed!important; }

html[data-theme="dark"] :is(
  .vendor-card-head,.vendor-footer,.vendor-section,.vendor-help,
  .permission-toolbar,.permission-summary-strip,.permission-groups,.permission-group-head,
  .column-panel,.pagination,.report-nav-head,
  .purchase-tabs,.supplier-mini,.purchase-summary>div,
  .history-summary,.reset-user-summary,.admin-password-rules span
) { background:#292929!important; border-color:#404040!important; color:#d7d7d7!important; }

html[data-theme="dark"] :is(
  .vendor-hero h1,.vendor-card-head h2,.vendor-section-title h3,.vendor-name,
  .vendor-kpi strong,.user-directory-head h2,.user-account-title h3,
  .permission-toolbar h3,.permission-group-head strong,.permission-module strong,
  .metric-card strong,.flow-health strong,.flow-stage h3,.procure-stage b,
  .purchase-card-head h2,.purchase-summary strong,.ik strong,.ihead h2,
  .history-summary b,.lead-history-event h3
) { color:#f5f5f5!important; }

html[data-theme="dark"] :is(
  .vendor-hero p,.vendor-card-head p,.vendor-section-title p,.vendor-sub,
  .vendor-kpi span,.vendor-footer small,.user-directory-head p,
  .user-account-title p,.permission-toolbar p,.permission-group-head small,
  .permission-module small,.metric-card span,.metric-card small,
  .flow-hero p,.flow-stage p,.procure-stage span,.purchase-card-head p,
  .purchase-kpi span,.flow-card small,.ik span,.wh small,
  .history-summary span,.lead-history-event p,.lead-history-event small
) { color:#aaa!important; }

html[data-theme="dark"] :is(
  .vendor-field input,.vendor-field select,.vendor-field textarea,
  .user-search input,.user-filters select,.filter-grid input,.filter-grid select,
  .table-tools input,.table-tools select,.quick-periods button,.pagination button,
  .purchase-form-grid input,.purchase-form-grid select,.purchase-form-grid textarea,
  .purchase-line-table input,.purchase-line-table select,.iform input,.iform select
) { background:#191919!important; color:#f5f5f5!important; border-color:#414141!important; }

html[data-theme="dark"] :is(
  .vendor-field input,.vendor-field select,.vendor-field textarea,
  .user-search input,.user-filters select,.filter-grid input,.filter-grid select,
  .table-tools input,.table-tools select,.purchase-form-grid input,
  .purchase-form-grid select,.purchase-form-grid textarea
):focus { border-color:#f97316!important; box-shadow:0 0 0 3px rgba(249,115,22,.16)!important; }

html[data-theme="dark"] :is(.vendor-table th,.itable th,.purchase-table th,.attention-table th) {
  background:#292929!important; color:#aaa!important; border-color:#3b3b3b!important;
}
html[data-theme="dark"] :is(.vendor-table td,.itable td,.purchase-table td,.attention-table td) {
  background:#202020!important; color:#e5e5e5!important; border-color:#383838!important;
}
html[data-theme="dark"] :is(.vendor-table tr:hover td,.itable tr:hover td,.purchase-table tr:hover td,.attention-table tr:hover td) {
  background:#29231f!important;
}

html[data-theme="dark"] .purchase-tab { color:#aaa!important; }
html[data-theme="dark"] .purchase-tab.active,
html[data-theme="dark"] .report-nav a:hover,
html[data-theme="dark"] .report-nav a.active { background:#35261c!important; color:#fb923c!important; }
html[data-theme="dark"] .flow-icon,
html[data-theme="dark"] .vendor-section-no,
html[data-theme="dark"] .permission-module-icon { background:#35261c!important; color:#fb923c!important; }
html[data-theme="dark"] .flow-stage-count { background:#3d2d13!important; color:#fbbf24!important; }
html[data-theme="dark"] .flow-stage small,
html[data-theme="dark"] .attention-table a,
html[data-theme="dark"] .filter-toggle,
html[data-theme="dark"] .permission-details summary { color:#fb923c!important; }
html[data-theme="dark"] .bar-row>div,
html[data-theme="dark"] .access-bar { background:#3b3b3b!important; }
html[data-theme="dark"] .bar-row i,
html[data-theme="dark"] .access-bar i { background:linear-gradient(90deg,#f97316,#fb923c)!important; }
html[data-theme="dark"] .report-nav details,
html[data-theme="dark"] .vendor-section,
html[data-theme="dark"] .flow-event,
html[data-theme="dark"] .permission-card { border-color:#393939!important; }
html[data-theme="dark"] .permission-action { background:#292929!important; color:#ddd!important; border-color:#464646!important; }
html[data-theme="dark"] .permission-popover-item,
html[data-theme="dark"] .permission-readonly,
html[data-theme="dark"] .role-badge,
html[data-theme="dark"] .access-chip { background:#303030!important; color:#d4d4d4!important; }
html[data-theme="dark"] .reset-warning { background:#3d2d13!important; color:#fcd34d!important; border-left-color:#f97316!important; }
html[data-theme="dark"] .history-summary,
html[data-theme="dark"] .history-card .modal-head { background:#252525!important; }
html[data-theme="dark"] .lead-history-event:before { background:#f97316!important; box-shadow:0 0 0 5px rgba(249,115,22,.15)!important; }
html[data-theme="dark"] .lead-history-event:after { background:#414141!important; }
html[data-theme="dark"] .status,
html[data-theme="dark"] .status-pill { background:#35261c!important; color:#fb923c!important; }
html[data-theme="dark"] .btn.secondary,
html[data-theme="dark"] .btn.ghost,
html[data-theme="dark"] .permission-action,
html[data-theme="dark"] .quick-periods button,
html[data-theme="dark"] .pagination button {
  background:#292929!important; color:#ededed!important; border-color:#484848!important;
}
html[data-theme="dark"] .btn.secondary:hover,
html[data-theme="dark"] .btn.ghost:hover { background:#35261c!important; color:#fb923c!important; border-color:#f97316!important; }
html[data-theme="dark"] .permission-choice,
html[data-theme="dark"] .permission-check { color:#bdbdbd!important; }
html[data-theme="dark"] .permission-note { background:#252525!important; color:#aaa!important; border-color:#3b3b3b!important; }


/* Personal profile */
.profile-avatar-image { object-fit: cover; display: block; }
.profile-page-grid { display:grid; grid-template-columns:minmax(0,1fr) 340px; gap:20px; align-items:start; }
.profile-edit-card { overflow:hidden; }
.profile-edit-hero { display:flex; align-items:center; gap:18px; padding:26px; border-bottom:1px solid var(--line); background:linear-gradient(135deg,rgba(255,255,255,.05),rgba(127,127,127,.04)); }
.profile-photo-wrap { position:relative; flex:0 0 auto; }
.profile-photo { width:108px; height:108px; border-radius:50%; object-fit:cover; display:grid; place-items:center; background:var(--surface-2); color:var(--ink); font-size:30px; font-weight:800; border:4px solid var(--surface); box-shadow:0 8px 24px rgba(0,0,0,.12); }
.profile-photo-edit { position:absolute; right:3px; bottom:3px; width:34px; height:34px; display:grid; place-items:center; border-radius:50%; background:var(--navy); color:#fff; border:3px solid var(--surface); cursor:pointer; }
.profile-photo-edit .nav-icon { width:15px; height:15px; }
.profile-edit-hero h2 { margin:0; font-size:23px; }
.profile-edit-hero p { margin:5px 0 7px; color:var(--muted); font-size:13px; }
.profile-edit-hero small { color:var(--muted); font-size:11px; }
.profile-form { padding:26px; }
.form-grid.two { display:grid; grid-template-columns:1fr 1fr; gap:18px; }
.field-full { grid-column:1 / -1; }
.field { display:grid; gap:7px; }
.field > span { color:var(--muted); font-size:12px; font-weight:700; }
.field input { width:100%; min-height:44px; padding:0 13px; border:1px solid var(--line); border-radius:11px; background:var(--surface-2); color:var(--ink); outline:none; }
.field input:focus { border-color:#9cafc1; box-shadow:0 0 0 3px rgba(71,119,205,.09); }
.field input[type=file] { padding:10px 12px; min-height:46px; }
.profile-form-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:24px; padding-top:20px; border-top:1px solid var(--line); }
.profile-summary-card { padding:22px; }
.profile-summary-title { display:flex; align-items:center; gap:10px; margin-bottom:18px; }
.profile-summary-title .nav-icon { width:20px; height:20px; }
.profile-summary-title h3 { margin:0; font-size:16px; }
.profile-summary-row { display:flex; justify-content:space-between; gap:12px; padding:13px 0; border-bottom:1px solid var(--line); font-size:12px; }
.profile-summary-row span { color:var(--muted); }
.profile-summary-row b { text-align:right; }
.profile-summary-note { margin:18px 0 0; color:var(--muted); font-size:11px; line-height:1.6; }
@media (max-width:900px) {
  .profile-page-grid { grid-template-columns:1fr; }
}
@media (max-width:640px) {
  .form-grid.two { grid-template-columns:1fr; }
  .field-full { grid-column:auto; }
  .profile-edit-hero { align-items:flex-start; }
  .profile-form { padding:20px; }
}


/* =========================================================
   Sidebar layout fix — fixed brand, independently scrollable navigation
   ========================================================= */
.app-shell {
  grid-template-columns: 270px minmax(0, 1fr);
}

.sidebar {
  width: 270px;
  height: 100vh;
  min-height: 100vh;
  padding: 12px 14px 18px;
  overflow: hidden !important;
  display: flex;
  flex-direction: column;
}

.sidebar > .brand {
  flex: 0 0 auto;
  position: relative;
  z-index: 2;
  margin: 0 0 14px;
}

.sidebar > .brand .brand-logo {
  display: block;
  width: 100%;
  max-width: 220px;
  height: 62px;
  object-fit: contain;
  object-position: center;
}

.sidebar > .nav-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2px 3px 18px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(79,96,121,.30) transparent;
}

.sidebar > .nav-list::-webkit-scrollbar {
  width: 6px;
}
.sidebar > .nav-list::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar > .nav-list::-webkit-scrollbar-thumb {
  background: rgba(79,96,121,.28);
  border-radius: 999px;
}
.sidebar > .nav-list::-webkit-scrollbar-thumb:hover {
  background: rgba(79,96,121,.45);
}

/* Keep the logo visually separated from the scrolling menu. */
.sidebar > .brand::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -8px;
  height: 1px;
  background: rgba(79,96,121,.14);
}

/* Prevent long navigation labels from forcing horizontal scrolling. */
.sidebar .nav-link {
  min-width: 0;
}
.sidebar .nav-link > span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    width: 270px;
  }
}

@media (max-width: 360px) {
  .sidebar {
    width: 250px;
  }
}

/* V28 — Unified ERP card system. Loaded last to normalize every module,
   including legacy inline module cards and nested operational sub-cards. */
:root {
  --card-radius: 18px;
  --card-border: #e3e8ef;
  --card-shadow: 0 8px 26px rgba(15, 23, 42, .055);
  --card-shadow-hover: 0 16px 38px rgba(15, 23, 42, .095);
  --card-soft: #f8fafc;
  --card-accent: #f97316;
}

body .card,
body .panel,
body .table-panel,
body .kpi,
body [class$="-card"],
body [class*="-card "],
body [class$="-kpi"],
body [class*="-kpi "],
body [class$="-tile"],
body [class*="-tile "],
body [class$="-panel"],
body [class*="-panel "] {
  border: 1px solid var(--card-border) !important;
  border-radius: var(--card-radius) !important;
  background: var(--surface, #fff) !important;
  box-shadow: var(--card-shadow) !important;
  color: var(--text, #1f2937);
}

body .card,
body .panel,
body .kpi,
body [class$="-card"],
body [class*="-card "],
body [class$="-kpi"],
body [class*="-kpi "],
body [class$="-tile"] {
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

body .kpi:hover,
body a.card:hover,
body a[class$="-card"]:hover,
body a[class*="-card "]:hover,
body [class$="-tile"]:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--card-border) 45%, var(--card-accent) 55%) !important;
  box-shadow: var(--card-shadow-hover) !important;
}

body .panel-head,
body [class$="-card-head"],
body [class*="-card-head "],
body [class$="-head"],
body [class*="-head "] {
  border-bottom-color: var(--card-border) !important;
}

body .table-wrap {
  overflow: auto;
  border-radius: 0 0 calc(var(--card-radius) - 1px) calc(var(--card-radius) - 1px);
}

body table {
  border-collapse: separate;
  border-spacing: 0;
}

body table th {
  background: color-mix(in srgb, var(--surface, #fff) 91%, #94a3b8 9%) !important;
  color: var(--muted, #64748b) !important;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .055em;
  text-transform: uppercase;
}

body table td {
  border-bottom-color: var(--card-border) !important;
}

body table tbody tr {
  transition: background .15s ease;
}

body table tbody tr:hover {
  background: color-mix(in srgb, var(--surface, #fff) 94%, #fb923c 6%) !important;
}

body .modal-card {
  overflow: hidden;
  border: 1px solid var(--card-border) !important;
  border-radius: 20px !important;
  background: var(--surface, #fff) !important;
  box-shadow: 0 30px 90px rgba(15, 23, 42, .25) !important;
}

body .modal-head {
  border-bottom: 1px solid var(--card-border) !important;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface, #fff) 96%, #fff 4%), var(--surface, #fff));
}

body input,
body select,
body textarea,
body .control {
  border-radius: 10px;
}

body .btn,
body .icon-button {
  border-radius: 9px;
}

body .page-head {
  gap: 18px;
  margin-bottom: 18px;
}

/* Final modal viewport safeguard. Later theme rules previously restored
   overflow:hidden and trapped long forms below the visible screen. */
body .modal {
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

body .modal-card,
body .modal-card.wide {
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px) !important;
  margin: 0 auto;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

body .modal-head {
  position: sticky;
  top: 0;
  z-index: 10;
}

body .modal-foot {
  position: sticky;
  bottom: 0;
  z-index: 10;
  background: var(--surface, #fff);
}

@media (max-width:650px) {
  body .modal-card,
  body .modal-card.wide {
    width: 100%;
    max-height: calc(100dvh - 12px) !important;
    margin-top: 12px;
    border-radius: 20px 20px 0 0 !important;
  }
}

body .page-head h1 {
  letter-spacing: -.55px;
}

html[data-theme="dark"] {
  --card-border: #414348;
  --card-shadow: 0 10px 28px rgba(0, 0, 0, .22);
  --card-shadow-hover: 0 18px 42px rgba(0, 0, 0, .32);
  --card-soft: #292a2d;
}

html[data-theme="dark"] body .card,
html[data-theme="dark"] body .panel,
html[data-theme="dark"] body .table-panel,
html[data-theme="dark"] body .kpi,
html[data-theme="dark"] body [class$="-card"],
html[data-theme="dark"] body [class*="-card "],
html[data-theme="dark"] body [class$="-kpi"],
html[data-theme="dark"] body [class*="-kpi "],
html[data-theme="dark"] body [class$="-tile"],
html[data-theme="dark"] body [class*="-tile "],
html[data-theme="dark"] body [class$="-panel"],
html[data-theme="dark"] body [class*="-panel "] {
  background: #303135 !important;
  border-color: var(--card-border) !important;
  color: #f8fafc !important;
}

html[data-theme="dark"] body table th {
  background: #27282b !important;
  color: #cbd5e1 !important;
}

html[data-theme="dark"] body table tbody tr:hover {
  background: #38393d !important;
}

@media (max-width: 720px) {
  body .card,
  body .panel,
  body .table-panel,
  body [class$="-card"],
  body [class*="-card "] {
    border-radius: 15px !important;
  }
  body .modal-card { border-radius: 16px !important; }
}

.header-document-search {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 270px;
  height: 38px;
  padding-left: 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
}
.header-document-search > .nav-icon { flex: 0 0 auto; color: var(--muted); }
.header-document-search input {
  min-width: 0;
  width: 145px;
  height: 34px;
  padding: 0;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  font-size: 10px;
}
.header-document-search .btn { flex: 0 0 auto; height: 34px; }
html[data-theme="dark"] .header-document-search { background: #303135; border-color: #494b50; }
@media(max-width:1050px){.header-document-search{min-width:0}.header-document-search input{display:none}}
@media(max-width:620px){.header-document-search .btn span:last-child{display:none}.header-document-search{padding-left:7px}.header-document-search .btn{width:34px;padding:0;justify-content:center}}

/* Enact Spectrum sidebar clipart */
.sidebar .nav-link{min-height:54px;height:auto;padding:7px 11px;gap:12px;border-radius:15px}
.nav-clipart{position:relative;display:grid;place-items:center;width:39px;height:39px;flex:0 0 39px;border-radius:13px;background:linear-gradient(145deg,color-mix(in srgb,var(--clip-a) 18%,#fff),color-mix(in srgb,var(--clip-b) 28%,#fff));border:1px solid color-mix(in srgb,var(--clip-a) 18%,#fff);font-size:20px;line-height:1;filter:saturate(1.08);box-shadow:0 5px 13px color-mix(in srgb,var(--clip-a) 16%,transparent);transition:transform .18s ease,box-shadow .18s ease}
.sidebar .nav-link:hover .nav-clipart{transform:translateY(-2px) rotate(-3deg);box-shadow:0 9px 18px color-mix(in srgb,var(--clip-a) 24%,transparent)}
.sidebar .nav-link.active{background:linear-gradient(110deg,#172554,#312e81)!important;color:#fff!important;box-shadow:0 10px 24px rgba(49,46,129,.24)!important}
.sidebar .nav-link.active .nav-clipart{background:linear-gradient(145deg,#fff,#eef2ff);border-color:#fff;box-shadow:0 6px 16px rgba(0,0,0,.18)}
html[data-theme="dark"] .nav-clipart{background:linear-gradient(145deg,color-mix(in srgb,var(--clip-a) 30%,#252525),color-mix(in srgb,var(--clip-b) 38%,#252525));border-color:color-mix(in srgb,var(--clip-a) 35%,#333)}
