:root {
  --bg: #0f1419;
  --bg-elevated: #1a2332;
  --bg-card: #1e2a3a;
  --bg-hover: #243447;
  --border: #2d3f54;
  --text: #e8eef4;
  --text-muted: #9fb0c6; /* Round 9: 5.7:1 on cards (was 4.5) */
  --primary: #2d8cff;
  --primary-dim: #1a5fad;
  --accent: #00c9a7;
  --warning: #f5a623;
  --danger: #f07474;
  --success: #3ecf8e;
  --personal: #7c6af7;
  --business: #00b4d8;
  --community: #f4a261;
  --radius: 14px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  --nav-h: 64px;
  --header-h: 56px;
  --max: 480px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --motion: 180ms cubic-bezier(0.22, 1, 0.36, 1);
  --motion-slow: 320ms cubic-bezier(0.22, 1, 0.36, 1);
  --scroll-track: #151c27;
  --scroll-thumb: #8fa4c0;
  --scroll-thumb-hover: #c2d2e6;
  /* Round 41: theme-aware chart colours (dashboard SVGs read these) */
  --chart-axis: #b8c6d8;
  --chart-label: #e8eef4;
  --chart-grid: #3a4e66;
  --chart-bar: #5aa9ff;
  --chart-in: #3ecf8e;
  --chart-out: #f07474;
  --chart-line: #f5c451;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  overflow-x: hidden;
  scrollbar-gutter: stable;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font);
  background: radial-gradient(ellipse at top, #1a2740 0%, var(--bg) 55%);
  color: var(--text);
  line-height: 1.45;
  scrollbar-width: auto;
  scrollbar-color: var(--scroll-thumb) var(--scroll-track);
}

html::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar,
.account-dropdown::-webkit-scrollbar,
.proto-options::-webkit-scrollbar,
.proto-hide::-webkit-scrollbar,
.opt-sheet::-webkit-scrollbar {
  width: 11px;
  height: 11px;
}
html::-webkit-scrollbar-track,
.table-wrap::-webkit-scrollbar-track,
.account-dropdown::-webkit-scrollbar-track,
.proto-options::-webkit-scrollbar-track,
.proto-hide::-webkit-scrollbar-track,
.opt-sheet::-webkit-scrollbar-track {
  background: var(--scroll-track);
  border-radius: 8px;
}
html::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb,
.account-dropdown::-webkit-scrollbar-thumb,
.proto-options::-webkit-scrollbar-thumb,
.proto-hide::-webkit-scrollbar-thumb,
.opt-sheet::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border-radius: 8px;
  border: 2px solid var(--scroll-track);
  min-height: 36px;
}
html::-webkit-scrollbar-thumb:hover,
.table-wrap::-webkit-scrollbar-thumb:hover,
.account-dropdown::-webkit-scrollbar-thumb:hover,
.proto-options::-webkit-scrollbar-thumb:hover,
.proto-hide::-webkit-scrollbar-thumb:hover,
.opt-sheet::-webkit-scrollbar-thumb:hover {
  background: var(--scroll-thumb-hover);
}

a {
  color: var(--primary);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.app-shell {
  max-width: var(--max);
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(26, 39, 64, 0.5) 0%, var(--bg) 120px);
  box-shadow: var(--shadow);
  position: relative;
  padding-bottom: calc(var(--nav-h) + 16px);
}

/* Desktop widen slightly for ERP */
@media (min-width: 900px) {
  :root {
    --max: 960px;
  }
  .app-shell {
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }
}

/* Header */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  background: rgba(15, 20, 25, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-back {
  flex: 0 0 auto;
  height: 36px;
  max-width: 28%;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-back:hover {
  background: var(--bg-hover);
  text-decoration: none;
}
.topbar .brand {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  color: var(--text);
  text-decoration: none;
  flex: 0 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 22%;
}
.topbar-spacer {
  flex: 1;
}
.topbar-search {
  flex: 1 1 160px;
  min-width: 120px;
  max-width: 420px;
  margin: 0 8px;
}
.topbar-search input {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
}
.topbar-search input::placeholder {
  color: var(--text-muted);
}

.topbar .brand span {
  color: var(--accent);
}

.profile-menus {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 1;
  min-width: 0;
}
.profile-menu {
  position: relative;
}
.profile-trigger {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.profile-trigger.personal.on {
  color: #fff;
  background: var(--personal);
  border-color: transparent;
}
.profile-trigger.business.on {
  color: #042430;
  background: var(--business);
  border-color: transparent;
}
.profile-trigger.personal:not(.on) {
  color: #fff;
  background: var(--personal);
  border-color: transparent;
}
.profile-trigger.business:not(.on) {
  color: #042430;
  background: var(--business);
  border-color: transparent;
}
.profile-dropdown {
  display: none;
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  min-width: 190px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 70;
}
.profile-menu:hover .profile-dropdown,
.profile-menu:focus-within .profile-dropdown,
.profile-menu.open .profile-dropdown {
  display: block;
}
.profile-dropdown a {
  display: block;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
}
.profile-dropdown a:hover {
  background: var(--bg-hover);
  text-decoration: none;
}

.pill {
  font-size: 0.65rem;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--bg-elevated);
  white-space: nowrap;
}
.pill.on {
  color: #fff;
  border-color: transparent;
}
.pill.personal.on {
  background: var(--personal);
}
.pill.business.on {
  background: var(--business);
}

.header-login {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.2;
}
.header-login:hover {
  text-decoration: none;
  filter: brightness(1.08);
}
.header-login.personal {
  color: #fff;
  background: var(--personal);
  border-color: transparent;
}
.header-login.business {
  color: #042430;
  background: var(--business);
  border-color: transparent;
}

.password-field {
  position: relative;
}
.password-field input {
  padding-right: 72px;
}
input.secret-input {
  -webkit-text-security: disc;
}
input.secret-input.is-revealed {
  -webkit-text-security: none;
}
.password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
}
.password-toggle:hover {
  color: var(--text);
  background: var(--bg-hover);
}
}

/* Account menu (logout) */
.account-menu {
  position: relative;
  flex-shrink: 0;
}
.account-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.account-btn:hover,
.account-btn[aria-expanded="true"] {
  border-color: var(--primary);
  background: var(--bg-hover);
}
.account-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 220px;
  max-width: min(320px, calc(100vw - 24px));
  max-height: min(420px, calc(100dvh - var(--header-h) - var(--nav-h) - 24px));
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 60;
  scrollbar-width: auto;
  scrollbar-color: var(--scroll-thumb) var(--scroll-track);
}
.account-dropdown[hidden] {
  display: none !important;
}
body.template-phone .account-dropdown {
  min-width: 240px;
}
.account-dropdown a,
.account-dropdown .opt-row {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-decoration: none;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.account-dropdown a:hover,
.account-dropdown .opt-row:hover {
  background: var(--bg-hover);
  text-decoration: none;
}

.opt-sheet {
  position: relative;
  z-index: 80;
  margin: 10px 12px 0;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  max-height: min(70vh, 560px);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.opt-sheet[hidden] {
  display: none !important;
}
.opt-sheet-form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}
.opt-sheet-head {
  font-weight: 700;
  margin-bottom: 10px;
  flex: 0 0 auto;
}
.opt-sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 2px;
}
.opt-sheet-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
  flex: 0 0 auto;
  padding-top: 8px;
}
.opt-reset,
.opt-close,
.opt-apply {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 10px 8px;
  border: 0;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  color: #fff;
}
.opt-reset { background: #c62828; color: #fff; }
.opt-close { background: #ef6c00; color: #fff; }
.opt-apply { background: #7cb342; color: #111; }
.opt-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  color: var(--text);
}
.opt-sheet .opt-row {
  display: block;
  padding: 10px 8px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}
body.template-phone .opt-sheet,
body.template-proto .opt-sheet {
  margin: 8px;
  max-height: calc(100% - var(--header-h) - var(--nav-h) - 24px);
}
body.template-proto .opt-sheet {
  background: #ececec;
  color: #111;
}
.listing-card.hide-origin [data-attr="origin"],
.listing-card.hide-reviews [data-attr="reviews"],
.listing-card.hide-pricing [data-attr="pricing"],
.listing-card.hide-pack [data-attr="pack"] {
  display: none !important;
}

/* Arrange / hide department tiles — all templates */
.tile-panel {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--header-h);
  bottom: var(--nav-h);
  z-index: 85;
  background: var(--bg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.tile-panel[hidden] {
  display: none !important;
}
.tile-panel form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}
.tile-panel-bar {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 6px;
  align-items: center;
  padding: 8px 10px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  flex: 0 0 auto;
}
.tile-panel-hint {
  margin: 0;
  padding: 8px 12px 4px;
  font-size: 0.78rem;
  color: var(--text-muted);
  flex: 0 0 auto;
}
.proto-hide-cancel,
.proto-hide-save,
.tile-reset {
  border: 0;
  color: #fff;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}
.proto-hide-cancel {
  background: #c62828;
}
.proto-hide-save {
  background: var(--success);
  color: #0b1a12;
}
.proto-hide-list {
  padding: 6px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}
.proto-hide-row {
  display: grid;
  grid-template-columns: 22px 72px 1fr auto;
  gap: 6px;
  align-items: center;
  margin: 0;
  cursor: grab;
}
.proto-hide-row.is-dragging {
  opacity: 0.45;
}
.proto-hide-row.drag-over {
  outline: 1px dashed var(--primary);
}
.drag-grip {
  color: var(--text-muted);
  letter-spacing: -2px;
  font-size: 0.85rem;
  user-select: none;
}
.proto-hide-row.is-header {
  grid-template-columns: 22px 88px 1fr auto;
  margin-top: 8px;
}
.proto-hide-row.is-header .proto-hide-name {
  background: var(--bg-card);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.72rem;
}
.proto-hide-row.header-off {
  opacity: 0.4;
}
.header-remove {
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  border-radius: 6px;
  font-size: 0.68rem;
  padding: 4px 8px;
  cursor: pointer;
  font-family: inherit;
}
.arrange-foot {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.add-header {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.add-header select {
  flex: 1;
  min-width: 120px;
}
.proto-hide-flag {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text);
}
.proto-hide-flag input {
  width: 20px;
  height: 20px;
  accent-color: #c62828;
}
.proto-hide-flag .off {
  background: #c62828;
  color: #fff;
  padding: 1px 6px;
  border-radius: 2px;
  opacity: 0.28;
}
.proto-hide-row:has(input:checked) .off {
  opacity: 1;
}
.proto-hide-row:has(input:checked) .proto-hide-name {
  opacity: 0.45;
}
.tile-panel .thumb {
  display: block;
  width: 40px;
  height: 32px;
  background: #fff;
  border: 1px solid var(--border);
  overflow: hidden;
  border-radius: 3px;
}
.tile-panel .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.proto-hide-name {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 0 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-weight: 700;
  color: var(--text);
}
.tile-move {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dept-move {
  width: 32px;
  height: 20px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.62rem;
  line-height: 1;
  cursor: pointer;
}
.dept-move:hover {
  background: var(--bg-hover);
  border-color: var(--primary);
}
.tile-panel-foot {
  padding: 8px 10px 12px;
  flex: 0 0 auto;
  border-top: 1px solid var(--border);
}
.tile-reset {
  width: 100%;
  background: var(--bg-hover);
  color: var(--text);
  border: 1px solid var(--border);
}

/* Main */
.main {
  flex: 1;
  padding: 16px 14px 24px;
  position: relative;
}

.page-title {
  margin: 0 0 4px;
  font-size: 1.45rem;
  font-weight: 700;
}
.page-sub {
  margin: 0 0 18px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}
.card h2,
.card h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}
.card p {
  margin: 0 0 10px;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.card p:last-child {
  margin-bottom: 0;
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 700px) {
  .card-grid.cols-2 {
    grid-template-columns: 1fr 1fr;
  }
  .card-grid.cols-3 {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

.dept-grid,
.dept-stack {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (min-width: 700px) {
  .dept-grid,
  .dept-stack {
    grid-template-columns: 1fr 1fr 1fr;
  }
}
.dept-band {
  grid-column: 1 / -1;
  margin: 8px 0 0;
  padding: 2px 2px 0;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.dept-band.specialist {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.dept-tile {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s, background 0.15s;
  min-height: 110px;
}
.dept-tile:hover {
  border-color: var(--business);
  background: var(--bg-hover);
  text-decoration: none;
  transform: translateY(-1px);
}
.dept-tile .icon {
  font-size: 1.5rem;
}
.dept-tile .name {
  font-weight: 600;
  font-size: 0.9rem;
}
.dept-tile .desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.home-tiles {
  display: grid;
  gap: 12px;
}
.home-tile {
  display: block;
  padding: 20px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.15s, border-color 0.15s;
}
.home-tile:hover {
  transform: translateY(-2px);
  text-decoration: none;
}
.home-tile.personal {
  border-left: 4px solid var(--personal);
}
.home-tile.business {
  border-left: 4px solid var(--business);
}
.home-tile.community {
  border-left: 4px solid var(--community);
}
.home-tile h2 {
  margin: 0;
  font-size: 1.15rem;
}
body.template-phone .home-tile,
body.template-wide .home-tile {
  padding: 16px 18px;
}
.home-tile p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
}
.home-tile .label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

/* Forms */
label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 4px;
  margin-top: 10px;
}
input,
select,
textarea {
  width: 100%;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--primary-dim);
  border-color: var(--primary);
}
textarea {
  min-height: 80px;
  resize: vertical;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  transition: filter 0.15s, transform 0.1s;
}
.btn:hover {
  filter: brightness(1.08);
  text-decoration: none;
}
.btn:active {
  transform: scale(0.98);
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-accent {
  background: var(--accent);
  color: #06241f;
}
.btn-business {
  background: var(--business);
  color: #042430;
}
.btn-personal {
  background: var(--personal);
  color: #fff;
}
.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-sm {
  padding: 7px 11px;
  font-size: 0.8rem;
}
.btn-block {
  width: 100%;
}
.profile-add-row {
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.profile-add {
  align-self: flex-start;
  width: auto;
}
.profile-add-plus {
  font-size: 1.15em;
  font-weight: 700;
  line-height: 1;
}

/* Lists */
.list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.list li:last-child {
  border-bottom: none;
}
.list li:has(.is-online) {
  padding-bottom: 14px;
}
.list .meta {
  flex: 1;
  min-width: 0;
}
.list .meta strong {
  display: block;
  font-size: 0.95rem;
}
.list .meta small {
  display: block;
  color: var(--text-muted);
  font-size: 0.78rem;
}
.inward-phase {
  font-weight: 700;
  color: var(--business);
}
.profile-enter {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
.profile-enter:hover {
  text-decoration: none;
}
.profile-enter:hover .meta strong {
  color: var(--personal);
}
.profile-enter:has(.avatar.biz):hover .meta strong {
  color: var(--business);
}
form.profile-remove {
  margin: 0;
  display: flex;
  flex-shrink: 0;
}
.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
}
.btn-icon:hover,
.btn-icon:focus-visible {
  color: var(--danger);
  border-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  text-decoration: none;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--personal), var(--primary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
  position: relative;
  overflow: visible;
}
.avatar.biz {
  background: linear-gradient(135deg, var(--business), var(--accent));
}
.avatar.is-online {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--success) 55%, transparent);
}
.avatar .online-flag {
  position: absolute;
  left: 50%;
  bottom: -6px;
  transform: translateX(-50%);
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 999px;
  background: var(--success);
  color: #04210f;
  white-space: nowrap;
}

.badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-hover);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.badge.public,
.badge.guest,
.badge.everyone {
  color: var(--success);
  border-color: rgba(62, 207, 142, 0.35);
}
.badge.personal {
  color: var(--personal);
  border-color: rgba(124, 106, 247, 0.4);
}
.badge.workplace {
  color: var(--warning);
  border-color: rgba(245, 166, 35, 0.4);
}
.badge.status {
  color: var(--business);
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  margin: 8px 0;
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
table.data th,
table.data td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
table.data.chembox th,
table.data.chembox td {
  white-space: normal;
  vertical-align: top;
}
table.data.chembox tr.chembox-h th {
  background: var(--bg-hover);
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.chembox-pics {
  display: flex;
  gap: 8px;
  margin: 0 0 10px;
}
.chembox-pics img,
img.chembox-hero {
  max-width: 100%;
  max-height: 140px;
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
  flex: 1;
}

/* Flash — overlay the screen. Zero height so tiles do not jump when it appears or leaves. */
.flashes {
  position: absolute;
  top: calc(var(--header-h) + 8px);
  left: 10px;
  right: 10px;
  z-index: 70;
  height: 0;
  margin: 0;
  padding: 0;
  overflow: visible;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}
.flash {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 11px 12px;
  border-radius: 12px;
  margin: 0;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.35;
  color: #f4f7fb;
  border: 0;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  transform: translateY(0);
  animation: toast-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.flash::before {
  content: "";
  flex: 0 0 7px;
  width: 7px;
  min-height: 1.2em;
  margin-top: 2px;
  border-radius: 99px;
  background: currentColor;
  opacity: 0.9;
}
.flash.is-out {
  animation: toast-out 0.34s cubic-bezier(0.4, 0, 1, 1) forwards;
  pointer-events: none;
}
.flash.success {
  background: #14532d;
  color: #d8ffe8;
}
.flash.success::before {
  background: #4ade80;
}
.flash.error {
  background: #7f1d1d;
  color: #ffe1e1;
}
.flash.error::before {
  background: #fb7185;
}
.flash.warning {
  background: #7c4a0e;
  color: #ffefc9;
}
.flash.warning::before {
  background: #fbbf24;
}
.flash.info,
.flash.message {
  background: #1e3a5f;
  color: #dbeafe;
}
.flash.info::before,
.flash.message::before {
  background: #60a5fa;
}

.inapp-notice {
  padding: 12px 14px;
  border-radius: var(--radius);
  margin-bottom: 14px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  font-size: 0.88rem;
}
.inapp-notice strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
}
.inapp-notice span {
  color: var(--text-muted);
}
.inapp-notice.warning {
  background: rgba(245, 166, 35, 0.12);
  border-color: rgba(245, 166, 35, 0.4);
}
.inapp-notice.info {
  background: rgba(45, 140, 255, 0.10);
  border-color: rgba(45, 140, 255, 0.3);
}

/* Bottom nav */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--max);
  height: var(--nav-h);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: rgba(15, 20, 25, 0.96);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  z-index: 50;
}
.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 600;
}
.bottom-nav a .nav-icon {
  font-size: 1.25rem;
  line-height: 1;
}
.bottom-nav a:hover {
  color: var(--text);
  text-decoration: none;
}
/* Profile context stays on when viewing Community from that profile */
.bottom-nav a.context {
  color: #fff;
  box-shadow: inset 0 -3px 0 #fff;
}
.bottom-nav a.community.here {
  color: #fff;
  box-shadow: inset 0 -3px 0 #fff;
}

/* PIN pad */
.pin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.pin-toolbar .muted,
.pin-toolbar #pin-step-label {
  margin: 0;
}
.pin-shuffle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.pin-shuffle input {
  margin: 0;
  accent-color: var(--personal);
}
.pin-display {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 18px 0;
}
.pin-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
}
.pin-dot.filled {
  background: var(--primary);
  border-color: var(--primary);
}
.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: min(280px, 100%);
  max-width: 280px;
  margin: 0 auto;
}
.pin-pad button {
  aspect-ratio: 1;
  width: 100%;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 600;
  cursor: pointer;
}
.pin-pad button:hover {
  background: var(--bg-hover);
}
.pin-pad button.action {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.pin-who {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 8px;
}
.pin-who .avatar {
  width: 36px;
  height: 36px;
  font-size: 0.75rem;
}
.pin-who .meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.pin-who strong {
  font-size: 0.92rem;
  line-height: 1.2;
}
.pin-who small {
  color: var(--text-muted);
  font-size: 0.72rem;
}
.pin-pad button[data-d],
.pin-pad button[data-digit] {
  transition: background 120ms ease, color 120ms ease;
}

/* Empty / lock */
.lock-banner {
  background: linear-gradient(90deg, rgba(124, 106, 247, 0.15), rgba(0, 180, 216, 0.1));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.lock-banner strong {
  color: var(--text);
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.stat {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
}
.stat .n {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--business);
}
.stat .l {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.notice {
  border-left: 3px solid var(--primary);
  padding: 10px 12px;
  margin-bottom: 8px;
  background: var(--bg-elevated);
  border-radius: 0 10px 10px 0;
}
.notice.warning {
  border-left-color: var(--warning);
}
.notice strong {
  display: block;
  font-size: 0.88rem;
}
.notice span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.muted {
  color: var(--text-muted);
}
.small {
  font-size: 0.8rem;
}
.mt-0 {
  margin-top: 0;
}
.mb-0 {
  margin-bottom: 0;
}
.hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

.search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.search-bar input::placeholder,
.proto-search input::placeholder,
input[type="search"]::placeholder {
  font-size: 0.93rem;
  color: #6b6b6b;
}
.search-bar input {
  flex: 1;
}

.search-wrap {
  position: relative;
  flex: 1;
}
.search-wrap input {
  width: 100%;
}
.suggest-box {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 70;
  max-height: min(70vh, 420px);
  overflow-y: auto;
  padding: 4px;
}
.suggest-box[hidden] {
  display: none !important;
}
.suggest-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  border-radius: 8px;
  cursor: pointer;
}
.suggest-item:hover,
.suggest-item.active {
  background: var(--bg-hover);
}
.suggest-item .s-name {
  font-weight: 600;
}
.suggest-item .s-cat {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.suggest-item.co-item {
  align-items: flex-start;
  flex-direction: column;
  gap: 2px;
}
.suggest-item.co-item .s-cat {
  white-space: normal;
}
.suggest-item.co-item.is-removed .s-cat {
  color: var(--warning);
}
.suggest-item.co-empty {
  cursor: default;
  color: var(--text-muted);
  font-size: 0.82rem;
}
.suggest-item.suggest-row {
  padding: 0 6px 0 0;
  gap: 4px;
}
.suggest-pick {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 8px 9px 12px;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
}
.suggest-add {
  flex: none;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 8px;
  cursor: pointer;
}
.suggest-add:disabled,
.suggest-add.is-added {
  color: var(--text-muted);
  cursor: default;
}
.dept-tile .name .count {
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}
.listing-filter[hidden] {
  display: none !important;
}
.btn[disabled],
.btn:disabled {
  opacity: 0.55;
  cursor: default;
}
.crumbs {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  width: 100%;
  font-weight: 650;
}
.crumbs a {
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}
.crumb-root {
  font-size: 1rem;
  line-height: 1;
}
.crumb-sep {
  color: var(--text-muted);
  font-weight: 500;
}
.crumb.current {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body.template-wide .crumbs {
  margin: 0 0 10px;
  font-size: 0.92rem;
}
.order-steps {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.order-step {
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 10px;
  align-items: start;
}
.order-step .dot {
  width: 10px;
  height: 10px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--border);
}
.order-step.done .dot,
.order-step.now .dot {
  background: var(--accent);
}
.order-step.now strong {
  color: var(--accent);
}
.order-step.now .dot {
  box-shadow: 0 0 0 0 rgba(0, 201, 167, 0.55);
  animation: step-pulse 1.4s ease-out infinite;
}
.status-flow-steps li.now .mark {
  animation: step-pulse 1.4s ease-out infinite;
}
@keyframes step-pulse {
  0% { box-shadow: 0 0 0 0 rgba(0, 201, 167, 0.55); }
  100% { box-shadow: 0 0 0 8px rgba(0, 201, 167, 0); }
}
.order-step.wait {
  color: var(--text-muted);
}
.co-picked {
  margin: 6px 0 12px;
}
.co-picked.is-removed {
  color: var(--warning);
}

.provider-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.provider-list li {
  animation: id-rise 0.45s var(--motion-slow) both;
  animation-delay: calc(var(--i, 0) * 70ms);
}
.provider-list .provider-rule {
  height: 0;
  margin: 4px 6px;
  padding: 0;
  border: 0;
  border-top: 1px solid var(--border);
  animation: none;
  pointer-events: none;
}
.verify-block {
  margin: 0 0 16px;
}
.verify-bar {
  display: block;
  margin: 0 0 10px;
  padding: 7px 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: center;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.verify-note {
  margin: 0 0 8px;
  color: var(--text-muted);
  font-size: 0.75rem;
  line-height: 1.4;
}
.verify-tags {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 10px;
  margin: 6px 0 0 8px;
  padding: 0;
}
.verify-tags li {
  position: relative;
  padding: 0 0 0 12px;
  font-size: 0.72rem;
  color: var(--text-muted);
  animation: none;
}
.verify-tags li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-muted);
}
.provider-more {
  margin: 0;
}
.provider-more summary {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 4px;
}
.provider-more .provider-btn {
  margin-top: 6px;
}
button.provider-btn {
  width: 100%;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.provider-btn.x .provider-ico { color: #e8eef4; }
.provider-btn.phone .provider-ico { color: var(--warning); }
.source-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
}
.source-chip-ico .provider-ico {
  width: 1.7rem;
  height: 1.7rem;
  font-size: 0.7rem;
}
.source-chip strong {
  flex: 1;
  font-size: 0.88rem;
}
.biz-create .provider-btn:hover {
  border-color: var(--business);
  box-shadow: 0 0 0 1px rgba(0, 180, 216, 0.35);
}
.provider-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}
.provider-btn small {
  display: block;
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.72rem;
  margin-top: 2px;
}
.provider-btn:hover {
  text-decoration: none;
  background: var(--bg-hover);
  border-color: var(--personal);
  box-shadow: 0 0 0 1px rgba(124, 106, 247, 0.35);
}
.provider-ico {
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  background: var(--bg-hover);
  flex-shrink: 0;
}
.provider-btn.google .provider-ico { color: #8ab4f8; }
.provider-btn.facebook .provider-ico { color: #9ab4ff; }
.provider-btn.linkedin .provider-ico { color: #7ec8e3; }
.provider-btn.email .provider-ico { color: var(--accent); }
.account-links {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}
.account-links li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.account-links li:last-child {
  border-bottom: none;
}
.realme-mark {
  font-weight: 700;
  letter-spacing: -0.03em;
  min-width: 4.2rem;
}
.realme-mark b {
  color: #ff5a6a;
  font-weight: 800;
}
.realme-mark.lg {
  font-size: 1.45rem;
  margin: 4px 0 2px;
}
.id-flow {
  animation: id-rise 0.42s var(--motion-slow) both;
}
.id-lead {
  margin: 0 0 12px;
  color: var(--text-muted);
  font-size: 0.88rem;
}
.id-flow-alt {
  margin-top: 14px;
}
.id-rail {
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 4px;
  margin: 0 0 16px;
  padding: 0;
  position: relative;
}
.id-rail::before {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  top: 4px;
  height: 1px;
  background: var(--border);
  z-index: 0;
}
.id-rail li {
  flex: 1;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.68rem;
  position: relative;
  z-index: 1;
}
.id-rail-dot {
  display: block;
  width: 8px;
  height: 8px;
  margin: 0 auto 6px;
  border-radius: 50%;
  background: var(--border);
}
.id-rail .is-now {
  color: var(--text);
}
.id-rail .is-now .id-rail-dot {
  background: var(--personal);
  box-shadow: 0 0 0 4px rgba(124, 106, 247, 0.25);
  animation: id-pulse 1.6s ease-in-out infinite;
}
.id-rail .is-done .id-rail-dot {
  background: var(--success);
}
.id-toast {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 3px solid var(--personal);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 0 0 14px;
  animation: id-toast-in 0.55s var(--motion-slow) both;
}
.id-toast p {
  margin: 0;
  font-size: 0.86rem;
}
.id-toast-from,
.id-toast-id {
  font-size: 0.68rem;
  color: var(--text-muted);
}
.id-otp {
  display: flex;
  gap: 6px;
  justify-content: space-between;
  margin: 0 0 14px;
}
input.id-otp-box {
  width: 2.35rem;
  max-width: 2.35rem;
  flex: 0 0 2.35rem;
  height: 2.6rem;
  text-align: center;
  font-size: 1.15rem;
  font-weight: 700;
  padding: 0;
  animation: id-rise 0.4s var(--motion-slow) both;
}
.id-otp-box:nth-child(1) { animation-delay: 40ms; }
.id-otp-box:nth-child(2) { animation-delay: 80ms; }
.id-otp-box:nth-child(3) { animation-delay: 120ms; }
.id-otp-box:nth-child(4) { animation-delay: 160ms; }
.id-otp-box:nth-child(5) { animation-delay: 200ms; }
.id-otp-box:nth-child(6) { animation-delay: 240ms; }
.id-otp-box:focus {
  border-color: var(--personal);
  box-shadow: 0 0 0 3px rgba(124, 106, 247, 0.28);
}
.id-scopes {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.id-scopes li {
  padding: 2px 0 2px 18px;
  position: relative;
  color: var(--text);
  font-size: 0.9rem;
  animation: id-rise 0.4s var(--motion-slow) both;
  animation-delay: calc(var(--i, 0) * 90ms);
}
.id-scopes li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.7em;
  width: 6px;
  height: 6px;
  margin-top: 0;
  border: 0;
  border-radius: 50%;
  background: var(--text);
  transform: translateY(-50%);
}
.id-decisions {
  display: flex;
  gap: 8px;
}
.id-decisions .btn {
  flex: 1;
}
.id-progress {
  list-style: none;
  margin: 0;
  padding: 0;
}
.id-progress li {
  padding: 10px 0 10px 32px;
  position: relative;
  color: var(--text-muted);
}
.id-progress li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border);
}
.id-progress li.is-busy::before {
  border-color: var(--personal);
  border-top-color: transparent;
  animation: id-spin 0.7s linear infinite;
}
.id-progress li.is-on {
  color: var(--text);
  font-weight: 600;
}
.id-progress li.is-on::before {
  border-color: var(--success);
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(62, 207, 142, 0.18);
  animation: id-pop 0.28s var(--motion);
}
.id-fetched {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.id-fetched span {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(124, 106, 247, 0.16);
  border: 1px solid rgba(124, 106, 247, 0.35);
  font-size: 0.78rem;
  animation: id-rise 0.35s var(--motion-slow) both;
}
.id-fetched span:nth-child(2) { animation-delay: 80ms; }
.id-fetched span:nth-child(3) { animation-delay: 160ms; }
.id-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  margin: 0 auto 12px;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--personal);
  color: #fff;
  font-weight: 700;
  animation: id-pop 0.4s var(--motion);
}
.id-avatar:not([hidden]) {
  display: flex;
}
.id-fetched[hidden] {
  display: none;
}
@keyframes id-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes id-toast-in {
  from { opacity: 0; transform: translateY(-12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
@keyframes id-pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(124, 106, 247, 0.18); }
  50% { box-shadow: 0 0 0 7px rgba(124, 106, 247, 0.08); }
}
@keyframes id-spin {
  to { transform: rotate(360deg); }
}
@keyframes id-pop {
  0% { transform: scale(0.6); }
  70% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.chip {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 0.78rem;
  text-decoration: none;
}
.chip.active,
.chip:hover {
  border-color: var(--community);
  color: var(--text);
  text-decoration: none;
}

.product-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.product-card .price {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.9rem;
}

.footer-note {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 20px 10px 8px;
}

.contact-toolbar {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}
.contact-toolbar input[type="search"] {
  width: 100%;
  margin-bottom: 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
}
.contact-group-pick label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.72rem;
  color: var(--text-muted);
}
.contact-group-pick select {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
  width: 100%;
}
@media (min-width: 800px) {
  body:not(.template-phone) .contact-toolbar {
    grid-template-columns: 1fr minmax(180px, 0.7fr);
    align-items: end;
  }
}
  font: inherit;
}
.contact-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
}
.contact-card:hover {
  border-color: var(--business);
  background: var(--bg-hover);
  text-decoration: none;
}
.share-depts {
  border: 0;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
}
.share-depts .chk {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  font-size: 0.72rem;
  color: var(--text);
}
.share-depts .chk input {
  width: auto;
}
.contact-logo {
  width: 56px;
  height: 44px;
  flex: 0 0 56px;
  border-radius: 8px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--border);
}
.contact-logo.lg {
  width: 72px;
  height: 56px;
  flex-basis: 72px;
}
.contact-logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.contact-logo .initials {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary-dim);
}
.contact-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.contact-body strong {
  font-size: 0.92rem;
}
.contact-body small {
  color: var(--text-muted);
  font-size: 0.75rem;
  line-height: 1.3;
}
.contact-po {
  color: var(--accent) !important;
}
.contact-hero {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
}
.contact-hero .page-title {
  margin: 0;
}
.contact-hero .page-sub {
  margin: 4px 0 0;
}

.used-here {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--business) 22%, transparent);
  color: var(--business);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  vertical-align: middle;
}
body.template-proto .used-here {
  background: #c8f0f8;
  color: #0b6e84;
}

.sites-map-card .sites-map {
  height: 220px;
  width: 100%;
  margin-top: 8px;
  border-radius: 10px;
  overflow: hidden;
  z-index: 0;
  background: #d7e0ea;
}
@media (min-width: 800px) {
  body:not(.template-phone) .sites-map-card .sites-map {
    height: 320px;
  }
}
.sites-map-card .leaflet-container,
.sites-map-card .leaflet-pane,
.sites-map-card .leaflet-top,
.sites-map-card .leaflet-bottom {
  z-index: 1;
}
.site-pin {
  background: transparent;
  border: 0;
}
.site-pin-dot {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  line-height: 1;
}
.site-pin.preferred .site-pin-dot {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--business) 70%, #fff);
}
.sites-legend-fold {
  margin-top: 8px;
}
.sites-legend-fold summary {
  cursor: pointer;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.sites-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.sites-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
  font-size: 0.72rem;
  cursor: pointer;
}
.sites-legend-item .swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 10px;
}
.sites-legend-item[aria-pressed="false"] {
  opacity: 0.4;
}
.sites-legend-item .used-here {
  margin-left: 0;
}
.site-list .meta small {
  display: block;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.template-switch select {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 5px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  max-width: 118px;
  cursor: pointer;
}

/* Pin the phone in a center column so Admin/Notes cannot shove it sideways
   when they paint (they sit in the HTML after the device). */
body.template-wide .stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, var(--max)) minmax(0, 1fr);
  align-items: start;
  column-gap: 16px;
  padding: 16px;
}
body.template-wide .device {
  grid-column: 2;
  min-height: 100%;
  width: 100%;
  max-width: var(--max);
}

.dev-rails {
  display: flex;
  flex-direction: row;
  gap: 10px;
  align-items: flex-start;
  position: sticky;
  top: 16px;
  align-self: start;
  justify-self: start;
  grid-column: 3;
  max-width: 100%;
  max-height: calc(100vh - 40px);
  z-index: 3;
}
.dev-rail {
  position: relative;
  width: 260px;
  flex: 0 0 260px;
  margin-top: 8px;
  padding: 10px;
  border-radius: 14px;
  background: #1a2332;
  border: 1px solid #2d3f54;
  color: #e8eef4;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: calc(100vh - 40px);
  overflow: auto;
}
.dev-rails.is-ready .dev-rail {
  transition: width 160ms ease, flex-basis 160ms ease, padding 160ms ease;
}
.dev-admin {
  width: 260px;
  flex: 0 0 260px;
}
html.rail-admin-collapsed .dev-admin,
html.rail-notes-collapsed .dev-notes,
html.rail-support-collapsed .dev-support,
.dev-rail.is-collapsed {
  width: 36px;
  flex: 0 0 36px;
  padding: 10px 4px;
  overflow: hidden;
}
html.rail-admin-collapsed .dev-admin .rail-body,
html.rail-notes-collapsed .dev-notes .rail-body,
html.rail-support-collapsed .dev-support .rail-body,
.dev-rail.is-collapsed .rail-body {
  display: none;
}
.rail-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  border: 0;
  background: transparent;
  color: #c5d4e8;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 2px 0 6px;
}
.dev-rail:not(.is-collapsed) .rail-toggle {
  position: absolute;
  top: 8px;
  right: 8px;
  width: auto;
  font-size: 0;
  padding: 4px 6px;
  z-index: 2;
}
.rail-toggle::after {
  content: "◀";
  font-size: 0.7rem;
  color: #8b9cb3;
}
html.rail-admin-collapsed .dev-admin .rail-toggle,
html.rail-notes-collapsed .dev-notes .rail-toggle,
html.rail-support-collapsed .dev-support .rail-toggle,
.dev-rail.is-collapsed .rail-toggle {
  position: static;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  justify-content: center;
  width: 100%;
  font-size: 0.78rem;
  padding: 12px 0;
  letter-spacing: 0.14em;
}
html.rail-admin-collapsed .dev-admin .rail-toggle::after,
html.rail-notes-collapsed .dev-notes .rail-toggle::after,
html.rail-support-collapsed .dev-support .rail-toggle::after,
.dev-rail.is-collapsed .rail-toggle::after {
  content: "";
}
.notes-section {
  border-top: 1px solid #2d3f54;
  padding-top: 8px;
}
.note-live {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #f0c36a;
}
.dev-rail.is-collapsed .rail-toggle[data-todo]:not([data-todo="0"])::before {
  content: attr(data-todo);
  display: inline-block;
  min-width: 1.1em;
  margin: 0 0 6px;
  padding: 1px 4px;
  border-radius: 8px;
  background: #3a2e14;
  color: #f0c36a;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0;
  writing-mode: horizontal-tb;
  transform: none;
  text-align: center;
}
.note-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 6px 0 8px;
}
.note-filter {
  border: 1px solid #2d3f54;
  background: #121922;
  color: #8fa4c0;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 6px;
  border-radius: 999px;
  cursor: pointer;
}
.note-filter.is-on {
  background: #243044;
  color: #e8eef4;
  border-color: #3d5470;
}
.notes-group {
  margin: 0 0 8px;
}
.notes-group > summary {
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8b9cb3;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 0 6px;
}
.notes-group > summary::-webkit-details-marker {
  display: none;
}
.notes-group > summary span {
  color: #c5d4e8;
  font-variant-numeric: tabular-nums;
}
.note-card {
  margin: 0 0 8px;
  padding: 8px 8px 6px;
  border: 1px solid #2d3f54;
  border-radius: 8px;
  background: #121922;
  font-size: 0.74rem;
  line-height: 1.4;
  color: #d7e4f5;
}
.note-card.user.is-here {
  border-color: #3d5a78;
  box-shadow: inset 2px 0 0 #7db0e8;
}
.note-card.kind-task_done p {
  color: #8b9cb3;
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}
.note-card summary {
  cursor: pointer;
  font-weight: 700;
  color: #e8eef4;
}
.note-card p {
  margin: 6px 0 0;
  white-space: pre-wrap;
}
.note-card.user p {
  margin: 0 0 6px;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.note-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.note-chip {
  flex: 0 0 auto;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 999px;
  background: #243044;
  color: #8fa4c0;
}
.note-chip.kind-task_todo {
  background: #3a2e14;
  color: #f0c36a;
}
.note-chip.kind-task_done {
  background: #143a28;
  color: #3ecf8e;
}
.note-chip.kind-note {
  background: #1e2a3c;
  color: #8fa4c0;
}
.note-page {
  font-size: 0.66rem;
  color: #7db0e8;
  text-decoration: none;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.note-page:hover {
  text-decoration: underline;
}
.note-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.note-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.note-kind-form {
  flex: 1 1 auto;
  min-width: 0;
}
.note-kind-form select {
  width: 100%;
  font-size: 0.68rem;
  padding: 3px 4px;
  border-radius: 6px;
  border: 1px solid #2d3f54;
  background: #1a2332;
  color: #e8eef4;
}
.note-del-inline {
  flex: 0 0 auto;
}
.note-kind-pick {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  margin: 4px 0 0;
}
.note-kind-pick label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 1 1 0;
  justify-content: center;
  white-space: nowrap;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #8fa4c0;
  border: 1px solid #2d3f54;
  border-radius: 999px;
  padding: 3px 6px;
  cursor: pointer;
  background: #121922;
}
.note-kind-pick input {
  margin: 0;
  accent-color: #7db0e8;
}
.note-kind-pick label:has(input:checked) {
  color: #e8eef4;
  border-color: #3d5470;
  background: #243044;
}
.note-add textarea {
  width: 100%;
  min-height: 52px;
  font-size: 0.75rem;
  padding: 6px 8px;
  margin: 6px 0;
  border-radius: 8px;
  border: 1px solid #2d3f54;
  background: #121922;
  color: #e8eef4;
}
.note-add .btn {
  width: 100%;
}
.admin-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding-right: 22px;
}
.dev-admin strong {
  font-size: 0.82rem;
}
.dev-admin-who {
  margin: 0;
  font-size: 0.72rem;
  color: #8b9cb3;
  line-height: 1.35;
}
.dev-admin .btn {
  width: 100%;
}
.dev-admin-link {
  font-size: 0.75rem;
  color: #8fa4c0;
  text-decoration: none;
}
.dev-admin-link:hover {
  color: #e8eef4;
  text-decoration: underline;
}
.admin-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
}
.admin-sessions {
  border-top: 1px solid #2d3f54;
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.admin-sessions-label {
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8b9cb3;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.admin-session {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 0.74rem;
}
.admin-session strong {
  display: block;
  font-size: 0.74rem;
}
.admin-session small {
  display: block;
  color: #8b9cb3;
  font-size: 0.66rem;
  word-break: break-all;
}
.admin-filter input {
  width: 100%;
  font-size: 0.75rem;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #2d3f54;
  background: #121922;
  color: #e8eef4;
}
.admin-tree {
  font-size: 0.75rem;
  border-top: 1px solid #2d3f54;
  padding-top: 8px;
}
.admin-tree details {
  margin: 2px 0 2px 8px;
  border-left: 1px solid #2d3f54;
  padding-left: 8px;
}
.admin-tree > details {
  margin-left: 0;
  border-left: 0;
  padding-left: 0;
}
.admin-tree summary {
  cursor: pointer;
  color: #c5d4e8;
  padding: 3px 0;
  list-style: none;
}
.admin-tree summary::-webkit-details-marker {
  display: none;
}
.admin-tree summary::before {
  content: "▸";
  display: inline-block;
  width: 12px;
  color: #8b9cb3;
  font-size: 0.7rem;
}
.admin-tree details[open] > summary::before {
  content: "▾";
}
.admin-tree summary a,
.admin-leaf {
  color: #d7e4f5;
  text-decoration: none;
}
.admin-tree summary a:hover,
.admin-leaf:hover {
  text-decoration: underline;
}
.admin-leaf {
  display: block;
  padding: 2px 0 2px 14px;
  color: #8fa4c0;
}
.admin-leaf.more {
  color: #7db0e8;
}
.admin-live {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #3ecf8e;
}
.admin-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3ecf8e;
  box-shadow: 0 0 0 3px rgba(62, 207, 142, 0.18);
  vertical-align: middle;
}
.admin-you {
  margin-left: 6px;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #7db0e8;
}
.page-title .admin-live {
  font-size: 0.7rem;
  vertical-align: middle;
}
.admin-explorer-tree .admin-tree {
  border-top: 0;
  font-size: 0.85rem;
}
.tree-person.is-hidden,
.tree-org.is-hidden {
  display: none;
}

/* Mobile app + Prototype templates share the portrait phone frame */
body.template-phone,
body.template-proto,
body.is-launcher {
  --max: 390px;
  --phone-w: 390px;
  --phone-h: 844px;
  background: #14161c;
  min-height: 100vh;
  overflow-x: hidden;
}
body.template-phone .stage,
body.template-proto .stage,
body.is-launcher .stage {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--phone-w) minmax(0, 1fr);
  align-items: start;
  column-gap: 18px;
  padding: 28px 16px 40px;
}
body.template-phone .device,
body.template-proto .device,
body.is-launcher .device {
  grid-column: 2;
  width: var(--phone-w);
  height: var(--phone-h);
  max-height: calc(100vh - 48px);
  border-radius: 44px;
  border: 11px solid #0b0c10;
  background: #000;
  box-shadow:
    0 0 0 2px #3a3d46,
    0 24px 60px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}
body.template-phone .phone-status {
  flex: 0 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 22px 0;
  color: #e8eef4;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: #000;
  position: relative;
  z-index: 2;
}
body.template-phone .phone-notch,
body.is-launcher .phone-notch {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  width: 118px;
  height: 22px;
  background: #0b0c10;
  border-radius: 0 0 16px 16px;
}
body.template-phone .app-shell,
body.template-proto .app-shell {
  flex: 1;
  min-height: 0;
  max-width: none;
  height: auto;
  margin: 0;
  border: none;
  box-shadow: none;
  overflow: hidden;
  padding-bottom: 0;
}
body.template-phone .main,
body.template-proto .main {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
body.template-phone .main::-webkit-scrollbar,
body.template-proto .main::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}
.phone-vscroll {
  position: absolute;
  width: 11px;
  z-index: 25;
  pointer-events: auto;
}
.phone-vscroll[hidden] {
  display: none !important;
}
.phone-vscroll-thumb {
  position: absolute;
  left: 1px;
  right: 1px;
  min-height: 36px;
  border-radius: 8px;
  background: var(--scroll-thumb);
  cursor: default;
  touch-action: none;
}
.phone-vscroll-thumb:hover,
.phone-vscroll.dragging .phone-vscroll-thumb {
  background: var(--scroll-thumb-hover);
}
body.template-phone .bottom-nav {
  position: relative;
  left: auto;
  transform: none;
  width: 100%;
  max-width: none;
  flex: 0 0 var(--nav-h);
}
body.template-phone .topbar {
  position: sticky;
  top: 0;
}
body.template-phone .topbar .brand {
  max-width: 52%;
  font-size: 0.82rem;
}
body.template-phone .profile-menus,
body.template-proto .profile-menus {
  display: none;
}
body.template-phone .dept-grid,
body.template-phone .dept-stack {
  grid-template-columns: 1fr;
  gap: 8px;
}
body.template-phone .dept-tile {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  row-gap: 2px;
  align-items: start;
  min-height: 0;
  padding: 12px;
}
body.template-phone .dept-tile .icon {
  grid-row: 1 / span 2;
  font-size: 1.35rem;
  line-height: 1.25;
}
body.template-phone .dept-tile .name {
  grid-column: 2;
}
body.template-phone .dept-tile .desc {
  grid-column: 2;
}
body.template-phone .main {
  padding: 10px 10px 16px;
}
body.template-phone .page-title {
  font-size: 1.12rem;
}
body.template-phone .page-sub {
  margin-bottom: 10px;
  font-size: 0.78rem;
}
body.template-phone .card {
  padding: 10px 12px;
  margin-bottom: 8px;
  border-radius: 12px;
}
body.template-phone .card h3 {
  font-size: 0.88rem;
}
body.template-phone .stat-row {
  gap: 6px;
  margin-bottom: 10px;
}
body.template-phone .btn-row {
  gap: 6px;
}
body.template-phone .job-facts {
  grid-template-columns: 1fr 1fr;
}
body.template-phone table.data {
  font-size: 0.72rem;
}
body.template-phone table.data th,
body.template-phone table.data td {
  padding: 4px 6px;
}
body.template-phone .status-flow-steps {
  max-height: 200px;
}
body.template-phone .card-grid.cols-2 {
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
body.template-phone #contact-grid.card-grid.cols-2 {
  grid-template-columns: 1fr;
}

/* Phone uses the same Back / Search / Options chrome as Prototype, but dark */
body.template-phone .proto-chrome {
  flex: 0 0 var(--header-h);
  height: var(--header-h);
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 6px;
  align-items: center;
  padding: 8px 8px;
  background: #141820;
  border-bottom: 1px solid var(--border);
  z-index: 40;
}
body.template-phone .proto-left {
  height: 36px;
  max-width: 42vw;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  line-height: 1.15;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.template-phone .proto-left.link,
body.template-phone .proto-left.exit {
  clip-path: none;
}
body.template-phone .proto-left:hover {
  background: var(--bg-hover);
  text-decoration: none;
}
body.template-phone .proto-left.exit {
  color: var(--danger);
}
body.template-phone .proto-options-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
body.template-phone .proto-options-btn .opt-label {
  display: none;
}
body.template-phone .proto-options-btn:hover,
body.template-phone .proto-options-btn[aria-expanded="true"] {
  border-color: var(--primary);
  background: var(--bg-hover);
}
body.template-phone .proto-search {
  margin: 0;
}
body.template-phone .proto-search .search-wrap,
.topbar-search .search-wrap {
  width: 100%;
}
body.template-phone .proto-search .suggest-box {
  z-index: 90;
}
body.template-phone .proto-search input {
  height: 36px;
  width: 100%;
  padding: 2px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.78rem;
}
body.template-phone .proto-titlebar {
  flex: 0 0 32px;
  height: 32px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: #0b0d12;
  color: var(--text);
  font-weight: 700;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border);
  gap: 6px;
  min-width: 0;
}
.title-cat {
  color: inherit;
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1px 8px;
  background: var(--bg-elevated);
  max-width: 62%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.title-cat:hover {
  border-color: var(--community, #7db0e8);
}
.title-sep {
  color: var(--text-muted);
  font-weight: 600;
}
.pallet-card {
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
}
.pallet-deck {
  display: grid;
  gap: 3px;
  max-width: 220px;
  padding: 8px 8px 6px;
  margin: 0 0 8px;
  background: #3a2a18;
  border-radius: 4px 4px 2px 2px;
  box-shadow: 0 6px 0 #2a1c10;
}
.pallet-deck .bag {
  display: block;
  min-height: 14px;
  background: linear-gradient(180deg, #d7c49a, #b89a62);
  border-radius: 2px;
  border: 1px solid #8a7040;
}
body.template-phone.is-substance .proto-titlebar {
  flex-basis: 42px;
  height: 42px;
  font-size: 1.15rem;
  letter-spacing: 0.01em;
}
body.template-phone .proto-options,
body.template-phone .proto-hide,
body.template-phone .proto-tips,
body.template-phone .proto-exit {
  position: absolute;
  left: 8px;
  right: 8px;
  z-index: 80;
}
body.template-phone .proto-options {
  left: auto;
  right: 8px;
  top: 88px;
  width: min(280px, calc(100% - 16px));
  max-height: calc(100% - 150px);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
body.template-phone .proto-options[hidden],
body.template-phone .proto-hide[hidden],
body.template-phone .proto-tips[hidden],
body.template-phone .proto-exit[hidden] {
  display: none !important;
}
body.template-phone .proto-opt-group {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
}
body.template-phone .proto-opt-group.tools {
  display: flex;
  flex-direction: column;
  grid-template-columns: none;
}
body.template-phone .proto-opt {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 40px;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  text-align: left;
}
body.template-phone .proto-opt:hover {
  text-decoration: none;
  filter: none;
  background: var(--bg-hover);
}
body.template-phone .proto-opt.icon img {
  display: none;
}
body.template-phone .proto-opt.icon[title]::after {
  content: attr(title);
}
body.template-phone .proto-options:has(.proto-opt-group.procurement) {
  width: min(300px, calc(100% - 16px));
}
body.template-phone .proto-options:has(.proto-opt-group.procurement) .proto-opt-group {
  margin: 0 0 4px;
  border-radius: 8px;
  overflow: hidden;
}
body.template-phone .proto-options:has(.proto-opt-group.procurement) .proto-opt-group:last-of-type {
  margin-bottom: 0;
}
body.template-phone .proto-options:has(.proto-opt-group.procurement) .proto-opt {
  border-radius: 0;
}
body.template-phone .proto-opt-group.tools .proto-opt {
  background: var(--bg-elevated);
}
body.template-phone .proto-opt-group.procurement .proto-opt {
  background: rgba(0, 180, 216, 0.2);
}
body.template-phone .proto-opt-group.transport .proto-opt {
  background: rgba(124, 106, 247, 0.22);
}
body.template-phone .proto-opt-group.storage .proto-opt {
  background: rgba(45, 140, 255, 0.22);
}
body.template-phone .proto-opt-group.manufacturing .proto-opt {
  background: rgba(0, 201, 167, 0.22);
}
body.template-phone .proto-opt-group.sales .proto-opt {
  background: rgba(244, 162, 97, 0.22);
}
body.template-phone .proto-template-row {
  display: block;
  margin: 4px 0 0;
}
body.template-phone .proto-template-row select {
  width: 100%;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.75rem;
  padding: 6px 8px;
}
body.template-phone .hub-chrome {
  display: none;
}
body.template-phone .hub-blurb,
body.template-wide .hub-blurb {
  display: none;
}

/* Mobile hub: same icon + name + desc tiles as Wide, stacked */
body.template-phone .hub-list {
  grid-template-columns: 1fr;
  gap: 8px;
}
body.template-phone .hub-list .dept-tile .thumb {
  display: none;
}
body.template-phone .hub-list .dept-tile .icon {
  display: block;
  grid-row: 1 / span 2;
  font-size: 1.45rem;
  line-height: 1.2;
}
body.template-phone .hub-list .dept-tile .name {
  display: block;
  grid-column: 2;
  min-height: 0;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
}
body.template-phone .hub-list .dept-tile .desc {
  display: block;
  grid-column: 2;
}
body.template-phone .hub-list .dept-tile .badge {
  margin-left: 6px;
}
body.template-phone .proto-tips {
  top: 96px;
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  box-shadow: var(--shadow);
}
body.template-phone .proto-tips p {
  margin: 8px 0 12px;
  font-size: 0.85rem;
  color: var(--text-muted);
}
body.template-phone .proto-tips-close {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 12px;
  font-weight: 700;
  cursor: pointer;
}
body.template-phone .main:has(.pin-pad),
body.template-proto .main:has(.pin-pad) {
  --pin-key: 60px;
  padding-top: 6px;
  padding-bottom: 6px;
  overflow: hidden;
}
body.template-phone .main:has(.pin-pad) .pin-who,
body.template-proto .main:has(.pin-pad) .pin-who {
  margin-bottom: 6px;
}
body.template-phone .pin-toolbar,
body.template-proto .pin-toolbar {
  margin-bottom: 0;
}
body.template-phone .pin-shuffle,
body.template-proto .pin-shuffle {
  font-size: 0.7rem;
}
body.template-proto .pin-shuffle {
  color: #444;
}
body.template-phone .main:has(.pin-pad) .card,
body.template-proto .main:has(.pin-pad) .card {
  padding: 12px 14px 10px;
  margin-bottom: 0;
}
body.template-phone .pin-display,
body.template-proto .pin-display {
  gap: 10px;
  margin: 8px 0 10px;
}
body.template-phone .pin-dot,
body.template-proto .pin-dot {
  width: 12px;
  height: 12px;
}
body.template-phone .pin-pad,
body.template-proto .pin-pad {
  width: max-content;
  max-width: 100%;
  display: grid;
  grid-template-columns: repeat(3, var(--pin-key));
  gap: 8px;
  margin: 4px auto 0;
}
body.template-phone .pin-pad button,
body.template-proto .pin-pad button {
  width: var(--pin-key);
  height: var(--pin-key);
  max-width: var(--pin-key);
  max-height: var(--pin-key);
  aspect-ratio: 1;
  justify-self: center;
  font-size: 1.2rem;
  padding: 0;
  line-height: 1;
}
body.template-phone .pin-pad button.action,
body.template-proto .pin-pad button.action {
  font-size: 0.75rem;
}
body.template-phone .main:has(.pin-pad) .btn-row,
body.template-proto .main:has(.pin-pad) .btn-row {
  margin-top: 8px;
  gap: 6px;
}
body.template-phone .main:has(.pin-pad) .btn-row .btn,
body.template-proto .main:has(.pin-pad) .btn-row .btn {
  padding: 6px 10px;
  font-size: 0.75rem;
}
body.template-phone .flash,
body.template-proto .flash {
  font-size: 0.78rem;
  padding: 9px 11px;
  border-radius: 10px;
}
@media (min-width: 900px) {
  body.template-phone,
  body.template-proto,
  body.is-launcher {
    --max: 390px;
  }
}
@media (max-width: 520px) {
  body.template-phone .stage,
  body.template-proto .stage,
  body.is-launcher .stage {
    padding: 0;
    grid-template-columns: 1fr;
  }
  body.template-phone .dev-rails,
  body.template-proto .dev-rails,
  body.is-launcher .dev-rails {
    display: none;
  }
  body.template-phone .device,
  body.template-proto .device,
  body.is-launcher .device {
    grid-column: 1;
    width: 100%;
    height: 100vh;
    max-height: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
  }
}

.quote-toolbar-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
}
.quote-filters {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 700px) {
  .quote-filters {
    grid-template-columns: 1fr 1.4fr auto;
    align-items: end;
  }
}
.quote-filters label,
.listing-quote-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.quote-filters input,
.quote-filters select,
.listing-quote-form input,
.listing-quote-form select {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
}
.listing-card h3 {
  font-size: 1rem;
  margin-bottom: 6px;
}
.listing-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 6px;
}
.listing-head h3 {
  margin: 0;
  flex: 1 1 auto;
}
.listing-seller {
  margin: 0 0 4px;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.supply-chip {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text);
  vertical-align: 1px;
}
.listing-mix {
  margin: 0 0 8px;
  font-size: 0.88rem;
  font-weight: 600;
}
.listing-filter {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}
.listing-filter-main {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: end;
}
.listing-filter-main > .btn {
  width: 100%;
}
body.template-phone .listing-filter {
  padding: 10px 12px;
}
body.template-phone .listing-filter-main {
  gap: 8px;
}
.listing-filter label,
.listing-filter-extra label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.listing-filter input,
.listing-filter select {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
}
.listing-filter-dest input {
  margin-top: 6px;
}
.pack-picker summary,
.listing-filter-advanced summary {
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--text);
}
.listing-filter-advanced summary {
  display: inline-block;
  width: auto;
}
.pack-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 0 0;
}
.pack-chips label {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.78rem;
}
.listing-filter-extra {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding-top: 10px;
}
@media (min-width: 800px) {
  body:not(.template-phone) .listing-filter-main {
    grid-template-columns: 0.7fr 1.1fr 1.5fr auto;
  }
  body:not(.template-phone) .listing-filter-main > .btn {
    width: auto;
  }
  body:not(.template-phone) .listing-filter-extra {
    grid-template-columns: 1fr 1fr 1fr;
  }
}
.listing-reviews {
  font-size: 0.78rem;
  color: var(--warning);
  white-space: nowrap;
}
.listing-reviews.is-empty {
  display: none;
}
.order-lead {
  margin: 0 0 4px;
}
.order-name {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.25;
}
.order-meta,
.order-line {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.order-action .btn {
  width: 100%;
}
.lapse-row {
  margin: 0 0 8px;
}
.lapse-row .btn {
  width: auto;
}
.listing-quote-card > form > .btn,
.listing-quote-card .btn-personal,
.listing-quote-card .btn-business {
  width: 100%;
  margin-top: 10px;
}
.listing-view {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.listing-hero {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.listing-hero-main {
  flex: 1 1 auto;
  min-width: 0;
}
.listing-kicker {
  margin: 0 0 4px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.listing-name {
  margin: 0 0 6px;
  font-size: 1.28rem;
  line-height: 1.25;
  display: block;
}
body.template-phone .listing-name {
  display: block;
  font-size: 1.18rem;
}
.listing-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  align-items: center;
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.listing-meta > span {
  white-space: nowrap;
}
.listing-hero-side {
  text-align: right;
  flex: 0 1 220px;
}
.listing-hero-side .btn {
  white-space: normal;
  text-align: center;
}
.listing-price-now {
  margin: 6px 0 0;
  font-weight: 700;
}
body.template-phone .listing-hero,
body.template-proto .listing-hero {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}
body.template-phone .listing-hero-side,
body.template-proto .listing-hero-side {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  width: 100%;
  flex: 1 1 auto;
}
body.template-phone .listing-price-now,
body.template-proto .listing-price-now {
  margin: 0;
  font-size: 1.05rem;
}
body.template-phone .listing-hero-side form,
body.template-proto .listing-hero-side form,
body.template-phone .listing-hero-side > .btn,
body.template-proto .listing-hero-side > .btn {
  flex: 1 1 100%;
}
body.template-phone .listing-hero-side .btn,
body.template-proto .listing-hero-side .btn {
  width: 100%;
}
body.template-phone .listing-head,
body.template-proto .listing-head {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
body.template-phone .listing-head h3,
body.template-proto .listing-head h3 {
  width: 100%;
}
body.template-wide .listing-facts {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
body.template-phone .listing-view .btn-row,
body.template-proto .listing-view .btn-row {
  flex-direction: column;
}
body.template-phone .listing-view .btn-row .btn,
body.template-proto .listing-view .btn-row .btn {
  width: 100%;
  text-align: center;
}
.quote-figures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}
.quote-figures .stat:last-child {
  grid-column: 1 / -1;
}
.quote-figures .stat:last-child .n {
  color: var(--accent);
}
body.template-wide .quote-figures {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
body.template-wide .quote-figures .stat:last-child {
  grid-column: auto;
}
body.template-phone .quote-figures .stat,
body.template-proto .quote-figures .stat {
  padding: 8px 6px;
}
body.template-phone .quote-figures .n,
body.template-proto .quote-figures .n {
  font-size: 1.02rem;
}
/* Round 62: review order - sections, right-aligned money, full-width actions on phone */
.buy-review { display: flex; flex-direction: column; gap: var(--sp-3, 12px); max-width: 720px; }
.buy-review .br-sec { margin: 0; }
.buy-review .br-product { font-size: 1.15rem; margin: 2px 0 8px; line-height: 1.3; overflow-wrap: anywhere; }
.buy-review .br-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin: 0; }
.buy-review .br-facts .br-wide { grid-column: 1 / -1; }
.buy-review .br-facts dt { color: var(--text-muted); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.buy-review .br-facts dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
#buy-review .review-lines { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 10px; }
#buy-review .review-line { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
#buy-review .review-line .k { color: var(--text-muted); }
#buy-review .review-line .v { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
#buy-review .review-line-total { border-top: 1px solid var(--border); padding-top: 8px; margin-top: 2px; }
#buy-review .review-line-total .k { color: var(--text); font-weight: 700; }
#buy-review .review-line-total .v { font-size: 1.25rem; color: var(--accent); }
.buy-review .br-sec label { display: block; margin-bottom: 10px; }
.buy-review .br-sec label:last-child { margin-bottom: 0; }
.buy-review .br-wallet { padding: 8px 0; border-bottom: 1px solid var(--border); }
.buy-review .br-wallet:last-of-type { border-bottom: 0; }
.buy-review .br-actions { margin-top: 4px; }
body.template-phone .buy-review .br-actions,
body.template-proto .buy-review .br-actions { flex-direction: column; gap: 8px; }
body.template-phone .buy-review .br-actions .btn,
body.template-proto .buy-review .br-actions .btn { width: 100%; min-height: 48px; justify-content: center; }
body.template-phone .buy-review input:not([type=radio]):not([type=checkbox]), body.template-phone .buy-review select,
body.template-proto .buy-review input:not([type=radio]):not([type=checkbox]), body.template-proto .buy-review select { width: 100%; max-width: 100%; box-sizing: border-box; }
.buy-review .br-sec label.opt-check { display: flex; align-items: flex-start; gap: 10px; }
.buy-review .br-sec label.opt-check input { width: auto; flex: none; margin-top: 3px; }
.buy-review .br-wallet small { display: block; }
body.template-phone .buy-review select { text-overflow: ellipsis; }
body.template-phone .quote-break,
body.template-proto .quote-break {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 8px;
}
.listing-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.listing-facts div {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
}
.listing-facts span {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.listing-facts strong {
  font-size: 0.88rem;
}
.listing-blurb {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}
.listing-fold {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 12px;
}
.listing-fold summary {
  cursor: pointer;
  font-weight: 700;
  padding: 6px 0;
}
.listing-quote-card h3 {
  margin-top: 0;
}
.chat-log {
  min-height: 120px;
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 0;
}
.chat-bubble {
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 0.78rem;
  max-width: 95%;
}
.chat-bubble.user {
  background: #243044;
  align-self: flex-end;
}
.chat-bubble.admin {
  background: #1e3a2f;
  align-self: flex-start;
}
.chat-bubble small {
  display: block;
  opacity: 0.65;
  font-size: 0.62rem;
}
.chat-compose textarea {
  width: 100%;
  resize: vertical;
}
.chat-threads {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 140px;
  overflow-y: auto;
  margin-bottom: 6px;
}
.chat-thread {
  text-align: left;
  border: 1px solid #2d3f54;
  background: #141b24;
  color: #e8eef4;
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
  font-family: inherit;
}
.chat-thread small {
  display: block;
  color: #8b9cb3;
  font-size: 0.68rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-thread.has-unread {
  border-color: #f0c36a;
}
.chat-thread.is-on {
  background: #243044;
}
.app-support {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--header-h);
  bottom: var(--nav-h);
  z-index: 86;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 0;
}
.app-support[hidden] {
  display: none !important;
}
.app-support-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  flex: 0 0 auto;
}
.app-support-hint {
  margin: 0;
  padding: 6px 12px 0;
  flex: 0 0 auto;
}
.app-support .chat-log {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  padding: 10px 12px;
}
.app-support .chat-compose {
  flex: 0 0 auto;
  padding: 8px 12px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}
.app-support-close {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 6px 12px;
  cursor: pointer;
  font-family: inherit;
}
body.template-phone .app-support {
  top: 96px;
}
body.template-proto .app-support {
  top: 70px;
  bottom: 56px;
  background: #12161c;
  color: #e8eef4;
}
body.template-proto .app-support-bar,
body.template-proto .app-support .chat-compose {
  background: #0b0d12;
  border-color: #2d3f54;
}
body.template-proto .app-support-close {
  background: #1a2332;
  color: #e8eef4;
  border-color: #2d3f54;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
}
@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
}
.listing-quote-form {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 10px;
  margin: 12px 0 10px;
}
.listing-quote-form:has(.listing-pack) {
  grid-template-columns: 1fr 1fr 1.3fr;
}
.listing-quote {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
}
.quote-line {
  font-size: 0.85rem;
  margin-bottom: 6px;
}
.quote-break {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.quote-break strong {
  color: var(--accent);
}
.listing-actions {
  flex-wrap: wrap;
}
.listing-actions form {
  display: inline;
}

/* Windowed lists: only on-screen rows exist in the DOM */
.vlist,
.vlist-window,
body.template-phone .main,
body.template-proto .main {
  overflow-anchor: none;
}
.vlist {
  position: relative;
}
.vlist-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin-bottom: 10px;
}
.vlist-q {
  flex: 1 1 180px;
  min-width: 140px;
  max-width: 280px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
}
.vlist-meta {
  margin-bottom: 10px;
}
.vlist-window {
  display: flex;
  flex-direction: column;
}
.vlist-spacer {
  flex: 0 0 auto;
  pointer-events: none;
}
.vlist-skel {
  opacity: 0.55;
  animation: vlist-pulse 1.1s ease-in-out infinite;
}
@keyframes vlist-pulse {
  50% { opacity: 0.28; }
}
.vlist-table .table-wrap {
  margin: 0;
}
.vlist-cards .listing-card,
.vlist-table tr[data-idx] {
  contain: layout style;
}

.hidden {
  display: none !important;
}

.progress-wrap {
  margin-bottom: 14px;
}
.progress-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
  font-size: 0.9rem;
}
.progress-bar {
  height: 10px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  overflow: hidden;
}
.progress-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--business), var(--accent));
  border-radius: 999px;
}
.stage-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}
.stage-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  font-size: 0.7rem;
  color: var(--text-muted);
  max-width: 100%;
}
.stage-chip .n {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  font-weight: 700;
  flex-shrink: 0;
}
.stage-chip.done {
  color: var(--success);
  border-color: rgba(62, 207, 142, 0.35);
}
.stage-chip.now {
  color: #fff;
  border-color: var(--business);
  background: rgba(0, 180, 216, 0.18);
}

/* Compact current-status control (tap to see done / remaining) */
.status-flow {
  margin: 0 0 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated);
  overflow: hidden;
}
.status-flow > summary {
  list-style: none;
  cursor: pointer;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "now pct"
    "bar bar";
  gap: 4px 10px;
  align-items: center;
  padding: 8px 10px;
  font-size: 0.82rem;
}
.status-flow > summary::-webkit-details-marker,
.status-flow > summary::marker {
  display: none;
}
.status-flow-now {
  grid-area: now;
  font-weight: 700;
  color: var(--business);
  padding-right: 18px;
  position: relative;
}
.status-flow-now::after {
  content: "▾";
  position: absolute;
  right: 0;
  top: 0;
  color: var(--text-muted);
  font-size: 0.7rem;
}
.status-flow[open] .status-flow-now::after {
  content: "▴";
}
.status-flow-pct {
  grid-area: pct;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
}
.status-flow.has-clock > summary {
  grid-template-areas:
    "now pct"
    "clock clock"
    "bar bar";
}
.status-flow.has-plan > summary {
  grid-template-areas:
    "now pct"
    "plan plan"
    "bar bar";
}
.status-flow.has-clock.has-plan > summary {
  grid-template-areas:
    "now pct"
    "clock clock"
    "plan plan"
    "bar bar";
}
.plan-dates {
  grid-area: plan;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  min-width: 0;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.plan-dates .plan-k {
  color: var(--text-muted);
  font-weight: 700;
}
.plan-dates time {
  font-weight: 700;
}
.status-flow-clock {
  grid-area: clock;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
  min-width: 0;
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
  color: var(--text);
}
.order-clock {
  margin: 0 0 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated);
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "phase eta"
    "elapsed elapsed";
  gap: 4px 10px;
  align-items: baseline;
  padding: 8px 10px;
  font-size: 0.82rem;
}
.order-clock-phase {
  grid-area: phase;
  font-weight: 700;
  color: var(--business);
  min-width: 0;
}
.order-clock-elapsed {
  grid-area: elapsed;
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
  color: var(--text);
}
.order-clock-eta {
  grid-area: eta;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  white-space: nowrap;
}
.order-clock.has-plan {
  grid-template-areas:
    "phase eta"
    "elapsed elapsed"
    "plan plan";
}
.status-flow-bar {
  grid-area: bar;
  display: block;
  height: 5px;
  border-radius: 999px;
  background: var(--bg);
  overflow: hidden;
}
.status-flow-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--business), var(--accent));
  border-radius: 999px;
}
.status-flow-steps {
  list-style: none;
  margin: 0;
  padding: 4px 8px 8px;
  border-top: 1px solid var(--border);
  max-height: 240px;
  overflow-y: auto;
}
.status-flow-steps li {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 5px 2px;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.status-flow-steps li.done {
  color: var(--success);
}
.status-flow-steps li.now {
  color: var(--text);
  font-weight: 700;
}
.status-flow-steps li.todo .label {
  opacity: 0.7;
}
.status-flow-steps .mark {
  text-align: center;
  font-size: 0.7rem;
}
.status-flow-steps .hint {
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.setup-flow {
  margin: 0 0 14px;
}
.setup-flow .status-flow-now {
  color: var(--personal);
}
.setup-flow-steps {
  max-height: 320px;
}
.setup-flow .label {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.setup-flow .label a,
.setup-flow .label button {
  color: inherit;
  font: inherit;
  font-weight: 650;
  text-align: left;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.setup-flow .label a:hover,
.setup-flow .label button:hover {
  text-decoration: underline;
}
.setup-flow .label small {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.68rem;
}
.setup-flow li.bonus .hint {
  color: var(--personal);
}
.setup-flow li.setup-done-head {
  display: block;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.setup-flow li.setup-done-head .label {
  font-weight: 700;
}
.setup-flow li.partial .hint {
  color: var(--accent);
}

.profile-hero {
  display: flex;
  align-items: center;
  gap: 14px;
}
.profile-hero .avatar {
  width: 56px;
  height: 56px;
  font-size: 1.1rem;
  flex: 0 0 56px;
}
.profile-hero small {
  display: block;
  color: var(--text-muted);
  margin-top: 2px;
}
.profile-card {
  padding-top: 4px;
  padding-bottom: 16px;
}
.profile-sec {
  margin: 12px 0 4px;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.profile-sub {
  margin: 10px 0 0;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
}
.profile-card.compact {
  padding: 8px 14px 12px;
}
.profile-row {
  display: grid;
  grid-template-columns: 1fr minmax(150px, 0.46fr);
  gap: 10px 18px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  align-items: start;
}
.profile-row.tight {
  padding: 8px 0;
  gap: 6px 12px;
}
.profile-row.tight input,
.profile-row.tight select {
  padding: 8px 10px;
}
.profile-row:last-of-type {
  border-bottom: 0;
}
.profile-row-edit label:first-child {
  margin-top: 0;
}
.profile-name-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.profile-row-status {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding-top: 2px;
}
.profile-row-status .ok {
  color: var(--success);
  font-weight: 700;
}
.profile-row-status .setup-verify {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.profile-row-status .setup-verify input[name="code"] {
  width: 7.5rem;
  padding: 7px 8px;
  margin: 0;
}
@media (max-width: 720px) {
  .profile-row {
    grid-template-columns: 1fr;
  }
}
body.template-phone .profile-row {
  grid-template-columns: 1fr;
}

.job-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "name value"
    "sub sub"
    "status status"
    "bar bar"
    "extra extra";
  column-gap: 8px;
  row-gap: 2px;
  align-items: start;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  padding: 10px 12px;
  margin-bottom: 8px;
}
.job-card-open {
  position: absolute;
  inset: 0;
  z-index: 1;
}
.job-name {
  grid-area: name;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.25;
  min-width: 0;
}
.job-ref {
  position: relative;
  z-index: 2;
}
.job-value {
  grid-area: value;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}
.job-sub {
  grid-area: sub;
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.job-sub:empty {
  display: none;
}
.job-status {
  grid-area: status;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 0;
  margin: 4px 0 0;
  font-size: 0.78rem;
}
.job-phase {
  font-weight: 700;
  color: var(--business);
}
.job-where {
  color: var(--text);
}
.job-where::before {
  content: "·";
  margin: 0 6px;
  color: var(--text-muted);
  font-weight: 400;
}
.job-eta {
  margin-left: auto;
  padding-left: 8px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.job-card .status-flow-bar {
  grid-area: bar;
  margin-top: 6px;
}
.job-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
  margin: 8px 0 0;
}
.job-facts div {
  min-width: 0;
}
.job-facts dt {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.job-facts dd {
  margin: 0;
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}
.job-card-extra {
  grid-area: extra;
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}
.job-card-extra:empty {
  display: none;
}
.job-card-extra p {
  margin: 0;
  width: 100%;
  font-size: 0.75rem;
}
.job-card .status-flow {
  position: relative;
  z-index: 2;
  margin-bottom: 0;
}

.fold-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  margin-bottom: 8px;
}
.fold-card > summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 12px;
  font-weight: 700;
  font-size: 0.88rem;
}
.fold-card > summary::-webkit-details-marker,
.fold-card > summary::marker {
  display: none;
}
.fold-card > summary::after {
  content: " ▾";
  color: var(--text-muted);
  font-weight: 400;
}
.fold-card[open] > summary::after {
  content: " ▴";
}
.fold-card .fold-body {
  padding: 0 12px 12px;
}
.fold-card h3 {
  margin: 0 0 4px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

/* Thumbs / section labels only used by the Prototype template */
.thumb,
.proto-section {
  display: none;
}

.community-tiles {
  grid-template-columns: 1fr !important;
  gap: 8px;
}
.community-tiles .proto-section,
.community-tiles .dept-band {
  grid-column: 1 / -1;
  margin: 8px 0 2px;
}
.community-page .dept-band {
  text-transform: none;
  letter-spacing: 0.04em;
  font-size: 0.78rem;
}
.origin-tag {
  display: inline-block;
  margin: 0 0 8px 6px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(244, 162, 97, 0.45);
  color: var(--community);
  font-size: 0.68rem;
  font-weight: 700;
  text-decoration: none;
  vertical-align: middle;
}
a.origin-tag:hover {
  text-decoration: none;
  background: rgba(244, 162, 97, 0.12);
}
.category-tile .badge {
  margin-left: 6px;
  vertical-align: middle;
}
.community-page .page-title {
  font-size: 1.15rem;
}
body.is-substance .community-page .page-title {
  font-size: 1.5rem;
}
@keyframes substance-arrive {
  0% {
    opacity: 0.2;
    transform: translateY(8px);
  }
  55% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 1;
    transform: none;
  }
}
@keyframes substance-arrive-bar {
  0% { background-color: rgba(0, 180, 216, 0.35); color: #fff; }
  100% { background-color: #0b0d12; }
}
body.arrive-substance .community-page .page-title {
  animation: substance-arrive 0.55s ease-out;
}
body.template-phone.arrive-substance .proto-titlebar {
  animation: substance-arrive 0.45s ease-out, substance-arrive-bar 0.7s ease-out;
}
.community-page .page-sub,
.community-page .small,
.community-page .muted {
  font-size: 0.8rem;
}
.community-page .dept-tile {
  min-height: 0;
  padding: 12px;
}
.community-page .dept-tile .name {
  font-size: 0.9rem;
}
.community-page .dept-tile .desc {
  font-size: 0.72rem;
}
.community-page .listing-card h3,
.community-page .card h3 {
  font-size: 0.95rem;
}
.community-page .listing-card p,
.community-page .card p {
  font-size: 0.8rem;
}

/* ── Prototype template: Application 2.0 phone chrome ───────── */
body.template-proto {
  --bg: #c8c8c8;
  --bg-elevated: #d6d6d6;
  --bg-card: #ececec;
  --bg-hover: #e4e4e4;
  --border: #9a9a9a;
  --text: #111111;
  --text-muted: #3a3a3a;
  --primary: #1565c0;
  --primary-dim: #0d47a1;
  --accent: #7cb342;
  --lime: #a4c639;
  --lime-hi: #c6e05a;
  --lime-mid: #9ccc3a;
  --lime-dark: #7cb342;
  --proto-red: #c62828;
  --proto-red-hi: #e53935;
  --proto-blue: #1565c0;
  --chart-axis: #333333; --chart-label: #111111; --chart-grid: #9a9a9a; --chart-bar: #1565c0; --chart-in: #2e7d32; --chart-out: #c62828; --chart-line: #b26a00;
  --proto-cyan: #00acc1;
  --proto-black: #1a1a1a;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  --header-h: 36px;
  --nav-h: 48px;
  background: #2a2c32;
}

body.template-proto .app-shell,
body.template-proto .main {
  --scroll-track: #cfcfcf;
  --scroll-thumb: #5c5c5c;
  --scroll-thumb-hover: #3a3a3a;
}
body.template-proto .app-shell {
  background: #bdbdbd;
  color: var(--text);
}

body.template-proto .main {
  padding: 6px 8px 10px;
  background: #bdbdbd;
}

body.template-proto .hub-chrome {
  display: none;
}

body.template-proto .proto-status {
  flex: 0 0 24px;
  height: 24px;
  position: relative;
  background: #000;
  overflow: hidden;
}
body.template-proto .proto-status img {
  display: block;
  width: 100%;
  height: 24px;
  object-fit: cover;
  object-position: left center;
}
body.template-proto .proto-clock {
  position: absolute;
  right: 8px;
  top: 0;
  height: 24px;
  display: flex;
  align-items: center;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-shadow: 0 0 2px #000;
}

body.template-proto .proto-chrome {
  flex: 0 0 var(--header-h);
  height: var(--header-h);
  display: grid;
  grid-template-columns: 78px 1fr 78px;
  gap: 4px;
  align-items: center;
  padding: 3px 6px;
  background: #2b2b2b;
  z-index: 40;
}
body.template-proto .proto-left,
body.template-proto .proto-options-btn {
  height: 28px;
  border: 1px solid rgba(0, 0, 0, 0.35);
  color: #fff;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  line-height: 1;
}
body.template-proto .proto-left.exit {
  clip-path: polygon(16% 0, 100% 0, 100% 100%, 16% 100%, 0 50%);
  padding-left: 12px;
  background: linear-gradient(180deg, #ef5350 0%, #c62828 55%, #b71c1c 100%);
  border-radius: 2px;
}
body.template-proto .proto-left.link {
  clip-path: polygon(16% 0, 100% 0, 100% 100%, 16% 100%, 0 50%);
  padding-left: 12px;
  background: linear-gradient(180deg, #4fc3f7 0%, #0288d1 55%, #01579b 100%);
  border-radius: 2px;
}
body.template-proto .proto-options-btn .opt-icon {
  display: none;
}
body.template-proto .proto-options-btn {
  background: linear-gradient(180deg, #42a5f5 0%, #1565c0 55%, #0d47a1 100%);
  border-radius: 3px;
}
body.template-proto .proto-options-btn[aria-expanded="true"] {
  filter: brightness(1.12);
}
body.template-proto .proto-left:hover,
body.template-proto .proto-options-btn:hover {
  text-decoration: none;
  filter: brightness(1.08);
}
body.template-proto .proto-search {
  margin: 0;
}
body.template-proto .proto-search input {
  height: 26px;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid #8a8a8a;
  background: #fff;
  color: #111;
  font-size: 0.8rem;
}
body.template-proto .proto-search input::placeholder {
  font-size: 0.87rem;
}
body.template-proto .proto-search input:focus {
  outline: 2px solid #90caf9;
  border-color: #1565c0;
}

body.template-proto .proto-titlebar {
  flex: 0 0 34px;
  height: 34px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: #111;
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}

body.template-proto .proto-options,
body.template-proto .proto-hide,
body.template-proto .proto-tips,
body.template-proto .proto-exit {
  position: absolute;
  left: 8px;
  right: 8px;
  z-index: 80;
}
body.template-proto .proto-options {
  top: 70px;
  max-height: calc(100% - 130px);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: rgba(20, 20, 20, 0.12);
  padding: 0 4px 8px;
}
body.template-proto .proto-options[hidden],
body.template-proto .proto-hide[hidden],
body.template-proto .proto-tips[hidden],
body.template-proto .proto-exit[hidden] {
  display: none !important;
}

body.template-proto .proto-opt-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 3px;
}
body.template-proto .proto-opt-group.tools {
  display: grid;
  grid-template-columns: 1fr 1fr 44px;
  gap: 3px;
  margin-bottom: 6px;
}
body.template-proto .proto-opt {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid rgba(0, 0, 0, 0.35);
  border-radius: 3px;
  color: #fff;
  font-weight: 700;
  font-size: 0.88rem;
  text-decoration: none;
  cursor: pointer;
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 1px 2px rgba(0, 0, 0, 0.25);
}
body.template-proto .proto-opt:hover {
  text-decoration: none;
  filter: brightness(1.08);
}
body.template-proto .proto-opt.icon {
  padding: 2px;
}
body.template-proto .proto-opt.icon img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}
body.template-proto .proto-opt-group.tools .proto-opt,
body.template-proto .proto-opt-group.tools button.proto-opt {
  background: linear-gradient(180deg, #3a3a3a, #1a1a1a);
}
body.template-proto .proto-opt-group.procurement .proto-opt {
  background: linear-gradient(180deg, #7a6a3a, #4e4320);
}
body.template-proto .proto-opt-group.transport .proto-opt {
  background: linear-gradient(180deg, #7b4f8c, #4a2a58);
}
body.template-proto .proto-opt-group.storage .proto-opt {
  background: linear-gradient(180deg, #3d7ec4, #1e4f86);
}
body.template-proto .proto-opt-group.manufacturing .proto-opt {
  background: linear-gradient(180deg, #b07a2a, #6d4a12);
}
body.template-proto .proto-opt-group.sales .proto-opt {
  background: linear-gradient(180deg, #2e8a78, #145246);
}
body.template-proto .proto-template-row {
  display: block;
  margin-top: 8px;
}
body.template-proto .proto-template-row select {
  background: #1a1a1a;
  color: #fff;
  border-color: #444;
  font-size: 0.75rem;
  padding: 6px 8px;
}

body.template-proto .proto-hide {
  top: 70px;
  bottom: 56px;
  left: 0;
  right: 0;
  background: #12161c;
  overflow-y: auto;
  z-index: 85;
}
body.template-proto .proto-hide-bar {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 6px;
  align-items: center;
  padding: 6px 8px;
  background: #0b0d12;
  color: #e8eef4;
  font-weight: 700;
}
body.template-proto .proto-hide-cancel,
body.template-proto .proto-hide-save {
  border: 0;
  color: #fff;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
}
body.template-proto .proto-hide-cancel {
  background: #8b2e2e;
}
body.template-proto .proto-hide-save {
  background: #2a6f4a;
  color: #e8fff2;
}
body.template-proto .proto-hide-list {
  padding: 6px 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
body.template-proto .proto-hide-row {
  display: grid;
  grid-template-columns: 22px 88px 1fr auto;
  gap: 6px;
  align-items: center;
  margin: 0;
}
body.template-proto .proto-hide-flag {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 0.62rem;
  font-weight: 700;
  color: #c5d4e8;
}
body.template-proto .proto-hide-flag input {
  width: 22px;
  height: 22px;
  accent-color: #8b2e2e;
}
body.template-proto .proto-hide-flag .off {
  background: #8b2e2e;
  padding: 1px 6px;
  border-radius: 2px;
  opacity: 0.35;
  color: #fff;
}
body.template-proto .proto-hide-row:has(input:checked) .off {
  opacity: 1;
}
body.template-proto .proto-hide-name {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  background: #1a2332;
  border: 1px solid #2d3f54;
  border-radius: 8px;
  font-weight: 700;
  color: #e8eef4;
  box-shadow: none;
}
body.template-proto .proto-hide-row.is-header .proto-hide-name {
  background: #141b24;
  color: #8b9cb3;
}
body.template-proto .tile-panel-hint {
  color: #8b9cb3;
  background: #12161c;
}
body.template-proto .tile-panel-foot {
  background: #12161c;
  border-top: 1px solid #2d3f54;
}
body.template-proto .tile-reset {
  background: #1a2332;
  color: #e8eef4;
  border: 1px solid #2d3f54;
}
body.template-proto .header-remove {
  background: #1a2332;
  color: #8b9cb3;
  border-color: #2d3f54;
}

body.template-proto .proto-tips {
  top: 78px;
  background: #29b6f6;
  color: #06233a;
  border: 1px solid #0277bd;
  border-radius: 6px;
  padding: 12px;
  box-shadow: var(--shadow);
}
body.template-proto .proto-tips p {
  margin: 8px 0 12px;
  font-size: 0.85rem;
  color: #06233a;
}
body.template-proto .proto-tips-close {
  background: #fff;
  border: 1px solid #0277bd;
  border-radius: 4px;
  padding: 6px 12px;
  font-weight: 700;
  cursor: pointer;
}

body.template-proto .proto-exit {
  top: 70px;
  bottom: 56px;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12px 10px;
  z-index: 90;
}
body.template-proto .proto-exit-card {
  width: 100%;
  background: #29b6f6;
  border: 2px solid #0277bd;
  border-radius: 6px;
  padding: 14px 12px 12px;
}
body.template-proto .proto-exit-title {
  margin: 0 0 12px;
  text-align: center;
  font-weight: 800;
  color: #111;
  text-decoration: underline;
}
body.template-proto .proto-exit-choices {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
body.template-proto .proto-exit-choice {
  min-width: 180px;
  text-align: center;
  padding: 8px 16px;
  border-radius: 8px;
  background: linear-gradient(180deg, var(--lime-hi), var(--lime-dark));
  color: #111;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid #6b8e23;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
body.template-proto .proto-exit-choice:hover {
  text-decoration: none;
  filter: brightness(1.05);
}
body.template-proto .proto-exit-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
body.template-proto .proto-exit-cancel,
body.template-proto .proto-exit-confirm {
  text-align: center;
  padding: 8px 10px;
  border-radius: 8px;
  font-weight: 700;
  border: 0;
  cursor: pointer;
  text-decoration: none;
}
body.template-proto .proto-exit-cancel {
  background: linear-gradient(180deg, #ef5350, #c62828);
  color: #fff;
}
body.template-proto .proto-exit-confirm {
  background: linear-gradient(180deg, #bdbdbd, #9e9e9e);
  color: #333;
}

body.template-proto .proto-dock {
  flex: 0 0 var(--nav-h);
  height: var(--nav-h);
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 48px;
  background: #111;
  z-index: 50;
}
body.template-proto .proto-dock a,
body.template-proto .proto-expand {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #111;
  font-size: 0.78rem;
  font-weight: 800;
  text-decoration: none;
  border: 2px solid #111;
  margin: 2px;
}
body.template-proto .proto-dock a.personal,
body.template-proto .proto-dock a.business {
  background: linear-gradient(180deg, var(--lime-hi), var(--lime-dark));
}
body.template-proto .proto-dock a.search {
  background: linear-gradient(180deg, #4dd0e1, #00838f);
  color: #fff;
}
body.template-proto .proto-dock a.here {
  box-shadow: inset 0 0 0 2px #fff;
  filter: brightness(1.08);
}
body.template-proto .proto-dock a.context:not(.here) {
  box-shadow: inset 0 -3px 0 #fff;
}
body.template-proto .proto-dock a:hover {
  text-decoration: none;
}
body.template-proto .proto-expand {
  background: transparent;
  border: 0;
  margin: 0;
  padding: 0;
  cursor: pointer;
}
body.template-proto .proto-expand img {
  width: 40px;
  height: 40px;
  display: block;
}

body.template-proto.expanded .stage {
  padding: 0;
  grid-template-columns: minmax(0, 1fr) minmax(0, 430px) minmax(0, 1fr);
}
body.template-proto.expanded .device {
  grid-column: 2;
  width: min(430px, 100%);
  height: 100vh;
  max-height: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

/* Lime tiles + photos from the mockups */
body.template-proto .thumb {
  display: block;
  width: 56px;
  height: 44px;
  flex: 0 0 56px;
  background: #fff;
  border: 1px solid #888;
  overflow: hidden;
}
body.template-proto .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
body.template-proto .proto-section {
  display: block;
  background: #111;
  color: #fff;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 5px 10px;
  margin: 8px 0 4px;
}
body.template-proto .proto-section:first-child {
  margin-top: 0;
}

body.template-proto .dept-grid,
body.template-proto .dept-stack {
  grid-template-columns: 1fr;
  gap: 6px;
}
body.template-proto .dept-band {
  background: #111;
  color: #fff;
  font-size: 0.82rem;
  letter-spacing: 0.01em;
  text-transform: none;
  padding: 5px 10px;
  margin: 8px 0 4px;
  border: 0;
}
body.template-proto .dept-band.specialist {
  margin-top: 14px;
  padding-top: 5px;
  border-top: 0;
}
body.template-proto .dept-tile {
  display: grid;
  grid-template-columns: 56px 1fr;
  grid-template-rows: auto;
  align-items: stretch;
  gap: 6px;
  min-height: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
body.template-proto .dept-tile:hover {
  transform: none;
  background: transparent;
  border: 0;
}
body.template-proto .dept-tile .icon,
body.template-proto .dept-tile .desc {
  display: none;
}
body.template-proto .dept-tile:not(:has(.thumb)) {
  grid-template-columns: 1fr;
}
body.template-proto .dept-tile:not(:has(.thumb)) .name {
  grid-column: 1;
}
body.template-proto .dept-tile .name,
body.template-proto .home-tile .name,
body.template-proto .home-tile h2 {
  display: flex;
  align-items: center;
  min-height: 44px;
  margin: 0;
  padding: 0 12px;
  background: linear-gradient(180deg, var(--lime-hi) 0%, var(--lime) 42%, var(--lime-dark) 100%);
  border: 1px solid #6b8e23;
  border-radius: 4px;
  color: #111;
  font-size: 0.92rem;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 1px 2px rgba(0, 0, 0, 0.18);
}
body.template-proto .dept-tile .badge {
  margin-left: 8px;
  background: #ef6c00;
  color: #fff;
  border: 0;
}

body.template-proto .home-tiles {
  gap: 6px;
}
body.template-proto .home-tile {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 6px;
  align-items: stretch;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  border-left: 0;
}
body.template-proto .home-tile:hover {
  transform: none;
}
body.template-proto .home-tile .label,
body.template-proto .home-tile .desc,
body.template-proto .home-tile p {
  display: none;
}
body.template-proto .home-tiles ~ .card {
  display: none;
}

body.template-proto .page-title {
  font-size: 1.15rem;
  color: #111;
}
body.template-proto .page-sub,
body.template-proto .muted,
body.template-proto .small {
  color: #333;
}
body.template-proto .card {
  background: #ececec;
  border-color: #9a9a9a;
  color: #111;
}
body.template-proto .card p,
body.template-proto .card h2,
body.template-proto .card h3 {
  color: #111;
}
body.template-proto .lock-banner {
  background: #dce775;
  border-color: #9e9d24;
  color: #333;
}
body.template-proto .stat {
  background: #e8e8e8;
  border-color: #9a9a9a;
}
body.template-proto .stat .n {
  color: #1565c0;
}
body.template-proto input,
body.template-proto select,
body.template-proto textarea {
  background: #fff;
  color: #111;
  border-color: #8a8a8a;
}
body.template-proto .btn-ghost {
  background: #eee;
  color: #111;
  border-color: #888;
}
body.template-proto .list li {
  border-bottom-color: #b0b0b0;
}
body.template-proto .profile-add-row {
  border-top-color: #b0b0b0;
}
body.template-proto .btn-icon {
  background: #eee;
  color: #444;
  border-color: #888;
}
body.template-proto .btn-icon:hover,
body.template-proto .btn-icon:focus-visible {
  color: #b00020;
  border-color: #b00020;
  background: #fdeaea;
}
body.template-proto .notice,
body.template-proto .inapp-notice {
  background: #fff8e1;
  color: #111;
  font-size: 0.75rem;
  padding: 6px 8px;
  margin-bottom: 6px;
}
body.template-proto .flash {
  font-size: 0.8rem;
  padding: 10px 12px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.38);
}
body.template-proto a {
  color: #0d47a1;
}
body.template-proto .contact-card {
  background: #ececec;
  color: #111;
}
body.template-proto .data,
body.template-proto table {
  color: #111;
}

body.template-proto .pin-pad button {
  background: #eee;
  color: #111;
  border-color: #888;
}
body.template-proto .pin-dot {
  border-color: #666;
}
body.template-proto .pin-dot.filled {
  background: #1565c0;
}

body.template-proto .flashes {
  padding: 0;
}

/* Motion — overlays and taps only. No entrance motion on area changes
   (staggered tile slides + scrollbar gutters were shoving the frame sideways). */
@keyframes pop-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}
@keyframes toast-in {
  from { transform: translateY(-110%); }
  to { transform: translateY(0); }
}
@keyframes toast-out {
  from { transform: translateY(0); }
  to { transform: translateY(-120%); }
}
@keyframes pin-pop {
  from { transform: scale(0.75); }
  to { transform: scale(1); }
}

.btn,
.proto-left,
.proto-options-btn,
.topbar-back,
.account-btn,
.proto-opt,
.opt-row,
.proto-dock a,
.bottom-nav a {
  transition: background-color var(--motion), border-color var(--motion), color var(--motion), filter var(--motion), box-shadow var(--motion);
}
.btn:active,
.proto-opt:active,
.opt-row:active,
.proto-options-btn:active,
.topbar-back:active,
.proto-left:active,
.dept-tile:active,
.home-tile:active {
  filter: brightness(0.94);
}
@media (hover: hover) {
  .dept-tile,
  .home-tile {
    transition: transform var(--motion), border-color var(--motion), background-color var(--motion), filter var(--motion);
  }
  .dept-tile:hover,
  .home-tile:hover {
    transform: translateY(-2px);
  }
}

input,
select,
textarea,
.search-bar input,
.proto-search input,
.topbar-search input {
  transition: border-color var(--motion), box-shadow var(--motion), background-color var(--motion);
}

@media (prefers-reduced-motion: reduce) {
  .flash,
  .flash.is-out {
    animation: none;
  }
  .flash.is-out {
    display: none;
  }
}
.pin-dot {
  transition: background-color var(--motion), border-color var(--motion);
}
.pin-dot.filled {
  animation: pin-pop 0.14s ease-out;
}
.pin-pad button {
  transition: filter var(--motion), background-color var(--motion);
}
.pin-pad button:active {
  filter: brightness(0.9);
}

.suggest-box:not([hidden]),
.opt-sheet:not([hidden]),
.proto-options:not([hidden]),
.proto-tips:not([hidden]),
.proto-hide:not([hidden]),
.app-support:not([hidden]),
.account-dropdown:not([hidden]) {
  animation: pop-in 0.14s ease-out;
}
.bottom-nav a,
.bottom-nav a.context,
.bottom-nav a.community.here {
  transition: color var(--motion), box-shadow var(--motion);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* Worker brief + catalogue / setup */
.work-brief {
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}
.work-brief-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.work-role {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--business);
}
.work-next {
  font-size: 0.72rem;
  color: var(--text-muted);
}
.work-do {
  margin: 0 0 8px;
  font-size: 0.88rem;
}
.work-check {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.work-check li {
  margin: 0 0 4px;
}
.work-docs,
.work-handoff {
  margin: 8px 0 0;
  font-size: 0.72rem;
  color: var(--text-muted);
}
.work-handoff {
  padding-left: 1.1rem;
}
.cat-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}
.pack-picks {
  display: grid;
  gap: 8px;
  margin-top: 6px;
}
.pack-pick {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
}
.pack-pick input {
  width: auto;
  margin-top: 4px;
}
.pack-pick small {
  display: block;
  color: var(--text-muted);
  font-size: 0.72rem;
}
.id-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
}
@media (max-width: 640px) {
  .id-fields { grid-template-columns: 1fr; }
}
.create-split {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin: 0 0 12px;
}
.create-cols-head,
.create-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(92px, 0.62fr);
  gap: 0;
  align-items: center;
}
.create-cols-head {
  background: #121922;
  padding: 4px 10px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8b9cb3;
  border-bottom: 1px solid var(--border);
}
.create-row {
  padding: 0;
  border-bottom: 1px solid var(--border);
}
.create-row:last-child {
  border-bottom: 0;
}
.create-data,
.create-source {
  padding: 5px 10px;
  margin: 0;
}
.create-source {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px 6px;
  font-size: 0.65rem;
  line-height: 1.2;
  color: var(--text-muted);
  background: rgba(18, 25, 34, 0.55);
  border-left: 1px solid var(--border);
  align-self: stretch;
  overflow-x: auto;
}
.create-source select {
  width: 100%;
  padding: 5px 6px;
  font-size: 0.72rem;
  border-radius: 8px;
}
.create-row.class-row {
  align-items: start;
}
.create-row.span {
  grid-template-columns: 1fr;
}
.create-row.span .create-source {
  display: none;
}
.create-data label {
  margin: 0;
  font-size: 0.68rem;
}
.create-split input,
.create-split select,
.create-split textarea {
  padding: 6px 8px;
  border-radius: 8px;
  margin-top: 2px;
}
.create-twin {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.create-twin.one {
  grid-template-columns: 1fr;
}
.create-twin label {
  margin: 0;
}
.class-compact {
  font-size: 0.78rem;
  line-height: 1.3;
}
.class-note {
  margin-top: 2px;
}
.class-note summary {
  cursor: pointer;
  font-size: 0.68rem;
  color: var(--text-muted);
}
.source-ok {
  color: var(--success);
  font-weight: 700;
  white-space: nowrap;
}
.source-no {
  color: var(--text-muted);
}
.source-links {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 0 6px;
  white-space: nowrap;
}
.source-links a {
  font-size: 0.68rem;
}
.tiny {
  font-size: 0.68rem;
  line-height: 1.3;
}
.title-live {
  margin: 0;
  padding: 8px 10px;
  border: 0;
  border-radius: 0;
  background: var(--bg-elevated);
}
.title-live strong {
  display: block;
  margin: 1px 0 0;
  font-size: 0.92rem;
  color: var(--text);
}
.create-more {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
  margin-top: 10px;
}
.create-more label {
  margin: 0;
  font-size: 0.72rem;
}
.create-more .span {
  grid-column: 1 / -1;
}
.create-more textarea {
  min-height: 52px;
  padding: 6px 8px;
}
.create-card .page-sub {
  margin-bottom: 8px;
}

/* Phone: keep source as a slim chip column — do not stack under the field. */
body.template-phone .create-cols-head,
body.template-phone .create-row,
body.template-proto .create-cols-head,
body.template-proto .create-row {
  grid-template-columns: minmax(0, 1fr) minmax(78px, 0.55fr);
}
body.template-phone .create-data,
body.template-phone .create-source,
body.template-proto .create-data,
body.template-proto .create-source {
  padding: 4px 8px;
}
body.template-phone .pack-picks {
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
body.template-phone .pack-pick {
  padding: 6px 8px;
  gap: 6px;
  border-radius: 8px;
}
body.template-phone .pack-pick small {
  font-size: 0.62rem;
}
body.template-phone .page-title {
  display: none;
}
body.template-phone .phone-hide {
  display: none;
}
body.template-phone .create-more {
  gap: 6px 8px;
}
@media (max-width: 720px) {
  body.template-wide .create-cols-head,
  body.template-wide .create-row {
    grid-template-columns: minmax(0, 1fr) minmax(88px, 0.55fr);
  }
}
.setup-progress {
  height: 4px;
  border-radius: 99px;
  background: var(--border);
  margin: 0 0 12px;
  overflow: hidden;
}
.setup-progress span {
  display: block;
  height: 100%;
  background: var(--success);
}
.setup-steps {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}
.setup-step {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
}
details.setup-step {
  display: block;
  padding: 4px 10px 10px;
}
details.setup-step > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  list-style: none;
  padding: 8px 4px;
}
details.setup-step > summary::-webkit-details-marker {
  display: none;
}
details.setup-step > summary small {
  display: block;
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.78rem;
}
.fold-inner {
  margin: 8px 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px 10px 10px;
  background: var(--bg);
}
.fold-inner > summary,
.fold-card > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  font-size: 0.82rem;
}
.fold-inner > summary::-webkit-details-marker,
.fold-card > summary::-webkit-details-marker {
  display: none;
}
.fold-card {
  border-bottom: 1px solid var(--border);
  padding: 6px 0 8px;
}
.fold-card:last-child {
  border-bottom: 0;
}
.compact-form {
  margin-top: 6px;
}
.compact-form label {
  font-size: 0.72rem;
  margin-top: 8px;
}
.compact-form input,
.compact-form select,
.compact-form textarea {
  font-size: 0.86rem;
  padding: 7px 8px;
}
.inline-del {
  margin-top: 4px;
}
.list.tight li {
  padding: 4px 0;
}
label.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  margin: 4px 0;
}
label.check input {
  margin: 0;
}
label.check input[type="checkbox"],
label.check input[type="radio"] {
  width: 18px;
  height: 18px;
  min-height: 0;
  padding: 0;
  flex: 0 0 18px;
}
.phone-only {
  display: none;
}
body.template-phone .phone-only {
  display: block;
}
body.template-phone .setup-step .btn-row,
body.template-phone .compact-form .btn-row {
  flex-wrap: wrap;
}
body.template-phone .id-fields {
  grid-template-columns: 1fr;
}
body.template-phone .stock-list,
body.template-phone .dg-list,
body.template-phone .doc-list,
body.template-phone .handler-list,
body.template-phone .cert-list {
  max-height: 52vh;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.setup-step.done {
  border-color: var(--success);
}
.setup-step.skipped {
  border-color: var(--border);
  opacity: 0.88;
}
.setup-skip {
  margin-top: 10px;
}
.setup-step .n {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--bg-elevated);
  font-weight: 700;
  flex-shrink: 0;
}
.setup-step.done .n {
  background: var(--success);
  color: #04150d;
}
.setup-step h3 {
  margin: 0 0 4px;
  font-size: 0.95rem;
}
.setup-step p {
  margin: 0 0 6px;
  font-size: 0.82rem;
}

/* Exit the Trade App → mock Samsung home */
body.app-exiting .app-shell {
  transform: scale(0.78) translateY(8%);
  opacity: 0;
  filter: blur(5px);
  border-radius: 28px;
  transform-origin: 50% 38%;
  transition:
    transform 280ms cubic-bezier(0.4, 0, 1, 1),
    opacity 220ms ease,
    filter 220ms ease;
}

.launcher {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  color: #fff;
  background:
    url("../launcher/wallpaper.jpg") center / cover no-repeat,
    #0b1220;
  user-select: none;
  -webkit-user-select: none;
  animation: launcher-in 380ms ease;
}
@keyframes launcher-in {
  from {
    opacity: 0;
    transform: scale(1.06);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

.launcher-status {
  flex: 0 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 22px 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  position: relative;
  z-index: 2;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}
.launcher-status-sig {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.66rem;
}
.sig-bars {
  width: 13px;
  height: 10px;
  background:
    linear-gradient(#fff, #fff) 0 100% / 2px 40% no-repeat,
    linear-gradient(#fff, #fff) 4px 100% / 2px 60% no-repeat,
    linear-gradient(#fff, #fff) 8px 100% / 2px 80% no-repeat,
    linear-gradient(#fff, #fff) 12px 100% / 2px 100% no-repeat;
}
.sig-bat {
  padding: 1px 5px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 4px;
  font-size: 0.58rem;
  font-weight: 800;
}

.launcher-hero {
  flex: 0 0 auto;
  padding: 18px 22px 6px;
}
.launcher-clock-time {
  font-size: 3.35rem;
  font-weight: 300;
  letter-spacing: -0.05em;
  line-height: 0.95;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}
.launcher-clock-date {
  margin-top: 6px;
  font-size: 0.92rem;
  font-weight: 500;
  opacity: 0.92;
}
.launcher-clock-wx {
  margin-top: 2px;
  font-size: 0.78rem;
  font-weight: 500;
  opacity: 0.78;
}

.launcher-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(5, 1fr);
  padding: 4px 8px 0;
  align-items: center;
  justify-items: center;
}

.launcher-app {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  height: 100%;
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.launcher-app:hover {
  text-decoration: none;
  color: #fff;
}
.launcher-app:active .licon {
  transform: scale(0.88);
}
.launcher-name {
  font-size: 0.58rem;
  font-weight: 600;
  line-height: 1.15;
  text-align: center;
  max-width: 100%;
  padding: 0 1px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}

.licon {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 26%;
  flex: 0 0 auto;
  box-shadow:
    0 3px 8px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
  overflow: hidden;
  transition: transform 120ms ease;
}
.licon::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 46%);
  pointer-events: none;
  z-index: 1;
}
.licon::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 22px;
  height: 22px;
  background: #fff;
  -webkit-mask: var(--glyph) center / contain no-repeat;
  mask: var(--glyph) center / contain no-repeat;
}

.launcher-app.is-ct .licon {
  box-shadow:
    0 0 0 1.5px rgba(0, 201, 167, 0.45),
    0 4px 12px rgba(0, 0, 0, 0.4);
}
.licon-ct {
  background: transparent;
  padding: 0;
}
.licon-ct::before,
.licon-ct::after {
  display: none;
}
.licon-ct img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.06);
  display: block;
}

.licon-phone {
  --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M6.6 10.8c1.4 2.8 3.8 5.1 6.6 6.6l2.2-2.2c.3-.3.7-.4 1.1-.2 1.1.4 2.3.6 3.5.6.6 0 1 .4 1 1V20c0 .6-.4 1-1 1C10.6 21 3 13.4 3 4c0-.6.4-1 1-1h3.5c.6 0 1 .4 1 1 0 1.2.2 2.5.6 3.6.1.4 0 .8-.3 1.1z'/%3E%3C/svg%3E");
  background: linear-gradient(180deg, #4ae08c, #1aa85a);
}
.licon-messages {
  --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M4 4h16a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H8l-4 4V6a2 2 0 0 1 2-2z'/%3E%3C/svg%3E");
  background: linear-gradient(180deg, #4fd1ff, #1a8cff);
}
.licon-chrome {
  background: conic-gradient(from 210deg, #ea4335 0 25%, #fbbc04 25% 50%, #34a853 50% 75%, #4285f4 75% 100%);
}
.licon-chrome::after {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  -webkit-mask: none;
  mask: none;
  box-shadow: inset 0 0 0 4.5px #4285f4;
}
.licon-camera {
  --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M9 4h6l1.5 2H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h3.5zm3 4.5A4.5 4.5 0 1 0 16.5 13 4.5 4.5 0 0 0 12 8.5z'/%3E%3C/svg%3E");
  background: linear-gradient(180deg, #6b7280, #374151);
}
.licon-gallery {
  background: linear-gradient(135deg, #f472b6, #60a5fa 45%, #34d399);
}
.licon-gallery::after {
  --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M4 5h16a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1zm2 10 3.5-4.5 2.5 3 3.5-4.5L20 15z'/%3E%3C/svg%3E");
  -webkit-mask: var(--glyph) center / contain no-repeat;
  mask: var(--glyph) center / contain no-repeat;
}
.licon-calendar {
  background: linear-gradient(180deg, #ef5350 0 30%, #f3f5f8 30%);
}
.licon-calendar::after {
  display: none;
}
.licon-calendar .cal-day {
  position: absolute;
  inset: 30% 0 0;
  display: grid;
  place-items: center;
  color: #c62828;
  font-weight: 800;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  z-index: 2;
}
.licon-clock {
  --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20zm1 5h-2v6l5 3 1-1.7-4-2.3z'/%3E%3C/svg%3E");
  background: linear-gradient(180deg, #60a5fa, #2563eb);
}
.licon-settings {
  --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 8.5A3.5 3.5 0 1 1 8.5 12 3.5 3.5 0 0 1 12 8.5zm9.4 3.1-1.8-.3a7.6 7.6 0 0 0-.8-1.9l1.1-1.5-1.8-1.8-1.5 1.1a7.6 7.6 0 0 0-1.9-.8l-.3-1.8h-2.6l-.3 1.8a7.6 7.6 0 0 0-1.9.8L7.1 5.3 5.3 7.1l1.1 1.5a7.6 7.6 0 0 0-.8 1.9l-1.8.3v2.6l1.8.3a7.6 7.6 0 0 0 .8 1.9l-1.1 1.5 1.8 1.8 1.5-1.1a7.6 7.6 0 0 0 1.9.8l.3 1.8h2.6l.3-1.8a7.6 7.6 0 0 0 1.9-.8l1.5 1.1 1.8-1.8-1.1-1.5a7.6 7.6 0 0 0 .8-1.9l1.8-.3z'/%3E%3C/svg%3E");
  background: linear-gradient(180deg, #9ca3af, #4b5563);
}
.licon-play {
  --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M8 5v14l11-7z'/%3E%3C/svg%3E");
  background: linear-gradient(180deg, #4ade80, #16a34a);
}
.licon-gmail {
  --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M20 6v12H4V6l8 5zM4 4h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z'/%3E%3C/svg%3E");
  background: linear-gradient(180deg, #f87171, #dc2626);
}
.licon-maps {
  --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 2a7 7 0 0 1 7 7c0 5.25-7 13-7 13S5 14.25 5 9a7 7 0 0 1 7-7zm0 4.5A2.5 2.5 0 1 0 14.5 9 2.5 2.5 0 0 0 12 6.5z'/%3E%3C/svg%3E");
  background: linear-gradient(180deg, #4ade80, #15803d);
}
.licon-youtube {
  background: linear-gradient(180deg, #ff4d4d, #cc0000);
}
.licon-youtube::after {
  width: 0;
  height: 0;
  background: none;
  -webkit-mask: none;
  mask: none;
  border-style: solid;
  border-width: 6px 0 6px 11px;
  border-color: transparent transparent transparent #fff;
  margin-left: 3px;
}
.licon-photos {
  background: conic-gradient(from 20deg, #fbbc04, #ea4335, #c084fc, #4285f4, #34a853, #fbbc04);
}
.licon-photos::after {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  -webkit-mask: none;
  mask: none;
}
.licon-drive {
  --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 3.2 22 20.8H2z'/%3E%3C/svg%3E");
  background: linear-gradient(180deg, #60a5fa, #1d4ed8);
}
.licon-contacts {
  --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 12a4 4 0 1 0-4-4 4 4 0 0 0 4 4zm0 2c-4.4 0-8 2.2-8 5v1h16v-1c0-2.8-3.6-5-8-5z'/%3E%3C/svg%3E");
  background: linear-gradient(180deg, #fb923c, #ea580c);
}
.licon-calculator {
  --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M6 3h12a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zm1 3v4h10V6zm0 6h3v2H7zm5 0h3v2h-3zm5 0h3v2h-3zM7 16h3v2H7zm5 0h3v2h-3zm5 0h3v2h-3z'/%3E%3C/svg%3E");
  background: linear-gradient(180deg, #6b7280, #1f2937);
}
.licon-notes {
  --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M6 3h9l5 5v13a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zm8 1.5V9h4.5z'/%3E%3C/svg%3E");
  background: linear-gradient(180deg, #fde047, #eab308);
}
.licon-notes::after {
  background: #3f3f46;
}
.licon-weather {
  --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M6.5 20a4.5 4.5 0 0 1-.4-9 6 6 0 0 1 11.5-1.6A4.5 4.5 0 0 1 17.5 20z'/%3E%3C/svg%3E");
  background: linear-gradient(180deg, #7dd3fc, #0284c7);
}
.licon-files {
  --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M3 6h7l2 2h9v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'/%3E%3C/svg%3E");
  background: linear-gradient(180deg, #93c5fd, #2563eb);
}
.licon-music {
  --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M18 3v10.5A3.5 3.5 0 1 1 16 10V7h-6v8.5A3.5 3.5 0 1 1 8 12V3z'/%3E%3C/svg%3E");
  background: linear-gradient(180deg, #fb7185, #e11d48);
}
.licon-wallet {
  --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M3 7a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v3h-4a2 2 0 0 0 0 4h4v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2zm14 4h4v2h-4a1 1 0 0 1 0-2z'/%3E%3C/svg%3E");
  background: linear-gradient(180deg, #a78bfa, #6d28d9);
}
.licon-health {
  --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 21s-7-4.4-9.5-8.2C.4 9.8 2.2 6 6 6c2 0 3.4 1 4 2 .6-1 2-2 4-2 3.8 0 5.6 3.8 3.5 6.8C19 16.6 12 21 12 21z'/%3E%3C/svg%3E");
  background: linear-gradient(180deg, #fb7185, #e11d48);
}
.licon-internet {
  --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20zm0 2c-.7 1.8-1.2 4.3-1.2 8s.5 6.2 1.2 8c.7-1.8 1.2-4.3 1.2-8s-.5-6.2-1.2-8zM4.6 9h14.8A8 8 0 0 0 4.6 9zm0 6h14.8A8 8 0 0 1 4.6 15z'/%3E%3C/svg%3E");
  background: linear-gradient(180deg, #38bdf8, #0369a1);
}
.licon-keep {
  --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M9 21h6v-1.5H9zM12 2a7 7 0 0 1 4 12.7V17H8v-2.3A7 7 0 0 1 12 2z'/%3E%3C/svg%3E");
  background: linear-gradient(180deg, #fde047, #f59e0b);
}
.licon-keep::after {
  background: #3f3f46;
}
.licon-meet {
  --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M3 7h12a2 2 0 0 1 2 2v1l4-3v12l-4-3v1a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2z'/%3E%3C/svg%3E");
  background: linear-gradient(180deg, #2dd4bf, #0f766e);
}
.licon-translate {
  --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M5 19h2.2l1-3h7.6l1 3H19L13 5h-2zm5.1-5L12 8.2 13.9 14z'/%3E%3C/svg%3E");
  background: linear-gradient(180deg, #60a5fa, #2563eb);
}
.licon-news {
  --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M4 5h12v14H6a2 2 0 0 1-2-2zm14 2h2v12a2 2 0 0 1-2 2h-1zM7 8h6v4H7zm0 6h6v2H7z'/%3E%3C/svg%3E");
  background: linear-gradient(180deg, #f87171, #b91c1c);
}
.licon-assistant {
  --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='8' cy='12' r='3'/%3E%3Ccircle cx='16.5' cy='9.5' r='2.2'/%3E%3Ccircle cx='16' cy='16.5' r='1.6'/%3E%3C/svg%3E");
  background: linear-gradient(180deg, #93c5fd, #2563eb);
}
.licon-store {
  --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M6 8V7a6 6 0 0 1 12 0v1h2l-1.2 13H5.2L4 8zm2 0h8V7a4 4 0 0 0-8 0z'/%3E%3C/svg%3E");
  background: linear-gradient(180deg, #4ade80, #15803d);
}

.launcher-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 6px 0 4px;
}
.launcher-dots .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
}
.launcher-dots .dot.on {
  background: #fff;
}

.launcher-dock {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 4px 14px 8px;
  padding: 10px 6px 12px;
  border-radius: 28px;
  background: rgba(16, 20, 28, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  justify-items: center;
}
.launcher-dock .launcher-name {
  display: none;
}
.launcher-dock .licon {
  width: 50px;
  height: 50px;
}

.launcher-home-bar {
  width: 112px;
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.88);
  margin: 0 auto 10px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.launcher-toast {
  position: absolute;
  left: 22px;
  right: 22px;
  top: 112px;
  bottom: auto;
  z-index: 8;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(12, 16, 24, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #e8eef4;
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.launcher-toast[hidden] {
  display: none !important;
}

body.template-phone .dept-tile .desc,
body.template-wide .dept-tile .desc,
body.template-phone .hub-list .dept-tile .desc,
body.template-wide .hub-list .dept-tile .desc {
  display: none;
}
body.template-phone .dept-tile,
body.template-wide .dept-tile {
  min-height: 0;
}
body.template-phone .hub-list .dept-tile .icon,
body.template-phone .dept-tile .icon {
  grid-row: 1;
}
body.template-phone .community-page .dept-tile,
body.template-wide .community-page .dept-tile {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  column-gap: 12px;
  padding: 11px 14px;
}
body.template-phone .community-page .dept-tile .icon,
body.template-wide .community-page .dept-tile .icon {
  grid-column: 1;
  grid-row: 1;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  line-height: 1;
}
body.template-phone .community-page .dept-tile .name,
body.template-wide .community-page .dept-tile .name {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  line-height: 1.25;
}

.chain-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
}
.chain-step {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  text-decoration: none;
}
.chain-step.is-on {
  color: #04140f;
  background: var(--accent, #00c9a7);
  border-color: transparent;
}
.live-route {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.live-route span:first-child {
  min-width: 0;
}
.live-route span:last-child:not(:first-child) {
  white-space: nowrap;
}
.live-card .live-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}
.live-meter {
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.live-meter i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--business), var(--accent));
}
.live-card.is-live .live-meter i {
  background-size: 200% 100%;
  background-image: linear-gradient(90deg, var(--business), #fff, var(--accent));
  animation: live-sheen 1.6s linear infinite;
}
@keyframes live-sheen {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}
.live-clock {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
  margin: 4px 0 8px;
  font-size: 0.78rem;
}
#live-elapsed {
  font-variant-numeric: tabular-nums;
}
#live-phase {
  color: var(--text-muted);
  text-align: right;
}
#live-map {
  height: 280px;
  border-radius: 14px;
  margin-bottom: 8px;
  background: #0c1218;
}
body.template-phone #live-map,
body.template-proto #live-map {
  height: 220px;
}
body.template-wide #live-map {
  height: 340px;
}
body.template-phone .live-card .live-top,
body.template-proto .live-card .live-top {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
.leaflet-container {
  background: #0c1218;
  font: inherit;
}
#live-map .leaflet-tile-pane {
  filter: invert(1) hue-rotate(180deg) brightness(0.85) contrast(0.95);
}

@media (max-height: 720px) {
  .launcher-clock-time {
    font-size: 2.6rem;
  }
  .launcher-hero {
    padding-top: 10px;
    padding-bottom: 0;
  }
  .licon {
    width: 42px;
    height: 42px;
  }
  .launcher-dock .licon {
    width: 44px;
    height: 44px;
  }
}


/* ---- Round 4: status badges, work queue, dashboard, costs ---- */
.badge.tone-ok { color: var(--success); border-color: rgba(62, 207, 142, 0.45); }
.badge.tone-info { color: var(--business); border-color: rgba(0, 180, 216, 0.45); }
.badge.tone-warn { color: var(--warning); border-color: rgba(245, 166, 35, 0.5); }
.badge.tone-bad { color: var(--danger); border-color: rgba(232, 93, 93, 0.5); }
.badge.tone-muted { color: var(--text-muted); }
.empty-state { text-align: center; padding: 18px 8px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 1.6rem; display: block; margin-bottom: 4px; }
.empty-state p { margin: 4px 0; }
.queue { list-style: none; margin: 0; padding: 0; }
.queue li { display: flex; gap: 8px; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--border); }
.queue li:last-child { border-bottom: 0; }
.queue .q-main { min-width: 0; flex: 1; }
.queue .q-title { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue .q-detail { font-size: 0.78rem; color: var(--text-muted); display: block; }
.queue .q-age { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; }
.queue .q-age.overdue { color: var(--danger); font-weight: 700; }
.queue form { margin: 0; }
.queue .btn { white-space: nowrap; }
.count-pill { display: inline-block; min-width: 22px; padding: 1px 7px; border-radius: 999px; font-size: 0.72rem;
  font-weight: 700; background: var(--business); color: #04202a; text-align: center; }
.count-pill.bad { background: var(--danger); color: #fff; }
.stage-bars { display: grid; gap: 6px; }
.stage-bar { display: grid; grid-template-columns: 1fr auto; gap: 6px; font-size: 0.8rem; }
.stage-bar .track { grid-column: 1 / -1; height: 6px; border-radius: 4px; background: var(--bg-hover); overflow: hidden; }
.stage-bar .track i { display: block; height: 100%; background: var(--business); }
.money-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.money-table th, .money-table td { padding: 6px 4px; border-bottom: 1px solid var(--border); text-align: right; }
.money-table th:first-child, .money-table td:first-child { text-align: left; }
.money-table tr.total td { font-weight: 700; border-top: 2px solid var(--border); }
.neg { color: var(--danger); }
.pos { color: var(--success); }
.warn-note { color: var(--warning); }
.page-sub { color: var(--text-muted); font-size: 0.85rem; margin: -6px 0 12px; }
@media (max-width: 420px) {
  .queue li { flex-wrap: wrap; }
  .queue .q-actions { width: 100%; display: flex; justify-content: flex-end; gap: 6px; }
  .money-table { font-size: 0.74rem; }
}
.job-phase.tone-ok { color: var(--success); }
.job-phase.tone-warn { color: var(--warning); }
.job-phase.tone-bad { color: var(--danger); }
.job-phase.tone-info { color: var(--business); }
summary .badge { margin-right: 4px; }


/* ---- Round 9 accessibility basics ---- */
a { color: #4da3ff; }                                   /* 5.5:1 on cards (primary blue was 4.4) */
.btn-primary { background: var(--primary-dim); }         /* white text 6.4:1 (was 3.3) */
:focus-visible {
  outline: 3px solid #ffd166;
  outline-offset: 2px;
  border-radius: 4px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, .btn:focus-visible,
a:focus-visible, summary:focus-visible {
  outline: 3px solid #ffd166 !important;
  outline-offset: 2px;
}
.skip-link {
  position: absolute; left: -9999px; top: 8px; z-index: 10000;
  background: #ffd166; color: #0f1419; padding: 8px 12px; border-radius: 6px; font-weight: 600;
}
.skip-link:focus { left: 8px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---- Round 10 (UX O14): wide tables scroll sideways inside the frame instead of being cut off ---- */
body:not(.template-wide) main table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
body:not(.template-wide) main table > thead, body:not(.template-wide) main table > tbody, body:not(.template-wide) main table > tfoot { width: 100%; }
body.template-wide main .card, body.template-wide main .table-wrap, body.template-wide main section { overflow-x: auto; -webkit-overflow-scrolling: touch; }
body.template-wide main table { width: 100%; }

/* =====================================================================
   Round 11: desktop layout + design tokens (one place for spacing, type, surfaces)
   ===================================================================== */
:root {
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;
  --fs-xs: 0.78rem; --fs-sm: 0.88rem; --fs-md: 1rem; --fs-lg: 1.15rem; --fs-xl: 1.5rem;
  --radius-sm: 8px;
  --side-w: 216px;
}
/* Wide template keeps a desktop width even under 900px. The old 480px cap
   let the Try this column cover the community search. */
body.template-wide { --max: 1240px; }
body.template-wide .app-shell:has(> .side-nav) {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  align-items: start;
  align-content: start; /* short pages: no stretched gap under the top bar */
}
body.template-wide .app-shell:has(> .side-nav) > * { grid-column: 1 / -1; }
body.template-wide .app-shell > .side-nav { grid-column: 1; }
body.template-wide .app-shell > .main.with-side-nav { grid-column: 2; padding: var(--sp-5) var(--sp-6) var(--sp-6); min-width: 0; }
body.template-wide .app-shell:has(> .guest-objectives) {
  grid-template-columns: minmax(0, var(--side-w)) minmax(12rem, 1fr) minmax(11rem, 260px);
}
@media (max-width: 980px) {
  body.template-wide .app-shell:has(> .guest-objectives) {
    grid-template-columns: minmax(8.5rem, var(--side-w)) minmax(14rem, 1fr) 13rem;
  }
}
body.template-wide .app-shell:has(> .guest-objectives) > .side-nav { min-width: 0; }
body.template-wide .app-shell > .guest-objectives {
  grid-column: 3;
  position: sticky;
  top: calc(var(--header-h, 56px) + 8px); /* stay under the top bar so the credit line is not covered */
  margin: 16px 16px 0 0;
  min-width: 0;
  max-width: 100%;
}
.guest-objectives-credit { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; margin: 0 0 8px; }
.guest-objectives-credit strong { font-size: 1.35rem; white-space: nowrap; }
.guest-paid { color: var(--ok, #3dd68c); font-weight: 700; white-space: nowrap; }
.guest-objectives-credit.is-paid strong { animation: guest-credit 0.6s ease; }
@keyframes guest-credit { from { transform: scale(1.15); } to { transform: scale(1); } }
.guest-steps { margin: 0 0 12px; padding-left: 1.1rem; min-width: 0; }
.guest-steps li { margin: 0 0 10px; min-width: 0; }
.guest-steps li span, .guest-steps li a, .guest-steps li small { display: block; overflow-wrap: break-word; }
.guest-steps li small { color: var(--text-muted); }
body.template-wide .main .search-bar { min-width: 0; max-width: 100%; }
body.template-wide .main .search-bar .search-wrap { min-width: 0; flex: 1 1 0; }
body.template-wide .main .search-bar input { min-width: 0; }
.guest-steps li.is-done { opacity: 0.75; }
.guest-choice { display: flex; flex-direction: column; gap: 8px; }
.practice-buy { margin: 0 0 16px; }
.practice-buy h2 { margin: 0 0 6px; font-size: 1rem; }
.guest-steps { list-style: decimal; }
body.template-phone .guest-objectives { margin: 12px 16px 0; }
/* Phone hides .hub-chrome, so these chips sit outside it and stay under the search. */
.guest-search-chips[hidden] { display: none; }
body.template-wide .community-page:not(.products-browse) > .guest-search-chips { max-width: 640px; }
body.template-phone .guest-search-chips { margin-top: 8px; padding-left: 4px; padding-right: 4px; }
/* Phone and proto hide .hub-chrome, so the outside copy is the line under the title there. */
.guest-pack-line { margin: 0 0 8px; color: var(--text-muted); font-size: 0.85rem; }
.guest-pack-line a { color: inherit; }
body.template-wide .guest-pack-outside { display: none; }
body.template-phone .guest-pack-outside,
body.template-proto .guest-pack-outside { display: block; margin: 8px 4px 0; }
body.template-wide .hub-chrome .guest-pack-line { display: block; }
.business-pack-line { margin: 0 0 8px; color: var(--text-muted); font-size: 0.85rem; }
.business-pack-line a { color: inherit; }
body.template-wide .business-pack-outside { display: none; }
body.template-phone .business-pack-outside,
body.template-proto .business-pack-outside { display: block; margin: 8px 4px 0; }
body.template-wide .hub-chrome .business-pack-line { display: block; }
/* Logged-in widescreen keeps Personal / Community / Business on the bottom bar.
   The top bar does not repeat those three. */
body.template-wide .app-shell:has(> .side-nav) {
  padding-bottom: calc(var(--nav-h) + 16px);
}

.side-nav {
  position: sticky; top: 0; align-self: start;
  max-height: 100vh; overflow-y: auto;
  padding: var(--sp-4) var(--sp-3) var(--sp-6);
  border-right: 1px solid var(--border);
  font-size: var(--fs-sm);
}
.side-nav-group + .side-nav-group { margin-top: var(--sp-4); }
.side-nav-head {
  font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-muted); padding: 0;
  display: flex; align-items: stretch; gap: 2px;
}
/* Round 61: groups start collapsed. Left zone = the department page; right zone = show/hide the group's pages. */
.side-nav .side-nav-head > .side-nav-head-link { display: block; flex: 1 1 auto; min-width: 0; color: var(--text-muted); padding: 6px var(--sp-2); border-radius: var(--radius-sm); line-height: 1.3; }
.side-nav .side-nav-head-link:hover { color: var(--text); background: var(--bg-hover); }
.side-nav-group.has-here > .side-nav-head > .side-nav-head-link { color: var(--text); box-shadow: inset 3px 0 0 var(--primary); background: rgba(45, 140, 255, 0.08); }
.side-nav-toggle { flex: none; width: 30px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-muted); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.side-nav-toggle:hover { background: var(--bg-hover); color: var(--text); }
.side-nav-toggle:focus-visible, .side-nav .side-nav-head-link:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.side-nav-chev { width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translate(-2px, -2px); transition: transform .15s; }
.side-nav-toggle[aria-expanded="true"] .side-nav-chev { transform: rotate(225deg) translate(-2px, -2px); }
@media (prefers-reduced-motion: reduce) { .side-nav-chev { transition: none; } }
.side-nav-items { padding-top: 2px; }
.side-nav-items[hidden] { display: none; }
.side-nav-group + .side-nav-group { margin-top: var(--sp-2); }
.side-nav a {
  display: block; padding: 6px var(--sp-2); border-radius: var(--radius-sm);
  color: var(--text); text-decoration: none; line-height: 1.3;
}
.side-nav a:hover { background: var(--bg-hover); text-decoration: none; }
.side-nav a.here { background: rgba(45, 140, 255, 0.16); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--primary); }

/* ---- Round 11: consistent page chrome on desktop ---- */
body.template-wide .main.with-side-nav .hub-chrome a.tiny.muted:first-child { display: none; } /* breadcrumb already shows the way back */
body.template-wide .main.with-side-nav h1, body.template-wide .main.with-side-nav .page-title {
  font-size: var(--fs-xl); line-height: 1.25; margin: 0 0 var(--sp-1); font-weight: 700;
}
body.template-wide .main.with-side-nav h2 { font-size: var(--fs-lg); margin: var(--sp-5) 0 var(--sp-2); }
body.template-wide .main.with-side-nav .crumbs { margin-bottom: var(--sp-3); }
body.template-wide .main.with-side-nav .card { padding: var(--sp-4) var(--sp-5); margin: 0 0 var(--sp-4); border-radius: var(--radius); }
/* forms: fields keep a readable width instead of stretching across the screen */
body.template-wide .main.with-side-nav form :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select, textarea) { max-width: 640px; }
body.template-wide .main.with-side-nav .id-fields { max-width: 640px; }
/* single big action cards become a compact row of buttons, right-aligned (where people look for "next") */
body.template-wide .main.with-side-nav form.order-action { display: flex; justify-content: flex-end; padding: var(--sp-3) var(--sp-4); }
body.template-wide .main.with-side-nav .order-action .btn { width: auto; min-width: 220px; }
/* standard page header: title/sub on the left, primary action on the right */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; margin-bottom: var(--sp-4); }
.page-head .page-head-text { min-width: 0; }
.page-head .page-sub { margin: 0; color: var(--text-muted); }
.page-head .page-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }
.summary-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-4); }
/* topbar on desktop: the side menu replaces Back; the view switch moves to the menu foot */
body.template-wide .app-shell:has(> .side-nav) .topbar-back,
body.template-wide .app-shell:has(> .side-nav) .topbar .template-switch { display: none; }
.side-nav-foot { margin-top: var(--sp-5); padding: 0 var(--sp-2); }
.side-nav-foot select { width: 100%; font-size: var(--fs-xs); }

/* sticky top bar must not cover whatever is scrolled into view (links to #anchors, keyboard focus) */
body.template-wide { scroll-padding-top: 80px; } html:has(body.template-wide) { scroll-padding-top: 80px; }

/* ---- Round 11: forms and lists ---- */
/* "<label>Email<input></label>" pattern: label text above its field, like every other form */
body.template-wide label:has(> input:not([type=checkbox]):not([type=radio]):not([type=hidden])),
body.template-wide label:has(> select), body.template-wide label:has(> textarea) {
  display: flex; flex-direction: column; gap: var(--sp-1);
  margin: 0 0 var(--sp-3); font-size: var(--fs-sm); color: var(--text-muted);
}
body.template-wide label:has(> select) > select, body.template-wide label:has(> input) > input, body.template-wide label:has(> textarea) > textarea { color: var(--text); }
/* folded list rows: name | status column | chevron at the far right (badges no longer float mid-row) */
body.template-wide .fold-card > summary { justify-content: flex-start; align-items: center; gap: var(--sp-4); }
body.template-wide .fold-card > summary > strong:first-child { flex: 0 0 min(42%, 420px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.template-wide .fold-card > summary::after { margin-left: auto; }

/* ---- Round 11: utility classes replacing inline styles ---- */
.inline-form { display: inline !important; }
.inline-block { display: inline-block !important; }
.fs-md { font-size: var(--fs-md) !important; }
.fs-lg { font-size: var(--fs-lg) !important; }
.mt-2 { margin-top: var(--sp-2) !important; }
.mt-3 { margin-top: var(--sp-3) !important; }
.mb-4 { margin-bottom: var(--sp-4) !important; }
.float-end { float: right !important; }
.pre-wrap { white-space: pre-wrap !important; }
.mw-420 { max-width: 420px !important; }

/* ---- Round 11: one table style on desktop ---- */
body.template-wide .main.with-side-nav table:not(.money-table) th {
  text-align: left; font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase;
  color: var(--text-muted); padding: var(--sp-2) var(--sp-3); border-bottom: 1px solid var(--border); white-space: nowrap;
}
body.template-wide .main.with-side-nav table:not(.money-table) td {
  text-align: left; padding: var(--sp-2) var(--sp-3); border-bottom: 1px solid rgba(45, 63, 84, 0.6); vertical-align: top;
}
body.template-wide .main.with-side-nav table:not(.money-table) tbody tr:hover td { background: rgba(255, 255, 255, 0.025); }
body.template-wide .main.with-side-nav table :is(td, th).num { text-align: right; font-variant-numeric: tabular-nums; }
/* multi-column data grids: text left, numbers right (money-table alone stays a 2-column label/amount list) */
body.template-wide .money-table.data-table th, body.template-wide .money-table.data-table td { text-align: left; padding: 6px 10px; }
body.template-wide .money-table.data-table :is(th, td).num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---- Round 12: department overview + section titles ---- */
.card-title { font-size: var(--fs-md) !important; font-weight: 700; margin: 0 0 var(--sp-3) !important; display: flex; align-items: center; gap: var(--sp-2); }
.link-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--sp-2); }
.link-grid a { display: block; padding: var(--sp-3); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); height: 100%; }
.link-grid a:hover { background: var(--bg-hover); text-decoration: none; border-color: var(--primary-dim); }
.link-grid a span { display: block; margin-top: 2px; font-size: var(--fs-xs); color: var(--text-muted); }
.side-nav a.more { color: var(--text-muted); font-size: var(--fs-xs); }

/* ---- Round 12: remaining one-off inline styles moved here ---- */
.w-60 { width: 60px !important; } .w-70 { width: 70px !important; } .w-120 { width: 120px !important; } .w-full { width: 100% !important; }
.chip-list { display: flex; gap: var(--sp-2); flex-wrap: wrap; list-style: none; padding: 0; margin: 0; }
.list-plain { list-style: none; padding: 0; margin: 0; }
.code-lg { font-size: 1.1em; letter-spacing: 0.1em; }
.mb-3 { margin-bottom: var(--sp-3) !important; } .ml-2 { margin-left: var(--sp-2) !important; } .my-3 { margin: var(--sp-3) 0 !important; }
.mt-1 { margin-top: var(--sp-1) !important; } .mt-4 { margin-top: var(--sp-4) !important; } .py-1 { padding: var(--sp-1) 0 !important; } .pl-4 { padding-left: 18px !important; }
.mw-560 { max-width: 560px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); }
.filter-bar { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: flex-end; }
.portal-bar { padding: 10px 16px; display: flex; justify-content: space-between; align-items: center; }
.portal-main { max-width: 900px; margin: 16px auto; padding: 0 12px; } .portal-main-wide { max-width: 1000px; }
.cols-2 { grid-template-columns: 1fr 1fr !important; }
.row-line { padding: var(--sp-2) 0; border-bottom: 1px solid var(--border); }
.box-pad { padding: 10px; margin: var(--sp-2) 0; }
.cursor-default { cursor: default; }
.flex-1 { flex: 1; } .text-center { text-align: center; }
.mt-6 { margin-top: 6px !important; } .mt-10 { margin-top: 10px !important; } .mb-10 { margin-bottom: 10px !important; }
.row-line { border-bottom-color: #2a3340; }

/* ---- Round 12: common record header (order / PO / shipment) ---- */
.detail-head { display: grid; grid-template-columns: 1fr auto; gap: var(--sp-2) var(--sp-4); margin-bottom: var(--sp-4);
  padding-bottom: var(--sp-3); border-bottom: 1px solid var(--border); }
.detail-head .page-actions { align-self: start; }
.detail-kind { margin: 0; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); font-weight: 700; }
.detail-title { font-weight: 500; color: var(--text-muted); }
.detail-facts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-6); margin: var(--sp-2) 0 0; }
.detail-facts dt { font-size: var(--fs-xs); color: var(--text-muted); }
.detail-facts dd { margin: 0; font-weight: 600; }
.detail-tabs { grid-column: 1 / -1; display: flex; gap: var(--sp-1); margin-top: var(--sp-2); }
.detail-tabs a { padding: 6px var(--sp-3); border-radius: var(--radius-sm); color: var(--text-muted); font-size: var(--fs-sm); }
.detail-tabs a:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
body.template-wide .detail-head ~ .order-lead :is(.order-name, .order-meta) { display: none; }
/* the record header already shows status, dates, totals and the invoice link */
body.template-wide .detail-head ~ p.tiny:has(> #invoice-pdf) { display: none; }
body.template-wide .detail-head ~ #so-lines > p:nth-child(-n+2) { display: none; }
body.template-wide .detail-head ~ #so-lines::before { content: "Order lines"; display: block; font-weight: 700; margin-bottom: var(--sp-2); }

/* ---- Round 12: states ---- */
.btn.is-busy, button.is-busy { opacity: 0.7; pointer-events: none; cursor: progress; }
.error-page { max-width: 560px; margin: var(--sp-6) auto; }
p.empty { padding: var(--sp-4); text-align: center; color: var(--text-muted); border: 1px dashed var(--border); border-radius: var(--radius-sm); }

/* ---- Round 14: desktop global search, shortcuts help, sortable tables (wide only) ---- */
body.template-wide .global-search { flex: 1 1 420px; max-width: 520px; }
body.template-wide .global-search .search-wrap { position: relative; }
body.template-wide .global-search input { width: 100%; }
body.template-wide .suggest-group { padding: 6px 12px 2px; text-transform: uppercase; letter-spacing: .04em; }
body.template-wide .suggest-item { text-decoration: none; }
body.template-wide .suggest-item .s-cat { color: var(--text-muted); font-size: var(--fs-sm, .8rem); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55%; }
body.template-wide th.sortable { cursor: pointer; user-select: none; }
body.template-wide th.sortable:hover { color: var(--text); }
body.template-wide th[aria-sort="ascending"]::after { content: " ▲"; font-size: .7em; }
body.template-wide th[aria-sort="descending"]::after { content: " ▼"; font-size: .7em; }
.kbd-help { position: fixed; right: 24px; bottom: 24px; z-index: 200; width: 380px; max-height: 80vh; overflow: auto; box-shadow: var(--shadow); }
.kbd-help[hidden] { display: none; }
kbd { display: inline-block; min-width: 1.4em; padding: 1px 6px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; font: 600 .8rem/1.4 ui-monospace, monospace; text-align: center; }
body.template-wide .search-results { list-style: none; margin: 0; padding: 0; }
body.template-wide .search-results li { padding: 8px 0; border-bottom: 1px solid var(--border); }
body.template-wide .search-results li:last-child { border-bottom: 0; }
.kbd-table { width: 100%; border-collapse: collapse; }
.kbd-table td { padding: 5px 4px; text-align: left; border-bottom: 1px solid var(--border); font-size: .88rem; }
.kbd-table td:first-child { white-space: nowrap; width: 1%; padding-right: 14px; }
/* dashboard charts (wide only) */
body.template-wide .dash-charts { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4, 16px); margin: var(--sp-4, 16px) 0; }
body.template-wide .dash-charts .card { margin: 0; }
body.template-wide .dash-charts .dash-wide { grid-column: 1 / -1; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--chart-grid, var(--border)); stroke-dasharray: 2 4; }
.chart .zero { stroke: var(--chart-axis, var(--text-muted)); }
.chart .axis, .chart text { fill: var(--chart-axis, var(--text-muted)); font-size: 11px; }
.chart .axis.lbl { fill: var(--chart-label, var(--text)); }
.chart .bar { fill: var(--chart-bar); }
.chart .bar.in { fill: var(--chart-in); }
.chart .bar.out { fill: var(--chart-out); }
.chart .line { fill: none; stroke: var(--chart-line); stroke-width: 2.5; }
.chart .dot { fill: var(--chart-line); }

/* ---- Round 14: print-friendly record pages (orders, POs, product, customer, supplier, carrier, reports) ---- */
@media print {
  .template-wide .sec-body[hidden] { display: block !important; } .sec-fold-all { display: none !important; }
  @page { margin: 14mm 12mm; }
  html, body { background: #fff !important; color: #111 !important; }
  body * { box-shadow: none !important; text-shadow: none !important; background-color: transparent !important; background-image: none !important; }
  .breadcrumb, .crumbs, nav[aria-label=Breadcrumb] { display: none !important; }
  .side-nav, .topbar, .app-topbar, header.topbar, .bottom-nav, .tabbar, .flashes, .skip-link, .page-actions, .detail-tabs,
  .dev-rails, .dev-rail, .kbd-help, .suggest-box, .template-switch,
  .vlist-q, input[type=search], form button, .btn, .hub-chrome a.tiny.muted, #page-csv, .no-print { display: none !important; }
  body.template-wide .app-shell:has(> .side-nav) { display: block !important; }
  main, .main, .app-shell, .container { width: auto !important; max-width: none !important; margin: 0 !important; padding: 0 !important; }
  .card, section.card { background: #fff !important; border: 1px solid #bbb !important; border-radius: 4px !important; break-inside: avoid; page-break-inside: avoid; color: #111 !important; }
  h1, h2, h3, .page-title, .card-title, .detail-kind, dt, dd, td, th, p, li, span, strong { color: #111 !important; }
  .muted, .tiny.muted, dt { color: #555 !important; }
  a { color: #111 !important; text-decoration: none !important; }
  .badge { border: 1px solid #777 !important; background: #fff !important; color: #111 !important; }
  table { border-collapse: collapse !important; width: 100% !important; }
  th, td { border-bottom: 1px solid #ccc !important; background: #fff !important; }
  tr { break-inside: avoid; }
  .detail-head { border-bottom: 2px solid #111 !important; margin-bottom: 8px !important; }
  .chart .bar { fill: #666 !important; } .chart .line, .chart .dot { stroke: #000 !important; fill: #000; } .chart .axis { fill: #333 !important; }
  details > summary { list-style: none; }
  #so-cancel, #po-cancel { display: none !important; }
}
body.template-wide .form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2, 8px) var(--sp-4, 16px); max-width: none; align-items: end; }
body.template-wide .form-grid-2 .btn-row { grid-column: 1 / -1; }

/* Round 18: compact toolbar forms (filters, import, scan) on desktop */
body.template-wide .toolbar-form { display: flex; flex-wrap: wrap; gap: var(--space-3, 12px); align-items: flex-end; }
body.template-wide .toolbar-form label { display: flex; flex-direction: column; gap: 4px; margin: 0; }
body.template-wide .toolbar-form label.check { flex-direction: row; align-items: center; }
body.template-wide .toolbar-form label.grow { flex: 1 1 320px; }
body.template-wide .toolbar-form .btn { margin: 0; }
body.template-wide .summary-line { margin-bottom: var(--space-3, 12px); }
body.template-wide .ghs-preview { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
body.template-wide .ghs-preview .signal { font-size: 1.2rem; text-transform: uppercase; margin-left: 8px; }
body.template-wide .check-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; border: 0; padding: 0; }

/* Round 22: Floor tools (new phone pages only) */
.floor-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.floor-tile { display: block; text-decoration: none; color: inherit; min-height: 72px; }
.floor-page .btn { display: block; width: 100%; text-align: center; margin: 6px 0; box-sizing: border-box; }
.floor-sync { margin-left: 6px; }
.floor-conflicts { margin: 6px 0; }
.tour-step { padding: 8px 0; border-bottom: 1px solid rgba(127,127,127,.2); }
.tour-step:last-child { border-bottom: 0; }
body.template-wide .stat-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
body.template-wide .stat-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.floor-sync[hidden] { display: none !important; }
body.template-wide .input-qty { max-width: 9em; }
/* Round 27: long page summaries no longer push the header actions onto their own line */
body.template-wide .page-head .page-head-text { flex: 1 1 420px; }
body.template-wide .page-head .page-actions { flex: 0 0 auto; }
/* Round 29: on desktop the developer panels are drawers docked to the right edge (closed by default) so they
   never widen the page; opening one overlays the content instead of pushing it sideways. Phone view unchanged. */
body.template-wide .dev-rails {
  position: fixed; right: 6px; top: 64px; grid-column: auto; flex-direction: column; align-items: flex-end;
  max-height: calc(100vh - 80px); z-index: 60; pointer-events: none; max-width: none;
}
body.template-wide .dev-rail { pointer-events: auto; margin-top: 0; box-shadow: 0 10px 28px rgba(0, 0, 0, .45); max-height: calc(100vh - 160px); }
body.template-wide .stage { grid-template-columns: minmax(0, 1fr) minmax(0, var(--max)) minmax(44px, 1fr); }
body.template-wide .id-otp { max-width: 340px; }

/* Round 31: glossary page + '?' help tips (tips render on the desktop layout only) */
.help-tip { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px;
  margin-left: 6px; border-radius: 50%; font-size: 12px; font-weight: 700; line-height: 1; cursor: help; vertical-align: middle;
  color: var(--accent, #22d3ee); border: 1px solid currentColor; background: transparent; }
.help-tip:focus { outline: 2px solid var(--accent, #22d3ee); outline-offset: 2px; }
.help-tip-body { display: none; position: absolute; z-index: 60; top: calc(100% + 8px); left: -8px; width: 320px; max-width: 70vw;
  padding: 10px 12px; border-radius: 8px; font-size: 13px; font-weight: 400; line-height: 1.45; text-align: left; white-space: normal;
  color: var(--text, #e5e7eb); background: var(--bg-elevated); border: 1px solid var(--border, #374151); box-shadow: 0 8px 24px rgba(0,0,0,.35); cursor: auto; }
.help-tip:hover .help-tip-body, .help-tip:focus .help-tip-body, .help-tip:focus-within .help-tip-body { display: block; }
.help-tip-body a { margin-left: 4px; }
.help-tip-demo { display: inline-flex; width: 16px; height: 16px; border-radius: 50%; border: 1px solid currentColor; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }
.glossary-index { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.glossary { margin: 0; display: grid; gap: 10px; }
.glossary-item { display: grid; grid-template-columns: minmax(180px, 240px) 1fr; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--border, #374151); }
.glossary-item:last-child { border-bottom: 0; }
.glossary-item dt { font-weight: 600; }
.glossary-item dd { margin: 0; }
.glossary-item:target { background: rgba(34, 211, 238, .08); }
@media (max-width: 700px) { .glossary-item { grid-template-columns: 1fr; gap: 2px; } }
.tour-step.tour-other { opacity: .72; }
.whatsnew-item { padding: 10px 0; border-bottom: 1px solid var(--border); }
.whatsnew-item:last-child { border-bottom: 0; }
.whatsnew-item ul { margin-top: 4px; padding-left: 20px; }
/* Round 33: import wizards */
.import-steps { margin: 0; padding-left: 20px; display: grid; gap: 10px; }
.import-step > div:first-child { min-width: 0; }
.import-step { display: list-item; }
.import-step .import-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.import-preview tr.row-bad td { background: rgba(240, 116, 116, .08); }
.import-preview td:nth-child(2) { min-width: 220px; }
.import-mode { border: 0; padding: 0; margin: 0 0 8px; display: grid; gap: 4px; flex-basis: 100%; }
.import-diff { margin: 4px 0 0; padding-left: 14px; }

/* Round 37: a link the person can't open (owned by another department) - shown as text, not a dead end */
.link-off { color: inherit; cursor: help; border-bottom: 1px dotted currentColor; }

/* Round 41: company name at the top of the mobile business area (additive) */
.m-company-name { display: none; }
body.template-phone .m-company-name, body.template-proto .m-company-name {
  display: block; margin: 4px 8px 8px; padding: 8px 10px; font-size: 1.15rem; font-weight: 700; line-height: 1.2;
  color: var(--text); background: var(--bg-card); border-left: 4px solid var(--primary); border-radius: 6px;
}

/* Round 41: dark-theme contrast pass. Purple on dark was 3.96:1; lifted to AA (4.5:1+). Proto (light) keeps its colours. */
body:not(.template-proto) { --personal-text: #a99dff; }
body:not(.template-proto) .btn-personal { background: #6650e8; }
body:not(.template-proto) .setup-flow .status-flow-now, body:not(.template-proto) .setup-flow li.bonus .hint,
body:not(.template-proto) .badge.personal, body:not(.template-proto) .profile-enter:hover .meta strong { color: var(--personal-text); }
/* Round 41: phone dark theme, clear contrast failures only (same values as desktop) */
body.template-phone .badge.tone-bad { color: #f68e8e; }
body.template-phone .count-pill.bad { background: #c23b3b; }

/* Round 41 (desktop): collapsible sections and denser lists */
.template-wide .fold-section > summary, .fold-section > summary { cursor: pointer; display: flex; align-items: baseline; gap: var(--sp-3, 12px); list-style: none; font-weight: 700; }
.template-wide .fold-section > summary::-webkit-details-marker, .fold-section > summary::-webkit-details-marker { display: none; }
.template-wide .fold-section > summary::before, .fold-section > summary::before { content: "▸"; color: var(--text-muted); transition: transform var(--motion); }
.template-wide .fold-section[open] > summary::before, .fold-section[open] > summary::before { transform: rotate(90deg); }
/* Round 61: sections made with the fold() macro carry a right-hand chevron (same as the side menu) instead of the ▸ */
.fold-section > summary:has(> .fold-chev)::before { content: none; }
.fold-section > summary { align-items: center; }
.fold-section > summary > .fold-chev { margin-left: auto; flex: none; width: 8px; height: 8px; border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg); transition: transform .15s; margin-right: 4px; }
.fold-section[open] > summary > .fold-chev { transform: rotate(225deg); }
.fold-section > summary:hover > .fold-chev { border-color: var(--text); }
.fold-section > summary .count-pill { font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .fold-section > summary > .fold-chev { transition: none; } }
.template-wide .fold-section > summary:focus-visible, .fold-section > summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
.template-wide .fold-section .fold-sum, .fold-section .fold-sum { font-weight: 400; }
.template-wide .fold-section > .fold-body, .fold-section > .fold-body { margin-top: var(--sp-3, 12px); }
.template-wide #contact-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.template-wide #contact-grid .contact-card { padding: 8px 10px; gap: 8px; }
.template-wide #contact-grid .contact-logo { width: 32px; height: 32px; flex: 0 0 32px; }
.template-wide #contact-grid .contact-body small { line-height: 1.3; }

.template-wide .sec-fold > h2, .template-wide .sec-fold > h3 { margin: 0; }
.template-wide .sec-toggle { all: unset; cursor: pointer; display: flex; align-items: center; gap: var(--sp-2, 8px); width: 100%; font: inherit; color: inherit; }
.template-wide .sec-toggle::before { content: "▾"; color: var(--text-muted); transition: transform var(--motion); }
.template-wide .sec-fold.is-folded .sec-toggle::before { transform: rotate(-90deg); }
.template-wide .sec-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; border-radius: 4px; }
.template-wide .sec-fold.is-folded { padding-top: var(--sp-3, 12px); padding-bottom: var(--sp-3, 12px); }
.template-wide .sec-fold > .sec-body { margin-top: var(--sp-3, 12px); }
.template-wide .sec-fold-all { display: flex; justify-content: flex-end; gap: 6px; margin: 0 0 var(--sp-2, 8px); }
/* Round 41 dark contrast: links on raised/hover panels (was 4.38:1 on /business/setup) */
:where(body.template-wide) a { color: #6cb4ff; }

/* Round 61: new-version banner (static/js/version_watch.js). Fixed overlay - no layout change; hidden until needed. */
.version-banner { position: fixed; left: 50%; top: .6rem; transform: translateX(-50%); z-index: 10002; display: flex; align-items: center; gap: .6rem;
  width: max-content; max-width: 94vw; box-sizing: border-box; padding: .4rem .5rem .4rem .9rem; border-radius: 12px; font-size: .9rem;
  background: var(--panel, #1d2735); color: var(--text, #e8eef6); border: 1px solid var(--primary, #2d8cff); box-shadow: 0 4px 18px rgba(0,0,0,.35); }
.version-banner > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.version-banner .version-refresh { flex: none; white-space: nowrap; border: 0; border-radius: 999px; padding: .25rem .8rem; background: var(--primary, #2d8cff); color: #fff; cursor: pointer; font: inherit; }
.version-banner .version-close { flex: none; border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 1.1rem; line-height: 1; padding: 0 .3rem; }

/* Round 60: shared loading indicator (static/js/busy.js). Overlays only - no layout change. */
.busy-bar { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 10000; pointer-events: none; opacity: 0; transition: opacity .15s; }
.busy-bar.on { opacity: 1; }
.busy-bar-fill { display: block; height: 100%; width: 40%; background: var(--primary, #2d8cff); animation: busy-slide 1.1s ease-in-out infinite; }
@keyframes busy-slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }
.busy-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.busy-toast { position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%); z-index: 10001; max-width: min(92vw, 30rem);
  display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; padding: .6rem .8rem; border-radius: 8px;
  background: var(--bg-elevated, #1a2332); color: var(--text, #e8eef4); border: 1px solid var(--danger, #f07474); box-shadow: 0 4px 16px rgba(0,0,0,.3); }
.busy-toast[hidden] { display: none; }
.busy-toast-msg { flex: 1 1 12rem; }
.busy-spin { display: inline-block; width: .9em; height: .9em; margin-right: .35em; vertical-align: -.12em; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: busy-spin .7s linear infinite; }
@keyframes busy-spin { to { transform: rotate(360deg); } }
.is-busy { cursor: progress; }
button.is-busy, input.is-busy, a.is-busy { opacity: .85; }
.busy-row { display: flex; align-items: center; gap: .3em; }
.busy-row.busy-error { color: var(--danger, #f07474); }
@media (prefers-reduced-motion: reduce) {
  .busy-bar-fill { animation: none; width: 100%; background: repeating-linear-gradient(90deg, var(--primary, #2d8cff) 0 12px, transparent 12px 18px); }
  .busy-spin { animation: none; border: none; width: auto; height: auto; }
  .busy-spin::before { content: "…"; }
}

/* Round 37: desktop contrast fixes (WCAG AA 4.5:1). Scoped to the wide/desktop template so phone pages stay identical. */
.template-wide .profile-trigger.personal,
.template-wide .profile-trigger.personal.on { background: color-mix(in srgb, var(--personal) 78%, #000); }
.template-wide .badge.tone-bad { color: #f68e8e; }
.template-wide .count-pill.bad { background: #c23b3b; }
.template-wide .dev-admin-link { color: #fff; }

/* Round 40: an invisible bridge over the gap between a top menu and its dropdown, so moving the mouse down
   doesn't close it (no visual change). Desktop adds a short close delay in base.html. */
.template-wide .profile-dropdown::before { content: ""; position: absolute; left: 0; right: 0; top: -10px; height: 10px; }
.template-wide .profile-menu.closing .profile-dropdown { display: block; }
/* Round 40: maps without third-party tiles */
.template-wide .no-tiles, .no-tiles { background: #dfe9ee linear-gradient(0deg, rgba(0,0,0,.04) 1px, transparent 1px) 0 0/40px 40px, linear-gradient(90deg, rgba(0,0,0,.04) 1px, transparent 1px) 0 0/40px 40px; }
/* Round 40: quick sales order */
.template-wide .qs-ta, .qs-ta { position: relative; max-width: 560px; }
.template-wide .qs .qs-in, .qs .qs-in { width: 90px; text-align: right; }
/* Round 41: CoA drop box (new element, so the phone gets it too) */
.template-wide .coa-drop, .coa-drop { display: block; border: 2px dashed #9fb3c2; border-radius: 10px; padding: 14px; margin: 6px 0 10px; text-align: center; cursor: pointer; }
.template-wide .coa-drop.is-over, .coa-drop.is-over { background: #eaf4fb; border-color: #2a6f97; }
.template-wide .coa-drop input[type=file], .coa-drop input[type=file] { display: block; margin: 8px auto 0; max-width: 100%; }
.template-wide .pre-wrap, .pre-wrap { white-space: pre-wrap; }

/* Round 44: group headings link to the department page, looking the same as before */
/* Round 61: the group header link is styled with the collapsible side menu above (Round 44 inline style retired). */
/* Round 62: order-form checkout uses the same payment rows and phone actions as Review order */
.buy-pay label.opt-check { display: flex; align-items: flex-start; justify-content: flex-start; gap: 10px; text-align: left; }
.buy-pay label.opt-check > span { flex: 1; min-width: 0; text-align: left; }
.buy-pay label.opt-check small { display: block; }
.buy-pay label.opt-check input { width: auto; flex: none; margin-top: 3px; }
body.template-phone .buy-pay .br-actions, body.template-proto .buy-pay .br-actions { flex-direction: column; gap: 8px; }
body.template-phone .buy-pay .br-actions .btn, body.template-proto .buy-pay .br-actions .btn { width: 100%; min-height: 48px; justify-content: center; }
/* Round 63: desktop department shell - phone-style tile panel docked left, content right */
.template-wide .dept-shell { display: grid; grid-template-columns: minmax(230px, 28%) minmax(0, 1fr); gap: var(--sp-4, 20px); align-items: start; }
.template-wide .dept-panel { position: sticky; top: 12px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px; max-height: calc(100vh - 90px); overflow-y: auto; }
.template-wide .dept-panel-head { display: flex; align-items: center; gap: 8px; padding: 6px 8px 10px; font-weight: 700; font-size: 1.05rem;
  color: var(--text); text-decoration: none; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.template-wide .dept-panel-list { display: flex; flex-direction: column; gap: 2px; }
.template-wide .dept-panel-tile { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--text);
  text-decoration: none; border: 1px solid transparent; }
.template-wide .dept-panel-tile .icon { font-size: 1.2rem; width: 1.6rem; text-align: center; flex: none; }
.template-wide .dept-panel-tile .txt { display: flex; flex-direction: column; min-width: 0; }
.template-wide .dept-panel-tile small { color: var(--text-muted); font-size: 0.75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.template-wide .dept-panel-tile:hover { background: var(--bg-hover); }
.template-wide .dept-panel-tile:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.template-wide .dept-panel-tile.here { background: var(--bg-hover); border-color: var(--border); box-shadow: inset 3px 0 0 var(--primary); }
.template-wide .dept-content { min-width: 0; }
.template-wide .dept-content > .page-head:first-child, .template-wide .dept-content > .hub-chrome:first-child { margin-top: 0; }
.plain-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.template-wide .dept-sub { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin: 18px 0 8px; }
/* Round 63: offline base map (sea + bundled coastlines) under any tiles; loading / offline note */
.cta-sea { background: #b9d3e0 !important; position: relative; }
.cta-sea .leaflet-tile-pane { z-index: 200; }
.city-label { background: transparent; border: 0; box-shadow: none; color: #2b3a44; font-size: 11px; font-weight: 600; padding: 0;
  text-shadow: 0 0 2px #fff, 0 0 2px #fff; }
.city-label::before { display: none; }
.map-note { position: absolute; left: 8px; bottom: 8px; z-index: 800; font-size: 11px; padding: 2px 8px; border-radius: 10px;
  background: rgba(255, 255, 255, .85); color: #234; pointer-events: none; }
/* Round 63: tracking page order card */
.track-order-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.track-order-ref { font-size: 1.15rem; font-weight: 700; }
.track-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 14px; margin: 0 0 10px; }
.track-facts .wide { grid-column: 1 / -1; }
.track-facts dt { color: var(--text-muted); font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.track-facts dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
body.template-phone .track-facts { grid-template-columns: 1fr 1fr; }
.track-items summary { cursor: pointer; font-weight: 700; }
.track-item-list { list-style: none; margin: 8px 0 0; padding: 0; }
.track-item-list li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px solid var(--border); }
.track-item-list .num { white-space: nowrap; font-variant-numeric: tabular-nums; }
#live-map { position: relative; }
/* Round 63: folds on phone (user-approved) - same header, touch-sized tap target */
body.template-phone .fold-section > summary, body.template-narrow .fold-section > summary { min-height: 44px; padding: 4px 0; -webkit-tap-highlight-color: transparent; }
body.template-phone .fold-section > summary > .fold-chev { width: 10px; height: 10px; margin-right: 6px; }
body.template-phone .fold-section .fold-body { margin-top: 8px; }
/* Round 63: dashboard cards never let content push past the frame */
body.template-wide .dash-charts > *, body.template-wide .kpi-grid > *, .card { min-width: 0; }
.chart { max-width: 100%; height: auto; display: block; overflow: hidden; }
.chart .num { font-variant-numeric: tabular-nums; }
/* Round 63: desktop area switch (mirrors the phone bottom nav), side-menu Community entry, trading-as switch */
.template-wide .area-switch { display: inline-flex; gap: 2px; padding: 3px; margin: 0 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2, rgba(255,255,255,.04)); flex: none; }
.template-wide .area-btn { display: inline-flex; align-items: center; gap: 6px; padding: 5px 14px; border-radius: 999px; font-weight: 600; font-size: .88rem; color: var(--text-muted); text-decoration: none; white-space: nowrap; }
.template-wide .area-btn:hover { color: var(--text); background: rgba(255,255,255,.06); }
.template-wide .area-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.template-wide .area-btn.here { color: #06121a; background: var(--accent); }
.template-wide .side-nav-community { display: block; margin: 0 0 10px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); font-weight: 700; color: var(--text); text-decoration: none; }
.template-wide .side-nav-community small { display: block; font-weight: 400; color: var(--text-muted); font-size: .72rem; margin-left: 1.6em; }
.template-wide .side-nav-community:hover, .template-wide .side-nav-community.here { border-color: var(--accent); }
.trading-as { display: flex; align-items: center; gap: 6px; margin: 0 0 12px; }
.trading-as .seg { padding: 4px 12px; border: 1px solid var(--border); border-radius: 999px; font-size: .85rem; text-decoration: none; color: var(--text-muted); }
.trading-as .seg.on { border-color: var(--accent); color: var(--text); font-weight: 600; }
/* Round 63: area header on every page (phone and desktop) */
.area-header { margin: 0 0 8px; font-size: .95rem; font-weight: 700; color: var(--text); letter-spacing: .01em; }
.area-header .area-kind { color: var(--text-muted); font-weight: 600; }
.area-header.area-business { border-left: 3px solid var(--business, #4da3ff); padding-left: 8px; }
.area-header.area-personal { border-left: 3px solid var(--personal, #b38bff); padding-left: 8px; }
.area-header.area-community { border-left: 3px solid var(--accent); padding-left: 8px; }
body.template-phone .area-header, body.template-narrow .area-header { margin: 4px 0 10px; font-size: 1rem; }
.template-wide .dept-panel-community { display: flex; gap: 10px; align-items: center; margin: 0 0 8px; padding: 8px 10px; border: 1px solid var(--accent); border-radius: 10px; text-decoration: none; color: var(--text); }
.template-wide .dept-panel-community small { display: block; color: var(--text-muted); font-size: .72rem; }
.area-header { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* Round 70: one thin desktop sidebar (phone never renders it) - sticky, own scroll, department groups like the phone app */
body.template-wide { --side-w: 228px; }
body.template-wide #app-sidebar { position: sticky; top: 0; height: 100vh; max-height: 100vh; overflow-y: auto; overscroll-behavior: contain;
  padding: var(--sp-3) var(--sp-2) var(--sp-5); scrollbar-width: thin; background: var(--bg-card, transparent); }
#app-sidebar .side-nav-group + .side-nav-group { margin-top: 2px; }
#app-sidebar .side-nav-head > .side-nav-head-link { color: var(--text); font-weight: 600; padding: 6px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#app-sidebar .side-nav-head > .side-nav-head-link.here { box-shadow: inset 3px 0 0 var(--primary); background: rgba(45, 140, 255, 0.16); }
#app-sidebar .sb-icon { display: inline-block; width: 1.4em; text-align: center; }
#app-sidebar .side-nav-items { padding: 2px 0 6px 1.6em; }
#app-sidebar .side-nav-items a { padding: 4px 8px; font-size: var(--fs-xs, .8rem); }
#app-sidebar .side-nav-items a.sb-tile { color: var(--text-muted); }
#app-sidebar .side-nav-items a.sb-tile.here { color: #fff; }
#app-sidebar .side-nav-community { margin: 8px 0 2px; padding: 6px; border: 0; font-weight: 600; }
#app-sidebar .side-nav-community.here { background: rgba(45, 140, 255, 0.16); box-shadow: inset 3px 0 0 var(--primary); }
#app-sidebar .side-nav-items a:not(.sb-tile) + a.sb-tile { margin-top: 6px; border-top: 1px solid var(--border); border-radius: 0 0 var(--radius-sm) var(--radius-sm); padding-top: 6px; }
/* the sticky top bar sits over the page: the sidebar starts under it */
body.template-wide #app-sidebar { top: var(--topbar-h, 56px); height: calc(100vh - var(--topbar-h, 56px)); max-height: calc(100vh - var(--topbar-h, 56px)); }

/* Round 71: narrower desktop windows (900-1099px): a slimmer sidebar, less padding and a top bar that fits */
@media (max-width: 1099px) {
  body.template-wide { --side-w: 196px; }
  body.template-wide .app-shell > .main.with-side-nav { padding: var(--sp-4) var(--sp-4) var(--sp-5); }
  body.template-wide #app-sidebar { padding-left: 4px; padding-right: 4px; }
  body.template-wide #app-sidebar .side-nav-items { padding-left: 1.2em; }
  body.template-wide .topbar { gap: 6px; }
  body.template-wide .topbar .area-btn { padding-left: 8px; padding-right: 8px; }
  body.template-wide .topbar .global-search { flex: 1 1 120px; min-width: 0; }
  body.template-wide .topbar .global-search input { min-width: 0; width: 100%; }
  body.template-wide .profile-menus { flex: none; }
}
@media (max-width: 1099px) {
  body.template-wide .topbar .global-search .search-wrap { min-width: 0; width: 100%; }
  body.template-wide .topbar .global-search input { min-width: 0 !important; width: 100% !important; max-width: none; }
  body.template-wide .topbar .area-btn { font-size: .85rem; }
}
body.template-wide .main.with-side-nav td > a[href*="/order/"]:first-child { white-space: nowrap; }
#app-sidebar a:focus-visible, #app-sidebar button:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
/* Round 71: on narrow desktop windows a wide table scrolls sideways inside its card instead of spilling out */
@media (max-width: 1099px) {
  body.template-wide .main.with-side-nav .table-scroll { max-width: 100%; overflow-x: auto; }
}

/* Round 72: narrow desktop (900-1099px): the top-bar search collapses to a magnifier icon and opens over the bar
   when clicked or focused ("/" still jumps to it); Escape or clicking away closes it again. */
@media (max-width: 1099px) {
  body.template-wide .topbar .global-search { flex: 0 0 40px; position: relative; }
  body.template-wide .topbar .global-search .search-wrap { position: relative; width: 40px; }
  body.template-wide .topbar .global-search .search-wrap::before { content: "\1F50D"; position: absolute; left: 0; top: 50%; width: 40px; text-align: center;
    transform: translateY(-50%); pointer-events: none; font-size: 15px; z-index: 1; }
  body.template-wide .topbar .global-search input { width: 40px !important; padding-left: 0; padding-right: 0; color: transparent; cursor: pointer; }
  body.template-wide .topbar .global-search input::placeholder { color: transparent; }
  body.template-wide .topbar .global-search:focus-within .search-wrap { position: absolute; right: 0; top: 50%; transform: translateY(-50%); width: min(460px, 70vw); z-index: 60; }
  body.template-wide .topbar .global-search:focus-within .search-wrap::before { content: none; }
  body.template-wide .topbar .global-search:focus-within input { width: 100% !important; padding: 0 12px; color: var(--text); cursor: text; box-shadow: 0 6px 24px rgba(0,0,0,.45); }
  body.template-wide .topbar .global-search:focus-within input::placeholder { color: var(--text-muted); }
}
body.template-wide .main.with-side-nav .table-scroll { max-width: 100%; overflow-x: auto; }
#app-sidebar:not(.sb-anim) .side-nav-chev { transition: none; }

/* Round 86: product codes (SUPPLIER-SUBSTANCE-VARIANT-UNITSIZE) never break mid-code */
.code { white-space: nowrap; font-variant-numeric: tabular-nums; }
.inline-search { margin: 0 0 .6rem; }
.inline-search input[type=search] { width: 100%; max-width: 22rem; }

/* Round 102: floating horizontal scrollbar for wide tables on narrow screens (drawn by app.js) */
.hscroll-float { position: fixed; z-index: 60; height: 14px; display: none; touch-action: none; cursor: pointer;
  background: var(--scroll-track, rgba(127,127,127,.25)); }
.hscroll-float.show { display: block; }
.hscroll-float-thumb { position: absolute; top: 3px; left: 0; height: 8px; border-radius: 5px; background: var(--primary, #3a8); opacity: .9; }
@media (min-width: 821px) { body:not(.template-phone) .hscroll-float { display: none !important; } }

/* Round 104: catalogue list actions sit beside the filter ('New product' menu + Import / export) */
.cat-actions { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.menu-pop { position: relative; display: inline-block; }
.menu-pop > summary { list-style: none; cursor: pointer; }
.menu-pop > summary::-webkit-details-marker { display: none; }
.menu-pop-list { position: absolute; right: 0; top: calc(100% + 4px); z-index: 40; min-width: 240px; display: flex; flex-direction: column;
  background: var(--card, #1b2230); border: 1px solid rgba(127,127,127,.3); border-radius: 8px; padding: 4px; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.menu-pop-list a { padding: 8px 10px; border-radius: 6px; text-decoration: none; color: inherit; }
.menu-pop-list a:hover, .menu-pop-list a:focus { background: rgba(127,127,127,.15); }

/* Round 109: the floating scrollbar never moves or resizes on hover (Round 108's lift made the pointer fall between
   bar and nav and flicker). The outer box is a fixed 24px hit area that reaches right down to the top of the bottom
   nav, so the pointer is always on either the bar or the nav. The visible track is drawn by ::before (a 4px visual gap
   above the nav); on hover / press / drag only that drawing changes into a raised card with a border and shadow, and
   the thumb turns the page text colour. */
.hscroll-float { height: 24px !important; background: transparent !important; border: 0; border-radius: 0; box-shadow: none;
  transform: none !important; color: var(--text, #dfe6ee); }
.hscroll-float::before { content: ''; position: absolute; left: 0; right: 0; top: 6px; bottom: 4px; pointer-events: none;
  border-radius: 7px; border: 1px solid transparent; background: var(--scroll-track, rgba(127,127,127,.25));
  transition: top .12s, background-color .12s, box-shadow .12s, border-color .12s; transition-delay: .12s; }
.hscroll-float-thumb { top: 9px; height: 8px; transition: background-color .12s .12s, opacity .12s .12s; }
.hscroll-float:hover::before, .hscroll-float:active::before, .hscroll-float.grab::before {
  top: 2px; background: var(--card, #1b2230); border-color: rgba(127,127,127,.35); border-radius: 10px;
  box-shadow: 0 6px 16px rgba(0,0,0,.45), 0 2px 4px rgba(0,0,0,.3); transition-delay: 0s; }
.hscroll-float:hover .hscroll-float-thumb, .hscroll-float:active .hscroll-float-thumb, .hscroll-float.grab .hscroll-float-thumb {
  background: currentColor; opacity: .85; transition-delay: 0s; }
/* end Round 109 */

/* Round 107: owner-first breadcrumb header (phone: icons + short names; wide: names only) */
.crumb-owner, .crumbs a.crumb { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.crumb-img { width: 20px; height: 20px; border-radius: 5px; object-fit: contain; background: #fff; flex: none; }
.crumb-ic { font-size: 1rem; line-height: 1; }
.crumb-owner .crumb-txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 30vw; }
body.template-wide .crumb-owner .crumb-txt { max-width: none; }
.crumbs .crumb-sep { flex: none; }
.crumb-long { display: none; }
body.template-wide .crumb-long { display: inline; }
body.template-wide .crumb-short, body.template-wide .crumbs .crumb-ic, body.template-wide .crumbs .crumb-img { display: none; }
body.template-wide .crumbs { font-size: 1.05rem; }

/* Round 110: data tables. (1) The page's vertical scrollbar is faded while idle and bright under the pointer or while
   dragged; its width (hit area) never changes, only the drawn thumb (a transparent border narrows it while idle).
   (2) A sticky copy of a long table's header (app.js) sits just under the top header and follows the table sideways.
   (3) The products list has fixed column widths, so it stays one rectangle while rows load in and out, and the HSNO
   cell shows the first few classes with the full list in a tooltip / tap popover. */
/* phone view: the page's own scrollbar is drawn by app.js (.phone-vscroll); the bar box is the fixed hit area */
.phone-vscroll { width: 14px; border-radius: 8px; transition: background-color .12s .12s, box-shadow .12s .12s; }
.phone-vscroll-thumb { left: 0; right: 0; border: 4px solid transparent; background-clip: padding-box;
  background-color: color-mix(in srgb, var(--text, #dfe6ee) 22%, transparent); transition: background-color .12s .12s, border-width .12s .12s; }
.phone-vscroll:hover, .phone-vscroll.dragging { background: color-mix(in srgb, var(--card, #1b2230) 90%, transparent);
  box-shadow: 0 0 0 1px rgba(127,127,127,.35), -2px 0 8px rgba(0,0,0,.35); transition-delay: 0s; }
.phone-vscroll:hover .phone-vscroll-thumb, .phone-vscroll.dragging .phone-vscroll-thumb {
  border-width: 2px; background-color: color-mix(in srgb, var(--text, #dfe6ee) 88%, transparent); transition-delay: 0s; }
/* wide view (when the main area itself scrolls): the same idea with the browser's scrollbar */
main.main { scrollbar-color: auto; scrollbar-width: auto; }
main.main::-webkit-scrollbar { width: 12px; height: 12px; background: transparent; }
main.main::-webkit-scrollbar-track { background: transparent; border-radius: 8px; transition: background-color .12s; }
main.main::-webkit-scrollbar-thumb { min-height: 40px; border-radius: 8px; border: 4px solid transparent; background-clip: padding-box;
  background-color: color-mix(in srgb, var(--text, #dfe6ee) 20%, transparent); }
main.main:hover::-webkit-scrollbar-thumb { background-color: color-mix(in srgb, var(--text, #dfe6ee) 34%, transparent); }
main.main::-webkit-scrollbar-track:hover { background: color-mix(in srgb, var(--card, #1b2230) 80%, transparent); }
main.main::-webkit-scrollbar-thumb:hover, main.main::-webkit-scrollbar-thumb:active {
  border-width: 2px; background-color: color-mix(in srgb, var(--text, #dfe6ee) 88%, transparent); }

main .vlist-table .table-wrap { overflow-x: auto; overflow-anchor: none; }
body main table.data.cat-grid { display: table; table-layout: fixed; width: 1496px; min-width: 100%; max-width: none; overflow: visible; }
table.data.cat-grid th, table.data.cat-grid td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.data.cat-grid td > div { overflow: hidden; text-overflow: ellipsis; }
.hz-short { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; cursor: help;
  border-bottom: 1px dotted color-mix(in srgb, var(--text, #dfe6ee) 45%, transparent); }
.tip-pop { position: fixed; z-index: 220; max-width: min(300px, 90vw); padding: 8px 10px; border-radius: 8px; font-size: .78rem;
  line-height: 1.35; white-space: normal; background: var(--card, #1b2230); color: var(--text, #dfe6ee);
  border: 1px solid rgba(127,127,127,.4); box-shadow: 0 6px 18px rgba(0,0,0,.45); }

.sticky-head { position: fixed; z-index: 55; display: none; overflow: hidden; pointer-events: none;
  background: var(--card, #1b2230); box-shadow: 0 3px 8px rgba(0,0,0,.35); }
.sticky-head.show { display: block; }
.sticky-head > table { display: table !important; table-layout: fixed; margin: 0 !important; max-width: none !important;
  overflow: visible !important; min-width: 0 !important; }
.sticky-head > table th { background: var(--card, #1b2230); }
/* end Round 110 */

/* Round 111: glass phone view - a slimmer case (6px bezel, same rounded corners and notch) and the content using the
   whole screen: header, breadcrumb, cards, tables, tiles and the bottom nav go to the screen edges with at most a 4px
   inset for text and controls; both floating scrollbars are 4px overlays on the edges that grow on hover (hit areas
   unchanged). Phone view only (framed and full-bleed); the wide view is unchanged. */
@media (min-width: 521px) {
  body.template-phone .device { border-width: 6px; }
}
body.template-phone .proto-chrome { padding-left: 4px; padding-right: 4px; gap: 4px; }
body.template-phone .proto-titlebar { padding-left: 4px; padding-right: 4px; }
body.template-phone .main { padding-left: 0; padding-right: 0; }
body.template-phone main .card, body.template-phone main .panel {
  padding-left: 4px; padding-right: 4px; border-left: 0; border-right: 0; border-radius: 0; margin-left: 0; margin-right: 0; }
body.template-phone main .card .table-wrap { margin-left: -4px; margin-right: -4px; }
body.template-phone main table.data th:first-child, body.template-phone main table.data td:first-child { padding-left: 4px; }
body.template-phone main .dept-tile, body.template-phone main .community-page .dept-tile { margin-left: 0; margin-right: 0; border-left: 0; border-right: 0; border-radius: 0;
  padding-left: 4px; padding-right: 4px; }
body.template-phone main :has(> .dept-tile), body.template-phone main .community-page { padding-left: 0; padding-right: 0; margin-left: 0; margin-right: 0; }
body.template-phone main .dept-band, body.template-phone main .page-title, body.template-phone main .page-sub,
body.template-phone main > h2, body.template-phone main > h3, body.template-phone main > p,
body.template-phone main .community-page > p, body.template-phone main .flash { padding-left: 4px; padding-right: 4px; }
/* dashboard figures wrap instead of running off the screen */
body.template-phone .stat-row { grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 2px; margin-left: 0; margin-right: 0; }
body.template-phone .stat { border-radius: 0; border-left: 0; border-right: 0; padding: 8px 4px; min-width: 0; }
body.template-phone .stat .n { font-size: 1.05rem; overflow-wrap: anywhere; }
body.template-phone .bottom-nav { padding-left: 0; padding-right: 0; padding-bottom: 6px; }
/* scrollbars: 4px on the edge, 10px under the pointer / while dragging; boxes (hit areas) never change */
body.template-phone .phone-vscroll { width: 12px; border-radius: 0; }
body.template-phone .phone-vscroll-thumb { left: 0; right: 0; border: 0 solid transparent; border-left-width: 8px; border-radius: 3px; }
body.template-phone .phone-vscroll:hover .phone-vscroll-thumb, body.template-phone .phone-vscroll.dragging .phone-vscroll-thumb { border-width: 0 0 0 2px; }
body.template-phone .phone-vscroll:hover, body.template-phone .phone-vscroll.dragging { background: transparent; box-shadow: none; }
body.template-phone .hscroll-float::before { top: 19px; bottom: 1px; border-radius: 4px; }
body.template-phone .hscroll-float-thumb { top: 19px; height: 4px; border-radius: 4px; transition: top .12s, height .12s, background-color .12s; }
body.template-phone .hscroll-float:hover::before, body.template-phone .hscroll-float.grab::before { top: 9px; }
body.template-phone .hscroll-float:hover .hscroll-float-thumb, body.template-phone .hscroll-float.grab .hscroll-float-thumb { top: 11px; height: 10px; }

/* breadcrumb collapse (app.js): earlier crumbs show only their icon; the last crumb keeps its text; category tag */
.crumbs { flex-wrap: nowrap; overflow: hidden; }
.crumbs > * { flex: none; }
.crumbs > .crumb.current { flex: 0 1 auto; min-width: 0; }
.crumb-ic-c { display: none; }
.crumbs .crumb.collapsed .crumb-txt, .crumbs .crumb.collapsed .crumb-long, .crumbs .crumb.collapsed .crumb-short { display: none !important; }
.crumbs .crumb.collapsed .crumb-ic, .crumbs .crumb.collapsed .crumb-img { display: inline-block !important; }
.crumbs .crumb.collapsed .crumb-img + .crumb-ic { display: none !important; }
.crumb-tag { flex: none; margin-left: 4px; font-size: .78em; font-weight: 500; color: var(--text-muted); white-space: nowrap; }
/* end Round 111 */

/* Round 113: /community/products browse tiles + the substance hub keeps the phone tile list on wide */
.products-browse .sub-grid .dept-band { grid-column: 1 / -1; }
.products-browse .dg-pill { font-size: .66rem; font-weight: 700; color: #f59e0b; border: 1px solid rgba(245,158,11,.5);
  border-radius: 999px; padding: 0 6px; white-space: nowrap; }
.products-browse .sub-tile .name { flex-wrap: wrap; }
.products-browse .sub-tile .desc { grid-column: 2; }
#pb-more { min-height: 1px; padding: 8px 4px; text-align: center; }
body.template-phone .products-browse .sub-grid { display: flex; flex-direction: column; gap: 2px; }
body.template-wide .products-browse .sub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)) !important; gap: 8px; }
/* the header suggest list would cover the tiles it is already filtering */
body:has(#pb-grid) #proto-suggest { display: none !important; }
body.template-wide .products-browse .search-bar { max-width: 720px; }
/* wide substance hub = the phone layout: one column of Markets / Knowledge tiles */
body.template-wide .community-page:not(.products-browse) .community-tiles { display: flex; flex-direction: column; gap: 2px; max-width: 640px; }
body.template-wide .community-page:not(.products-browse) .community-tiles .dept-band { margin-top: 10px; }
body.template-wide .community-page:not(.products-browse) .hub-chrome, body.template-wide .community-page:not(.products-browse) > .btn-row { max-width: 640px; }
body.template-phone .products-browse .sub-tile .desc { display: block !important; grid-column: 2; font-size: .72rem; color: var(--text-muted); }
/* end Round 113 */

/* Round 113b: watch button + watchlist */
.watch-box { margin: 0 0 10px; }
.watch-box > summary { list-style: none; display: inline-flex; cursor: pointer; }
.watch-box > summary::-webkit-details-marker { display: none; }
.watch-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 10px; margin-top: 8px; padding: 10px;
  border: 1px solid var(--border); border-radius: 10px; }
.watch-form p, .watch-form .btn-row { grid-column: 1 / -1; margin: 0; }
.watch-form label { display: flex; flex-direction: column; gap: 2px; font-size: .75rem; color: var(--text-muted); }
.wl-card { margin-bottom: 8px; }
.wl-card.has-special { border-color: #f59e0b; }
.wl-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.wl-name { font-weight: 700; color: var(--text); text-decoration: none; }
.wl-best { font-weight: 700; color: var(--accent); white-space: nowrap; }
.wl-row { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-top: 1px solid var(--border);
  color: var(--text); text-decoration: none; font-size: .82rem; }
.wl-row.best .wl-price { font-weight: 700; }
.wl-row.special { background: rgba(245, 158, 11, .08); }
.wl-special-tag { font-size: .66rem; font-weight: 700; color: #f59e0b; border: 1px solid rgba(245,158,11,.6); border-radius: 999px; padding: 0 6px; white-space: nowrap; }
.wl-actions { display: flex; gap: 6px; margin-top: 6px; }
body.template-phone .watch-box { padding: 0 4px; }
/* end Round 113b */

/* Round 116: NZ import statistics */
.ts-chart { width: 100%; height: auto; display: block; margin: 4px 0 10px; }
.ts-code summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.ts-shared { font-size: .8rem; color: var(--warning); }
.ts-own { font-size: .8rem; color: var(--success); }
.ts-conf { font-size: .72rem; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-muted); }
.ts-conf-high { color: var(--success); border-color: var(--success); }
.ts-conf-medium { color: var(--warning); border-color: var(--warning); }
.ts-countries { display: grid; gap: 6px; }
.ts-country { display: grid; grid-template-columns: minmax(90px, 38%) 1fr auto; gap: 8px; align-items: center; font-size: .85rem; }
.ts-cn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.ts-bar { background: var(--bg-elevated); border-radius: 4px; height: 10px; overflow: hidden; }
.ts-bar span { display: block; height: 100%; background: var(--accent); }
.ts-cv { color: var(--chart-label); font-variant-numeric: tabular-nums; }
.ts-code h4 { margin: 12px 0 2px; font-size: .9rem; color: var(--text-muted); }
.ts-nat { border-top: 1px solid var(--border); padding: 8px 0; }
.ts-natgrid { display: grid; grid-template-columns: auto auto 1fr; gap: 3px 10px; font-size: .85rem; margin-top: 4px; }
.ts-natgrid b { color: var(--chart-label); text-align: right; font-variant-numeric: tabular-nums; }
.ts-gap { color: var(--warning); margin: 6px 0 0; }
.ts-bar-exp span { background: var(--personal); }
.ts-scale { position: absolute; opacity: 0; pointer-events: none; }
.ts-scalebar { display: flex; gap: 6px; margin: 4px 0 8px; }
.ts-scalebar label { padding: 3px 10px; border: 1px solid var(--border); border-radius: 999px; cursor: pointer; color: var(--text-muted); }
#ts-scale-log:checked ~ .ts-scalebar label[for="ts-scale-log"], #ts-scale-lin:checked ~ .ts-scalebar label[for="ts-scale-lin"] { color: var(--text); border-color: var(--primary); background: var(--bg-hover); }
#ts-scale-log:checked ~ .ts-flowwrap .ts-lin, #ts-scale-lin:checked ~ .ts-flowwrap .ts-log { display: none; }
.ts-flow { border-top: 1px solid var(--border); padding-top: 6px; }
.ts-goal { display: flex; align-items: center; gap: 8px; margin: 6px 0 2px; }
.ts-goalbar { flex: 1; height: 10px; background: var(--bg-elevated); border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
.ts-goalbar span { display: block; height: 100%; background: linear-gradient(90deg, var(--warning), var(--success)); }
.ts-flownotes { padding-left: 18px; margin-top: 8px; } .ts-flownotes li { margin: 3px 0; }

/* Round 117: identifiers */
.ids { display: grid; grid-template-columns: max-content 1fr; gap: 6px 12px; margin: 0; font-size: .88rem; }
.ids dt { color: var(--text-muted); }
.ids dd { margin: 0; overflow-wrap: anywhere; color: var(--text); }
.ids .mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .8rem; }
.id-summary { overflow-wrap: anywhere; }

/* Round 117: the substance crumb keeps its name; earlier crumbs and then the current crumb collapse to icons.
   The in-content heading shows only the sub-page (icon + name) with the CAS number small beside it. */
.crumbs > .crumb-keep { flex: 0 1 auto; min-width: 4em; overflow: hidden; }
.crumbs > .crumb-keep .crumb-txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs .crumb.current .crumb-ic-c { display: none; }
.crumbs .crumb.current.collapsed .crumb-txt { display: none !important; }
.crumbs .crumb.current.collapsed .crumb-ic-c { display: inline-block !important; }
.sub-pagehead { padding: 8px 4px 4px; }
.sub-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; font-size: 1rem; margin: 0; color: var(--text); }
.sub-ic { font-size: 1rem; }
.sub-cas { font-size: .78rem; font-weight: 400; color: var(--text-muted); }
body.template-wide .sub-pagehead { padding: 0 0 8px; max-width: 640px; }
.dept-tile .id-summary { display: block; grid-column: 2 / -1; color: var(--text-muted); font-size: .78rem; overflow-wrap: anywhere; }
body.template-phone .dept-tile .id-summary { display: block !important; }
.ts-avggrid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.ts-avg { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; background: var(--bg-elevated); }
.ts-avg .l { font-size: .8rem; color: var(--text-muted); }
.ts-avg .n { font-size: 1.4rem; font-weight: 700; color: var(--chart-label); }
.ts-avg .n .u { font-size: .85rem; font-weight: 500; color: var(--text-muted); }
.ts-spark { width: 100%; height: 72px; display: block; margin-top: 4px; }
.ts-avgtab { width: 100%; border-collapse: collapse; margin-top: 4px; table-layout: fixed; }
.ts-avgtab th, .ts-avgtab td { text-align: center; padding: 1px 2px; font-weight: 400; color: var(--text-muted); font-size: .7rem; }
.ts-avgtab td { color: var(--text); }
.pk { color: var(--chart-label); } small.pt { color: var(--text-muted); font-size: .72rem; }
.chart-tip { position: fixed; z-index: 9999; display: none; max-width: 260px; padding: 6px 9px; border-radius: 8px; font-size: .78rem;
  background: var(--bg-card); color: var(--text); border: 1px solid var(--primary); box-shadow: var(--shadow); pointer-events: none; }
svg.ts-chart rect.tip-on, svg.ts-spark rect.tip-on { fill: rgba(255, 255, 255, 0.08); }
.ts-country.tip-on { background: var(--bg-hover); }
.ts-country-link { color: inherit; text-decoration: none; } .ts-cfig b { color: var(--chart-label); }
/* Round 117: products list Product column = full description, at most 2 lines, full text in the tooltip */
table.data.cat-grid td.cat-name { white-space: normal; }
table.data.cat-grid td.cat-name .clamp2 { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
  overflow: hidden; white-space: normal; overflow-wrap: anywhere; line-height: 1.25; max-height: 2.5em; }
/* Round 117: owner tools on our product page */
.owner-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; }
.owner-tile { display: flex; flex-direction: column; gap: .15rem; padding: .6rem .7rem; border: 1px solid var(--border); border-radius: 10px; color: inherit; text-decoration: none; }
.owner-tile:hover { background: var(--bg-hover); }
.owner-edit label { display: block; margin-bottom: .5rem; } .owner-edit textarea, .owner-edit input { width: 100%; }
/* Round 118: the substance tile you just came back from */
.tile-came-from { outline: 2px solid var(--primary); outline-offset: -2px; background: var(--bg-hover); }
tr.tile-came-from > td { background: var(--bg-hover); }
.tile-pulse { animation: tile-pulse 1.2s ease-out 1; }
@keyframes tile-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary) 55%, transparent); } 100% { box-shadow: 0 0 0 12px transparent; } }
@media (prefers-reduced-motion: reduce) { .tile-pulse { animation: none; } }
/* Round 118: country lists show the top N, then 'Show all countries (N)' */
.ts-countries:not(.show-all) > .ts-more { display: none; }
.ts-more-btn { margin: 6px 0 4px; }
/* Round 118: variant code with its pack codes on a listing card */
.listing-variant { margin: 2px 0 6px; } .listing-variant .code { font-family: var(--font-mono, ui-monospace, monospace); font-size: .9em; }
.pack-chip { display: inline-block; padding: 1px 7px; margin: 2px 2px 0 0; border: 1px solid var(--border); border-radius: 999px; }

/* Round 118: the 'New product' menu stays inside its panel and on screen. On phone the button sits at the left edge, so the
   panel opens to the right from it; items wrap inside the panel; the hint drops under the item at body size. */
.menu-pop-list { max-width: min(320px, calc(100vw - 24px)); box-sizing: border-box; overflow-wrap: anywhere; color: var(--text, inherit); font-size: .92rem; }
.menu-pop-list a { display: block; line-height: 1.3; white-space: normal; }
.menu-pop-list a .tiny { display: block; margin-top: 2px; }
.template-phone .menu-pop-list { left: 0; right: auto; width: min(280px, calc(100vw - 32px)); min-width: 0; }
/* Round 118: Suppliers table on our product page - stacked cards on phone */
.template-phone .sup-table, .template-phone .sup-table tbody { display: block; }
.template-phone .sup-table tr:first-child { display: none; }
.template-phone .sup-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; padding: 10px 0; border-bottom: 1px solid rgba(127,127,127,.25); }
.template-phone .sup-table td { display: block; border: 0; padding: 2px 0; text-align: left; }
.template-phone table.sup-table td[data-label]::before { content: attr(data-label) !important; display: block; font-size: .72rem; opacity: .65; }
.template-phone .sup-table td[data-label=""]::before { content: none; }
.template-phone .sup-table td[data-label="Supplier"], .template-phone .sup-table td[data-label="Their description"] { grid-column: 1 / -1; }
.template-phone .sup-table td[data-label="Supplier"] a { font-weight: 600; }

/* Round 119: substances under each HS code on a country page - linked chips; a long list shows 5 then 'Show all' */
.ts-subs { display: flex; flex-wrap: wrap; gap: 4px 6px; margin: 4px 0 2px; }
.ts-subs .ts-sub { font-size: .82rem; padding: 2px 8px; border-radius: 999px; border: 1px solid rgba(127,127,127,.35); text-decoration: none; }
.ts-subs .ts-sub:hover { background: rgba(127,127,127,.15); }

/* Round 119: country page - the import / export totals are tabs */
.ts-tabs .ts-tab { text-decoration: none; color: inherit; cursor: pointer; border: 2px solid transparent; border-radius: 10px; opacity: .65; transition: opacity .15s; }
.ts-tabs .ts-tab:hover { opacity: .9; }
.ts-tabs .ts-tab.is-active { opacity: 1; border-color: var(--accent, #22c3e6); background: rgba(34,195,230,.10); box-shadow: inset 0 -3px 0 var(--accent, #22c3e6); }

/* Round 119: research-derived overseas suppliers */
.os-card .os-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.badge.os-research { background: rgba(242,177,58,.15); color: #f2b13a; }
.os-dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; } .os-dl dt { opacity: .7; } .os-dl dd { margin: 0; overflow-wrap: anywhere; }
.os-ev { margin: 0; padding-left: 18px; } .os-ev li { margin: 3px 0; }

/* Round 121: HS-code breakdown table under the Imports / Exports tabs */
.ts-brk { width: 100%; border-collapse: collapse; }
.ts-brk th, .ts-brk td { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.ts-brk .num { text-align: right; white-space: nowrap; }
.ts-brk .nowrap { white-space: nowrap; }
.ts-brk tfoot td { border-bottom: 0; }
.ts-brkwrap:not(.show-all) tr.ts-more { display: none; }
/* Round 121: charts keep phone proportions on wide screens (no scaling with the card width): the SVG is capped at
   the phone's rendered width, so bars, value labels and axis text render at the phone size (about 175px tall),
   and per-code charts sit in a 2-column grid where they fit. Phone layout unchanged. */
body.template-wide .ts-chart { max-width: 370px; }
body.template-wide .ts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(370px, 1fr)); gap: 4px 24px; }
body.template-wide .ts-grid .ts-cell { min-width: 0; }

/* Round 124: /community/discussion New post toggle (a small button; the form opens below it) */
details.new-post { margin: 0 0 .75rem; }
details.new-post > summary { list-style: none; display: inline-flex; width: auto; cursor: pointer; }
details.new-post > summary::-webkit-details-marker { display: none; }
details.new-post[open] > summary { margin-bottom: .5rem; }

/* Round 124: 'Added' on product and substance pages is the small muted label used in search results, not a button */
.added-tag {
  display: inline-flex; align-items: center; gap: 2px; width: auto; flex: none;
  border: 1px solid var(--border); border-radius: 8px; padding: 2px 8px;
  font-size: 0.72rem; font-weight: 700; line-height: 1.4; color: var(--text-muted);
  background: transparent; white-space: nowrap; vertical-align: middle;
}

/* Round 124: /personal/products uses the office products grid; ten columns, so a narrower fixed width */
body main table.data.cat-grid.cat-grid-personal { width: 1340px; }
.vlist-q-form { display: contents; }
table.data.cat-grid th.sortable { cursor: pointer; user-select: none; }
table.data.cat-grid th[aria-sort="ascending"]::after { content: " ▲"; font-size: .7em; }
table.data.cat-grid th[aria-sort="descending"]::after { content: " ▼"; font-size: .7em; }

/* Round 124: one standard search box (.vlist-q) on the older tool / department pages, right in the dark theme on wide
   and phone: themed placeholder, native dark clear button, the app's focus ring, and no overflow on narrow screens. */
.search-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 10px; }
.search-form .btn { flex: none; }
.vlist-q { box-sizing: border-box; width: 100%; max-width: min(280px, 100%); margin: 0; line-height: 1.3; }
.vlist-toolbar .vlist-q, .search-form .vlist-q { width: auto; }
.vlist-q:focus { outline: 2px solid var(--primary-dim); outline-offset: 0; border-color: var(--primary); }
.vlist-q::placeholder, input[type="search"]::placeholder { color: var(--text-muted); opacity: 1; }
input[type="search"] { -webkit-appearance: none; appearance: none; color-scheme: inherit; }
input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; }
.contact-toolbar .vlist-q { max-width: none; width: 100%; }
body.template-phone .vlist-toolbar .vlist-q, body.template-phone .search-form .vlist-q { flex: 1 1 100%; max-width: 100%; }
/* the wide form rule (form inputs up to 640px) made the search boxes in search forms stretch; they keep the standard size */
body.template-wide .main.with-side-nav form :is(input.vlist-q:not([type=hidden]):not([type=checkbox]):not([type=radio])) { max-width: min(280px, 100%); }

/* Round 124: search box at the top of the wide sidebar */
.side-nav-search { position: relative; margin: 2px 8px 8px; }
.side-nav .side-nav-search .vlist-q { width: 100%; max-width: none; font-size: 0.8rem; padding: 6px 9px; }
.side-nav-sug { left: 0; right: 0; z-index: 90; max-height: min(60vh, 420px); }
.side-nav-sug .suggest-item { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 6px 10px; }
body.template-wide .side-nav-sug .suggest-item .s-name, body.template-wide .side-nav-sug .suggest-item .s-cat { white-space: normal; overflow: visible; text-overflow: clip; max-width: 100%; }
.side-nav-sug .suggest-item .s-name { font-size: 0.8rem; }
.side-nav-sug .suggest-item .s-cat { font-size: 0.7rem; color: var(--text-muted); }
.side-nav-sug .suggest-item.is-active, .side-nav-sug .suggest-item:hover { background: var(--bg-hover); }

/* ==== Round 126: wide-screen navigation - top bar (Ctrl+K, ＋ New, Community, bell, help, one profile switcher),
   three-section sidebar (Admin · person · business) with pinned & recent, department area tabs, command palette.
   Wide template only; phone and Powerpoint are untouched. No light theme. ==== */
body.template-wide { --side-w: 256px; --admin-c: #f5a623; }
@media (max-width: 1299px) { body.template-wide { --side-w: 236px; } }
@media (max-width: 1099px) { body.template-wide { --side-w: 212px; } }
html.sb-rail body.template-wide { --side-w: 60px; }

/* top bar */
body.template-wide .topbar.wtop { height: 56px; gap: 10px; padding: 0 12px 0 8px; background: linear-gradient(180deg, #141d29 0%, #111923 100%);
  box-shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 8px 24px rgba(0,0,0,.25); backdrop-filter: none; }
.wtop-icon { position: relative; flex: none; width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 10px; border: 1px solid transparent;
  background: transparent; color: var(--text-muted); font-size: 16px; cursor: pointer; text-decoration: none; padding: 0; }
.wtop-icon:hover, .wtop-icon.here { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.wtop .profile-trigger.wtop-icon { max-width: none; font-size: 16px; font-weight: 400; border-radius: 10px; border-color: transparent; background: transparent; color: var(--text-muted); padding: 0; }
.wtop-brand { flex: none; display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 15px; color: var(--text); white-space: nowrap; text-decoration: none;
  width: calc(var(--side-w) - 54px); min-width: 0; overflow: hidden; }
.wtop-brand:hover { text-decoration: none; }
.wtop-brand small { color: #6f819a; font-weight: 600; }
.wtop-logo { flex: none; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-size: 12px; font-weight: 800; color: #04131a;
  background: radial-gradient(120% 120% at 20% 10%, #5ff5d9 0%, #00c9a7 45%, #0a8f9e 100%); box-shadow: 0 4px 14px rgba(0,201,167,.35), inset 0 1px 0 rgba(255,255,255,.5); }
html.sb-rail .wtop-brand { width: auto; }
.wtop-cmd { flex: 1 1 auto; min-width: 0; max-width: 620px; height: 38px; display: flex; align-items: center; gap: 10px; padding: 0 8px 0 12px; border-radius: 12px;
  background: #0d141d; border: 1px solid #2a3b50; color: #6f819a; box-shadow: inset 0 1px 2px rgba(0,0,0,.4); cursor: text; font: inherit; font-size: 13.5px; text-align: left; }
.wtop-cmd:hover { border-color: #3a5170; color: var(--text-muted); }
.wtop-cmd-q { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wtop kbd, .cmdk kbd, .wtop-dd kbd { font: 600 11px/1 var(--font); padding: 3px 6px; border-radius: 6px; border: 1px solid #3a4e66; background: #152031; color: var(--text-muted); white-space: nowrap; }
.wtop-spacer { flex: 1 1 0; min-width: 0; }
.wtop .profile-trigger { max-width: none; overflow: visible; }
.wtop .profile-trigger.wtop-new { height: 36px; display: inline-flex; align-items: center; gap: 6px; padding: 0 14px; border-radius: 10px; font-size: 14px; font-weight: 700;
  color: #04131a; border: 0; background: linear-gradient(180deg, #22e0bf, #00b496); box-shadow: 0 4px 14px rgba(0,201,167,.28), inset 0 1px 0 rgba(255,255,255,.35); }
.wtop-car { font-size: 10px; opacity: .7; }
.wtop-comm { flex: none; height: 36px; display: inline-flex; align-items: center; gap: 7px; padding: 0 12px; border-radius: 10px; color: var(--text); font-weight: 600; font-size: 14px;
  border: 1px solid rgba(244,162,97,.35); background: rgba(244,162,97,.08); white-space: nowrap; text-decoration: none; }
.wtop-comm:hover { text-decoration: none; background: rgba(244,162,97,.16); }
.wtop-comm.here { border-color: var(--community); background: rgba(244,162,97,.2); }
.wtop-badge { position: absolute; top: 0; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; font: 700 10px/18px var(--font); color: #fff;
  background: var(--danger); box-shadow: 0 0 0 2px #121a24; }
.wtop .profile-trigger.wtop-who { display: flex; align-items: center; gap: 9px; height: 40px; padding: 0 10px 0 4px; border-radius: 12px; border: 1px solid #2a3b50;
  background: #131d2a; color: var(--text); font-size: 13px; font-weight: 400; }
.wtop-av { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 12px; color: #fff;
  background: linear-gradient(135deg, #9a8cff, #6a55f0); box-shadow: inset 0 1px 0 rgba(255,255,255,.35); }
.wtop-av.guest { background: #2a3b50; }
.wtop-lines { display: flex; flex-direction: column; line-height: 1.15; text-align: left; min-width: 0; max-width: 170px; }
.wtop-lines b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wtop-lines span { font-size: 11.5px; color: var(--business); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wtop-lines span.on-per { color: #b3a8ff; }
.wtop-dd { min-width: 230px; max-height: calc(100vh - 80px); overflow-y: auto; }
.wtop-dd-right { left: auto; right: 0; }
.wtop-dd a, .wtop-dd button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border-radius: 8px; color: var(--text); text-decoration: none;
  font: 500 .85rem/1.3 var(--font); background: transparent; border: 0; text-align: left; cursor: pointer; }
.wtop-dd a:hover, .wtop-dd button:hover, .wtop-dd a:focus-visible, .wtop-dd button:focus-visible { background: var(--bg-hover); text-decoration: none; }
.wtop-dd a.on { box-shadow: inset 3px 0 0 var(--accent); background: rgba(0,201,167,.08); }
.wtop-dd a small { margin-left: auto; color: var(--text-muted); font-size: .72rem; }
.wtop-dd kbd { margin-left: auto; }
.wtop-ic { width: 1.4em; text-align: center; flex: none; }
.wtop-dd-label { padding: 8px 10px 3px; font: 700 10.5px/1 var(--font); letter-spacing: .08em; text-transform: uppercase; color: #6f819a; }
.wtop-view { padding: 2px 10px 6px; }
.wtop-view select { width: 100%; }
.wtop-pill { margin-left: auto; font-size: .7rem; font-weight: 700; padding: 1px 6px; border-radius: 8px; background: var(--danger); color: #fff; }
@media (max-width: 1299px) {
  .wtop-cmd-q { font-size: 13px; }
  .wtop-lines { max-width: 120px; }
}
@media (max-width: 1099px) {
  body.template-wide .topbar.wtop { gap: 6px; }
  .wtop-brand .wtop-name, .wtop-brand small { display: none; }
  .wtop-brand { width: auto; }
  .wtop-cmd kbd { display: none; }
  .wtop-comm { padding: 0 9px; }
  .wtop-lines { display: none; }
}

/* sidebar */
body.template-wide #app-sidebar.sb3 { padding: 10px 8px 8px; background: linear-gradient(180deg, #151f2c, #121a25); display: flex; flex-direction: column; gap: 0; }
.sb3 .sb-collapse { position: sticky; top: 0; z-index: 3; margin: 0 0 8px; padding-bottom: 6px; background: #151f2c; }
.sb3 .sb-collapse-btn { width: 100%; height: 30px; border-radius: 9px; border: 1px solid #273850; background: #0d141d; color: var(--text); font: 700 12.5px/1 var(--font); cursor: pointer; }
.sb3 .sb-collapse-btn:hover { background: var(--bg-hover); }
.sb3 .side-nav-search { margin: 0 0 8px; }
.sb3 .side-nav-search .vlist-q { height: 32px; border-radius: 9px; background: #0d141d; border: 1px solid #273850; }
.sb3 .sb-lbl { font: 700 10.5px/1 var(--font); letter-spacing: .09em; text-transform: uppercase; color: #6f819a; margin: 2px 6px 6px; }
.sb3 .sb-pin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-bottom: 10px; }
.side-nav.sb3 a.sb-pin { display: flex; align-items: center; gap: 6px; height: 26px; padding: 0 8px; min-width: 0; border-radius: 8px; background: #182434; border: 1px solid #243449;
  font-size: 12px; white-space: nowrap; overflow: hidden; color: var(--text); }
.side-nav.sb3 a.sb-pin:hover { background: var(--bg-hover); }
.sb3 .sb-pin .e { flex: none; font-size: 11px; }
.sb3 .sb-pin .t { overflow: hidden; text-overflow: ellipsis; }
.side-nav.sb3 a.sb-pin.rec { background: transparent; border-style: dashed; color: var(--text-muted); }
.sb3 .sb-sec { border-radius: 12px; margin: 0 0 6px; border: 1px solid transparent; }
.sb3 .sb-sec-h .sb-tog { display: flex; align-items: center; gap: 9px; width: 100%; height: 35px; padding: 0 8px 0 6px; border-radius: 11px; border: 0; background: transparent;
  font: 700 14px/1 var(--font); cursor: pointer; text-align: left; color: var(--text); }
.sb3 .sb-sec-h .sb-tog:hover { background: var(--bg-hover); }
.sb3 .sb-ico { flex: none; width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; font-size: 13px; }
.sb3 .sb-sec-t { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb3 .sb-meta { margin-left: auto; font: 600 11px/1 var(--font); color: #6f819a; flex: none; }
.sb3 .sb-dev { font: 800 9px/1 var(--font); letter-spacing: .06em; padding: 3px 5px; border-radius: 5px; color: #1b1203; background: var(--admin-c); }
.sb3 .sb-admin .sb-ico { background: rgba(245,166,35,.16); box-shadow: inset 0 0 0 1px rgba(245,166,35,.35); }
.sb3 .sb-personal .sb-ico { background: rgba(124,106,247,.18); box-shadow: inset 0 0 0 1px rgba(124,106,247,.45); }
.sb3 .sb-business .sb-ico { background: rgba(0,180,216,.16); box-shadow: inset 0 0 0 1px rgba(0,180,216,.45); }
.sb3 .sb-admin .sb-sec-t { color: #f7d08f; } .sb3 .sb-personal .sb-sec-t { color: #c7bfff; } .sb3 .sb-business .sb-sec-t { color: #9fe8f7; }
.sb3 .sb-sec.is-open.sb-business { background: linear-gradient(180deg, rgba(0,180,216,.07), rgba(0,180,216,.015)); border-color: rgba(0,180,216,.18); }
.sb3 .sb-sec.is-open.sb-personal { background: linear-gradient(180deg, rgba(124,106,247,.08), rgba(124,106,247,.015)); border-color: rgba(124,106,247,.2); }
.sb3 .sb-sec.is-open.sb-admin { background: linear-gradient(180deg, rgba(245,166,35,.07), rgba(245,166,35,.012)); border-color: rgba(245,166,35,.18); }
.sb3 .sb-sec-b { padding: 2px 4px 6px; }
.sb3 .sb-sec-b[hidden], .sb3 .sb-items[hidden] { display: none; }
.sb3 .sb-chev, .sb3 .sb-chev-sp { flex: none; width: 14px; height: 14px; display: inline-grid; place-items: center; }
.sb3 .sb-chev::before { content: ""; width: 6px; height: 6px; border-right: 2px solid #6f819a; border-bottom: 2px solid #6f819a; transform: rotate(-45deg); transition: transform .15s; }
.sb3 [aria-expanded="true"] > .sb-chev::before { transform: rotate(45deg); }
#app-sidebar.sb3:not(.sb-anim) .sb-chev::before { transition: none; }
@media (prefers-reduced-motion: reduce) { .sb3 .sb-chev::before { transition: none; } }
.sb3 .sb-grp { margin: 1px 0; }
.sb3 .sb-grp-h { display: flex; align-items: center; min-height: 27px; border-radius: 8px; }
.sb3 .sb-grp-h:hover { background: var(--bg-hover); }
.sb3 .sb-grp-h .sb-tog { display: flex; align-items: center; gap: 8px; height: 27px; padding: 0 2px 0 4px; border: 0; background: transparent; cursor: pointer;
  color: #cfd9e6; font: 600 13px/1 var(--font); text-align: left; border-radius: 8px; flex: none; }
.sb3 .sb-grp-h .sb-tog:only-child, .sb3 .sb-grp-h .sb-tog:has(+ .sb-n) { flex: 1 1 auto; min-width: 0; }
.sb3 .sb-grp-t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-nav.sb3 a.sb-grp-a { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 8px; height: 27px; padding: 0 6px 0 4px; border-radius: 8px;
  color: #cfd9e6; font: 600 13px/1 var(--font); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: transparent; box-shadow: none; }
.sb3 .sb-grp.single .sb-grp-h { padding-left: 4px; }
.sb3 .sb-grp.single a.sb-grp-a { padding-left: 8px; }
.sb3 .sb-e { flex: none; width: 18px; text-align: center; font-size: 13px; }
.sb3 .sb-n { margin-left: auto; padding: 0 6px; font: 600 11px/1 var(--font); color: #6f819a; flex: none; }
.sb3 .sb-grp.has-here > .sb-grp-h { background: rgba(0,201,167,.10); box-shadow: inset 3px 0 0 var(--accent); }
.sb3 .sb-grp.has-here > .sb-grp-h .sb-tog, .sb3 .sb-grp.has-here > .sb-grp-h a.sb-grp-a { color: #fff; }
.side-nav.sb3 a.sb-grp-a.here { color: #04131a; background: linear-gradient(90deg, #1fdcbb, #00b496); }
.sb3 .sb-items { margin: 2px 0 4px 15px; padding-left: 8px; border-left: 1px solid #2a3b50; }
.side-nav.sb3 a.sb-it { display: flex; align-items: center; min-height: 24px; padding: 3px 8px; border-radius: 7px; color: var(--text-muted); font-size: 12.8px; line-height: 1.25;
  font-weight: 400; background: transparent; box-shadow: none; }
.side-nav.sb3 a.sb-it:hover { background: var(--bg-hover); color: var(--text); }
.side-nav.sb3 a.sb-it.sub { color: #8494aa; }
.side-nav.sb3 a.sb-it.here { color: #04131a; font-weight: 700; background: linear-gradient(90deg, #1fdcbb, #00b496); box-shadow: 0 3px 12px rgba(0,201,167,.25); }
.sb3 .sb-sub-h { margin: 6px 8px 2px; font: 700 10px/1.2 var(--font); letter-spacing: .08em; text-transform: uppercase; color: #6f819a; }
.sb3 .sb-subgrp { margin-top: 3px; }
.sb3 .sb-subgrp .sb-items { margin-left: 13px; }
.sb3 .sb-foot { margin-top: auto; display: flex; align-items: center; gap: 8px; padding: 8px 6px 2px; border-top: 1px solid var(--border); }
.sb3 .sb-foot-btn { border: 0; background: transparent; color: var(--text-muted); font-size: 11.5px; cursor: pointer; padding: 4px 6px; border-radius: 6px; white-space: nowrap; }
.sb3 .sb-foot-btn:hover { background: var(--bg-hover); color: var(--text); }
.sb3 .sb-foot .tiny { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1099px) {
  body.template-wide #app-sidebar.sb3 { padding-left: 5px; padding-right: 5px; }
  .sb3 .sb-items { margin-left: 8px; }
  .sb3 .sb-pin-grid { grid-template-columns: 1fr; }
}
/* icon rail: section and group icons only; clicking one opens the sidebar again */
html.sb-rail #app-sidebar.sb3 { padding: 8px 4px; overflow-x: hidden; }
html.sb-rail .sb3 .side-nav-search, html.sb-rail .sb3 .sb-collapse, html.sb-rail .sb3 .sb-pins, html.sb-rail .sb3 .sb-items, html.sb-rail .sb3 .sb-sec-t, html.sb-rail .sb3 .sb-meta,
html.sb-rail .sb3 .sb-chev, html.sb-rail .sb3 .sb-chev-sp, html.sb-rail .sb3 .sb-grp-t, html.sb-rail .sb3 .sb-n, html.sb-rail .sb3 .sb-foot { display: none !important; }
html.sb-rail .sb3 .sb-sec-b { display: block !important; padding: 2px 0; }
html.sb-rail .sb3 .sb-sec { border: 0; background: none !important; margin-bottom: 4px; }
html.sb-rail .sb3 .sb-sec-h .sb-tog { justify-content: center; padding: 0; }
html.sb-rail .sb3 .sb-grp-h { justify-content: center; }
html.sb-rail .sb3 .sb-grp-h .sb-tog:has(+ a) { display: none; }
html.sb-rail .side-nav.sb3 a.sb-grp-a { flex: none; width: 40px; justify-content: center; font-size: 0; padding: 0; gap: 0; }
html.sb-rail .sb3 .sb-grp-h .sb-tog { justify-content: center; width: 40px; padding: 0; }
html.sb-rail .sb3 .sb-e { font-size: 15px; width: auto; }
html.sb-rail .sb3 .sb-subgrp { display: none; }

/* breadcrumb row with the pin star */
body.template-wide .crumb-row { display: flex; align-items: center; gap: 8px; margin-bottom: var(--sp-3); min-width: 0; }
body.template-wide .crumb-row .crumbs { margin-bottom: 0 !important; min-width: 0; }
.pin-btn { flex: none; border: 0; background: transparent; color: #8494aa; font-size: 17px; line-height: 1; cursor: pointer; padding: 3px 5px; border-radius: 6px; }
.pin-btn:hover { background: var(--bg-hover); color: #f5c451; }
.pin-btn.on { color: #f5c451; }

/* department area tabs */
body.template-wide .dept-tabs { display: flex; gap: 2px; padding: 4px; margin: 0 0 var(--sp-4); border-radius: 12px; background: #121b27; border: 1px solid var(--border);
  overflow-x: auto; scrollbar-width: thin; }
body.template-wide .dept-tab { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 9px; color: var(--text-muted);
  font-size: 12.8px; font-weight: 600; white-space: nowrap; text-decoration: none; }
body.template-wide .dept-tab:hover { color: var(--text); background: rgba(255,255,255,.04); text-decoration: none; }
body.template-wide .dept-tab.on { color: #fff; background: linear-gradient(180deg, #24364c, #1c2b3d); box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 2px 8px rgba(0,0,0,.3); }
@media (max-width: 1299px) { body.template-wide .dept-tab { padding: 0 8px; font-size: 12.3px; } }

/* Ctrl+K palette */
.cmdk-scrim { position: fixed; inset: 0; background: rgba(5,9,14,.62); backdrop-filter: blur(3px); z-index: 200; }
.cmdk { position: fixed; z-index: 201; top: 72px; left: 50%; transform: translateX(-50%); width: min(660px, calc(100vw - 32px)); border-radius: 16px;
  background: linear-gradient(180deg, #1b2737, #162130); border: 1px solid #33475f; box-shadow: 0 30px 80px rgba(0,0,0,.6), 0 0 0 1px rgba(0,201,167,.12); overflow: hidden; }
.cmdk[hidden], .cmdk-scrim[hidden] { display: none; }
.cmdk-in { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 16px; }
.cmdk-in input { flex: 1; min-width: 0; border: 0 !important; outline: none; background: transparent !important; color: var(--text); font-size: 16px; box-shadow: none !important; padding: 4px 0; max-width: none !important; }
.cmdk-list { max-height: min(60vh, 460px); overflow-y: auto; padding: 4px 8px 8px; }
.cmdk-sec { font: 700 10.5px/1 var(--font); letter-spacing: .08em; text-transform: uppercase; color: #6f819a; padding: 10px 10px 6px; }
.cmdk-row { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 4px 10px; border-radius: 9px; font-size: 13.5px; color: var(--text); text-decoration: none; }
.cmdk-row:hover { background: var(--bg-hover); text-decoration: none; }
.cmdk-row.sel { background: rgba(0,201,167,.12); box-shadow: inset 0 0 0 1px rgba(0,201,167,.35); }
.cmdk-ic { flex: none; width: 1.5em; text-align: center; }
.cmdk-t { flex: 0 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-t mark { background: none; color: var(--accent); font-weight: 700; }
.cmdk-p { margin-left: auto; padding-left: 12px; color: #6f819a; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; min-width: 0; text-align: right; }
.cmdk-row kbd { margin-left: 8px; }
.cmdk-empty { padding: 16px 10px; color: var(--text-muted); font-size: 13px; }
.cmdk-f { display: flex; gap: 16px; padding: 9px 16px; border-top: 1px solid var(--border); color: #6f819a; font-size: 11.5px; flex-wrap: wrap; }

/* dev panels: no clipped round N / S / E buttons any more - opened from the profile menu, closed with their ◀ */
body.template-wide .dev-rail.is-collapsed { display: none; }
html.rail-admin-collapsed body.template-wide .dev-admin, html.rail-notes-collapsed body.template-wide .dev-notes,
html.rail-support-collapsed body.template-wide .dev-support { display: none; }
body.template-wide .dept-tabs { overflow: visible; flex-wrap: nowrap; position: relative; }
body.template-wide .dept-tab.is-over { display: none; }
body.template-wide .dept-more { position: relative; flex: none; margin-left: auto; }
body.template-wide .dept-more-btn { border: 0; background: transparent; cursor: pointer; font-family: inherit; }
body.template-wide .dept-more-dd { position: absolute; right: 0; top: calc(100% + 6px); z-index: 70; min-width: 180px; padding: 6px; border-radius: 12px;
  background: var(--bg-card); border: 1px solid var(--border); box-shadow: var(--shadow); }
body.template-wide .dept-more-dd[hidden] { display: none; }
body.template-wide .dept-more-it { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; color: var(--text); text-decoration: none; font-size: .85rem; white-space: nowrap; }
body.template-wide .dept-more-it:hover { background: var(--bg-hover); text-decoration: none; }

.unit-size-lead {
  margin: 0 0 12px;
}
.unit-size-phase {
  margin: 16px 0 8px;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.unit-size-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 0 8px;
}
a.unit-size-row {
  display: grid;
  grid-template-columns: 148px 1fr;
  gap: 12px;
  align-items: center;
  text-decoration: none;
  color: inherit;
  padding: 8px;
}
a.unit-size-row:hover {
  text-decoration: none;
  border-color: var(--community, var(--border));
}
.unit-size-row img,
.unit-chosen img {
  width: 148px;
  height: 148px;
  object-fit: cover;
  border-radius: 12px;
  background: #eceae6;
}
.unit-size-row strong,
.unit-chosen strong {
  display: block;
  font-size: 1.08rem;
  margin-bottom: 4px;
}
.unit-size-dims {
  display: block;
  margin-bottom: 4px;
  font-size: 0.92rem;
  color: var(--text);
}
.unit-size-fallback {
  width: 148px;
  height: 148px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-weight: 700;
}
.unit-chosen {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}
.unit-chosen img,
.unit-chosen .unit-size-fallback {
  width: 112px;
  height: 112px;
}
.conc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 10px;
}
.conc-chip {
  display: inline-block;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text);
  text-decoration: none;
  font-size: 0.82rem;
}
.conc-chip.is-on {
  border-color: var(--community, var(--border));
  font-weight: 700;
}
.conc-range {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
  margin: 0 0 12px;
}
.conc-range label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.conc-range input {
  width: 88px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
}
.unit-request {
  margin: 12px 0;
}
.unit-request form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.unit-request label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.unit-request input {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
}
@media (min-width: 800px) {
  a.unit-size-row { grid-template-columns: 220px 1fr; }
  a.unit-size-row img,
  a.unit-size-row .unit-size-fallback { width: 220px; height: 220px; }
}
