/* W.V.Z. Tabletbeheer — "Fris Water" huisstijl (1-op-1 met de tablet-app + native beheercentrum).
   Primair blauw #006EA5, accent geel #F9DD3C. Licht, luchtig, aqua-tinten, zachte schaduwen.
   Beheerpaneel = scrollbaar (geen kiosk-lock), tekst selecteerbaar. */

:root {
  --blue: #006EA5;
  --blue-dark: #005580;
  --blue-darker: #00415f;
  --yellow: #F9DD3C;
  --yellow-dark: #d8bd1f;
  --ink: #0d2733;
  --ink-soft: #3d5a67;
  --muted: #5b7280;
  /* blauwzweem-neutralen (gekozen, geen kaal grijs) */
  --paper: #eef5fa;
  --paper-2: #e3eef6;
  --card: #ffffff;
  --line: #d9e6ef;
  --line-soft: #e7f0f6;
  --white: #fff;
  --danger: #c62828;
  --danger-bg: #fbe9e9;
  --ok: #1f7a3d;
  /* aqua-tinten (icoon-chips, inzetstukken) */
  --aqua-50: #f2f8fc;
  --aqua-100: #e6f1f8;
  --aqua-150: #d8e9f3;
  --aqua-200: #c7deec;
  --radius: 20px;
  --radius-sm: 13px;
  --shadow-soft: 0 1px 2px rgba(13,39,51,.05), 0 10px 30px rgba(0,80,128,.09);
  --shadow-tile: 0 1px 2px rgba(13,39,51,.06), 0 8px 20px rgba(0,80,128,.10);
  --shadow-lift: 0 2px 6px rgba(13,39,51,.08), 0 20px 44px rgba(0,80,128,.16);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { overflow-x: hidden; }

body {
  margin: 0; min-height: 100vh; color: var(--ink);
  overflow-x: hidden;
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
  background:
    radial-gradient(900px 520px at 88% -12%, #f4fbff 0%, rgba(244,251,255,0) 60%),
    radial-gradient(760px 620px at -8% 8%, #eaf5fd 0%, rgba(234,245,253,0) 55%),
    linear-gradient(180deg, var(--paper) 0%, var(--paper-2) 100%);
  background-attachment: fixed;
}

/* --- Kopbalk (als het native beheercentrum: blauw verloop + logo-chip + titel) --- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 14px 22px; color: #fff;
  background: linear-gradient(180deg, var(--blue) 0%, var(--blue-dark) 100%);
  box-shadow: 0 6px 22px rgba(0,65,95,.20);
  position: sticky; top: 0; z-index: 10;
}
.brand-btn { display: flex; align-items: center; gap: 12px; background: none; border: none; color: #fff; cursor: pointer; padding: 0; }
.brand-logo {
  height: 40px; width: 40px; object-fit: contain; display: block;
  background: #fff; border-radius: 11px; padding: 5px;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.brand-btn span { font-weight: 800; font-size: 19px; letter-spacing: .3px; }

/* --- Layout --- */
main, .wrap { max-width: 880px; margin: 0 auto; padding: 22px 20px 60px; }
.card.narrow { max-width: 520px; margin: 46px auto; }
.center { text-align: center; }

.card {
  background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: 24px; margin-bottom: 20px; box-shadow: var(--shadow-soft);
}
h1 { margin: 0 0 8px; font-size: 26px; color: var(--blue-darker); }
/* Sectiekop met blauw bolletje (1-op-1 met het native beheercentrum). */
h2 {
  margin: 0 0 14px; font-size: 15px; font-weight: 800; letter-spacing: .6px;
  text-transform: uppercase; color: var(--blue); display: flex; align-items: center; gap: 10px;
}
h2::before { content: ""; width: 11px; height: 11px; border-radius: 50%; background: var(--blue); flex: 0 0 auto; }
.muted { color: var(--muted); font-size: 14px; }

/* --- Formulieren --- */
label { display: block; margin: 14px 0 5px; font-weight: 700; font-size: 13.5px; color: var(--ink-soft); }
label.check { display: flex; align-items: center; gap: 9px; font-weight: 600; color: var(--ink); cursor: pointer; }
label.check input { width: 18px; height: 18px; accent-color: var(--blue); }
input:not([type]), input[type=text], input[type=password], input[type=number], input[type=time], textarea, select {
  width: 100%; min-width: 0; max-width: 100%;
  padding: 11px 13px; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  font: inherit; background: var(--aqua-50); color: var(--ink); transition: border-color .12s, background .12s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--blue); background: #fff; }
input.short { width: 100px; }
textarea { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 13px; resize: vertical; }
select { cursor: pointer; }
code { background: var(--aqua-100); padding: 1px 6px; border-radius: 6px; font-size: 13px; color: var(--blue-dark); }

/* --- Knoppen --- */
button { border: none; border-radius: var(--radius-sm); padding: 12px 20px; font: inherit; font-weight: 700; cursor: pointer; touch-action: manipulation; transition: transform .06s, background .12s, box-shadow .12s; }
button:active { transform: translateY(1px); }
.primary { background: var(--blue); color: #fff; box-shadow: 0 6px 16px rgba(0,110,165,.28); }
.primary:hover { background: var(--blue-dark); }
.secondary { background: var(--yellow); color: var(--ink); box-shadow: 0 6px 16px rgba(216,189,31,.3); }
.secondary:hover { background: var(--yellow-dark); }
.ghost { background: #fff; color: var(--blue); border: 1.5px solid var(--line); box-shadow: var(--shadow-soft); }
.ghost:hover { border-color: var(--blue); background: var(--aqua-50); }
button.danger { background: var(--danger-bg); color: var(--danger); box-shadow: none; }
button.danger:hover { background: #f6d5d5; }
button.small { padding: 8px 14px; font-size: 14px; }
#lock-btn { background: rgba(255,255,255,.16); color: #fff; border: 1.5px solid rgba(255,255,255,.35); box-shadow: none; }
#lock-btn:hover { background: rgba(255,255,255,.26); }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 16px; }
.back { background: none; border: none; color: var(--blue); font-weight: 800; cursor: pointer; padding: 4px 0; margin-bottom: 10px; font-size: 15px; }
.back:hover { color: var(--blue-dark); }

/* --- Homescherm: tegels met icoon-chip (1-op-1 met de tablet) --- */
.home-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; margin-top: 10px; }
@media (max-width: 560px) { .home-grid { grid-template-columns: 1fr; } }
.home-tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: 24px; cursor: pointer; text-align: left; box-shadow: var(--shadow-tile);
  transition: transform .08s ease, box-shadow .08s ease;
}
.home-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.ht-icon {
  width: 54px; height: 54px; margin-bottom: 8px; color: var(--blue);
  background: var(--aqua-100); border-radius: 15px; display: flex; align-items: center; justify-content: center;
}
.ht-icon svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ht-label { font-size: 21px; font-weight: 800; color: var(--blue-darker); }
.ht-sub { font-size: 14px; color: var(--muted); }

/* --- Tabel (gebruikers) --- */
.grid { width: 100%; border-collapse: collapse; table-layout: fixed; }
.grid th { text-align: left; font-size: 12px; color: var(--muted); padding: 8px 6px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
.grid td { padding: 6px; border-top: 1px solid var(--line-soft); vertical-align: middle; }
.grid input { width: 100%; padding: 10px 11px; }
.grid col.c-del, .grid th.c-del, .grid td.del { width: 52px; }
.grid td.del { text-align: center; }
.grid td.del button, .u-del {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; padding: 0; background: var(--danger-bg); color: var(--danger);
  border: none; border-radius: 10px; box-shadow: none;
}
.grid td.del svg, .u-del svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 640px) {
  .grid, .grid thead, .grid tbody, .grid tr, .grid td { display: block; }
  .grid thead { display: none; }
  .grid tr { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px; margin-bottom: 12px; background: var(--aqua-50); }
  .grid td { border: none; padding: 5px; }
  .grid td.del { text-align: right; }
}

/* --- Meldingen --- */
.msg { font-weight: 600; margin: 10px 0 0; min-height: 20px; }
.msg.ok { color: var(--ok); } .msg.err { color: var(--danger); }
.msg.floating {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--blue-darker); color: #fff; padding: 13px 22px; border-radius: 12px;
  z-index: 30; box-shadow: var(--shadow-lift); font-weight: 700;
}

/* subtiel "Powered by Larsmeneer"-watermerk, linksonder, op elk scherm */
.lm-badge {
  position: fixed; left: 10px; bottom: 8px; z-index: 40;
  display: flex; align-items: center; gap: 5px;
  opacity: .45; pointer-events: none; user-select: none;
}
.lm-badge img { height: 15px; width: auto; display: block; }
.lm-badge span { font-size: 10.5px; color: #333; letter-spacing: .2px; white-space: nowrap; }

/* --- Tablets --- */
.tablet-row { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-top: 1px solid var(--line-soft); flex-wrap: wrap; }
.tablet-row:first-child { border-top: none; }
.tablet-row .name { font-weight: 800; min-width: 90px; color: var(--blue-darker); }
.tablet-row .status { font-size: 13px; color: var(--muted); flex: 1; }
.tablet-row .status.err { color: var(--danger); font-weight: 700; }
.tablet-row button { padding: 9px 14px; font-size: 14px; }
.tablet-row .danger { background: var(--danger-bg); color: var(--danger); box-shadow: none; }
.tablet-row .tablet-opt { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); white-space: nowrap; cursor: pointer; }
.tablet-row .tablet-opt input { width: 17px; height: 17px; accent-color: var(--blue); }

/* --- Rooster --- */
.rooster-tabs { display: flex; gap: 9px; flex-wrap: wrap; margin-bottom: 16px; }
.rooster-tab { padding: 9px 18px; border: 1.5px solid var(--line); border-radius: 999px; background: #fff; cursor: pointer; font-weight: 700; color: var(--ink-soft); box-shadow: var(--shadow-soft); }
.rooster-tab.active { background: var(--blue); color: #fff; border-color: transparent; }
.rooster-day { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.rooster-day:first-child { border-top: none; }
.rooster-day.dim { opacity: .45; }
.rooster-day .rd-name { min-width: 110px; font-weight: 700; padding-top: 8px; }
.rd-ranges { display: flex; flex-direction: column; gap: 7px; flex: 1; }
.rd-range { display: flex; align-items: center; gap: 8px; }
.rd-range input[type=time] { padding: 8px 10px; width: auto; }
.rd-range .u-del { width: 32px; height: 32px; }
button.ghost.small { padding: 5px 12px; font-size: 13px; align-self: flex-start; }
.rooster-override { margin: 18px 0 4px; padding: 16px; background: var(--aqua-50); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); }
.rooster-override .row { margin-top: 12px; }

/* --- Standaard wifi's --- */
.wifi-net-row { display: flex; gap: 9px; align-items: center; margin-bottom: 9px; }
.wifi-net-row input { flex: 1; }
.wifi-net-row .u-del { flex: 0 0 auto; font-size: 16px; }

/* --- Tegel-editor --- */
.tile-card { border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 16px; margin-bottom: 14px; background: var(--aqua-50); box-shadow: var(--shadow-soft); }
.tile-card .tc-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.tile-card .tc-row > * { flex: 1 1 140px; min-width: 0; }
.tile-card select, .tile-card input { padding: 9px 11px; background: #fff; }
.tile-card .tc-tools { display: flex; gap: 6px; flex: 0 0 auto; }
.tile-card .tc-tools button { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; background: #fff; border: 1px solid var(--line); color: var(--ink); box-shadow: none; }
.tile-card .tc-tools button:last-child { background: var(--danger-bg); color: var(--danger); border-color: #f3d3d3; }
.tile-card .tc-tools svg, .sub-item .s-del svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; display: block; }
.sub-item .s-del { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; background: var(--danger-bg); color: var(--danger); border: none; flex: 0 0 auto; box-shadow: none; }
.tile-card .sub-items { margin-top: 10px; padding-left: 10px; border-left: 3px solid var(--aqua-200); }
.tile-card .sub-item { display: flex; gap: 8px; margin-top: 7px; }

/* --- Per-gebruiker zichtbaarheid ("wie ziet deze tegel?") --- */
.tile-users { margin-top: 12px; }
.tile-users > summary {
  list-style: none; cursor: pointer; font-weight: 700; font-size: 13.5px; color: var(--blue-dark);
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 0;
}
.tile-users > summary::-webkit-details-marker { display: none; }
.tile-users > summary::before { content: "▸"; font-size: 11px; transition: transform .12s; }
.tile-users[open] > summary::before { transform: rotate(90deg); }
.tu-hint { font-weight: 500; color: var(--muted); font-size: 12.5px; }
.tu-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.tu-chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px;
  border: 1.5px solid var(--line); border-radius: 999px; background: #fff; cursor: pointer;
  font-size: 13.5px; font-weight: 600; color: var(--ink-soft); white-space: nowrap;
}
.tu-chip input { width: 16px; height: 16px; accent-color: var(--blue); margin: 0; }
.tu-chip:has(input:checked) { background: var(--aqua-100); border-color: var(--blue); color: var(--blue-darker); }

/* --- QR + details --- */
.qr-out { display: flex; justify-content: center; padding: 18px; }
.qr-out svg { width: min(80vw, 360px); height: auto; }
details { margin-top: 12px; }
summary { cursor: pointer; font-weight: 600; color: var(--blue); }

/* --- Legacy tabs (nog gebruikt?) --- */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs button { background: #fff; border: 1px solid var(--line); color: var(--ink); }
.tabs button.active { background: var(--blue); color: #fff; border-color: var(--blue); }
