/* ── Variables ────────────────────────────────────────────────────────────── */
:root {
  --bg:            #0D0D0D;
  --surface:       #1C1C1E;
  --card:          #2C2C2E;
  --card-hover:    #3A3A3C;
  --border:        #3A3A3C;
  --border-light:  #48484A;
  --primary:       #FF6500;
  --primary-dark:  #CC5200;
  --primary-dim:   rgba(255,101,0,.15);
  --text:          #FFFFFF;
  --text-2:        #EBEBF5;
  --text-muted:    #8E8E93;
  --text-dim:      #48484A;
  --success:       #30D158;
  --danger:        #FF453A;
  --info:          #0A84FF;
  --yellow:        #FFD60A;
  --r-xl: 20px; --r-lg: 16px; --r-md: 12px; --r-sm: 8px; --r-xs: 6px;
  --shadow: 0 4px 24px rgba(0,0,0,.5);
  --t: .18s ease;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --max: 480px;
}

/* ── Reset ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
a { color: var(--primary); text-decoration: none; }
button { cursor: pointer; font-family: var(--font); border: none; }
input, select, textarea { font-family: var(--font); }

/* ── App Shell ────────────────────────────────────────────────────────────── */
.app-header {
  background: rgba(28,28,30,.9);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.header-inner {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  max-width: var(--max);
  margin: 0 auto;
  gap: 10px;
  min-height: 56px;
}
.app-logo {
  flex: 1;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
}
.logo-mark {
  background: var(--primary);
  color: #fff;
  font-size: .75rem;
  font-weight: 900;
  padding: 2px 6px;
  border-radius: var(--r-xs);
  letter-spacing: .05em;
}
.back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--card);
  color: var(--text);
  transition: background var(--t);
  flex-shrink: 0;
}
.back-btn:hover, .back-btn:active { background: var(--border-light); color: var(--text); }
.header-action {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: .8rem;
}
.app-main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 16px 16px 100px;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: .95rem;
  font-weight: 600;
  padding: 14px 20px;
  border-radius: var(--r-lg);
  transition: all var(--t);
  min-height: 52px;
  border: none;
  cursor: pointer;
  letter-spacing: .02em;
  white-space: nowrap;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover  { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(255,101,0,.35); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--card-hover); }
.btn-danger {
  background: rgba(255,69,58,.15);
  color: var(--danger);
  border: 1px solid rgba(255,69,58,.3);
}
.btn-danger:hover { background: rgba(255,69,58,.25); }
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover { background: var(--card); color: var(--text); }
.btn-success {
  background: var(--success);
  color: #000;
}
.btn-success:hover { background: #26b84a; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(48,209,88,.35); }
.btn-full { width: 100%; }
.btn-sm { font-size: .82rem; padding: 8px 14px; min-height: 36px; border-radius: var(--r-sm); }
.btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.btn-sm svg { width: 15px; height: 15px; }

/* ── Sticky bottom bar ────────────────────────────────────────────────────── */
.sticky-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, var(--bg) 60%, transparent);
  padding: 20px 16px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 50;
}
.sticky-bar-inner {
  display: flex;
  gap: 10px;
  max-width: var(--max);
  margin: 0 auto;
}
.sticky-bar .btn { flex: 1; }

/* ── Home screen ──────────────────────────────────────────────────────────── */
.home-hero {
  text-align: center;
  padding: 40px 0 32px;
}
.home-logo {
  font-size: 3.5rem;
  font-weight: 900;
  letter-spacing: -.03em;
  line-height: 1;
  color: var(--text);
}
.home-logo .accent { color: var(--primary); }
.home-tagline {
  margin-top: 10px;
  color: var(--text-muted);
  font-size: .8rem;
  letter-spacing: .15em;
  text-transform: uppercase;
}
.home-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}
.home-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 20px;
  color: var(--text);
  text-decoration: none;
  transition: all var(--t);
  position: relative;
  overflow: hidden;
  min-height: 88px;
}
.home-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--primary-dim);
  opacity: 0;
  transition: opacity var(--t);
}
.home-btn:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow); }
.home-btn:hover::after { opacity: 1; }
.home-btn:active { transform: translateY(0); }
.home-btn.featured {
  background: linear-gradient(135deg, #1a0800, #2a1000);
  border-color: var(--primary);
}
.hb-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--r-md);
  background: var(--primary-dim);
  border: 1px solid rgba(255,101,0,.3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.home-btn.featured .hb-icon {
  background: var(--primary);
  border-color: var(--primary);
}
.hb-icon svg { width: 26px; height: 26px; color: var(--primary); }
.home-btn.featured .hb-icon svg { color: #fff; }
.hb-text { flex: 1; position: relative; z-index: 1; }
.hb-label {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: .02em;
}
.hb-sub {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: 3px;
}
.hb-arrow { color: var(--text-dim); position: relative; z-index: 1; }
.hb-arrow svg { width: 20px; height: 20px; }

/* ── Section ──────────────────────────────────────────────────────────────── */
.section { margin-bottom: 28px; }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 0 4px;
}
.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .78rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.section-icon {
  width: 22px;
  height: 22px;
  border-radius: var(--r-xs);
  display: flex;
  align-items: center;
  justify-content: center;
}
.section-icon.orange { background: var(--primary-dim); color: var(--primary); }
.section-icon.blue   { background: rgba(10,132,255,.15); color: var(--info); }
.section-icon.green  { background: rgba(48,209,88,.15); color: var(--success); }
.section-icon svg { width: 13px; height: 13px; }

/* ── Form ─────────────────────────────────────────────────────────────────── */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.form-row {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--border);
}
.form-row:last-child { border-bottom: none; }
.form-row label {
  display: flex;
  align-items: center;
  padding: 0 16px;
  font-size: .85rem;
  color: var(--text-muted);
  min-width: 100px;
  flex-shrink: 0;
  font-weight: 500;
}
.form-row input,
.form-row select {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: .95rem;
  padding: 15px 16px 15px 0;
  min-height: 52px;
  width: 0;
}
.form-row input::placeholder { color: var(--text-dim); }
.form-row input:focus { color: var(--text); }
.form-row input[type=text].kenteken { text-transform: uppercase; font-weight: 700; letter-spacing: .1em; }

/* ── Item cards ───────────────────────────────────────────────────────────── */
.items-list { display: flex; flex-direction: column; gap: 8px; }
.item-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px;
  position: relative;
  animation: slideIn var(--t) both;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.item-card-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}
.item-card-top input {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: .92rem;
  padding: 10px 12px;
  outline: none;
  transition: border-color var(--t);
}
.item-card-top input:focus { border-color: var(--primary); }
.item-card-top input::placeholder { color: var(--text-dim); }
.item-remove {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,69,58,.12);
  border: 1px solid rgba(255,69,58,.2);
  border-radius: var(--r-sm);
  color: var(--danger);
  transition: all var(--t);
  cursor: pointer;
  margin-top: 2px;
}
.item-remove:hover { background: rgba(255,69,58,.25); }
.item-remove svg { width: 14px; height: 14px; }
.item-fields {
  display: grid;
  gap: 8px;
}
.item-fields.cols-2 { grid-template-columns: 1fr 1fr; }
.item-fields.cols-1 { grid-template-columns: 1fr; }
.field-group { display: flex; flex-direction: column; gap: 4px; }
.field-label {
  font-size: .72rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding-left: 2px;
}
.field-input {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: .92rem;
  padding: 10px 12px;
  outline: none;
  transition: border-color var(--t);
  width: 100%;
}
.field-input:focus { border-color: var(--primary); }
.field-input::placeholder { color: var(--text-dim); }
.field-input[type=number] { -moz-appearance: textfield; }
.field-input[type=number]::-webkit-inner-spin-button,
.field-input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; }

.add-item-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px;
  background: transparent;
  border: 1.5px dashed var(--border);
  border-radius: var(--r-lg);
  color: var(--text-muted);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--t);
  margin-top: 8px;
}
.add-item-btn svg { width: 16px; height: 16px; }
.add-item-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-dim); }

/* ── Live totals ──────────────────────────────────────────────────────────── */
.live-totals {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  margin-top: 4px;
}
.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: .9rem;
  color: var(--text-muted);
}
.total-row.divider { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 12px; }
.total-row.grand {
  color: var(--text);
  font-size: 1.2rem;
  font-weight: 800;
}
.total-row .amount { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.total-row.grand .amount { color: var(--primary); }

/* ── Invoice preview (in-browser) ────────────────────────────────────────── */
.invoice-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: 8px;
}
.inv-header {
  background: linear-gradient(135deg, #1a0800, #2a0f00);
  border-bottom: 3px solid var(--primary);
  padding: 20px;
}
.inv-header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.inv-company-name {
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: -.02em;
  line-height: 1;
}
.inv-company-name .accent { color: var(--primary); }
.inv-company-details {
  font-size: .75rem;
  color: rgba(255,255,255,.5);
  margin-top: 6px;
  line-height: 1.6;
}
.inv-badge {
  text-align: right;
}
.inv-badge-label {
  font-size: .65rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--primary);
  font-weight: 700;
}
.inv-badge-num {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: .05em;
  line-height: 1.2;
}
.inv-badge-date { font-size: .78rem; color: rgba(255,255,255,.5); margin-top: 2px; }
.inv-client {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.inv-client-block {}
.inv-client-label {
  font-size: .68rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 4px;
}
.inv-client-name { font-size: 1.05rem; font-weight: 700; }
.inv-client-plate {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--yellow);
  color: #000;
  font-size: .78rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 4px;
  margin-top: 5px;
  letter-spacing: .1em;
}
.inv-verval { text-align: right; }
.inv-verval-label {
  font-size: .68rem;
  color: var(--text-muted);
  letter-spacing: .1em;
  text-transform: uppercase;
  font-weight: 700;
}
.inv-verval-date { font-size: .9rem; font-weight: 600; margin-top: 2px; }
.inv-table { width: 100%; border-collapse: collapse; }
.inv-table th {
  font-size: .68rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  padding: 12px 20px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}
.inv-table th.num { text-align: right; }
.inv-table td {
  padding: 12px 20px;
  font-size: .88rem;
  border-bottom: 1px solid rgba(58,58,60,.5);
  vertical-align: top;
}
.inv-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.inv-table td .type-badge {
  display: inline-block;
  font-size: .62rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 2px;
}
.badge-product    { background: rgba(10,132,255,.15);  color: var(--info); }
.badge-dienst     { background: rgba(48,209,88,.15);   color: var(--success); }
.badge-arbeids    { background: rgba(255,101,0,.15);   color: var(--primary); }
.inv-table tbody tr:last-child td { border-bottom: none; }
.inv-totals {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--card);
}
.inv-total-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: .88rem;
  color: var(--text-muted);
}
.inv-total-row.grand {
  border-top: 1px solid var(--border);
  margin-top: 8px;
  padding-top: 12px;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
}
.inv-total-row.grand .amount { color: var(--primary); }
.inv-total-row .amount { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); }
.inv-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  font-size: .75rem;
  color: var(--text-muted);
  line-height: 1.7;
}
.inv-footer strong { color: var(--text-2); }

/* ── Invoice list ─────────────────────────────────────────────────────────── */
.fact-list { display: flex; flex-direction: column; gap: 10px; }
.fact-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  text-decoration: none;
  color: var(--text);
  transition: all var(--t);
}
.fact-card:hover { border-color: var(--primary); background: linear-gradient(135deg, #1a0800, #1C1C1E); }
.fact-num {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: .05em;
  min-width: 80px;
}
.fact-info { flex: 1; min-width: 0; }
.fact-name { font-weight: 600; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fact-meta { font-size: .78rem; color: var(--text-muted); margin-top: 2px; display: flex; gap: 8px; }
.fact-plate {
  background: var(--yellow);
  color: #000;
  font-size: .65rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 3px;
  letter-spacing: .08em;
}
.fact-amount { font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.badge {
  display: inline-flex;
  align-items: center;
  font-size: .68rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.badge-ok  { background: rgba(48,209,88,.15);  color: var(--success); }
.badge-concept { background: rgba(255,214,10,.12); color: var(--yellow); }

/* ── Success screen ───────────────────────────────────────────────────────── */
.success-wrap { padding: 32px 0 16px; }
.success-icon {
  width: 72px;
  height: 72px;
  background: rgba(48,209,88,.15);
  border: 2px solid var(--success);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  animation: popIn .4s cubic-bezier(0.175,0.885,0.32,1.275) both;
}
@keyframes popIn {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.success-icon svg { width: 36px; height: 36px; color: var(--success); }
.success-title {
  font-size: 1.5rem;
  font-weight: 800;
  text-align: center;
}
.success-sub {
  text-align: center;
  color: var(--text-muted);
  margin-top: 6px;
  font-size: .88rem;
}
.share-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}
.share-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 12px;
  color: var(--text);
  cursor: pointer;
  transition: all var(--t);
  text-decoration: none;
}
.share-btn:hover { border-color: var(--primary); background: var(--primary-dim); }
.share-btn-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
}
.share-btn-icon svg { width: 22px; height: 22px; }
.share-btn-label { font-size: .82rem; font-weight: 600; text-align: center; }

/* ── Empty state ──────────────────────────────────────────────────────────── */
.empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-muted);
}
.empty-icon { font-size: 3rem; margin-bottom: 12px; opacity: .4; }
.empty-title { font-weight: 600; font-size: 1rem; color: var(--text-2); }
.empty-sub { font-size: .85rem; margin-top: 4px; }

/* ── Page titles ──────────────────────────────────────────────────────────── */
.page-title {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 20px;
  padding: 4px 0;
}

/* ── Utility ──────────────────────────────────────────────────────────────── */
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-20 { margin-top: 20px; }
.text-muted { color: var(--text-muted); font-size: .85rem; }
.text-center { text-align: center; }
.gap-4  { gap: 4px; }
.flex   { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
