:root {
  --bg: #f5f8fa; --card: #fff; --text: #213343; --muted: #6b7f92; --line: #dfe3eb; --line2: #eaf0f6;
  --side: #213343; --side2: #2d4458; --accent: #ff7a59; --accent2: #ff5c35; --teal: #00a4bd; --purple: #7c62d7;
  --green: #00bda5; --red: #f2545b; --yellow: #f5c26b; --radius: 8px; --shadow: 0 1px 3px rgba(33,51,67,.08), 0 1px 2px rgba(33,51,67,.04);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--text); font-size: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
a { color: #0068b1; text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin: 0; font-weight: 600; } h2 { font-size: 20px; margin: 0; } h3 { margin: 0 0 6px; } h4 { margin: 0 0 12px; font-size: 14px; font-weight: 600; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .center { text-align: center; } .right { text-align: right; } .mt { margin-top: 14px; } .pad { padding: 24px; }
.hidden { display: none !important; } .spacer { flex: 1; } .neg, .overdue { color: var(--red) !important; } .done { text-decoration: line-through; color: var(--muted); }
.clamp { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }

/* buttons & inputs */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 6px; border: 1px solid #cbd6e2; background: #fff; color: var(--text); font: 500 13px inherit; font-family: inherit; cursor: pointer; white-space: nowrap; text-decoration: none !important; }
.btn:hover { background: #f5f8fa; } .btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; } .btn.primary:hover { background: var(--accent2); }
.btn.danger { color: var(--red); border-color: #f5c0c3; } .btn.danger:hover { background: #fdeeef; }
.btn.sm { padding: 5px 10px; font-size: 12px; } .btn.block { width: 100%; justify-content: center; padding: 11px; font-size: 14px; }
.btn.ghost { background: transparent; color: #cbd6e2; border-color: #3f5a72; } .btn.ghost:hover { background: var(--side2); }
.icon-btn { border: 0; background: transparent; cursor: pointer; padding: 4px 7px; border-radius: 4px; color: var(--muted); font-size: 14px; } .icon-btn:hover { background: var(--line2); } .icon-btn:disabled { opacity: .3; }
.link-btn { border: 0; background: none; color: #0068b1; cursor: pointer; font: inherit; font-size: 12px; padding: 0 4px; } .link-btn:hover { text-decoration: underline; }
input, select, textarea { font: inherit; color: inherit; padding: 8px 10px; border: 1px solid #cbd6e2; border-radius: 6px; background: #f5f8fa; width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(0,164,189,.15); background: #fff; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--accent); } input:disabled { opacity: .7; }
textarea.code { font-family: ui-monospace, Menlo, monospace; font-size: 12px; background: #f5f8fa; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 400 !important; }
.field label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 5px; color: #33475b; } .req { color: var(--red); }
.picker { position: relative; } .picker input[role=combobox] { min-height: 44px; padding-right: 44px; }
.picker-clear { position: absolute; right: 0; top: 0; width: 44px; height: 44px; }
.picker-list { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 30; margin: 0; padding: 4px; list-style: none; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(33,51,67,.15); max-height: 280px; overflow-y: auto; }
.picker-list [role=option] { min-height: 44px; padding: 6px 10px; border-radius: 6px; cursor: pointer; display: flex; flex-direction: column; justify-content: center; overflow-wrap: anywhere; }
.picker-list [role=option]:hover, .picker-list [aria-selected=true] { background: var(--line2); } .picker-empty { padding: 12px 10px; }
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; margin-bottom: 14px; } .grid-form .full { grid-column: 1 / -1; }
.auth-card .field { margin-bottom: 14px; }

/* badges & avatars */
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; background: var(--line2); color: #425b76; white-space: nowrap; }
.b-customer, .b-done, .b-ok, .b-active, .b-closed, .b-stage-won { background: #e5f8f6; color: #00806f; }
.b-lead, .b-new, .b-subscriber { background: #e5f5f8; color: #007a8c; }
.b-mql, .b-sql, .b-opportunity, .b-in_progress { background: #efebfb; color: #5c45b8; }
.b-high, .b-stage-lost { background: #fdeeef; color: #c93a41; } .b-medium, .b-waiting_on_us { background: #fef6e7; color: #a86c00; } .b-low { background: var(--line2); }
.b-waiting_on_contact { background: #eef3f8; color: #425b76; } .b-stage-open { background: #fff1ed; color: #c4401f; }
.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: #fff; font-size: 12px; font-weight: 600; flex: none; vertical-align: middle; }
.avatar.sm { width: 26px; height: 26px; font-size: 10px; } .avatar.xs { width: 20px; height: 20px; font-size: 9px; } .avatar.lg { width: 56px; height: 56px; font-size: 18px; } .avatar.sq { border-radius: 8px; }

/* shell */
.shell { display: flex; min-height: 100vh; }
.side { width: 224px; background: var(--side); color: #dbe5ee; display: flex; flex-direction: column; padding: 14px 10px; position: sticky; top: 0; height: 100vh; flex: none; z-index: 20; }
.brand { display: block; padding: 6px 10px 10px; text-decoration: none !important; } .brand-logo { display: block; height: 44px; width: auto; }
.auth-logo { display: block; height: 64px; width: auto; margin: 0 auto 18px; } .auth-side-logo { display: block; height: 72px; width: auto; align-self: flex-start; }
.ws-name { font-size: 12px; color: #8fa6bb; padding: 0 10px 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 6px; color: #dbe5ee; text-decoration: none !important; margin-bottom: 2px; }
.nav:hover { background: var(--side2); } .nav.active { background: var(--side2); color: #fff; box-shadow: inset 3px 0 var(--accent); }
.nav-ico { width: 20px; text-align: center; }
.side-foot { margin-top: auto; border-top: 1px solid #3f5a72; padding-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.me { display: flex; gap: 8px; align-items: center; font-size: 13px; } .muted-inv { color: #8fa6bb; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { height: 56px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 0 24px; position: sticky; top: 0; z-index: 10; }
.burger { display: none; font-size: 20px; }
.side-close, .side-backdrop { display: none; }
.gsearch { position: relative; max-width: 520px; flex: 1; } .gsearch input { background: #f5f8fa; border-radius: 20px; padding-left: 16px; }
.gresults { position: absolute; top: 42px; left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(33,51,67,.15); overflow: hidden; }
.gres { display: block; padding: 10px 14px; border-bottom: 1px solid var(--line2); color: var(--text); text-decoration: none !important; } .gres:hover { background: #f5f8fa; }
.view { padding: 24px; max-width: 1500px; width: 100%; }

/* page */
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.count { display: inline-block; background: var(--line2); color: var(--muted); border-radius: 10px; padding: 1px 8px; font-size: 12px; font-weight: 600; vertical-align: middle; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tab { border: 0; background: none; padding: 10px 14px; cursor: pointer; font: 500 13px inherit; font-family: inherit; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); } .tabs.small .tab { padding: 8px 10px; font-size: 12px; }
.toolbar { display: flex; gap: 8px; margin-bottom: 12px; align-items: center; flex-wrap: wrap; }
.toolbar input[type=search] { max-width: 280px; background: #fff; } .toolbar select { width: auto; background: #fff; }
.bulk { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.crumbs { margin-bottom: 12px; font-size: 13px; }
.fc-card { border-left: 3px solid var(--yellow); } .fc-list { list-style: none; margin: 0 0 12px; padding: 0; }
.fc-list li { padding: 6px 0; border-top: 1px solid var(--line2); } .fc-list label { display: flex; gap: 10px; align-items: flex-start; min-height: 44px; cursor: pointer; overflow-wrap: anywhere; }
.fc-list input { margin-top: 3px; flex: none; } .fc-warn { display: block; color: #b25e09; }
.sec-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; } .sec-head h4 { margin: 0; }

/* table */
.table-wrap { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #f5f8fa; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th.sortable { cursor: pointer; } .table th.sortable:hover { color: var(--text); }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line2); vertical-align: middle; }
.rec-table td { white-space: nowrap; } /* scroll sideways inside .table-wrap instead of wrapping phones/emails */
.table tr:hover td { background: #fafcfd; } .table .chk { width: 36px; }
.card .table th:first-child, .card .table td:first-child { padding-left: 16px; }
.rec-link { font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.pager { display: flex; justify-content: flex-end; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.empty { text-align: center; padding: 48px 20px; } .empty-ico { font-size: 40px; margin-bottom: 8px; }

/* modal */
.modal-wrap { position: fixed; inset: 0; background: rgba(33,51,67,.55); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 100; overflow-y: auto; animation: fade .12s; }
.modal { background: #fff; border-radius: 10px; width: 100%; max-width: 480px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { max-width: 720px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; background: var(--side); color: #fff; border-radius: 10px 10px 0 0; }
.modal-head h3 { margin: 0; font-size: 16px; } .modal-head .icon-btn { color: #fff; } .modal-head .icon-btn:hover { background: var(--side2); }
.modal-body { padding: 20px; } .modal-foot { display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line2); padding-top: 14px; margin-top: 6px; }
@keyframes fade { from { opacity: 0; } }

/* toasts */
#toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: var(--side); color: #fff; padding: 11px 16px; border-radius: 6px; box-shadow: 0 6px 20px rgba(0,0,0,.2); font-size: 13px; max-width: 360px; border-left: 4px solid var(--green); transition: opacity .4s, transform .4s; }
.toast.err { border-left-color: var(--red); } .toast.hide { opacity: 0; transform: translateY(8px); }
.form-err { margin: 0 0 12px; padding: 8px 12px; border-radius: 6px; background: #fdeeef; color: #b3262d; font-size: 13px; }
.form-err .clash-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

/* auth */
.auth { display: flex; min-height: 100vh; }
.auth-side { flex: 1; background: linear-gradient(150deg, #213343, #2d4458 60%, #ff7a59 160%); color: #fff; padding: 64px; display: flex; flex-direction: column; justify-content: center; }
.auth-side h2 { font-size: 30px; line-height: 1.25; margin: 24px 0; max-width: 460px; } .auth-side ul { padding-left: 20px; line-height: 2; color: #dbe5ee; }
.logo-lg { font-size: 26px; font-weight: 700; color: var(--accent); }
.auth-main { flex: 1; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 400px; } .auth-card h1 { margin-bottom: 20px; } .auth > .auth-card { margin: auto; text-align: center; }

/* dashboard */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; color: var(--text); text-decoration: none !important; box-shadow: var(--shadow); transition: border-color .15s; }
.kpi:hover { border-color: var(--accent); } .kpi-l { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kpi-v { font-size: 28px; font-weight: 700; margin: 6px 0 2px; } .kpi-s { font-size: 12px; color: var(--muted); }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); gap: 0 16px; }
.hbars { display: flex; flex-direction: column; gap: 9px; }
.hbar { display: grid; grid-template-columns: 150px 1fr 70px; gap: 10px; align-items: center; font-size: 12px; }
.hbar-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .hbar-t { background: var(--line2); border-radius: 4px; height: 14px; overflow: hidden; }
.hbar-f { height: 100%; border-radius: 4px; min-width: 2px; } .hbar-v { text-align: right; font-weight: 600; }
.cols { display: flex; align-items: flex-end; gap: 6px; height: 180px; padding-top: 16px; }
.col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.col-b { width: 100%; max-width: 36px; background: var(--teal); border-radius: 4px 4px 0 0; min-height: 2px; } .col-v { font-size: 11px; font-weight: 600; margin-bottom: 3px; }
.col-l { font-size: 10px; color: var(--muted); margin-top: 4px; white-space: nowrap; }
.rel-item { display: block; padding: 9px 0; border-bottom: 1px solid var(--line2); color: var(--text); text-decoration: none !important; } .rel-item:last-child { border-bottom: 0; }
a.rel-item:hover b { color: #0068b1; }

/* board */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 16px; align-items: flex-start; min-height: 60vh; }
.lane { background: #eaf0f6; border-radius: var(--radius); width: 270px; flex: none; display: flex; flex-direction: column; max-height: calc(100vh - 210px); border-top: 3px solid #99afc4; }
.lane.k-won { border-top-color: var(--green); } .lane.k-lost { border-top-color: var(--red); } .lane.over { background: #dde7f1; outline: 2px dashed var(--teal); }
.lane-head { padding: 12px; } .lane-body { padding: 0 8px 8px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.deal-card { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 12px; cursor: grab; box-shadow: var(--shadow); }
.deal-card:hover { border-color: #99afc4; } .deal-card.dragging { opacity: .4; }
.deal-move { display: none; } @media (any-pointer: coarse) { .deal-move { display: block; width: 100%; margin-top: 8px; min-height: 44px; } }
.deal-name { font-weight: 600; display: block; margin-bottom: 4px; } .deal-amt { font-weight: 600; margin-bottom: 2px; }
.deal-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.lane-add { border: 1px dashed #b6c7d6; background: transparent; padding: 8px; border-radius: 6px; cursor: pointer; color: var(--muted); font: inherit; } .lane-add:hover { background: #fff; color: var(--text); }

/* detail */
.detail { display: grid; grid-template-columns: 320px minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.d-head { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; } .d-head h2 { word-break: break-word; }
.quick { display: flex; justify-content: space-between; gap: 6px; padding: 12px 0; border-top: 1px solid var(--line2); border-bottom: 1px solid var(--line2); margin-bottom: 14px; }
.qa { display: flex; flex-direction: column; align-items: center; gap: 4px; border: 0; background: none; cursor: pointer; font-size: 18px; color: var(--text); text-decoration: none !important; font-family: inherit; }
.qa span { font-size: 11px; color: var(--muted); } .qa:hover span { color: var(--accent); }
.props { display: flex; flex-direction: column; gap: 10px; } .prop-l { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; } .prop-v { word-break: break-word; }
.composer textarea { margin: 0 0 10px; background: #fff; }
.timeline { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line2); } .tl-item:last-child { border-bottom: 0; }
.tl-ico { width: 32px; height: 32px; border-radius: 50%; background: var(--line2); display: grid; place-items: center; flex: none; font-size: 14px; }
.tl-body { flex: 1; min-width: 0; } .tl-meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; } .tl-meta b { color: var(--text); }
.tl-text { white-space: normal; word-break: break-word; } .t-system .tl-text { color: var(--muted); font-size: 13px; }
.files { display: flex; flex-direction: column; gap: 6px; }
.file { display: flex; gap: 10px; align-items: center; padding: 8px; border: 1px solid var(--line2); border-radius: 6px; } .file-ico { font-size: 20px; } .file-info { flex: 1; min-width: 0; } .file-info a { word-break: break-all; }
.stagebar { display: flex; gap: 2px; margin-bottom: 14px; overflow-x: auto; }
.stage-step { flex: 1; min-width: 110px; border: 0; padding: 9px 10px; background: #eaf0f6; cursor: pointer; font: 500 12px inherit; font-family: inherit; color: var(--muted); clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-step:first-child { clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%); }
.stage-step:hover { background: #dbe5ee; } .stage-step.active { background: var(--accent); color: #fff; } .stage-step.active.k-won { background: var(--green); } .stage-step.active.k-lost { background: var(--red); }

/* forms builder & settings */
.form-builder { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.fb-row { display: grid; grid-template-columns: 1.3fr 1fr 110px auto auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line2); }
.fb-row .full { grid-column: 1 / -1; } .fb-btns { white-space: nowrap; }
.copy-row { display: flex; gap: 8px; }
.settings { max-width: 900px; } .settings .table td { padding: 8px 10px; } .settings .table input, .settings .table select { padding: 5px 8px; }

/* responsive */
@media (max-width: 1200px) { .detail { grid-template-columns: 300px minmax(0, 1fr); } .d-right { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 16px; } }
@media (max-width: 900px) {
  .side { position: fixed; left: -240px; visibility: hidden; transition: left .2s, visibility 0s .2s; box-shadow: 0 0 40px rgba(0,0,0,.3); } .side.open { left: 0; visibility: visible; transition: left .2s; }
  .side-close { display: block; position: absolute; top: 10px; right: 8px; color: #dbe5ee; font-size: 18px; }
  .side-backdrop.open { display: block; position: fixed; inset: 0; background: rgba(33,51,67,.45); z-index: 19; }
  .burger { display: block; } .view { padding: 16px; } .top { padding: 0 16px; }
  .detail, .form-builder { grid-template-columns: 1fr; } .dash-grid { grid-template-columns: 1fr; }
  .auth-side { display: none; } .grid-form { grid-template-columns: 1fr; } .hbar { grid-template-columns: 100px 1fr 60px; }
  .fb-row { grid-template-columns: 1fr 1fr; }
}

/* ================= dashboards ================= */
.dash { background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.dash-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 24px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.dash-title { display: flex; align-items: center; gap: 6px; min-width: 0; }
.dash-title h1 { font-size: 24px; display: inline; }
.star { font-size: 20px; color: var(--muted); } .star.on { color: var(--accent); }
.link-strong { background: none; border: 0; font: 600 13px inherit; font-family: inherit; color: var(--text); cursor: pointer; padding: 6px 4px; text-decoration: none !important; }
.link-strong:hover { color: #0068b1; }
.btn.pill { border-radius: 18px; }
.vsep { width: 1px; height: 22px; background: var(--text); opacity: .6; }
.danger-text { color: var(--red) !important; }
/* dropdowns built on <details> */
details.dd { position: relative; }
details.dd > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
details.dd > summary::-webkit-details-marker { display: none; }
.caret { color: var(--text); font-size: 16px; }
.dd-menu { position: absolute; top: calc(100% + 4px); left: 0; min-width: 220px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(33,51,67,.15); padding: 6px; z-index: 30; display: flex; flex-direction: column; max-height: 360px; overflow-y: auto; }
details.dd.right .dd-menu { left: auto; right: 0; }
.dd-menu label.dd-check { display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.toolbar input.cf-text { max-width: 180px; }
.dd-menu a, .dd-menu button { text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 6px; font: 13px inherit; font-family: inherit; color: var(--text); cursor: pointer; text-decoration: none !important; white-space: nowrap; }
.dd-menu a:hover, .dd-menu button:hover { background: #f5f8fa; } .dd-menu a.active { font-weight: 600; background: #fff1ed; }
.dd-menu hr { border: 0; border-top: 1px solid var(--line2); margin: 4px 0; }
.dash-filters { display: flex; align-items: center; gap: 14px; padding: 12px 24px; flex-wrap: wrap; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: #eaf0f6; border: 1px solid #cbd6e2; border-radius: 14px; padding: 3px 4px 3px 10px; font-size: 12px; font-weight: 500; cursor: pointer; }
.chip-x { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 11px; padding: 2px 5px; border-radius: 50%; } .chip-x:hover { background: #cbd6e2; }
.dash-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 0 24px 16px; }
.span2 { grid-column: 1 / -1; }
.dash-foot { padding: 0 24px 16px; text-align: right; }
.rcard { margin: 0; padding: 18px 20px; border-radius: 10px; min-width: 0; }
.rcard.dragging { opacity: .4; } .rcard.over { outline: 2px dashed var(--teal); outline-offset: 2px; }
.rhead { display: flex; align-items: center; gap: 8px; }
.rhandle { cursor: grab; color: #99afc4; letter-spacing: -3px; font-weight: 700; user-select: none; padding: 0 4px; }
.rtitle-wrap { display: flex; align-items: center; gap: 6px; min-width: 0; }
.rtitle { margin: 0; font-size: 17px; color: #00576b; font-weight: 600; }
.info { color: var(--muted); cursor: help; font-size: 14px; }
.fchip { margin: 8px 0 6px; background: #eaf0f6; border: 0; border-radius: 12px; font: 600 11px inherit; font-family: inherit; padding: 3px 9px; cursor: pointer; color: var(--text); }
.fchip:hover { background: #dbe5ee; }
.rbody { position: relative; min-height: 80px; }
/* charts */
.chart-root { position: relative; }
.chart-box { width: 100%; overflow: hidden; } .chart-box svg { display: block; max-width: 100%; height: auto; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 6px 0 4px; }
.lg-item { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; cursor: pointer; font: 12.5px inherit; font-family: inherit; color: var(--text); padding: 2px 0; }
.lg-item.off { color: #b6c2cf; } .lg-item.off .lg-dot { opacity: .3; }
.lg-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.ax-grid { stroke: #e3e8ee; stroke-dasharray: 3 3; } .ax-base { stroke: #99afc4; }
.ax-tick { fill: var(--muted); font-size: 11px; } .ax-cat { fill: #33475b; font-size: 12px; }
.ax-title { fill: var(--text); font-size: 12.5px; font-weight: 600; }
.val-label { fill: var(--text); font-size: 11.5px; font-weight: 600; }
.crosshair { stroke: #99afc4; stroke-width: 1; } .crosshair.hidden { display: none; }
.hit { cursor: default; }
.chart-tip { position: absolute; z-index: 20; pointer-events: none; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px rgba(33,51,67,.18); padding: 8px 10px; font-size: 12px; min-width: 180px; }
.tip-title { font-weight: 600; margin-bottom: 4px; }
.tip-row { display: flex; align-items: center; gap: 6px; padding: 1px 0; color: var(--muted); } .tip-row b { color: var(--text); margin-left: auto; padding-left: 12px; }
.tip-row.on { color: var(--text); } .tip-l { white-space: nowrap; }
.chart-empty { padding: 40px 12px; text-align: center; color: var(--muted); }
.chart-note { font-size: 12px; color: var(--muted); margin-top: 6px; }
.donut-wrap { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; padding: 8px 0; }
.donut-total { font-size: 20px; font-weight: 700; fill: var(--text); }
.donut-legend { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 6px; }
.dl-row { display: grid; grid-template-columns: 14px 1fr auto 44px; gap: 8px; align-items: center; font-size: 13px; }
.dl-v { font-weight: 600; } .dl-p { color: var(--muted); text-align: right; }
.kpi-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; padding: 4px 0; }
.kpi-tile { border: 1px solid var(--line2); border-radius: 8px; padding: 14px 16px; }
/* report tables */
.rtable-wrap { overflow-x: auto; border-top: 1px solid var(--line2); }
.rtable th { background: #fff; text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--text); font-weight: 500; border-bottom: 1px solid #33475b; }
.rtable td { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sort-ic { color: var(--muted); margin-left: 4px; font-size: 12px; }
.rpager { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 14px 0 2px; flex-wrap: wrap; }
.rpager select { width: auto; padding: 4px 8px; background: #fff; }
.link-btn:disabled { color: #b6c2cf; cursor: default; text-decoration: none; }
.pg { min-width: 30px; height: 30px; border: 1px solid transparent; background: none; border-radius: 15px; cursor: pointer; font: 600 13px inherit; font-family: inherit; color: var(--text); }
.pg.on { border-color: #33475b; } .pg:hover { background: #f5f8fa; }
/* builder & filters */
.modal.xwide { max-width: 1180px; }
.rb { display: grid; grid-template-columns: 400px minmax(0, 1fr); gap: 20px; align-items: start; }
.rb-left { max-height: 66vh; overflow-y: auto; padding-right: 8px; }
.rb-right { position: sticky; top: 0; border: 1px solid var(--line); border-radius: 10px; padding: 14px; min-height: 360px; }
.rb-prev-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.rb-prev { max-height: 60vh; overflow: auto; }
.rb-sec { border-top: 1px solid var(--line2); padding-top: 14px; margin-top: 14px; }
.field-l { display: block; font-size: 12px; font-weight: 600; margin-bottom: 6px; color: #33475b; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-b { display: inline-flex; align-items: center; gap: 6px; border: 1px solid #cbd6e2; background: #fff; border-radius: 6px; padding: 6px 10px; cursor: pointer; font: 500 12.5px inherit; font-family: inherit; color: var(--text); }
.seg-b span { font-size: 14px; color: var(--muted); } .seg-b.on { border-color: var(--accent); background: #fff1ed; } .seg-b.on span { color: var(--accent); }
.row2 { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; } .row2 > select { flex: 1; min-width: 140px; }
.inline { display: inline-flex; align-items: center; gap: 6px; }
.meas { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; align-items: center; }
.meas > select, .meas > input { flex: 1 1 140px; min-width: 140px; } /* each box keeps a readable width, wraps when the panel is narrow */
.cols-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.col-item { display: flex; align-items: center; gap: 4px; padding: 5px 8px; background: #f5f8fa; border: 1px solid var(--line2); border-radius: 6px; font-size: 13px; }
.flt-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.flt-row { display: grid; grid-template-columns: 1.2fr 1fr 1.4fr auto; gap: 6px; align-items: start; }
.flt-row > select, .flt-row > input, .flt-row > details, .flt-row > .between, .flt-row > .ref-multi { min-width: 0; }
.ref-multi { display: flex; flex-direction: column; gap: 6px; } .ref-chips:empty { display: none; } .ref-chips .chip { cursor: default; overflow-wrap: anywhere; }
.filter-picker { width: 240px; } .filter-picker input[role=combobox] { background: #fff; }
.between { display: flex; align-items: center; gap: 4px; font-size: 12px; }
details.multi { position: relative; } details.multi summary { list-style: none; border: 1px solid #cbd6e2; border-radius: 6px; padding: 8px 10px; background: #f5f8fa; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
details.multi summary::-webkit-details-marker { display: none; }
.multi-list { margin-top: 4px; min-width: 180px; max-height: 200px; overflow-y: auto; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(33,51,67,.15); padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.af-row { display: flex; gap: 8px; align-items: flex-start; } .af-row .badge { margin-top: 8px; } .af-row .flt-row { flex: 1; }
.af-add { display: flex; gap: 8px; align-items: center; } .af-add select { width: auto; }
.flist { padding-left: 20px; line-height: 1.8; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-bottom: 8px; }
.tpl { display: flex; flex-direction: column; gap: 4px; border: 1px solid #cbd6e2; border-radius: 8px; padding: 12px; cursor: pointer; }
.tpl:has(input:checked) { border-color: var(--accent); background: #fff1ed; } .tpl input { width: auto; align-self: flex-start; }
@media (max-width: 1100px) { .rb { grid-template-columns: 1fr; } .rb-right { position: static; } }
@media (max-width: 900px) {
  .dash-grid2 { grid-template-columns: 1fr; padding: 0 12px 12px; } .dash-head, .dash-filters { padding-left: 12px; padding-right: 12px; }
  .flt-row { grid-template-columns: 1fr 1fr; }
}

/* ---------- Version 4 ---------- */
.ver-tag { margin: -8px 10px 12px; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
/* deals: saved view tabs */
.vtabs { display: flex; align-items: flex-end; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 12px; overflow-x: auto; overflow-y: visible; }
.vtab { display: flex; align-items: center; border: 1px solid transparent; border-bottom: 0; border-radius: 6px 6px 0 0; margin-bottom: -1px; }
.vtab.active { background: #fff; border-color: var(--line); }
.vtab-name { border: 0; background: none; padding: 9px 12px; cursor: pointer; font: 500 13px inherit; font-family: inherit; color: var(--muted); white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.vtab.active .vtab-name { color: var(--text); font-weight: 600; } .vtab-name:hover { color: var(--text); }
.vtab details.vmenu .dd-menu { position: fixed; top: auto; right: auto; left: auto; margin-top: 4px; }
.vtab-add { border: 1px dashed #b6c7d6; background: none; border-radius: 6px; padding: 4px 10px; margin: 0 0 5px 6px; cursor: pointer; color: var(--muted); font-size: 15px; } .vtab-add:hover { color: var(--text); background: #fff; }
.dbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.dbar input[type=search] { max-width: 300px; background: #fff; } .dbar select { width: auto; background: #fff; }
.pipe-sel { font-weight: 600; } .mode-seg .seg-b { padding: 6px 10px; } .sortby select { padding: 6px 8px; }
.qbar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; padding: 8px 10px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.qpill { display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border-radius: 16px; border: 1px solid #cbd6e2; background: #fff; font-size: 12.5px; font-weight: 500; cursor: pointer; white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.qpill:hover { border-color: #99afc4; background: #f5f8fa; } .qpill .caret { color: var(--muted); font-size: 10px; }
.qpill.on { background: #fff1ed; border-color: var(--accent); padding-right: 4px; } .qpill.on b { font-weight: 600; }
.qpill.add { border-style: dashed; color: var(--muted); }
.qsep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.lane-title { display: flex; align-items: center; gap: 6px; } .lane-title b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lane-empty { text-align: center; padding: 10px 0 2px; }
.lane-foot { border-top: 1px solid #d5dee8; padding: 9px 12px; font-size: 12px; display: flex; flex-direction: column; gap: 3px; background: #e3eaf1; border-radius: 0 0 var(--radius) var(--radius); }
.lane-foot > div { display: flex; justify-content: space-between; gap: 8px; }
.card-props { display: flex; flex-direction: column; gap: 2px; font-size: 12px; }
.cp-l { color: var(--muted); } .cp-v { font-weight: 500; overflow-wrap: anywhere; }
.deal-foot { gap: 6px; } .deal-foot .clip { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deals-table td { white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.pager > .muted.small:first-child { margin-right: auto; }
/* lists */
.lists-help { max-width: 820px; margin: -6px 0 14px; line-height: 1.6; }
.list-group { padding: 0; overflow: visible; } /* visible so the ⋯ menu is not cut off */ .lg-head { display: flex; align-items: baseline; gap: 10px; padding: 14px 16px 10px; } .lg-head h3 { margin: 0; font-size: 15px; }
.list-history { list-style: none; margin: 0; padding: 0 16px 12px; } .modal .list-history { padding: 0; max-height: 60vh; overflow: auto; } .list-history li { padding: 6px 0; border-top: 1px solid var(--line2); } .list-history li:first-child { border-top: 0; }
.table .num { text-align: right; } .b-kind-static { background: #eaf0f6; color: #33475b; } .b-kind-active { background: #e5f5f8; color: #007a8c; }
.kind-opt { display: flex; align-items: flex-start; gap: 8px; margin: 6px 0; font-size: 13px; } .kind-opt input { margin-top: 3px; }
.rules-card .row-actions { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.ac-res { max-height: 50vh; overflow-y: auto; margin-top: 10px; display: flex; flex-direction: column; }
.ac-item { padding: 7px 4px; border-bottom: 1px solid var(--line2); } .ac-item:hover { background: #f5f8fa; }
.modal-foot .spacer { flex: 1; }
@media (max-width: 900px) { .qsep { display: none; } .dbar input[type=search] { max-width: none; flex: 1 1 100%; order: 5; } }

/* deals import */
.di-map { max-height: 42vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 6px; margin-top: 6px; } .di-map select { padding: 5px 8px; }
.di-stages { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.di-result ul { margin: 6px 0 0; padding-left: 18px; }

/* deals: bulk selection */
.dbulk { position: sticky; top: 0; z-index: 15; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 9px 14px; margin-bottom: 12px; background: #fff7f4; border: 1px solid var(--accent); border-radius: var(--radius); box-shadow: var(--shadow); }
.dbulk select { width: auto; padding: 5px 8px; background: #fff; }
.dc-top { display: flex; align-items: flex-start; gap: 7px; margin-bottom: 4px; } .dc-top .deal-name { margin-bottom: 0; flex: 1; min-width: 0; }
.deal-chk, .lane-chk { margin: 3px 0 0; cursor: pointer; flex: none; width: 15px; height: 15px; }
.deal-card .deal-chk { opacity: .35; transition: opacity .12s; } .deal-card:hover .deal-chk, .deal-card.picked .deal-chk, .board.selecting .deal-chk { opacity: 1; }
.deal-card.picked { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(255,122,89,.25); }
.deals-table tr.picked td { background: #fff7f4; }
.chk, .deal-chk, .lane-chk, .row-chk, .lrow-chk { user-select: none; }

/* dashboard country picker */
.country-dd > summary { list-style: none; } .country-dd > summary::-webkit-details-marker { display: none; }
.country-menu { min-width: 240px; gap: 2px; padding: 10px 12px; } .country-menu .check { padding: 5px 2px; font-size: 13px; }
.country-menu .row-actions { display: flex; align-items: center; gap: 8px; }
.nowrap { white-space: nowrap; }

/* Phones: keep every page inside the screen width (no sideways scrolling) */
@media (max-width: 700px) {
  .toolbar > * { max-width: 100%; min-width: 0; }
  /* Lists: hide Owner and Updated so the table fits; the ⋯ menu still opens */
  .list-group th:nth-child(4), .list-group td:nth-child(4), .list-group th:nth-child(5), .list-group td:nth-child(5) { display: none; }
  .list-group td, .list-group th { padding-left: 10px; padding-right: 10px; }
  /* Settings and other cards: wide tables scroll inside their card */
  .card:not(.list-group) > table, .card:not(.list-group) > form > table, .settings .card table { display: block; overflow-x: auto; max-width: 100%; }
  .settings .card { min-width: 0; } .settings .card table td { white-space: nowrap; }
}

/* Show / Hide password button inside password boxes */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 64px; width: 100%; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--accent, #0b7285); font-size: 12px; font-weight: 600; padding: 4px 8px; cursor: pointer; border-radius: 6px; }
.pw-eye:hover, .pw-eye:focus-visible { background: rgba(0,0,0,.06); }

/* Dashboard: visible remove (✕) button on each report */
.rremove { color: #7c98b6; font-size: 13px; }
.rremove:hover, .rremove:focus-visible { color: var(--red, #d9363e); background: #fdecec; }

/* Contact type and marketing tags */
.b-existing_client { background: #e5f4e4; color: #1e6b33; }
.b-potential_client { background: #e7f1fb; color: #1d5a96; }
.b-partner { background: #efedff; color: #5b47c2; }
.b-vendor { background: #f9eeda; color: #8a5a00; }
.b-marketing_contact { background: #e6f7f5; color: #0b6e64; }
.b-non_marketing_contact { background: #f0efec; color: #5a5a5a; }

/* Left menu: Contacts group with Lists and Companies under it */
.nav-parent { width: 100%; background: none; border: 0; font: inherit; text-align: left; cursor: pointer; }
.nav-caret { margin-left: auto; font-size: 11px; opacity: .7; transition: transform .15s; }
.nav-group:not(.open) .nav-caret { transform: rotate(-90deg); }
.nav-group:not(.open) .nav-sub { display: none; }
.nav-group.has-active > .nav-parent { color: #fff; }
.nav-child { padding: 7px 10px 7px 40px; font-size: 13.5px; }

/* Deal preview panel (right side) */
.dpreview { position: fixed; top: 0; right: 0; height: 100vh; width: min(440px, 100vw); background: #fff; box-shadow: -12px 0 40px rgba(33,51,67,.18); z-index: 60; overflow-y: auto; transform: translateX(100%); transition: transform .18s ease; outline: none; }
.dpreview.in { transform: none; }
.dp-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 10px; border-bottom: 1px solid #eaf0f6; position: sticky; top: 0; background: #fff; z-index: 1; }
.dp-title { flex: 1; min-width: 0; } .dp-title h2 { margin: 2px 0 4px; font-size: 19px; overflow-wrap: anywhere; }
.dp-amount { font-size: 16px; font-weight: 700; color: #213343; }
.dp-actions { display: flex; gap: 8px; padding: 12px 20px 0; }
.dp-sec { padding: 14px 20px; border-bottom: 1px solid #f0f3f7; } .dp-sec h4 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .03em; color: #516f90; }
.dp-sec select, .dp-sec textarea { width: 100%; } .dp-sec .right { margin-top: 8px; text-align: right; }
.dp-act { padding: 8px 0; border-bottom: 1px dashed #eaf0f6; } .dp-act:last-child { border-bottom: 0; }
.deal-card { cursor: pointer; } .deal-card.previewing { outline: 2px solid var(--teal, #00a4bd); outline-offset: -1px; }

/* Form editor */
.form-builder { grid-template-columns: minmax(280px, 1fr) minmax(0, 1.4fr); }
.fb-col { display: grid; gap: 16px; min-width: 0; }
.fb-dirty { margin-left: auto; margin-right: 8px; font-size: 12px; color: #b25e09; background: #fef4e6; padding: 2px 8px; border-radius: 10px; }
.fbq { border: 1px solid var(--line2, #eaf0f6); border-radius: 8px; margin-bottom: 8px; background: #fff; }
.fbq.open { border-color: var(--teal, #00a4bd); box-shadow: 0 0 0 1px var(--teal, #00a4bd) inset; }
.fbq.dragging { opacity: .4; } .fbq.over { border-top: 3px solid var(--teal, #00a4bd); }
.fbq-head { display: flex; align-items: center; gap: 8px; padding: 10px 10px; cursor: pointer; }
.fbq-drag { cursor: grab; color: #99acc2; letter-spacing: -2px; } .fbq-sum { flex: 1; min-width: 0; }
.fbq-body { padding: 4px 14px 14px; border-top: 1px solid var(--line2, #eaf0f6); }
.fb-h { margin: 14px 0 8px; font-size: 13px; } .fb-h:first-child { margin-top: 0; }
.fb-picks { display: flex; flex-wrap: wrap; gap: 8px; }
.fb-pick { border: 1px solid #cbd6e2; background: #f5f8fa; border-radius: 16px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.fb-pick:hover:not(:disabled) { border-color: var(--teal, #00a4bd); background: #e5f8fb; } .fb-pick:disabled { opacity: .45; cursor: not-allowed; }
.fb-preview { border: 1px dashed #cbd6e2; border-radius: 8px; padding: 16px; background: #fbfcfd; }
.pf h3 { margin: 0 0 4px; } .pf-row { margin-bottom: 12px; } .pf-row > label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.pf input, .pf select, .pf textarea { width: 100%; }
@media (max-width: 1100px) { .form-builder { grid-template-columns: 1fr; } }

/* Phones: buttons at least 44px, big enough to tap with a thumb */
@media (max-width: 700px) {
  button, .btn, details.dd > summary, details.multi summary, .tab, .nav, .qpill, .chip, .dd-menu a, a.link-strong { min-height: 44px; }
  .icon-btn, .btn, .pg, .chip-x { min-width: 44px; }
  .icon-btn, summary.icon-btn, a.link-strong { display: inline-flex; align-items: center; justify-content: center; }
  .btn { justify-content: center; }
  .pw-wrap input { min-height: 44px; }
  .pw-eye { right: 0; }
  .vtabs { overflow-y: hidden; }
  .crumbs a { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; }
  .qa { min-width: 44px; min-height: 44px; }
}
