:root {
  --cramba-navy: #0e3f6b;
  --cramba-blue: #1f6ca8;
  --cramba-sky: #64acd7;
  --cramba-sand: #f5f7fb;
  --cramba-charcoal: #16222d;
  --cramba-mist: #e6eff7;
  --card-shadow: 0 18px 34px rgba(14, 63, 107, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  color: var(--cramba-charcoal);
  font-family: "Outfit", "Avenir Next", "Trebuchet MS", sans-serif;
  background:
    radial-gradient(circle at 10% 10%, rgba(31, 108, 168, 0.18), transparent 45%),
    radial-gradient(circle at 90% 85%, rgba(100, 172, 215, 0.2), transparent 42%),
    linear-gradient(130deg, #f4f8fc 0%, #ffffff 55%, #ecf4fb 100%);
}

.page-shell {
  width: min(1040px, 92vw);
  margin: 0 auto;
  padding: 2.4rem 0 2.8rem;
}

.hero {
  padding: 1.4rem 1.5rem;
  border-left: 8px solid var(--cramba-blue);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(4px);
  border-radius: 14px;
}

.letterhead {
  margin-bottom: 0.9rem;
  padding: 0.9rem 1rem;
  border: 2px solid rgba(14, 63, 107, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
}

.letterhead img {
  display: block;
  width: min(100%, 780px);
  height: auto;
}

.hub-home-link-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin: 0.2rem 0 1rem;
}

.hub-home-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 0.9rem 1.35rem;
  border: 2px solid rgba(14, 63, 107, 0.2);
  border-radius: 14px;
  background: linear-gradient(135deg, var(--cramba-blue) 0%, var(--cramba-navy) 100%);
  color: #ffffff;
  text-decoration: none;
  font-family: "Barlow", "Segoe UI", sans-serif;
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  font-weight: 800;
  letter-spacing: 0.015em;
  box-shadow: 0 14px 22px rgba(14, 63, 107, 0.2);
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.library-link {
  background: linear-gradient(135deg, #2d7aac 0%, #0e3f6b 100%);
}

.hub-home-link:hover,
.hub-home-link:focus-visible {
  transform: translateY(-1px);
  filter: brightness(1.05);
  box-shadow: 0 16px 26px rgba(14, 63, 107, 0.26);
  outline: none;
}

@media (max-width: 640px) {
  .hub-home-link-wrap {
    flex-direction: column;
    align-items: stretch;
  }

  .hub-home-link {
    width: 100%;
    text-align: center;
  }
}

.eyebrow {
  margin: 0 0 0.25rem;
  color: var(--cramba-blue);
  font-family: "Barlow", "Segoe UI", sans-serif;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: "Barlow", "Segoe UI", sans-serif;
  color: var(--cramba-navy);
  font-size: clamp(2.1rem, 4.8vw, 3.2rem);
  line-height: 1.03;
}

.intro {
  max-width: 58ch;
  margin: 0.75rem 0 0;
  font-size: 1.04rem;
}

.menu-grid {
  display: grid;
  gap: 1rem;
  margin-top: 1.2rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.menu-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.8rem;
  min-height: 220px;
  padding: 1.1rem;
  color: inherit;
  text-decoration: none;
  border: 2px solid rgba(14, 63, 107, 0.18);
  border-radius: 14px;
  background: linear-gradient(170deg, #ffffff 0%, var(--cramba-sand) 100%);
  box-shadow: var(--card-shadow);
  transform: translateY(6px);
  opacity: 0;
  animation: card-enter 0.55s ease forwards;
}

.menu-card:nth-child(2) {
  animation-delay: 0.08s;
}

.menu-card:nth-child(3) {
  animation-delay: 0.16s;
}

.menu-card:hover,
.menu-card:focus-visible {
  outline: none;
  border-color: var(--cramba-sky);
  transform: translateY(-2px);
  transition: transform 180ms ease, border-color 180ms ease;
}

.menu-card h2 {
  margin: 0;
  color: var(--cramba-navy);
  font-size: 1.45rem;
  line-height: 1.1;
}

.menu-card p {
  margin: 0;
}

.menu-card span {
  display: inline-flex;
  width: fit-content;
  padding: 0.48rem 0.7rem;
  color: #fff;
  border-radius: 999px;
  background: var(--cramba-blue);
  font-family: "Barlow", "Segoe UI", sans-serif;
  font-weight: 700;
}

.footer-note {
  margin-top: 1.25rem;
  color: #324148;
}

.subpage {
  max-width: 940px;
}

.subpage h1 {
  font-size: clamp(1.4rem, 2.6vw, 2rem);
  line-height: 1.1;
}

.back-link {
  display: inline-flex;
  margin-bottom: 0.55rem;
  color: var(--cramba-navy);
  text-decoration: none;
  font-family: "Barlow", "Segoe UI", sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
}

.compact-title {
  font-size: clamp(1.2rem, 2.2vw, 1.55rem) !important;
  letter-spacing: 0.01em;
}

.form-header-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.7rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  height: fit-content;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(14, 63, 107, 0.16);
  background: rgba(100, 172, 215, 0.12);
  color: var(--cramba-navy);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.form-card {
  margin-top: 0.7rem;
  padding: 0.8rem;
  border: 1px solid rgba(14, 63, 107, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 4px 10px rgba(14, 63, 107, 0.07);
}

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

label,
fieldset {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  color: var(--cramba-charcoal);
  font-weight: 600;
}

label span,
legend {
  color: var(--cramba-navy);
  font-size: 0.96rem;
}

input,
textarea,
select,
button,
.secondary-button {
  font: inherit;
}

input,
textarea,
select {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid #c7d7e6;
  border-radius: 6px;
  color: var(--cramba-charcoal);
  background: #fff;
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid rgba(31, 108, 168, 0.2);
  border-color: var(--cramba-blue);
}

textarea {
  resize: vertical;
  min-height: 84px;
}

.full-width {
  grid-column: 1 / -1;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.45rem;
}

.table-add-row {
  border-top: 1px solid rgba(14, 63, 107, 0.1);
  padding-top: 0.45rem;
}

.table-toolbar p {
  margin: 0;
  color: var(--cramba-navy);
  font-size: 0.75rem;
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
}

.expense-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  table-layout: fixed;
}

.payment-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  table-layout: fixed;
}

.expense-table th,
.expense-table td {
  padding: 0;
  border: 1px solid rgba(14, 63, 107, 0.12);
  background: #fff;
  vertical-align: top;
}

.payment-table th,
.payment-table td {
  padding: 0;
  border: 1px solid rgba(14, 63, 107, 0.12);
  background: #fff;
  vertical-align: top;
}

.expense-table thead th {
  background: var(--cramba-mist);
  color: var(--cramba-navy);
  font-size: 0.8rem;
  line-height: 1.2;
  text-align: left;
  padding-left: 0.75rem;
}

.table-note {
  margin: 0.45rem 0 0;
  color: rgba(14, 63, 107, 0.7);
  font-size: 0.72rem;
  line-height: 1.4;
}

.payment-table thead th {
  background: var(--cramba-mist);
  color: var(--cramba-navy);
  font-size: 0.8rem;
  line-height: 1.2;
  text-align: left;
  padding-left: 0.75rem;
}

.expense-table tbody input,
.expense-table tbody textarea,
.payment-table tbody input,
.payment-table tbody textarea,
.invoice-table tbody input,
.invoice-table tbody textarea {
  min-height: 40px;
  padding: 0.4rem 0.45rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.expense-table tbody textarea,
.payment-table tbody textarea,
.invoice-table tbody textarea {
  display: block;
  resize: none;
  overflow: hidden;
  line-height: 1.35;
}

.expense-table th:nth-child(1),
.expense-table td:nth-child(1) {
  width: 15%;
}

.expense-table th:nth-child(2),
.expense-table td:nth-child(2) {
  width: 16%;
}

.expense-table th:nth-child(3),
.expense-table td:nth-child(3) {
  width: 25%;
}

.expense-table th:nth-child(4),
.expense-table td:nth-child(4),
.expense-table th:nth-child(5),
.expense-table td:nth-child(5),
.expense-table th:nth-child(6),
.expense-table td:nth-child(6) {
  width: 12%;
}

.expense-table th:nth-child(7),
.expense-table td:nth-child(7) {
  width: 8%;
}

.payment-table th:nth-child(1),
.payment-table td:nth-child(1) {
  width: 17%;
}

.payment-table th:nth-child(2),
.payment-table td:nth-child(2) {
  width: 35%;
}

.payment-table th:nth-child(3),
.payment-table td:nth-child(3),
.payment-table th:nth-child(4),
.payment-table td:nth-child(4),
.payment-table th:nth-child(5),
.payment-table td:nth-child(5) {
  width: 14%;
}

.payment-table th:nth-child(6),
.payment-table td:nth-child(6) {
  width: 6%;
}

.expense-table .row-delete-cell,
.payment-table .row-delete-cell,
.invoice-table .row-delete-cell,
.expense-table td:last-child,
.payment-table td:last-child,
.invoice-table td:last-child {
  vertical-align: middle;
  text-align: center;
}

.cost-input,
.tax-input,
.row-total,
#grand-total {
  text-align: right;
}

.row-total,
#grand-total {
  background: rgba(100, 172, 215, 0.08);
  font-weight: 700;
  color: var(--cramba-navy);
}

.totals-card {
  padding-top: 0.9rem;
  padding-bottom: 0.9rem;
}

.grand-total-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.8rem;
  margin-top: 0.75rem;
}

.grand-total-row label {
  margin: 0;
  font-size: 1.02rem;
}

#grand-total {
  max-width: 210px;
  font-size: 1.15rem;
}

.radio-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.3rem;
  padding: 0.4rem 0.15rem;
}

.radio-list label {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}

.radio-list input {
  width: auto;
  margin: 0;
}

.notes-field {
  margin-top: 1rem;
}

.reimbursement-side-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.75rem;
}

.form-note {
  margin: 0;
  padding: 0.75rem 0.9rem;
  border-radius: 8px;
  background: rgba(100, 172, 215, 0.12);
  color: var(--cramba-navy);
  font-size: 0.92rem;
  line-height: 1.5;
}

.instructions-note {
  margin: 0 0 1rem;
}

.invoice-top-grid,
.invoice-detail-grid,
.invoice-bottom-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.invoice-detail-grid {
  margin-top: 0.7rem;
}

.invoice-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  table-layout: fixed;
}

.invoice-table th,
.invoice-table td {
  padding: 0;
  border: 1px solid rgba(14, 63, 107, 0.12);
  background: #fff;
  vertical-align: top;
}

.invoice-table thead th {
  background: var(--cramba-mist);
  color: var(--cramba-navy);
  font-size: 0.8rem;
  line-height: 1.2;
  text-align: left;
  padding-left: 0.75rem;
}

.invoice-table th:nth-child(1),
.invoice-table td:nth-child(1) {
  width: 52%;
}

.invoice-table th:nth-child(2),
.invoice-table td:nth-child(2) {
  width: 12%;
}

.invoice-table th:nth-child(3),
.invoice-table td:nth-child(3),
.invoice-table th:nth-child(4),
.invoice-table td:nth-child(4) {
  width: 17%;
}

.invoice-table th:nth-child(5),
.invoice-table td:nth-child(5) {
  width: 5%;
}

.qty-input,
.unit-price-input,
.line-total,
#invoice-subtotal,
#invoice-total {
  text-align: right;
}

.line-total,
#invoice-total {
  background: rgba(100, 172, 215, 0.08);
  font-weight: 700;
  color: var(--cramba-navy);
}

.invoice-totals {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-left: auto;
  width: min(100%, 340px);
}

.invoice-grand-total-wrap span {
  font-size: 1.06rem;
}

.invoice-grand-total {
  font-size: 1.36rem;
}

.instructions-card h2 {
  margin: 0 0 0.6rem;
  color: var(--cramba-navy);
  font-size: 1.2rem;
}

.instructions-card ol {
  margin: 0 0 1rem;
  padding-left: 1.3rem;
  line-height: 1.7;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.row-delete-button {
  min-width: 34px;
  min-height: 34px;
  padding: 0.25rem;
}

button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.52rem 0.8rem;
  border: none;
  border-radius: 6px;
  background: var(--cramba-blue);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 180ms ease, opacity 180ms ease;
}

button:hover,
button:focus-visible,
.secondary-button:hover,
.secondary-button:focus-visible {
  transform: translateY(-1px);
}

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

.secondary-button {
  background: var(--cramba-navy);
}

.row-delete-button {
  width: 100%;
  min-width: 26px;
  padding: 0.36rem 0.3rem;
  border-radius: 5px;
  background: #f6dfe0;
  color: #8d1f25;
  font-size: 0.9rem;
  line-height: 1;
}

.row-delete-button:hover,
.row-delete-button:focus-visible {
  background: #f2ccce;
}

.hidden {
  display: none;
}

.print-footer-note {
  display: none;
}

.form-footer {
  margin-top: 2rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(14, 63, 107, 0.18);
  color: var(--cramba-navy);
  font-size: 0.8rem;
  text-align: center;
  opacity: 0.8;
}

.form-footer p {
  margin: 0;
}

@keyframes card-enter {
  from {
    transform: translateY(6px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(1040px, 94vw);
    padding-top: 1rem;
  }

  .hero {
    padding: 1.1rem;
  }

  .menu-card {
    min-height: 200px;
  }

  .form-header-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .form-grid,
  .reimbursement-grid,
  .invoice-top-grid,
  .invoice-detail-grid,
  .invoice-bottom-grid {
    grid-template-columns: 1fr;
  }

  .table-toolbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.45rem;
  }
}

@media print {
  @page {
    size: 8.5in 11in;
    margin: 0.5in;
  }

  body {
    background: #fff;
  }

  .page-shell {
    width: 100%;
    max-width: none;
    padding: 0;
    padding-bottom: 0.55in;
  }

  .back-link,
  .no-print,
  .action-row,
  .table-toolbar {
    display: none !important;
  }

  .form-card {
    box-shadow: none;
    border-color: rgba(14, 63, 107, 0.18);
    margin-top: 0.42rem;
    padding: 0.45rem;
    break-inside: avoid;
  }

  .letterhead {
    margin-bottom: 0.42rem;
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
  }

  .form-header-row {
    margin-bottom: 0.42rem;
  }

  h1,
  .compact-title {
    font-size: 1.15rem !important;
    line-height: 1.05;
  }

  label span,
  legend {
    font-size: 0.83rem;
  }

  input,
  textarea,
  select {
    font-size: 0.86rem;
    padding: 0.32rem 0.45rem;
    border-radius: 4px;
  }

  textarea {
    min-height: 60px;
  }

  .expense-table th,
  .expense-table td,
  .payment-table th,
  .payment-table td,
  .invoice-table th,
  .invoice-table td {
    padding: 0.2rem 0.24rem;
    font-size: 0.75rem;
  }

  .expense-table tbody input,
  .payment-table tbody input,
  .invoice-table tbody input {
    min-height: 24px;
  }

  .table-wrap {
    overflow: visible;
  }

  .print-footer-note {
    display: block;
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    padding-top: 0.08in;
    border-top: 1px solid rgba(14, 63, 107, 0.18);
    color: var(--cramba-navy);
    background: #fff;
    font-size: 0.74rem;
    line-height: 1.3;
    text-align: center;
  }
}
