.fin-plan-page .fin-summaries { grid-template-columns: minmax(0,1fr) minmax(0,1fr) minmax(185px,.63fr); }
.fin-plan-page .fin-summary { min-height: 94px; padding: 11px 14px; gap: 5px; }
.fin-plan-page .fin-summary-value { font-size: clamp(22px,3vw,29px); }
.fin-plan-overdue {
  display: grid; align-content: space-between; gap: 5px; min-width: 0; padding: 11px 14px; text-align: left;
  border: 1px solid #efd0d8; border-radius: var(--crm-radius); background: linear-gradient(118deg,#fff,#fff0f3);
  color: #9d243e; font: inherit; cursor: pointer; box-shadow: var(--crm-shadow);
}
.fin-plan-overdue:is(:hover,[aria-pressed="true"]) { border-color: #d97890; background: #fff0f4; }
.fin-plan-overdue-label,.fin-plan-overdue-caption { display: flex; align-items: center; gap: 7px; }
.fin-plan-overdue-label { font-size: 14px; font-weight: 690; }
.fin-plan-overdue .fin-tile { background: #ffe4ec; color: #9d243e; }
.fin-plan-overdue .fin-summary-value { color: inherit; }
.fin-plan-overdue-caption { color: #88384d; font-size: 12px; }
.fin-plan-overdue-caption .icon { width: 15px; height: 15px; }
.plan-panel .fin-panel-head { padding: 9px 12px; }
:is(.plan-panel,.plan-drawer-actions) .button.primary { min-height: 38px; border-color: transparent; background: var(--crm-gradient); color: #fff; }
:is(.plan-panel,.plan-drawer-actions) .button.primary:hover { background: var(--crm-gradient); filter: brightness(1.08); }
.plan-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 9px 12px; border-bottom: 1px solid #e1e6f3; }
.plan-tools .fin-search { flex-basis: 230px; max-width: 410px; }
.plan-scroll { max-height: min(560px,calc(100dvh - 300px)); min-height: 100px; overflow-y: auto; border-radius: 0 0 13px 13px; }
.plan-table { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.plan-table :is(th,td) { text-align: left; vertical-align: middle; border: 0; }
.plan-table th:first-child { width: 13%; }
.plan-table th:nth-child(2) { width: 30%; }
.plan-table th:nth-child(4) { width: 14%; }
.plan-table th:nth-child(5) { width: 15%; }
.plan-table th:last-child { width: 36px; }
.plan-table thead th {
  position: sticky; top: 0; z-index: 2; padding: 7px 12px; background: #edf1fa; color: #465979; font-size: 12px; font-weight: 670;
}
.plan-table tbody td { padding: 7px 12px; height: 47px; border-bottom: 1px solid #e5eaf4; background: transparent; }
.plan-table tbody .plan-entry:hover { background: #f5f1ff; cursor: pointer; }
.plan-table tbody .plan-entry.is-selected { background: #f0eaff; }
.plan-table .plan-group th { padding: 5px 12px; border-bottom: 1px solid #e1e6f3; background: #f6f8fd; color: #445676; font-size: 12px; font-weight: 700; }
.plan-table .plan-group[data-status="overdue"] th { background: #fff1f4; border-bottom-color: #f3dce3; color: #962740; }
.plan-table .plan-group[data-status="today"] th { background: #f3efff; border-bottom-color: #e7def9; color: #51359c; }
.plan-table .plan-money { text-align: right; }
.plan-date,.plan-money { font-weight: 720; font-variant-numeric: tabular-nums; }
.plan-money { white-space: nowrap; }
.plan-money[data-direction="in"] { color: #14704f; }
.plan-money[data-direction="out"] { color: #5335a8; }
.plan-parties { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 6px; overflow-wrap: anywhere; }
.plan-parties .icon { width: 13px; height: 13px; color: #6a55ac; }
.plan-parties strong { font-weight: 690; min-width: 0; }
.plan-sub { display: block; color: var(--crm-muted); font-size: 12px; }
.plan-status[data-status="done"] { border-color: #c9e9d6; background: #e4f4ea; color: #176449; }
.plan-status[data-status="cancelled"] { border-color: #e2e7f0; background: #eff2f7; color: #4b5a73; }
.plan-status[data-status="upcoming"] { border-color: #cce2f3; background: #e5f2fb; color: #275a84; }
.plan-order {
  display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px; color: #4e34ac;
  font: inherit; font-weight: 690; text-decoration: none; overflow-wrap: anywhere;
}
.plan-order:hover { color: #4e34ac; text-decoration: underline; }
.plan-detail {
  display: grid; place-items: center; min-width: 25px; min-height: 29px; margin-left: -7px; padding: 0;
  border: 0; border-radius: 5px; background: transparent; color: #644fc0; cursor: pointer;
}
.plan-detail:hover { background: #ebe4ff; }
.plan-detail .icon { width: 13px; transform: rotate(-90deg); }
.plan-breakdown { padding: 11px 13px; }
.plan-breakdown h3 { margin-bottom: 5px; }
.plan-breakdown dl > div {
  display: grid; grid-template-columns: minmax(76px,.72fr) minmax(0,1.28fr); align-items: baseline; gap: 8px;
  padding: 7px 0; border-bottom: 1px solid #e4e9f3;
}
.plan-breakdown dl > div:last-child { border-bottom: 0; }
.plan-breakdown dt { color: var(--crm-muted); font-size: 13px; }
.plan-breakdown dd { text-align: right; font-weight: 620; overflow-wrap: anywhere; }
.plan-breakdown .plan-order { justify-content: end; }
.plan-breakdown p { color: #405271; white-space: pre-wrap; overflow-wrap: anywhere; }
.plan-drawer-actions { display: grid; justify-items: start; gap: 6px; }
.plan-drawer-actions p { color: var(--crm-muted); font-size: 12px; }

@media (max-width: 800px) {
  .fin-plan-page .fin-summaries { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .fin-plan-overdue { grid-column: 1 / -1; grid-template-columns: minmax(0,1fr) auto; align-items: center; padding: 8px 10px; }
  .fin-plan-overdue-caption { grid-column: 1 / -1; margin-left: 35px; }
  .plan-scroll { min-height: 0; max-height: none; overflow: visible; }
  .plan-table,.plan-table tbody { display: block; }
  .plan-table thead { display: none; }
  .plan-table tbody tr {
    display: grid; grid-template-columns: minmax(0,1fr) auto 25px; grid-template-areas: "parties money more" "due status status" "order order order";
    gap: 4px 6px; align-items: center; padding: 7px 8px; border-bottom: 1px solid #e5eaf4;
  }
  .plan-table tbody td { display: block; padding: 0; height: auto; border: 0; }
  .plan-table tbody tr.plan-group { display: block; padding: 0; }
  .plan-table .plan-group th { display: block; width: 100%; padding-inline: 8px; border-bottom: 0; }
  .plan-entry td:nth-child(1) { grid-area: due; display: flex; align-items: baseline; gap: 5px; font-size: 12px; }
  .plan-entry td:nth-child(2) { grid-area: parties; }
  .plan-entry td:nth-child(3) { grid-area: order; }
  .plan-entry td:nth-child(4) { grid-area: money; }
  .plan-entry td:nth-child(5) { grid-area: status; justify-self: end; }
  .plan-entry td:nth-child(6) { grid-area: more; }
  .plan-detail { margin-left: 0; }
  .plan-order { font-size: 12px; }
}
@media (max-width: 420px) {
  .fin-plan-page .fin-summary { padding-inline: 9px; }
  .fin-plan-page .fin-summary p { min-height: 0; }
  .plan-entry .plan-money { font-size: 13px; }
}
