@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,700&family=Space+Grotesk:wght@400;500;600&display=swap");

:root {
  color-scheme: light;
  --ink: #1d1b1a;
  --muted: #5a4f48;
  --paper: #ffffff;
  --accent: #cb5c2f;
  --accent-dark: #9f3f1f;
  --line: #d7cabc;
  --shadow: 0 18px 45px rgba(26, 22, 18, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Trebuchet MS", sans-serif;
  color: var(--ink);
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 10%, rgba(203, 92, 47, 0.16), transparent 45%),
    radial-gradient(circle at 90% 20%, rgba(90, 79, 72, 0.12), transparent 50%),
    linear-gradient(140deg, #f9f2e6, #efe9df 50%, #f6efe5 100%);
}

.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 24px 72px;
  animation: rise 0.8s ease both;
}

.hero {
  max-width: 640px;
  margin-bottom: 32px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 12px;
}

h1 {
  font-family: "Fraunces", "Times New Roman", serif;
  font-size: clamp(32px, 4vw, 46px);
  margin: 0 0 12px;
}

.sub {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

.grid {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.panel {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(215, 202, 188, 0.7);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.form-panel h2,
.preview-panel h2 {
  font-size: 20px;
  margin-top: 0;
}

form {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}

input {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fffdf9;
  font-size: 15px;
  font-family: "Space Grotesk", "Trebuchet MS", sans-serif;
}

label.checkbox {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}

label.checkbox input {
  width: 18px;
  height: 18px;
  padding: 0;
}

input:focus {
  outline: 2px solid rgba(203, 92, 47, 0.4);
  border-color: var(--accent);
}

input.invalid {
  border-color: #d0473c;
  outline: 2px solid rgba(208, 71, 60, 0.25);
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

button {
  border: none;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.1);
}

.primary {
  background: var(--accent);
  color: #fff;
}

.primary:hover {
  background: var(--accent-dark);
}

.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
}

.small-button {
  padding: 8px 12px;
  font-size: 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
}

.small-button:hover {
  color: var(--ink);
}

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

.hint a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.hint a:hover {
  text-decoration: underline;
}

.preview-panel {
  position: relative;
}

.list-panel h2 {
  margin-top: 0;
}

.invoice-list {
  display: grid;
  gap: 12px;
  font-size: 14px;
}

.list-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 8px 0 16px;
}

.invoice-card {
  border: 1px solid var(--line);
  background: #fffdf9;
  padding: 14px 16px;
  border-radius: 14px;
  display: grid;
  gap: 6px;
}

.invoice-card header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-weight: 600;
}

.invoice-card .meta {
  font-size: 13px;
  color: var(--muted);
}

.invoice-card .paid {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.invoice-card .paid input {
  width: 16px;
  height: 16px;
}

.empty {
  margin: 0;
  color: var(--muted);
}

.card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-bar {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.filter-bar label {
  font-weight: 600;
}

.filter-bar input,
.filter-bar select {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fffdf9;
  font-size: 14px;
  font-family: "Space Grotesk", "Trebuchet MS", sans-serif;
}

.paper {
  background: var(--paper);
  border-radius: 18px;
  padding: 32px;
  min-height: 640px;
  box-shadow: inset 0 0 0 1px rgba(215, 202, 188, 0.8);
  animation: float-in 0.9s ease both;
}

.paper-title {
  font-size: 20px;
  font-family: "Fraunces", "Times New Roman", serif;
  margin: 0 0 8px;
}

.paper-strong {
  font-weight: 600;
  margin: 0 0 6px;
}

.label {
  font-weight: 600;
}

.value {
  font-weight: 400;
}

.paper-link {
  color: var(--accent);
  text-decoration: underline;
  margin: 0 0 6px;
}

.paper-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.meta {
  font-size: 14px;
  color: var(--muted);
}

.meta p {
  margin: 0 0 6px;
}

.divider {
  height: 2px;
  background: var(--line);
  margin: 24px 0;
}

.table {
  display: grid;
  gap: 12px;
  font-size: 14px;
}

.row {
  display: grid;
  grid-template-columns: 1.6fr 0.4fr 0.6fr 0.4fr;
  gap: 12px;
  align-items: center;
}

.row.header {
  font-weight: 600;
  color: var(--muted);
}

.row.body {
  font-weight: 500;
}

.totals {
  font-size: 16px;
}

.payment,
.terms {
  font-size: 14px;
  color: var(--muted);
}

.client {
  margin-bottom: 18px;
}

.payment p,
.terms p {
  margin: 0 0 6px;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes float-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 720px) {
  .paper {
    padding: 24px;
  }

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

@media print {
  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  body {
    background: #fff;
    font-family: Arial, Helvetica, sans-serif;
    color: #000;
  }

  .hero,
  .form-panel,
  .list-panel,
  .hint {
    display: none;
  }

  .grid {
    display: block;
  }

  .panel,
  .paper {
    box-shadow: none;
    border: none;
  }

  .panel {
    background: transparent;
    padding: 0;
  }

  .paper {
    border-radius: 0;
    padding: 24px 28px;
    color: #000;
    opacity: 1;
  }

  .app {
    padding: 0;
    animation: none;
    opacity: 1;
    transform: none;
  }

  .paper-title {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 18px;
  }

  .paper-link {
    color: #1a73e8;
  }

  .paper-header {
    display: block;
  }

  .meta {
    color: #000;
    margin-top: 10px;
  }

  .client {
    margin: 16px 0 6px;
  }

  .divider {
    background: #999;
  }

  .row.header span {
    text-align: center;
  }

  .row.body span {
    color: #000;
  }

  .payment,
  .terms {
    color: #000;
  }

  .paper,
  .panel {
    animation: none;
    transform: none;
  }
}
