:root {
  --blue: #1d4ed8;
  --blue-dark: #1e40af;
  --text: #0f172a;
  --grey: #64748b;
  --line: #e2e8f0;
  --background: #f1f5f9;
  --white: #ffffff;
  --green: #16a34a;
  --orange: #ea580c;
  --red: #dc2626;
}

* { box-sizing: border-box; }

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

a { color: var(--blue); }

.hidden { display: none !important; }

/* ---------- Login ---------- */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.12);
  padding: 32px;
  width: 100%;
  max-width: 400px;
}
.login-logo { display: block; margin: 0 auto 24px; max-width: 240px; max-height: 110px; }
.login-card h1 { font-size: 20px; margin: 0 0 4px; text-align: center; }
.login-card p.sub { color: var(--grey); text-align: center; margin: 0 0 24px; font-size: 14px; }

/* ---------- Formulieren ---------- */
label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  background: var(--white);
  color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); border-color: var(--blue); }
.field { margin-bottom: 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 180px; }

button {
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  background: var(--blue);
  color: var(--white);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
button:hover { background: var(--blue-dark); }
button.wide { width: 100%; }
button.secondary { background: var(--white); color: var(--text); border: 1px solid var(--line); }
button.secondary:hover { background: var(--background); }
button.danger { background: var(--red); }
button.small { padding: 6px 10px; font-size: 13px; }
button:disabled { opacity: .5; cursor: not-allowed; }

.message { padding: 10px 12px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.message.error { background: #fee2e2; color: #991b1b; }
.message.ok { background: #dcfce7; color: #166534; }
.message.info { background: #dbeafe; color: #1e40af; }

/* ---------- Layout ---------- */
#app { display: none; min-height: 100vh; }
#app.active { display: flex; }

aside {
  width: 240px;
  background: var(--white);
  border-right: 1px solid var(--line);
  padding: 20px 12px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}
aside img.logo { max-width: 100%; max-height: 60px; margin: 0 8px 24px; }
.menu-group { margin-bottom: 18px; }
.menu-heading {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--grey);
  padding: 0 12px 6px;
}
nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--text);
  font-weight: 500;
  margin-bottom: 4px;
  padding: 10px 12px;
}
.menu-icon { width: 18px; height: 18px; flex: 0 0 18px; opacity: .75; }
nav button.active .menu-icon { opacity: 1; }
nav button:hover { background: var(--background); }
nav button.active { background: var(--blue); color: var(--white); }
.user-block { margin-top: auto; border-top: 1px solid var(--line); padding-top: 16px; font-size: 13px; }
.user-block .name { font-weight: 700; }
.user-block .role { color: var(--grey); margin-bottom: 10px; }

main { flex: 1; padding: 28px 32px; overflow-x: auto; }
h2 { margin: 0 0 4px; font-size: 22px; }
.page-sub { color: var(--grey); margin: 0 0 20px; }

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}
.card h3 { margin: 0 0 14px; font-size: 16px; }

/* ---------- Tabel ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--grey); }
tr:last-child td { border-bottom: none; }
td.right, th.right { text-align: right; }
table input, table select { padding: 6px 8px; font-size: 14px; }

.label {
  display: inline-block; padding: 3px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 700;
}
.label.concept { background: var(--line); color: var(--grey); }
.label.ingediend { background: #ffedd5; color: #9a3412; }
.label.goedgekeurd { background: #dcfce7; color: #166534; }
.label.afgekeurd { background: #fee2e2; color: #991b1b; }

.permission-group { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; }
.permission-group h4 { margin: 0 0 8px; font-size: 14px; }
.permission-group label { display: flex; align-items: center; gap: 8px; font-weight: 400; margin-bottom: 6px; }
.permission-group input[type=checkbox] { width: auto; }

/* Dagblokken bij uren en productie */
.day-block {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
  background: #f8fafc;           /* iets donkerder dan de kaart eromheen */
}
.day-block.weekend {
  background: #dfe6ef;           /* zaterdag en zondag duidelijk donkerder */
  border-color: #c3cede;
}
.day-header { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.day-header strong { font-size: 15px; }
.day-block table { margin-bottom: 8px; background: transparent; }
.day-block th { padding-top: 0; }
.day-block td { border-bottom-color: rgba(15, 23, 42, .08); }
/* invoervelden houden een witte achtergrond, zodat ze opvallen in het blok */
.day-block input, .day-block select { background: var(--white); }

.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.hint { color: var(--grey); font-size: 13px; }

dialog {
  border: none; border-radius: 14px; padding: 24px; max-width: 560px; width: 92%;
  box-shadow: 0 20px 60px rgba(15,23,42,.25);
}
dialog::backdrop { background: rgba(15,23,42,.45); }
dialog h3 { margin-top: 0; }

/* ---------- Telefoon ---------- */

/* De balk met de menuknop staat er alleen op een smal scherm. */
#topbar { display: none; }
#menu-overlay { display: none; }

@media (max-width: 900px) {
  #app.active { display: block; }

  #topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--white);
    border-bottom: 1px solid var(--line);
    padding: 8px 12px;
    height: 56px;
  }
  #menu-toggle {
    background: none;
    color: var(--text);
    padding: 8px;
    display: flex;
    align-items: center;
  }
  #menu-toggle:hover { background: var(--background); }
  .topbar-logo { max-height: 32px; max-width: 190px; }

  /* Het menu schuift van links in beeld */
  aside {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 270px;
    max-width: 84vw;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform .22s ease;
    overflow-y: auto;
    box-shadow: 0 0 40px rgba(15, 23, 42, .18);
  }
  aside.open { transform: none; }

  #menu-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .45);
    z-index: 30;
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s ease;
  }
  #menu-overlay.open { opacity: 1; pointer-events: auto; }

  main { padding: 18px 14px 40px; }
  h2 { font-size: 20px; }

  /* Tikken moet makkelijk gaan, en iOS mag niet inzoomen bij een invoerveld */
  input, select, textarea { font-size: 16px; padding: 12px; }
  button { min-height: 42px; padding: 10px 14px; }
  button.small { min-height: 36px; }
  .row > * { flex: 1 1 100%; }

  /* Brede tabellen mogen zijwaarts schuiven in plaats van de pagina op te rekken */
  .card > table,
  .day-block table,
  #ms-content table,
  #content table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .tabs { flex-wrap: nowrap; overflow-x: auto; }
  .tabs .tab { white-space: nowrap; padding: 10px 12px; }

  .card { padding: 16px; border-radius: 10px; }
  .day-block { padding: 10px; }
  .day-header { flex-wrap: wrap; }

  dialog { padding: 18px; width: 96%; }

  #login-screen { padding: 16px; align-items: flex-start; padding-top: 40px; }
  .login-card { padding: 22px; box-shadow: 0 8px 24px rgba(15, 23, 42, .10); }
  .login-logo { max-width: 200px; max-height: 90px; margin-bottom: 18px; }

  /* Statuslabels en knoppen in tabellen niet laten samenklonteren */
  .actions { gap: 6px; }
  table input, table select { font-size: 15px; padding: 8px; }
}

/* ---------- Tabs (binnen een pagina) ---------- */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin: 0 0 20px;
  flex-wrap: wrap;
}
.tabs .tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 10px 16px;
  color: var(--grey);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.tabs .tab:hover { color: var(--text); background: none; }
.tabs .tab.active { color: var(--blue); border-bottom-color: var(--blue); }

/* Aantal ongelezen berichten, in het menu */
.badge {
  margin-left: auto;
  background: var(--red);
  color: var(--white);
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
}
nav button.active .badge { background: var(--white); color: var(--blue); }
