:root {
  font-family: system-ui, sans-serif;
  line-height: 1.5;
  color: #0f172a;
  background: #f8fafc;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #f8fafc;
}

.shell {
  display: grid;
  grid-template-columns: 16.5rem minmax(0, 1fr);
  min-height: 100vh;
}

.menu {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow: auto;
  padding: 1.4rem 1rem 1.5rem;
  background: #0f172a;
  color: #e2e8f0;
}

.menu .eyebrow {
  color: #94a3b8;
}

.menu-title {
  margin: 0.2rem 0 1rem;
  font-size: 1.15rem;
  color: #fff;
}

.menu-label {
  margin: 1.1rem 0 0.4rem;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
}

#home-page .kpis article strong {
  font-size: 1.2rem;
}

.customer-menu {
  display: grid;
  gap: 0.35rem;
}

.customer-menu button.item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  text-align: left;
  padding: 0.65rem 0.7rem;
  border: 0;
  border-radius: 0.65rem;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.customer-menu button.item:hover {
  background: #1e293b;
}

.customer-menu button.item.active {
  background: #f8fafc;
  color: #0f172a;
  font-weight: 600;
}

.customer-menu .count {
  font-size: 0.75rem;
  color: #94a3b8;
}

.customer-menu button.item.active .count {
  color: #64748b;
}

.menu-empty {
  margin: 0.5rem 0 1rem;
  color: #94a3b8;
  font-size: 0.9rem;
}

.add-form {
  display: grid;
  gap: 0.45rem;
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid #334155;
}

.add-form input,
.add-form button {
  font: inherit;
  padding: 0.5rem 0.6rem;
  border-radius: 0.5rem;
  border: 1px solid #334155;
}

.add-form input {
  background: #1e293b;
  color: #fff;
}

.add-form button {
  cursor: pointer;
  font-weight: 600;
  background: #fff;
  color: #0f172a;
  border-color: #fff;
}

.page {
  max-width: 72rem;
  margin: 0;
  padding: 2.5rem 1.5rem 4rem;
}

.eyebrow {
  margin: 0;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.75rem;
  color: #64748b;
}

h1 {
  margin: 0.25rem 0 0.75rem;
  font-size: 2rem;
}

.lede,
.hint,
.meta {
  color: #475569;
}

.dropzone {
  display: grid;
  place-items: center;
  min-height: 8rem;
  margin: 1.5rem 0;
  border: 1.5px dashed #94a3b8;
  border-radius: 1rem;
  background: #fff;
  cursor: pointer;
  font-weight: 600;
}

.dropzone input {
  display: none;
}

.dropzone:hover,
.dropzone.drag {
  border-color: #0f172a;
}

.error {
  color: #b91c1c;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.75rem;
  margin: 1.25rem 0;
}

.kpis article {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.85rem;
  padding: 1rem;
}

.kpis span {
  display: block;
  color: #64748b;
  font-size: 0.85rem;
}

.kpis strong {
  font-size: 1.35rem;
}

.card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  padding: 1rem 1.1rem 1.25rem;
  margin: 1rem 0;
}

.card h2 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th,
td {
  text-align: left;
  padding: 0.45rem 0.4rem;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: top;
}

th {
  color: #64748b;
  font-weight: 600;
}

.scroll {
  overflow: auto;
  max-height: 36rem;
}

.scroll table {
  border-collapse: separate;
  border-spacing: 0;
}

.scroll thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
  box-shadow: inset 0 -1px 0 #e2e8f0;
}

#customer-portal #portal-table.scroll {
  max-height: calc(100vh - 16rem);
}

.extra-rate {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid #e2e8f0;
}

.extra-rate span {
  width: 100%;
  color: #64748b;
  font-size: 0.9rem;
}

.extra-rate input,
.extra-rate select,
.extra-rate button {
  font: inherit;
  padding: 0.4rem 0.5rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.45rem;
  background: #fff;
}

.extra-rate input#extra-size {
  min-width: 14rem;
  flex: 1;
}

.extra-rate button {
  cursor: pointer;
  font-weight: 600;
}

.link {
  margin-left: 0.75rem;
  border: 0;
  background: none;
  color: #0f766e;
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
}

.month-pick {
  display: grid;
  gap: 0.2rem;
  font-size: 0.85rem;
  color: #64748b;
}

.month-pick span {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.month-pick select,
.month-pick input {
  font: inherit;
  padding: 0.4rem 0.55rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  background: #fff;
  color: #0f172a;
}

.month-pick input {
  width: 5.5rem;
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: end;
  gap: 0.75rem 1rem;
}

tfoot th {
  padding-top: 0.7rem;
  border-top: 2px solid #cbd5e1;
  font-weight: 700;
}

.card-head h2 {
  margin: 0;
}

.danger {
  font: inherit;
  padding: 0.4rem 0.65rem;
  border: 1px solid #fecaca;
  border-radius: 0.5rem;
  background: #fff;
  color: #b91c1c;
  cursor: pointer;
}

@media (max-width: 800px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .menu {
    position: static;
    height: auto;
  }
}

.invoice-card h3 {
  margin: 1.25rem 0 0.4rem;
  font-size: 1.05rem;
}

.totals-table {
  margin-top: 1rem;
  max-width: 28rem;
  margin-left: auto;
}

.totals-table td,
.totals-table th {
  text-align: right;
}

.totals-table td:first-child,
.totals-table th:first-child {
  text-align: left;
}

.totals-table .grand th {
  font-size: 1.05rem;
  border-bottom: 0;
}

.print-btn,
.confirm-btn {
  font: inherit;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border: 1px solid #0f172a;
  border-radius: 0.5rem;
  background: #0f172a;
  color: #fff;
  cursor: pointer;
}

.confirm-btn {
  background: #0f766e;
  border-color: #0f766e;
}

body.portal-mode .menu,
body.login-mode .menu,
body.login-mode #home-page,
body.login-mode #customer-work,
body.login-mode #customer-portal {
  display: none !important;
}

body.portal-mode .menu .add-form,
body.portal-mode .menu-label,
body.portal-mode #home-page,
body.portal-mode #customer-work,
body.portal-mode #customer-login,
body.portal-mode #customer-forgot,
body.portal-mode #customer-reset {
  display: none !important;
}

body.portal-mode .shell,
body.login-mode .shell,
body.portal-site .shell,
body[data-app-mode="klant"] {
  display: block;
}

body.portal-mode .shell,
body.login-mode .shell {
  grid-template-columns: 1fr;
}

body[data-app-mode="klant"] .page,
body.portal-mode .page,
body.login-mode .page {
  max-width: 72rem;
  margin: 0 auto;
}

.invoice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.login-card {
  max-width: 24rem;
}

.login-form {
  display: grid;
  gap: 0.85rem;
}

.login-form label {
  display: grid;
  gap: 0.3rem;
  font-weight: 600;
}

.login-form input {
  font: inherit;
  padding: 0.5rem 0.6rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
}

.login-form .hint {
  font-weight: 500;
  margin: 0;
}

.login-form .ok {
  margin: 0;
  color: #0f766e;
  font-weight: 600;
}

#portal-search {
  min-width: 16rem;
  font: inherit;
  padding: 0.4rem 0.55rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
}

.portal-row {
  cursor: pointer;
}

.portal-row:hover,
.portal-row.active {
  background: #ecfdf5;
}

@media print {
  .printing-portal .menu,
  .printing-portal .invoice-actions,
  .printing-portal #portal-search,
  .printing-portal .month-pick,
  .printing-portal #portal-kpis,
  .printing-portal #portal-detail,
  .printing-portal #portal-table {
    display: none !important;
  }

  .printing-portal .shell {
    display: block;
  }

  .printing-portal #portal-invoice .customer-invoice-doc {
    border: 0;
    padding: 0;
    margin: 0;
  }
}

@media print {
  .printing-invoice .menu,
  .printing-invoice .dropzone,
  .printing-invoice .danger,
  .printing-invoice .link,
  .printing-invoice #file,
  .printing-invoice #month-overview,
  .printing-invoice #customer-card,
  .printing-invoice #dropzone,
  .printing-invoice #results,
  .printing-invoice #hint,
  .printing-invoice #error,
  .printing-invoice .print-btn,
  .printing-invoice .confirm-btn,
  .printing-invoice .invoice-actions,
  .printing-invoice .fuel-row {
    display: none !important;
  }

  .printing-invoice .shell {
    display: block;
  }

  .printing-invoice #invoice-panel {
    display: block !important;
    border: 0;
    box-shadow: none;
    padding: 0;
  }

  .printing-invoice .invoice-admin,
  .printing-invoice #company-card,
  .printing-invoice #home-page,
  .printing-invoice #customer-work > header {
    display: none !important;
  }

  .printing-invoice .customer-invoice-doc {
    display: block !important;
    border: 0;
    padding: 0;
    margin: 0;
    font-size: 10pt;
  }
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 0.7rem;
}

.settings-grid label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
}

.settings-grid input,
.settings-grid textarea {
  font: inherit;
  font-weight: 500;
  padding: 0.4rem 0.5rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.45rem;
}

.settings-grid textarea {
  min-height: 4.2rem;
  resize: vertical;
}

.customer-invoice-doc {
  margin: 1.25rem 0 0;
  padding: 1.4rem 1.5rem 1.6rem;
  border: 1px solid #cbd5e1;
  border-radius: 1rem;
  background: #fff;
}

.invoice-letterhead {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: flex-start;
  margin-bottom: 1.4rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #0f172a;
}

.invoice-letterhead h2 {
  margin: 0 0 0.35rem;
  font-size: 1.6rem;
}

.invoice-company {
  font-size: 0.95rem;
  color: #334155;
}

.invoice-company strong {
  display: block;
  font-size: 1.15rem;
  color: #0f172a;
  margin-bottom: 0.2rem;
}

.invoice-meta {
  text-align: right;
  font-size: 0.92rem;
}

.invoice-parties {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.invoice-lines th:nth-child(n+2),
.invoice-lines td:nth-child(n+2) {
  text-align: right;
  white-space: nowrap;
}

.invoice-lines .section-row td {
  padding-top: 0.75rem;
  font-weight: 700;
  color: #0f172a;
  border-bottom: 0;
}

.invoice-pay {
  margin-top: 1rem;
  padding: 0.75rem 0.9rem;
  background: #f8fafc;
  border-radius: 0.7rem;
  color: #334155;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.customer-invoice-doc {
  font-size: 0.88rem;
}

.customer-invoice-doc table {
  font-size: 0.85rem;
}

.invoice-parties h3 {
  margin: 0 0 0.25rem;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
}

.invoice-pay {
  margin-top: 1.25rem;
  padding: 0.85rem 1rem;
  background: #f8fafc;
  border-radius: 0.7rem;
  color: #334155;
}

.customer-invoice-doc .totals-table {
  max-width: 100%;
}

.surcharge-box {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.fuel-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0.7rem 0.8rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.7rem;
  background: #f8fafc;
  font-weight: 600;
}

.fuel-row span {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 500;
}

.price-input {
  width: 6.5rem;
  font: inherit;
  padding: 0.3rem 0.4rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.4rem;
}

.missing {
  color: #b45309;
}
