/* ── Fonts ─────────────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@400;700&display=swap');

@font-face { font-family: 'Maven Pro'; font-weight: 400; font-display: swap;
  src: url('/public/fonts/MavenPro-Regular.ttf') format('truetype'); }
@font-face { font-family: 'Maven Pro'; font-weight: 500; font-display: swap;
  src: url('/public/fonts/MavenPro-Medium.ttf') format('truetype'); }
@font-face { font-family: 'Maven Pro'; font-weight: 700; font-display: swap;
  src: url('/public/fonts/MavenPro-Bold.ttf') format('truetype'); }
@font-face { font-family: 'Maven Pro'; font-weight: 900; font-display: swap;
  src: url('/public/fonts/MavenPro-Black.ttf') format('truetype'); }
@font-face { font-family: 'Lato'; font-weight: 300; font-display: swap;
  src: url('/public/fonts/Lato-Light.ttf') format('truetype'); }
@font-face { font-family: 'Lato'; font-weight: 400; font-display: swap;
  src: url('/public/fonts/Lato-Medium.ttf') format('truetype'); }
@font-face { font-family: 'Lato'; font-weight: 700; font-display: swap;
  src: url('/public/fonts/Lato-Bold.ttf') format('truetype'); }
@font-face { font-family: 'Lato'; font-weight: 900; font-display: swap;
  src: url('/public/fonts/Lato-Black.ttf') format('truetype'); }

/* ── Design tokens ─────────────────────────────────────────────────────────── */
:root {
  --wd-orange:   #F9981C;
  --wd-blue:     #283583;
  --wd-link:     #009FE3;
  --wd-sportief: #00A2BF;
  --wd-warmte:   #DB6245;
  --wd-natuur:   #4FAF68;
  --wd-terra:    #9F9985;
  --wd-zand:     #D0C8AC;
  --wd-sand-20:  #F7F5EF;
  --wd-sand-40:  #EDE9DD;
  --wd-blue-20:  #D3D6E6;

  --fg-1:   #283583;
  --fg-2:   #1E1E28;
  --fg-3:   #5A5F7A;
  --surface: #FFFFFF;
  --bg-soft: #F7F5EF;
  --border:  #E5E2D6;
  --border-strong: #C9C4B1;

  /* legacy compat for admin pages */
  --bg: var(--bg-soft);
  --text: var(--fg-2);
  --text-muted: var(--fg-3);
  --accent: var(--wd-blue);
  --accent-hover: #1d276e;
  --danger:  #C53030;
  --success: #4FAF68;
  --radius:  8px;

  --shadow-card: 0 1px 2px rgba(40,53,131,.06), 0 8px 24px rgba(40,53,131,.08);
  --shadow-lift: 0 2px 4px rgba(40,53,131,.08), 0 20px 40px rgba(40,53,131,.14);

  --font-display: 'Maven Pro', 'Helvetica Neue', Arial, sans-serif;
  --font-body:    'Lato', 'Helvetica Neue', Arial, sans-serif;
  --font-hand:    'Caveat', cursive;

  --sidebar-w: 264px;
  --topbar-h:  56px;
}

html.sidebar-collapsed { --sidebar-w: 72px; }

/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100vh; }

body {
  font-family: var(--font-body);
  background: var(--bg-soft);
  color: var(--fg-2);
  line-height: 1.55;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--fg-1);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -.005em;
}

a { color: var(--wd-link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Sidebar ───────────────────────────────────────────────────────────────── */
#mwd-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--wd-blue);
  z-index: 200;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 280ms cubic-bezier(.22,1,.36,1);
}

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 22px;
  min-height: 72px; flex-shrink: 0;
}
.sidebar-brand-icon {
  width: 36px; height: 36px; flex-shrink: 0;
  background: var(--wd-orange); border-radius: 8px;
  display: grid; place-items: center; color: #fff;
}
.sidebar-brand-icon svg { width: 22px; height: 22px; }
.sidebar-logo-mark { width: 26px; height: 26px; object-fit: contain; filter: brightness(0) invert(1); display: block; }
.sidebar-brand-text { min-width: 0; overflow: hidden; }
.sidebar-brand-name {
  font-family: var(--font-display); font-weight: 700;
  font-size: 17px; line-height: 1.05; color: #fff;
  letter-spacing: -.01em; white-space: nowrap;
}
.sidebar-brand-org {
  font-size: 10px; letter-spacing: .16em; text-transform: uppercase;
  color: rgba(255,255,255,.45); font-weight: 700; margin-top: 3px;
  white-space: nowrap;
}

.sidebar-section-label {
  padding: 10px 22px 4px;
  font-size: 10px; letter-spacing: .16em;
  text-transform: uppercase; font-weight: 700;
  color: rgba(255,255,255,.4);
  font-family: var(--font-display);
  white-space: nowrap; overflow: hidden;
}

.sidebar-nav-section {
  padding: 2px 10px;
  display: flex; flex-direction: column; gap: 2px;
}

.sidebar-item {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px;
  color: rgba(255,255,255,.7);
  text-decoration: none;
  border-radius: 8px;
  font-size: 14px; font-weight: 500;
  font-family: var(--font-body);
  white-space: nowrap;
  min-height: 38px;
  transition: background 160ms, color 160ms;
  box-shadow: inset 3px 0 0 transparent;
}
.sidebar-item:hover                     { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.sidebar-item.active                    { background: rgba(255,255,255,.14); color: #fff; font-weight: 600;
                                          box-shadow: inset 4px 0 0 var(--wd-orange); }
.sidebar-item.active .sidebar-item-icon { color: var(--wd-orange); }
.sidebar-item--muted                    { opacity: .55; pointer-events: none; }

.sidebar-item-icon {
  width: 20px; height: 20px; flex-shrink: 0;
  display: grid; place-items: center;
  font-size: 15px; line-height: 1;
}
.sidebar-item-icon svg, .sidebar-mod-icon { width: 20px; height: 20px; }
.sidebar-item-label { overflow: hidden; text-overflow: ellipsis; flex: 1; }

.sidebar-divider { height: 1px; margin: 10px 18px; background: rgba(255,255,255,.10); flex-shrink: 0; }
.sidebar-spacer { flex: 1; }

.sidebar-footer {
  padding: 12px 14px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: 10px;
  background: rgba(255,255,255,.06);
}
.sidebar-user-avatar {
  width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
  background: linear-gradient(135deg,#DB6245 0%,#F9981C 100%);
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 12px;
  font-family: var(--font-display);
}
.sidebar-user-info { flex: 1; min-width: 0; overflow: hidden; }
.sidebar-user-name { font-size: 12px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11px; color: rgba(255,255,255,.5); }
.sidebar-collapse-btn {
  width: 28px; height: 28px; flex-shrink: 0;
  background: transparent; border: none;
  color: rgba(255,255,255,.5); cursor: pointer;
  border-radius: 6px; display: grid; place-items: center;
  transition: background 160ms, color 160ms;
}
.sidebar-collapse-btn:hover { background: rgba(255,255,255,.08); color: rgba(255,255,255,.9); }
.sidebar-collapse-btn svg { width: 18px; height: 18px; }

/* Collapsed overrides */
html.sidebar-collapsed .sidebar-brand      { padding: 18px; justify-content: center; }
html.sidebar-collapsed .sidebar-brand-text,
html.sidebar-collapsed .sidebar-section-label,
html.sidebar-collapsed .sidebar-item-label,
html.sidebar-collapsed .sidebar-user-info  { display: none; }
html.sidebar-collapsed .sidebar-item        { justify-content: center; padding: 10px;
                                              box-shadow: inset 0 4px 0 transparent; }
html.sidebar-collapsed .sidebar-item.active { box-shadow: inset 0 4px 0 var(--wd-orange); }
html.sidebar-collapsed .sidebar-user       { justify-content: center; }

/* Mobile overlay */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 199; }

/* ── Top bar ───────────────────────────────────────────────────────────────── */
#mwd-topbar {
  position: fixed; top: 0;
  left: var(--sidebar-w); right: 0;
  height: var(--topbar-h);
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: flex; align-items: center; gap: 12px;
  padding: 0 24px 0 20px;
  border-bottom: 1px solid var(--border);
  transition: left 280ms cubic-bezier(.22,1,.36,1);
}

.topbar-search {
  display: flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 12px;
  flex: 1; max-width: 480px;
}
.topbar-search-icon { width: 16px; height: 16px; flex-shrink: 0; color: var(--fg-3); }
.topbar-search-icon svg { width: 16px; height: 16px; }
.topbar-search input {
  flex: 1; border: none; outline: none; background: transparent;
  font-family: var(--font-body); font-size: 13px; color: var(--fg-2);
}
.topbar-search input::placeholder { color: var(--fg-3); }
.topbar-search-kbd {
  font-family: var(--font-body); font-size: 11px; font-weight: 600;
  color: var(--fg-3); background: var(--wd-sand-20);
  border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px;
}

.topbar-spacer { flex: 1; }

.topbar-lang {
  display: flex; background: #fff;
  border: 1px solid var(--border); border-radius: 999px;
  padding: 3px; font-size: 12px;
  font-family: var(--font-display); font-weight: 700;
}
.topbar-lang-btn {
  border: none; padding: 4px 12px; border-radius: 999px;
  background: transparent; color: var(--fg-3);
  cursor: pointer; font: inherit; letter-spacing: .04em;
  transition: background 150ms, color 150ms;
}
.topbar-lang-btn.active { background: var(--wd-blue); color: #fff; }

.topbar-icon-btn {
  position: relative; width: 34px; height: 34px;
  border: 1px solid var(--border); background: #fff; border-radius: 8px;
  display: grid; place-items: center; cursor: pointer; color: var(--fg-2);
}
.topbar-icon-btn svg { width: 18px; height: 18px; }

.topbar-avatar {
  width: 34px; height: 34px; border-radius: 8px; flex-shrink: 0;
  background: linear-gradient(135deg,#DB6245 0%,#F9981C 100%);
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 12px;
  font-family: var(--font-display);
  text-decoration: none; cursor: pointer;
  transition: transform 120ms ease;
}
.topbar-avatar:hover { text-decoration: none; transform: translateY(-1px); }

.sidebar-toggle {
  display: none; width: 34px; height: 34px;
  background: transparent; border: 1px solid var(--border);
  border-radius: 8px; cursor: pointer;
  flex-direction: column; gap: 4px; align-items: center; justify-content: center;
}
.sidebar-toggle span { display: block; width: 16px; height: 2px; background: var(--fg-2); border-radius: 2px; }

.btn-logout {
  padding: 6px 14px; background: transparent;
  color: var(--fg-3); border: 1px solid var(--border);
  border-radius: 8px; cursor: pointer;
  font-size: 12px; font-weight: 600; font-family: var(--font-body);
  transition: border-color 120ms, color 120ms;
}
.btn-logout:hover { border-color: var(--fg-3); color: var(--fg-2); }

/* ── Main / iframe ─────────────────────────────────────────────────────────── */
#main-content {
  margin-left: var(--sidebar-w);
  margin-top: var(--topbar-h);
  min-height: calc(100vh - var(--topbar-h));
  transition: margin-left 280ms cubic-bezier(.22,1,.36,1);
}

#module-iframe {
  position: fixed;
  left: var(--sidebar-w); top: var(--topbar-h);
  width: calc(100vw - var(--sidebar-w));
  height: calc(100vh - var(--topbar-h));
  border: none;
  transition: left 280ms cubic-bezier(.22,1,.36,1), width 280ms cubic-bezier(.22,1,.36,1);
}

/* ── Overview / dashboard ──────────────────────────────────────────────────── */
.overview { padding: 32px 32px 64px; max-width: 1400px; margin: 0 auto; }

.overview-kicker { font-size: 13px; color: var(--fg-3); font-weight: 500; margin-bottom: 6px; }
.overview-kicker strong { color: var(--fg-1); font-weight: 700; }
.overview-title { font-size: 40px; margin: 0 0 16px; }
.overview-lead { font-size: 16px; line-height: 1.55; color: var(--fg-3); max-width: 600px; }
.overview-hand {
  font-family: var(--font-hand);
  font-weight: 700; font-size: 32px;
  color: var(--wd-orange); line-height: 1;
  display: inline-block;
  transform: rotate(-3deg); transform-origin: left center;
}

.modules-section { margin-bottom: 40px; }
.modules-section-header {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 16px;
}
.modules-section-title { font-family: var(--font-display); font-size: 18px; font-weight: 700; color: var(--fg-1); letter-spacing: -.005em; }
.modules-section-count { font-size: 13px; color: var(--fg-3); }

.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* Module tile */
.module-tile {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden;
  text-decoration: none; color: inherit;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(40,53,131,.04);
  transition: transform 240ms cubic-bezier(.22,1,.36,1), box-shadow 240ms;
}
.module-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); text-decoration: none; color: inherit; }

/* Theme colour tokens — set on .module-tile */
.module-tile.theme-orange  { --tile-color: var(--wd-orange);   --tile-tint: rgba(249,152,28,.10); }
.module-tile.theme-blue    { --tile-color: var(--wd-blue);     --tile-tint: rgba(40,53,131,.08);  }
.module-tile.theme-sportief{ --tile-color: var(--wd-sportief); --tile-tint: rgba(0,162,191,.10);  }
.module-tile.theme-warmte  { --tile-color: var(--wd-warmte);   --tile-tint: rgba(219,98,69,.10);  }
.module-tile.theme-natuur  { --tile-color: var(--wd-natuur);   --tile-tint: rgba(79,175,104,.10); }
.module-tile.theme-terra   { --tile-color: var(--wd-terra);    --tile-tint: rgba(159,153,133,.16);}
.module-tile.theme-zand    { --tile-color: var(--wd-zand);     --tile-tint: rgba(208,200,172,.30);}

.module-tile-stripe { height: 4px; background: var(--tile-color, var(--wd-blue)); }

.module-tile-body { padding: 20px 22px 18px; flex: 1; display: flex; flex-direction: column; }

.module-tile-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 10px; }

.module-tile-icon-wrap {
  width: 44px; height: 44px; border-radius: 10px; flex-shrink: 0;
  background: var(--tile-tint, rgba(40,53,131,.08));
  display: grid; place-items: center; font-size: 22px; line-height: 1;
}
.module-tile-name {
  font-family: var(--font-display); font-weight: 700;
  font-size: 17px; color: var(--fg-1); line-height: 1.2;
  letter-spacing: -.005em; margin: 6px 0 0;
}
.module-tile-desc { font-size: 13px; line-height: 1.5; color: var(--fg-3); flex: 1; margin-top: 4px; }

.module-tile-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 16px; padding-top: 12px;
  border-top: 1px dashed var(--border);
}
.module-tile-open  { font-size: 12px; font-weight: 700; color: var(--tile-color, var(--wd-blue));
                     font-family: var(--font-display); letter-spacing: .02em;
                     display: inline-flex; align-items: center; gap: 4px; }
.tile-arrow { display: inline-block; transition: transform 200ms; }
.module-tile:hover .tile-arrow { transform: translateX(3px); }

.empty-state { padding: 64px 32px; text-align: center; color: var(--fg-3); }

/* ── Login ─────────────────────────────────────────────────────────────────── */
body.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--wd-blue);
  background-image: radial-gradient(circle at 30% 40%, rgba(249,152,28,.12) 0%, transparent 60%),
                    radial-gradient(circle at 70% 60%, rgba(255,255,255,.05) 0%, transparent 60%);
}
.login-card {
  background: var(--surface); border-radius: 16px;
  padding: 2.5rem 2.75rem; width: 100%; max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-mark {
  display: flex; justify-content: center; margin: 0 auto 20px;
}
.login-mark img { max-width: 220px; height: auto; }
.login-title { text-align: center; font-family: var(--font-display); font-size: 24px; font-weight: 700; color: var(--fg-1); margin-bottom: 4px; }
.login-sub   { text-align: center; font-size: 11px; color: var(--fg-3); margin-bottom: 28px;
               letter-spacing: .12em; text-transform: uppercase; font-family: var(--font-display); font-weight: 700; }

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-label { display: block; font-size: .82rem; font-weight: 600; margin-bottom: .35rem; color: var(--fg-2); }
.req { color: var(--danger); }
.form-hint  { font-size: .75rem; color: var(--fg-3); margin-top: .3rem; }

.form-control {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: .875rem; font-family: var(--font-body);
  color: var(--fg-2); background: var(--surface);
  transition: border-color .12s, box-shadow .12s; appearance: auto;
}
.form-control:focus { outline: none; border-color: var(--wd-blue); box-shadow: 0 0 0 3px rgba(40,53,131,.12); }
.form-control[type="file"] { padding: .45rem .6rem; }
.radio-group  { display: flex; gap: 1.5rem; flex-wrap: wrap; padding: .4rem 0; }
.radio-label  { display: flex; align-items: center; gap: .4rem; font-size: .875rem; cursor: pointer; }
.form-actions { display: flex; gap: .75rem; margin-top: 1.5rem; align-items: center; }
.form-fieldset { border: 1px solid var(--border); border-radius: 8px; padding: .9rem 1rem 1rem; margin: 1.4rem 0; }
.form-fieldset legend { padding: 0 .4rem; font-size: .82rem; font-weight: 600; color: var(--fg-2); }
.permission-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .4rem .8rem; }
.permission-row { display: flex; align-items: flex-start; gap: .55rem; padding: .35rem .4rem; border-radius: 6px; cursor: pointer; }
.permission-row:hover { background: var(--bg-soft); }
.permission-mod { display: flex; flex-direction: column; gap: 1px; line-height: 1.3; }
.permission-meta { font-size: .72rem; color: var(--fg-3); }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 20px; border-radius: 8px;
  font-size: .875rem; font-weight: 600; font-family: var(--font-body);
  cursor: pointer; border: 1px solid transparent;
  text-decoration: none; transition: all 160ms; line-height: 1.4;
}
.btn:hover { text-decoration: none; }
.btn-primary   { background: var(--wd-blue);   color: #fff; border-color: var(--wd-blue); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-secondary { background: var(--surface);   color: var(--fg-2); border-color: var(--border); }
.btn-secondary:hover { background: var(--wd-sand-20); }
.btn-danger    { background: var(--danger);    color: #fff; }
.btn-warning   { background: var(--wd-orange); color: #fff; }
.btn-success   { background: var(--success);   color: #fff; }

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.card { background: var(--surface); border-radius: 10px; padding: 1.5rem; box-shadow: var(--shadow-card); border: 1px solid var(--border); }

/* ── Page layout ───────────────────────────────────────────────────────────── */
.page-content { padding: 1.75rem 2rem; }
.page-header  { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.page-title   { font-size: 1.35rem; font-weight: 700; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
.section-title  { font-size: 1rem; font-weight: 600; }

/* ── Stats (admin dashboard) ───────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 1rem; margin-bottom: 1.75rem; }
.stat-card  { background: var(--surface); border-radius: 10px; padding: 1.25rem 1.5rem;
              box-shadow: var(--shadow-card); border: 1px solid var(--border); text-align: center; }
.stat-value { font-size: 2rem; font-weight: 700; color: var(--wd-blue); font-family: var(--font-display); line-height: 1.1; }
.stat-label { font-size: .78rem; color: var(--fg-3); margin-top: .25rem; text-transform: uppercase; letter-spacing: .04em; }
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }

/* ── Tables ────────────────────────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow-card); border: 1px solid var(--border); }
.table th, .table td { padding: .75rem 1rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { background: var(--wd-sand-20); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--fg-3); }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: #f9fbfd; }

/* ── Alerts ────────────────────────────────────────────────────────────────── */
.alert { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: .875rem; }
.alert-error   { background: #fff5f5; color: #c53030; border: 1px solid #feb2b2; }
.alert-success { background: #f0fff4; color: #276749; border: 1px solid #9ae6b4; }

/* ── Badges ────────────────────────────────────────────────────────────────── */
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 99px; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.badge-admin    { background: var(--wd-blue-20); color: var(--wd-blue); }
.badge-user     { background: #e9d8fd; color: #553c9a; }
.badge-static   { background: #c6f6d5; color: #276749; }
.badge-proxy    { background: #fefcbf; color: #744210; }
.badge-active   { background: #c6f6d5; color: #276749; }
.badge-inactive { background: #fed7d7; color: #9b2c2c; }

/* ── Permissions ───────────────────────────────────────────────────────────── */
.module-selector { display: flex; flex-wrap: wrap; gap: .5rem; }
.module-selector-item {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .45rem .85rem; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-soft); color: var(--fg-2); text-decoration: none;
  font-size: .84rem; transition: background .12s, border-color .12s;
}
.module-selector-item:hover { background: var(--wd-blue-20); border-color: var(--wd-blue); text-decoration: none; }
.module-selector-item.active { background: var(--wd-blue); color: #fff; border-color: var(--wd-blue); }
.module-selector-item.active span { color: #fff !important; }

/* ── Mobile ────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  html.sidebar-collapsed { --sidebar-w: 0px; }

  #mwd-sidebar {
    width: 264px !important;
    transform: translateX(-100%);
    transition: transform 280ms cubic-bezier(.22,1,.36,1);
  }
  #mwd-sidebar.is-open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,.3); }

  #mwd-topbar    { transition: none; }
  #main-content  { transition: none; }
  #module-iframe { left: 0; width: 100vw; transition: none; }

  .sidebar-close  { display: block; }
  .sidebar-overlay.is-open { display: block; }
  .sidebar-toggle { display: flex !important; }
  .sidebar-collapse-btn { display: none !important; }

  .stats-grid    { grid-template-columns: 1fr 1fr; }
  .dashboard-grid{ grid-template-columns: 1fr; }
  .form-row      { grid-template-columns: 1fr; }
  .page-content  { padding: 1rem; }
  .overview      { padding: 20px 16px 48px; }
}

@media (max-width: 480px) {
  .login-card { margin: 1rem; padding: 1.5rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ── SVG tile icon ──────────────────────────────────────────────────────────── */
.module-tile-icon-wrap { font-size: 0; } /* suppress emoji baseline gap */
.tile-icon { width: 24px; height: 24px; color: var(--tile-color, var(--wd-blue)); }

/* ── Icon picker ────────────────────────────────────────────────────────────── */
.icon-picker {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px;
  padding: 10px; margin-top: 4px;
  border: 1.5px solid var(--border); border-radius: 10px;
  background: var(--surface);
  max-height: 220px; overflow-y: auto;
}
.icon-picker-btn {
  padding: 9px; border: 1.5px solid transparent; border-radius: 8px;
  background: none; cursor: pointer; color: var(--fg-3);
  display: flex; align-items: center; justify-content: center;
  transition: border-color 120ms, color 120ms, background 120ms;
}
.icon-picker-btn:hover { border-color: var(--wd-blue); color: var(--wd-blue); background: rgba(40,53,131,.05); }
.icon-picker-btn.is-selected { border-color: var(--wd-blue); background: rgba(40,53,131,.09); color: var(--wd-blue); }
.picker-icon { width: 20px; height: 20px; pointer-events: none; }
.icon-picker-hint { font-size: 12px; color: var(--fg-3); margin-top: 5px; min-height: 1em; }

/* ── Print ──────────────────────────────────────────────────────────────────── */
@media print {
  #mwd-sidebar, #sidebar-overlay, #mwd-topbar { display: none !important; }
  #main-content { margin-left: 0 !important; margin-top: 0 !important; }
  #module-iframe { position: static !important; width: 100% !important; height: auto !important; min-height: 100vh; border: none !important; }
  body { overflow: visible !important; }
}
