:root {
  --color-primary: #1a2744;
  --color-accent:  #f5a623;
  --color-bg:      #f0f4f8;
  --color-card:    #ffffff;
  --color-text:    #2d3748;
  --color-muted:   #718096;
  --color-error:   #e53e3e;
  --color-success: #38a169;
  --color-border:  #e2e8f0;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Poppins', sans-serif;
  font-size: 16px;
  color: var(--color-text);
  background: linear-gradient(135deg, #e8edf5 0%, #f0f4f8 100%);
  min-height: 100vh;
}

.page-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px 16px;
}

.card {
  background: var(--color-card);
  max-width: 480px;
  width: 92%;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.10);
  padding: 36px 32px;
}

/* Sections */
section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

section[hidden] {
  display: none !important;
}

section.fade-in {
  animation: fadeIn 200ms ease forwards;
}

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

/* Typography */
.heading {
  font-size: 22px;
  font-weight: 600;
  color: var(--color-primary);
  text-align: center;
}

.subtitle {
  font-size: 13px;
  font-weight: 400;
  color: var(--color-muted);
  text-align: center;
  margin-top: -8px;
}

.body-text {
  font-size: 14px;
  color: var(--color-muted);
  text-align: center;
  line-height: 1.6;
}

/* Fields */
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
}

.required {
  color: var(--color-error);
}

.badge-optional {
  font-size: 12px;
  font-weight: 400;
  color: var(--color-muted);
}

input[type="text"],
textarea {
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  color: var(--color-text);
  border: 1.5px solid var(--color-border);
  border-radius: 8px;
  padding: 10px 14px;
  width: 100%;
  outline: none;
  transition: border-color 150ms, box-shadow 150ms;
  background: #fff;
}

input[type="text"]:focus,
textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(26,39,68,0.08);
}

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

.char-counter {
  font-size: 12px;
  color: var(--color-muted);
  text-align: right;
}

/* Error */
.error-msg {
  font-size: 13px;
  color: var(--color-error);
  padding: 8px 12px;
  background: rgba(229,62,62,0.07);
  border-radius: 6px;
  border-left: 3px solid var(--color-error);
}

/* Button */
.btn {
  font-family: 'Poppins', sans-serif;
  font-size: 15px;
  font-weight: 500;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  padding: 12px 20px;
  width: 100%;
  transition: background 150ms, transform 150ms;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

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

.btn-primary:hover:not(:disabled) {
  background: #111e3a;
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Spinner */
.spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Invoice summary card */
.invoice-card {
  background: #f7fafc;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.invoice-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

.invoice-label {
  color: var(--color-muted);
  font-weight: 400;
}

.invoice-value {
  color: var(--color-text);
  font-weight: 500;
  text-align: right;
}

/* Star rating */
.star-rating {
  display: flex;
  gap: 6px;
}

.star {
  font-size: 36px;
  color: #ddd;
  cursor: pointer;
  transition: color 100ms, transform 100ms;
  line-height: 1;
  user-select: none;
}

.star.hover,
.star.selected {
  color: var(--color-accent);
}

.star:hover {
  transform: scale(1.1);
}

.star-readonly .star {
  cursor: default;
  font-size: 30px;
}

.star-readonly .star:hover {
  transform: none;
}

/* Back link */
.back-link {
  text-align: center;
  margin-top: -4px;
}

.back-link a {
  font-size: 13px;
  color: var(--color-muted);
  text-decoration: none;
  transition: color 150ms;
}

.back-link a:hover {
  color: var(--color-primary);
}

/* Icon wrap */
.icon-wrap {
  display: flex;
  justify-content: center;
}

/* Success icon animation */
.success-icon {
  animation: scaleIn 400ms ease-out forwards;
  transform-origin: center;
}

@keyframes scaleIn {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

#success-stars {
  justify-content: center;
}

/* Mobile */
@media (max-width: 480px) {
  .card {
    padding: 28px 20px;
  }

  .heading {
    font-size: 20px;
  }

  .star {
    font-size: 30px;
  }
}
