:root {
  --bg: #0c0c0f;
  --panel: #151519;
  --panel2: #1c1c21;
  --line: #2b2b32;
  --text: #f7f7f8;
  --muted: #93939d;
  --pink: #ed2871;
  --orange: #ff9a48;
  --green: #58c887;
  --yellow: #ffc05b;
  --red: #f06d6d;
  --grad: linear-gradient(120deg, var(--pink), var(--orange));
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, sans-serif;
}
.portal-shell {
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
  min-height: 100vh;
}
.portal-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}
.portal-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-decoration: none;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
}
.portal-logo img { width: 54px; height: 54px; object-fit: contain; }
.portal-sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 45px;
}
.portal-sidebar nav a,
.portal-sidebar nav span {
  display: flex;
  justify-content: space-between;
  color: #8f8f99;
  text-decoration: none;
  padding: 12px 13px;
  border-radius: 8px;
  font-size: 14px;
}
.portal-sidebar nav .active { color: #fff; background: var(--grad); font-weight: 800; }
.portal-sidebar .portal-admin-nav {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.portal-sidebar small { font-size: 9px; text-transform: uppercase; }
.portal-source {
  margin-top: 10px;
  color: #686873;
  font-size: 11px;
  line-height: 1.5;
  padding: 12px;
}
.portal-main { padding: 0 clamp(22px, 4vw, 58px) 50px; }
.portal-header {
  height: 104px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
.portal-header p,
.card-head p,
.section-head p {
  margin: 0 0 6px;
  color: #7e7e88;
  font-size: 10px;
  letter-spacing: .16em;
  font-weight: 800;
}
.portal-header h1 { margin: 0; font-size: 30px; letter-spacing: -.04em; }
.user-box { display: flex; align-items: center; gap: 12px; color: #bdbdc4; font-size: 13px; }
.user-box button {
  border: 1px solid #3a3a42;
  background: transparent;
  color: #fff;
  border-radius: 7px;
  padding: 8px 11px;
  cursor: pointer;
}
.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  padding: 26px 0 18px;
}
.toolbar > div { display: flex; align-items: end; gap: 10px; }
.toolbar label { display: flex; flex-direction: column; gap: 6px; color: #898993; font-size: 11px; }
.toolbar select {
  background: #17171b;
  color: #fff;
  border: 1px solid #393941;
  border-radius: 7px;
  padding: 10px 34px 10px 12px;
}
.status-pill { padding: 9px 12px; border-radius: 20px; background: #28282e; color: #aaa; font-size: 11px; }
.status-pill.approved { background: #173725; color: #7de6a6; }
.toolbar-actions button { border: 0; border-radius: 7px; padding: 10px 13px; font-weight: 800; cursor: pointer; }
.toolbar-actions #save-plans { background: #fff; color: #111; }
.toolbar-actions #save-plans.saving { background:#d8d8dc; color:#333; cursor:wait; }
.toolbar-actions #save-plans.saved { background:#37c978; color:#07150d; box-shadow:0 0 0 3px rgba(55,201,120,.16); }
.toolbar-actions #save-plans.save-error { background:#ff627b; color:#fff; }
.motivation-export { display:block; margin-top:12px; padding:8px 12px; border:1px solid #ff8b49; border-radius:9px; background:rgba(255,139,73,.1); color:#ffc09a; font-weight:800; cursor:pointer; }
.motivation-export:hover { background:linear-gradient(90deg,rgba(239,47,110,.2),rgba(255,139,73,.22)); color:#fff; }
.motivation-export:disabled { opacity:.65; cursor:wait; }
.toolbar-actions #approve-plans { background: var(--grad); color: #fff; }
.toolbar-actions span { font-size: 12px; color: #85dca3; }
.toolbar-actions .save-message.pending { color:#ffbe75; }
.toolbar-actions .save-message.error { color:#ff8296; }
.save-toast {
  position:fixed; right:24px; bottom:24px; z-index:1000; max-width:380px;
  padding:14px 18px; border:1px solid #3d414a; border-radius:10px;
  background:#191a1f; color:#fff; font-weight:800; opacity:0;
  transform:translateY(14px); pointer-events:none; transition:.22s ease;
  box-shadow:0 18px 50px rgba(0,0,0,.45);
}
.save-toast.visible { opacity:1; transform:translateY(0); }
.save-toast.success { border-color:#2f9c60; background:#123020; color:#8ff0b5; }
.save-toast.error { border-color:#a74455; background:#361820; color:#ff9bab; }
.metric-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.metric-card { background: var(--panel); border: 1px solid var(--line); border-radius: 11px; padding: 18px; }
.metric-card span { color: #888892; font-size: 11px; }
.metric-card b { display: block; font-size: 25px; margin: 11px 0 7px; }
.metric-card small { color: #a9a9b0; }
.metric-strip .metric-card:first-child {
  border-color: #6a3450;
  background: linear-gradient(135deg, #251620, #19171a);
}
.metric-strip .metric-card:first-child b { color: #ff9a78; }
.payout-note { display: block; margin-top: 6px; color: #88daa8; font-size: 9px; }
.actual-input { width: 115px; }
.team-dashboard {
  background: linear-gradient(145deg, #151519, #101013);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  margin-bottom: 22px;
}
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 18px; }
.section-head h2 { margin: 0; font-size: 23px; }
.section-head > span { color: #777782; font-size: 11px; }
.team-dashboard .metric-card { background: #1a1a1f; }
.team-table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.team-table { min-width: 780px; }
.team-table tbody tr { cursor: pointer; }
.team-table tbody tr:hover { background: #1b1b20; }
.team-progress { display: flex; align-items: center; gap: 10px; }
.team-progress .progress-track { width: 120px; }
.manager-tabs { display: flex; gap: 7px; overflow: auto; margin: 0 0 14px; }
.manager-tabs button {
  white-space: nowrap;
  border: 1px solid #383840;
  background: #17171b;
  color: #9b9ba5;
  border-radius: 7px;
  padding: 10px 14px;
  cursor: pointer;
}
.manager-tabs button.active { background: #fff; color: #101012; border-color: #fff; font-weight: 800; }
.motivation-card { background: var(--panel); border: 1px solid var(--line); border-radius: 13px; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: end; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.card-head h2 { font-size: 22px; margin: 0; }
.card-head > span { color: #777782; font-size: 11px; }
.motivation-blocks {
  display: grid;
  gap: 14px;
  padding: 16px;
  background: #101013;
}
.manager-tasks-block {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-top: 1px solid var(--line);
  background: linear-gradient(120deg, #11131b, #101013);
}
.manager-tasks-block:empty { display: none; }
.manager-tasks-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 14px;
}
.manager-tasks-head p { margin: 0 0 5px; color: #8d9dc8; font-size: 10px; font-weight: 800; letter-spacing: .14em; }
.manager-tasks-head h3 { margin: 0; font-size: 18px; }
.manager-tasks-head small { color: #7f8495; font-size: 10px; }
.manager-task-list { display: grid; gap: 9px; }
.manager-task-item {
  display: grid;
  grid-template-columns: 7px minmax(0, 1fr) auto;
  gap: 13px;
  align-items: start;
  padding: 14px 15px;
  border: 1px solid #33394b;
  border-radius: 10px;
  background: #15171e;
}
.manager-task-item::before { content: ""; width: 7px; min-height: 100%; border-radius: 8px; background: #86a7ff; box-shadow: 0 0 16px rgb(134 167 255 / .45); }
.manager-task-item h4 { margin: 0; font-size: 14px; }
.manager-task-item p { margin: 7px 0 0; color: #b3b6c2; font-size: 12px; line-height: 1.45; white-space: pre-wrap; }
.manager-task-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; color: #858b9d; font-size: 10px; }
.manager-task-meta b { color: #c9d5ff; }
.manager-task-actions { display: flex; gap: 6px; }
.manager-task-actions button { border: 1px solid #4a5269; background: transparent; color: #dfe6ff; border-radius: 6px; padding: 7px 9px; cursor: pointer; }
.manager-task-actions .danger { color: #ff9c9c; border-color: #6d3535; }
.manager-task-empty { margin: 0; color: #7b8191; font-size: 12px; }
.motivation-block {
  --block-accent: #777782;
  --block-glow: rgb(119 119 130 / .10);
  background: var(--panel);
  border: 1px solid color-mix(in srgb, var(--block-accent) 36%, var(--line));
  border-radius: 11px;
  overflow: hidden;
  box-shadow: inset 3px 0 0 var(--block-accent), 0 8px 28px rgb(0 0 0 / .10);
  transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.motivation-block:hover {
  border-color: color-mix(in srgb, var(--block-accent) 58%, var(--line));
  box-shadow: inset 3px 0 0 var(--block-accent), 0 12px 34px rgb(0 0 0 / .18);
}
.motivation-block > header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(circle at 12% 0%, var(--block-glow), transparent 42%),
    linear-gradient(110deg, #1b1b20, #141418);
}
.motivation-block > header::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  align-self: center;
  border-radius: 50%;
  background: var(--block-accent);
  box-shadow: 0 0 16px var(--block-accent);
}
.motivation-block > header > div { margin-right: auto; }
.motivation-block > header span { color: var(--block-accent); }
.motivation-block.block-plan {
  --block-accent: #f2f2f4;
  --block-glow: rgb(242 242 244 / .08);
}
.motivation-block.block-categories {
  --block-accent: #ff9a48;
  --block-glow: rgb(255 154 72 / .16);
}
.motivation-block.block-new-clients {
  --block-accent: #55c8f2;
  --block-glow: rgb(85 200 242 / .15);
}
.motivation-block.block-akb {
  --block-accent: #58c887;
  --block-glow: rgb(88 200 135 / .15);
}
.motivation-block.block-team {
  --block-accent: #b189ff;
  --block-glow: rgb(177 137 255 / .15);
}
.motivation-block.block-special {
  --block-accent: #ed2871;
  --block-glow: rgb(237 40 113 / .16);
}
.motivation-block.block-manufacturer {
  --block-accent: #ffc05b;
  --block-glow: rgb(255 192 91 / .16);
}
.motivation-block > header span {
  color: #767681;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .14em;
}
.motivation-block > header h3 { margin: 5px 0 0; font-size: 18px; }
.motivation-block > header small { color: #777782; font-size: 10px; }
.auto-calc { color: #7de6a6; font-size: 11px; font-weight: 700; }
.task-period { display: block; margin-top: 6px; color: #a7a7b1; font-size: 10px; }
.campaign-ended-current { color: #85858e; background: #17171b; }
.campaign-ended-current td { color: #85858e; }
.campaign-ended-current td b { color: #b7b7bd; }
.campaign-ended-current:not(.is-expanded) td .task-period,
.campaign-ended-current:not(.is-expanded) td .auto-calc,
.campaign-ended-current:not(.is-expanded) td .motivation-export { display: none; }
.campaign-details-toggle {
  display: inline-flex;
  margin: 0 0 0 9px;
  padding: 4px 8px;
  border: 1px solid #48484f;
  border-radius: 999px;
  background: #222227;
  color: #b7b7bd;
  font: inherit;
  font-size: 10px;
  cursor: pointer;
}
.campaign-details-toggle:hover { border-color: #777782; color: #f0f0f2; }
.rule-catalog-tree {
  max-height: 430px;
  overflow: auto;
  padding: 8px;
  border: 1px solid #383840;
  border-radius: 8px;
  background: #0e0e11;
}
.catalog-tree-folder { margin: 2px 0; }
.catalog-tree-folder > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  color: #d5d5dc;
  list-style: none;
}
.catalog-tree-folder > summary::-webkit-details-marker { display: none; }
.catalog-tree-folder > summary::before { content: "›"; color: #777782; font-size: 18px; transition: transform .15s; }
.catalog-tree-folder[open] > summary::before { transform: rotate(90deg); }
.catalog-tree-folder > summary:hover { background: #1d1d22; }
.catalog-tree-folder > summary span { font-weight: 800; }
.catalog-tree-folder > summary small { margin-left: auto; color: #70707a; font-size: 9px; }
.catalog-tree-children { margin-left: 18px; padding-left: 8px; border-left: 1px solid #2d2d34; }
.catalog-tree-product {
  display: flex !important;
  grid-template-columns: none !important;
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
  min-height: 32px;
  margin: 2px 0 !important;
  padding: 6px 8px;
  border-radius: 5px;
  color: #a9a9b2 !important;
  cursor: pointer;
}
.catalog-tree-product:hover { background: #19191e; color: #fff !important; }
.catalog-tree-product input,
.catalog-tree-folder summary input { width: 15px; height: 15px; min-height: 0; accent-color: #ed2871; }
.catalog-tree-product input:disabled + span,
.catalog-tree-folder summary input:disabled ~ span { opacity: .45; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 690px; }
th {
  text-align: left;
  color: #777782;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 13px 20px;
  border-bottom: 1px solid var(--line);
}
td { padding: 13px 20px; border-bottom: 1px solid #25252b; font-size: 13px; }
tr.group-row td {
  background: #101013;
  color: #888892;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: 9px 20px;
}
.plan-input {
  width: 130px;
  background: #0f0f12;
  color: #fff;
  border: 1px solid #3a3a43;
  border-radius: 6px;
  padding: 8px;
  text-align: right;
  font-weight: 800;
}
.plan-input:disabled { border-color: transparent; background: transparent; }
.progress,
.team-progress { display: flex; align-items: center; gap: 9px; }
.progress-track { width: 86px; height: 6px; background: #303037; border-radius: 10px; overflow: hidden; }
.progress-track i { display: block; height: 100%; background: var(--grad); border-radius: 10px; }
.state { display: inline-block; padding: 6px 8px; border-radius: 20px; background: #28282e; color: #aaa; font-size: 10px; }
.state.good { background: #173725; color: #7de6a6; }
.state.warn { background: #3a2d15; color: #ffd37c; }
.state.bad { background: #3d2020; color: #ff9c9c; }
.definition { padding: 14px 20px; color: #73737d; font-size: 11px; line-height: 1.5; }
.auth-required { text-align: center; margin: 90px auto; max-width: 420px; }
.auth-required img { width: 100px; }
.auth-required p { color: #999; }
.auth-required a {
  display: inline-block;
  background: var(--grad);
  color: #fff;
  padding: 12px 18px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 800;
}
.access-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
  padding: 28px 0 20px;
}
.access-head p { margin: 0 0 6px; color: #7e7e88; font-size: 10px; letter-spacing: .16em; font-weight: 800; }
.access-head h2 { margin: 0; font-size: 25px; }
.access-head > span { color: #777782; font-size: 11px; }
.access-head > div:last-child { display: flex; align-items: center; gap: 14px; }
.access-head > div:last-child > span { color: #777782; font-size: 11px; }
.users-table { min-width: 980px; }
.users-table td { vertical-align: middle; }
.users-table td small { display: block; margin-top: 6px; color: #777782; font-size: 10px; }
.role-badge {
  display: inline-block;
  padding: 6px 9px;
  border: 1px solid #3b3b43;
  border-radius: 20px;
  color: #bdbdc5;
  font-size: 10px;
  font-weight: 800;
}
.role-badge.admin { color: #ffadcf; border-color: #71304c; background: #351724; }
.role-badge.head { color: #ffc986; border-color: #644527; background: #302214; }
.role-badge.manager { color: #98d8ff; border-color: #28556f; background: #152936; }
.primary-action {
  border: 0;
  border-radius: 7px;
  padding: 10px 14px;
  background: var(--grad);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}
.editor-card {
  margin-bottom: 20px;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.editor-card > div:first-child { display: flex; align-items: center; justify-content: space-between; }
.editor-card h3 { margin: 0 0 18px; }
.editor-card [data-close-editor] {
  border: 0; background: transparent; color: #aaa; font-size: 25px; cursor: pointer;
}
.editor-grid { display: grid; grid-template-columns: repeat(2, minmax(220px, 1fr)); gap: 14px; }
.editor-grid label,
.portal-dialog > label {
  display: flex; flex-direction: column; gap: 7px; color: #96969f; font-size: 11px;
}
.editor-grid input, .editor-grid select,
.portal-dialog input, .portal-dialog select, .portal-dialog textarea {
  width: 100%; background: #0f0f12; color: #fff; border: 1px solid #3a3a43;
  border-radius: 7px; padding: 10px;
}
.portal-dialog textarea { min-height: 118px; resize: vertical; font: inherit; line-height: 1.45; }
.editor-card > p, .portal-dialog > p { color: #aaa; font-size: 12px; }
.row-actions { display: flex; gap: 6px; }
.row-actions button {
  border: 1px solid #414149; background: transparent; color: #ddd;
  border-radius: 6px; padding: 7px 9px; cursor: pointer;
}
.row-actions button.danger { color: #ff9c9c; border-color: #6d3535; }
.disabled-note { color: #ff9c9c !important; }
.portal-dialog {
  width: min(520px, calc(100vw - 30px)); background: #17171b; color: #fff;
  border: 1px solid #3b3b43; border-radius: 14px; padding: 26px;
}
.portal-dialog.wide { width: min(760px, calc(100vw - 30px)); }
.portal-dialog::backdrop { background: rgb(0 0 0 / .75); }
.portal-dialog h2 { margin: 0 0 8px; }
.portal-dialog > label { margin: 14px 0; }
.portal-dialog select[multiple] { min-height: 260px; }
.portal-dialog label small { color: #71717a; }
.portal-dialog form { float: right; }
.dialog-close { border: 0; background: transparent; color: #aaa; font-size: 26px; cursor: pointer; }
.detail-star {
  margin-left: 7px;
  border: 0;
  background: transparent;
  color: var(--yellow);
  font-size: 16px;
  cursor: pointer;
  vertical-align: middle;
}
.detail-star:hover { transform: scale(1.18); }
.client-detail-list {
  max-height: 55vh;
  overflow: auto;
  margin-top: 18px;
  border-top: 1px solid var(--line);
}
.client-detail-row {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  padding: 13px 4px;
  border-bottom: 1px solid var(--line);
}
.client-detail-row > span { color: #666670; font-size: 11px; padding-top: 2px; }
.client-detail-row b { display: block; font-size: 13px; }
.client-detail-row small { display: block; margin-top: 5px; color: #85858e; }
.loading-note { color: #85858e; }
.receivables-hero {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  padding: 30px 0 20px;
}
.receivables-hero p,
.receivables-workspace header p,
.dialog-eyebrow {
  margin: 0 0 7px;
  color: #7e7e88;
  font-size: 10px;
  letter-spacing: .16em;
  font-weight: 800;
}
.receivables-hero h2,
.receivables-workspace h2 { margin: 0; font-size: 25px; }
.receivables-hero > div > span { display: block; margin-top: 8px; color: #8c8c96; font-size: 12px; }
.receivables-freshness { color: #777782; font-size: 11px; white-space: nowrap; }
.scope-tabs { display: flex; gap: 7px; margin-bottom: 18px; }
.scope-tabs button {
  border: 1px solid #393941;
  background: #17171b;
  color: #9b9ba5;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
}
.scope-tabs button.active { border-color: transparent; background: var(--grad); color: #fff; font-weight: 800; }
.receivables-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.debt-kpi {
  position: relative;
  overflow: hidden;
  min-height: 132px;
  padding: 19px;
  background: linear-gradient(145deg, #17171b, #121215);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.debt-kpi::after {
  content: "";
  position: absolute;
  width: 100px;
  height: 100px;
  right: -45px;
  top: -45px;
  border-radius: 50%;
  background: var(--debt-color, #fff);
  opacity: .10;
  filter: blur(2px);
}
.debt-kpi span { color: #92929c; font-size: 11px; }
.debt-kpi b { display: block; margin: 15px 0 9px; font-size: 24px; letter-spacing: -.03em; }
.debt-kpi small { color: #777782; }
.debt-kpi.danger { --debt-color: #ed4c67; border-color: #532733; }
.debt-kpi.danger b { color: #ff8799; }
.debt-kpi.warning { --debt-color: #ffb64d; border-color: #554027; }
.debt-kpi.warning b { color: #ffc979; }
.debt-kpi.attention { --debt-color: #ed2871; border-color: #59233b; }
.debt-kpi.undated { --debt-color: #9a82ff; border-color: #44386f; }
.debt-kpi.undated b { color: #b9aaff; }
.manager-debt-section {
  padding: 22px;
  margin-bottom: 20px;
  background: linear-gradient(145deg, #151519, #101013);
  border: 1px solid var(--line);
  border-radius: 13px;
}
.manager-debt-grid { display: grid; grid-template-columns: repeat(4, minmax(180px, 1fr)); gap: 10px; }
.manager-debt-grid button {
  text-align: left;
  border: 1px solid #303038;
  border-radius: 10px;
  padding: 15px;
  color: #fff;
  background: #1a1a1f;
  cursor: pointer;
  transition: border-color .2s ease, transform .2s ease;
}
.manager-debt-grid button:hover { border-color: #ed2871; transform: translateY(-2px); }
.manager-debt-grid span { display: block; color: #9c9ca5; font-size: 11px; }
.manager-debt-grid b { display: block; margin: 10px 0 7px; font-size: 18px; }
.manager-debt-grid small { color: #ff9aab; font-size: 10px; line-height: 1.4; }
.receivables-workspace {
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 13px;
}
.receivables-workspace > header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}
.receivables-filters { display: flex; gap: 8px; flex-wrap: wrap; justify-content: end; }
.receivables-filters input,
.receivables-filters select {
  min-height: 39px;
  border: 1px solid #393941;
  border-radius: 7px;
  background: #101013;
  color: #fff;
  padding: 9px 11px;
}
.receivables-filters input { min-width: 230px; }
.receivables-table-wrap { overflow: auto; }
.receivables-table { min-width: 980px; }
.receivables-table tbody tr { cursor: pointer; transition: background .15s ease; }
.receivables-table tbody tr:hover { background: #1c1c21; }
.receivables-table td small,
.debtor-documents td small { display: block; margin-top: 5px; color: #777782; font-size: 10px; }
.receivables-table .amount,
.debtor-documents .amount { font-weight: 800; white-space: nowrap; }
.danger-text { color: #ff8296 !important; }
.task-actions { display:flex; flex-wrap:wrap; gap:6px; margin-top:8px; }
.edit-task, .delete-task { padding:5px 9px; border-radius:8px; background:transparent;
    font-size:12px; cursor:pointer; }
.edit-task { border:1px solid #4d5364; color:#d9dbe3; }
.delete-task { border:1px solid #6d3535;
    border-radius:8px; background:transparent; color:#ff9c9c; font-size:12px; cursor:pointer; }
.editor-grid label small, #rule-paths-label small { display:block; margin-top:6px; color:#9296a6;
  font-size:11px; line-height:1.35; font-weight:400; }
.debt-status {
  display: inline-block;
  white-space: nowrap;
  padding: 6px 9px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 800;
}
.debt-status.overdue { color: #ff9cac; background: #3b1e28; }
.debt-status.soon { color: #ffd18d; background: #3a2b16; }
.debt-status.undated { color: #c5b8ff; background: #2b2448; }
.debt-status.planned { color: #8fdbae; background: #183225; }
.undated-text { color: #b9aaff; font-weight: 800; }
.row-open {
  width: 31px;
  height: 31px;
  border: 1px solid #3a3a42;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  cursor: pointer;
}
.empty-row { padding: 40px !important; text-align: center; color: #777782; }
.receivables-workspace > footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 13px 20px;
  border-top: 1px solid var(--line);
  color: #70707a;
  font-size: 10px;
}
.receivables-workspace > footer span:last-child { max-width: 720px; text-align: right; }
.debtor-dialog > #debtor-subtitle { margin: 7px 0 18px; color: #8b8b95; font-size: 12px; }
.payment-term-editor { display: grid; grid-template-columns: 180px 1fr auto; gap: 10px; align-items: end; margin: 0 0 18px; padding: 14px; border: 1px solid #313139; border-radius: 14px; background: #111116; }
.payment-term-editor label { display: grid; gap: 6px; color: #9a9aa6; font-size: 11px; }
.payment-term-editor input { min-width: 0; padding: 10px 12px; color: #fff; background: #0b0b0f; border: 1px solid #3a3a44; border-radius: 9px; }
.payment-term-editor button { padding: 10px 14px; border: 0; border-radius: 9px; font-weight: 700; cursor: pointer; }
.payment-term-editor small { grid-column: 1 / -1; color: #8b8b95; }
@media (max-width: 760px) { .payment-term-editor { grid-template-columns: 1fr; } .payment-term-editor small { grid-column: auto; } }
.debtor-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.debtor-summary > div {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #101013;
}
.debtor-summary span { display: block; color: #81818b; font-size: 10px; }
.debtor-summary b { display: block; margin-top: 9px; font-size: 18px; }
.debtor-documents { min-width: 720px; }
.clients-hero {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  padding: 30px 0 20px;
}
.clients-hero p,
.clients-workspace header p,
.client-chart-card header p,
.client-orders-card header p {
  margin: 0 0 7px;
  color: #7e7e88;
  font-size: 10px;
  letter-spacing: .16em;
  font-weight: 800;
}
.clients-hero h2,
.clients-workspace h2 { margin: 0; font-size: 25px; }
.clients-hero > div > span {
  display: block;
  margin-top: 8px;
  color: #8c8c96;
  font-size: 12px;
}
.clients-freshness { color: #777782; font-size: 11px; white-space: nowrap; }
.clients-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.client-kpi {
  --client-color: #f4f4f6;
  position: relative;
  min-height: 126px;
  overflow: hidden;
  padding: 18px;
  background: linear-gradient(145deg, #17171b, #121215);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.client-kpi::after {
  content: "";
  position: absolute;
  width: 95px;
  height: 95px;
  right: -43px;
  top: -43px;
  border-radius: 50%;
  background: var(--client-color);
  opacity: .11;
}
.client-kpi span { color: #92929c; font-size: 11px; }
.client-kpi b { display: block; margin: 14px 0 8px; font-size: 23px; }
.client-kpi small { color: #777782; }
.client-kpi.warning { --client-color: #ffb64d; border-color: #554027; }
.client-kpi.warning b { color: #ffc979; }
.client-kpi.danger { --client-color: #ed4c67; border-color: #532733; }
.client-kpi.danger b { color: #ff8799; }
.client-kpi.cadence { --client-color: #b189ff; border-color: #44386f; }
.client-kpi.cadence b { color: #c4adff; }
.client-kpi.revenue { --client-color: #58c887; border-color: #28543b; }
.client-kpi.revenue b { color: #8de3ae; }
.clients-workspace {
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 13px;
}
.clients-workspace > header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}
.clients-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: end;
}
.clients-filters input,
.clients-filters select {
  min-height: 39px;
  border: 1px solid #393941;
  border-radius: 7px;
  background: #101013;
  color: #fff;
  padding: 9px 11px;
}
.clients-filters input { min-width: 220px; }
.clients-filters .amount-filter { min-width: 130px; width: 145px; }
.month-filter-label { display: grid; gap: 3px; min-width: 150px; color: #a5a5af; font-size: 11px; }
.month-filter-label select { min-width: 150px; }
.client-hidden-row { opacity: .62; }
.hidden-client-note { color: #ffae72 !important; }
.visibility-toggle {
  border: 1px solid #4a343a;
  border-radius: 6px;
  background: #25171b;
  color: #ff9cac;
  padding: 7px 9px;
  font: inherit;
  font-size: 9px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}
.visibility-toggle.restore { border-color: #28543b; background: #14271c; color: #8de3ae; }
.clients-table-wrap { overflow: auto; }
.clients-table { min-width: 1480px; }
.abc-dynamics-table { min-width: 980px; width: 100%; }
.abc-dynamics-table tbody tr:nth-child(even) { background:#1a1a20; }
.abc-dynamics-table td.turnover-fall { color:#ff9cab; background:#3a2029; font-weight:800; }
.abc-dynamics-table td.turnover-rise { color:#93e5b2; background:#193429; font-weight:800; }
.client-section-toggle { flex-shrink:0; padding:9px 13px; border:1px solid #4b4b58; background:#23232b; color:#eee; border-radius:8px; cursor:pointer; white-space:nowrap; }
.client-foldable > header { flex-wrap:wrap; }
.client-section-body[hidden] { display:none !important; }
.client-section-body > footer { padding:14px 22px; color:#9999a5; font-size:11px; }
.abc-dynamics-table td small { display:block; color:#92929d; font-size:10px; margin-top:5px; }
.abc-dynamics-table td:first-child { min-width:230px; }
.abc-dynamics-table button { background:#202026; color:#eee; border:1px solid #41414b; border-radius:7px; padding:7px 10px; cursor:pointer; white-space:nowrap; }
.abc-dynamics-table .abc-client-link { border:0; background:none; padding:0; font-weight:800; text-align:left; white-space:normal; }
.abc-category-row { background:#111116; }
.abc-category-row td:first-child { padding-left:32px; color:#beb1d8; }
.abc-help, #abc-dynamics-count { color:#9797a2; font-size:12px; line-height:1.6; padding:12px 22px; }
#abc-dynamics-period { color:#aaa; font-size:12px; margin-top:8px; }
.clients-table thead button {
  position: relative;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.clients-table thead button:hover,
.clients-table thead button.active { color: #fff; }
.clients-table thead button.active::after {
  content: "↓";
  margin-left: 6px;
  color: #ed2871;
}
.clients-table thead button.active[data-direction="asc"]::after { content: "↑"; }
.clients-table tbody tr { cursor: pointer; transition: background .15s ease; }
.clients-table tbody tr:hover { background: #1c1c21; }
.clients-table td small {
  display: block;
  margin-top: 5px;
  color: #777782;
  font-size: 10px;
}
.abc-combined {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  border: 1px solid #393941;
  border-radius: 8px;
  background: #101013;
  font-size: 13px;
  letter-spacing: .04em;
}
.abc-combined i { color: #666672; font-style: normal; }
.abc-a { color: #66dda0; }
.abc-b { color: #ffc769; }
.abc-c { color: #ff8499; }
.abc-none { color: #777782; }
.client-trend {
  display: inline-block;
  min-width: 62px;
  padding: 5px 8px;
  border-radius: 18px;
  font-size: 10px;
  font-weight: 850;
  text-align: center;
}
.client-trend.up, .client-trend.new { color: #8de3ae; background: #173727; }
.client-trend.down { color: #ff9cac; background: #3b1e28; }
.client-trend.flat { color: #d8d8df; background: #303037; }
.client-status {
  display: inline-block;
  white-space: nowrap;
  padding: 6px 9px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 800;
}
.client-status.dormant { color: #ff9cac; background: #3b1e28; }
.client-status.attention { color: #ffd18d; background: #3a2b16; }
.client-status.cadence { color: #cfbfff; background: #2b2448; }
.client-status.active { color: #8fdbae; background: #183225; }
.client-priority {
  display: inline-block;
  white-space: nowrap;
  padding: 6px 9px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 800;
}
.client-priority.priority { color: #ff9cac; background: #3b1e28; }
.client-priority.regular { color: #8fdbae; background: #183225; }
.client-priority.developing { color: #cfbfff; background: #2b2448; }
.client-priority.single { color: #b6b6bf; background: #29292f; }
.clients-workspace > footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 13px 20px;
  border-top: 1px solid var(--line);
  color: #70707a;
  font-size: 10px;
}
.clients-workspace > footer span:last-child { max-width: 720px; text-align: right; }
.category-matrix-card {
  margin-top: 14px;
  overflow: hidden;
  background: #141417;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.category-matrix-card > header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: end;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.category-matrix-card h2 { margin: 0; font-size: 22px; }
.category-matrix-card header p { margin: 0 0 6px; color: #777782; font-size: 9px; }
.matrix-header-tools { display: grid; justify-items: end; gap: 10px; }
.matrix-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.matrix-filters select,
.matrix-filters button,
.visibility-dialog select,
.visibility-dialog input {
  min-height: 38px;
  border: 1px solid #393941;
  border-radius: 7px;
  background: #101013;
  color: #fff;
  padding: 9px 11px;
}
.matrix-filters button { cursor:pointer; font-weight:800; }
.matrix-filters button:hover { border-color:#696975; }
.visibility-dialog label { display: grid; gap: 6px; margin: 14px 0; color: #a4a4ae; font-size: 11px; }
.client-visibility-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
  padding: 13px 15px;
  border: 1px solid #34343c;
  border-radius: 9px;
  background: #111114;
}
.client-visibility-bar.is-hidden { border-color: #4a343a; background: #1c1417; }
.client-visibility-bar b,
.client-visibility-bar span { display: block; }
.client-visibility-bar span { margin-top: 5px; color: #84848e; font-size: 10px; }
.matrix-legend { display: flex; flex-wrap: wrap; gap: 12px; color: #8d8d96; font-size: 9px; }
.matrix-legend span { display: inline-flex; align-items: center; gap: 5px; }
.matrix-legend i,
.matrix-light {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.matrix-legend .recent,
.matrix-light.recent { background: #38c77c; box-shadow: 0 0 0 3px #173727; }
.matrix-legend .stale,
.matrix-light.stale { background: #f5b84c; box-shadow: 0 0 0 3px #3a2e18; }
.matrix-legend .missing,
.matrix-light.missing { background: #e4536f; box-shadow: 0 0 0 3px #3a1d26; }
.matrix-legend .ignored,
.matrix-light.ignored { background: #85858f; box-shadow: 0 0 0 3px #303037; }
.matrix-light {
  position: relative;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  color: #0c0c0f;
  font-size: 9px;
  font-weight: 950;
  line-height: 20px;
  text-align: center;
  cursor: pointer;
  transition: transform .15s ease, filter .15s ease;
}
.matrix-light.has-note::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  padding: 2px;
  background: conic-gradient(from 25deg, #ff3d81, #ff884d, #9d62ff, #ff3d81);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.matrix-light:hover { transform: scale(1.35); filter: brightness(1.18); }
.category-matrix { min-width: 1280px; }
.category-matrix th:not(:first-child):not(:nth-child(2)),
.category-matrix td:not(:first-child):not(:nth-child(2)) { text-align: center; }
.category-matrix th { max-width: 120px; white-space: normal; line-height: 1.25; }
.category-matrix tbody tr { cursor: pointer; }
.category-matrix tbody tr:hover { background: #1c1c21; }
.category-matrix td small { display: block; margin-top: 4px; color: #777782; font-size: 9px; }
.filter-reset {
  display:block; margin:12px auto 0; padding:8px 12px; border:1px solid #4a4a55;
  border-radius:7px; background:#202126; color:#fff; font:inherit; font-weight:800;
  cursor:pointer;
}
.filter-reset:hover { border-color:#767684; background:#292a30; }
.matrix-comment-head { min-width:280px; }
.matrix-comment-cell { min-width:280px; text-align:left !important; }
.matrix-comment-cell textarea,
.client-work-comment textarea {
  width:100%; min-height:64px; resize:vertical; box-sizing:border-box;
  border:1px solid #393941; border-radius:7px; background:#0d0d10; color:#fff;
  padding:9px 10px; font:inherit; font-size:11px; line-height:1.4;
}
.matrix-comment-cell button,
.client-work-comment button {
  margin-top:6px; border:1px solid #454650; border-radius:7px; background:#202126;
  color:#fff; padding:7px 10px; font-size:10px; font-weight:800; cursor:pointer;
}
.matrix-comment-cell button.saved,
.client-work-comment button.saved { border-color:#2f9c60; background:#173b27; color:#8ff0b5; }
.matrix-comment-cell button.save-error,
.client-work-comment button.save-error { border-color:#a74455; color:#ff9bab; }
.client-work-note-preview { color:#c1a6d8 !important; max-width:320px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.client-work-comment {
  display:grid; grid-template-columns:minmax(220px,.8fr) minmax(320px,2fr) auto;
  align-items:center; gap:12px; margin-bottom:14px; padding:14px 15px;
  border:1px solid #3b3342; border-radius:9px; background:#151219;
}
.client-work-comment b,.client-work-comment span { display:block; }
.client-work-comment span { margin-top:5px; color:#888892; font-size:10px; }
.client-work-comment button { margin:0; white-space:nowrap; }
.portal-dialog.client-dialog {
  width: min(1120px, calc(100vw - 28px));
  max-height: 92vh;
  overflow: auto;
}
.client-dialog > #client-dialog-subtitle {
  margin: 7px 0 18px;
  color: #96969f;
  font-size: 11px;
  line-height: 1.7;
}
.client-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.client-summary-grid > div {
  padding: 15px;
  background: #101013;
  border: 1px solid var(--line);
  border-radius: 9px;
}
.client-summary-grid span,
.client-summary-grid small { display: block; color: #81818b; font-size: 10px; }
.client-summary-grid b { display: block; margin: 9px 0 6px; font-size: 17px; }
.client-summary-grid .abc-summary { color: #f5b84c; letter-spacing: .06em; }
.client-summary-grid .trend-summary.up,
.client-summary-grid .trend-summary.new { color: #78dda2; }
.client-summary-grid .trend-summary.down { color: #ff8096; }
.client-summary-grid .trend-summary.flat { color: #d8d8df; }
.client-analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.client-chart-card,
.client-orders-card {
  overflow: hidden;
  background: #111114;
  border: 1px solid var(--line);
  border-radius: 11px;
}
.client-chart-card.wide { grid-column: 1 / -1; }
.client-recommendations {
  grid-column: 1 / -1;
  overflow: hidden;
  background: linear-gradient(135deg, #17151a, #111114);
  border: 1px solid #342b34;
  border-radius: 11px;
}
.client-recommendations > header { padding: 16px 18px; border-bottom: 1px solid var(--line); }
.client-recommendations h3 { margin: 0; font-size: 16px; }
.coverage-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 18px 4px;
}
.coverage-chip {
  display: inline-grid;
  grid-template-columns: 8px auto;
  gap: 1px 7px;
  align-items: center;
  padding: 7px 9px;
  background: #1b1b20;
  border: 1px solid #2d2d34;
  border-radius: 7px;
  font-size: 9px;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.coverage-chip > i { width: 7px; height: 7px; border-radius: 50%; }
.coverage-chip > small { grid-column: 2; color: #777782; font-size: 8px; }
.coverage-chip.recent > i { background: #38c77c; }
.coverage-chip.stale > i { background: #f5b84c; }
.coverage-chip.missing > i { background: #e4536f; }
.coverage-chip.ignored > i { background: #85858f; }
.coverage-chip.ignored { border-color: #44444c; background: #19191d; color: #a5a5ae; }
.coverage-chip.has-note {
  border-color: transparent;
  background:
    linear-gradient(#1b1b20, #1b1b20) padding-box,
    linear-gradient(115deg, #ff3d81, #ff884d, #9d62ff) border-box;
}
.category-note-dialog > #category-note-subtitle { color:#8c8c96; font-size:11px; }
.category-note-dialog > label:not(.category-ignore-toggle) {
  display:grid; gap:7px; margin:16px 0; color:#a4a4ae; font-size:11px;
}
.category-note-dialog textarea {
  width:100%; min-height:120px; box-sizing:border-box; resize:vertical;
  border:1px solid #393941; border-radius:8px; background:#0d0d10; color:#fff;
  padding:11px 12px; font:inherit; line-height:1.5;
}
.category-ignore-toggle {
  display:flex; gap:12px; align-items:flex-start; margin:18px 0; padding:14px;
  border:1px solid #3d3d46; border-radius:9px; background:#151519; cursor:pointer;
}
.category-ignore-toggle input { width:18px; height:18px; margin-top:2px; accent-color:#85858f; }
.category-ignore-toggle span { flex:1; }
.category-ignore-toggle b,.category-ignore-toggle small { display:block; }
.category-ignore-toggle small { margin-top:5px; color:#85858f; font-size:9px; line-height:1.5; }
#category-note-message { min-height:18px; color:#8ff0b5; font-size:10px; }
.recommendation-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  padding: 12px 18px 18px;
}
.recommendation-list > div {
  padding: 12px;
  background: #101013;
  border: 1px solid #29292f;
  border-radius: 8px;
}
.recommendation-list b,
.recommendation-list span { display: block; }
.recommendation-list b { margin-bottom: 6px; font-size: 11px; }
.recommendation-list span { color: #92929c; font-size: 9px; line-height: 1.45; }
.client-chart-card > header,
.client-orders-card > header { padding: 16px 18px; border-bottom: 1px solid var(--line); }
.client-chart-card h3,
.client-orders-card h3 { margin: 0; font-size: 16px; }
.monthly-sales-chart {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(74px, 1fr));
  gap: 8px;
  align-items: end;
  min-height: 240px;
  padding: 20px 18px 16px;
}
.month-column { min-width: 0; text-align: center; }
.month-value {
  height: 28px;
  overflow: hidden;
  color: #aaaab3;
  font-size: 9px;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.month-bar {
  position: relative;
  height: 135px;
  margin: 0 auto 9px;
  border-radius: 7px;
  background: #202025;
  overflow: hidden;
}
.month-bar i {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--grad);
  border-radius: 7px 7px 0 0;
}
.month-column b { display: block; font-size: 11px; text-transform: capitalize; }
.month-column small { color: #73737c; font-size: 9px; }
.category-bars { padding: 16px 18px; }
.category-bars > div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  margin-bottom: 13px;
  font-size: 11px;
}
.category-bars b { font-size: 10px; }
.category-bars > div > i {
  grid-column: 1 / -1;
  height: 5px;
  background: #29292f;
  border-radius: 8px;
  overflow: hidden;
}
.category-bars em {
  display: block;
  height: 100%;
  background: var(--grad);
  border-radius: 8px;
}
.category-months { padding: 16px 18px; }
.category-legend { display: flex; flex-wrap: wrap; gap: 7px 12px; margin-bottom: 16px; }
.category-legend span { color: #92929c; font-size: 9px; }
.category-legend i {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 5px;
  border-radius: 50%;
}
.category-month-row {
  display: grid;
  grid-template-columns: 34px 1fr 82px;
  gap: 9px;
  align-items: center;
  margin-bottom: 12px;
}
.category-month-row b { font-size: 10px; text-transform: capitalize; }
.category-month-row > span { text-align: right; color: #aaaab2; font-size: 9px; }
.category-stack {
  display: flex;
  height: 11px;
  overflow: hidden;
  background: #29292f;
  border-radius: 8px;
}
.category-stack i { display: block; height: 100%; }
.client-orders-card { margin-top: 12px; }
.client-orders-card table { min-width: 790px; }
.client-address,
.client-definition { color: #7f7f89; font-size: 10px; line-height: 1.5; }
.client-address { margin: 15px 2px 5px; }
.client-definition { margin: 8px 2px 0; }
@media (max-width: 900px) {
  .portal-shell { grid-template-columns: 1fr; }
  .portal-sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 12px 18px;
    flex-direction: row;
    align-items: center;
  }
  .portal-sidebar nav { margin: 0 0 0 auto; flex-direction: row; }
  .portal-sidebar .portal-admin-nav {
    margin: 0 !important;
    padding: 0;
    border-top: 0;
  }
  .portal-sidebar nav span,
  .portal-source { display: none; }
  .metric-strip { grid-template-columns: repeat(2, 1fr); }
  .section-head { align-items: start; flex-direction: column; }
  .access-head { align-items: start; flex-direction: column; }
  .team-dashboard { padding: 16px; }
  .receivables-kpis { grid-template-columns: repeat(2, 1fr); }
  .manager-debt-grid { grid-template-columns: repeat(2, 1fr); }
  .receivables-workspace > header { align-items: start; flex-direction: column; }
  .receivables-filters { justify-content: start; }
  .clients-kpis { grid-template-columns: repeat(2, 1fr); }
  .clients-workspace > header { align-items: start; flex-direction: column; }
  .clients-filters { justify-content: start; }
  .client-summary-grid { grid-template-columns: repeat(2, 1fr); }
  .category-matrix-card > header { align-items: start; flex-direction: column; }
  .recommendation-list { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .portal-main { padding: 0 14px 35px; }
  .portal-header { height: auto; padding: 18px 0; align-items: start; }
  .portal-header h1 { font-size: 24px; }
  .user-box { flex-direction: column; align-items: end; }
  .portal-sidebar nav a { padding: 9px; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .toolbar > div { justify-content: space-between; }
  .metric-strip { grid-template-columns: 1fr 1fr; }
  .metric-card { padding: 14px; }
  .metric-card b { font-size: 19px; }
  .card-head { align-items: start; flex-direction: column; gap: 9px; }
  .editor-grid { grid-template-columns: 1fr; }
  .receivables-hero { align-items: start; flex-direction: column; }
  .receivables-kpis { grid-template-columns: 1fr 1fr; }
  .debt-kpi { min-height: 115px; padding: 15px; }
  .debt-kpi b { font-size: 19px; }
  .manager-debt-grid { grid-template-columns: 1fr; }
  .receivables-filters, .receivables-filters input, .receivables-filters select { width: 100%; }
  .receivables-workspace > footer { flex-direction: column; }
  .receivables-workspace > footer span:last-child { text-align: left; }
  .debtor-summary { grid-template-columns: 1fr; }
  .clients-hero { align-items: start; flex-direction: column; }
  .clients-kpis { grid-template-columns: 1fr 1fr; }
  .client-kpi { min-height: 112px; padding: 14px; }
  .clients-filters,
  .clients-filters input,
  .clients-filters select { width: 100%; }
  .clients-workspace > footer { flex-direction: column; }
  .clients-workspace > footer span:last-child { text-align: left; }
  .client-summary-grid { grid-template-columns: 1fr; }
  .client-analytics-grid { grid-template-columns: 1fr; }
  .client-chart-card.wide { grid-column: auto; }
  .monthly-sales-chart {
    grid-template-columns: repeat(7, minmax(58px, 1fr));
    overflow-x: auto;
  }
}
