:root {
  --bg: #f2f4f1;
  --surface: #ffffff;
  --surface-soft: #f7f8f6;
  --ink: #16251f;
  --muted: #65736d;
  --line: #dde3df;
  --line-strong: #cbd4ce;
  --green: #173f36;
  --green-2: #235b4d;
  --mint: #c9f3da;
  --mint-ink: #18513f;
  --blue: #dcecf8;
  --blue-ink: #275b78;
  --amber: #fae9c8;
  --amber-ink: #8a5b12;
  --red: #f8ded9;
  --red-ink: #9a3c2e;
  --shadow: 0 12px 30px rgba(31, 54, 45, .07);
  --radius: 16px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(rgba(242, 244, 241, .78), rgba(242, 244, 241, .88)),
    url("atyrau-background.png") center bottom / cover fixed no-repeat;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button { color: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(203, 212, 206, .75);
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(18px);
}

.topbar__inner {
  width: min(1420px, calc(100% - 48px));
  height: 72px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brand__mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: #fff;
  background: var(--green);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -.03em;
}

.brand strong, .brand small { display: block; }
.brand strong { font-size: 14px; letter-spacing: -.01em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 12px; }

.topbar__actions { display: flex; align-items: center; gap: 14px; }

.storage-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.storage-state__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #42b982;
  box-shadow: 0 0 0 4px rgba(66, 185, 130, .12);
}

.icon-button {
  width: 38px;
  height: 38px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  list-style: none;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.icon-button:hover { border-color: var(--line-strong); background: var(--surface-soft); }
.icon-button:active { transform: translateY(1px); }
.icon-button svg { width: 19px; height: 19px; fill: currentColor; stroke: none; }
.icon-button--light { color: var(--muted); }
.icon-button--light svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

.more-menu { position: relative; }
.more-menu summary::-webkit-details-marker { display: none; }
.more-menu__panel {
  position: absolute;
  right: 0;
  top: calc(100% + 9px);
  width: 245px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 18px 40px rgba(22, 37, 31, .14);
}

.more-menu__panel button {
  width: 100%;
  padding: 10px 11px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-size: 13px;
}

.more-menu__panel button:hover { background: var(--surface-soft); }
.more-menu__panel svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.more-menu__divider { height: 1px; margin: 6px 4px; background: var(--line); }
.danger-text { color: var(--red-ink) !important; }

.page-shell {
  width: min(1420px, calc(100% - 48px));
  margin: 0 auto;
  padding: 42px 0 72px;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--green-2);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 7px; font-size: clamp(30px, 3.6vw, 48px); line-height: 1.03; letter-spacing: -.045em; }
.page-heading__subtitle { margin-bottom: 0; color: var(--muted); font-size: 15px; }

.primary-button, .secondary-button, .ghost-button, .delete-button {
  min-height: 42px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: 11px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease;
}

.primary-button {
  border: 1px solid var(--green);
  color: #fff;
  background: var(--green);
  box-shadow: 0 8px 18px rgba(23, 63, 54, .16);
}
.primary-button:hover { background: #0f342c; box-shadow: 0 10px 22px rgba(23, 63, 54, .22); }
.primary-button:active, .secondary-button:active, .ghost-button:active { transform: translateY(1px); }
.primary-button svg, .delete-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.secondary-button { border: 1px solid var(--line-strong); background: #fff; }
.secondary-button:hover { background: var(--surface-soft); }
.ghost-button { min-height: 38px; padding-inline: 13px; border: 1px solid var(--line); background: transparent; color: var(--muted); }
.ghost-button:hover { border-color: var(--line-strong); color: var(--ink); background: #fff; }

.kpi-grid {
  margin-top: 30px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.kpi-card {
  min-height: 138px;
  padding: 22px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .92);
  box-shadow: var(--shadow);
}

.kpi-card--dark { color: #fff; border-color: var(--green); background: var(--green); }
.kpi-card__icon { flex: 0 0 39px; width: 39px; height: 39px; display: grid; place-items: center; border-radius: 11px; color: #fff; background: rgba(255,255,255,.13); }
.kpi-card__icon--mint { color: var(--mint-ink); background: var(--mint); }
.kpi-card__icon--blue { color: var(--blue-ink); background: var(--blue); }
.kpi-card__icon--amber { color: var(--amber-ink); background: var(--amber); }
.kpi-card__icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.kpi-card span { display: block; margin: 1px 0 6px; color: var(--muted); font-size: 12px; font-weight: 650; }
.kpi-card--dark span, .kpi-card--dark small { color: rgba(255,255,255,.66); }
.kpi-card strong { display: block; font-size: clamp(24px, 2.2vw, 32px); line-height: 1; letter-spacing: -.035em; }
.kpi-card small { display: block; margin-top: 8px; color: var(--muted); font-size: 11px; }

.registry-card {
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.registry-card__header { padding: 24px 25px 18px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.registry-card__header h2 { margin-bottom: 4px; font-size: 19px; letter-spacing: -.02em; }
.registry-card__header p, .last-updated { margin-bottom: 0; color: var(--muted); font-size: 12px; }
.last-updated { padding-top: 4px; }

.filters { padding: 0 25px 18px; display: flex; align-items: flex-end; gap: 10px; }
.search-field { position: relative; flex: 1 1 440px; min-width: 240px; }
.search-field svg { position: absolute; left: 13px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); fill: none; stroke: #89958f; stroke-width: 1.8; stroke-linecap: round; }
.search-field input { width: 100%; height: 42px; padding: 0 14px 0 41px; border: 1px solid var(--line); border-radius: 10px; outline: 0; background: var(--surface-soft); color: var(--ink); }
.search-field input:focus { border-color: #75a898; background: #fff; box-shadow: 0 0 0 3px rgba(117, 168, 152, .12); }

.select-field { min-width: 170px; }
.select-field > span { display: block; margin: 0 0 5px 2px; color: var(--muted); font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; }
.select-field select { width: 100%; height: 42px; padding: 0 35px 0 12px; border: 1px solid var(--line); border-radius: 10px; outline: 0; background: var(--surface-soft); color: var(--ink); font-size: 13px; }
.select-field select:focus { border-color: #75a898; box-shadow: 0 0 0 3px rgba(117, 168, 152, .12); }

.table-wrap { overflow-x: auto; border-top: 1px solid var(--line); }
table { width: 100%; min-width: 1020px; border-collapse: collapse; }
th { height: 38px; padding: 0 10px; color: #748078; background: #f7f8f6; text-align: left; font-size: 9px; font-weight: 800; letter-spacing: .055em; text-transform: uppercase; }
th:first-child, td:first-child { padding-left: 16px; }
th:last-child, td:last-child { width: 46px; padding-right: 10px; }
td { padding: 11px 10px; border-top: 1px solid #edf0ee; vertical-align: middle; font-size: 12px; }
tbody tr { transition: background .14s ease; }
tbody tr:hover { background: #fbfcfb; }

.client-cell { min-width: 190px; }
.client-cell strong { display: block; max-width: 320px; color: var(--ink); font-size: 12px; line-height: 1.3; }
.client-cell span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.manager-cell { min-width: 125px; }
.manager-cell strong { color: var(--ink); font-size: 12px; line-height: 1.3; }
.money-cell { white-space: nowrap; font-weight: 750; font-variant-numeric: tabular-nums; }
.money-cell span { display: block; max-width: 155px; margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 600; white-space: normal; }
.condition-cell strong, .delay-cell strong { display: block; font-size: 12px; }
.condition-cell span, .delay-cell span, .end-cell span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.end-cell { text-transform: capitalize; }

.status-badge {
  width: max-content;
  max-width: 170px;
  padding: 5px 9px;
  border-radius: 999px;
  color: #54615b;
  background: #e9eeeb;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .015em;
  white-space: nowrap;
}
.status-badge--approved { color: var(--mint-ink); background: var(--mint); }
.status-badge--pending { color: var(--amber-ink); background: var(--amber); }
.status-badge--rejected { color: var(--red-ink); background: var(--red); }
.status-badge--review { color: var(--blue-ink); background: var(--blue); }

.inline-status-cell { min-width: 128px; }
.inline-status-select {
  width: 100%;
  min-width: 118px;
  padding: 6px 24px 6px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.inline-status-select:hover,
.inline-status-select:focus { border-color: currentColor; outline: none; box-shadow: 0 0 0 3px rgba(16, 79, 64, .1); }
.inline-status-select:disabled { cursor: wait; opacity: .55; }
.inline-status-select--approved { color: var(--mint-ink); background-color: var(--mint); }
.inline-status-select--pending { color: var(--amber-ink); background-color: var(--amber); }
.inline-status-select--rejected { color: var(--red-ink); background-color: var(--red); }
.inline-status-select--review { color: var(--blue-ink); background-color: var(--blue); }
.inline-status-select--none { color: var(--muted); background-color: #eef2f0; }

.row-action { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid transparent; border-radius: 9px; background: transparent; color: #75827b; cursor: pointer; }
.row-action:hover { border-color: var(--line); background: #fff; color: var(--ink); }
.row-action svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.empty-state { padding: 68px 24px 74px; text-align: center; }
.empty-state__icon { width: 48px; height: 48px; margin: 0 auto 15px; display: grid; place-items: center; border-radius: 14px; color: var(--green-2); background: var(--mint); }
.empty-state__icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.empty-state h3 { margin-bottom: 6px; font-size: 16px; }
.empty-state p { margin-bottom: 16px; color: var(--muted); font-size: 13px; }

.record-dialog {
  width: min(910px, calc(100% - 32px));
  max-height: min(880px, calc(100vh - 32px));
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 30px 90px rgba(15, 35, 28, .28);
}
.record-dialog::backdrop { background: rgba(13, 30, 25, .48); backdrop-filter: blur(4px); }
.record-dialog form { max-height: inherit; display: flex; flex-direction: column; }
.dialog-head { flex: 0 0 auto; padding: 22px 24px 18px; display: flex; align-items: flex-start; justify-content: space-between; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin-bottom: 0; font-size: 23px; letter-spacing: -.025em; }
.dialog-body { overflow-y: auto; padding: 4px 24px 8px; }
.form-section { padding: 24px 0 26px; border-bottom: 1px solid var(--line); }
.form-section:last-child { border-bottom: 0; }
.form-section__heading { margin-bottom: 18px; display: flex; align-items: flex-start; gap: 12px; }
.form-section__heading > span { width: 29px; height: 29px; flex: 0 0 29px; display: grid; place-items: center; border-radius: 9px; color: var(--mint-ink); background: var(--mint); font-size: 10px; font-weight: 850; }
.form-section__heading h3 { margin-bottom: 3px; font-size: 15px; }
.form-section__heading p { margin-bottom: 0; color: var(--muted); font-size: 11px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.field { display: block; }
.field--wide { grid-column: 1 / -1; }
.field > span { display: block; margin: 0 0 6px 2px; color: #4f5d56; font-size: 11px; font-weight: 750; }
.field b { color: var(--red-ink); }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; outline: 0; background: var(--surface-soft); color: var(--ink); font-size: 13px; transition: border-color .15s ease, background .15s ease, box-shadow .15s ease; }
.field input, .field select { height: 41px; padding: 0 12px; }
.field textarea { min-height: 80px; padding: 11px 12px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: #75a898; background: #fff; box-shadow: 0 0 0 3px rgba(117, 168, 152, .12); }
.field input:invalid:not(:placeholder-shown) { border-color: #d78374; }

.history-fill {
  margin-top: -3px;
  padding: 11px 13px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid #b9dfcc;
  border-radius: 10px;
  color: var(--mint-ink);
  background: #eefaf3;
}
.history-fill svg { width: 19px; height: 19px; flex: 0 0 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.history-fill strong, .history-fill span { display: block; }
.history-fill strong { margin-bottom: 2px; font-size: 11px; }
.history-fill span { color: #4f7465; font-size: 10px; line-height: 1.35; }

.dialog-foot { flex: 0 0 auto; min-height: 72px; padding: 14px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid var(--line); background: #fbfcfb; }
.dialog-foot__right { margin-left: auto; display: flex; align-items: center; gap: 9px; }
.delete-button { padding: 0; border: 0; background: transparent; color: var(--red-ink); }
.delete-button:hover { text-decoration: underline; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 80;
  min-width: 220px;
  max-width: calc(100% - 32px);
  padding: 12px 16px;
  border-radius: 11px;
  color: #fff;
  background: #173f36;
  box-shadow: 0 14px 35px rgba(16, 43, 35, .24);
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 14px);
  transition: opacity .2s ease, transform .2s ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1080px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters { flex-wrap: wrap; }
  .search-field { flex-basis: 100%; }
  .select-field { flex: 1 1 180px; }
}

@media (max-width: 680px) {
  .topbar__inner, .page-shell { width: min(100% - 28px, 1420px); }
  .topbar__inner { height: 64px; }
  .storage-state { display: none; }
  .page-shell { padding-top: 28px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .page-heading .primary-button { width: 100%; }
  .kpi-grid { grid-template-columns: 1fr; gap: 10px; }
  .kpi-card { min-height: 112px; padding: 18px; }
  .registry-card__header { padding: 20px 18px 15px; }
  .last-updated { display: none; }
  .filters { padding: 0 18px 16px; }
  .select-field { min-width: 0; flex-basis: calc(50% - 5px); }
  .filters > .ghost-button { width: 100%; }
  th:first-child, td:first-child { padding-left: 18px; }
  .record-dialog { width: 100%; max-width: none; max-height: 95vh; margin: auto 0 0; border-radius: 18px 18px 0 0; }
  .dialog-head, .dialog-body, .dialog-foot { padding-left: 18px; padding-right: 18px; }
  .form-grid { grid-template-columns: 1fr; }
  .field--wide { grid-column: auto; }
  .dialog-foot { align-items: stretch; flex-direction: column-reverse; }
  .dialog-foot__right { width: 100%; margin: 0; }
  .dialog-foot__right > * { flex: 1; }
  .delete-button { align-self: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
body.auth-locked > :not(.auth-gate) { display: none !important; }
.auth-gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(rgba(238,244,240,.88),rgba(238,244,240,.94)),url("atyrau-background.png") center/cover fixed; }
.auth-card { width: min(460px,100%); padding: 38px; border: 1px solid rgba(23,63,54,.14); border-radius: 24px; background: rgba(255,255,255,.96); box-shadow: 0 24px 70px rgba(15,45,38,.18); }
.auth-card h1 { margin: 8px 0 12px; font-size: clamp(28px,5vw,42px); line-height: 1.05; }
.auth-card > p:not(.eyebrow) { color: #52635f; line-height: 1.55; }
.auth-card .field { margin: 24px 0 16px; }
.auth-card .primary-button { width: 100%; justify-content: center; min-height: 48px; }
.auth-mark { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 13px; background: #173f36; color: #fff; font-weight: 800; margin-bottom: 20px; }
.auth-message { min-height: 24px; margin: 14px 0 0 !important; color: #173f36 !important; font-size: 14px; }
.auth-user { border: 1px solid rgba(23,63,54,.16); border-radius: 10px; background: #fff; color: #173f36; padding: 9px 12px; cursor: pointer; font: inherit; font-size: 12px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 22px 0 4px; padding: 4px; border-radius: 12px; background: #edf3f0; }
.auth-tabs button { border: 0; border-radius: 9px; padding: 10px; background: transparent; color: #52635f; cursor: pointer; font: inherit; }
.auth-tabs button.is-active { background: #fff; color: #173f36; font-weight: 700; box-shadow: 0 2px 8px rgba(23,63,54,.1); }
.auth-card .auth-tabs + .field { margin-top: 16px; }
.auth-card .field + .field { margin-top: 12px; }
.auth-hint { margin: 12px 0 0 !important; font-size: 13px; }
.access-overlay { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 20px; background: rgba(12,35,30,.5); }
.access-card { width: min(650px,100%); max-height: min(760px,90vh); overflow: auto; padding: 28px; border-radius: 22px; background: #fff; box-shadow: 0 24px 70px rgba(0,0,0,.25); }
.access-head { display: flex; justify-content: space-between; gap: 20px; align-items: start; }
.access-head h2 { margin: 4px 0 20px; font-size: 28px; }
.access-head .icon-button { font-size: 26px; line-height: 1; }
.access-add { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.access-add input { min-width: 0; border: 1px solid #cfdad6; border-radius: 10px; padding: 12px 14px; font: inherit; }
.access-list { margin-top: 18px; border-top: 1px solid #e0e8e5; }
.access-list > div { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 2px; border-bottom: 1px solid #e0e8e5; }
.access-list span { display: grid; gap: 4px; min-width: 0; }
.access-list strong { overflow-wrap: anywhere; }
.access-list small { color: #71817d; }
.access-list button { border: 1px solid #cfdad6; border-radius: 9px; padding: 8px 11px; background: #fff; color: #173f36; cursor: pointer; }
@media (max-width: 560px) { .access-add { grid-template-columns: 1fr; } .auth-card { padding: 28px 22px; } }
.client-link { display: block; padding: 0; border: 0; background: transparent; color: #173f36; font: inherit; font-weight: 800; text-align: left; text-decoration: underline; text-decoration-color: rgba(23,63,54,.25); text-underline-offset: 3px; cursor: pointer; }
.client-link:hover { color: #28715f; text-decoration-color: currentColor; }
.client-dialog { width: min(760px,calc(100% - 28px)); max-height: 88vh; padding: 0; border: 0; border-radius: 22px; color: #173f36; box-shadow: 0 30px 90px rgba(10,35,29,.28); }
.client-dialog::backdrop { background: rgba(10,30,25,.52); backdrop-filter: blur(4px); }
.client-dialog__head { display: flex; justify-content: space-between; gap: 20px; padding: 28px 30px 22px; border-bottom: 1px solid #e3ebe7; }
.client-dialog__head h2 { margin: 4px 0; font-size: 28px; }
.client-dialog__head p { margin: 0; color: #6a7975; }
.client-conditions { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; padding: 24px 30px; }
.client-conditions article { padding: 16px; border-radius: 14px; background: #f1f6f3; }
.client-conditions span,.client-conditions strong { display: block; }
.client-conditions span { margin-bottom: 7px; color: #6a7975; font-size: 12px; }
.client-dialog > h3 { margin: 0; padding: 0 30px 12px; }
.client-history { display: grid; gap: 8px; padding: 0 30px 30px; }
.client-history button { display: grid; grid-template-columns: 90px minmax(150px,1fr) auto minmax(125px,auto); gap: 14px; align-items: center; width: 100%; padding: 14px 16px; border: 1px solid #e0e9e5; border-radius: 12px; background: #fff; color: inherit; text-align: left; cursor: pointer; }
.client-history button:hover { border-color: #75a99b; background: #f6faf8; }
.client-history small { color: #6a7975; }
.client-history__pdz { justify-self: end; margin: 0; text-align: center; }
@media (max-width:700px) { .client-conditions { grid-template-columns: repeat(2,1fr); } .client-history button { grid-template-columns: 1fr; gap: 4px; } }
.row-overdue td { background: #fff5f3; }
.row-overdue td:first-child { box-shadow: inset 4px 0 #c94f3d; }
.pdz-status-cell { min-width: 145px; }
.pdz-status-cell small { display: block; margin-top: 4px; color: #71817d; font-size: 10px; line-height: 1.3; }
.pdz-badge--pending-term { background: #e8f1fb; color: #315f8c; white-space: normal; line-height: 1.3; }
.pdz-badge { display: inline-flex !important; width: fit-content; margin: 0 0 4px; padding: 4px 7px; border-radius: 999px; font-size: 10px !important; font-weight: 800; }
.pdz-badge--overdue { background: #fde0da; color: #9d3425 !important; }
.pdz-badge--ok { background: #dff3e8; color: #23684f !important; }
.pdz-badge--unchecked { background: #eef2f0; color: #687873 !important; }
.client-pdz { display: flex; justify-content: space-between; gap: 16px; margin: 22px 30px 0; padding: 16px 18px; border-radius: 14px; }
.client-pdz span { color: inherit; }
.client-pdz--overdue { background: #fde5df; color: #8e3023; }
.client-pdz--ok { background: #e1f3e9; color: #23684f; }
.section-switch {
  display: inline-flex;
  gap: 4px;
  margin: 0 0 22px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255,255,255,.82);
  box-shadow: 0 10px 28px rgba(23,63,54,.08);
}
.section-switch button {
  border: 0;
  border-radius: 10px;
  padding: 10px 18px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.section-switch button.is-active { color: #fff; background: var(--green); }
.sales-view[hidden] { display: none; }
.debt-view[hidden] { display: none; }
.sales-view .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.debt-view .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sales-heading { margin-top: 0; }
.kpi-card__text { max-width: 220px; font-size: clamp(17px, 1.7vw, 25px) !important; line-height: 1.1; }
.manager-ranking { display: grid; gap: 12px; padding: 0 20px 22px; }
.manager-rank { display: grid; grid-template-columns: minmax(180px,1fr) minmax(160px,2fr) auto; gap: 16px; align-items: center; }
.manager-rank__name { font-weight: 800; color: var(--green); }
.manager-rank__bar { height: 12px; overflow: hidden; border-radius: 999px; background: #e8efec; }
.manager-rank__bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg,#1d584c,#4c9c88); }
.manager-rank__amount { min-width: 135px; text-align: right; font-weight: 800; }
.sales-groups-card { overflow: hidden; }
.sales-pies { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; padding: 0 20px 24px; }
.sales-pie-card { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(180deg,#fff,#f7faf8); }
.sales-pie-card__head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; min-height: 58px; }
.sales-pie-card__head h3 { margin: 0; color: var(--green); font-size: 16px; line-height: 1.25; }
.sales-pie-card__head strong { flex: 0 0 auto; font-size: 14px; white-space: nowrap; }
.sales-pie { position: relative; width: min(230px, 78%); aspect-ratio: 1; margin: 16px auto 20px; border-radius: 50%; display: grid; place-items: center; box-shadow: inset 0 -14px 24px rgba(8,46,37,.14), 0 10px 22px rgba(8,46,37,.12); }
.sales-pie::before { content: ""; width: 48%; aspect-ratio: 1; border-radius: 50%; background: #fff; box-shadow: 0 3px 10px rgba(8,46,37,.13); }
.sales-pie span { position: absolute; max-width: 105px; text-align: center; font-weight: 900; color: var(--green); font-size: 13px; }
.sales-pie-legend { display: grid; gap: 8px; padding: 0; margin: 0; list-style: none; }
.sales-pie-legend li { display: grid; grid-template-columns: 12px minmax(0,1fr) auto; align-items: center; gap: 8px; font-size: 12px; }
.debt-table { min-width: 1120px; }
.debt-table td { font-variant-numeric: tabular-nums; }
.debt-table td:nth-child(n+4) { white-space: nowrap; font-weight: 700; }
.debt-table .debt-overdue { color: #9d3425; background: #fff4f1; }
.debt-table tr.has-pdz { background: #fff9f7; }
.debt-table tr.has-pdz:hover { background: #fff3ef; }
.debt-filters .select-field { min-width: 220px; }
.sales-pie-legend li span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sales-pie-legend strong { font-size: 12px; }
.pie-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--pie-color); }

@media (max-width: 800px) {
  .sales-view .kpi-grid { grid-template-columns: 1fr; }
  .debt-view .kpi-grid { grid-template-columns: 1fr; }
  .section-switch { display: flex; }
  .section-switch button { flex: 1; padding-inline: 10px; }
  .manager-rank { grid-template-columns: 1fr auto; }
  .manager-rank__bar { grid-column: 1 / -1; grid-row: 2; }
  .sales-pies { grid-template-columns: 1fr; }
}
