:root {
  --bg: #f6f8fb;
  --ink: #172033;
  --muted: #667085;
  --line: #d9e2ec;
  --primary: #126c8f;
  --primary-dark: #0b4f6a;
  --accent: #f6b642;
  --success: #14804a;
  --danger: #b42318;
  --shadow: 0 18px 45px rgba(23, 32, 51, 0.12);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(18, 108, 143, 0.12), transparent 38%),
    linear-gradient(315deg, rgba(246, 182, 66, 0.18), transparent 35%),
    var(--bg);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 22px;
}

.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
  align-items: stretch;
  margin-bottom: 18px;
}

.hero-main,
.gross-panel,
.summary-card,
.section {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(217, 226, 236, 0.9);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

.hero-main {
  min-height: 250px;
  padding: clamp(22px, 4vw, 42px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.hero-main::after {
  content: "";
  position: absolute;
  right: clamp(12px, 4vw, 42px);
  bottom: 0;
  width: clamp(120px, 20vw, 230px);
  height: clamp(105px, 16vw, 185px);
  background:
    linear-gradient(#2c394f 0 0) 49% 13% / 42% 8% no-repeat,
    linear-gradient(135deg, #126c8f 0 50%, #0b4f6a 50%) 50% 32% / 78% 31% no-repeat,
    linear-gradient(#f6b642 0 0) 50% 72% / 70% 11% no-repeat,
    linear-gradient(#ffffff 0 0) 50% 89% / 86% 12% no-repeat;
  opacity: 0.22;
  transform: rotate(-3deg);
  pointer-events: none;
}

.brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  width: fit-content;
  margin-bottom: 18px;
  color: var(--primary-dark);
  font-weight: 800;
}

.brand img {
  width: 52px;
  height: 52px;
  border-radius: 8px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 700px;
  margin-bottom: 12px;
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 1.02;
  letter-spacing: 0;
}

.subtitle {
  max-width: 610px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

.gross-panel {
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

label {
  display: block;
  margin-bottom: 8px;
  color: #344054;
  font-weight: 700;
}

.money-input {
  position: relative;
}

.money-input span {
  position: absolute;
  left: 16px;
  top: 50%;
  color: var(--muted);
  font-weight: 700;
  transform: translateY(-50%);
}

.money-input input {
  width: 100%;
  min-height: 58px;
  padding: 12px 16px 12px 58px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fff;
  font-size: 1.35rem;
  font-weight: 800;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.money-input input:focus,
.field input:focus,
.field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(18, 108, 143, 0.16);
}

.summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.summary-card {
  padding: 18px;
}

.summary-card small {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.summary-card strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: clamp(1.45rem, 3vw, 2.25rem);
  line-height: 1.1;
}

.summary-card.net {
  color: #fff;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  border-color: transparent;
}

.summary-card.net small {
  color: rgba(255, 255, 255, 0.78);
}

.grid {
  display: grid;
  grid-template-columns: 1.35fr 0.85fr;
  gap: 18px;
  align-items: start;
}

.section {
  padding: 18px;
}

.section-head {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

h2 {
  margin-bottom: 0;
  font-size: 1.25rem;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
  background: #fff;
}

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

th {
  color: #344054;
  background: #eef5f8;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

tr:last-child td {
  border-bottom: 0;
}

.amount {
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  color: var(--primary-dark);
  background: #e3f2f7;
  font-size: 0.85rem;
  font-weight: 800;
  white-space: nowrap;
}

.remove-btn {
  min-width: 38px;
  min-height: 36px;
  border-radius: var(--radius);
  color: var(--danger);
  background: #fff1f0;
  font-weight: 900;
}

.remove-btn:hover {
  background: #ffd8d4;
}

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

.field input,
.field select {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  outline: none;
}

.button-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.btn {
  min-height: 46px;
  padding: 11px 14px;
  border-radius: var(--radius);
  color: #fff;
  background: var(--primary);
  font-weight: 800;
  transition: transform 0.15s ease, background 0.2s ease;
}

.btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.btn.secondary {
  color: var(--primary-dark);
  background: #e3f2f7;
}

.btn.secondary:hover {
  background: #cbe6ef;
}

.btn.warning {
  color: #241600;
  background: var(--accent);
}

.btn.success {
  background: var(--success);
}

.notice {
  margin-top: 18px;
  padding: 14px 16px;
  border-left: 5px solid var(--accent);
  border-radius: var(--radius);
  color: #344054;
  background: #fff8e7;
  line-height: 1.5;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 20;
  width: min(92vw, 420px);
  padding: 13px 16px;
  border-radius: var(--radius);
  color: #fff;
  background: #172033;
  box-shadow: var(--shadow);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 18px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 900px) {
  .hero,
  .grid,
  .summary {
    grid-template-columns: 1fr;
  }

  .hero-main {
    min-height: 220px;
  }
}

@media (max-width: 560px) {
  .app {
    padding: 14px;
  }

  .hero {
    gap: 12px;
  }

  .hero-main,
  .gross-panel,
  .summary-card,
  .section {
    box-shadow: 0 12px 28px rgba(23, 32, 51, 0.1);
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .button-row {
    grid-template-columns: 1fr;
  }

  th,
  td {
    padding: 11px 10px;
  }
}

@media print {
  body {
    background: #fff;
  }

  .app {
    width: 100%;
    padding: 0;
  }

  .gross-panel,
  .actions,
  .remove-btn,
  .toast {
    display: none !important;
  }

  .hero,
  .grid,
  .summary {
    display: block;
  }

  .hero-main,
  .summary-card,
  .section {
    margin-bottom: 12px;
    box-shadow: none;
    border: 1px solid #b8c4d0;
    break-inside: avoid;
  }

  table {
    min-width: 0;
  }
}
