﻿:root {
  --plum: #002776;
  --plum-2: #ff6600;
  --plum-soft: #fff1e6;
  --gold: #ff6600;
  --ink: #0d1730;
  --muted: #667085;
  --line: #dbe5f5;
  --surface: #ffffff;
  --background: #f4f8ff;
  --danger: #a52b32;
  --shadow: 0 12px 32px rgba(0, 39, 118, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--background);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  z-index: 20;
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  padding: 12px max(24px, calc((100vw - 1500px) / 2));
  border-bottom: 1px solid rgba(0, 39, 118, 0.12);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
}

.brand,
.brand > div,
.top-actions,
.section-heading > div,
.bottom-actions {
  display: flex;
  align-items: center;
}

.brand {
  gap: 12px;
}

.brand > div {
  align-items: flex-start;
  flex-direction: column;
}

.brand-logo {
  display: block;
  width: 600px;
  height:200px;
  object-fit: contain;
}

.eyebrow {
  color: var(--plum-2);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.brand strong {
  margin-top: 1px;
  font-size: 18px;
}

.top-actions {
  gap: 10px;
}

.save-state {
  margin-right: 6px;
  color: var(--muted);
  font-size: 13px;
}

.page-shell {
  width: min(1500px, calc(100% - 48px));
  margin: 0 auto;
  padding: 46px 0 80px;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 30px;
}

.hero-title {
  display: flex;
  align-items: center;
  gap: 18px;
}

.form-logo {
  display: block;
  width: 68px;
  height: 68px;
  flex: 0 0 auto;
  object-fit: contain;
}

.hero h1 {
  margin: 7px 0 8px;
  color: var(--plum);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(36px, 4vw, 58px);
  font-weight: 600;
  letter-spacing: -0.035em;
}

.hero p,
.section-heading p {
  margin: 0;
  color: var(--muted);
}

.total-card {
  min-width: 270px;
  padding: 20px 24px;
  border: 1px solid rgba(255, 102, 0, 0.35);
  border-radius: 18px;
  color: white;
  background: linear-gradient(135deg, var(--plum), #0045a8);
  box-shadow: var(--shadow);
}

.total-card span,
.total-card small {
  display: block;
  color: rgba(255, 255, 255, 0.72);
}

.total-card strong {
  display: block;
  margin: 4px 0;
  font-family: Georgia, serif;
  font-size: 34px;
}

.panel {
  margin-top: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 25px 28px;
  border-bottom: 1px solid var(--line);
}

.section-heading > div {
  gap: 14px;
}

.section-heading h2 {
  margin: 0 0 4px;
  color: var(--plum);
  font-family: Georgia, serif;
  font-size: 24px;
}

.section-heading p {
  font-size: 14px;
}

.step {
  display: grid;
  flex: 0 0 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: linear-gradient(135deg, var(--plum), #0045a8);
  font-weight: 800;
}

.identity-grid {
  display: grid;
  grid-template-columns: 1.3fr 1.5fr 1fr;
  gap: 20px;
  padding: 28px;
}

label > span {
  display: block;
  margin-bottom: 8px;
  color: #263653;
  font-size: 13px;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid #cfdaf0;
  border-radius: 9px;
  outline: none;
  color: var(--ink);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.identity-grid input {
  height: 46px;
  padding: 0 13px;
}

input:focus,
textarea:focus {
  border-color: var(--plum-2);
  box-shadow: 0 0 0 3px rgba(255, 102, 0, 0.16);
}

input:invalid:not(:placeholder-shown) {
  border-color: var(--danger);
}

.button {
  text-decoration: none;
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 750;
  transition: transform 0.12s, box-shadow 0.12s, background 0.12s;
}

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

.button-primary {
  color: white;
  background: var(--plum);
  box-shadow: 0 6px 16px rgba(0, 39, 118, 0.2);
}

.button-primary:hover {
  background: #003894;
}

.button-secondary {
  border-color: rgba(255, 102, 0, 0.24);
  color: var(--plum);
  background: var(--plum-soft);
}

.button-ghost {
  border-color: var(--line);
  color: #4c4147;
  background: white;
}

.button-large {
  min-height: 48px;
  padding-inline: 22px;
}

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

table {
  width: 100%;
  min-width: 1320px;
  border-collapse: collapse;
  table-layout: fixed;
}

th {
  height: 72px;
  padding: 11px 8px;
  border-bottom: 1px solid var(--line);
  color: #263653;
  background: #eef5ff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.025em;
  line-height: 1.3;
  text-align: left;
  text-transform: uppercase;
  vertical-align: bottom;
}

th.numeric {
  text-align: right;
}

th:nth-child(2) { width: 132px; }
th:nth-child(3) { width: 238px; }
th:nth-child(4) { width: 178px; }
th:nth-child(5) { width: 106px; }
th:nth-child(6) { width: 78px; }
th:nth-child(7) { width: 118px; }
th:nth-child(8) { width: 126px; }
th:nth-child(9) { width: 115px; }
th:nth-child(10) { width: 126px; }

.row-number,
.row-index {
  width: 42px;
  text-align: center;
}

.delete-column {
  width: 48px;
}

td {
  height: 66px;
  padding: 8px;
  border-bottom: 1px solid #e5edf9;
  background: white;
  vertical-align: middle;
}

.expense-row:hover td {
  background: #f8fbff;
}

.row-index {
  color: #998b93;
  font-size: 12px;
  font-weight: 800;
}

td input,
td textarea {
  min-height: 40px;
  padding: 8px 9px;
  border-color: transparent;
  background: #f5f8fd;
  font-size: 13px;
}

td textarea {
  display: block;
  resize: vertical;
  line-height: 1.35;
}

td input[type="number"] {
  text-align: right;
}

.money-input {
  position: relative;
}

.money-input span {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 10px;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 13px;
}

.money-input input {
  padding-left: 25px;
}

.row-total {
  color: var(--plum);
  font-weight: 850;
  text-align: right;
  white-space: nowrap;
}

.icon-button {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 0;
  border-radius: 8px;
  color: #9a858f;
  background: transparent;
  font-size: 23px;
}

.icon-button:hover {
  color: var(--danger);
  background: #faecee;
}

.table-footer {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 16px 28px;
  border-top: 1px solid var(--line);
  background: #eef5ff;
}

.table-footer p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.footer-total {
  display: flex;
  min-width: 230px;
  align-items: center;
  justify-content: space-between;
  color: var(--plum);
}

.footer-total strong {
  font-family: Georgia, serif;
  font-size: 26px;
}

.empty-state {
  display: flex;
  min-height: 220px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 7px;
  color: var(--muted);
}

.empty-state strong {
  color: var(--plum);
  font-family: Georgia, serif;
  font-size: 21px;
}

.empty-state .button {
  margin-top: 10px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  padding: 26px 28px;
}

.summary-grid > div {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fbff;
}

.summary-grid span {
  display: block;
  min-height: 34px;
  color: var(--muted);
  font-size: 13px;
}

.summary-grid strong {
  display: block;
  margin-top: 8px;
  color: var(--plum);
  font-size: 22px;
}

.summary-grid .summary-grand {
  color: white;
  border-color: var(--plum);
  background: linear-gradient(135deg, var(--plum), #0045a8);
}

.summary-grand span,
.summary-grand strong {
  color: white;
}

.form-message {
  min-height: 20px;
  margin: 0 28px;
  color: var(--danger);
  font-size: 13px;
}

.bottom-actions {
  justify-content: flex-end;
  gap: 12px;
  padding: 20px 28px 28px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.honeypot {
  position: absolute !important;
  left: -10000px !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
}

.button[disabled] {
  cursor: wait;
  opacity: 0.68;
  transform: none;
}

.form-message.success {
  color: #287245;
}

@media (max-width: 900px) {
  .save-state {
    display: none;
  }

  .page-shell {
    width: min(100% - 28px, 1500px);
    padding-top: 28px;
  }

  .hero {
    align-items: stretch;
    flex-direction: column;
  }

  .total-card {
    width: 100%;
  }

  .identity-grid,
  .summary-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 620px) {
  .topbar {
    min-height: 66px;
    padding-inline: 14px;
  }

  .top-actions .button-ghost {
    display: none;
  }

  .brand-logo {
    width: 40px;
    height: 40px;
  }

  .hero-title {
    align-items: flex-start;
    gap: 12px;
  }

  .form-logo {
    width: 50px;
    height: 50px;
  }

  .top-actions .button {
    min-height: 38px;
    padding-inline: 12px;
    font-size: 13px;
  }

  .page-shell {
    width: min(100% - 20px, 1500px);
    padding-bottom: 36px;
  }

  .hero h1 {
    font-size: 38px;
  }

  .panel {
    border-radius: 16px;
  }

  .section-heading {
    align-items: flex-start;
    padding: 20px;
  }

  .activity-heading {
    flex-direction: column;
  }

  .add-row-top {
    width: 100%;
  }

  .identity-grid,
  .summary-grid {
    grid-template-columns: 1fr;
    padding: 20px;
  }

  .summary-grid span {
    min-height: 0;
  }

  .table-footer {
    align-items: stretch;
    flex-direction: column;
    padding-inline: 20px;
  }

  .footer-total {
    width: 100%;
  }

  .bottom-actions {
    align-items: stretch;
    flex-direction: column-reverse;
    padding-inline: 20px;
  }
}

@media print {
  @page {
    size: landscape;
    margin: 10mm;
  }

  body {
    background: white;
    font-size: 10px;
  }

  .topbar,
  .add-row-top,
  .delete-column,
  td:last-child,
  .summary-panel,
  .empty-state {
    display: none !important;
  }

  .page-shell {
    width: 100%;
    padding: 0;
  }

  .hero {
    align-items: flex-end;
    margin-bottom: 12px;
  }

  .hero h1 {
    margin-block: 2px;
    font-size: 28px;
  }

  .hero p {
    display: none;
  }

  .total-card {
    min-width: 210px;
    padding: 10px 14px;
    color: var(--plum);
    border: 1px solid var(--plum);
    background: white;
    box-shadow: none;
  }

  .total-card span,
  .total-card small {
    color: #555;
  }

  .total-card strong {
    font-size: 24px;
  }

  .panel {
    margin-top: 10px;
    border-radius: 0;
    box-shadow: none;
    break-inside: avoid;
  }

  .section-heading {
    padding: 8px 12px;
  }

  .section-heading h2 {
    font-size: 16px;
  }

  .section-heading p,
  .step {
    display: none;
  }

  .identity-grid {
    grid-template-columns: 1.2fr 1.5fr 0.8fr;
    gap: 10px;
    padding: 10px 12px;
  }

  .identity-grid input {
    height: 28px;
    padding: 3px 5px;
    border: 0;
    border-bottom: 1px solid #777;
    border-radius: 0;
  }

  table {
    min-width: 0;
    table-layout: fixed;
  }

  th {
    height: 44px;
    padding: 4px;
    font-size: 7px;
  }

  th:nth-child(2) { width: 8%; }
  th:nth-child(3) { width: 18%; }
  th:nth-child(4) { width: 14%; }
  th:nth-child(n+5):nth-child(-n+9) { width: 9%; }
  th:nth-child(10) { width: 10%; }

  td {
    height: 29px;
    padding: 2px 3px;
  }

  td input,
  td textarea {
    min-height: 23px;
    padding: 2px;
    border: 0;
    background: white;
    font-size: 8px;
  }

  .row-total,
  .money-input span {
    font-size: 8px;
  }

  .table-footer {
    min-height: 40px;
    padding: 7px 12px;
  }

  .table-footer p {
    font-size: 8px;
  }

  .footer-total strong {
    font-size: 18px;
  }
}
