:root {
  --kf-background: #fdf9f9;
  --kf-navy: #060649;
  --kf-gold: #b49167;
  --kf-gold-dark: #846440;
  --kf-gold-soft: #f2e9de;
  --kf-surface: #ffffff;
  --kf-text: #060649;
  --kf-muted: #62627c;
  --kf-border: #e8e1df;
  --kf-success: #26705b;
  --kf-success-soft: #eaf5f0;
  --kf-warning: #985d17;
  --kf-warning-soft: #fff4e4;
  --kf-error: #a83b46;
  --kf-error-soft: #fff0f1;
  --kf-info-soft: #f1f2f9;
  --shadow-sm: 0 10px 34px rgba(6, 6, 73, 0.055);
  --shadow-focus: 0 0 0 4px rgba(180, 145, 103, 0.28);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --content-width: 1120px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--kf-text);
  background:
    radial-gradient(circle at 8% 9%, rgba(180, 145, 103, 0.09), transparent 24rem),
    linear-gradient(180deg, #fffdfd 0, var(--kf-background) 22rem);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:not(:disabled),
label[for] {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
[tabindex="0"]:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 10px 16px;
  color: #fff;
  background: var(--kf-navy);
  border-radius: 8px;
  transform: translateY(-180%);
}

.skip-link:focus {
  transform: translateY(0);
}

.page-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header,
.site-footer,
main {
  width: min(calc(100% - 40px), var(--content-width));
  margin-inline: auto;
}

.site-header {
  min-height: 110px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-block: 22px;
}

.brand {
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
}

.brand-frame {
  width: 190px;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
}

.brand img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 22px;
}

.secure-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--kf-muted);
  font-size: 0.875rem;
  font-weight: 600;
}

.secure-label svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--kf-gold-dark);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.text-button {
  padding: 6px 0;
  border: 0;
  border-bottom: 1px solid currentColor;
  color: var(--kf-navy);
  background: transparent;
  font-size: 0.875rem;
  font-weight: 650;
}

main {
  flex: 1;
}

.loading-state,
.access-state {
  width: min(100%, 650px);
  min-height: 460px;
  margin: 5vh auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 50px 32px;
  text-align: center;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(232, 225, 223, 0.9);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.loading-state h1,
.access-state h1 {
  margin: 24px 0 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.8rem, 5vw, 2.55rem);
  font-weight: 400;
  line-height: 1.12;
}

.loading-state p,
.access-state p {
  max-width: 490px;
  margin: 0;
  color: var(--kf-muted);
}

.loading-mark {
  width: 38px;
  height: 38px;
  border: 2px solid var(--kf-gold-soft);
  border-top-color: var(--kf-gold);
  border-radius: 50%;
  animation: rotate 0.9s linear infinite;
}

.access-icon {
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  color: var(--kf-gold-dark);
  background: var(--kf-gold-soft);
  border-radius: 50%;
}

.access-icon.error {
  color: var(--kf-error);
  background: var(--kf-error-soft);
}

.access-icon svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.access-state .primary-button {
  margin-top: 26px;
}

.portal {
  padding: 34px 0 76px;
}

.welcome-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(290px, 390px);
  gap: 52px;
  align-items: end;
  margin-bottom: 42px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--kf-gold-dark);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.welcome-copy h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.35rem, 6vw, 4.55rem);
  font-weight: 400;
  letter-spacing: -0.045em;
  line-height: 0.98;
}

.welcome-copy > p:last-child {
  max-width: 670px;
  margin: 22px 0 0;
  color: var(--kf-muted);
  font-size: 1.05rem;
}

.progress-panel {
  padding: 24px 26px;
  background: var(--kf-navy);
  color: #fff;
  border-radius: var(--radius-md);
  box-shadow: 0 14px 40px rgba(6, 6, 73, 0.14);
}

.progress-panel__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.progress-panel__label {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.82rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.progress-panel__count {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.65rem;
}

.progress-track {
  width: 100%;
  height: 6px;
  margin: 18px 0 12px;
  overflow: hidden;
  appearance: none;
  background: rgba(255, 255, 255, 0.17);
  border: 0;
  border-radius: 999px;
}

.progress-track::-webkit-progress-bar {
  background: rgba(255, 255, 255, 0.17);
  border-radius: 999px;
}

.progress-track::-webkit-progress-value {
  background: var(--kf-gold);
  border-radius: 999px;
  transition: width 300ms ease;
}

.progress-track::-moz-progress-bar {
  background: var(--kf-gold);
  border-radius: 999px;
}

.progress-panel__hint {
  margin: 0;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.86rem;
}

.advisor-note {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 26px;
  padding: 16px 20px;
  background: rgba(242, 233, 222, 0.64);
  border: 1px solid rgba(180, 145, 103, 0.24);
  border-radius: var(--radius-sm);
}

.advisor-monogram {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: var(--kf-navy);
  background: #fff;
  border: 1px solid rgba(180, 145, 103, 0.42);
  border-radius: 50%;
  font-family: Georgia, "Times New Roman", serif;
}

.advisor-note p {
  margin: 0;
  color: var(--kf-muted);
  font-size: 0.92rem;
}

.advisor-note strong {
  color: var(--kf-navy);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin: 42px 0 18px;
}

.section-heading h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.65rem, 4vw, 2.25rem);
  font-weight: 400;
  line-height: 1.15;
}

.section-heading p {
  margin: 0 0 4px;
  color: var(--kf-muted);
  font-size: 0.9rem;
}

.pieces-list {
  display: grid;
  gap: 18px;
}

.piece-card {
  position: relative;
  overflow: hidden;
  background: var(--kf-surface);
  border: 1px solid var(--kf-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.piece-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--kf-gold);
  content: "";
}

.piece-card[data-status="validated"]::before {
  background: var(--kf-success);
}

.piece-card[data-status="rejected"]::before {
  background: var(--kf-error);
}

.piece-card__main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 34px;
  padding: 30px 32px;
}

.piece-card__title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.piece-card h3 {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 730;
  line-height: 1.35;
}

.piece-card__instructions {
  max-width: 690px;
  margin: 9px 0 0;
  color: var(--kf-muted);
  font-size: 0.94rem;
}

.requirement {
  display: inline-block;
  margin-top: 12px;
  color: var(--kf-gold-dark);
  font-size: 0.82rem;
  font-weight: 700;
}

.status-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  color: var(--kf-navy);
  background: var(--kf-info-soft);
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 750;
  white-space: nowrap;
}

.status-badge::before {
  width: 6px;
  height: 6px;
  background: currentColor;
  border-radius: 50%;
  content: "";
}

.status-badge[data-tone="success"] {
  color: var(--kf-success);
  background: var(--kf-success-soft);
}

.status-badge[data-tone="error"] {
  color: var(--kf-error);
  background: var(--kf-error-soft);
}

.status-badge[data-tone="warning"] {
  color: var(--kf-warning);
  background: var(--kf-warning-soft);
}

.piece-card__status-message {
  margin: 18px 0 0;
  padding: 12px 14px;
  color: var(--kf-error);
  background: var(--kf-error-soft);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
}

.piece-card__status-message strong {
  display: block;
}

.upload-zone {
  min-height: 154px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
  background: #fcfafa;
  border: 1px dashed #cdbba7;
  border-radius: var(--radius-md);
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.upload-zone[data-dragging="true"] {
  background: var(--kf-gold-soft);
  border-color: var(--kf-gold-dark);
  transform: translateY(-2px);
}

.upload-zone__icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  margin-bottom: 9px;
  color: var(--kf-gold-dark);
  background: var(--kf-gold-soft);
  border-radius: 50%;
}

.upload-zone__icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.upload-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 12px;
  color: var(--kf-navy);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--kf-gold);
  font-size: 0.87rem;
  font-weight: 750;
}

.upload-zone > span:last-child {
  margin-top: 6px;
  color: var(--kf-muted);
  font-size: 0.75rem;
}

.upload-zone--locked {
  color: var(--kf-muted);
  background: #f8f7f7;
  border-style: solid;
  border-color: var(--kf-border);
}

.files-list {
  margin: 0;
  padding: 0 32px 26px;
  list-style: none;
}

.file-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 13px;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid #efebea;
}

.file-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: var(--kf-gold-dark);
  background: var(--kf-gold-soft);
  border-radius: 10px;
}

.file-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.file-details {
  min-width: 0;
}

.file-name {
  display: block;
  overflow: hidden;
  font-size: 0.9rem;
  font-weight: 680;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-meta,
.file-state {
  color: var(--kf-muted);
  font-size: 0.78rem;
}

.file-state--error {
  color: var(--kf-error);
}

.file-progress {
  width: min(100%, 360px);
  height: 4px;
  display: block;
  margin-top: 8px;
  overflow: hidden;
  appearance: none;
  background: #eee9e8;
  border: 0;
  border-radius: 999px;
}

.file-progress::-webkit-progress-bar {
  background: #eee9e8;
  border-radius: 999px;
}

.file-progress::-webkit-progress-value {
  background: var(--kf-gold);
  border-radius: 999px;
  transition: width 180ms linear;
}

.file-progress::-moz-progress-bar {
  background: var(--kf-gold);
  border-radius: 999px;
}

.file-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-button {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--kf-muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
}

.icon-button:hover {
  color: var(--kf-error);
  background: var(--kf-error-soft);
}

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

.confirm-delete {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--kf-error);
  font-size: 0.8rem;
  font-weight: 700;
}

.confirm-delete button {
  padding: 5px 8px;
  border: 1px solid currentColor;
  border-radius: 7px;
  background: #fff;
  font-size: 0.76rem;
  font-weight: 700;
}

.submit-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 30px;
  align-items: center;
  margin-top: 26px;
  padding: 28px 30px;
  background: var(--kf-surface);
  border: 1px solid var(--kf-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.submit-panel h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.5rem;
  font-weight: 400;
}

.submit-panel p {
  margin: 7px 0 0;
  color: var(--kf-muted);
  font-size: 0.9rem;
}

.primary-button,
.secondary-button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 12px 21px;
  border-radius: 11px;
  font-weight: 720;
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.primary-button {
  color: #fff;
  background: var(--kf-navy);
  border: 1px solid var(--kf-navy);
}

.primary-button:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(6, 6, 73, 0.18);
}

.primary-button:disabled {
  color: #8c8c9c;
  background: #e8e7eb;
  border-color: #e8e7eb;
  cursor: not-allowed;
}

.secondary-button {
  color: var(--kf-navy);
  background: #fff;
  border: 1px solid var(--kf-border);
}

.submitted-panel {
  position: relative;
  overflow: hidden;
  margin-top: 26px;
  padding: 34px;
  color: #fff;
  background: var(--kf-navy);
  border-radius: var(--radius-lg);
}

.submitted-panel::after {
  position: absolute;
  top: -80px;
  right: -50px;
  width: 230px;
  height: 230px;
  border: 1px solid rgba(180, 145, 103, 0.5);
  border-radius: 50%;
  content: "";
}

.submitted-panel h2 {
  position: relative;
  z-index: 1;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.65rem, 4vw, 2.25rem);
  font-weight: 400;
}

.submitted-panel p {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: 10px 0 0;
  color: rgba(255, 255, 255, 0.75);
}

.toast-region {
  position: fixed;
  z-index: 20;
  right: 20px;
  bottom: 20px;
  width: min(calc(100% - 40px), 390px);
  display: grid;
  gap: 10px;
}

.toast {
  padding: 14px 16px;
  color: #fff;
  background: var(--kf-navy);
  border-left: 4px solid var(--kf-gold);
  border-radius: 10px;
  box-shadow: 0 12px 34px rgba(6, 6, 73, 0.18);
  font-size: 0.88rem;
  animation: toast-in 220ms ease-out;
}

.toast[data-tone="error"] {
  background: #5f1e27;
  border-left-color: #f0a8ae;
}

.site-footer {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-block: 24px;
  color: var(--kf-muted);
  border-top: 1px solid var(--kf-border);
  font-size: 0.8rem;
}

.site-footer p {
  margin: 0;
}

.noscript-message {
  position: fixed;
  inset: 20px;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 30px;
  color: #fff;
  background: var(--kf-navy);
  text-align: center;
}

@keyframes rotate {
  to { transform: rotate(360deg); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
}

@media (max-width: 800px) {
  .welcome-grid {
    grid-template-columns: 1fr;
    gap: 28px;
    align-items: stretch;
  }

  .piece-card__main {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .upload-zone {
    min-height: 130px;
  }
}

@media (max-width: 600px) {
  .site-header,
  .site-footer,
  main {
    width: min(calc(100% - 28px), var(--content-width));
  }

  .site-header {
    min-height: 86px;
    padding-block: 16px;
  }

  .brand-frame {
    width: 148px;
  }

  .secure-label {
    font-size: 0;
    gap: 0;
  }

  .secure-label svg {
    width: 20px;
    height: 20px;
  }

  .header-actions {
    gap: 14px;
  }

  .portal {
    padding-top: 24px;
  }

  .welcome-copy h1 {
    font-size: clamp(2.25rem, 13vw, 3.2rem);
  }

  .piece-card__main,
  .files-list,
  .submit-panel,
  .submitted-panel {
    padding-inline: 20px;
  }

  .piece-card__title-row {
    flex-direction: column-reverse;
    align-items: flex-start;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .file-row {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .file-actions {
    grid-column: 2;
    justify-content: flex-start;
  }

  .submit-panel {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .submit-panel .primary-button {
    width: 100%;
  }

  .site-footer {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 4px;
  }
}

@media (max-width: 380px) {
  .text-button {
    font-size: 0.78rem;
  }

  .progress-panel,
  .piece-card__main,
  .files-list {
    padding-inline: 17px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
