/* EXP Management Portal: corporate maritime style. Deep navy, light sea blue, lots of white space. */
:root {
  --navy-900: #071a33; --navy-800: #0b2547; --navy-700: #12345f; --navy-600: #1d4a80;
  --sea-500: #4aa8d8; --sea-400: #6dbde4; --sea-100: #e7f4fb; --sea-50: #f3f9fd;
  --ink: #0b2547; --ink-2: #4b5d75; --ink-3: #7b8ba1; --line: #e3e9f0; --bg: #ffffff; --bg-2: #f6f8fb; --card: #ffffff;
  --ok: #1f8a5b; --ok-bg: #e5f5ee; --warn: #a76200; --warn-bg: #fff3df; --bad: #c0392b; --bad-bg: #fdecea;
  --star: #e8a317;
  --radius: 10px; --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(7, 26, 51, .06), 0 4px 16px rgba(7, 26, 51, .06);
  --shadow-lg: 0 10px 40px rgba(7, 26, 51, .16);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --ink: #e6edf5; --ink-2: #a9b8ca; --ink-3: #7d8da3; --line: #22344d; --bg: #0a1628; --bg-2: #0d1d33; --card: #102341;
  --sea-100: #123a5c; --sea-50: #0f2a45; --ok-bg: #12382a; --warn-bg: #3a2a0c; --bad-bg: #3d1717;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.5 var(--font); color: var(--ink); background: var(--bg-2); -webkit-font-smoothing: antialiased; }
a { color: var(--navy-600); }
:root[data-theme="dark"] a { color: var(--sea-400); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 28px; font-weight: 600; } h2 { font-size: 21px; font-weight: 600; } h3 { font-size: 16px; font-weight: 600; }
.muted { color: var(--ink-2); } .small { font-size: 13px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--sea-500); outline-offset: 2px; }

/* ---------- Form controls ---------- */
label.field { display: block; margin-bottom: 16px; }
label.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=date], input[type=number], input[type=url], input[type=tel], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--sea-500); box-shadow: 0 0 0 3px rgba(74, 168, 216, .25); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 600; font-size: 14px; border-radius: 8px;
  padding: 10px 18px; border: 1px solid transparent; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, color .15s; white-space: nowrap; }
.btn-primary { background: var(--navy-800); color: #fff; }
.btn-primary:hover { background: var(--navy-600); }
:root[data-theme="dark"] .btn-primary { background: var(--sea-500); color: var(--navy-900); }
.btn-secondary { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { border-color: var(--sea-500); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { color: var(--ink); background: var(--sea-50); }
.btn-danger { background: var(--card); color: var(--bad); border-color: var(--line); }
.btn-danger:hover { background: var(--bad-bg); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: default; }
.btn-block { width: 100%; }
.alert { padding: 10px 14px; border-radius: 8px; font-size: 14px; margin-bottom: 16px; }
.alert-error { background: var(--bad-bg); color: var(--bad); }
.alert-ok { background: var(--ok-bg); color: var(--ok); }
.alert-info { background: var(--sea-50); color: var(--ink); border: 1px solid var(--sea-100); }
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--sea-100); color: var(--navy-700); }
:root[data-theme="dark"] .badge { color: var(--sea-400); }
.badge-ok { background: var(--ok-bg); color: var(--ok); } .badge-warn { background: var(--warn-bg); color: var(--warn); } .badge-bad { background: var(--bad-bg); color: var(--bad); }

/* ---------- Landing / sign-in ---------- */
.landing { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--bg); }
.landing-hero { position: relative; overflow: hidden; color: #fff; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(1200px 600px at 10% 110%, rgba(74, 168, 216, .35), transparent 60%), linear-gradient(160deg, var(--navy-800), var(--navy-900)); }
.landing-hero .brand { display: flex; align-items: center; gap: 12px; font-weight: 600; letter-spacing: .08em; font-size: 14px; }
.landing-hero .brand img { width: 36px; height: 36px; filter: invert(1); }
.landing-hero h1 { font-size: clamp(32px, 4vw, 52px); font-weight: 700; letter-spacing: .02em; margin: 0 0 16px; }
.landing-hero .tag { display: inline-flex; align-items: center; gap: 8px; border: 1px solid rgba(255, 255, 255, .35); border-radius: 999px; padding: 6px 14px; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; }
.landing-hero .waves { position: absolute; left: 0; right: 0; bottom: 0; height: 160px; opacity: .22; pointer-events: none; }
.landing-hero footer { font-size: 12px; opacity: .7; position: relative; }
.landing-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.signin { width: 100%; max-width: 400px; }
.signin h2 { font-size: 24px; margin-bottom: 6px; }
.signin .steps { display: flex; gap: 6px; margin: 18px 0 26px; }
.signin .steps span { flex: 1; height: 4px; border-radius: 4px; background: var(--line); }
.signin .steps span.on { background: var(--sea-500); }
.code-input { font-size: 26px !important; letter-spacing: .5em; text-align: center; font-variant-numeric: tabular-nums; }
.qr { display: flex; gap: 18px; align-items: center; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 18px; }
.qr img { width: 150px; height: 150px; border-radius: 6px; background: #fff; padding: 6px; }
.qr code { font-size: 12px; word-break: break-all; }
ol.howto { padding-left: 20px; margin: 0 0 18px; color: var(--ink-2); font-size: 14px; }
.pw-rules { font-size: 13px; color: var(--ink-2); margin: -8px 0 16px; }
@media (max-width: 860px) {
  .landing { grid-template-columns: 1fr; }
  .landing-hero { padding: 28px 20px 36px; min-height: 0; }
  .landing-hero h1 { margin-top: 28px; }
  .landing-hero footer { display: none; }
}

/* ---------- App shell ---------- */
.topbar { position: sticky; top: 0; z-index: 50; background: var(--navy-800); color: #fff; box-shadow: 0 2px 10px rgba(7, 26, 51, .2); }
.topbar-inner { max-width: 1440px; margin: 0 auto; display: flex; align-items: center; gap: 8px; padding: 0 20px; height: 60px; }
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .08em; font-size: 13px; color: #fff; text-decoration: none; margin-right: 18px; white-space: nowrap; }
.topbar .brand img { width: 28px; height: 28px; filter: invert(1); }
.nav { display: flex; align-items: stretch; height: 100%; gap: 2px; flex: 1; }
.nav-item { position: relative; display: flex; }
.nav-item > button { font: inherit; font-size: 14px; color: rgba(255, 255, 255, .82); background: none; border: 0; padding: 0 14px; cursor: pointer; display: flex; align-items: center; gap: 6px; border-bottom: 3px solid transparent; }
.nav-item > button:hover, .nav-item.open > button { color: #fff; background: rgba(255, 255, 255, .06); }
.nav-item.active > button { color: #fff; border-bottom-color: var(--sea-500); }
.nav-item .caret { width: 10px; height: 10px; opacity: .7; }
.menu { position: absolute; top: 100%; left: 0; min-width: 230px; background: var(--card); color: var(--ink); border-radius: 0 0 var(--radius) var(--radius); box-shadow: var(--shadow-lg); padding: 6px; display: none; }
.nav-item.open .menu, .account.open .menu { display: block; }
.menu a, .menu button { display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: 6px; color: var(--ink); text-decoration: none; font: inherit; font-size: 14px; background: none; border: 0; cursor: pointer; }
.menu a:hover, .menu button:hover, .menu a.current { background: var(--sea-50); }
.menu .sep { height: 1px; background: var(--line); margin: 6px 4px; }
.menu small { display: block; color: var(--ink-3); font-size: 12px; }
.account { position: relative; display: flex; align-items: center; }
.account > button { display: flex; align-items: center; gap: 10px; color: #fff; background: none; border: 0; font: inherit; font-size: 14px; cursor: pointer; padding: 6px 8px; border-radius: 8px; }
.account > button:hover { background: rgba(255, 255, 255, .08); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--sea-500); color: var(--navy-900); display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.account .menu { left: auto; right: 0; border-radius: var(--radius); margin-top: 8px; }
.burger { display: none; background: none; border: 0; color: #fff; padding: 8px; cursor: pointer; }
.role-pill { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; opacity: .75; }

main.page { max-width: 1440px; margin: 0 auto; padding: 28px 20px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head p { margin: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 22px; }
.placeholder { text-align: center; padding: 60px 20px; }
.placeholder .icon { font-size: 34px; opacity: .5; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-weight: 600; padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--bg-2); white-space: nowrap; }
table.data td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--sea-50); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.row-actions.nowrap { display: grid; grid-template-columns: auto auto; gap: 4px; white-space: nowrap; }
.row-actions.nowrap > :nth-child(3) { grid-column: 1 / -1; justify-self: start; }
.row-actions.nowrap .btn { padding-left: 6px; padding-right: 6px; justify-content: center; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar > input, .toolbar > select { width: auto; min-width: 180px; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: flex-end; margin-top: 14px; color: var(--ink-2); font-size: 14px; }

/* ---------- Dialogs & toasts ---------- */
dialog { border: 0; border-radius: var(--radius-lg); padding: 0; width: min(520px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); background: var(--card); color: var(--ink); }
dialog::backdrop { background: rgba(7, 26, 51, .45); }
dialog form, dialog .dlg { padding: 24px; }
dialog .dlg-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.toast-stack { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: var(--navy-800); color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 14px; max-width: 360px; animation: slidein .2s ease-out; }
.toast.error { background: var(--bad); }
@keyframes slidein { from { transform: translateY(10px); opacity: 0; } }
.pw-row { display: flex; gap: 8px; } .pw-row input { flex: 1; }

/* ---------- Responsive shell ---------- */
@media (max-width: 1000px) {
  .burger { display: block; }
  .nav { display: none; position: absolute; top: 60px; left: 0; right: 0; flex-direction: column; background: var(--navy-800); height: auto; padding: 8px; box-shadow: var(--shadow-lg); }
  .nav.open { display: flex; }
  .nav-item { flex-direction: column; }
  .nav-item > button { padding: 12px; border-bottom: 0; border-left: 3px solid transparent; }
  .nav-item.active > button { border-left-color: var(--sea-500); }
  .menu { position: static; box-shadow: none; background: rgba(255, 255, 255, .04); border-radius: 8px; }
  .menu a, .menu button { color: #fff; } .menu a:hover, .menu a.current { background: rgba(255, 255, 255, .08); }
  .menu small { color: rgba(255, 255, 255, .55); }
  .topbar .brand span { display: none; }
  .account .name { display: none; }
  .account .menu a, .account .menu button { color: var(--ink); }
}
@media (max-width: 640px) { main.page { padding: 18px 16px 48px; } h1 { font-size: 23px; } .toolbar > input, .toolbar > select { min-width: 0; width: 100%; } }
.mt-14 { margin-top: 14px; }
#userEmail { padding: 8px 12px 4px; }
.account { margin-left: auto; }

/* ---------- Search ---------- */
.filters { margin-bottom: 18px; }
.filter-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .filter-row { grid-template-columns: 1fr 1fr; } }
.filter-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.filters .switch { margin-top: 14px; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.switch input { width: 16px; height: 16px; accent-color: var(--navy-600); }
.ms { position: relative; }
.ms-btn { width: 100%; display: flex; align-items: center; gap: 8px; text-align: left; font: inherit; font-size: 14px; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; cursor: pointer; min-height: 44px; }
.ms-btn:hover { border-color: var(--sea-500); }
.ms.has-value .ms-btn { border-color: var(--sea-500); background: var(--sea-50); }
.ms-label { font-size: 12px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.ms-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-caret { color: var(--ink-3); font-size: 11px; }
.ms-pop { display: none; position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; width: max(100%, 300px); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 10px; }
.ms.open .ms-pop { display: block; }
.ms-filter { margin-bottom: 8px; }
.ms-list { max-height: 280px; overflow: auto; }
.ms-opt { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.ms-opt:hover { background: var(--sea-50); }
.ms-opt input { width: 16px; height: 16px; accent-color: var(--navy-600); flex: none; }
.ms-opt span:nth-child(2) { flex: 1; }
.ms-n { font-size: 12px; color: var(--ink-3); }
.ms-empty { padding: 8px; }
.ms-foot { display: flex; justify-content: space-between; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.results-bar { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin: 6px 0 16px; }
.results-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; flex: 1; min-width: 260px; }
.results-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.result-count { font-size: 15px; color: var(--ink-2); white-space: nowrap; }
.result-count b { font-size: 22px; color: var(--ink); margin-right: 2px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--navy-800); color: #fff; border-radius: 999px; padding: 4px 4px 4px 12px; font-size: 13px; }
:root[data-theme="dark"] .chip { background: var(--sea-100); }
.chip button { background: rgba(255, 255, 255, .15); color: #fff; border: 0; width: 22px; height: 22px; border-radius: 50%; cursor: pointer; font-size: 15px; line-height: 1; }
.chip button:hover { background: rgba(255, 255, 255, .3); }
select.sort { width: auto; padding: 7px 10px; font-size: 13px; }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg { font: inherit; font-size: 13px; padding: 6px 12px; border: 0; background: var(--card); color: var(--ink-2); cursor: pointer; }
.seg.on { background: var(--navy-800); color: #fff; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.contact-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; transition: box-shadow .15s, border-color .15s; }
.contact-card:hover { border-color: var(--sea-400); box-shadow: var(--shadow-lg); }
.contact-card header { display: flex; justify-content: space-between; gap: 10px; }
.cc-name { font-size: 17px; font-weight: 600; color: var(--ink); text-decoration: none; }
.cc-name:hover { color: var(--navy-600); text-decoration: underline; }
.cc-company { font-weight: 600; color: var(--navy-600); }
:root[data-theme="dark"] .cc-company { color: var(--sea-400); }
.cc-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.badge-soft { background: var(--bg-2); color: var(--ink-2); border: 1px solid var(--line); }
.cc-meta { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.cc-meta > div { display: flex; align-items: center; gap: 4px; min-width: 0; }
.cc-meta a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-ico { width: 20px; color: var(--ink-3); flex: none; text-align: center; }
.contact-card footer { display: flex; flex-wrap: wrap; row-gap: 8px; column-gap: 8px; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); }
.cc-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.cc-reviewed { margin-top: -4px; }
.stars { color: var(--star); letter-spacing: 1px; white-space: nowrap; }
.is-deleted { opacity: .6; }
.icon-btn { background: none; border: 0; font-size: 22px; line-height: 1; cursor: pointer; color: var(--ink-3); padding: 2px; }
.icon-btn.fav.on { color: var(--star); }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--navy-600); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
:root[data-theme="dark"] .link-btn { color: var(--sea-400); }
.phone { position: relative; display: inline-flex; align-items: center; gap: 2px; }
.phone .menu { top: calc(100% + 4px); border-radius: var(--radius); min-width: 210px; z-index: 30; }
.phone.open .menu { display: block; }
table.data.compact td, table.data.compact th { padding: 9px 8px; }
.saved-list { display: grid; gap: 12px; }
.saved-item { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.saved-item h3 { margin: 0 0 4px; } .saved-item p { margin: 0; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.detail-grid dl { margin: 0; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: 0; }
.kv dt { color: var(--ink-3); font-size: 13px; } .kv dd { margin: 0; word-break: break-word; }
.card.internal { background: var(--warn-bg); border-color: transparent; }
.prewrap { white-space: pre-wrap; }

/* ---------- Map ---------- */
.map-wrap { position: relative; padding: 0; overflow: hidden; }
.map { height: calc(100vh - 230px); min-height: 420px; }
.legend { position: absolute; z-index: 500; left: 12px; bottom: 24px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 10px 12px; font-size: 12px; max-width: 260px; max-height: 50%; overflow: auto; }
.legend:empty { display: none; }
.legend-title { font-weight: 700; margin-bottom: 6px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-size: 11px; }
.legend-row { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .15); flex: none; }
.map-status { margin-top: 10px; }
.map-pop { display: grid; gap: 4px; font: 13px var(--font); }
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large { background-color: rgba(74, 168, 216, .35) !important; }
.marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div { background-color: var(--navy-700) !important; color: #fff !important; font-weight: 700; }
.leaflet-container { font-family: var(--font); background: #aad3df; }
@media (max-width: 1000px) { .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .detail-grid { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .filter-row, .filter-grid { grid-template-columns: 1fr; } .kv { grid-template-columns: 1fr; gap: 2px; } .card-grid { grid-template-columns: 1fr; } }
.phone .link-btn { white-space: nowrap; }

/* ---------- Batch upload ---------- */
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 34px 20px; border: 2px dashed var(--sea-400); border-radius: var(--radius-lg); background: var(--sea-50); text-align: center; cursor: pointer; margin-bottom: 18px; transition: background .15s; }
.dropzone:hover, .dropzone.over { background: var(--sea-100); }
.dz-icon { font-size: 30px; color: var(--navy-600); }
.steps-line { display: flex; gap: 10px; flex-wrap: wrap; list-style: none; padding: 0; margin: 0 0 16px; counter-reset: s; }
.steps-line li { counter-increment: s; display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px 6px 6px; }
.steps-line li::before { content: counter(s); display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--navy-800); color: #fff; font-size: 12px; font-weight: 700; }
.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--bg-2); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; }
.stat b { font-size: 26px; } .stat span { font-size: 13px; color: var(--ink-2); }
.stat.ok b { color: var(--ok); } .stat.bad b { color: var(--bad); } .stat.warn b { color: var(--warn); }
.txt-bad { color: var(--bad); } .txt-warn { color: var(--warn); }
.commit-bar { display: flex; justify-content: flex-end; gap: 10px; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.commit-bar select { width: auto; }
.mt-28 { margin-top: 28px; }
@media (max-width: 640px) { .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.picker { position: relative; }
.picker-list { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; max-height: 320px; overflow: auto; }
.picker-item { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 6px; font: inherit; color: var(--ink); cursor: pointer; }
.picker-item:hover { background: var(--sea-50); }
.form-group { border: 0; padding: 0; margin: 0 0 18px; }
.form-group legend { font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin-bottom: 10px; padding: 0; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 16px; }
.span-2 { grid-column: span 2; } .span-all { grid-column: 1 / -1; margin: 8px 0 0; }
textarea { resize: vertical; }
.card.narrow { max-width: 720px; }
.chosen { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; background: var(--sea-50); border: 1px solid var(--sea-100); border-radius: 8px; padding: 10px 12px; }
@media (max-width: 900px) { .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } .span-2 { grid-column: auto; } }
dialog.wide { width: min(860px, calc(100vw - 32px)); }
table.compare td.before { color: var(--ink-2); text-decoration: line-through; text-decoration-color: rgba(192, 57, 43, .5); }
table.compare td.after { font-weight: 600; background: var(--ok-bg); }
.break { word-break: break-all; }
.mb-18 { margin-bottom: 18px; }

/* ---------- Dashboard ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { display: flex; flex-direction: column; gap: 2px; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px 16px; box-shadow: var(--shadow); font: inherit; color: var(--ink); }
button.kpi { cursor: pointer; } button.kpi:hover { border-color: var(--sea-400); }
.kpi-label { font-size: 13px; color: var(--ink-2); }
.kpi-value { font-size: 30px; font-weight: 700; letter-spacing: -.02em; }
.kpi-hint { font-size: 12px; color: var(--ink-3); }
.kpi.warn .kpi-value { color: var(--warn); }
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.dash-grid .card h3 { margin-bottom: 12px; }
.table-wrap.flat { box-shadow: none; border: 0; border-radius: 0; }
.bars { display: grid; gap: 4px; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 38%) 1fr 48px; align-items: center; gap: 10px; background: none; border: 0; padding: 4px 6px; border-radius: 6px; font: inherit; color: var(--ink); text-align: left; }
button.bar-row { cursor: pointer; } button.bar-row:hover { background: var(--sea-50); }
.bar-label { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 14px; }
.bar-fill { display: block; height: 100%; width: 0; background: #2a78d6; border-radius: 0 4px 4px 0; transition: width .4s ease-out; min-width: 2px; }
:root[data-theme="dark"] .bar-fill { background: #3987e5; }
.bar-val { font-size: 13px; color: var(--ink-2); text-align: right; font-variant-numeric: tabular-nums; }
.month-chart { width: 100%; height: auto; }
.mc-bar { fill: #2a78d6; } :root[data-theme="dark"] .mc-bar { fill: #3987e5; }
.month-chart g:hover .mc-bar { fill: var(--navy-600); }
.mc-axis { font-size: 11px; fill: var(--ink-3); } .mc-val { font-size: 11px; fill: var(--ink-2); }
.mc-base { stroke: var(--line); stroke-width: 1; }
.heat { height: 380px; border-radius: var(--radius); overflow: hidden; }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 800px) { .dash-grid { grid-template-columns: 1fr; } .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.dup-list { display: grid; gap: 8px; }
.dup-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); margin-top: 8px; flex-wrap: wrap; }
table.merge td.picked { background: var(--ok-bg); }
.outbox { display: grid; gap: 10px; }
.outbox summary { cursor: pointer; }
.mail-body { white-space: pre-wrap; font: 13px/1.5 var(--font); background: var(--bg-2); padding: 12px; border-radius: 8px; margin: 12px 0 0; }
table.data.compact td:first-child a { white-space: nowrap; }
[hidden] { display: none !important; }

/* "Appointed" filter: a plain select styled like the other filter boxes */
.ms-like { display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 0 0 0 12px; min-height: 44px; }
.ms-like select { flex: 1; border: 0; background: transparent; font: inherit; font-size: 14px; color: var(--ink); min-height: 42px; padding: 0 8px 0 0; }
.ms-like:focus-within { border-color: var(--sea-500); }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.appt-summary { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: baseline; margin-bottom: 10px; }
.appt-summary b { font-size: 22px; }
.cc-appt { font-size: 12px; color: var(--ink-2); }
.appt-link { background: none; border: 0; padding: 2px 0; font: inherit; font-size: 12px; font-weight: 600; color: #c62828; cursor: pointer; white-space: nowrap; }
.appt-link:hover, .appt-link:focus-visible { text-decoration: underline; }
:root[data-theme="dark"] .appt-link { color: #ff8a80; }
.cc-actions { align-items: center; }
/* Uploaded logo (Admin Center, then Branding): keep its own colours, allow wide logos. */
.brand img.brand-logo.custom { filter: none; width: auto; max-width: 160px; object-fit: contain; }
.brand img.brand-logo.custom.tile { background: #fff; border-radius: 6px; padding: 3px; }
.landing-hero .brand img.brand-logo.custom { height: 44px; max-width: 220px; }
.brand-preview { display: flex; flex-wrap: wrap; gap: 14px; margin: 10px 0 4px; }
.brand-preview .bp { border-radius: 10px; padding: 14px 18px; min-width: 260px; }
.brand-preview .bp-top { background: var(--navy-800, #0b2545); }
.brand-preview .bp-top .brand { margin: 0; }
.brand-preview .bp-label { font-size: 12px; color: var(--ink-3); margin-bottom: 4px; }
.brand-form { display: grid; gap: 12px; max-width: 560px; }
.brand-form label { display: grid; gap: 4px; font-weight: 600; font-size: 14px; }
.brand-form .check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.bp-top .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .08em; font-size: 13px; color: #fff; }
.bp-top .brand img { width: 28px; height: 28px; filter: invert(1); }
.bp-top .brand img.brand-logo.custom { filter: none; width: auto; height: 28px; }

/* ---------- Log-in page (v1.17): white left with the form, dark blue (or photo) right ---------- */
.landing-v2 { grid-template-columns: 1fr 1fr; }
.landing-left { background: #fff; color: var(--ink); display: flex; flex-direction: column; min-height: 100vh; padding: 40px 56px 32px; }
:root[data-theme="dark"] .landing-left { background: var(--bg); }
.landing-left .brand { display: flex; align-items: center; gap: 12px; font-weight: 700; letter-spacing: .08em; font-size: 14px; color: var(--navy-800); }
:root[data-theme="dark"] .landing-left .brand { color: var(--ink); }
.landing-left .brand img { width: 44px; height: 44px; }
:root[data-theme="dark"] .landing-left .brand img.brand-logo:not(.custom) { filter: invert(1); }
/* An uploaded logo sits on a dark blue tile so white logos show on the white page. */
.landing-left .brand img.brand-logo.custom { width: auto; height: 56px; max-width: 240px; object-fit: contain; filter: none; box-sizing: border-box; padding: 7px; border-radius: 12px; background: var(--navy-800); }
.landing-left .brand img.brand-logo.custom.tile { background: #fff; border: 1px solid var(--line); }
.landing-mid { flex: 1; display: flex; align-items: center; padding: 32px 0; }
.landing-left .signin h1 { font-size: clamp(26px, 2.6vw, 34px); font-weight: 700; letter-spacing: .02em; color: var(--navy-800); margin: 0 0 26px; line-height: 1.15; }
:root[data-theme="dark"] .landing-left .signin h1 { color: var(--ink); }
.landing-left .signin h2 { margin-bottom: 4px; }
.landing-bottom { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.landing-bottom .tag { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; max-width: 400px; box-sizing: border-box; border: 1px solid var(--line); color: var(--navy-800); border-radius: 8px; padding: 6px 14px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
:root[data-theme="dark"] .landing-bottom .tag { color: var(--ink); }
.landing-bottom footer { font-size: 12px; color: var(--ink-2); }
.landing-art { position: relative; overflow: hidden; min-height: 100vh;
  background: radial-gradient(1200px 600px at 10% 110%, rgba(74, 168, 216, .35), transparent 60%), linear-gradient(160deg, var(--navy-800), var(--navy-900)); }
.landing-art .waves { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 160px; opacity: .22; pointer-events: none; }
.landing-art.has-photo { background-size: cover; background-position: center; background-repeat: no-repeat; }
.landing-art.has-photo .waves { display: none; }
@media (max-width: 860px) {
  .landing-v2 { grid-template-columns: 1fr; }
  .landing-art { display: none; }
  .landing-left { padding: 24px 20px; }
}
/* Branding page: mini preview of the log-in page */
.lp-mini { display: grid; grid-template-columns: 1fr 1fr; width: 420px; max-width: 100%; height: 230px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-top: 4px; }
.lp-mini-left { background: #fff; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.lp-mini-brand { display: flex; align-items: center; gap: 6px; font-size: 9px; font-weight: 700; letter-spacing: .08em; color: var(--navy-800); }
.lp-mini-brand img { width: 22px; height: 22px; }
.lp-mini-brand img.brand-logo.custom { width: auto; height: 26px; max-width: 110px; object-fit: contain; padding: 3px; border-radius: 6px; background: var(--navy-800); box-sizing: border-box; }
.lp-mini-brand img.brand-logo.custom.tile { background: #fff; border: 1px solid var(--line); }
.lp-mini-name { margin-top: 18px; font-size: 12px; font-weight: 700; color: var(--navy-800); line-height: 1.2; }
.lp-mini-h { font-size: 10px; font-weight: 600; color: var(--navy-800); }
.lp-mini-left i { display: block; height: 13px; border: 1px solid var(--line); border-radius: 3px; }
.lp-mini-left u { display: block; height: 13px; background: var(--navy-800); border-radius: 3px; }
.lp-mini-art { background: radial-gradient(400px 200px at 10% 110%, rgba(74, 168, 216, .35), transparent 60%), linear-gradient(160deg, var(--navy-800), var(--navy-900)); }
.lp-mini-art.has-photo { background-size: cover; background-position: center; }
a.strong { font-weight: 600; }
/* v1.18 companies with several contact persons */
.mb-14 { margin-bottom: 14px; }
.mt-8 { margin-top: 8px; }
tr.is-current td { background: var(--tint, #eef4fa); }
:root[data-theme="dark"] tr.is-current td { background: rgba(255,255,255,.06); }
dialog .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; }
@media (max-width: 640px) { dialog .form-grid { grid-template-columns: 1fr; } }
.plain-list { list-style: none; padding: 0; margin: 0; }
.plain-list li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.plain-list li:last-child { border-bottom: 0; }
.plain-list .badge { margin-left: 8px; }
/* v1.19 company cards and key contact */
.ap-tab { display: flex; align-items: center; gap: 6px; width: 100%; margin-top: 10px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card, #fff); font: inherit; font-weight: 600; font-size: 13px; color: var(--navy-800); cursor: pointer; text-align: left; }
:root[data-theme="dark"] .ap-tab { color: var(--ink); background: transparent; }
.ap-tab .n { background: var(--navy-800); color: #fff; border-radius: 10px; padding: 0 7px; font-size: 12px; }
.ap-list { margin-top: 6px; }
.ap-list .p { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.ap-list .p:last-child { border-bottom: 0; }
.ap-list .badge-ok { margin-left: 6px; }
.match { display: inline-block; background: var(--warn-bg); color: var(--warn); border-radius: 6px; padding: 0 6px; font-size: 11px; font-weight: 600; margin-left: 6px; }
.cc-person { font-weight: 700; }
td.center { text-align: center; }
td.nowrap, td.nowrap .link-btn { white-space: nowrap; }
.key-tick { width: 18px; height: 18px; cursor: pointer; }
.ml-6 { margin-left: 6px; }
td.email-cell { max-width: 190px; overflow-wrap: break-word; }
.ap-tab { flex-wrap: wrap; } .ap-tab > span.muted { flex-basis: 100%; padding-left: 14px; font-weight: 400; }
/* v1.20 Sign in with Microsoft */
.btn-ms { display: flex; align-items: center; justify-content: center; gap: 10px; background: #fff; color: #1f1f1f; border: 1px solid #8c8c8c; font-weight: 600; text-decoration: none; margin: 4px 0 6px; }
.btn-ms:hover { background: #f3f3f3; }
.ms-logo { display: grid; grid-template-columns: 9px 9px; gap: 2px; }
.ms-logo i { width: 9px; height: 9px; display: block; }
.ms-logo i:nth-child(1) { background: #f25022; } .ms-logo i:nth-child(2) { background: #7fba00; } .ms-logo i:nth-child(3) { background: #00a4ef; } .ms-logo i:nth-child(4) { background: #ffb900; }
.or { display: flex; align-items: center; gap: 10px; color: var(--ink-3); font-size: 12px; margin: 12px 0 6px; }
.or::before, .or::after { content: ''; flex: 1; border-top: 1px solid var(--line); }
.radio-list { display: grid; gap: 8px; }
.radio-card { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.radio-card input { margin-top: 3px; }
.radio-card span { display: grid; gap: 2px; }
.radio-card:has(input:checked) { border-color: var(--sea, #1d6fa3); background: var(--tint, #eef4fa); }
:root[data-theme="dark"] .radio-card:has(input:checked) { background: rgba(255,255,255,.05); }
.checks { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 4px; }
.checks .ok { color: var(--ok); } .checks .todo { color: var(--ink-3); }
.form-grid.two { grid-template-columns: 1fr 1fr; }
label.check.big { display: flex; gap: 8px; align-items: center; font-size: 15px; margin: 6px 0; }
/* v1.22 log-in buttons: [Log In] or [Microsoft logo], with hover tips */
.login-or { display: flex; align-items: center; justify-content: center; gap: 22px; margin-top: 10px; }
.login-or .btn-primary { min-width: 140px; }
.or-word { color: var(--ink-3); font-size: 14px; }
.ms-square { display: inline-flex; padding: 4px; border-radius: 6px; line-height: 0; }
.ms-square:hover, .ms-square:focus-visible { outline: 2px solid var(--sea, #1d6fa3); outline-offset: 2px; }
.ms-logo.big { grid-template-columns: 20px 20px; gap: 3px; }
.ms-logo.big i { width: 20px; height: 20px; }
.tip { position: relative; display: inline-flex; }
.tip-text { position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%); background: #1f2937; color: #fff; font-size: 12px; font-weight: 500; line-height: 1.35; padding: 7px 10px; border-radius: 6px; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .12s; z-index: 5; }
.tip-text::after { content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 6px solid transparent; border-top-color: #1f2937; }
.tip:hover .tip-text, .tip:focus-within .tip-text { opacity: 1; }
p.center { text-align: center; margin-top: 12px; }
