/* ============================================================
   platform.css — Yexle Internal Apps Portal
   Shared design system for index.html, admin.html, join.html
   and the platform nav shell injected into every app.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;500;600;700;800&family=DM+Mono:wght@400;500&display=swap');

/* ── Tokens ─────────────────────────────────────────────────── */
:root {
  /* Surface */
  --bg:       #F4F5F7;
  --surface:  #FFFFFF;
  --surface2: #F8F9FB;
  --surface3: #EEF0F4;

  /* Borders */
  --border:  rgba(27, 43, 75, 0.09);
  --border2: rgba(27, 43, 75, 0.16);

  /* Brand — matches yexle.com's own blue (#136CA3 is their dominant colour by
     usage count: nav hover, headings, every button). The previous #1E8FD5 was
     already the same hue, just too light to clear WCAG AA text contrast
     (3.53:1); Yexle's actual value clears it outright (5.67:1) with no
     synthetic darkening needed. #1A5484 is their own darker companion shade. */
  --navy:      #0A1628;
  --yblue:     #136CA3;
  --yblue2:    #1A5484;
  --yblue-dim: rgba(19, 108, 163, 0.08);
  --navy-dim:  rgba(10,  22,  40, 0.06);
  --teal:      #007A72;
  --teal2:     #00605A;
  --teal-dim:  rgba(0, 169, 157, 0.08);

  /* Blue chrome bars (hdr-bar, site-footer, app toolbars) */
  --bar-bg:  #136CA3;
  --bar-bg2: #1A5484; /* hover/pressed -- same as --yblue2 in light mode, since --bar-bg == --yblue here */

  /* Text */
  --text:       #1B2B4B;
  --text-muted: #5A6A8A;
  --text-dim:   #586E8B;

  /* Semantic */
  --danger:      #D93025;
  --danger-dim:  rgba(217, 48,  37, 0.08);
  --warn:        #E07B00;
  --warn-dim:    rgba(224, 123,  0, 0.10);
  --success:     #0D7C4C;
  --success-dim: rgba(13, 124,  76, 0.08);

  /* Shape */
  --radius:    10px;
  --radius-sm:  6px;

  /* Elevation */
  --shadow-sm: 0 1px 3px rgba(27, 43, 75, 0.08), 0 1px 2px rgba(27, 43, 75, 0.06);
  --shadow:    0 4px 12px rgba(27, 43, 75, 0.10), 0 1px 3px rgba(27, 43, 75, 0.08);

  /* Typography */
  --font-sans: 'Open Sans', system-ui, sans-serif;
  --font-mono: 'DM Mono', ui-monospace, monospace;

  /* Platform nav */
  --platform-nav-height: 0px;
}

/* ── Dark theme ─────────────────────────────────────────────────
   Injected by nav-shell AFTER each app's own stylesheet, so at equal
   specificity these token re-declarations win and every app inherits the
   flip. Only the shared design tokens are overridden here; component rules
   above reference them, so they re-theme automatically. Brand hues are kept
   but nudged brighter for legibility on dark surfaces. --navy is used by apps
   as a strong text/heading color, so in dark it becomes a light color. */
[data-theme="dark"] {
  /* Surface */
  --bg:       #12151C;
  --surface:  #1A1F29;
  --surface2: #212736;
  --surface3: #2A3242;

  /* Borders (low-alpha light on dark) */
  --border:  rgba(230, 234, 242, 0.10);
  --border2: rgba(230, 234, 242, 0.18);

  /* Brand — nudged brighter for dark legibility */
  --navy:      #E6EAF2;   /* was a dark heading color; now a light one */
  --yblue:     #40A9E8;
  --yblue2:    #63BAF0;
  --yblue-dim: rgba(64, 169, 232, 0.14);
  --navy-dim:  rgba(230, 234, 242, 0.08);
  --teal:      #2CC2B4;
  --teal2:     #45D2C4;
  --teal-dim:  rgba(44, 194, 180, 0.14);

  /* Blue chrome bars — deep desaturated blue so they sit into the dark UI */
  --bar-bg:  #1B4A66;
  --bar-bg2: #26678E; /* hover/pressed, +10% lightness -- same delta as --yblue -> --yblue2 */

  /* Text */
  --text:       #E6EAF2;
  --text-muted: #9AA6BD;
  --text-dim:   #919AAE;

  /* Semantic — brightened for dark */
  --danger:      #F16257;
  --danger-dim:  rgba(241, 98,  87, 0.14);
  --warn:        #F0A03A;
  --warn-dim:    rgba(240, 160, 58, 0.14);
  --success:     #3FBE7E;
  --success-dim: rgba(63, 190, 126, 0.14);

  /* Elevation — deeper shadows read better on dark */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.40), 0 1px 2px rgba(0, 0, 0, 0.30);
  --shadow:    0 4px 14px rgba(0, 0, 0, 0.50), 0 1px 3px rgba(0, 0, 0, 0.35);
}

/* Smooth theme toggle */
html { transition: background-color 0.18s, color 0.18s; }

/* ── Theme toggle button (nav-shell) ─────────────────────────── */
.platform-nav-theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

.platform-nav-theme-btn:hover {
  color: var(--yblue);
  background: var(--yblue-dim);
  border-color: var(--yblue);
}

.platform-nav-theme-btn svg { display: block; }

/* ── Reset ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Header ──────────────────────────────────────────────────── */
.site-header {
  width: 100%;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: var(--shadow);
}

/* Logo bar */
.hdr-logo {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.hdr-logo-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 52px;
}

.hdr-logo-img {
  height: 28px;
  width: auto;
  display: block;
}

.hdr-logo-divider {
  width: 1px;
  height: 24px;
  background: var(--border2);
  flex-shrink: 0;
}

.hdr-logo-tag {
  font-size: 11px;
  color: var(--text-muted);
}

/* App bar */
.hdr-bar {
  background: var(--bar-bg);
  position: fixed;
  top: var(--platform-nav-height, 0px);
  left: 0; right: 0;
  z-index: 90;
  height: 40px;
}

.hdr-bar-inner {
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 40px;
}

.hdr-bar-name {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.hdr-bar-pipe {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.35);
  font-weight: 300;
}

.hdr-bar-sub {
  font-size: 11px;
  /* 90% (not 100%) still reads as de-emphasised next to .hdr-bar-name's solid
     white, while clearing WCAG AA (4.91:1) against --bar-bg; anything much
     lower doesn't -- 85% is only 4.58:1, too tight a margin to keep. */
  color: rgba(255, 255, 255, 0.9);
}

.hdr-bar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.hdr-bar-user {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
  font-weight: 500;
}

.hdr-bar-link {
  font-size: 12px;
  /* 0.9 not lower -- see .hdr-bar-sub above; same --bar-bg contrast constraint. */
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s;
}

.hdr-bar-link:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.hdr-bar-link--highlight {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

/* ── Canonical blue-bar (toolbar) buttons & menus ────────────────────────────
   Standard styling for any button/dropdown placed in the blue .hdr-bar, shared
   by every app (ChangeGuard is the reference). Scoped to .hdr-bar so it never
   touches BPMN's separate light .toolbar (which has its own .tb-btn). A
   class-less <button> in the bar auto-takes the flat look; add .pri for the
   primary action or .icon-circle for a round icon. */
.hdr-bar .tb-lbl { font-size: 11px; font-weight: 700; color: rgba(255,255,255,.9); text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
.hdr-bar .tb-btn,
.hdr-bar button:not([class]) {
  height: 28px; padding: 0 14px; border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: #fff; font-family: inherit; font-size: 12px; font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; transition: all .12s;
}
.hdr-bar .tb-btn:hover,
.hdr-bar button:not([class]):hover { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.4); }
.hdr-bar .tb-btn:disabled,
.hdr-bar button:not([class]):disabled { opacity: .35; cursor: not-allowed; }
.hdr-bar .tb-btn.flat { border-color: transparent; background: transparent; }
.hdr-bar .tb-btn.flat:hover { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.4); }
.hdr-bar .tb-btn.pri { background: #178740; border-color: #178740; color: #fff; font-weight: 700; box-shadow: 0 2px 6px rgba(10,22,40,.25); } /* darkened from #1B9E4B: 3.48:1 -> 4.59:1 */
.hdr-bar .tb-btn.pri:hover { background: #147236; border-color: #147236; }
.hdr-bar .tb-btn.pri:disabled { opacity: .4; box-shadow: none; }
.hdr-bar .tb-btn.icon-circle { width: 28px; height: 28px; padding: 0; border-radius: 50%; justify-content: center; border: 1px solid transparent; background: transparent; }
.hdr-bar .tb-btn.icon-circle:hover { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.4); }
.hdr-bar .tb-divider { width: 1px; height: 22px; background: rgba(255,255,255,.25); margin: 0 4px; flex-shrink: 0; }
.hdr-bar .tb-spacer { flex: 1; }
.hdr-bar .tb-dropdown { position: relative; display: inline-flex; }
.hdr-bar .tb-dropdown-menu { position: absolute; top: calc(100% + 6px); left: 0; background: var(--surface); border: 1px solid var(--border2); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 180px; z-index: 500; display: none; padding: 4px 0; max-height: 60vh; overflow: auto; }
.hdr-bar .tb-dropdown-menu.open { display: block; }
.hdr-bar .tb-dropdown-item { display: flex; align-items: center; gap: 6px; padding: 8px 14px; font-size: 12px; color: var(--text); cursor: pointer; transition: background .1s; white-space: nowrap; }
.hdr-bar .tb-dropdown-item:hover { background: var(--navy-dim); }
.hdr-bar .tb-dropdown-item.active { color: var(--yblue); font-weight: 700; }
.hdr-bar .tb-dropdown-item.disabled { opacity: .4; cursor: not-allowed; }
.hdr-bar .tb-dropdown-item.danger { color: var(--danger); }
.hdr-bar .tb-dropdown-item.danger:hover { background: var(--danger-dim); }
.hdr-bar .tb-dropdown-sep { height: 1px; background: var(--border); margin: 4px 0; }

/* ── Page shell ──────────────────────────────────────────────── */
.page {
  flex: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 36px 32px 80px;
  width: 100%;
}

/* ── Page header ─────────────────────────────────────────────── */
.page-header {
  margin-bottom: 28px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.2;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.5;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 7px 16px;
  background: var(--surface);
  color: var(--navy);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.btn:hover { border-color: var(--navy); background: var(--navy-dim); }

.btn--primary {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0, 169, 157, 0.25);
}

.btn--primary:hover { background: var(--teal2); border-color: var(--teal2); }
.btn--primary:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }

/* Dark mode's --teal (#2CC2B4) is a lightened accent for use as *text* on
   dark surfaces (6.62:1) -- as a solid fill under white button text it was
   only 2.21:1. A button needs its own darker dark-mode fill; overridden here
   rather than changing --teal itself, which stays correct for every other
   (text) use. */
[data-theme="dark"] .btn--primary {
  background: #1E8379;
  border-color: #1E8379;
}
[data-theme="dark"] .btn--primary:hover {
  background: #196E65;
  border-color: #196E65;
}

.btn--secondary {
  background: transparent;
  border-color: var(--yblue);
  color: var(--yblue);
}

.btn--secondary:hover { background: var(--yblue); color: #fff; }

.btn--danger {
  border-color: rgba(217, 48, 37, 0.3);
  color: var(--danger);
}

.btn--danger:hover { background: var(--danger-dim); border-color: var(--danger); }

.btn--sm { padding: 4px 10px; font-size: 12px; }

.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 20px;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface2);
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Section labels ──────────────────────────────────────────── */
.section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 14px;
}

/* ── App grid cards ──────────────────────────────────────────── */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.app-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-decoration: none;
  color: inherit;
  display: block;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s, transform 0.15s, border-color 0.15s;
  position: relative;
  overflow: hidden;
}

.app-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
  border-color: var(--border2);
}

.app-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--card-accent, var(--yblue));
  opacity: 0;
  transition: opacity 0.15s;
}

.app-card:hover::before { opacity: 1; }

.app-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 16px;
}

.app-card-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 5px;
}

.app-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

.app-card-arrow {
  position: absolute;
  bottom: 16px;
  right: 18px;
  color: var(--text-dim);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.15s, transform 0.15s;
}

.app-card:hover .app-card-arrow { opacity: 1; transform: translateX(0); }

/* ── Empty / loading states ──────────────────────────────────── */
.state {
  text-align: center;
  padding: 80px 20px;
}

.state-icon {
  margin-bottom: 14px;
  opacity: 0.45;
  color: var(--text-dim);
}

.state-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 6px;
}

.state-sub {
  font-size: 13px;
  line-height: 1.7;
  max-width: 420px;
  margin: 0 auto;
  color: var(--text-muted);
}

@keyframes spin { to { transform: rotate(360deg); } }

.spinner {
  display: inline-block;
  width: 32px;
  height: 32px;
  border: 3px solid var(--border2);
  border-top-color: var(--yblue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-bottom: 16px;
}

/* ── Space dropdown ──────────────────────────────────────────── */
.space-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 220px;
  z-index: 500;
  overflow: hidden;
  display: none;
}

.space-dropdown.open { display: block; }

.space-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.1s;
}

.space-dropdown-item:hover { background: var(--surface2); }

.space-dropdown-item.active {
  background: var(--yblue-dim);
  color: var(--yblue);
  font-weight: 600;
}

.space-dropdown-item .check { margin-left: auto; color: var(--yblue); }

/* ── Badge / chip ────────────────────────────────────────────── */
.badge {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: inline-block;
}

.badge--admin     { background: var(--yblue-dim);   color: var(--yblue);    border: 1px solid rgba(30, 143, 213, .2); }
.badge--editor    { background: var(--teal-dim);     color: var(--teal);     border: 1px solid rgba(0, 169, 157, .2);  }
.badge--commentor { background: var(--warn-dim);     color: var(--warn);     border: 1px solid rgba(224, 123, 0, .2); }
.badge--viewer    { background: var(--navy-dim);     color: var(--text-muted); border: 1px solid var(--border2);       }
.badge--pending   { background: var(--warn-dim);     color: var(--warn);     border: 1px solid rgba(224, 123, 0, .2); }

/* ── App-access chips (member tables, space-manager.js) ───────── */
.app-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.app-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border: 1px solid var(--border2);
  border-radius: 20px;
  white-space: nowrap;
  line-height: 1.4;
}

.app-chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.app-chips-none {
  font-size: 12px;
  color: var(--text-dim);
  font-style: italic;
}

/* ── Modal ───────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 22, 40, 0.4);
  z-index: 900;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(10, 22, 40, 0.25);
  width: 100%;
  max-width: 440px;
  overflow: hidden;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--navy);
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 18px;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: color 0.15s;
  line-height: 1;
}

.modal-close:hover { color: var(--navy); }

.modal-body { padding: 24px; }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--surface2);
}

/* ── Form fields ─────────────────────────────────────────────── */
.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }

.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.field-input {
  width: 100%;
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field-input:focus {
  border-color: var(--yblue);
  box-shadow: 0 0 0 3px var(--yblue-dim);
}

.field-input--select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239AAABF' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
  cursor: pointer;
}

/* App access checkbox grid */
.app-check-grid { display: flex; flex-wrap: wrap; gap: 8px; }

.app-check-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.app-check-item:has(input:checked) {
  border-color: var(--teal);
  background: var(--teal-dim);
  color: var(--teal);
}

.app-check-item input {
  width: 13px;
  height: 13px;
  accent-color: var(--teal);
  cursor: pointer;
}

/* ── Toggle switch ───────────────────────────────────────────── */
.toggle {
  position: relative;
  width: 32px;
  height: 18px;
  cursor: pointer;
  display: inline-block;
}

.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--surface3);
  border: 1px solid var(--border2);
  border-radius: 9px;
  transition: background 0.2s;
}

.toggle input:checked + .toggle-track {
  background: var(--teal);
  border-color: var(--teal);
}

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
  pointer-events: none;
}

.toggle input:checked ~ .toggle-thumb { transform: translateX(14px); }

/* ── Toast ───────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 52px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--navy);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 999;
  white-space: nowrap;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Member table ────────────────────────────────────────────── */
.member-table { width: 100%; border-collapse: collapse; }

.member-table th {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}

.member-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}

.member-table tr:last-child td { border-bottom: none; }
.member-table tr:hover td { background: var(--surface2); }

.member-name  { font-weight: 600; color: var(--navy); display: block; }
.member-email { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); margin-top: 1px; display: block; }

/* ── Footer ──────────────────────────────────────────────────── */
.site-footer {
  background: var(--bar-bg);
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 100;
  box-shadow: 0 -2px 8px rgba(10, 22, 40, 0.15);
}

.site-footer-inner {
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 36px;
}

/* 90% -- see .hdr-bar-sub comment above; same --bar-bg contrast constraint. */
.site-footer-left  { font-size: 12px; color: rgba(255, 255, 255, 0.9); }
.site-footer-right { font-size: 12px; color: rgba(255, 255, 255, 0.9); }

/* ── Platform nav shell (injected into apps) ─────────────────── */
.platform-nav-bar {
  height: 48px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

.platform-nav-inner {
  padding: 0 12px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.platform-nav-left,
.platform-nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.platform-nav-yexle-logo {
  height: 22px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.platform-nav-app-brand {
  display: flex;
  align-items: center;
  gap: 7px;
}

.platform-nav-app-icon {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: block;
  flex-shrink: 0;
}

.platform-nav-app-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--navy, #1b2b4b);
  white-space: nowrap;
}

.platform-nav-portal-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  /* var(--bar-bg), not var(--yblue): see the .pa-topbar / .site-footer fix
     notes elsewhere -- --yblue in dark mode is the lighter text-oriented
     accent, not meant for a solid fill under white text (was 2.6:1). */
  background: var(--bar-bg);
  border-radius: 6px;
  padding: 5px 12px;
  text-decoration: none;
  transition: background 0.15s;
  white-space: nowrap;
}

.platform-nav-portal-btn:hover { background: var(--bar-bg2); }

.platform-nav-portal-link {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 500;
  color: var(--yblue);
  text-decoration: none;
  transition: color 0.15s;
}

.platform-nav-portal-link:hover { color: var(--yblue2); }

.platform-nav-divider {
  width: 1px;
  height: 18px;
  background: var(--border2);
}

.platform-nav-space-select {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  border: none;
  background: transparent;
  cursor: pointer;
  outline: none;
  padding: 0 2px;
}

/* ── Nav bar space switcher — same look as .space-tag/.space-dropdown on the
   portal page, sized up to read well in the 48px top bar ── */
.platform-nav-space-wrap { position: relative; display: inline-flex; }

.platform-nav-space-tag {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  background: var(--yblue-dim);
  color: var(--yblue);
  border: 1px solid rgba(30, 143, 213, 0.2);
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.15s;
  user-select: none;
}

.platform-nav-space-tag:hover { background: rgba(30, 143, 213, 0.14); }

.platform-nav-link {
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: color 0.15s;
}

.platform-nav-link:hover { color: var(--text); }
.platform-nav-link--admin { color: var(--yblue); }
.platform-nav-link--admin:hover { color: var(--yblue2); }

.platform-nav-user {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}
.platform-nav-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

/* ── Icon picker (shared by spaces pages) ────────────────────── */
.icon-pick-search {
  width: 100%; border: 1px solid var(--border2); border-radius: 6px;
  padding: 6px 10px; font-size: 12px; font-family: var(--font-sans);
  color: var(--text); outline: none; margin-bottom: 8px; display: block;
}
.icon-pick-search:focus { border-color: var(--yblue); box-shadow: 0 0 0 3px var(--yblue-dim); }
.icon-pick-scroll { max-height: 186px; overflow-y: auto; border: 1px solid var(--border); border-radius: 6px; padding: 8px; }
.icon-pick-grid { display: grid; grid-template-columns: repeat(auto-fill, 34px); gap: 4px; }
.icon-pick-btn {
  width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 16px; transition: border-color 0.15s, background 0.15s; padding: 0;
}
.icon-pick-btn:hover    { border-color: var(--yblue); background: var(--yblue-dim); }
.icon-pick-btn.selected { border-color: var(--yblue); background: var(--yblue-dim); }
.icon-pick-none { font-size: 12px; color: var(--text-dim); padding: 12px 0; text-align: center; }

/* ── Invite dropdown ─────────────────────────────────────────── */
.invite-dd-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; cursor: pointer; transition: background 0.1s;
}
.invite-dd-item:hover, .invite-dd-item.focused { background: var(--surface2); }
.pa-avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; font-weight: 700; flex-shrink: 0; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 640px) {
  .page { padding: 24px 16px 80px; }
  .hdr-logo-inner,
  .hdr-bar-inner,
  .site-footer-inner,
  .platform-nav-inner { padding: 0 16px; }
  .hdr-bar-sub { display: none; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .app-grid { grid-template-columns: 1fr; }
}
