:root {
  --rose-100: #f8e9f5;
  --rose-200: #efd7e8;
  --lilac-200: #dcc8e8;
  --plum-600: #6d2f67;
  --plum-700: #4f214c;
  --gold-400: #d7b16d;
  --cream-100: #fff7ef;
  --text-900: #3f1b3d;
  --text-700: #62305f;
  --shadow: 0 14px 30px rgba(79, 33, 76, 0.16);
  --radius-lg: 20px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--text-900);
  font-family: "Nunito Sans", "Trebuchet MS", sans-serif;
  background: linear-gradient(
    145deg,
    var(--rose-100) 0%,
    var(--lilac-200) 100%
  );
  overflow-x: hidden;
}

.home-page {
  background:
    radial-gradient(circle at 8% 14%, rgba(255, 244, 201, 0.72), transparent 18%),
    radial-gradient(circle at 88% 14%, rgba(255, 215, 240, 0.6), transparent 24%),
    radial-gradient(circle at 14% 82%, rgba(206, 164, 246, 0.5), transparent 24%),
    radial-gradient(circle at 84% 84%, rgba(255, 218, 178, 0.4), transparent 20%),
    radial-gradient(circle at 52% 48%, rgba(255, 255, 255, 0.28), transparent 62%),
    linear-gradient(160deg, #e6c1ef 0%, #f1d5ec 38%, #f0cde6 68%, #d9b7ec 100%);
}

.home-page .background-glow {
  background:
    radial-gradient(circle at 20% 18%, rgba(255, 232, 171, 0.5), transparent 26%),
    radial-gradient(circle at 82% 12%, rgba(255, 248, 219, 0.4), transparent 32%),
    radial-gradient(circle at 30% 58%, rgba(255, 255, 255, 0.28), transparent 40%),
    radial-gradient(circle at 12% 88%, rgba(255, 244, 208, 0.35), transparent 30%),
    radial-gradient(circle at 88% 78%, rgba(255, 226, 182, 0.3), transparent 28%);
}

.home-page .app-shell {
  max-width: 430px;
  min-height: 100vh;
  padding-top: 70px;
}

.home-page .brand-card {
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.home-page .brand-mark {
  font-size: clamp(3rem, 12vw, 4.4rem);
  color: #7a336e;
  text-shadow: 0 2px 0 rgba(255, 238, 255, 0.7);
}

.home-page #brand-title {
  font-size: clamp(2.5rem, 10.5vw, 3.9rem);
  color: #5c2456;
  text-shadow: 0 2px 0 rgba(255, 238, 255, 0.7);
}

.home-page .brand-tagline {
  margin-top: 10px;
  font-size: 1rem;
  color: rgba(92, 36, 86, 0.86);
}

.home-page .quick-actions {
  margin-top: 120px;
  gap: 12px;
}

.home-page .btn {
  border: 1px solid rgba(122, 74, 131, 0.28);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.58),
    0 4px 10px rgba(112, 63, 110, 0.22);
}

.home-page .btn-primary {
  background: linear-gradient(180deg, #c487dd 0%, #b16ccf 50%, #9f59bf 100%);
  color: #fff7ff;
}

.home-page .btn-secondary {
  background: linear-gradient(180deg, #f6e1b8 0%, #f4d79f 48%, #f0cb8d 100%);
  color: #643454;
}

.background-glow {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(
      circle at 18% 20%,
      rgba(215, 177, 109, 0.33),
      transparent 40%
    ),
    radial-gradient(
      circle at 78% 10%,
      rgba(109, 47, 103, 0.12),
      transparent 45%
    ),
    radial-gradient(
      circle at 50% 80%,
      rgba(255, 255, 255, 0.5),
      transparent 50%
    );
  pointer-events: none;
}

.app-shell {
  position: relative;
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 18px 14px 28px;
}

.screen {
  display: none;
  animation: fade-in 220ms ease-out;
}

.screen.is-active {
  display: block;
}

.brand-card {
  border-radius: var(--radius-lg);
  padding: 28px 18px;
  text-align: center;
  background: linear-gradient(
    165deg,
    rgba(255, 247, 239, 0.95),
    rgba(239, 215, 232, 0.92)
  );
  box-shadow: var(--shadow);
  border: 1px solid rgba(109, 47, 103, 0.14);
}

.brand-mark {
  margin: 0;
  color: var(--plum-600);
  font-size: clamp(2.3rem, 9vw, 4rem);
  font-family: "Marcellus", "Georgia", serif;
  line-height: 1;
}

#brand-title {
  margin: 0;
  color: var(--plum-700);
  font-family: "Marcellus", "Palatino Linotype", serif;
  font-size: clamp(1.9rem, 8vw, 3rem);
  font-weight: 400;
  line-height: 1.06;
}

.brand-tagline {
  margin-top: 8px;
  color: var(--text-700);
  font-size: 0.98rem;
}

.quick-actions {
  margin-top: 18px;
  display: grid;
  gap: 10px;
}

.app-note {
  margin-top: 16px;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-700);
}

.btn {
  width: 100%;
  border: none;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  padding: 12px 18px;
  cursor: pointer;
  transition:
    transform 120ms ease,
    box-shadow 120ms ease,
    filter 120ms ease;
  text-align: center;
}

.btn:hover,
.btn:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(79, 33, 76, 0.15);
}

.btn-primary {
  background: linear-gradient(140deg, var(--plum-600), var(--plum-700));
  color: #fff;
}

.btn-secondary {
  background: linear-gradient(145deg, var(--gold-400), #f2d9a7);
  color: #4a2a1f;
}

.btn-outline {
  border: 1px solid rgba(109, 47, 103, 0.4);
  background: rgba(255, 247, 239, 0.7);
  color: var(--plum-700);
}

.btn-ghost {
  width: auto;
  padding: 8px 14px;
  border: 1px solid rgba(79, 33, 76, 0.22);
  background: rgba(255, 255, 255, 0.64);
  color: var(--plum-700);
}

.screen-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.budget-top {
  margin-bottom: 8px;
}

#budget-title {
  margin: 16px 0 16px;
  font-family: "Marcellus", "Palatino Linotype", serif;
  font-size: clamp(1.15rem, 5.6vw, 1.8rem);
  line-height: 1.18;
  text-align: center;
  color: var(--plum-700);
}

#budget-form {
  display: grid;
  gap: 14px;
}

.field-grid {
  display: grid;
  gap: 10px;
}

.field {
  display: grid;
  gap: 5px;
  font-size: 0.93rem;
}

.field span {
  color: var(--text-700);
  font-weight: 700;
}

input,
select {
  width: 100%;
  border: 1px solid rgba(109, 47, 103, 0.26);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--text-900);
  font: inherit;
  padding: 10px 11px;
}

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' fill='none' stroke='%235f315c' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

input:focus,
select:focus {
  outline: 2px solid rgba(109, 47, 103, 0.34);
  outline-offset: 1px;
}

.panel {
  border-radius: var(--radius-md);
  background: rgba(255, 247, 239, 0.75);
  border: 1px solid rgba(109, 47, 103, 0.16);
  padding: 12px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.items-section {
  margin-top: 2px;
}

.items-title {
  margin: 0 0 8px;
  color: var(--text-700);
  font-size: 1.02rem;
  font-weight: 700;
}

.items-add-bottom {
  margin-top: 8px;
  margin-bottom: 0;
}

.panel h3 {
  margin: 0;
  color: var(--plum-700);
  font-family: "Marcellus", "Palatino Linotype", serif;
}

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

.item-card {
  border: 1px solid rgba(109, 47, 103, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.62);
  padding: 10px;
}

.item-card-grid {
  display: grid;
  gap: 8px;
}

.item-card-grid .field {
  margin: 0;
}

.item-card-grid .field span {
  font-size: 0.88rem;
}

.item-card-grid .remove-item {
  justify-self: end;
}

.remove-item {
  min-width: 84px;
  padding: 6px 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.remove-item[hidden] {
  display: none !important;
}

.results {
  background: linear-gradient(
    165deg,
    rgba(255, 247, 239, 0.9),
    rgba(220, 200, 232, 0.78)
  );
}

.result-grid {
  margin-top: 10px;
  display: grid;
  gap: 10px;
}

.result-card {
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(109, 47, 103, 0.12);
  padding: 10px;
}

.result-card p {
  margin: 0;
  color: var(--text-700);
  font-size: 0.9rem;
}

.result-card strong {
  display: block;
  margin-top: 4px;
  color: var(--plum-700);
  font-size: 1.18rem;
}

.form-actions {
  display: grid;
  gap: 10px;
}

.print-report {
  display: none;
}

@media (min-width: 700px) {
  .app-shell {
    padding: 28px 18px 38px;
  }

  .field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .result-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .item-card-grid {
    grid-template-columns: minmax(0, 1fr) 180px auto;
    align-items: end;
  }
}

@media print {
  @page {
    size: A4;
    margin: 12mm;
  }

  body {
    background: #fff;
    color: #1f1f1f;
  }

  .background-glow,
  #home-screen,
  .screen-top,
  .panel-head,
  .items-section,
  .results,
  .form-actions,
  #budget-form > .field-grid,
  #budget-form > .time-grid {
    display: none !important;
  }

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

  .screen {
    display: block !important;
  }

  #budget-title {
    display: none;
  }

  .print-report {
    display: block;
    border: 1.5px solid #7b7b7b;
    border-top: 8px solid #4f214c;
    border-radius: 8px;
    padding: 14px 14px 10px;
    background: #fff;
  }

  .print-report-title {
    margin: 0 0 12px;
    font-size: 1.5rem;
    line-height: 1.15;
    font-family: "Marcellus", "Palatino Linotype", serif;
    color: #231726;
    letter-spacing: 0.2px;
  }

  .print-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 12px;
    margin-bottom: 12px;
    font-size: 0.93rem;
  }

  .print-meta p {
    margin: 0;
    border: 1px solid #d3d3d3;
    border-radius: 6px;
    padding: 6px 8px;
    background: #fafafa;
  }

  .print-subtitle {
    margin: 14px 0 6px;
    font-size: 1.03rem;
    color: #231726;
    font-weight: 700;
  }

  .print-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 10px;
    font-size: 0.91rem;
  }

  .print-table th,
  .print-table td {
    border: 1px solid #c4c4c4;
    padding: 7px 8px;
    text-align: left;
  }

  .print-table thead th {
    background: #f0f0f0;
    font-weight: 700;
    color: #262626;
  }

  .print-table tbody tr:nth-child(even) td {
    background: #fbfbfb;
  }

  .print-table tbody td:last-child,
  .print-table thead th:last-child {
    text-align: right;
  }

  #print-cost-total,
  #print-cost-unit,
  #print-min-price,
  #print-suggested-price,
  #print-profit-unit,
  #print-profit-total,
  #print-total-time {
    font-weight: 700;
    color: #1e1e1e;
  }
}

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}
