/* Symphora app shell: navbar + sidebar. Standalone — no JS framework. */

.app {
  height: 100vh;
  overflow: hidden;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--nav-h) 1fr;
  grid-template-areas: "side nav" "side main";
  background: var(--paper-2);
  transition: grid-template-columns .2s var(--ease);
}
.app[data-sidebar="collapsed"] { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }

/* ====== Navbar =========================================================== */
.nav {
  grid-area: nav;
  display: flex; align-items: center;
  padding: 0 var(--s-4);
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  gap: var(--s-3);
  z-index: 20;
}
.nav__left { display: flex; align-items: center; gap: var(--s-3); }
.nav__search { flex: 1; max-width: 480px; }
.nav__right { margin-left: auto; display: flex; align-items: center; gap: 4px; }

.nav__crumb {
  display: flex; align-items: center; gap: 6px;
  font-size: var(--t-sm); color: var(--ink-3);
}
.nav__crumb > strong { color: var(--ink); font-weight: 500; }

.nav-org {
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 10px;
  border: 1px solid var(--line); background: var(--paper);
  border-radius: var(--r-md);
  font-size: var(--t-sm); font-weight: 500;
  color: var(--ink);
  cursor: pointer;
}
.nav-org:hover { background: var(--paper-2); }
.nav-org-wrap { position: relative; display: inline-flex; }

/* Popover (org menu / profile menu) */
.popover {
  position: absolute;
  top: calc(100% + 6px); right: 0;
  min-width: 280px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  z-index: 50;
  display: none;
  overflow: hidden;
}
.popover[data-open="true"] { display: block; }
.popover__org {
  display: flex; align-items: center; gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line-2);
}
.popover__org__mark {
  width: 32px; height: 32px; border-radius: var(--r-md);
  background: var(--accent); color: var(--on-accent);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  flex-shrink: 0;
}
.popover__org__name { font-size: 13px; font-weight: 600; }
.popover__org__meta { font-family: var(--font-mono); font-size: 10px; color: var(--ink-3); letter-spacing: 0.06em; text-transform: uppercase; margin-top: 2px; }
.popover__group { padding: 6px 0; border-bottom: 1px solid var(--line-2); }
.popover__group:last-child { border-bottom: 0; }
.popover__group__label {
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-3); padding: 4px 14px;
}
.popover__item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px;
  font-size: 13px; color: var(--ink);
  text-decoration: none;
  cursor: pointer;
}
.popover__item:hover { background: var(--paper-2); }
.popover__item[aria-current="page"] { background: var(--paper-2); font-weight: 500; }
.popover__item__icon { width: 16px; display: inline-flex; color: var(--ink-3); flex-shrink: 0; }
.popover__item__hint { margin-left: auto; font-family: var(--font-mono); font-size: 10px; color: var(--ink-3); }

/* Notification bell + dropdown */
.nav-bell-wrap { position: relative; display: inline-flex; }
.popover--notif { width: 340px; }
.notif-pop__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--line-2);
}
.notif-pop__title { font-size: 13px; font-weight: 600; }
.notif-pop__read { font-size: 12px; color: var(--accent-ink); font-weight: 500; }
.notif-pop__read:hover { text-decoration: underline; }
.notif-pop__list { max-height: 360px; overflow-y: auto; }
.notif-pop__row {
  display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: center;
  padding: 11px 14px; border-bottom: 1px solid var(--line-2);
  text-decoration: none; color: inherit; cursor: pointer;
}
.notif-pop__row:last-child { border-bottom: 0; }
.notif-pop__row:hover { background: var(--paper-2); }
.notif-pop__row[data-unread="true"] { background: var(--accent-soft); }
.notif-pop__row[data-unread="true"]:hover { background: oklch(from var(--accent-soft) calc(l - 0.02) c h); }
.notif-pop__ico {
  width: 28px; height: 28px; border-radius: var(--r-md);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.notif-pop__ico--leave { background: var(--accent-soft); color: var(--accent-ink); }
.notif-pop__ico--pay { background: var(--good-soft); color: var(--good-ink); }
.notif-pop__ico--policy { background: var(--warn-soft); color: var(--warn-ink); }
.notif-pop__ico--asset { background: var(--paper-3); color: var(--ink-2); }
.notif-pop__body { min-width: 0; }
.notif-pop__row-title { display: block; font-size: 13px; font-weight: 500; line-height: 1.3; }
.notif-pop__row-meta { display: block; font-family: var(--font-mono); font-size: 10px; color: var(--ink-3); margin-top: 2px; }
.notif-pop__dot { width: 7px; height: 7px; border-radius: 99px; background: var(--accent); flex-shrink: 0; }
.notif-pop__foot {
  display: block; text-align: center; padding: 11px 14px;
  font-size: 13px; font-weight: 500; color: var(--accent-ink);
  border-top: 1px solid var(--line-2); text-decoration: none;
}
.notif-pop__foot:hover { background: var(--paper-2); }
.nav-org__mark {
  width: 18px; height: 18px; border-radius: var(--r-sm);
  background: var(--accent); color: var(--on-accent);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700;
}

.nav__divider { width: 1px; height: 22px; background: var(--line); margin: 0 6px; }

.icon-btn {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-2); border-radius: var(--r-md);
  position: relative;
  transition: background .12s var(--ease), color .12s var(--ease);
}
.icon-btn:hover { background: var(--paper-2); color: var(--ink); }
.icon-btn__dot {
  position: absolute; top: 7px; right: 7px;
  width: 6px; height: 6px; border-radius: 99px;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--paper);
}

.profile-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 10px 0 4px;
  border-radius: 99px;
}
.profile-btn:hover { background: var(--paper-2); }
.profile-btn__name { font-size: var(--t-sm); font-weight: 500; }

/* ====== Sidebar ========================================================== */
.side {
  grid-area: side;
  background: var(--paper);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: var(--s-3) 10px;
  overflow: hidden;
  z-index: 21;
}
.side__head {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 8px 12px;
}
.app[data-sidebar="collapsed"] .side__head { padding: 4px 0 12px; justify-content: center; }
.app[data-sidebar="collapsed"] .wordmark { font-size: 0; }
.app[data-sidebar="collapsed"] .wordmark::after { font-size: 24px; }

.app-switch {
  display: flex; gap: 2px;
  padding: 3px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  margin-bottom: var(--s-3);
}
.app-switch__btn {
  flex: 1; padding: 5px 4px;
  border-radius: var(--r-sm);
  font-size: var(--t-sm); font-weight: 500;
  color: var(--ink-3);
}
.app-switch__btn[aria-current="page"] {
  background: var(--paper); color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.app[data-sidebar="collapsed"] .app-switch { display: none; }

.side__nav { flex: 1; overflow-y: auto; overflow-x: hidden; }
.side__nav::-webkit-scrollbar { width: 0; }

.nav-group { margin-bottom: 14px; }
.nav-group__label {
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 0.08em;
  color: var(--ink-3); text-transform: uppercase;
  padding: 0 8px 6px;
}
.app[data-sidebar="collapsed"] .nav-group__label { display: none; }
.app[data-sidebar="flat"] .nav-group__label { display: none; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px;
  border-radius: var(--r-md);
  font-size: var(--t-base);
  color: var(--ink-2);
  text-decoration: none;
  cursor: pointer;
  position: relative;
  transition: background .12s var(--ease), color .12s var(--ease);
}
.nav-item:hover { background: var(--paper-2); color: var(--ink); }
.nav-item[aria-current="page"] {
  background: var(--ink); color: var(--paper);
  font-weight: 500;
}
.nav-item[aria-current="page"] .nav-item__icon { color: var(--paper); }
.nav-item__icon { flex-shrink: 0; color: var(--ink-2); display: inline-flex; }
.nav-item__label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item__badge {
  font-family: var(--font-mono);
  font-size: 10px; padding: 1px 6px;
  border-radius: 99px;
  background: var(--paper-2); color: var(--ink-2);
}
.nav-item[aria-current="page"] .nav-item__badge { background: oklch(1 0 0 / 0.16); color: var(--paper); }

/* Collapsed: hide labels, center icons */
.app[data-sidebar="collapsed"] .nav-item__label,
.app[data-sidebar="collapsed"] .nav-item__badge { display: none; }
.app[data-sidebar="collapsed"] .nav-item {
  justify-content: center; width: 40px; height: 40px; padding: 0; margin: 2px auto;
}

.side__foot {
  border-top: 1px solid var(--line-2);
  padding-top: var(--s-3);
  display: flex; gap: 4px;
}
.side__foot .btn { width: 100%; }

/* ====== Main content ===================================================== */
.main {
  grid-area: main;
  overflow-y: auto;
  background: var(--paper-2);
}

/* ====== Mobile =========================================================== */
@media (max-width: 768px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-areas: "nav" "main";
  }
  .side {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 260px;
    transform: translateX(-100%);
    transition: transform .25s var(--ease);
    box-shadow: var(--shadow-lg);
  }
  .app[data-sidebar="open"] .side { transform: translateX(0); }
  .nav__crumb { display: none; }
  .nav__search { max-width: none; }
}

/* ====== Mobile-nav scrim ================================================== */
.scrim {
  display: none;
  position: fixed; inset: 0;
  background: oklch(0.18 0.01 260 / 0.4);
  z-index: 19;
}
@media (max-width: 768px) {
  .app[data-sidebar="open"] .scrim { display: block; }
}

/* ====== Command palette (overlay) ======================================== */
.cmdk {
  position: fixed; inset: 0;
  background: oklch(0.18 0.01 260 / 0.4);
  z-index: 50;
  display: none;
  align-items: flex-start; justify-content: center;
  padding-top: 12vh;
}
.cmdk[data-open="true"] { display: flex; }
.cmdk__panel {
  width: min(560px, 92vw);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.cmdk__input {
  width: 100%; height: 48px;
  padding: 0 18px;
  background: transparent; border: 0; border-bottom: 1px solid var(--line-2);
  outline: none; font-size: var(--t-md); color: var(--ink);
}
.cmdk__list { max-height: 50vh; overflow-y: auto; padding: 8px; }
.cmdk__group-label { padding: 8px 10px 4px; font-family: var(--font-mono); font-size: 10px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.08em; }
.cmdk__item {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 10px; border-radius: var(--r-md);
  font-size: var(--t-base); color: var(--ink-2);
}
.cmdk__item:hover, .cmdk__item[data-active="true"] { background: var(--paper-2); color: var(--ink); }
.cmdk__item__shortcut { margin-left: auto; font-family: var(--font-mono); font-size: 10px; color: var(--ink-3); }

/* ====== Tweaks panel ===================================================== */
.tweaks-btn {
  position: fixed; bottom: 16px; right: 16px;
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 14px;
  background: var(--ink); color: var(--paper);
  border-radius: var(--r-full);
  font-size: var(--t-sm); font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 40;
}
.tweaks {
  position: fixed; bottom: 16px; right: 16px;
  width: 280px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  z-index: 40;
  overflow: hidden;
  display: none;
}
.tweaks[data-open="true"] { display: block; }
.tweaks__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid var(--line-2);
}
.tweaks__title { font-size: var(--t-sm); font-weight: 600; }
.tweaks__body { padding: 12px 14px; display: flex; flex-direction: column; gap: 14px; max-height: 60vh; overflow-y: auto; }
.tweaks__row { display: flex; flex-direction: column; gap: 6px; }
.tweaks__label { font-size: var(--t-xs); font-weight: 500; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em; }
.tweaks__swatches { display: flex; gap: 6px; }
.tweaks__swatch {
  width: 22px; height: 22px; border-radius: 99px;
  border: 2px solid transparent;
  cursor: pointer;
}
.tweaks__swatch[aria-pressed="true"] { border-color: var(--ink); }

/* ====== Modal / dialog =================================================== */
.modal {
  position: fixed; inset: 0;
  background: oklch(0.18 0.01 260 / 0.42);
  z-index: 60;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 10vh 16px 16px;
  opacity: 0; pointer-events: none;
  transition: opacity .16s var(--ease);
}
.modal[data-open="true"] { opacity: 1; pointer-events: auto; }
.modal__panel {
  width: min(520px, 96vw);
  max-height: 84vh;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-2xl);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  overflow: hidden;
  transform: translateY(8px) scale(0.99);
  transition: transform .18s var(--ease);
}
.modal[data-size="lg"] .modal__panel { width: min(760px, 96vw); }
.modal[data-open="true"] .modal__panel { transform: translateY(0) scale(1); }
.modal__head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line-2);
}
.modal__title { font-size: var(--t-lg); font-weight: 600; letter-spacing: -0.01em; }
.modal__sub { font-size: var(--t-sm); color: var(--ink-3); margin-top: 3px; }
.modal__x {
  width: 28px; height: 28px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-md); color: var(--ink-3);
}
.modal__x:hover { background: var(--paper-2); color: var(--ink); }
.modal__body { padding: 18px 20px; overflow-y: auto; }
.modal__foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  padding: 14px 20px; border-top: 1px solid var(--line-2);
  background: var(--paper);
}
.modal__foot .spacer { flex: 1; }

/* Form fields inside modals */
.form-grid { display: grid; gap: 14px; }
.form-grid--2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 520px) { .form-grid--2 { grid-template-columns: 1fr; } }
.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row--span { grid-column: 1 / -1; }
.form-row > label { font-size: var(--t-sm); font-weight: 500; color: var(--ink-2); }
.form-row__hint { font-size: var(--t-xs); color: var(--ink-3); }

/* ====== Dropdown menu (row actions etc.) ================================= */
.menu {
  position: fixed;
  min-width: 180px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  padding: 5px;
  z-index: 70;
  opacity: 0; transform: scale(0.97); transform-origin: top right;
  pointer-events: none;
  transition: opacity .12s var(--ease), transform .12s var(--ease);
}
.menu[data-open="true"] { opacity: 1; transform: scale(1); pointer-events: auto; }
.menu__item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 7px 10px; border-radius: var(--r-md);
  font-size: var(--t-base); color: var(--ink-2); text-align: left;
  white-space: nowrap;
}
.menu__item:hover { background: var(--paper-2); color: var(--ink); }
.menu__item__icon { display: inline-flex; color: var(--ink-3); }
.menu__item--danger { color: var(--bad-ink); }
.menu__item--danger:hover { background: var(--bad-soft); }
.menu__item--danger .menu__item__icon { color: var(--bad-ink); }
.menu__sep { height: 1px; background: var(--line-2); margin: 5px 0; }
.menu__label { padding: 6px 10px 3px; font-family: var(--font-mono); font-size: 10px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.07em; }

/* Toast stack */
.toast-host { position: fixed; bottom: 24px; right: 24px; z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast-host .toast { position: static; }
.toast__icon { display: inline-flex; }
.toast--good .toast__icon { color: var(--good); }
.toast--bad .toast__icon { color: var(--bad); }

/* ====== Audience picker (shared: announcements, policies, allowances) ==== */
.aud-seg { display: flex; gap: 4px; padding: 3px; background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--r-md); }
.aud-seg__btn { flex: 1; padding: 7px 8px; border-radius: var(--r-sm); font-size: 13px; color: var(--ink-3); text-align: center; white-space: nowrap; transition: background .12s var(--ease), color .12s var(--ease); }
.aud-seg__btn[aria-pressed="true"] { background: var(--paper); color: var(--ink); box-shadow: var(--shadow-sm); font-weight: 500; }
.aud-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.aud-chip { display: inline-flex; align-items: center; gap: 7px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 99px; font-size: 13px; color: var(--ink-2); cursor: pointer; transition: border-color .12s var(--ease), background .12s var(--ease), color .12s var(--ease); }
.aud-chip:hover { border-color: var(--ink-4); }
.aud-chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.aud-chip__n { font-family: var(--font-mono); font-size: 11px; opacity: 0.65; }
.aud-count { display: flex; align-items: center; gap: 8px; padding: 11px 14px; background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--r-md); font-size: 13px; }
.aud-count b { font-family: var(--font-mono); }
.aud-suggest { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
