:root {
  --ink: #111111;
  --muted: #676767;
  --soft: #f5f5f0;
  --panel: #ffffff;
  --line: #deded5;
  --yellow: #ffde00;
  --red: #ff1f1f;
  --green: #0a8f5a;
  --blue: #205db8;
  --amber: #b26100;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--soft);
  color: var(--ink);
  font: 14px/1.45 Inter, Arial, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  border: 0;
  border-radius: 7px;
  padding: 11px 15px;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
  font-weight: 750;
}

button:hover {
  transform: translateY(-1px);
}

.danger {
  background: #ffe1de;
  color: #9d1b13;
}

.secondary {
  background: #e8e8df;
  color: var(--ink);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.field-help {
  color: #4f4f4f;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1,
h2,
h3,
.brand strong,
.brand-logo,
.hero-logo {
  font-family: "Yango Headline", Arial Black, Inter, sans-serif;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 238px;
  padding: 22px 16px;
  background: #111;
  color: #fff;
}

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

.brand-logo {
  color: var(--red);
  font-size: 28px;
  font-style: italic;
  font-weight: 950;
  letter-spacing: 0;
  line-height: 1;
}

.brand small {
  display: block;
  color: #c9c9c3;
}

nav {
  display: grid;
  gap: 7px;
}

.nav-btn {
  width: 100%;
  background: transparent;
  color: #e7e7df;
  text-align: left;
}

.nav-btn.active,
.nav-btn:hover {
  background: var(--red);
  color: #fff;
}

main {
  min-height: 100vh;
  margin-left: 238px;
}

body[data-mode="partner"] .masthead,
body[data-mode="partner"] .status-strip,
body[data-mode="master"] .masthead,
body[data-mode="master"] .status-strip {
  display: none;
}

.masthead {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 26px;
  align-items: end;
  min-height: 390px;
  padding: 42px 34px 34px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.72)),
    radial-gradient(circle at 86% 24%, rgba(255, 31, 31, 0.2), transparent 28%),
    #fff;
  color: var(--ink);
  overflow: hidden;
}

.masthead::after {
  content: "ESTAMOS CONTIGO";
  position: absolute;
  right: -70px;
  top: 40px;
  color: rgba(255, 31, 31, 0.08);
  font-family: "Yango Headline", Arial Black, sans-serif;
  font-size: 92px;
  font-style: italic;
  font-weight: 950;
  transform: rotate(-6deg);
  animation: driftText 8s ease-in-out infinite alternate;
}

.masthead-copy {
  position: relative;
  z-index: 1;
}

.hero-logo {
  color: var(--red);
  font-size: clamp(54px, 8vw, 112px);
  font-style: italic;
  font-weight: 950;
  line-height: 0.82;
  margin-bottom: 22px;
}

.eyebrow {
  display: inline-flex;
  margin-bottom: 14px;
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--red);
  color: #fff;
  font-weight: 850;
  text-transform: uppercase;
}

.masthead h1 {
  max-width: 800px;
  font-size: clamp(38px, 5vw, 72px);
  line-height: 0.95;
  letter-spacing: 0;
  text-transform: uppercase;
}

.masthead p {
  max-width: 690px;
  margin-top: 14px;
  color: #4f4f4f;
  font-size: 17px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.hero-actions button:first-child {
  background: var(--yellow);
  color: #111;
}

.hero-link {
  background: #111;
}

.support-visual {
  position: relative;
  z-index: 1;
  min-height: 260px;
}

.heart-badge {
  position: absolute;
  left: 22px;
  top: -18px;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--yellow);
  color: #111;
  font-size: 14px;
  font-weight: 950;
  text-transform: uppercase;
  animation: floatBadge 3.8s ease-in-out infinite;
  z-index: 2;
}

.support-card {
  display: grid;
  gap: 10px;
  border-radius: 8px;
  padding: 86px 24px 24px;
  min-height: 250px;
  color: #fff;
  box-shadow: 0 24px 60px rgba(255, 31, 31, 0.22);
  animation: cardLift 4.6s ease-in-out infinite;
}

.red-card {
  background: var(--red);
}

.support-card strong {
  color: #fff;
  font-family: "Yango Headline", Arial Black, sans-serif;
  font-size: 34px;
  line-height: 0.95;
  text-transform: uppercase;
}

.support-card span {
  color: #fff;
  font-size: 15px;
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  padding: 15px 34px;
  background: var(--red);
  color: #fff;
}

.status-strip span {
  font-weight: 750;
}

.workbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 22px 34px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.workbar p,
.panel p,
.section-title p,
.card-meta,
small {
  color: var(--muted);
}

.toolbar,
.actions,
.search-panel,
.table-actions {
  display: flex;
  gap: 10px;
  align-items: end;
}

.table-actions {
  justify-content: flex-end;
  margin: 26px 0 22px;
}

.table-actions select {
  max-width: 240px;
  margin-right: auto;
}

.toolbar select {
  min-width: 220px;
}

.view {
  display: none;
  padding: 24px 34px 40px;
}

.view.active {
  display: block;
}

.panel,
.case-card,
.metrics > div,
.table-wrap,
.list-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.panel {
  padding: 20px;
  margin-bottom: 18px;
}

.auth-panel {
  display: grid;
  gap: 18px;
  max-width: 860px;
}

.auth-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: end;
}

.auth-form-muted {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.protected-content {
  display: none;
}

.protected-content.unlocked {
  display: block;
}

.auth-panel.hidden,
.nav-btn.hidden,
.toolbar.hidden {
  display: none;
}

.form-panel {
  max-width: 1060px;
}

.section-title {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 4px 0 16px;
}

.compact-title {
  margin: 0 0 14px;
}

.section-title + .form-grid {
  margin-bottom: 24px;
}

.section-title span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-weight: 950;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.wide {
  grid-column: 1 / -1;
}

.evidence-instructions,
.terms-consent {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.evidence-instructions {
  display: grid;
  gap: 9px;
  border-color: #ffd8d8;
  background: #fff8f8;
  color: var(--ink);
}

.evidence-instructions h4 {
  margin: 0;
  color: var(--red);
  font-size: 15px;
}

.evidence-instructions p,
.evidence-instructions li {
  color: #3e3e3e;
  font-size: 13px;
  font-weight: 550;
}

.evidence-instructions ol {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 20px;
}

.evidence-instructions strong {
  color: var(--ink);
  font-size: 13px;
}

.terms-consent {
  display: grid;
  gap: 10px;
  margin: 8px 0 18px;
}

.terms-box {
  display: grid;
  gap: 12px;
  max-height: min(76vh, 720px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.terms-box h3,
.terms-box h4 {
  font-size: 18px;
}

.terms-box p,
.terms-box li {
  color: #3e3e3e;
  font-size: 13px;
}

.terms-box h4 {
  margin: 4px 0 0;
  color: var(--ink);
}

.terms-box ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 20px;
}

.terms-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--ink);
  font-size: 13px;
}

.terms-check input {
  width: auto;
  margin-top: 3px;
}

.link-button {
  justify-self: start;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--red);
  text-decoration: underline;
}

.modal.hidden {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 22px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 17, 17, 0.58);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(860px, 100%);
  box-shadow: 0 24px 70px rgba(17, 17, 17, 0.28);
}

.modal-head {
  position: sticky;
  top: -16px;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin: -16px -16px 0;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.icon-close {
  display: grid;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-size: 24px;
  line-height: 1;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.aid-settings {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) repeat(3, minmax(120px, 160px)) auto;
  gap: 12px;
  align-items: end;
}

.aid-breakdown {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 12px;
  margin: 0 0 8px;
}

.aid-control {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.aid-control strong {
  text-transform: uppercase;
}

.aid-control span {
  color: var(--red);
  font-size: 28px;
  font-weight: 900;
}

.partner-summary-panel {
  margin: 8px 0 4px;
}

.partner-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 12px;
}

.summary-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.summary-card strong {
  font-size: 16px;
}

.summary-card div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.summary-card span {
  color: var(--red);
  font-weight: 900;
}

.metrics > div {
  padding: 16px;
}

.metrics span {
  display: block;
  font-size: 29px;
  font-weight: 900;
  color: var(--red);
}

.case-grid {
  display: grid;
  gap: 12px;
}

.case-card {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 18px;
  padding: 16px;
}

.case-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.case-code {
  color: var(--muted);
  font-weight: 850;
}

.case-title {
  font-size: 18px;
  font-weight: 850;
}

.case-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 11px 0;
}

.pill,
.status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 850;
}

.pill {
  background: #eeeee8;
  color: #333;
}

.status-new {
  background: #fff4b8;
  color: #5f4b00;
}

.status-review {
  background: #dbeafe;
  color: #174a99;
}

.status-approved {
  background: #fff0cb;
  color: #7a4c00;
}

.status-paid {
  background: #111;
  color: #fff;
}

.status-rejected {
  background: #ffe1de;
  color: #9d1b13;
}

.aid-soft {
  background: #e9f7ef;
  color: var(--green);
}

.aid-medium {
  background: #fff0cb;
  color: var(--amber);
}

.aid-hard {
  background: #ffe1de;
  color: #a31610;
}

.aid-pending {
  background: #eeeee8;
  color: #444;
}

.case-detail {
  color: #343434;
}

.evidence-list,
.timeline {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.evidence-list a {
  color: var(--blue);
  font-weight: 750;
  text-decoration: none;
}

.case-actions {
  display: grid;
  gap: 9px;
  align-content: start;
}

.amount-note {
  border-radius: 7px;
  padding: 10px 11px;
  background: #fff5bf;
  color: #4f3d00;
  font-weight: 850;
}

.master-row-actions {
  display: grid;
  grid-template-columns: minmax(150px, 1fr);
  gap: 8px;
}

.master-row-actions label {
  min-width: 150px;
}

.master-row-actions button {
  padding: 9px 10px;
}

.case-actions textarea {
  min-height: 86px;
}

.empty {
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.list {
  display: grid;
  gap: 10px;
}

.list-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
}

#toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 420px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #111;
  color: #fff;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: 0.2s ease;
}

#toast.show {
  opacity: 1;
  transform: translateY(0);
}

@keyframes floatBadge {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-10px) rotate(-4deg);
  }
}

@keyframes cardLift {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(8px);
  }
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 222, 0, 0.62);
  }
  100% {
    box-shadow: 0 0 0 30px rgba(255, 222, 0, 0);
  }
}

@keyframes driftText {
  from {
    transform: translateX(0) rotate(-6deg);
  }
  to {
    transform: translateX(-28px) rotate(-6deg);
  }
}

@media (max-width: 980px) {
  .sidebar {
    position: static;
    width: auto;
  }

  main {
    margin-left: 0;
  }

  .masthead {
    grid-template-columns: 1fr;
  }

  .masthead::after {
    display: none;
  }

  .workbar,
  .toolbar,
  .search-panel,
  .table-actions,
  .auth-form {
    align-items: stretch;
    flex-direction: column;
    grid-template-columns: 1fr;
  }

  .form-grid,
  .metrics,
  .case-card {
    grid-template-columns: 1fr;
  }
}
