:root {
  --bg: #ffffff;
  --bg-soft: #fafafa;
  --muted: #6b7280;
  /* neutral-500 */
  --muted-600: #52525b;
  --muted-700: #3f3f46;
  --muted-800: #27272a;
  --border: #e5e7eb;
  /* neutral-200 */
  --border-2: #d1d5db;
  /* neutral-300 */
  --accent: #f59e0b;
  /* amber-500 */
  --accent-50: #fffbeb;
  /* amber-50 */
  --accent-600: #d97706;
  --success: #10b981;
  /* emerald-500 */
  --danger: #ef4444;
  --ring: rgba(245, 158, 11, 0.35);
  --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica Neue, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: #0a0a0a;
  background: linear-gradient(to bottom, rgba(245, 158, 11, 0.08), #ffffff 35%, #ffffff);
  min-height: 100vh;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 40px 16px 64px;
}

header.page-header {
  text-align: center;
  margin-bottom: 24px;
}

header.page-header h1 {
  font-size: clamp(28px, 3.4vw, 36px);
  line-height: 1.15;
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #111827;
}

header.page-header p {
  margin-top: 8px;
  color: var(--muted);
}

/* Stepper */
.stepper-wrap {
  display: flex;
  gap: 16px;
  align-items: start;
  justify-content: space-between;
  flex-wrap: wrap;
}

.steps {
  flex: 0 0 calc(50% - 8px);
}

.steps-row {
  display: flex;
  gap: 24px;
  align-items: center;
  flex-wrap: nowrap;
  justify-content: space-between;
}

.step-btn {
  appearance: none;
  border: 0;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  padding: 0 !important;
  font-size: 14px;
}

.step-btn[aria-current="step"] {
  color: #0f172a;
}

.step-dot {
  height: 24px;
  width: 24px;
  border-radius: 999px;
  border: 1px solid var(--border-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: #fff;
}

.step-dot.active {
  background: rgba(245, 158, 11, 0.10);
  border-color: var(--accent);
  color: #b45309;
}

.step-dot.done {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.step-sep {
  height: 1px;
  width: 96px;
  background: var(--border);
  display: none;
}

@media (min-width: 640px) {
  .step-sep {
    display: block;
    margin: 0 8px;
  }
}

.step-progress {
  margin-top: 12px;
  height: 6px;
  width: 100%;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.step-progress>span {
  display: block;
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 200ms ease;
}

.live-preview-legend {
  flex: 0 0 calc(50% - 8px);
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted-700);
  font-weight: 600;
  font-size: 24px;
}

.icon-eye {
  width: 16px;
  height: 16px;
  color: var(--success);
}

/* Layout */
.layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  margin-top: 24px;
}

@media (min-width: 1024px) {
  .layout {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  .layout aside {
    order: 0;
  }
}

.layout aside.order-first {
  order: -1;
}

/* Card */
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
}

.card-header {
  padding: 16px 16px 8px 16px;
}

.card-title {
  font-size: 24px !important;
  font-weight: 700;
  margin: 0;
}

.card-content {
  padding: 16px;
}

.space-y>*+* {
  margin-top: 12px;
}

/* Form controls */
label {
  font-size: 13px;
  color: var(--muted-700);
  font-weight: 600;
}

.field {
  display: grid;
  gap: 6px;
}

.grid-2 {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid var(--border-2) !important;
  border-radius: 12px !important;
  padding: 12px 8px !important;
  font-size: 14px !important;
  color: #111827 !important;
  background: #fff !important;
  height: unset !important;
  line-height: 24px !important;
  outline: none;
  transition: box-shadow 160ms ease, border-color 160ms ease, background 160ms ease;
}

.input:focus,
.select:focus,
.textarea:focus {
  box-shadow: 0 0 0 4px var(--ring);
  border-color: var(--accent);
}

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

/* Buttons */
.btn {
  appearance: none;
  border: 1px solid transparent;
  background: #f3f4f6;
  color: #111827;
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

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

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

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

.btn-outline {
  background: #fff;
  border-color: #fde68a;
  /* amber-200 */
}

.btn-outline:hover {
  background: #fffbeb;
}

.btn-muted {
  background: #e5e7eb;
  color: #374151;
  border-color: #e5e7eb;
}

.btn-muted:hover {
  background: #e5e7eb;
}

.btn-ghost {
  background: transparent;
  color: var(--danger);
  border-color: transparent;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 8px;
}

.btn-dashed {
  width: 100%;
  background: #fff;
  border: 1px dashed var(--border-2);
  color: var(--muted-700);
  padding: 10px 12px;
  border-radius: 8px;
  font-weight: 600;
}

.btn-dashed:hover {
  background: #f8fafc;
}

/* Upload box */
.upload {
  border: 1px dashed #fcd34d;
  /* amber-300 */
  background: rgba(251, 191, 36, 0.08);
  color: #b45309;
  padding: 24px;
  border-radius: 12px;
  text-align: center;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
}

.upload:hover {
  background: #fffbeb;
}

/* Preview Invoice */
.inv-card .card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.inv-card {
  color: #000000;
}

.inv-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.logo-box {
  width: 91px;
  height: 91px;
  border-radius: 8px;
  overflow: hidden;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.placeholder-logo {
  width: 32px;
  height: 32px;
  opacity: 0.6;
  background: linear-gradient(135deg, #e5e7eb, #f3f4f6);
  border-radius: 6px;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.muted {
  color: var(--muted);
}

.muted-600 {
  color: var(--muted-600);
}

.section {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.table-head {
  display: grid;
  grid-template-columns: 4fr 4fr 1fr 1fr 2fr;
  gap: 8px;
  background: #f8fafc;
  color: var(--muted-700);
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}

.table-row {
  display: grid;
  grid-template-columns: 4fr 4fr 1fr 1fr 2fr;
  gap: 8px;
  padding: 10px 12px;
  font-size: 14px;
  align-items: center;
  border-top: 1px solid var(--border);
}

.table-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  padding: 24px;
  color: #9ca3af;
  text-align: center;
  font-size: 14px;
}

.calc {
  display: flex;
  gap: 24px;
  align-items: start;
  justify-content: end;
}

.calc div {
  width: 50%;
  align-items: end;
}

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

.totals {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.line.muted {
  color: var(--muted-700);
}

.line.total {
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 16px;
  font-weight: 800;
  color: #111827;
}

.footnote {
  padding-top: 8px;
  text-align: center;
  font-size: 11px;
  color: #9ca3af;
}

.hidden {
  display: none !important;
}

/* Icons (inline svgs use currentColor) */
.icon {
  width: 16px;
  height: 16px;
  display: inline-block;
}

/* Helpers */
.row {
  display: grid;
  gap: 12px;
}

.row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.amount-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafafa;
  padding: 10px 12px;
  font-weight: 700;
}

/* Responsive adjustments */
@media (max-width: 480px) {

  .table-head,
  .table-row {
    grid-template-columns: 3fr 3fr 1fr 1fr 2fr;
  }
}