:root {
  --navy: #0b3558;
  --navy-2: #0f466f;
  --blue: #1675b8;
  --blue-soft: #eaf4fb;
  --teal: #0f8b8d;
  --green: #2e8b57;
  --amber: #d58b16;
  --red: #c44536;
  --ink: #162230;
  --muted: #66788a;
  --line: #dfe7ee;
  --panel: #ffffff;
  --page: #f4f7fa;
  --shadow: 0 10px 28px rgba(19, 53, 82, .09);
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--page); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.hidden { display: none !important; }

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 1.15fr) minmax(340px, .85fr);
  background: linear-gradient(135deg, #082c4a 0%, #0c507d 52%, #edf5fa 52%, #f8fbfd 100%);
}
.login-hero { padding: 72px; color: white; display: flex; flex-direction: column; justify-content: center; }
.brand-mark { display: inline-grid; place-items: center; width: 54px; height: 54px; border-radius: 16px; background: rgba(255,255,255,.15); font-size: 24px; font-weight: 800; letter-spacing: .04em; border: 1px solid rgba(255,255,255,.22); }
.login-hero h1 { font-size: clamp(34px, 4vw, 58px); line-height: 1.04; margin: 24px 0 18px; max-width: 720px; }
.login-hero p { font-size: 18px; line-height: 1.65; max-width: 680px; color: rgba(255,255,255,.82); }
.hero-points { display: grid; gap: 14px; margin-top: 28px; }
.hero-point { display: flex; align-items: center; gap: 12px; color: rgba(255,255,255,.92); }
.hero-dot { width: 9px; height: 9px; border-radius: 999px; background: #72d6c9; box-shadow: 0 0 0 6px rgba(114,214,201,.15); }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 40px; }
.login-card { width: min(440px, 100%); background: rgba(255,255,255,.96); border: 1px solid rgba(255,255,255,.6); border-radius: 24px; padding: 36px; box-shadow: 0 24px 70px rgba(4,35,59,.2); }
.login-card h2 { margin: 0 0 8px; font-size: 30px; }
.login-card .sub { color: var(--muted); margin: 0 0 26px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 258px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; min-height: 100vh; overflow: hidden; background: linear-gradient(180deg, var(--navy), #082a47); color: white; padding: 22px 16px; display: flex; flex-direction: column; z-index: 4; }
.sidebar-brand { display: flex; gap: 12px; align-items: center; padding: 4px 8px 18px; border-bottom: 1px solid rgba(255,255,255,.12); }
.sidebar-brand .brand-mark { width: 42px; height: 42px; border-radius: 12px; font-size: 18px; }
.sidebar-brand strong { display: block; font-size: 15px; }
.sidebar-brand span { font-size: 11px; color: rgba(255,255,255,.65); }
.nav { display: grid; gap: 5px; margin-top: 20px; flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; padding-right: 4px; scrollbar-color: rgba(255,255,255,.28) transparent; }
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.28); border-radius: 99px; }
.nav button { border: 0; background: transparent; color: rgba(255,255,255,.76); text-align: left; padding: 11px 12px; border-radius: 11px; display: flex; gap: 11px; align-items: center; transition: .18s ease; }
.nav button:hover { background: rgba(255,255,255,.08); color: white; }
.nav button.active { background: rgba(255,255,255,.14); color: white; box-shadow: inset 3px 0 0 #65c8da; }
.nav .icon { width: 20px; text-align: center; font-size: 16px; }
.sidebar-foot { flex: 0 0 auto; margin-top: 8px; border-top: 1px solid rgba(255,255,255,.12); padding: 16px 8px 4px; }
.user-block { margin-bottom: 12px; }
.user-block strong { font-size: 13px; display: block; }
.user-block span { color: rgba(255,255,255,.65); font-size: 11px; }
.sidebar-foot button { width: 100%; border: 1px solid rgba(255,255,255,.2); background: transparent; color: white; border-radius: 10px; padding: 9px 12px; }

.main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 3; background: rgba(244,247,250,.94); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); padding: 14px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mobile-menu { display: none; border: 0; background: var(--panel); border-radius: 10px; width: 40px; height: 40px; box-shadow: var(--shadow); }
.topbar h1 { font-size: 22px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.pill { background: white; border: 1px solid var(--line); padding: 8px 11px; border-radius: 999px; font-size: 12px; color: var(--muted); }
.content { padding: 24px; max-width: 1680px; margin: 0 auto; }

.toolbar { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.toolbar .spacer { flex: 1; }
.field { display: grid; gap: 6px; }
.field label { font-size: 12px; font-weight: 700; color: #516273; }
.input, select, textarea { width: 100%; border: 1px solid #cfd9e2; border-radius: 10px; padding: 10px 11px; background: white; color: var(--ink); outline: none; transition: .15s ease; }
.input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(22,117,184,.12); }
textarea { min-height: 88px; resize: vertical; }
.btn { border: 0; border-radius: 10px; padding: 10px 14px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; }
.btn-primary { background: var(--navy-2); color: white; }
.btn-primary:hover { background: var(--navy); }
.btn-secondary { background: white; color: var(--navy); border: 1px solid var(--line); }
.btn-secondary:hover { background: #f9fbfc; }
.btn-danger { background: #fff1ef; color: var(--red); border: 1px solid #f3c5bf; }
.btn-success { background: #eaf7ef; color: var(--green); border: 1px solid #c7e5d2; }
.btn-sm { padding: 7px 10px; font-size: 12px; border-radius: 8px; }
.btn-icon { width: 34px; height: 34px; padding: 0; }

.grid { display: grid; gap: 18px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px; }
.card-title { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.card-title h3 { margin: 0; font-size: 16px; }
.card-title p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.kpi { padding: 18px; position: relative; overflow: hidden; }
.kpi::after { content: ''; position: absolute; right: -24px; top: -24px; width: 90px; height: 90px; border-radius: 50%; background: rgba(22,117,184,.07); }
.kpi-label { color: var(--muted); font-size: 12px; font-weight: 700; }
.kpi-value { margin-top: 8px; font-size: clamp(22px, 2.3vw, 34px); font-weight: 800; letter-spacing: -.02em; }
.kpi-meta { margin-top: 8px; display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--muted); }
.kpi-good { color: var(--green); }
.kpi-bad { color: var(--red); }
.kpi-warn { color: var(--amber); }
.progress { height: 7px; background: #e9eef3; border-radius: 999px; overflow: hidden; margin-top: 12px; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), var(--teal)); }

.scenario-bar { display: flex; flex-wrap: wrap; gap: 8px; padding: 7px; background: #eaf0f5; border-radius: 12px; }
.scenario-bar button { border: 0; background: transparent; color: #53697d; font-size: 12px; font-weight: 700; padding: 8px 12px; border-radius: 9px; }
.scenario-bar button.active { background: white; color: var(--navy); box-shadow: 0 3px 10px rgba(17,50,80,.1); }

.chart-wrap { min-height: 300px; }
.chart-wrap svg { width: 100%; height: 300px; display: block; }
.chart-axis { stroke: #d9e2e9; stroke-width: 1; }
.chart-label { fill: #6b7c8d; font-size: 10px; }
.chart-target { fill: rgba(22,117,184,.18); }
.chart-forecast { fill: #1675b8; }
.legend { display: flex; gap: 16px; font-size: 11px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; }

.alert-list { display: grid; gap: 10px; }
.alert-item { padding: 12px 13px; border: 1px solid var(--line); border-radius: 11px; background: #fbfcfd; display: flex; gap: 11px; align-items: flex-start; }
.alert-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex: 0 0 auto; }
.alert-item strong { font-size: 13px; display: block; margin-bottom: 3px; }
.alert-item p { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.45; }

.table-card { overflow: hidden; }
.table-tools { padding: 14px 16px; display: flex; gap: 10px; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.table-scroll { overflow: auto; max-height: calc(100vh - 290px); }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { position: sticky; top: 0; z-index: 1; background: #f5f8fa; color: #4f6273; text-align: left; padding: 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid #edf1f4; vertical-align: top; }
tr:hover td { background: #fbfdfe; }
.number { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); }
.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 4px 8px; font-size: 10px; font-weight: 800; white-space: nowrap; }
.badge-blue { background: #e7f2fa; color: #126498; }
.badge-green { background: #e8f5ed; color: #267548; }
.badge-amber { background: #fff4df; color: #9b6513; }
.badge-red { background: #fff0ee; color: #a7392e; }
.badge-gray { background: #edf1f4; color: #5f6e7b; }
.empty { padding: 44px 24px; text-align: center; color: var(--muted); }
.empty strong { color: var(--ink); display: block; font-size: 16px; margin-bottom: 6px; }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); padding: 0 12px; overflow-x: auto; }
.tabs button { border: 0; background: transparent; padding: 13px 10px; color: var(--muted); font-weight: 700; font-size: 12px; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.active { color: var(--blue); border-bottom-color: var(--blue); }

.modal-backdrop { position: fixed; inset: 0; background: rgba(4,28,46,.56); z-index: 20; display: grid; place-items: center; padding: 18px; }
.modal { width: min(980px, 100%); max-height: calc(100vh - 36px); overflow: auto; background: white; border-radius: 18px; box-shadow: 0 30px 90px rgba(0,0,0,.25); }
.modal-head { position: sticky; top: 0; z-index: 2; background: white; display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 20px; }
.modal-body { padding: 20px; }
.modal-foot { position: sticky; bottom: 0; background: white; border-top: 1px solid var(--line); padding: 14px 20px; display: flex; justify-content: flex-end; gap: 10px; }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-4 { grid-column: span 4; }
.month-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }

.import-zone { border: 2px dashed #b9c9d6; border-radius: 16px; padding: 32px; text-align: center; background: #f9fbfc; transition: .15s ease; }
.import-zone.drag { border-color: var(--blue); background: var(--blue-soft); }
.import-zone h3 { margin: 6px 0 6px; }
.import-zone p { margin: 0 0 16px; color: var(--muted); font-size: 13px; }
.import-summary { margin-top: 18px; }
.warning { background: #fff7e8; color: #7c581a; border: 1px solid #f1d79e; border-radius: 10px; padding: 10px 12px; font-size: 12px; margin-bottom: 8px; }
.success { background: #eaf7ef; color: #246b43; border: 1px solid #c4e2cf; border-radius: 10px; padding: 10px 12px; font-size: 12px; margin-bottom: 8px; }
.error { background: #fff0ee; color: #983a31; border: 1px solid #efc4bf; border-radius: 10px; padding: 10px 12px; font-size: 12px; margin-bottom: 8px; }

.org-tree { display: grid; gap: 16px; }
.org-bu { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.org-bu-head { background: #eef5fa; padding: 13px 15px; font-weight: 800; color: var(--navy); }
.org-divisions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 14px; }
.org-division { border: 1px solid var(--line); border-radius: 12px; padding: 13px; }
.org-division h4 { margin: 0 0 9px; }
.person-row { padding: 8px 0; border-top: 1px solid #eef2f5; display: flex; justify-content: space-between; gap: 10px; }
.person-row:first-of-type { border-top: 0; }
.person-row span { color: var(--muted); font-size: 11px; }

.target-grid input, .target-grid select { min-width: 100px; padding: 7px 8px; border: 1px solid #d6e0e8; border-radius: 7px; }
.target-grid input[type="number"] { text-align: right; }
.target-grid .calculated { background: #f4f7fa; color: #46596b; }

.toast-stack { position: fixed; top: 18px; right: 18px; z-index: 50; display: grid; gap: 10px; width: min(360px, calc(100vw - 36px)); }
.toast { background: white; border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 12px; padding: 12px 14px; font-size: 13px; animation: slide-in .18s ease; }
.toast.good { border-left: 4px solid var(--green); }
.toast.bad { border-left: 4px solid var(--red); }
@keyframes slide-in { from { opacity: 0; transform: translateY(-8px); } }

@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .form-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .form-grid .span-4 { grid-column: span 2; }
  .month-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
}

@media (max-width: 860px) {
  .login-shell { grid-template-columns: 1fr; background: linear-gradient(165deg, #082c4a 0%, #0c507d 42%, #eef5fa 42%); }
  .login-hero { padding: 44px 28px 90px; }
  .login-panel { padding: 0 20px 40px; margin-top: -58px; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -280px; transition: .2s ease; box-shadow: 14px 0 40px rgba(0,0,0,.2); }
  .sidebar.open { left: 0; }
  .mobile-menu { display: inline-grid; place-items: center; }
  .topbar { padding: 12px 14px; }
  .topbar-right .pill { display: none; }
  .content { padding: 16px; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .org-divisions { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .grid-4 { grid-template-columns: 1fr; }
  .login-hero h1 { font-size: 38px; }
  .login-card { padding: 26px 22px; }
  .toolbar { align-items: stretch; }
  .toolbar .field, .toolbar .btn { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2, .form-grid .span-4 { grid-column: span 1; }
  .month-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .topbar h1 { font-size: 18px; }
}

@media print {
  body { background: white; }
  .app-shell { display: block; }
  .sidebar, .topbar, .toolbar, .btn, .tabs { display: none !important; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; break-inside: avoid; }
  .table-scroll { overflow: visible; max-height: none !important; }
  th { position: static; }
}
.chart-actual { fill: #2e8b57; }
.chart-projection { fill: #1675b8; }
a.btn { text-decoration: none; }

/* Version 1.2 scenario comparison */
.selected-row { background: rgba(22, 117, 184, 0.06); }
.scenario-link {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0 6px 0 0;
  color: #125f96;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
}
.scenario-link:hover { text-decoration: underline; }

/* Organisation editor */
.org-edit-head { display: flex; align-items: end; gap: 14px; justify-content: space-between; }
.org-name-field { min-width: 220px; flex: 1; }
.org-name-field label { display: block; margin-bottom: 5px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.org-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.org-division-head { display: flex; gap: 10px; align-items: end; margin-bottom: 12px; }
.org-division-head .org-name-field { min-width: 0; }
.org-people { display: grid; gap: 9px; margin-bottom: 10px; }
.org-person-edit { display: grid; grid-template-columns: minmax(130px, 1fr) minmax(120px, .8fr) minmax(160px, 1.2fr) 34px; gap: 8px; align-items: end; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fbfdff; }
.org-person-edit .field label { font-size: 10px; }
.org-person-delete { margin-bottom: 1px; }
.btn-small { padding: 7px 10px; font-size: 12px; }
.btn-icon { width: 34px; min-width: 34px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center; font-size: 19px; line-height: 1; }

@media (max-width: 900px) {
  .org-edit-head { align-items: stretch; flex-direction: column; }
  .org-head-actions { justify-content: flex-end; }
  .org-person-edit { grid-template-columns: 1fr 1fr 34px; }
  .org-alias-field { grid-column: 1 / 3; }
  .org-person-delete { grid-column: 3; grid-row: 1; }
}

@media (max-width: 600px) {
  .org-person-edit { grid-template-columns: 1fr 34px; }
  .org-person-edit .field { grid-column: 1; }
  .org-alias-field { grid-column: 1; }
  .org-person-delete { grid-column: 2; grid-row: 1; }
}

/* Vanguard corporate logo — Version 1.4.0 */
.brand-logo {
  display: block;
  height: auto;
  object-fit: contain;
  object-position: left center;
  user-select: none;
  -webkit-user-drag: none;
}
.login-brand-logo {
  width: min(360px, 72vw);
  max-height: 72px;
  margin: 0 0 18px;
}
.sidebar-brand {
  align-items: flex-start;
  flex-direction: column;
  gap: 8px;
}
.sidebar-brand-logo {
  width: 176px;
  max-width: 100%;
  max-height: 34px;
}
.sidebar-brand-copy strong {
  font-size: 13px;
  letter-spacing: .01em;
}
.sidebar-brand-copy span {
  display: block;
  margin-top: 2px;
}
@media (max-width: 600px) {
  .login-brand-logo { width: min(290px, 78vw); max-height: 58px; }
}

/* Sortable data tables — Version 1.4.0 */
.sortable-th { padding: 0; }
.sort-button {
  width: 100%;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 10px;
  font: inherit;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}
.sort-button:hover,
.sort-button:focus-visible { background: #eaf2f7; color: var(--blue); outline: none; }
.sort-button.active { color: var(--blue); }
.sort-indicator { min-width: 12px; color: #8b9aa7; font-size: 10px; line-height: 1; }
.sort-button.active .sort-indicator { color: var(--blue); }
th.number .sort-button { justify-content: flex-end; text-align: right; }

/* User access administration — Version 1.4.0 */
.permission-summary { display: flex; flex-wrap: wrap; gap: 5px; max-width: 430px; }
.permission-summary span { display: inline-flex; padding: 4px 7px; border-radius: 999px; background: #eef3f7; color: #506376; font-size: 10px; font-weight: 700; }
.permission-editor { display: grid; gap: 18px; margin-top: 18px; }
.permission-editor.disabled { opacity: .5; pointer-events: none; }
.permission-section { border: 1px solid var(--line); border-radius: 14px; padding: 16px; background: #fbfdff; }
.permission-checkbox-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.permission-check { display: flex; gap: 9px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 10px 11px; background: white; font-size: 12px; font-weight: 700; color: #42586a; cursor: pointer; }
.permission-check:hover { border-color: #9fc4dc; background: #f5faff; }
.permission-check input { accent-color: var(--blue); }
.permission-icon { width: 18px; text-align: center; color: var(--navy-2); }
.division-permission-list { display: grid; gap: 12px; }
.division-permission-unit { border: 1px solid #e4ebf0; border-radius: 11px; padding: 12px; background: white; }
.division-permission-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.check-row { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: #526779; }
.check-row input { accent-color: var(--blue); }
.access-active { margin-top: 14px; font-weight: 700; }

@media (max-width: 900px) {
  .permission-checkbox-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .permission-checkbox-grid { grid-template-columns: 1fr; }
  .division-permission-head { align-items: flex-start; flex-direction: column; }
}


/* Salesperson-level access — Version 1.4.0 */
.salesperson-access-list { display: grid; gap: 10px; }
.salesperson-access-division { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); }
.salesperson-access-division-head { padding: 9px 10px; background: #f7f9fb; border-bottom: 1px solid var(--border); }
.permission-check-division { border: 0; padding: 0; background: transparent; }
.permission-check span small { display: block; color: var(--muted); font-size: 10px; font-weight: 500; margin-top: 2px; }
.salesperson-checkbox-grid { padding: 10px; }
.salesperson-checkbox-grid .permission-check { min-height: 48px; }
.salesperson-checkbox-grid input:disabled + span { opacity: .48; }
@media (max-width: 760px) { .salesperson-checkbox-grid { grid-template-columns: 1fr; } }

/* Email-enabled organisation editor — Version 1.4.0 */
.org-divisions { grid-template-columns: 1fr; }
.org-edit-head { display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)) auto; align-items: end; }
.org-division-head { display: grid; grid-template-columns: repeat(3, minmax(150px, 1fr)) 34px; align-items: end; }
.org-person-edit { grid-template-columns: repeat(4, minmax(140px, 1fr)) 34px; }
@media (max-width: 1100px) {
  .org-edit-head, .org-division-head { grid-template-columns: 1fr 1fr; }
  .org-head-actions { grid-column: 1 / 3; justify-content: flex-end; }
  .org-division-head > .btn-icon { grid-column: 2; grid-row: 1; justify-self: end; }
  .org-person-edit { grid-template-columns: 1fr 1fr 34px; }
  .org-person-edit .org-alias-field { grid-column: 1 / 3; }
}
@media (max-width: 650px) {
  .org-edit-head, .org-division-head { grid-template-columns: 1fr 34px; }
  .org-edit-head .org-name-field, .org-division-head .org-name-field { grid-column: 1 / 3; }
  .org-head-actions { grid-column: 1 / 3; }
  .org-division-head > .btn-icon { grid-column: 2; grid-row: 1; }
  .org-person-edit { grid-template-columns: 1fr 34px; }
  .org-person-edit .field, .org-person-edit .org-alias-field { grid-column: 1; }
}

/* Version 1.4.0 dashboard salesperson multi-select */
.dashboard-people-field { min-width: 230px; }
.multi-select { position: relative; min-width: 230px; }
.multi-select > summary {
  list-style: none;
  width: 100%;
  border: 1px solid #cfd9e2;
  border-radius: 10px;
  padding: 10px 34px 10px 11px;
  background: white;
  color: var(--ink);
  cursor: pointer;
  position: relative;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.multi-select > summary::-webkit-details-marker { display: none; }
.multi-select > summary::after { content: '▾'; position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.multi-select[open] > summary { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(22,117,184,.12); }
.multi-select-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  width: min(340px, 86vw);
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  box-shadow: 0 18px 40px rgba(19,53,82,.18);
}
.multi-select-actions { display: flex; justify-content: space-between; gap: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.multi-select-actions button { border: 0; background: transparent; color: var(--blue); padding: 4px; font-size: 11px; font-weight: 800; }
.multi-select-options { display: grid; gap: 3px; max-height: 250px; overflow: auto; padding: 8px 0; }
.multi-select-options label { display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: 8px; color: var(--ink); cursor: pointer; font-size: 12px; }
.multi-select-options label:hover { background: var(--blue-soft); }
.multi-select-options input { width: 16px; height: 16px; margin: 0; }
.multi-select-apply { width: 100%; }

@media (max-width: 600px) {
  .dashboard-people-field, .multi-select { width: 100%; min-width: 0; }
  .multi-select-menu { position: static; width: 100%; margin-top: 6px; }
}


/* Orders & Pipeline invoicing views — Version 1.4.0 */
.record-projection-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(360px, 1.2fr);
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #f8fbfd;
}
.record-projection-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
}
.record-projection-switch button {
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  padding: 8px 11px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.record-projection-switch button.active {
  background: var(--blue);
  color: white;
  box-shadow: 0 2px 8px rgba(22,117,184,.2);
}
.record-projection-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(100px, 1fr));
  gap: 8px;
}
.record-projection-summary > div {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: white;
  min-width: 0;
}
.record-projection-summary > div.active {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(22,117,184,.1);
}
.record-projection-summary span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.record-projection-summary strong {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  overflow-wrap: anywhere;
}
@media (max-width: 1100px) {
  .record-projection-panel { grid-template-columns: 1fr; align-items: stretch; }
  .record-projection-switch { width: fit-content; max-width: 100%; overflow-x: auto; }
}
@media (max-width: 620px) {
  .record-projection-summary { grid-template-columns: 1fr; }
}

/* KPI traffic-light performance — Version 1.4.0 */
.traffic-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 6px;
  border-radius: 999px;
  vertical-align: middle;
  background: #8b9aa7;
}
.traffic-dot.green { background: #2e8b57; }
.traffic-dot.yellow { background: #d58b16; }
.traffic-dot.red { background: #c44536; }
.traffic-dot.pending { background: #8b9aa7; }
.kpi-traffic-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(100px, 1fr));
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #f8fbfd;
}
.kpi-traffic-strip > div {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
}
.kpi-traffic-strip strong { font-size: 18px; }
.kpi-traffic-strip small { color: var(--muted); font-weight: 700; }
.kpi-config-card { overflow: hidden; }
.kpi-config-table { min-width: 1460px; }
.kpi-config-table td { vertical-align: top; }
.kpi-config-table input,
.kpi-config-table select { min-width: 112px; }
.kpi-config-table td:first-child input { min-width: 250px; }
.kpi-traffic-config { align-items: end; margin-bottom: 16px; }
#kpi-scorecard table { min-width: 1440px; }
#kpi-scorecard td { vertical-align: top; }
#kpi-scorecard textarea { min-width: 220px; min-height: 62px; }
#kpi-scorecard .input.number { min-width: 110px; }
.kpi-dashboard-summary .badge { white-space: nowrap; }
@media (max-width: 760px) {
  .kpi-traffic-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .kpi-traffic-strip { grid-template-columns: 1fr; }
}


.table-total-row th { background: #eef4f8; color: #15354a; font-weight: 800; border-top: 2px solid #9db5c5; border-bottom: 2px solid #9db5c5; white-space: nowrap; }
.records-monthly-table th, .records-monthly-table td { min-width: 105px; }
.records-monthly-table th:nth-child(-n+7), .records-monthly-table td:nth-child(-n+7) { min-width: 125px; }
.records-monthly-table thead { position: sticky; top: 0; z-index: 2; }


.academy-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(310px,1fr));gap:18px;margin-top:18px}.academy-course{padding:20px;display:flex;flex-direction:column;gap:10px}.academy-course h3{margin:2px 0;font-size:19px}.academy-course-top,.academy-meta{display:flex;align-items:center;justify-content:space-between;gap:8px}.badge-blue{background:#e7f3fb;color:#0b5d8f}.academy-course .info{padding:9px;font-size:12px}

/* AI chat and talking bot */
.ai-chat-card{border:1px solid #cbd9e8}.ai-chat-messages{height:360px;overflow:auto;background:#f6f9fc;border:1px solid #dbe4ee;border-radius:14px;padding:16px;display:flex;flex-direction:column;gap:12px}.ai-msg{max-width:86%;padding:12px 14px;border-radius:14px;line-height:1.5;box-shadow:0 1px 2px rgba(15,23,42,.06)}.ai-user{align-self:flex-end;background:#123b6d;color:#fff}.ai-bot{align-self:flex-start;background:#fff;border:1px solid #dbe4ee}.ai-msg-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:5px}.ai-user .ai-msg-head{color:#dbeafe}.ai-chat-compose{margin-top:14px}.ai-chat-compose textarea{width:100%;min-height:78px}.ai-chat-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:8px}.badge-green{background:#dcfce7;color:#166534}@media(max-width:700px){.ai-chat-messages{height:300px}.ai-msg{max-width:96%}}
