/* ── Reset & tokens ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:       #003366;
  --blue-light: #0055aa;
  --blue-pale:  #e8eef7;
  --text:       #1a1a1a;
  --muted:      #555555;
  --border:     #d4d8e1;
  --bg:         #f0f2f5;
  --white:      #ffffff;
  --red:        #c0392b;
  --radius:     8px;
  --shadow:     0 2px 12px rgba(0,0,0,0.08);
  --font:       'Segoe UI', system-ui, -apple-system, sans-serif;
}

html { font-size: 15px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
}

/* ── Header ─────────────────────────────────────────────────────────────────── */
.site-header {
  background: var(--blue);
  color: var(--white);
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.header-inner {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 60px;
}
.brand {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1;
}
.brand-dr { color: var(--white); }
.brand-it { color: #7EBAFF; }

.header-tagline {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.65);
  font-weight: 400;
  border-left: 1px solid rgba(255,255,255,0.25);
  padding-left: 16px;
  margin-left: 8px;
  flex: 1;
}

.logout-btn {
  margin-left: auto;
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 6px;
  padding: 5px 14px;
  transition: background .15s, color .15s;
}
.logout-btn:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

/* ── Layout ─────────────────────────────────────────────────────────────────── */
.container {
  max-width: 860px;
  margin: 32px auto 64px;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Cards ──────────────────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 32px;
  border: 1px solid var(--border);
}
.card-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--blue);
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--blue-pale);
}
.optional {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
  font-size: 0.75rem;
}

/* ── Grid ───────────────────────────────────────────────────────────────────── */
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }

@media (max-width: 620px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ── Form fields ─────────────────────────────────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.req { color: var(--red); }

input[type="text"],
input[type="date"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-family: var(--font);
  font-size: 0.92rem;
  color: var(--text);
  background: var(--white);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--blue-light);
  box-shadow: 0 0 0 3px rgba(0, 85, 170, 0.12);
}
textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
input[type="date"] { cursor: pointer; }

/* ── Items tabel ─────────────────────────────────────────────────────────────── */
.items-header {
  display: grid;
  grid-template-columns: 1fr 90px 160px 110px 36px;
  gap: 10px;
  padding: 0 0 8px;
  border-bottom: 1.5px solid var(--border);
  margin-bottom: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--blue);
}

.item-row {
  display: grid;
  grid-template-columns: 1fr 90px 160px 110px 36px;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
}
.item-row:last-child { border-bottom: none; }

.item-row .col-desc textarea {
  min-height: 56px;
  resize: vertical;
}

.input-euro {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input-euro:focus-within {
  border-color: var(--blue-light);
  box-shadow: 0 0 0 3px rgba(0, 85, 170, 0.12);
}
.euro-prefix {
  padding: 9px 8px 9px 10px;
  background: var(--blue-pale);
  color: var(--blue);
  font-weight: 600;
  font-size: 0.9rem;
  user-select: none;
}
.input-euro input {
  border: none;
  border-radius: 0;
  padding-left: 8px;
  flex: 1;
}
.input-euro input:focus { box-shadow: none; }

.line-total {
  font-weight: 700;
  color: var(--text);
  font-size: 0.9rem;
  white-space: nowrap;
  text-align: right;
  display: block;
}

.btn-delete {
  background: none;
  border: 1.5px solid #e0e0e0;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  cursor: pointer;
  color: #aaa;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.btn-delete:hover {
  background: #fdf0f0;
  border-color: var(--red);
  color: var(--red);
}

#addItemBtn { margin-top: 14px; }

@media (max-width: 620px) {
  .items-header { display: none; }
  .item-row {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto;
  }
  .item-row .col-desc { grid-column: 1 / -1; }
  .item-row .col-del  { grid-column: 2; justify-self: end; }
}

/* ── Totalen ─────────────────────────────────────────────────────────────────── */
.totals-card { background: var(--blue-pale); border-color: #c4d4ea; }
.totals-inner {
  max-width: 380px;
  margin-left: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.totals-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.92rem;
  color: var(--muted);
}
.totals-row span:last-child {
  font-weight: 600;
  color: var(--text);
  min-width: 110px;
  text-align: right;
}
.totals-grand {
  padding-top: 12px;
  border-top: 2.5px solid var(--blue);
  color: var(--blue);
  font-size: 1.05rem;
  font-weight: 700;
}
.totals-grand span:last-child {
  color: var(--blue);
  font-size: 1.15rem;
}

/* ── Knoppen ─────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 7px;
  border: 2px solid transparent;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
  text-decoration: none;
}
.btn-primary {
  background: var(--blue);
  color: var(--white);
  border-color: var(--blue);
}
.btn-primary:hover {
  background: var(--blue-light);
  border-color: var(--blue-light);
  box-shadow: 0 4px 14px rgba(0, 51, 102, 0.28);
}
.btn-secondary {
  background: var(--blue-pale);
  color: var(--blue);
  border-color: #c4d4ea;
}
.btn-secondary:hover {
  background: #d6e4f7;
  border-color: var(--blue-light);
}
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
}
.btn-ghost:hover {
  background: #f0f0f0;
  color: var(--text);
}

.actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ── Notificaties ────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--red);
  color: #fff;
  padding: 14px 20px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: 0 4px 18px rgba(0,0,0,0.18);
  z-index: 999;
  transition: opacity 0.3s;
}
.toast.success { background: #1e7b4b; }
