/* ============================================================
   TOKENS
   ============================================================ */
:root {
  /* Brand green scale — derived from the AAC logo (dominant #004010) */
  --brand-900:   #0B3D24;
  --brand-800:   #10502F;
  --brand-700:   #14603C;
  --brand-600:   #1C7049;
  --brand-500:   #23844F;
  --brand-100:   #E4F2EA;
  --brand-50:    #F1F8F4;

  /* Brand semantic aliases */
  --brand-primary:  var(--brand-600);
  --brand-dark:     var(--brand-900);
  --brand-subtle:   var(--brand-100);

  /* Neutrals — warm, faintly green-tinted */
  --background:      #F5F7F6;
  --surface:         #FFFFFF;
  --surface-subtle:  #F0F4F2;
  --surface-muted:   #F0F4F2;
  --text-primary:    #17201C;
  --text-secondary:  #65716B;
  --text-tertiary:   #8B9690;

  --bg:          var(--background);
  --content:     var(--surface);
  --sidebar:     var(--surface);
  --panel:       var(--surface);
  --panel-2:     var(--surface-subtle);
  --hover:       #EDF2EF;
  --border:      #DFE6E2;
  --border-strong: #CED9D3;
  --border-soft: #EAF0EC;
  --text:        var(--text-primary);
  --text-soft:   var(--text-secondary);
  --text-dim:    var(--text-tertiary);
  --accent:      var(--brand-600);
  --accent-hover:var(--brand-500);
  --accent-press:var(--brand-700);
  --accent-soft: var(--brand-100);
  --accent-border: #CFE6D8;
  --accent-ink:  #ffffff;
  --live:        var(--brand-600);
  --danger:      #D0493F;
  --radius:      14px;
  --shadow-sm:   0 1px 2px rgba(11,61,36,.05);
  --shadow-md:   0 4px 14px rgba(11,61,36,.07);
  --shadow-lg:   0 12px 30px rgba(11,61,36,.08);
  --sidebar-w:   244px;
  --sidebar-collapsed: 70px;
  --mobile-bar:  52px;
  --content-max: 1440px;
}

/* ============================================================
   RESET / BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
svg { stroke: currentColor; fill: none; stroke-width: 1.7; }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes slideInLeft {
  from { transform: translateX(-100%); }
  to   { transform: translateX(0); }
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.anim-fade-up  { animation: fadeUp  .38s cubic-bezier(.22,.68,0,1.2) both; }
.anim-fade-in  { animation: fadeIn  .22s ease both; }
.anim-scale-in { animation: scaleIn .28s cubic-bezier(.22,.68,0,1.2) both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ============================================================
   LAYOUT — fixed sidebar + scrollable main
   ============================================================ */
.frame {
  display: flex;
  height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.side {
  width: var(--sidebar-w);
  flex: none;
  height: 100vh;
  position: sticky;
  top: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 14px 12px;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 50;
  transition: transform .28s cubic-bezier(.22,.68,0,1.2);
}

.side-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.side-close { display: none; background: none; border: none; color: var(--text-dim); cursor: pointer; padding: 6px; border-radius: 8px; }
.side-close:hover { background: var(--hover); color: var(--text); }

.ws { display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 6px; border-radius: 10px; cursor: pointer; transition: background .14s; flex: 1; min-width: 0; }
.ws:hover { background: var(--hover); }
.ws-logo { width: 34px; height: 34px; border-radius: 9px; flex: none; overflow: hidden; background: #E8EAEF; }
.ws-logo img { width: 100%; height: 100%; object-fit: cover; }
.ws .meta { line-height: 1.15; min-width: 0; overflow: hidden; }
.ws .meta b { font-size: 14px; font-weight: 700; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws .meta .ws-sub { font-size: 11px; font-weight: 700; color: var(--text-soft); display: block; }

.search {
  display: flex; align-items: center; gap: 9px;
  margin: 10px 4px 6px; padding: 9px 11px 9px 16px;
  background: #F2F4F7; border: 1px solid var(--border); border-radius: 10px;
  color: var(--text-dim); transition: border-color .15s;
}
.search:focus-within { border-color: rgba(79,178,134,.4); }
.search .mag { width: 14px; height: 14px; border: 1.6px solid currentColor; border-radius: 50%; position: relative; flex: none; }
.search .mag::after { content: ""; position: absolute; width: 6px; height: 1.6px; background: currentColor; right: -4px; bottom: 0; transform: rotate(45deg); }
.search input { flex: 1; min-width: 0; background: none; border: none; outline: none; color: var(--text); font-family: inherit; font-size: 13px; }
.search input::placeholder { color: var(--text-dim); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 10.5px; color: var(--text-dim); font-weight: 700; letter-spacing: .6px; text-transform: uppercase; margin: 14px 8px 4px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px 9px 15px; border-radius: 9px;
  font-size: 13.5px; font-weight: 500; color: var(--text-soft); cursor: pointer;
  transition: background .14s, color .14s, transform .1s;
  user-select: none;
}
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item:active { transform: scale(.98); }
.nav-item.active { background: var(--hover); color: var(--text); font-weight: 600; }
.nav-item.active .ic { color: var(--accent); opacity: 1; }
.nav-item .ic { width: 16px; height: 16px; flex: none; opacity: .75; display: grid; place-items: center; transition: color .14s; }
.nav-item .ic svg { width: 16px; height: 16px; }

.side-foot { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 8px 2px; border-top: 1px solid var(--border); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: #b8455a;
  display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff;
  flex: none; overflow: hidden; transition: transform .15s, box-shadow .15s;
  cursor: pointer;
}
.avatar:hover { transform: scale(1.08); box-shadow: 0 0 0 3px var(--accent-soft); }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.avatar-sm { width: 30px; height: 30px; font-size: 11px; }
.avatar-md { width: 52px; height: 52px; font-size: 16px; }
.avatar-lg { width: 80px; height: 80px; font-size: 24px; }
.side-foot .who { line-height: 1.2; min-width: 0; flex: 1; overflow: hidden; }
.side-foot .who b { font-size: 13px; font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot .who small { font-size: 11px; color: var(--text-dim); display: block; }
.logout { background: none; border: none; color: var(--text-dim); cursor: pointer; padding: 6px; border-radius: 8px; display: grid; place-items: center; transition: background .14s, color .14s, transform .1s; }
.logout svg { width: 16px; height: 16px; }
.logout:hover { background: var(--hover); color: var(--text); }
.logout:active { transform: scale(.9); }

/* ============================================================
   MOBILE TOP BAR
   ============================================================ */
.mobile-bar {
  display: none;
  position: fixed; top: 0; left: 0; right: 0; height: var(--mobile-bar);
  background: var(--sidebar); border-bottom: 1px solid var(--border);
  align-items: center; gap: 12px; padding: 0 16px; z-index: 40;
}
.hamburger { background: none; border: none; color: var(--text-soft); cursor: pointer; padding: 6px; border-radius: 8px; display: grid; place-items: center; transition: background .14s, color .14s; }
.hamburger:hover { background: var(--hover); color: var(--text); }
.mobile-title { font-size: 15px; font-weight: 700; flex: 1; letter-spacing: -.2px; }

/* Backdrop */
.side-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(21,26,35,.35);
  z-index: 45; opacity: 0; transition: opacity .25s;
}
.side-backdrop.visible { opacity: 1; }

/* ============================================================
   MAIN — scrollable content only
   ============================================================ */
.main {
  flex: 1;
  min-width: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 28px 32px 48px;
  scroll-behavior: smooth;
}

/* ============================================================
   PANELS + TRANSITIONS
   ============================================================ */
.panel { display: flex; flex-direction: column; min-width: 0; }
.panel[hidden] { display: none !important; }
.panel.active { animation: fadeUp .32s cubic-bezier(.22,.68,0,1.2) both; }

/* ============================================================
   MAIN HEAD
   ============================================================ */
.main-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 24px; }
.main-head h1 { font-size: 24px; font-weight: 700; margin: 0; letter-spacing: -.4px; }
.main-head p { margin: 4px 0 0; font-size: 13px; color: var(--text-soft); }
.head-right { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.view-toggle { display: flex; background: var(--panel); border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.view-toggle button { width: 34px; height: 34px; display: grid; place-items: center; background: none; border: none; cursor: pointer; color: var(--text-dim); transition: background .14s, color .14s; }
.view-toggle button.active { background: var(--hover); color: var(--text); }
.view-toggle svg { width: 15px; height: 15px; }

/* ============================================================
   CATEGORY TABS
   ============================================================ */
.cat-tabs { display: flex; align-items: center; gap: 4px; margin-bottom: 22px; flex-wrap: wrap; }
.cat-tab {
  font-family: inherit; font-size: 13px; font-weight: 600; color: var(--text-soft);
  background: none; border: 1px solid transparent; border-radius: 9px; cursor: pointer;
  padding: 7px 14px; transition: background .14s, color .14s, border-color .14s, transform .1s;
}
.cat-tab .n { font-size: 11px; color: var(--text-dim); margin-left: 6px; font-weight: 500; }
.cat-tab:hover { color: var(--text); background: var(--hover); }
.cat-tab:active { transform: scale(.97); }
.cat-tab.active { color: var(--text); background: var(--panel); border-color: var(--border); }
.cat-tab.active .n { color: var(--text-soft); }

/* ============================================================
   APP GRID
   ============================================================ */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid.list { grid-template-columns: 1fr; gap: 10px; }

.card {
  display: flex; flex-direction: column; border-radius: var(--radius);
  text-decoration: none; color: inherit;
  background: var(--panel); border: 1px solid var(--border);
  transition: border-color .2s, transform .2s, box-shadow .2s;
  animation: cardIn .35s cubic-bezier(.22,.68,0,1.2) both;
  animation-delay: calc(var(--i, 0) * 55ms);
}
a.card { cursor: pointer; }
a.card:not(.compact):hover {
  border-color: rgba(255,255,255,.2);
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0,0,0,.35);
}
a.card:not(.compact):active { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.25); }
.card.locked { opacity: .88; cursor: default; }
.card .thumb-wrap {
  border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;
  overflow: hidden; background: #E5E7EC;
}

.thumb { aspect-ratio: 16/10; background: #E5E7EC; position: relative; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; transition: transform .3s; }
a.card:hover .thumb img { transform: scale(1.02); }
.thumb.lock { display: grid; place-items: center; background: repeating-linear-gradient(135deg, #EDEEF2 0 12px, #E5E7EC 12px 24px); }
.thumb .locktag { display: grid; place-content: center; justify-items: center; gap: 8px; }
.thumb .locktag .lk { width: 22px; height: 18px; border: 2px solid var(--text-dim); border-radius: 4px; position: relative; }
.thumb .locktag .lk::before { content: ""; position: absolute; width: 12px; height: 9px; border: 2px solid var(--text-dim); border-bottom: none; border-radius: 7px 7px 0 0; top: -8px; left: 3px; }
.thumb .locktag span { font-size: 11px; color: var(--text-dim); font-family: ui-monospace, 'SF Mono', 'Menlo', monospace; }

/* card meta row */
.meta { display: flex; align-items: flex-start; gap: 11px; padding: 14px 14px 16px; border-top: 1px solid var(--border-soft); }
.app-ic { width: 44px; height: 44px; border-radius: 10px; flex: none; display: grid; place-items: center; font-weight: 700; font-size: 15px; color: #15211b; background: linear-gradient(145deg, #56bd8f, #3c9b73); }
.app-ic-img { background: #fff; padding: 0; overflow: hidden; }
.app-ic-img img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 8px; }
.app-ic.muted { background: #33333a; color: var(--text-soft); }
.meta .txt { min-width: 0; flex: 1; }
.meta .name-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.meta .name { font-size: 15px; font-weight: 700; letter-spacing: -.2px; }
.meta .desc { font-size: 12.5px; color: var(--text-soft); margin-top: 3px; line-height: 1.45; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 600; padding: 3px 8px; border-radius: 20px; white-space: nowrap; }
.badge.live { color: var(--live); background: rgba(70,194,119,.12); }
.badge.live .d { width: 5px; height: 5px; border-radius: 50%; background: var(--live); animation: fadeIn 1s ease infinite alternate; }
.badge.soon { color: var(--accent); background: var(--accent-soft); }
.badge.plan { color: var(--text-dim); background: var(--hover); }

/* list view */
.grid.list .card { flex-direction: row; align-items: center; gap: 14px; background: var(--content); padding: 12px 16px; }
.grid.list a.card:hover { border-color: rgba(255,255,255,.2); transform: none; box-shadow: none; }
.grid.list .thumb-wrap { width: 120px; flex: none; border-radius: calc(var(--radius) - 2px); }
.grid.list .meta { padding: 0; flex: 1; border-top: none; }

.empty { color: var(--text-dim); font-size: 14px; margin-top: 8px; animation: fadeIn .22s ease both; }

/* ============================================================
   RECENTS STRIP
   ============================================================ */
.recents-strip { margin-bottom: 28px; animation: fadeUp .3s ease both; }
.section-label { font-size: 11px; font-weight: 700; color: var(--text-dim); letter-spacing: .6px; text-transform: uppercase; margin-bottom: 12px; }
.recents-row { display: flex; gap: 10px; flex-wrap: wrap; }
.card.compact {
  flex-direction: row; align-items: center; gap: 10px;
  background: var(--content); border-radius: 10px; padding: 10px 14px;
}
a.card.compact:hover { border-color: rgba(255,255,255,.2); transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.card.compact .meta { padding: 0; border-top: none; }
.card.compact .app-ic { width: 34px; height: 34px; font-size: 12px; border-radius: 8px; }
.card.compact .name { font-size: 13px; }
.card.compact .badge { display: none; }
.card.compact .txt { display: flex; align-items: center; }

/* ============================================================
   SETTINGS
   ============================================================ */
.settings-head { margin-bottom: 22px; }
.settings-head h1 { font-size: 24px; font-weight: 700; margin: 0 0 4px; letter-spacing: -.4px; }

.settings-tabs { display: flex; gap: 4px; margin-bottom: 26px; border-bottom: 1px solid var(--border); }
.stab {
  background: none; border: none; border-bottom: 2px solid transparent;
  font-family: inherit; font-size: 13.5px; font-weight: 600; color: var(--text-soft);
  cursor: pointer; padding: 8px 16px 10px; margin-bottom: -1px;
  transition: color .14s, border-color .14s;
}
.stab:hover { color: var(--text); }
.stab.active { color: var(--text); border-bottom-color: var(--accent); }

.stab-panel { display: none; }
.stab-panel.active { display: block; animation: fadeUp .25s ease both; }

/* profile */
.profile-avatar-wrap { display: flex; align-items: center; gap: 18px; margin-bottom: 28px; }
.av-actions { display: flex; flex-direction: column; gap: 8px; }
.av-upload-btn { background: var(--panel); border: 1px solid var(--border); color: var(--text-soft); font-family: inherit; font-size: 13px; font-weight: 600; border-radius: 8px; padding: 7px 14px; cursor: pointer; width: fit-content; transition: background .14s, color .14s; }
.av-upload-btn:hover { color: var(--text); background: var(--panel-2); }
.av-remove-btn { background: none; border: none; color: var(--text-dim); font-family: inherit; font-size: 13px; cursor: pointer; padding: 2px 0; width: fit-content; transition: color .14s; }
.av-remove-btn:hover { color: var(--danger); }
.autosave-status { font-size: 12px; font-weight: 600; color: var(--live); opacity: 0; transition: opacity .3s; pointer-events: none; }
.autosave-status.visible { opacity: 1; }

.profile-form { max-width: 440px; display: flex; flex-direction: column; gap: 14px; }
.field-row { display: flex; flex-direction: column; gap: 6px; }
.field-row-inline { flex-direction: row; align-items: center; gap: 12px; }
.field-row label { font-size: 12px; font-weight: 600; color: var(--text-soft); letter-spacing: .2px; }
.field-row input, .field-row select {
  padding: 10px 13px; background: #ffffff; border: 1px solid var(--border);
  border-radius: 9px; color: var(--text); font-family: inherit; font-size: 14px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field-row input:focus, .field-row select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field-row input::placeholder { color: var(--text-dim); }
.field-row select { cursor: pointer; appearance: auto; }
.field-note { font-size: 11.5px; color: var(--text-dim); margin-top: 2px; }
.form-divider { display: flex; align-items: center; gap: 12px; margin: 4px 0; }
.form-divider::before, .form-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.form-divider span { font-size: 11.5px; color: var(--text-dim); font-weight: 600; white-space: nowrap; }
.form-err { font-size: 12.5px; color: var(--danger); min-height: 0; empty-cells: hide; }
.form-ok { font-size: 12.5px; color: var(--live); min-height: 0; }
.form-err:empty, .form-ok:empty { display: none; }
.btn-save {
  padding: 11px 22px; background: var(--accent); color: #15211b;
  font-family: inherit; font-size: 14px; font-weight: 700; border: none; border-radius: 9px;
  cursor: pointer; width: fit-content; transition: filter .14s, transform .1s;
}
.btn-save:hover { filter: brightness(1.07); }
.btn-save:active { transform: scale(.97); }
.btn-save:disabled { opacity: .6; cursor: default; filter: none; transform: none; }
.btn-save.btn-danger { background: var(--danger); color: #fff; }
.form-desc { font-size: 13px; color: var(--text-dim); line-height: 1.55; margin: 2px 0 10px; }

/* email individual picker */
.em-picker { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-top: -6px; }
.em-picker-search { width: 100%; background: #F2F4F7; border: none; border-bottom: 1px solid var(--border); padding: 10px 14px; color: var(--text); font-family: inherit; font-size: 13.5px; outline: none; }
.em-picker-search::placeholder { color: var(--text-dim); }
.em-picker-list { max-height: 220px; overflow-y: auto; }
.em-picker-row { display: flex; align-items: center; gap: 11px; padding: 9px 14px; cursor: pointer; transition: background .1s; }
.em-picker-row:hover { background: var(--hover); }
.em-picker-row input[type=checkbox] { flex: none; accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }
.em-picker-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.em-picker-name { font-size: 13.5px; color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.em-picker-email { font-size: 11.5px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.em-picker-empty { padding: 14px; font-size: 13px; color: var(--text-dim); text-align: center; }

/* users tab */
.users-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; gap: 10px; }
.users-count { font-size: 13px; color: var(--text-soft); }
.btn-add { padding: 9px 18px; background: var(--accent); color: #15211b; font-family: inherit; font-size: 13.5px; font-weight: 700; border: none; border-radius: 9px; cursor: pointer; transition: filter .14s, transform .1s; }
.btn-add:hover { filter: brightness(1.07); }
.btn-add:active { transform: scale(.97); }

.users-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
.users-table { min-width: 640px; }
.users-row { display: grid; grid-template-columns: 40px 1fr 1.2fr .65fr 1fr .65fr 68px; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--border-soft); min-height: 52px; transition: background .12s; }
.users-row:last-child { border-bottom: none; }
.users-row:not(.users-header):hover { background: var(--hover); }
.users-header { background: var(--panel); min-height: 38px; }
.users-header .uc { font-size: 10.5px; font-weight: 700; color: var(--text-dim); letter-spacing: .5px; text-transform: uppercase; }
.uc { font-size: 13px; color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.uc-name { font-weight: 600; }
.uc-un { color: var(--text-soft); font-family: ui-monospace, 'SF Mono', 'Cascadia Code', 'Menlo', monospace; font-size: 11.5px; }
.uc-actions { justify-content: flex-end; gap: 4px; flex-wrap: nowrap; }

.role-pill { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 20px; white-space: nowrap; }
.role-developer { background: rgba(79,178,134,.15); color: var(--accent); }
.role-admin { background: rgba(100,140,255,.15); color: #7a9fff; }
.role-user { background: var(--hover); color: var(--text-soft); }
.role-pm { background: rgba(180,130,255,.15); color: #b482ff; }

.ent-pill { font-size: 10.5px; background: var(--panel); border: 1px solid var(--border); color: var(--text-soft); padding: 2px 7px; border-radius: 6px; white-space: nowrap; }
.ent-all { background: rgba(79,178,134,.1); border-color: rgba(79,178,134,.25); color: var(--accent); }
.ent-none { font-size: 11px; color: var(--text-dim); }

.status-pill { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 20px; }
.st-active { background: rgba(70,194,119,.1); color: var(--live); }
.st-off { background: var(--hover); color: var(--text-dim); }

.icon-btn { background: none; border: 1px solid transparent; color: var(--text-dim); cursor: pointer; padding: 6px; border-radius: 7px; display: grid; place-items: center; transition: background .12s, color .12s, border-color .12s, transform .1s; }
.icon-btn:hover { background: var(--hover); color: var(--text); border-color: var(--border); }
.icon-btn:active { transform: scale(.9); }
.icon-danger:hover { background: rgba(224,112,112,.1); color: var(--danger); border-color: rgba(224,112,112,.2); }
.icon-impersonate:hover { background: rgba(130,160,255,.12); color: #8aa0ff; border-color: rgba(130,160,255,.25); }
.icon-btn svg { stroke: currentColor; fill: none; stroke-width: 1.7; }

/* login activity table */
.act-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
.act-table { min-width: 780px; }
.act-row {
  display: grid; grid-template-columns: 1.7fr 1.3fr .8fr 1fr 1fr .8fr 1fr;
  align-items: center; gap: 10px; padding: 0 16px;
  border-bottom: 1px solid var(--border-soft); min-height: 54px; transition: background .12s;
}
.act-row:last-child { border-bottom: none; }
.act-row:not(.act-header):hover { background: var(--hover); }
.act-header { background: var(--panel); min-height: 38px; }
.act-header .ac { font-size: 10.5px; font-weight: 700; color: var(--text-dim); letter-spacing: .5px; text-transform: uppercase; }
.ac { font-size: 13px; color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ac-user { display: flex; align-items: center; gap: 10px; }
.ac-user .uinfo { min-width: 0; line-height: 1.25; }
.ac-user .uinfo b { font-size: 13px; font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-user .uinfo small { font-size: 11px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.ac-when b { font-size: 12.5px; font-weight: 500; display: block; white-space: nowrap; }
.ac-when small { font-size: 11px; color: var(--text-dim); }
.ac-ip { font-family: ui-monospace, 'SF Mono', 'Cascadia Code', 'Menlo', monospace; font-size: 12px; color: var(--text-soft); }
.method-pill { font-size: 10.5px; font-weight: 700; padding: 3px 9px; border-radius: 20px; white-space: nowrap; }
.method-password { background: var(--hover); color: var(--text-soft); }
.method-2fa { background: rgba(79,178,134,.15); color: var(--accent); }

/* ent checkboxes */
.ent-checks { display: flex; gap: 12px; flex-wrap: wrap; padding: 6px 0 4px; }
.ent-check { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-soft); cursor: pointer; transition: color .14s; }
.ent-check:hover { color: var(--text); }
.ent-check input { accent-color: var(--accent); width: 14px; height: 14px; cursor: pointer; }

/* modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(21,26,35,.45);
  display: grid; place-items: center; z-index: 100;
  animation: fadeIn .18s ease both;
}
.modal-overlay[hidden] { display: none !important; }
.modal {
  background: var(--panel); border: 1px solid var(--border); border-radius: 18px;
  width: 480px; max-width: calc(100vw - 32px); max-height: 90dvh; overflow-y: auto;
  display: flex; flex-direction: column;
  animation: scaleIn .24s cubic-bezier(.22,.68,0,1.2) both;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 0; position: sticky; top: 0; background: var(--panel); z-index: 1; }
.modal-head span { font-size: 17px; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text-dim); font-size: 18px; cursor: pointer; padding: 4px 8px; border-radius: 7px; transition: background .14s, color .14s; }
.modal-close:hover { background: var(--hover); color: var(--text); }
.modal-body { padding: 20px 24px 24px; display: flex; flex-direction: column; gap: 14px; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; padding-top: 8px; }
.btn-cancel { background: none; border: 1px solid var(--border); color: var(--text-soft); font-family: inherit; font-size: 13.5px; font-weight: 600; padding: 9px 18px; border-radius: 9px; cursor: pointer; transition: background .14s, color .14s; }
.btn-cancel:hover { background: var(--hover); color: var(--text); }
.modal-av-wrap { display: flex; align-items: center; gap: 14px; }

/* ============================================================
   DESKTOP — collapsed icon rail, expand on hover (overlay)
   ============================================================ */
@media (min-width: 1025px) {
  .frame { padding-left: var(--sidebar-collapsed); }
  .side {
    position: fixed; left: 0; top: 0;
    width: var(--sidebar-collapsed);
    transition: width .2s ease;
    transform: translateZ(0);
  }
  .side:hover { width: var(--sidebar-w); box-shadow: 4px 0 18px rgba(0,0,0,.35); }

  /* Labels collapse away in the rail; fade back in on hover */
  .side .ws .meta,
  .side .nav-text,
  .side .nav-label,
  .side .side-foot .who,
  .side .side-foot .logout,
  .side .search input { opacity: 0; transition: opacity .15s ease; }

  .side:hover .ws .meta,
  .side:hover .nav-text,
  .side:hover .nav-label,
  .side:hover .side-foot .who,
  .side:hover .side-foot .logout,
  .side:hover .search input { opacity: 1; transition: opacity .2s ease .06s; }

  /* Collapsed rail: center each control, shrink its bubble to a tidy square */
  .side:not(:hover) .ws { justify-content: center; padding-left: 0; padding-right: 0; gap: 0; }
  .side:not(:hover) .ws .meta { display: none; }
  .side:not(:hover) .ws-logo { margin: 0 auto; }

  .side:not(:hover) .nav { align-items: center; }
  .side:not(:hover) .nav-item {
    width: 42px; margin: 0 auto; gap: 0;
    padding-left: 0; padding-right: 0; justify-content: center;
  }
  .side:not(:hover) .nav-text { width: 0; overflow: hidden; }

  .side:not(:hover) .search {
    width: 42px; margin-left: auto; margin-right: auto;
    gap: 0; padding-left: 0; padding-right: 0; justify-content: center;
  }
  .side:not(:hover) .search input { flex: none; width: 0; padding: 0; }

  .side:not(:hover) .side-foot { justify-content: center; gap: 0; }
  .side:not(:hover) .side-foot .who { width: 0; overflow: hidden; }
  .side:not(:hover) .side-foot .logout { width: 0; padding: 0; overflow: hidden; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Tablet: 700–1024px — slim top bar */
@media (max-width: 1024px) {
  body { overflow: hidden; }
  .frame { flex-direction: column; height: 100vh; }

  .side {
    position: fixed; top: 0; left: 0; height: 100vh;
    transform: translateX(-110%); z-index: 50;
    box-shadow: 4px 0 32px rgba(0,0,0,.4);
  }
  .side.open { transform: translateX(0); animation: slideInLeft .28s cubic-bezier(.22,.68,0,1.2) both; }
  .side-close { display: grid; }
  .side-backdrop { display: block; }

  .mobile-bar { display: flex; }

  .main {
    height: calc(100vh - var(--mobile-bar));
    margin-top: var(--mobile-bar);
    padding: 22px 20px 40px;
  }
}

/* Mobile: < 540px */
@media (max-width: 540px) {
  .main { padding: 18px 14px 48px; }
  .main-head h1 { font-size: 20px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .modal { max-width: 100vw; max-height: 95dvh; border-radius: 18px 18px 0 0; align-self: flex-end; }
  .modal-overlay { align-items: flex-end; }
  .users-row { gap: 8px; padding: 0 12px; }
  .profile-form { max-width: 100%; }
}

/* Very small: < 380px */
@media (max-width: 380px) {
  .grid { grid-template-columns: 1fr; }
  .cat-tab { padding: 6px 10px; font-size: 12px; }
}

/* 2-col grid in mid range */
@media (min-width: 541px) and (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   THEME TOGGLE BUTTON
   ============================================================ */
.theme-toggle {
  background: none; border: none; color: var(--text-dim); cursor: pointer;
  padding: 6px; border-radius: 8px; display: grid; place-items: center;
  transition: background .14s, color .14s, transform .1s;
}
.theme-toggle svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.7; }
.theme-toggle:hover { background: var(--hover); color: var(--text); }
.theme-toggle:active { transform: scale(.9); }
.theme-toggle .icon-sun { display: block; }
.theme-toggle .icon-moon { display: none; }

/* ============================================================
   DARK MODE TOKENS + OVERRIDES  (opt-in via toggle)
   ============================================================ */
[data-theme="dark"] {
  --bg:          #1a1a1c;
  --content:     #1f1f22;
  --sidebar:     #171719;
  --panel:       #26262a;
  --panel-2:     #2d2d32;
  --hover:       rgba(255,255,255,.055);
  --border:      rgba(255,255,255,.08);
  --border-soft: rgba(255,255,255,.05);
  --text:        #f3f3f4;
  --text-soft:   #a0a0a7;
  --text-dim:    #6d6d74;
  --accent:      #3B7C52;
  --accent-hover:#4a9163;
  --accent-press:#2F6B45;
  --accent-soft: rgba(59,124,82,.20);
  --accent-border: rgba(59,124,82,.34);
  --accent-ink:  #ffffff;
  --live:        #46c277;
  --danger:      #e07070;
  --shadow-sm:   0 1px 2px rgba(0,0,0,.18);
  --shadow-lg:   0 16px 40px rgba(0,0,0,.34);
}

[data-theme="dark"] .search { background: #0e0e0f; }

[data-theme="dark"] .field-row input,
[data-theme="dark"] .field-row select { background: #0e0e0f; color: var(--text); }

[data-theme="dark"] textarea {
  background: #0e0e0f !important;
  color: var(--text) !important;
  border-color: rgba(255,255,255,.12) !important;
}

[data-theme="dark"] .thumb-wrap { background: #0f0f10; }
[data-theme="dark"] .thumb { background: #0f0f10; }
[data-theme="dark"] .thumb.lock {
  background: repeating-linear-gradient(135deg, #161618 0 12px, #1b1b1e 12px 24px);
}

[data-theme="dark"] .side:hover { box-shadow: 4px 0 18px rgba(0,0,0,.35); }
[data-theme="dark"] .side-backdrop { background: rgba(0,0,0,.55); }
[data-theme="dark"] .modal-overlay { background: rgba(0,0,0,.6); }

[data-theme="dark"] .ws-logo { background: #222; }
[data-theme="dark"] .avatar { background: #b8455a; }
[data-theme="dark"] .app-ic.muted { background: #33333a; color: var(--text-soft); }

[data-theme="dark"] .em-picker-search { background: rgba(255,255,255,.04); }

[data-theme="dark"] .role-admin { background: rgba(100,140,255,.15); color: #7a9fff; }
[data-theme="dark"] .role-pm { background: rgba(180,130,255,.15); color: #b482ff; }
[data-theme="dark"] .icon-impersonate:hover { color: #8aa0ff; background: rgba(130,160,255,.12); border-color: rgba(130,160,255,.25); }

[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

@media (min-width: 1025px) {
  .side:not(:hover) .theme-toggle { width: 0; padding: 0; overflow: hidden; }
}

/* ============================================================
   PREMIUM POLISH LAYER  (2026 restyle — visual only)
   ============================================================ */

/* Buttons — handcrafted, medium radius, tactile */
.btn-save, .btn-add {
  color: var(--accent-ink); font-weight: 600;
  border-radius: 10px; box-shadow: var(--shadow-sm);
  transition: background .16s ease, transform .12s ease, box-shadow .16s ease;
}
.btn-save:hover, .btn-add:hover { background: var(--accent-hover); filter: none; }
.btn-save:active, .btn-add:active { background: var(--accent-press); transform: translateY(.5px) scale(.99); }
.btn-save.btn-danger { background: var(--danger); color: #fff; }
.btn-save.btn-danger:hover { background: var(--danger); filter: brightness(1.04); }
.btn-cancel, .av-upload-btn { border-radius: 10px; font-weight: 500; transition: background .16s ease, color .16s ease, border-color .16s ease; }
.btn-cancel:hover { border-color: #D5DAE3; }

/* Inputs — elegant, 10px radius, soft hover, green focus */
.field-row input, .field-row select, .search { border-radius: 10px; }
.field-row input:hover, .field-row select:hover { border-color: #D5DAE3; }

/* Cards — weightless sheets, gentle 2px lift, muted previews */
.card { box-shadow: var(--shadow-sm); }
a.card:not(.compact):hover { border-color: var(--accent-border); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
a.card:not(.compact):active { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
a.card.compact:hover { border-color: var(--accent-border); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
/* Card hero — subtle "Apple-event" tile: soft light + faint construction grid, grounded icon */
.thumb.tile {
  position: relative; overflow: hidden; display: grid; place-items: center;
  background: radial-gradient(120% 80% at 50% -20%, #FCFDFE 0%, #F1F4F8 68%, #ECEFF4 100%);
}
.thumb.tile::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(47,107,69,.055) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(47,107,69,.055) 1px, transparent 1px);
  background-size: 24px 24px;
  -webkit-mask-image: radial-gradient(120% 95% at 50% 0%, #000 22%, transparent 78%);
  mask-image: radial-gradient(120% 95% at 50% 0%, #000 22%, transparent 78%);
}
.thumb.tile::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(85% 55% at 50% -12%, rgba(255,255,255,.85), transparent 62%);
}
.thumb-brand {
  position: relative; z-index: 1;
  width: 58px; height: 58px; border-radius: 14px; overflow: hidden;
  background: var(--panel); border: 1px solid rgba(16,24,40,.06);
  box-shadow: 0 1px 2px rgba(16,24,40,.06), 0 10px 22px rgba(16,24,40,.10);
  display: grid; place-items: center; font-weight: 600; font-size: 21px; color: var(--text-soft);
  transition: transform .18s ease, box-shadow .18s ease;
}
.thumb-brand img { width: 100%; height: 100%; object-fit: cover; display: block; }
a.card:not(.compact):hover .thumb-brand { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(16,24,40,.08), 0 16px 30px rgba(16,24,40,.14); }
[data-theme="dark"] .thumb.tile { background: radial-gradient(120% 80% at 50% -20%, #202024 0%, #171719 72%); }
[data-theme="dark"] .thumb.tile::before { background-image: linear-gradient(to right, rgba(120,200,150,.05) 1px, transparent 1px), linear-gradient(to bottom, rgba(120,200,150,.05) 1px, transparent 1px); }
[data-theme="dark"] .thumb.tile::after { background: radial-gradient(85% 55% at 50% -12%, rgba(255,255,255,.05), transparent 62%); }
[data-theme="dark"] .thumb-brand { background: #26262a; border-color: rgba(255,255,255,.07); box-shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 22px rgba(0,0,0,.35); }

/* App-icon tile — flat soft green (no gradient) */
.app-ic { background: var(--accent-soft); color: var(--accent); }
.app-ic.muted { background: var(--panel-2); color: var(--text-dim); }
.app-ic-img { background: #fff; }

/* Sidebar nav — soft green active, green icon */
.nav-item { transition: background .16s ease, color .16s ease; }
.nav-item.active { background: var(--accent-soft); color: var(--text); }
.nav-item.active .ic { color: var(--accent); }

/* Tabs — calm green active */
.cat-tab.active { background: var(--accent-soft); border-color: var(--accent-border); color: var(--text); }

/* Status pills / badges — soft pastel, borderless, fully rounded */
.badge, .role-pill, .ent-pill, .status-pill, .method-pill {
  border: none; border-radius: 999px; font-weight: 600; letter-spacing: .1px;
}
.badge.live, .st-active, .method-2fa, .role-developer, .ent-all { color: #2E8B57; background: #EAF8EE; }
.badge.soon { color: #C69200; background: #FFF8E8; }
.badge.plan, .st-off, .method-password, .role-user, .ent-pill { color: #6B7280; background: #F3F4F6; }
.role-admin { color: #3978FF; background: #EEF5FF; }
.role-pm    { color: #7A5AF0; background: #F1ECFB; }

/* Table headers — quiet */
.users-header, .act-header { background: transparent; border-bottom: 1px solid var(--border); }

/* Dialog — premium */
.modal { border-radius: 16px; box-shadow: var(--shadow-lg); }
.modal-close { border-radius: 8px; }

/* Typography — restrained weights (rarely 700) */
.main-head h1, .settings-head h1, .modal-head span, .mobile-title,
.meta .name, .ws .meta b, .nav-label, .section-label { font-weight: 600; }

/* Empty state */
.empty { color: var(--text-dim); }

/* Thin, minimal scrollbars */
* { scrollbar-width: thin; scrollbar-color: rgba(120,128,140,.4) transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: rgba(120,128,140,.32); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(120,128,140,.5); background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* Accessible focus rings — forest green */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: none; box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Dark-mode pill tints (kept tasteful) */
[data-theme="dark"] .badge.live, [data-theme="dark"] .st-active, [data-theme="dark"] .method-2fa, [data-theme="dark"] .role-developer, [data-theme="dark"] .ent-all { color: #46c277; background: rgba(70,194,119,.14); }
[data-theme="dark"] .badge.soon { color: #f0b429; background: rgba(240,180,41,.14); }
[data-theme="dark"] .badge.plan, [data-theme="dark"] .st-off, [data-theme="dark"] .method-password, [data-theme="dark"] .role-user, [data-theme="dark"] .ent-pill { color: #a0a0a7; background: rgba(255,255,255,.07); }

/* ============================================================
   SECOND POLISH PASS — homepage hierarchy + card footer
   ============================================================ */

/* Card surface — layered above the page, soft border + whisper shadow */
.card { box-shadow: 0 1px 2px rgba(16,24,40,.04); }
a.card:not(.compact):hover { border-color: #D5DBE4; transform: translateY(-3px); box-shadow: 0 2px 6px rgba(16,24,40,.05), 0 18px 36px rgba(16,24,40,.08); }
a.card:not(.compact):active { transform: translateY(-1px); box-shadow: 0 1px 2px rgba(16,24,40,.04); }

/* Card footer — Linear/Vercel calm: no divider, drop the duplicate icon, quieter description */
.card:not(.compact) .meta { padding: 14px 16px 16px; border-top: none; align-items: center; gap: 0; }
.card:not(.compact) .meta > .app-ic { display: none; }
.meta .name-row { gap: 8px; align-items: center; }
.meta .name { font-size: 14.5px; letter-spacing: -.1px; color: var(--text); }
.meta .desc { font-size: 12.5px; color: var(--text-soft); margin-top: 5px; line-height: 1.55; }

/* "Live" badge — tighter proportion */
.badge { padding: 2.5px 8px; font-size: 10px; }

/* Homepage rhythm — greeting leads, then recents, categories, apps */
.main-head { margin-bottom: 30px; }
.main-head h1 { font-size: 23px; letter-spacing: -.5px; }
.main-head p { margin-top: 6px; color: var(--text-soft); }
.recents-strip { margin-bottom: 30px; }
.section-label { letter-spacing: .8px; color: var(--text-dim); }
.cat-tabs { margin-bottom: 24px; }
.grid { gap: 18px; }

/* ============================================================
   SIDEBAR REDESIGN — premium expanded navigation system
   ============================================================ */
:root { --sidebar-w: 268px; }

.side { width: var(--sidebar-w); padding: 16px 14px 14px; background: var(--sidebar); border-right: 1px solid var(--border); }

/* Logo — breathing room */
.side-top { margin-bottom: 14px; padding: 6px 6px 0; }
.ws { gap: 12px; padding: 6px; border-radius: 12px; }
.ws-logo { width: 36px; height: 36px; border-radius: 10px; }
.ws .meta b { font-size: 15px; font-weight: 600; letter-spacing: -.1px; }
.ws .meta .ws-sub { font-size: 11px; font-weight: 500; color: var(--text-dim); letter-spacing: .01em; }

/* Search */
.search { margin: 4px 4px 10px; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); border-color: transparent; color: var(--text-dim); }
.search:focus-within { background: var(--panel); border-color: var(--accent-border); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input { font-size: 13.5px; }

/* Section labels */
.nav-label { font-size: 10.5px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--text-dim); margin: 16px 12px 6px; }
.nav-label:first-child { margin-top: 4px; }

/* Navigation rows */
.nav { gap: 3px; }
.nav-item {
  min-height: 44px; padding: 0 12px; gap: 12px; border-radius: 11px;
  font-size: 14.5px; font-weight: 500; color: var(--text-soft);
  transition: background .15s ease, color .15s ease, box-shadow .2s ease;
}
.nav-item:hover { background: var(--hover); color: var(--text); transform: none; }
.nav-item:active { transform: none; }
.nav-item .ic { width: 19px; height: 19px; opacity: 1; color: var(--text-dim); transition: color .2s ease; }
.nav-item .ic svg { width: 19px; height: 19px; stroke-width: 1.7; }
.nav-item:hover .ic { color: var(--text-soft); }

/* Active — selected, not merely highlighted */
.nav-item.active {
  background: var(--accent-soft); color: var(--text); font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--accent-border), 0 1px 2px rgba(16,24,40,.05);
}
.nav-item.active .ic { color: var(--accent); }

/* Right-aligned nav badge slot (Soon / Beta / New / count) */
.nav-item .nav-badge { margin-left: auto; font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 999px; background: var(--panel-2); color: var(--text-soft); }

/* Bottom profile — name left, actions right, hairline divider */
.side-foot { margin-top: auto; padding: 12px 6px 2px; border-top: 1px solid var(--border-soft); gap: 10px; }
.avatar { width: 32px; height: 32px; }
.side-foot .who b { font-size: 13.5px; font-weight: 600; }
.side-foot .who small { font-size: 11.5px; color: var(--text-dim); }
.logout, .theme-toggle { color: var(--text-dim); border-radius: 9px; transition: background .15s ease, color .15s ease; }
.logout:hover, .theme-toggle:hover { background: var(--hover); color: var(--text); }

/* Keep the sidebar expanded on desktop (no icon-rail collapse) */
@media (min-width: 1025px) {
  .frame { padding-left: 0; }
  .side { position: sticky; top: 0; left: auto; width: var(--sidebar-w); box-shadow: none; }
  .side:hover { width: var(--sidebar-w); box-shadow: none; }
  .side .ws .meta, .side .nav-text, .side .nav-label,
  .side .side-foot .who, .side .side-foot .logout, .side .search input,
  .side .theme-toggle { opacity: 1; }
  .side:not(:hover) .ws { justify-content: flex-start; padding-left: 6px; padding-right: 6px; gap: 12px; }
  .side:not(:hover) .ws .meta { display: block; }
  .side:not(:hover) .ws-logo { margin: 0; }
  .side:not(:hover) .nav { align-items: stretch; }
  .side:not(:hover) .nav-item { width: auto; margin: 0; gap: 12px; padding: 0 12px; justify-content: flex-start; }
  .side:not(:hover) .nav-text { width: auto; overflow: visible; }
  .side:not(:hover) .search { width: auto; margin: 4px 4px 10px; gap: 9px; padding: 10px 12px; justify-content: flex-start; }
  .side:not(:hover) .search input { flex: 1; width: auto; padding: 0; }
  .side:not(:hover) .side-foot { justify-content: flex-start; gap: 10px; }
  .side:not(:hover) .side-foot .who { width: auto; overflow: visible; }
  .side:not(:hover) .side-foot .logout,
  .side:not(:hover) .theme-toggle { width: auto; padding: 6px; overflow: visible; }
}

/* ============================================================
   LAUNCHER TILE SYSTEM  (2026 design-system restyle — visual only)
   Content-sized app tiles: accent-tinted icon square · live status
   dot · mono slug · neutral chips · label/value meta. Accent shows
   only on the icon square, live dot, active nav, and primary button.
   ============================================================ */
:root {
  --accent-tint:     var(--accent-soft);
  --accent-strong:   var(--live);
  --text-primary:    var(--text);
  --text-secondary:  var(--text-soft);
  --text-muted:      var(--text-dim);
  --border-hairline: var(--border);
  --radius-card: 16px;
  --radius-tile: 11px;
  --radius-chip: 8px;
  --shadow-card: 0 1px 2px rgba(16,24,40,.04);
  --mono: ui-monospace, 'SF Mono', 'Cascadia Code', 'Menlo', monospace;
}

.grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }

.card {
  display: flex; flex-direction: column;
  background: var(--panel);
  border: .5px solid var(--border-hairline);
  border-radius: var(--radius-card);
  padding: 18px;
  box-shadow: var(--shadow-card);
  text-decoration: none; color: inherit;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.card.locked { opacity: .92; cursor: default; }
a.card:not(.compact):hover { border-color: var(--accent-border); box-shadow: 0 2px 6px rgba(16,24,40,.05), 0 16px 32px rgba(16,24,40,.08); transform: translateY(-2px); }
a.card:not(.compact):active { transform: translateY(-1px); box-shadow: var(--shadow-card); }

.tile-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 13px; }
.app-ic { width: 42px; height: 42px; border-radius: var(--radius-tile); flex: none; display: grid; place-items: center; font-weight: 500; font-size: 16px; background: var(--accent-tint); color: var(--accent); }
.app-ic.muted { background: var(--panel-2); color: var(--text-muted); }
.app-ic-img { background: #fff; padding: 0; overflow: hidden; }
.app-ic-img img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius-tile); display: block; }

.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); flex: none; }
.status-dot.live { background: var(--accent-strong); box-shadow: 0 0 0 3px var(--accent-tint); }

.tile-name { font-size: 15px; font-weight: 500; color: var(--text-primary); letter-spacing: -.1px; }
.tile-slug { font-size: 12px; color: var(--text-secondary); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-slug.dim { color: var(--text-muted); }
.mono { font-family: var(--mono); }

.tile-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 13px; }
.chip { font-size: 11px; font-weight: 500; padding: 3px 9px; border-radius: var(--radius-chip); background: var(--panel-2); color: var(--text-secondary); white-space: nowrap; }
.chip.chip-accent { background: var(--accent-tint); color: var(--accent); }

.tile-meta { margin-top: 14px; padding-top: 12px; border-top: .5px solid var(--border-soft); display: flex; flex-direction: column; gap: 7px; }
.mrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 12px; }
.mrow .ml { color: var(--text-muted); font-weight: 400; }
.mrow .mv { color: var(--text-primary); font-weight: 500; }

/* Duplicate recents strip removed — dedicated Recents view remains */
.recents-strip { display: none !important; }

/* List view — one compact row per app */
.grid.list { grid-template-columns: 1fr; gap: 8px; }
.grid.list .card { flex-direction: row; align-items: center; gap: 14px; padding: 12px 16px; }
.grid.list .tile-top { margin-bottom: 0; }
.grid.list .tile-slug { margin-top: 0; }
.grid.list .tile-chips, .grid.list .tile-meta { margin: 0; padding: 0; border: none; margin-left: auto; }
.grid.list .tile-meta { flex-direction: row; }

/* Home typography — sentence case, two weights (400 / 500) */
.main-head h1 { font-weight: 500; }
.main-head p { font-weight: 400; }

/* ============================================================
   BADGE / PILL SYSTEM  (2026 — one component, six semantic tones)
   Single source of truth for every status, category, and count
   pill. Tone encodes meaning (green healthy · red failed · gray
   category · blue info · purple accent · amber warning). Same
   formula for all tones — only the hue changes. Light + dark
   driven entirely from these tokens.
   ============================================================ */
:root {
  --badge-success-bg: #E6F4EA; --badge-success-border: #B7E4C7; --badge-success-text: #2F6B45;
  --badge-danger-bg:  #FEF3F2; --badge-danger-border:  #FECDCA; --badge-danger-text:  #B42318;
  --badge-neutral-bg: #F4F4F5; --badge-neutral-border: #E4E4E7; --badge-neutral-text: #52525B;
  --badge-info-bg:    #EFF6FF; --badge-info-border:    #BFDBFE; --badge-info-text:    #1D4ED8;
  --badge-accent-bg:  #F5F3FF; --badge-accent-border:  #DDD6FE; --badge-accent-text:  #6D28D9;
  --badge-warning-bg: #FFFAEB; --badge-warning-border: #FDE68A; --badge-warning-text: #B45309;
}
[data-theme="dark"] {
  --badge-success-bg: rgba(29,158,117,.14);  --badge-success-border: rgba(29,158,117,.30);  --badge-success-text: #6CE9A6;
  --badge-danger-bg:  rgba(240,68,56,.14);   --badge-danger-border:  rgba(240,68,56,.30);   --badge-danger-text:  #FDA29B;
  --badge-neutral-bg: rgba(255,255,255,.07); --badge-neutral-border: rgba(255,255,255,.14); --badge-neutral-text: #D4D4D8;
  --badge-info-bg:    rgba(59,130,246,.14);  --badge-info-border:    rgba(59,130,246,.30);  --badge-info-text:    #93C5FD;
  --badge-accent-bg:  rgba(139,92,246,.14);  --badge-accent-border:  rgba(139,92,246,.30);  --badge-accent-text:  #C4B5FD;
  --badge-warning-bg: rgba(245,158,11,.14);  --badge-warning-border: rgba(245,158,11,.30);  --badge-warning-text: #FCD34D;
}

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 500; line-height: 1.35;
  padding: 3.5px 10px; border-radius: 9999px; white-space: nowrap;
  border: .5px solid transparent; letter-spacing: 0;
}
.pill-sm { font-size: 11px; padding: 2px 8px; }
.pill .pill-ic { display: inline-flex; align-items: center; }
.pill .pill-ic svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.pill .pill-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }

.pill-success { background: var(--badge-success-bg); border-color: var(--badge-success-border); color: var(--badge-success-text); }
.pill-danger  { background: var(--badge-danger-bg);  border-color: var(--badge-danger-border);  color: var(--badge-danger-text); }
.pill-neutral { background: var(--badge-neutral-bg); border-color: var(--badge-neutral-border); color: var(--badge-neutral-text); }
.pill-info    { background: var(--badge-info-bg);    border-color: var(--badge-info-border);    color: var(--badge-info-text); }
.pill-accent  { background: var(--badge-accent-bg);  border-color: var(--badge-accent-border);  color: var(--badge-accent-text); }
.pill-warning { background: var(--badge-warning-bg); border-color: var(--badge-warning-border); color: var(--badge-warning-text); }

/* Tile: status pill sits with the app name (not floating) */
.tile-name-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Legacy pill classes → mapped onto the same component + tokens
   (safety net for any instance not migrated to pill()) */
.badge, .role-pill, .status-pill, .method-pill, .ent-pill, .chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 500; line-height: 1.35;
  padding: 3.5px 10px; border-radius: 9999px; white-space: nowrap;
  border: .5px solid transparent;
}
.badge.live, .st-active, .method-2fa, .role-developer, .ent-all {
  background: var(--badge-success-bg); border-color: var(--badge-success-border); color: var(--badge-success-text);
}
.badge.soon { background: var(--badge-warning-bg); border-color: var(--badge-warning-border); color: var(--badge-warning-text); }
.badge.plan, .st-off, .method-password, .role-user, .ent-pill, .chip {
  background: var(--badge-neutral-bg); border-color: var(--badge-neutral-border); color: var(--badge-neutral-text);
}
.role-admin { background: var(--badge-info-bg);   border-color: var(--badge-info-border);   color: var(--badge-info-text); }
.role-pm    { background: var(--badge-accent-bg); border-color: var(--badge-accent-border); color: var(--badge-accent-text); }
[data-theme="dark"] .badge.live, [data-theme="dark"] .st-active, [data-theme="dark"] .method-2fa,
[data-theme="dark"] .role-developer, [data-theme="dark"] .ent-all { background: var(--badge-success-bg); color: var(--badge-success-text); }
[data-theme="dark"] .badge.soon { background: var(--badge-warning-bg); color: var(--badge-warning-text); }
[data-theme="dark"] .badge.plan, [data-theme="dark"] .st-off, [data-theme="dark"] .method-password,
[data-theme="dark"] .role-user, [data-theme="dark"] .ent-pill, [data-theme="dark"] .chip { background: var(--badge-neutral-bg); color: var(--badge-neutral-text); }

/* ============================================================
   APP ICON SYSTEM  (2026 — Lucide squircle tiles, one system)
   One coordinated green/teal/slate family. White Lucide glyph,
   uniform stroke-width 2, flat (no gradient/shadow). Tile color
   from the --app-* token layer; the app-<slug> class selects it.
   ============================================================ */
:root {
  --app-green:       #0F6E56;
  --app-teal-green:  #14776A;
  --app-slate:       #274C5B;
  --app-teal:        #1C5D66;
  --app-green-slate: #2E5245;
  --app-green-dark:  #0B4A3A;
}

.app-ic.app-ic-lucide { color: #fff; background: var(--panel-2); overflow: hidden; }
.app-ic-lucide svg { width: 54%; height: 54%; display: block; stroke: currentColor; fill: none; stroke-width: 2; }

.app-ic.app-invoices    { background: var(--app-green); }
.app-ic.app-projections { background: var(--app-teal-green); }
.app-ic.app-tm          { background: var(--app-slate); }
.app-ic.app-reports     { background: var(--app-teal); }
.app-ic.app-estimating  { background: var(--app-green-slate); }
.app-ic.app-pas         { background: var(--app-green-dark); }

.app-ic.app-ic-lucide.muted { background: var(--panel-2); color: var(--text-muted); }

.app-ic-sm { width: 34px; height: 34px; border-radius: 9px; }

/* Dark canvas: hairline same-family border so tiles don't vanish */
[data-theme="dark"] .app-ic-lucide { border: .5px solid rgba(255,255,255,.10); }

/* ============================================================
   PREMIUM DASHBOARD  (2026 — cohesive shell · cards · controls)
   Final layer: layout density, control row, segmented tabs,
   3-zone app cards, list rows, focus + motion. Logo-green driven.
   ============================================================ */
:root { --sidebar-w: 240px; }

/* Shell — page canvas + capped content width */
.main { padding: 32px; }
.main .panel { max-width: var(--content-max); margin: 0 auto; width: 100%; }
@media (max-width: 1024px) { .main { padding: 22px 20px 40px; } }
@media (max-width: 540px)  { .main { padding: 18px 16px 40px; } }

/* Header — greeting rhythm, restrained size */
.main-head { display: block; margin-bottom: 22px; }
.main-head h1 { font-size: 22px; font-weight: 600; letter-spacing: -.4px; line-height: 1.2; color: var(--text-primary); margin: 0; }
.main-head p { margin: 5px 0 0; font-size: 13.5px; line-height: 1.45; color: var(--text-secondary); }

/* Control row — category tabs (left) + view toggle (right), one band */
.controls { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.controls .cat-tabs { margin: 0; flex: 0 1 auto; }
.controls .view-toggle { margin: 0; flex: none; }

/* Category tabs — compact segmented control */
.cat-tabs { display: inline-flex; align-items: center; gap: 2px; padding: 3px; background: var(--surface-subtle); border: 1px solid var(--border); border-radius: 10px; width: fit-content; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tab { display: inline-flex; align-items: center; gap: 7px; font-family: inherit; font-size: 13px; font-weight: 500; color: var(--text-secondary); background: none; border: none; border-radius: 7px; cursor: pointer; padding: 6px 12px; white-space: nowrap; transition: background .15s ease, color .15s ease; }
.cat-tab:hover { color: var(--text-primary); background: rgba(11,61,36,.045); }
.cat-tab.active { color: var(--brand-700); background: var(--surface); box-shadow: 0 1px 2px rgba(11,61,36,.07); font-weight: 500; }
.cat-tab .n { font-size: 11.5px; font-weight: 500; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.cat-tab.active .n { color: var(--brand-600); }

/* View toggle — part of the control row */
.view-toggle { display: inline-flex; background: var(--surface-subtle); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; overflow: visible; }
.view-toggle button { width: 32px; height: 30px; display: grid; place-items: center; background: none; border: none; border-radius: 7px; cursor: pointer; color: var(--text-dim); transition: background .15s ease, color .15s ease; }
.view-toggle button:hover { color: var(--text-primary); }
.view-toggle button.active { background: var(--surface); color: var(--brand-700); box-shadow: 0 1px 2px rgba(11,61,36,.07); }
.view-toggle svg { width: 15px; height: 15px; }

/* App grid — responsive, density-capped */
.grid { grid-template-columns: repeat(3, minmax(0,1fr)); gap: 18px; align-items: stretch; }
@media (max-width: 1180px) { .grid:not(.list) { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 680px)  { .grid:not(.list) { grid-template-columns: 1fr; } }

/* App card — premium 3-zone, equal height */
.card { padding: 16px 16px 14px; border-radius: 15px; border: 1px solid var(--border); background: var(--surface); box-shadow: none; transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.grid:not(.list) .card { height: 100%; }
a.card:not(.compact):hover { border-color: var(--accent-border); box-shadow: 0 2px 8px rgba(11,61,36,.06); transform: translateY(-1px); }
a.card:not(.compact):active { transform: translateY(0); box-shadow: none; }
.card.locked { opacity: 1; }

.card-top { display: flex; align-items: center; gap: 12px; }
.card-head { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.card-name { flex: 1; min-width: 0; font-size: 15px; font-weight: 600; letter-spacing: -.1px; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-head .pill { flex: none; }

.card-mid { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 13px; }
.card-url { flex: 1; min-width: 0; font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-url.dim { color: var(--text-dim); }
.card-mid .pill { flex: none; }

.grid:not(.list) .card-foot { margin-top: auto; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border-soft); }
.card-foot-label { font-size: 12px; color: var(--text-dim); }

/* List view — same design system, clean rows */
.grid.list { grid-template-columns: 1fr; gap: 8px; }
.grid.list .card { flex-direction: row; align-items: center; gap: 16px; padding: 12px 16px; height: auto; }
.grid.list .card-top { flex: 1 1 auto; min-width: 0; }
.grid.list .card-mid { margin-top: 0; flex: 1 1 auto; justify-content: flex-end; }
.grid.list .card-url { flex: 0 1 auto; max-width: 280px; }
.grid.list .card-foot { margin-top: 0; padding-top: 0; border-top: none; flex: none; }
.grid.list .card-foot-label { display: none; }
@media (max-width: 720px) { .grid.list .card-mid { display: none; } }
@media (max-width: 520px) { .grid.list .card-foot { display: none; } }

/* Sidebar profile — uncramped */
.side-foot { gap: 8px; padding: 12px 6px 4px; }
.side-foot .who { flex: 1; min-width: 0; }
.side-foot .logout, .side-foot .theme-toggle { flex: none; }

/* Focus — brand ring, clearly visible, not color-only */
a.card:focus-visible, .cat-tab:focus-visible, .view-toggle button:focus-visible,
.nav-item:focus-visible, .search input:focus-visible, .logout:focus-visible, .theme-toggle:focus-visible {
  outline: 2px solid var(--brand-600); outline-offset: 2px; box-shadow: none;
}

/* ============================================================
   REFINEMENT PASS 2  (2026 — precision, composition, branding)
   Builds on the premium layer: pale-green selected states, a
   cohesive toolbar, taller structured cards with a real metadata
   footer, sidebar precision, two-row profile. Token-driven.
   ============================================================ */

/* Header — confident greeting, breathing room before controls */
.main-head { margin-bottom: 26px; }
.main-head h1 { font-size: 24px; font-weight: 600; letter-spacing: -.5px; line-height: 1.18; color: var(--text-primary); }
.main-head p { font-size: 14px; margin-top: 6px; line-height: 1.45; color: var(--text-secondary); }

/* Toolbar — one cohesive band, tabs left / view switch right, matched height */
.controls { align-items: center; margin-bottom: 16px; gap: 12px; }

/* Segmented category control — 37px tall, deliberate pale-green selection */
.cat-tabs { padding: 3px; border-radius: 9px; background: var(--surface-muted); border: 1px solid var(--border); }
.cat-tab { height: 31px; padding: 0 13px; gap: 7px; border-radius: 6px; font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.cat-tab:hover:not(.active) { color: var(--text-primary); background: rgba(11,61,36,.05); }
.cat-tab.active { background: var(--brand-100); color: var(--brand-700); box-shadow: inset 0 0 0 1px var(--accent-border); }
.cat-tab .n { font-size: 11.5px; color: var(--text-tertiary); font-variant-numeric: tabular-nums; }
.cat-tab.active .n { color: var(--brand-600); }

/* View switcher — matched 37px height, 31px squares, pale-green active */
.view-toggle { height: 37px; align-items: center; padding: 3px; border-radius: 9px; background: var(--surface-muted); border: 1px solid var(--border); }
.view-toggle button { width: 31px; height: 31px; border-radius: 6px; color: var(--text-tertiary); }
.view-toggle button:hover:not(.active) { color: var(--text-primary); background: rgba(11,61,36,.05); }
.view-toggle button.active { background: var(--brand-100); color: var(--brand-700); box-shadow: inset 0 0 0 1px var(--accent-border); }
.view-toggle svg { width: 15px; height: 15px; }

/* App grid — a touch more air */
.grid { gap: 18px; }

/* App card — taller, structured, product character */
.card { padding: 18px; border-radius: 15px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-sm); }
.grid:not(.list) .card { min-height: 158px; }
a.card:not(.compact):hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }
a.card:not(.compact):active { transform: translateY(0); box-shadow: var(--shadow-sm); }

.card-top { display: flex; align-items: center; gap: 12px; }
.card-name { font-size: 15.5px; font-weight: 600; letter-spacing: -.15px; color: var(--text-primary); }

/* URL — its own row, interface font (not mono), quietly muted */
.card-url { font-family: inherit; font-size: 12.5px; color: var(--text-secondary); margin-top: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-url.dim { color: var(--text-tertiary); }

/* Metadata footer — category left, Access → status right, real divider */
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--border-soft); }
.card-foot-cat { min-width: 0; display: flex; }
.card-access { display: flex; align-items: center; gap: 8px; flex: none; }
.card-access-label { font-size: 11.5px; color: var(--text-tertiary); }

/* Live status — compact, pale green, thin border, dot + text */
.card-head .pill.pill-success { padding: 3px 9px; }

/* ---- Sidebar precision ---- */
.side { padding: 16px 12px 12px; }
.side-top { padding: 4px 6px 0; margin-bottom: 12px; }
.ws { gap: 11px; padding: 6px; border-radius: 11px; }
.ws-logo { width: 36px; height: 36px; border-radius: 10px; }
.ws .meta b { font-size: 14.5px; font-weight: 600; letter-spacing: -.1px; color: var(--text-primary); }
.ws .meta .ws-sub { font-size: 11px; font-weight: 500; color: var(--text-tertiary); }

.search { height: 38px; padding: 0 12px; gap: 9px; align-items: center; background: var(--surface-muted); border: 1px solid var(--border); border-radius: 9px; color: var(--text-tertiary); }
.search:focus-within { background: var(--surface); border-color: var(--accent-border); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input { font-size: 13.5px; }
.search input::placeholder { color: var(--text-tertiary); }

.nav-label { margin: 16px 11px 6px; font-size: 10.5px; font-weight: 600; letter-spacing: .08em; color: var(--text-tertiary); }
.nav-item { min-height: 40px; gap: 11px; padding: 0 11px; border-radius: 9px; font-size: 14px; font-weight: 500; color: var(--text-secondary); }
.nav-item .ic { width: 18px; height: 18px; color: var(--text-tertiary); }
.nav-item .ic svg { width: 18px; height: 18px; }
.nav-item:hover:not(.active) { background: var(--hover); color: var(--text-primary); }
.nav-item:hover:not(.active) .ic { color: var(--text-secondary); }
.nav-item.active { background: var(--brand-100); color: var(--brand-700); font-weight: 600; box-shadow: inset 0 0 0 1px var(--accent-border); }
.nav-item.active .ic { color: var(--brand-600); }

/* Profile — two-row: identity, then utility controls (uncramped) */
.side-foot { flex-direction: column; align-items: stretch; gap: 8px; padding: 12px 6px 2px; border-top: 1px solid var(--border-soft); }
.profile-id { display: flex; align-items: center; gap: 10px; min-width: 0; }
.profile-id .avatar { width: 34px; height: 34px; flex: none; }
.profile-id .who { flex: 1; min-width: 0; line-height: 1.25; }
.profile-id .who b { display: block; font-size: 13px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-id .who small { display: block; font-size: 11.5px; color: var(--text-tertiary); }
.profile-tools { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.profile-tools .logout, .profile-tools .theme-toggle { width: 32px; height: 32px; border-radius: 8px; color: var(--text-tertiary); }
.profile-tools .logout:hover, .profile-tools .theme-toggle:hover { background: var(--hover); color: var(--text-primary); }

/* Keep two-row profile intact in the desktop expanded rail */
@media (min-width: 1025px) {
  .side:not(:hover) .side-foot { flex-direction: column; align-items: stretch; gap: 8px; }
  .side:not(:hover) .profile-tools { justify-content: flex-end; }
  .side:not(:hover) .profile-tools .logout,
  .side:not(:hover) .profile-tools .theme-toggle { width: 32px; padding: 6px; overflow: visible; }
}

/* ============================================================
   SIDEBAR PASS 3  (2026 — narrow, structured, premium)
   Sidebar-only. Unified Lucide outline icons, fixed-width icon
   container for label alignment, restrained AAC-green active.
   Semantic --sidebar-* tokens; nothing else on the page changes.
   ============================================================ */
:root {
  --sidebar-w: 220px;
  --sidebar-background:        var(--surface);
  --sidebar-border:            var(--border);
  --sidebar-text:              var(--text-secondary);
  --sidebar-text-muted:        var(--text-tertiary);
  --sidebar-icon:              var(--text-tertiary);
  --sidebar-hover:             #EEF3F0;
  --sidebar-active-background:  var(--brand-100);
  --sidebar-active-border:      var(--accent-border);
  --sidebar-active-text:        var(--brand-700);
  --sidebar-focus-ring:         var(--brand-600);
}

.side { width: var(--sidebar-w); padding: 14px 10px 12px; background: var(--sidebar-background); border-right: 1px solid var(--sidebar-border); }

/* Brand header — compact application identity */
.side-top { padding: 2px 6px 0; margin-bottom: 14px; }
.ws { gap: 10px; padding: 4px; border-radius: 10px; }
.ws-logo { width: 36px; height: 36px; border-radius: 9px; }
.ws .meta { line-height: 1.2; }
.ws .meta b { font-size: 15px; font-weight: 600; letter-spacing: -.1px; color: var(--text-primary); }
.ws .meta .ws-sub { font-size: 11px; font-weight: 500; color: var(--sidebar-text-muted); }

/* Search — compact, interactive, Lucide search glyph */
.search { height: 35px; margin: 0 4px 0; padding: 0 11px; gap: 9px; align-items: center; background: var(--surface-muted); border: 1px solid var(--sidebar-border); border-radius: 9px; color: var(--sidebar-text-muted); }
.search:focus-within { background: var(--surface); border-color: var(--sidebar-active-border); box-shadow: 0 0 0 3px var(--accent-soft); }
.search .mag { width: 16px; height: 16px; border: none; border-radius: 0; display: flex; align-items: center; justify-content: center; position: static; color: var(--sidebar-text-muted); flex: none; }
.search .mag::after { display: none; }
.search .mag svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.search input { font-size: 13px; }
.search input::placeholder { color: var(--sidebar-text-muted); }

/* Section headings — small, uppercase, readable */
.nav { gap: 2px; margin-top: 16px; }
.nav-label { margin: 4px 12px 6px; font-size: 10.5px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--sidebar-text-muted); }
.nav-label ~ .nav-label,
.nav-item + .nav-label { margin-top: 20px; }

/* Navigation rows — compact, aligned via fixed icon container */
.nav-item { min-height: 38px; margin: 0 2px; padding: 0 10px; gap: 11px; border-radius: 10px; font-size: 14px; font-weight: 500; color: var(--sidebar-text); transition: background .14s ease, color .14s ease; }
.nav-item .ic { width: 20px; height: 18px; flex: none; display: flex; align-items: center; justify-content: center; color: var(--sidebar-icon); opacity: 1; }
.nav-item .ic svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.85; stroke-linecap: round; stroke-linejoin: round; }
.nav-item .nav-text { line-height: 1; }
.nav-item:hover:not(.active) { background: var(--sidebar-hover); color: var(--text-primary); }
.nav-item:hover:not(.active) .ic { color: var(--sidebar-text); }
.nav-item.active { background: var(--sidebar-active-background); color: var(--sidebar-active-text); font-weight: 600; box-shadow: inset 0 0 0 1px var(--sidebar-active-border); }
.nav-item.active .ic { color: var(--brand-600); }
.nav-item:focus-visible { outline: 2px solid var(--sidebar-focus-ring); outline-offset: -2px; box-shadow: none; }

/* Profile — compact account area, unified icon treatment */
.side-foot { padding: 12px 4px 2px; border-top: 1px solid var(--border-soft); gap: 8px; }
.profile-id { gap: 10px; }
.profile-id .avatar { width: 32px; height: 32px; }
.profile-id .who b { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.profile-id .who small { font-size: 11.5px; color: var(--sidebar-text-muted); }
.profile-tools .logout, .profile-tools .theme-toggle { width: 32px; height: 32px; border-radius: 8px; color: var(--sidebar-icon); }
.profile-tools .logout:hover, .profile-tools .theme-toggle:hover { background: var(--sidebar-hover); color: var(--text-primary); }
.profile-tools .logout:focus-visible, .profile-tools .theme-toggle:focus-visible { outline: 2px solid var(--sidebar-focus-ring); outline-offset: 2px; box-shadow: none; }
.side-foot svg { stroke-width: 1.85; stroke-linecap: round; stroke-linejoin: round; }
.profile-tools .logout svg, .profile-tools .theme-toggle svg { width: 17px; height: 17px; }

/* ============================================================
   APPLICATIONS TOOLBAR  (2026 — one cohesive control surface)
   Three-zone: left label+count · centered segmented filters ·
   right view switch. White surface, subtle border, restrained
   shadow. Toolbar-only; cards/grid/sidebar unchanged.
   ============================================================ */
.toolbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  min-height: 62px;
  padding: 11px 18px;
  margin-bottom: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 15px;
  box-shadow: var(--shadow-sm);
}
.toolbar-left { grid-column: 1; justify-self: start; min-width: 0; }
.toolbar-title { font-size: 13.5px; font-weight: 600; letter-spacing: -.1px; color: var(--text-primary); line-height: 1.2; }
.toolbar-sub { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; font-variant-numeric: tabular-nums; }

.toolbar .cat-tabs { grid-column: 2; justify-self: center; margin: 0; }
.toolbar .view-toggle { grid-column: 3; justify-self: end; margin: 0; }

/* Compact the segmented + switcher to ~36px within the toolbar */
.toolbar .cat-tabs { padding: 3px; }
.toolbar .cat-tab { height: 30px; padding: 0 12px; }
.toolbar .view-toggle { height: 36px; padding: 3px; }
.toolbar .view-toggle button { width: 30px; height: 30px; }

/* Responsive: keep label + view switch on row 1, filters full-width row 2 */
@media (max-width: 900px) {
  .toolbar {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    row-gap: 12px;
  }
  .toolbar-left { grid-column: 1; grid-row: 1; }
  .toolbar .view-toggle { grid-column: 2; grid-row: 1; justify-self: end; }
  .toolbar .cat-tabs { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; overflow-x: auto; }
}

/* Mobile: comfortable stacking, preserve every control + touch target */
@media (max-width: 540px) {
  .toolbar { padding: 12px 14px; gap: 12px; }
  .toolbar .cat-tabs { width: 100%; }
  .toolbar .cat-tab { height: 32px; }
  .toolbar .view-toggle { height: 34px; }
  .toolbar .view-toggle button { width: 30px; height: 30px; }
}

/* ============================================================
   CARD — HERO ICON  (2026 — restore the larger card with the app
   icon featured on a soft tile, name + status + description below)
   ============================================================ */
.grid { grid-template-columns: repeat(3, minmax(0,1fr)); gap: 18px; }

.card { padding: 0; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-sm); overflow: hidden; }
.grid:not(.list) .card { min-height: 0; height: 100%; display: flex; flex-direction: column; }
a.card:not(.compact):hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-2px); }
a.card:not(.compact):active { transform: translateY(-1px); box-shadow: var(--shadow-sm); }

/* Hero — soft tile with the app icon centered */
.card-hero {
  position: relative; height: 132px;
  display: grid; place-items: center;
  background: radial-gradient(130% 90% at 50% -10%, #FBFDFC 0%, #EFF4F1 68%, #E8EEEA 100%);
  border-bottom: 1px solid var(--border-soft);
  overflow: hidden;
}
.card-hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(28,112,73,.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(28,112,73,.05) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(120% 95% at 50% 0%, #000 20%, transparent 78%);
  mask-image: radial-gradient(120% 95% at 50% 0%, #000 20%, transparent 78%);
}
.app-ic-hero { position: relative; z-index: 1; width: 60px; height: 60px; border-radius: 16px; box-shadow: 0 2px 6px rgba(11,61,36,.14), 0 10px 22px rgba(11,61,36,.12); transition: transform .18s ease, box-shadow .18s ease; }
.app-ic-hero svg { width: 52%; height: 52%; }
a.card:not(.compact):hover .app-ic-hero { transform: translateY(-2px); box-shadow: 0 3px 8px rgba(11,61,36,.16), 0 16px 30px rgba(11,61,36,.16); }

/* Body — name + live, description */
.card-body { padding: 15px 18px 18px; display: flex; flex-direction: column; }
.card-body .card-name-row { display: flex; align-items: center; gap: 8px; }
.card-body .card-name { flex: 1; min-width: 0; font-size: 15.5px; font-weight: 600; letter-spacing: -.15px; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-body .card-name-row .pill { flex: none; }
.card-body .card-desc { font-size: 12.5px; color: var(--text-secondary); margin-top: 6px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

[data-theme="dark"] .card-hero { background: radial-gradient(130% 90% at 50% -10%, #1f2a24 0%, #171d19 70%); }
[data-theme="dark"] .card-hero::before { background-image: linear-gradient(to right, rgba(108,233,166,.05) 1px, transparent 1px), linear-gradient(to bottom, rgba(108,233,166,.05) 1px, transparent 1px); }

/* List view — collapse hero to an inline icon, keep info in a row */
.grid.list .card { flex-direction: row; align-items: center; gap: 4px; padding: 0; height: auto; }
.grid.list .card-hero { height: auto; width: auto; flex: none; background: none; border: none; padding: 12px 4px 12px 16px; place-items: center; }
.grid.list .card-hero::before { display: none; }
.grid.list .card-hero .app-ic-hero { width: 42px; height: 42px; border-radius: 12px; box-shadow: none; }
.grid.list .card-body { flex: 1; min-width: 0; padding: 12px 16px 12px 8px; }
.grid.list .card-desc { -webkit-line-clamp: 1; margin-top: 3px; }

/* ============================================================
   RESTORE ORIGINAL CARDS  (thumb-tile hero with the app's PNG icon
   centered, name + Live badge + description below). Final layer —
   wins over the interim compact/hero card sections.
   ============================================================ */
.grid { grid-template-columns: repeat(3, minmax(0,1fr)); gap: 18px; align-items: stretch; }
.grid:not(.list) .card { height: 100%; }
.card { padding: 0; display: flex; flex-direction: column; border-radius: 16px; overflow: hidden; border: 1px solid var(--border); background: var(--panel); box-shadow: var(--shadow-sm); }
a.card:not(.compact):hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow-md); }
a.card:not(.compact):active { transform: translateY(-1px); box-shadow: var(--shadow-sm); }

/* interim card scaffolding no longer produced */
.card-hero, .card-body { display: none !important; }

.thumb-wrap { display: block; }
.thumb { aspect-ratio: 16 / 10; }

/* list view — original row layout */
.grid.list { grid-template-columns: 1fr; gap: 8px; }
.grid.list .card { flex-direction: row; align-items: center; gap: 14px; padding: 12px 16px; height: auto; }
.grid.list .thumb-wrap { width: 116px; flex: none; }
.grid.list .thumb { aspect-ratio: 16 / 10; }
.grid.list .meta { padding: 0; border-top: none; flex: 1; }
