@font-face {
  font-family: 'Montserrat';
  src: url('/static/fonts/Montserrat-Light.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Montserrat';
  src: url('/static/fonts/Montserrat-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #000000;
  --ink-soft: #1a1a1a;
  --grey: #6f6f6f;
  --grey-light: #9a9a9a;
  --line: #e8e8e8;
  --bg: #fafafa;
  --white: #ffffff;
  --yellow: #ffcc00;
  --yellow-dark: #e6b800;
  --yellow-soft: #fff5cc;
  --red: #df1010;
  --red-soft: #fdeaea;
  --green: #1f6b3d;
  --green-soft: #e8f3ec;
  --blue: #2a5a8f;
  --blue-soft: #e9f0f8;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: none; }

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 21px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }

.shell { display: flex; min-height: 100vh; }

/* Sidebar — zwarte interne navigatie, zoals de Offertetool */
.sidebar {
  width: 236px;
  flex: 0 0 236px;
  background: #000;
  padding: 20px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  color: #fff;
}
.brand { display: block; padding: 2px 8px 14px; border-bottom: 1px solid rgba(255,255,255,0.12); }
.brand img { width: 146px; height: auto; display: block; }
.brand .tag { display: block; margin-top: 7px; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255,255,255,0.45); }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: rgba(255,255,255,0.35);
  padding: 14px 10px 6px;
}
.nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 11px;
  border-radius: 8px;
  font-size: 13.5px;
  color: rgba(255,255,255,0.7);
}
.nav a:hover { background: rgba(255,255,255,0.1); color: #fff; }
.nav a.active { background: var(--yellow); color: #000; font-weight: 700; }
.nav a.active .count { background: rgba(0,0,0,0.14); color: #000; }
.count {
  font-size: 11px;
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-radius: 20px;
  padding: 1px 7px;
  min-width: 22px;
  text-align: center;
}
.sidebar-foot { margin-top: auto; padding: 14px 4px 0; border-top: 1px solid rgba(255,255,255,0.12); font-size: 11px; color: rgba(255,255,255,0.45); }
.userline { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; }
.userline strong { display: block; font-size: 12.5px; color: #fff; font-weight: 700; }
.userline span { font-size: 10.5px; color: rgba(255,255,255,0.45); }
.userline .btn { background: transparent; border-color: rgba(255,255,255,0.25); color: #fff; }
.userline .btn:hover { background: rgba(255,255,255,0.1); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--yellow); color: #000;
  display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex: 0 0 34px;
}

/* Main */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 64px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  gap: 16px;
}
.topbar h1 { font-size: 18px; }
.topbar .sub { font-size: 11.5px; color: var(--grey-light); margin-top: 1px; }
.content { padding: 26px 28px 48px; max-width: 1240px; width: 100%; }

/* Flash */
.flash {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 18px;
  font-size: 13px;
  border: 1px solid transparent;
}
.flash.ok { background: var(--green-soft); border-color: #c8e2d1; color: #17522f; }
.flash.err { background: var(--red-soft); border-color: #f0cbc7; color: #7f1d16; }

/* Cards and grid */
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card + .card { margin-top: 18px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.card-head h2 { font-size: 15px; }
.card-head p { font-size: 12px; color: var(--grey); margin: 3px 0 0; }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat .label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--grey-light); }
.stat .value { font-size: 25px; font-weight: 700; margin-top: 5px; letter-spacing: -0.02em; }
.stat .meta { font-size: 11.5px; color: var(--grey); margin-top: 3px; }
.stat.alert { border-color: #efc9c4; background: #fffbfa; }
.stat.alert .value { color: var(--red); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--grey-light);
  font-weight: 700;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td { padding: 11px 10px; border-bottom: 1px solid #efefe9; font-size: 13px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fbfbf8; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.actions { text-align: right; white-space: nowrap; }
.muted { color: var(--grey); }
.small { font-size: 11.5px; }
.nowrap { white-space: nowrap; }

/* Pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
  white-space: nowrap;
}
.pill.concept { background: #f0f0eb; color: #57574f; }
.pill.definitief { background: var(--yellow-soft); color: #7a5c00; }
.pill.verzonden { background: var(--blue-soft); color: var(--blue); }
.pill.betaald { background: var(--green-soft); color: var(--green); }
.pill.vervallen { background: #f0f0eb; color: #8a8a82; text-decoration: line-through; }
.pill.late { background: var(--red-soft); color: var(--red); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: #f7f7f2; }
.btn.primary { background: var(--yellow); border-color: var(--yellow); color: #000; }
.btn.primary:hover { background: var(--yellow-dark); border-color: var(--yellow-dark); }
.btn.accent { background: #000; border-color: #000; color: #fff; }
.btn.accent:hover { background: #222; }
.btn.danger { color: var(--red); border-color: #edc9c4; }
.btn.danger:hover { background: var(--red-soft); }
.btn.small { padding: 5px 9px; font-size: 11.5px; border-radius: 6px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline { display: inline; }

/* Forms */
form { margin: 0; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 11.5px; font-weight: 700; color: var(--ink-soft); margin-bottom: 5px; }
.field .hint { font-size: 11px; color: var(--grey-light); margin-top: 4px; }
input[type='text'], input[type='email'], input[type='password'], input[type='number'], input[type='date'], input[type='month'], select, textarea {
  width: 100%;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid #d9d9d2;
  border-radius: 8px;
  padding: 9px 10px;
  min-height: 38px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--yellow); outline-offset: 0; border-color: var(--yellow); }
textarea { resize: vertical; min-height: 84px; }
.row { display: grid; gap: 14px; }
.row.two { grid-template-columns: 1fr 1fr; }
.row.three { grid-template-columns: 1fr 1fr 1fr; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.check input { width: 16px; height: 16px; min-height: 0; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.form-actions .spacer { flex: 1; }

/* Detail blocks */
.meta-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; }
.meta-grid .item .label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--grey-light); margin-bottom: 3px; }
.meta-grid .item .value { font-size: 13px; font-weight: 700; }
.section-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--grey-light); font-weight: 700; margin: 22px 0 8px; }

/* Empty state */
.empty { text-align: center; padding: 34px 20px; color: var(--grey); }
.empty h3 { margin-bottom: 6px; }
.empty p { font-size: 12.5px; }

/* Login / setup */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; background: var(--bg); padding: 24px; }
.auth-card { width: 100%; max-width: 430px; background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 30px; box-shadow: 0 10px 30px rgba(20,20,20,0.05); }
.auth-card .brand img { width: 150px; margin-bottom: 18px; }
.auth-card h1 { font-size: 19px; margin-bottom: 4px; }
.auth-card .sub { font-size: 12.5px; color: var(--grey); margin-bottom: 20px; }
.auth-foot { margin-top: 16px; font-size: 11.5px; color: var(--grey-light); text-align: center; }
.setup-card { max-width: 760px; }

/* Invoice lines editor */
.lines-editor { width: 100%; }
.lines-editor .line-row { display: grid; grid-template-columns: 1fr 130px 100px 40px; gap: 10px; align-items: start; margin-bottom: 9px; }
.lines-editor .line-row input, .lines-editor .line-row select { min-height: 36px; }
.lines-editor .line-row .remove { border: 1px solid var(--line); background: var(--white); border-radius: 8px; height: 36px; cursor: pointer; color: var(--red); font-size: 16px; line-height: 1; }
.totals { margin-left: auto; width: 290px; margin-top: 14px; }
.totals div { display: flex; justify-content: space-between; padding: 5px 0; font-size: 13px; }
.totals div.total { border-top: 2px solid var(--ink); margin-top: 5px; padding-top: 8px; font-weight: 700; }

/* Updates */
.status-box { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); font-size: 13px; margin-bottom: 18px; }
.version-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.version-box { border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.version-box .label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--grey-light); }
.version-box .value { font-size: 18px; font-weight: 700; margin-top: 4px; }

/* Responsive */
@media (max-width: 1000px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .meta-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 820px) {
  .shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 14px; }
  .brand { padding: 0; margin-right: 8px; }
  .brand img { width: 108px; }
  .nav { flex-direction: row; flex-wrap: wrap; gap: 2px; }
  .nav-label { display: none; }
  .sidebar-foot { display: none; }
  .topbar { padding: 0 16px; height: 56px; }
  .content { padding: 18px 16px 40px; }
  .grid-4, .grid-3, .grid-2, .row.two, .row.three { grid-template-columns: 1fr; }
  .version-grid { grid-template-columns: 1fr; }
  .lines-editor .line-row { grid-template-columns: 1fr 1fr; }
}
