/* ===========================================================
   Brinkreef — iOS-geïnspireerde stijl met licht/donker modus
   =========================================================== */

:root {
  /* iOS systeemkleuren (licht) */
  --bg: #f2f2f7;
  --bg-elevated: #ffffff;
  --card: #ffffff;
  --card-2: #f2f2f7;
  --sidebar: rgba(255, 255, 255, 0.72);
  --label: #1c1c1e;
  --label-2: rgba(60, 60, 67, 0.6);
  --label-3: rgba(60, 60, 67, 0.3);
  --separator: rgba(60, 60, 67, 0.18);
  --blue: #007aff;
  --blue-press: #0062cc;
  --green: #34c759;
  --red: #ff3b30;
  --orange: #ff9500;
  --purple: #af52de;
  --pink: #ff2d55;
  --indigo: #5856d6;
  --teal: #30b0c7;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.06);
  --radius: 18px;
  --radius-sm: 12px;
  --radius-lg: 26px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

[data-theme="dark"] {
  --bg: #000000;
  --bg-elevated: #1c1c1e;
  --card: #1c1c1e;
  --card-2: #2c2c2e;
  --sidebar: rgba(28, 28, 30, 0.72);
  --label: #ffffff;
  --label-2: rgba(235, 235, 245, 0.6);
  --label-3: rgba(235, 235, 245, 0.3);
  --separator: rgba(84, 84, 88, 0.55);
  --blue: #0a84ff;
  --blue-press: #409cff;
  --green: #30d158;
  --red: #ff453a;
  --orange: #ff9f0a;
  --purple: #bf5af2;
  --pink: #ff375f;
  --indigo: #5e5ce6;
  --teal: #40c8e0;
  --shadow: 0 1px 3px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.45);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #000000; --bg-elevated: #1c1c1e; --card: #1c1c1e; --card-2: #2c2c2e;
    --sidebar: rgba(28,28,30,.72); --label: #fff; --label-2: rgba(235,235,245,.6);
    --label-3: rgba(235,235,245,.3); --separator: rgba(84,84,88,.55);
    --blue: #0a84ff; --green: #30d158; --red: #ff453a; --shadow: 0 1px 3px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.45);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--label);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}
a { color: inherit; text-decoration: none; }
h1 { font-size: 2rem; font-weight: 800; letter-spacing: -0.03em; margin: 0 0 .25rem; }
h2 { font-size: 1.2rem; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 .9rem; }
.muted { color: var(--label-2); }
.ico { width: 19px; height: 19px; }

/* ---------------- layout ---------------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 270px; flex: 0 0 270px;
  background: var(--sidebar);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-right: 1px solid var(--separator);
  display: flex; flex-direction: column;
  padding: 20px 16px;
  position: sticky; top: 0; height: 100vh;
}
.content {
  flex: 1; padding: 40px clamp(20px, 5vw, 56px);
  max-width: 1180px; width: 100%;
}

/* brand */
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 22px; }
.brand-logo { width: 44px; height: 44px; border-radius: 12px; box-shadow: var(--shadow); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: 1.2rem; font-weight: 800; letter-spacing: -0.02em; }
.brand-text small { color: var(--label-2); font-size: .8rem; }

/* nav — iOS inset grouped list */
.nav-group {
  display: flex; flex-direction: column;
  background: var(--card); border-radius: var(--radius);
  padding: 6px; gap: 2px; flex: 0 0 auto;
  box-shadow: var(--shadow);
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 10px; border-radius: var(--radius-sm);
  color: var(--label); font-weight: 500; font-size: .98rem;
}
.nav-item:hover { background: var(--card-2); }
.nav-item.active { background: var(--card-2); }
.nav-label { flex: 1; }
.chev { width: 16px; height: 16px; color: var(--label-3); }

/* gekleurde iOS icoon-badges */
.ibadge {
  width: 30px; height: 30px; flex: 0 0 30px;
  border-radius: 8px; display: grid; place-items: center;
  color: #fff;
  background: linear-gradient(180deg, var(--blue), var(--blue-press));
}
.ibadge .ico { width: 17px; height: 17px; }
.ibadge-home { background: linear-gradient(180deg,#0a84ff,#0062cc); }
.ibadge-wifi { background: linear-gradient(180deg,#34c759,#248a3d); }
.ibadge-ha   { background: linear-gradient(180deg,#5ac8fa,#0a84ff); }
.ibadge-link { background: linear-gradient(180deg,#5856d6,#3634a3); }
.ibadge-doc  { background: linear-gradient(180deg,#ff9500,#c93400); }
.ibadge-lock { background: linear-gradient(180deg,#8e8e93,#48484a); }
.ibadge-chart{ background: linear-gradient(180deg,#af52de,#8944ab); }
.ibadge-users{ background: linear-gradient(180deg,#ff2d55,#d70015); }
.ibadge-gear { background: linear-gradient(180deg,#8e8e93,#3a3a3c); }

/* sidebar voet */
.sidebar-foot { margin-top: auto; padding-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.theme-toggle {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: none; cursor: pointer;
  background: var(--card); border-radius: var(--radius-sm);
  color: var(--label); font-family: var(--font); font-size: .92rem; font-weight: 500;
  box-shadow: var(--shadow);
}
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .t-moon { display: none; }
[data-theme="dark"] .theme-toggle .t-sun { display: none; }
[data-theme="dark"] .theme-toggle .t-moon { display: inline; }

.who {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border-radius: var(--radius-sm);
  padding: 10px 12px; box-shadow: var(--shadow);
}
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--indigo));
  display: grid; place-items: center; font-weight: 700; color: #fff;
}
.who-text { display: flex; flex-direction: column; line-height: 1.2; flex: 1; min-width: 0; }
.who-text strong { font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-text span { font-size: .78rem; color: var(--label-2); }
.logout { color: var(--label-2); display: grid; place-items: center; padding: 4px; }
.logout svg { width: 19px; height: 19px; }
.logout:hover { color: var(--red); }

/* page head — iOS large title */
.page-head { margin-bottom: 26px; }

/* cards */
.card {
  background: var(--card); border-radius: var(--radius);
  padding: 22px; margin-bottom: 18px; box-shadow: var(--shadow);
}
.note-card { color: var(--label-2); }

/* dashboard tiles */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
.tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 14px;
  padding: 22px; background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); transition: transform .18s ease, box-shadow .18s ease;
}
.tile:hover { transform: translateY(-3px); box-shadow: 0 8px 30px rgba(0,0,0,.12); }
.tile:active { transform: scale(.97); }
.tile .ibadge { width: 46px; height: 46px; flex: 0 0 46px; border-radius: 12px; }
.tile .ibadge .ico { width: 24px; height: 24px; }
.tile-label { font-weight: 600; font-size: 1.02rem; }

/* forms */
label { display: block; font-size: .85rem; color: var(--label-2); margin-bottom: 12px; font-weight: 500; }
input, select, textarea {
  width: 100%; margin-top: 6px; padding: 12px 14px;
  background: var(--card-2); border: 1px solid transparent; border-radius: var(--radius-sm);
  color: var(--label); font-size: .98rem; font-family: var(--font);
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--blue); background: var(--bg-elevated); }
.form-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.form-row input { flex: 1; min-width: 160px; margin-top: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.flag-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin: 16px 0; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input { margin-top: 0; width: auto; }
.check { display: flex; align-items: center; gap: 8px; color: var(--label); margin: 0; font-weight: 500; }
.check input { width: auto; margin: 0; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 11px 18px; border: none; border-radius: 980px;
  background: var(--card-2); color: var(--label); font-weight: 600; cursor: pointer;
  font-size: .94rem; font-family: var(--font); transition: filter .15s, transform .1s;
}
.btn:hover { filter: brightness(.96); }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-press); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 7px 14px; font-size: .86rem; }
.btn-block { width: 100%; justify-content: center; padding: 14px; }
.danger { color: var(--red); }

/* flash */
.flash { padding: 13px 16px; border-radius: var(--radius-sm); margin-bottom: 20px; font-size: .94rem; font-weight: 500; }
.flash-success { background: rgba(52,199,89,.15); color: var(--green); }
.flash-error { background: rgba(255,59,48,.15); color: var(--red); }
.flash-info { background: rgba(0,122,255,.15); color: var(--blue); }

/* links */
.link-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.link-card { background: var(--card); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; justify-content: space-between; gap: 14px; box-shadow: var(--shadow); }
.link-main { display: flex; gap: 12px; align-items: flex-start; }
.link-main strong { display: block; }
.link-main small { color: var(--label-2); }
.link-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.badge { font-size: .72rem; padding: 4px 10px; border-radius: 980px; background: rgba(0,122,255,.15); color: var(--blue); font-weight: 600; }
.badge-muted { background: var(--card-2); color: var(--label-2); }

/* metrics */
.metric-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.metric { background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.metric-label { display: block; color: var(--label-2); font-size: .85rem; margin-bottom: 6px; font-weight: 500; }
.metric-value { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; }
.bar { height: 7px; background: var(--card-2); border-radius: 980px; margin-top: 14px; overflow: hidden; }
.bar > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--blue), var(--indigo)); transition: width .5s ease; border-radius: 980px; }

/* avatars */
.avatar-img { object-fit: cover; }
img.avatar { padding: 0; }
.avatar-xl { width: 84px; height: 84px; border-radius: 22px; object-fit: cover; box-shadow: var(--shadow); display: block; }
.avatar-fallback { display: grid; place-items: center; font-size: 2rem; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--blue), var(--indigo)); }
.logo-preview { background: var(--card-2); padding: 8px; }

/* settings / profile */
.profile-row { display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap; }
.profile-pic { flex: 0 0 auto; }
.profile-forms { flex: 1; min-width: 240px; display: flex; flex-direction: column; gap: 12px; }
.btn-row { margin-top: 6px; }
.section-title { margin: 26px 0 14px; }

/* users */
.user-card .user-head { margin-bottom: 6px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.user-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; border-top: 1px solid var(--separator); padding-top: 16px; margin-top: 4px; }

/* network */
.sub { font-size: 1rem; font-weight: 700; margin: 18px 0 4px; }
.small { font-size: .85rem; }
.mt { margin-top: 12px; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; color: var(--label-2); }
.table-card { padding: 6px 6px; overflow-x: auto; }
.net-table { width: 100%; border-collapse: collapse; font-size: .94rem; }
.net-table th { text-align: left; font-weight: 600; color: var(--label-2); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; padding: 12px 14px; }
.net-table td { padding: 12px 14px; border-top: 1px solid var(--separator); }
.net-table tbody tr:hover { background: var(--card-2); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; vertical-align: middle; }
.dot-on { background: var(--green); box-shadow: 0 0 0 3px rgba(52,199,89,.18); }
.dot-off { background: var(--label-3); }

.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.qr-card { display: flex; gap: 18px; align-items: center; }
.qr-img { flex: 0 0 auto; background: #fff; border-radius: var(--radius-sm); padding: 8px; }
.qr-img img { width: 120px; height: 120px; display: block; }

/* embed */
.embed-wrap { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); margin-bottom: 18px; }
.embed-wrap iframe { width: 100%; height: 72vh; border: 0; display: block; background: #fff; }

/* login */
.login-body { display: grid; place-items: center; min-height: 100vh; background: var(--bg); padding: 20px; }
.login-card { background: var(--card); border-radius: var(--radius-lg); padding: 38px 32px; width: min(400px, 94vw); box-shadow: 0 20px 60px rgba(0,0,0,.18); text-align: center; }
.login-logo { width: 76px; height: 76px; border-radius: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.login-title { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; }
.login-sub { color: var(--label-2); margin: 2px 0 22px; }
.login-card form { margin-top: 8px; text-align: left; }
.login-card label { color: var(--label); }
.login-foot { margin-top: 18px; }
.theme-link { background: none; border: none; color: var(--blue); font-family: var(--font); font-size: .9rem; cursor: pointer; font-weight: 600; }

/* mobiel: sidebar wordt onderbalk (iOS tab bar) */
@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .content { padding: 24px 18px 96px; order: 1; }
  .sidebar {
    width: 100%; flex: none; height: auto; position: fixed; bottom: 0; top: auto;
    flex-direction: row; align-items: center; padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    border-right: none; border-top: 1px solid var(--separator); z-index: 50; gap: 8px;
  }
  .brand, .sidebar-foot { display: none; }
  .nav-group {
    flex-direction: row; flex: 1; box-shadow: none; background: transparent;
    overflow-x: auto; padding: 0; gap: 4px;
  }
  .nav-item { flex-direction: column; gap: 4px; padding: 6px 10px; font-size: .68rem; min-width: 64px; text-align: center; }
  .nav-label { flex: none; }
  .chev { display: none; }
}
