:root {
  color-scheme: light;
  --ink: #19212a;
  --muted: #69717d;
  --line: #d9dee7;
  --paper: #f6f7f9;
  --panel: #ffffff;
  --green: #147a5c;
  --green-soft: #e6f4ee;
  --red: #b42318;
  --red-soft: #ffe9e6;
  --blue: #2457a6;
  --amber: #9a5b00;
  --focus: #2f6fed;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

body.auth-locked {
  min-height: 100vh;
  overflow: hidden;
}

body.auth-locked .topbar,
body.auth-locked .layout {
  display: none;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(360px, 520px);
  align-items: stretch;
  background:
    linear-gradient(135deg, rgba(13, 18, 24, 0.96) 0%, rgba(26, 32, 38, 0.96) 45%, rgba(250, 251, 252, 1) 45.2%, rgba(244, 246, 249, 1) 100%),
    #f4f6f9;
}

body:not(.auth-locked) .login-screen {
  display: none;
}

.login-visual {
  position: relative;
  display: grid;
  align-content: center;
  gap: 42px;
  min-height: 100vh;
  padding: clamp(28px, 6vw, 82px);
  color: #fff;
}

.login-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.07) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(90deg, #000 0%, rgba(0, 0, 0, 0.72) 62%, transparent 100%);
  pointer-events: none;
}

.login-brand-mark {
  position: relative;
  width: min(280px, 56vw);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid rgba(236, 202, 119, 0.56);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.03)),
    rgba(255, 255, 255, 0.04);
  color: #f5d58a;
  font-size: clamp(54px, 9vw, 96px);
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.26);
}

.login-metric-board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: min(720px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(14px);
}

.login-metric-board div {
  display: grid;
  gap: 8px;
  min-height: 104px;
  padding: 18px;
}

.login-metric-board div + div {
  border-left: 1px solid rgba(255, 255, 255, 0.14);
}

.login-metric-board span {
  color: rgba(255, 255, 255, 0.65);
  font-size: 12px;
  text-transform: uppercase;
}

.login-metric-board strong {
  align-self: end;
  color: #fff;
  font-size: clamp(16px, 2vw, 22px);
}

.login-panel {
  align-self: center;
  justify-self: center;
  display: grid;
  gap: 18px;
  width: min(420px, calc(100vw - 36px));
  border: 1px solid rgba(25, 33, 42, 0.1);
  border-radius: 8px;
  padding: clamp(24px, 5vw, 42px);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 28px 70px rgba(25, 33, 42, 0.18);
}

.login-heading {
  display: grid;
  gap: 8px;
  margin-bottom: 4px;
}

.login-heading h1 {
  font-size: clamp(30px, 4vw, 42px);
}

.login-heading p:last-child {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
}

.login-message {
  min-height: 18px;
  color: var(--red);
  font-size: 13px;
  font-weight: 800;
}

.login-message:empty {
  display: block;
}

.session-control {
  display: flex;
  align-items: center;
  justify-content: center;
}

.session-control span {
  display: none;
}

.logout-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid #ccd6e3;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff 0%, #f4f7fb 100%);
  color: #14202c;
  box-shadow:
    0 10px 24px rgba(25, 33, 42, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.logout-icon-button:hover {
  border-color: #9fb0c3;
  background: #fff;
  color: #9a3412;
  transform: translateY(-1px);
}

.logout-icon-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(18px, 4vw, 44px);
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid var(--line);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 18px;
}

h3 {
  margin: 0;
  font-size: 15px;
}

.brand-block {
  min-width: max-content;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 18px;
}

.pdf-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.report-control {
  position: relative;
}

.report-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 20;
  display: grid;
  gap: 6px;
  width: min(390px, 90vw);
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 34px rgba(25, 33, 42, 0.18);
}

.report-menu-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px 36px;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
}

.report-menu-row:hover {
  border-color: #c9d6e6;
  background: #f6f9fd;
}

.report-menu-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.report-menu-copy strong,
.report-menu-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-menu-copy span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.report-action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  min-height: 0;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.report-action-button:hover {
  border-color: #c9d6e6;
  background: #fff;
}

.report-action-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.1;
}

.icon-tool {
  width: 42px;
  min-height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.icon-tool:hover {
  border-color: #aeb8c6;
  background: #f9fafb;
}

.icon-tool svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.icon-tool .whatsapp-mark {
  width: 22px;
  height: 22px;
  stroke-width: 1.9;
}

.eyebrow {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  padding: 0 calc(clamp(360px, 21vw, 390px) + 24px) 44px clamp(18px, 4vw, 44px);
}

.workspace,
.results {
  min-width: 0;
}

.workspace {
  padding-top: 24px;
}

.section-heading,
.debt-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 10px 0 14px;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.commitment-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 220px));
  gap: 12px;
}

.commitment-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin: -2px 0 14px;
}

.row-fields,
.selector-fields,
.type-fields {
  display: grid;
  gap: 12px;
}

.selector-fields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.type-fields {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.debt-row[data-credit-type="CC"] .type-fields {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.debt-row[data-credit-type="PL"] .type-fields {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.debt-row[data-credit-type="Fees"] .type-fields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.remark-field {
  width: 100%;
  max-width: none;
}

.cc-check-fields {
  display: flex;
  align-items: end;
  gap: 18px;
  flex: 1;
  min-width: min(560px, 100%);
  width: 100%;
}

.cc-checked-controls {
  display: grid;
  grid-template-columns: minmax(150px, auto) minmax(150px, auto) 92px;
  align-items: end;
  gap: 12px;
  margin-left: auto;
}

.increase-limit-summary {
  min-height: 18px;
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  visibility: hidden;
}

.increase-limit-summary.is-active {
  visibility: visible;
}

.retaining-fee-control {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}

.retaining-count-label {
  display: flex;
  align-items: center;
  gap: 6px;
  width: auto;
}

.retaining-count-label input {
  width: 54px;
  min-height: 28px;
  padding: 4px 8px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.available-limit-control,
.loan-amount-control {
  position: relative;
  display: block;
}

.available-limit-control input,
.loan-amount-control input {
  padding-right: 62px;
}

.available-auto-button,
.loan-increase-button {
  position: absolute;
  right: 7px;
  top: 7px;
  width: 44px;
  min-height: 28px;
  height: 28px;
  padding: 0;
  border-radius: 6px;
  background: #d7dde7;
  color: #667085;
  font-size: 10px;
  letter-spacing: 0;
}

.available-auto-button.is-active {
  background: var(--red);
  color: #fff;
}

.loan-increase-button.is-active {
  background: var(--green);
  color: #fff;
}

.available-limit-field.auto-active input {
  color: var(--red);
  font-weight: 800;
  background: #fff8f7;
}

.loan-amount-field.auto-increase-active input {
  color: var(--green);
  font-weight: 800;
  background: #f0fbf6;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: 3px solid rgba(47, 111, 237, 0.24);
  border-color: var(--focus);
}

.rows {
  display: grid;
  gap: 12px;
}

.row-action-bar {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.row-action-bar .ghost-button {
  min-width: 140px;
}

.debt-row,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.debt-row {
  padding: 14px;
}

.debt-row.included {
  border-left: 5px solid var(--green);
}

.debt-row.inactive {
  opacity: 0.68;
}

.row-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.row-title {
  margin-right: auto;
}

.include-toggle {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.include-toggle input,
.include-all-toggle input {
  width: 18px;
  min-height: 18px;
}

.include-all-toggle {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 6px 12px;
  background: var(--ink);
  color: #fff;
  white-space: nowrap;
}

.include-all-toggle input {
  accent-color: #fff;
}

.row-bottom {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 26px;
  margin-top: 12px;
}

.row-result {
  width: fit-content;
  min-width: min(360px, 100%);
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 15px 18px;
  background: #fff;
  color: var(--blue);
  font-size: 24px;
  font-weight: 800;
  box-shadow: 0 0 10px rgba(25, 33, 42, 0.22);
}

.row-result:empty {
  display: none;
}

.pl-interest-source {
  width: min(260px, 100%);
}

.row-bottom:has(.row-result:empty) {
  display: none;
}

.credit-divider {
  height: 1px;
  margin: 0;
  background: linear-gradient(90deg, transparent, #9aa4b2 8%, #2d3748 50%, #9aa4b2 92%, transparent);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9);
}

.results {
  position: fixed;
  top: 98px;
  right: 0;
  bottom: -1px;
  z-index: 1;
  width: clamp(360px, 21vw, 390px);
  min-height: calc(100dvh - 97px);
  align-self: start;
  display: grid;
  grid-template-rows: auto auto auto auto minmax(0, 1fr);
  gap: 10px;
  border-left: 1px solid #d3dae5;
  background: #f6f9fc;
  box-shadow: -16px 0 34px rgba(25, 33, 42, 0.04);
  overflow-y: auto;
  padding: 18px 18px 14px;
}

.results::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  width: auto;
  height: auto;
  background: #f6f9fc;
}

.mini-list div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 5px 0;
}

.mini-list div.highlight {
  margin: 0;
  border: 0;
  border-radius: 6px;
  background: #fff6db;
}

.principal-list {
  display: none;
}

.summary-sections {
  display: grid;
  gap: 9px;
  margin: 0;
}

.summary-band {
  display: grid;
  overflow: hidden;
  border: 1px solid #d8e0eb;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(25, 33, 42, 0.04);
}

.summary-band div {
  display: grid;
  gap: 3px;
  min-height: 50px;
  padding: 8px 10px;
  background: #fff;
}

.summary-band div + div {
  border-left: 1px solid var(--line);
}

.band-fees {
  grid-template-columns: 1fr 1fr;
}

.band-totals {
  grid-template-columns: 1fr 1fr;
}

.band-monthly {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.summary-band span {
  color: var(--muted);
}

.summary-band strong {
  align-self: end;
  font-size: 15px;
}

.summary-band small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

strong {
  overflow-wrap: anywhere;
}

.status {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 0;
}

.status.ok {
  border-color: #cbe8dc;
  background: linear-gradient(180deg, #e7f6ef 0%, #dff2ea 100%);
  color: var(--green);
}

.status.short {
  border-color: #ffd0cb;
  background: linear-gradient(180deg, #fff0ee 0%, #ffe6e2 100%);
  color: var(--red);
}

.status.neutral {
  border-color: #d8e0eb;
  background: linear-gradient(180deg, #f6f8fb 0%, #eef2f7 100%);
  color: var(--muted);
}

.panel {
  min-height: 0;
  margin-top: 0;
  padding: 12px 13px;
  box-shadow: 0 8px 18px rgba(25, 33, 42, 0.04);
}

.results .panel:last-child {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.results .panel:last-child #cashoutPlan {
  flex: 1;
  align-content: start;
}

.panel h2 {
  margin-bottom: 8px;
  font-size: 18px;
}

.projection-head,
.projection-row {
  display: grid !important;
  grid-template-columns: 42px minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding: 6px 0 !important;
}

.projection-head {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.projection-row strong {
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  font-size: 14px;
}

.projection-row span {
  display: block;
  width: 28px;
  text-align: left;
}

.money-cell {
  display: grid;
  grid-template-columns: 26px 76px 24px;
  column-gap: 3px;
  align-items: baseline;
  justify-content: end;
}

.money-cell span {
  width: auto;
  color: var(--ink);
  font-size: inherit;
  font-weight: inherit;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.money-cell span:nth-child(1) {
  text-align: left;
}

.money-cell span:nth-child(2) {
  text-align: right;
}

.money-cell span:nth-child(3) {
  text-align: left;
}

.mini-list .projection-row.highlight {
  margin: 0;
  border: 0;
  border-radius: 6px;
  background: #fff6db;
  padding: 5px 0 !important;
}

.cashout-row {
  padding: 7px 0 !important;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 9px 14px;
  background: var(--ink);
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.secondary,
.ghost-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.icon-button {
  width: 34px;
  min-height: 34px;
  padding: 0;
  background: #eef1f5;
  color: var(--ink);
  font-size: 20px;
}

.method-control {
  width: min(340px, 42vw);
}

.dashboard-method {
  position: relative;
  z-index: 1;
  width: 100%;
  margin-top: 0;
  margin-bottom: 0;
}

.dashboard-method label {
  margin-bottom: 4px;
}

.dashboard-method select {
  min-height: 40px;
}

.save-control {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: grid;
  grid-template-columns: minmax(180px, 320px) 164px 112px;
  align-items: end;
  gap: 12px;
  width: min(620px, calc(100vw - 560px));
  min-width: 520px;
  margin: 0;
}

.active-save-name {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 14px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.active-save-editor {
  display: block;
  cursor: text;
}

.active-save-name.has-save {
  color: var(--ink);
}

.active-save-name:hover {
  border-color: #aeb8c6;
  background: #fbfcfe;
}

.plan-save-control {
  display: grid;
  grid-template-columns: minmax(116px, 1fr) 40px;
  align-items: center;
  gap: 8px;
}

.plan-control {
  position: relative;
}

.plan-button {
  width: 100%;
  min-height: 42px;
}

.save-stack {
  display: grid;
  grid-template-rows: 20px 22px;
  align-items: center;
  justify-items: center;
  gap: 2px;
  width: 112px;
}

.save-action-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}

.save-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  min-width: 38px;
  min-height: 38px;
  padding: 0;
  border: 1px solid #cfd8e6;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff 0%, #f4f7fb 100%);
  color: #193a6a;
  box-shadow: 0 6px 16px rgba(25, 58, 106, 0.12);
}

.save-icon-button:hover {
  border-color: #9fb2cc;
  background: #fff;
}

.save-icon-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.1;
}

.save-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 112px;
  min-height: 22px;
  border: 1px solid #d8e0ea;
  border-radius: 999px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
}

.save-status.unsaved {
  border-color: #f0c4bf;
  background: #fff3f1;
  color: var(--red);
}

.save-status.saved {
  border-color: #b9ddcf;
  background: #effaf5;
  color: var(--green);
}

.autosave-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: 112px;
  padding: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

.autosave-toggle input {
  position: absolute;
  width: 1px;
  min-height: 1px;
  opacity: 0;
  pointer-events: none;
}

.autosave-switch {
  position: relative;
  width: 34px;
  height: 18px;
  border-radius: 999px;
  background: #c9d1dc;
  transition: background 160ms ease;
}

.autosave-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(25, 33, 42, 0.25);
  transition: transform 160ms ease;
}

.autosave-toggle input:checked + .autosave-switch {
  background: var(--blue);
}

.autosave-toggle input:checked + .autosave-switch::after {
  transform: translateX(16px);
}

.plan-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 20;
  display: grid;
  gap: 6px;
  width: min(340px, 86vw);
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 16px 34px rgba(25, 33, 42, 0.18);
}

.plan-menu-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px 34px 34px;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border: 1px solid transparent;
  border-radius: 8px;
}

.plan-menu-row.active {
  border-color: #c9d6e6;
  background: #f6f9fd;
}

.plan-name-button {
  min-width: 0;
  justify-content: flex-start;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-name-editor {
  width: 100%;
  min-width: 0;
  height: 34px;
  border-radius: 7px;
  font-weight: 800;
}

.plan-icon-button {
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.plan-icon-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.plan-icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.modal {
  width: min(560px, calc(100vw - 32px));
  border: 0;
  border-radius: 10px;
  padding: 0;
  box-shadow: 0 24px 60px rgba(25, 33, 42, 0.28);
}

#loadDialog {
  width: min(820px, calc(100vw - 32px));
}

.message-modal {
  width: min(1120px, calc(100vw - 32px));
}

.message-modal .modal-card {
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  height: min(820px, calc(100vh - 40px));
  padding: 14px 18px 16px;
}

.modal::backdrop {
  background: rgba(25, 33, 42, 0.45);
}

.modal-card {
  display: grid;
  gap: 16px;
  padding: 18px;
  background: #fff;
}

.modal-heading,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-actions {
  justify-content: flex-end;
}

.record-count {
  margin-right: auto;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.modal-message {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.modal-message:empty {
  display: none;
}

.saved-data-list {
  display: grid;
  gap: 10px;
  min-height: 410px;
  max-height: min(440px, 60vh);
  overflow: auto;
  align-content: start;
}

.load-tools {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(190px, 0.7fr);
  gap: 12px;
}

.message-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.message-sidebar {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-width: 0;
  border-right: 1px solid var(--line);
  background: #f8fafc;
}

.message-preset-list {
  display: grid;
  align-content: start;
  gap: 6px;
  overflow: auto;
  padding: 10px;
}

.message-list-heading {
  padding: 8px 8px 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.message-list-empty {
  padding: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.message-list-button {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 58px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.message-list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
}

.message-list-item .message-list-button {
  min-width: 0;
}

.message-edit-button {
  width: 36px;
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0;
  background: transparent;
  color: var(--muted);
}

.message-edit-button:hover {
  border-color: #d7dde7;
  background: #fff;
  color: var(--ink);
}

.message-edit-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.message-list-button:hover {
  border-color: #e4e8ef;
  background: #fff;
}

.message-list-button.active {
  border-color: #cfd6e2;
  background: #fff;
  box-shadow: 0 6px 18px rgba(25, 33, 42, 0.07);
}

.message-list-button strong,
.message-list-button span {
  overflow: hidden;
  text-overflow: clip;
  white-space: normal;
}

.message-list-button strong {
  font-size: 13px;
}

.message-list-button span {
  color: var(--muted);
  font-size: 11px;
}

.show-all-drafts {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 9px;
  border-top: 1px solid var(--line);
  padding: 12px;
  color: var(--ink);
  background: #fff;
}

.show-all-drafts input {
  width: 17px;
  min-height: 17px;
}

.message-editor-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: 14px;
}

.message3-details-panel {
  display: grid;
  gap: 12px;
  border: 1px solid #cfd6e2;
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfe;
}

.message3-details-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.message3-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.message3-remark-field {
  grid-column: 1 / -1;
}

.message3-detail-actions {
  justify-content: flex-end;
}

.message-options-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  border: 1px solid #e1e6ee;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fbfcfe;
}

.message-preview-label {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  flex: 1 1 auto;
  min-height: 0;
}

.message-preview {
  height: 100%;
  min-height: 0;
  resize: none;
  line-height: 1.45;
  white-space: pre-wrap;
}

.message-actions {
  flex-wrap: wrap;
  align-self: end;
  margin-top: auto;
  padding-top: 8px;
}

.message-action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  min-width: 42px;
  min-height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.message-action-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.1;
}

.message-whatsapp-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  min-width: 46px;
  padding: 0;
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.message-whatsapp-button:hover {
  background: #0f1720;
  color: #fff;
}

.message-whatsapp-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.saved-data-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.saved-data-item.current {
  border-color: #2f6fed;
  background: #eaf2ff;
  box-shadow: inset 4px 0 0 #2f6fed;
}

.saved-data-name {
  display: grid;
  gap: 4px;
  min-width: 0;
  min-height: 42px;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  justify-content: stretch;
}

.saved-data-name:hover {
  background: transparent;
  color: var(--blue);
}

.saved-data-name strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-data-name-editor {
  width: 100%;
  min-width: 0;
}

.saved-data-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  min-width: 42px;
  min-height: 42px;
  padding: 0;
}

.saved-data-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.1;
}

.saved-data-icon.load {
  background: var(--ink);
  color: #fff;
}

.saved-data-item button:not(.saved-data-icon),
.save-control button:not(.save-icon-button),
.modal-actions button {
  min-width: 82px;
}

.save-control .plan-menu button {
  min-width: 0;
}

.save-control .plan-menu .plan-icon-button {
  min-width: 34px;
}

@media (max-width: 1000px) {
  .topbar {
    position: static;
  }

  .save-control {
    position: static;
    left: auto;
    top: auto;
    transform: none;
    width: auto;
    min-width: 0;
    margin-left: auto;
    margin-right: 0;
  }

  .login-screen {
    grid-template-columns: 1fr;
    background:
      linear-gradient(180deg, rgba(13, 18, 24, 0.97) 0%, rgba(28, 34, 40, 0.97) 45%, #f4f6f9 45.2%, #f4f6f9 100%);
    overflow: auto;
  }

  .login-visual {
    min-height: 42vh;
    align-content: end;
  }

  .login-brand-mark {
    width: min(190px, 44vw);
  }

  .login-panel {
    margin: -36px auto 28px;
  }

  .layout {
    grid-template-columns: 1fr;
    padding: 24px clamp(18px, 4vw, 44px) 44px;
  }

  .workspace {
    padding-top: 0;
  }

  .results {
    position: static;
    right: auto;
    bottom: auto;
    width: auto;
    min-height: 0;
    margin-top: 40px;
    padding: 18px 14px 14px;
    scroll-margin-top: 32px;
    border: 1px solid var(--line);
    border-radius: 8px;
    grid-template-rows: auto;
  }

  .results .dashboard-method {
    margin-top: 0;
    margin-bottom: 0;
  }

  .results .status {
    padding: 11px 13px;
    font-size: 16px;
  }

  .results .summary-sections {
    gap: 9px;
    margin: 10px 0;
  }

  .results .summary-band div {
    min-height: 46px;
    padding: 7px 8px;
  }

  .results .panel {
    margin-top: 8px;
    padding: 10px 11px;
  }
}

@media (max-width: 720px) {
  .topbar,
  .section-heading,
  .debt-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .brand-row {
    justify-content: space-between;
  }

  .login-visual {
    gap: 22px;
    padding: 26px 18px 58px;
  }

  .login-metric-board {
    grid-template-columns: 1fr;
  }

  .login-metric-board div {
    min-height: 74px;
  }

  .login-metric-board div + div {
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    border-left: 0;
  }

  .method-control,
  .save-control {
    width: 100%;
  }

  .save-control,
  .session-control,
  .saved-data-item,
  .load-tools,
  .message-shell,
  .message3-fields {
    grid-template-columns: 1fr;
  }

  .save-control {
    margin-left: 0;
    margin-right: 0;
  }

  .plan-menu {
    position: static;
    width: 100%;
    margin-top: 8px;
  }

  .report-menu {
    left: auto;
    right: 0;
  }

  .message-shell {
    min-height: 0;
  }

  .message-sidebar {
    max-height: 240px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .message-editor-panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: auto;
  }

  .message-preview {
    height: 100%;
    min-height: 0;
  }

  .row-action-bar {
    justify-content: stretch;
  }

  .row-action-bar .ghost-button {
    width: 100%;
  }

  .profile-grid,
  .commitment-row,
  .commitment-grid,
  .selector-fields,
  .type-fields,
  .cc-check-fields,
  .summary-band,
  .actions {
    grid-template-columns: 1fr;
  }

  .summary-band div + div {
    border-top: 1px solid rgba(25, 33, 42, 0.12);
    border-left: 0;
  }

  .row-result {
    margin-left: 0;
  }
}
