:root {
  --bg: #F1F5F9;
  --card: #FFFFFF;
  --border: #E2E8F0;
  --header-bg: #111827;
  --header-subtle: #9CA3AF;
  --accent: #16A34A;
  --accent-dark: #127A3D;
  --accent-tint: #ECFDF5;
  --text: #111827;
  --muted: #6B7280;
  --error: #DC2626;
  --warning: #B45309;
  --warning-tint: #FFFBEB;
  --success: #15803D;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 1px rgba(15, 23, 42, 0.04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
}

.header {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--header-bg);
  padding: 9px 18px;
  border-bottom: 2px solid var(--accent);
}

.badge {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--accent);
  color: white;
  font-weight: bold;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.5px;
}

.title-box { display: flex; align-items: baseline; gap: 8px; }
.title-box .title { color: white; font-weight: bold; font-size: 20px; }
.title-box .tagline { color: var(--header-subtle); font-size: 14px; }

.module-nav {
  margin-left: auto;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.module-nav a {
  font-size: 12px;
  font-weight: 700;
  color: var(--header-subtle);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 6px;
  white-space: nowrap;
}
.module-nav a:hover { color: white; background: rgba(255, 255, 255, 0.08); }
.module-nav a.active { color: white; background: var(--accent); }

.step-back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-dark);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 0 10px 0;
  text-decoration: none;
}
.step-back:hover { text-decoration: underline; }

.body {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 14px 18px;
  margin-bottom: 12px;
}

.card h2 {
  margin: 0 0 10px 0;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--accent-dark);
}

.sub-heading {
  margin: 14px 0 6px 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.row-fields {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.row-fields .field { flex: 1 1 200px; margin-bottom: 10px; max-width: 320px; }

.hint {
  font-size: 13px;
  color: var(--muted);
  background: #F8FAFC;
  border: 1px dashed var(--border);
  border-radius: 5px;
  padding: 8px 10px;
  margin-top: 4px;
  line-height: 1.5;
}

.hidden { display: none !important; }

.table-wrap {
  margin-top: 12px;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
  padding: 6px 8px;
  white-space: nowrap;
}

.data-table td {
  padding: 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.data-table tbody tr:hover { background: #F8FAFC; }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.detail-grid > div {
  background: #F8FAFC;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
}
.detail-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--muted);
  margin-bottom: 2px;
}

.field { margin-bottom: 10px; max-width: 260px; }
.field label { display: block; font-size: 13px; color: var(--text); font-weight: 700; margin-bottom: 3px; }
.field input, .field select {
  width: 100%;
  font-size: 15px;
  font-family: inherit;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
}

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.accent-btn, .ghost-btn {
  border: none;
  border-radius: 6px;
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.05s ease;
}
.accent-btn { background: var(--accent); color: white; }
.accent-btn:hover { background: var(--accent-dark); }
.accent-btn:active { transform: scale(0.98); }
.accent-btn:disabled { background: #9CA3AF; cursor: default; }

.ghost-btn { background: white; color: var(--accent-dark); border: 1.5px solid var(--border); }
.ghost-btn:hover { background: var(--accent-tint); border-color: #A7F3D0; }

.bill-btn, .edit-invoice-btn { padding: 5px 14px; font-size: 12px; }

.badge-auto {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--warning-tint);
  color: var(--warning);
  vertical-align: middle;
  margin-left: 4px;
}

.data-table input {
  font-size: 13px;
  font-family: inherit;
  border: 1.5px solid var(--border);
  border-radius: 5px;
  padding: 5px 7px;
  width: 100%;
}
.item-name { min-width: 160px; }
.remove-item-btn { padding: 3px 9px; font-size: 13px; line-height: 1; }

.status { font-size: 13px; font-weight: 700; color: var(--muted); }
.status.success { color: var(--success); }
.status.error { color: var(--error); }

@media (max-width: 820px) {
  .data-table th:nth-child(3), .data-table td:nth-child(3) { display: none; }
}
