/* The Fence Guys — App Shell components (sidebar rail extras, buttons, badges, avatars,
   global search, notification tray, account/more menus, mobile dock, toast).
   Extracted verbatim from the production stylesheet so the shell renders identically. */

/* --- tints, buttons, badges, avatars --- */
.panel-body { padding: 16px 18px; }

.tint-lime { background: var(--status-success-bg); color: var(--status-success); }
.tint-amber { background: var(--status-warning-bg); color: var(--status-warning); }
.tint-coral { background: var(--status-error-bg); color: var(--status-error); }
.tint-violet { background: var(--status-info-bg); color: var(--status-info); }
.tint-accent { background: var(--brand-accent-soft); color: var(--brand-accent-strong); }

/* ---------------- BUTTONS ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; padding: 8px 16px;
  border: 1px solid transparent; border-radius: 11px;
  background: var(--surface-primary); color: var(--text-primary);
  font-weight: 700; font-size: 13.5px; white-space: nowrap;
  transition: filter .12s, background .12s, border-color .12s;
}
.btn:hover { filter: brightness(.98); }
.btn:focus-visible { outline: 2px solid var(--brand-accent); outline-offset: 2px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { min-height: 34px; padding: 7px 13px; font-size: 12.5px; border-radius: 10px; }
.btn.xs { min-height: 30px; padding: 5px 11px; font-size: 12px; border-radius: 9px; }
.btn.block { width: 100%; }

.btn.primary {
  border: 0; color:var(--action-primary-text);
  background: linear-gradient(150deg, var(--brand-accent-strong), var(--brand-accent));
  box-shadow: 0 8px 18px var(--focus-ring);
}
.btn.ghost { border: 1px solid var(--border-default); background: var(--surface-primary); box-shadow: var(--shadow-low); }
.btn.soft { border: 0; background: var(--brand-accent-soft); color: var(--brand-accent-text); }
.btn.soft-coral { border: 0; background: var(--status-error); color:var(--action-primary-text); }
.btn.soft-amber { border: 0; background: var(--status-warning-bg); color: var(--status-warning); }
.btn.link { border: 0; background: transparent; color: var(--brand-accent-strong); box-shadow: none; padding: 6px 8px; min-height: auto; }
.btn.danger { border: 0; background: var(--status-error); color:var(--action-primary-text); }
.btn.icon-btn { width: 40px; height: 40px; min-height: 0; padding: 0; border: 1px solid var(--border-default); border-radius: 11px; background: var(--surface-primary); color: var(--text-secondary); }
.btn.icon-btn.sm { width: 32px; height: 32px; border-radius: 9px; }

/* ---------------- BADGES / PILLS ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: var(--r-pill);
  font-size: 11.5px; font-weight: 700; white-space: nowrap;
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.live .dot { animation: bcpulse 1.6s infinite; }
.badge.tag {
  font-family: var(--font-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: .06em; padding: 2px 7px; border-radius: 6px;
}
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: var(--r-pill);
  background: var(--surface-secondary); color: var(--text-secondary);
  font-size: 12px; font-weight: 600; border: 1px solid var(--border-default);
}

/* ---------------- AVATAR ---------------- */
.avatar {
  display: grid; place-items: center; flex: none;
  width: 40px; height: 40px; border-radius: var(--r);
  color:var(--action-primary-text); font-size: 13px; font-weight: 700;
  background: linear-gradient(150deg, var(--brand-accent-strong), var(--brand-accent));
}
.avatar.round { border-radius: 50%; }
.avatar.sm { width: 32px; height: 32px; font-size: 11px; }
.avatar.lg { width: 48px; height: 48px; font-size: 15px; }

/* --- search box, results panel, popover base, menu items --- */
/* ---------------- SEARCH BOX ---------------- */
.search-wrap { position: relative; min-width: 0; }
.search-box {
  display: flex; align-items: center; gap: 9px;
  width: min(360px, 32vw); padding: 9px 12px;
  border: 1px solid var(--border-default); border-radius: var(--r);
  background: var(--surface-primary); color: var(--text-muted); box-shadow: var(--shadow-low);
}
.search-box input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text-primary); font-size: 13.5px; }
.search-box kbd {
  display: inline-flex; align-items: center; height: 20px; padding: 0 6px;
  border: 1px solid var(--border-default); border-radius: 6px; color: var(--text-subtle);
  font: var(--table-heading-weight) 10.5px/1 var(--font-mono);
}
.search-panel {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 2147482000;
  width: min(460px, 80vw); max-height: 60vh; overflow: auto;
  padding: 6px; background: var(--surface-primary); border: 1px solid var(--border-default);
  border-radius: 14px; box-shadow: var(--shadow-high); animation: bcpop .14s ease;
}
.search-group { font: var(--table-heading-weight) 9.5px/1 var(--font-ui); letter-spacing: .12em; text-transform: uppercase; color: var(--text-subtle); padding: 10px 10px 6px; }
.search-item { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 9px; width: 100%; text-align: left; padding: 9px 10px; border: 0; border-radius: 9px; background: transparent; }
.search-item:hover, .search-item.active { background:var(--hover-bg);color:var(--hover-text); }
.search-item strong { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.search-item small { font-size: 11.5px; color: var(--text-muted); }
.search-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
}
.search-copy strong,
.search-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 50%;
  color:var(--action-primary-text);
  font-size: 10.5px;
  font-weight: 850;
}
.search-avatar.icon-only {
  border-radius: var(--r);
  background: var(--brand-accent-soft);
  color: var(--brand-accent-strong);
}

/* ---------------- DROPDOWN MENU / POPOVER ---------------- */
.pop {
  position: absolute; z-index: 2147482000;
  min-width: 200px; padding: 6px;
  background: var(--surface-primary); border: 1px solid var(--border-default);
  border-radius: 14px; box-shadow: var(--shadow-high); animation: bcpop .14s ease;
}
.pop[hidden] { display: none; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: 36px; padding: 8px 11px;
  border: 0; border-radius: 9px; background: transparent;
  color: var(--text-secondary); font-size: 13px; font-weight: 600; text-align: left;
}
.menu-item:hover { background:var(--hover-bg);color:var(--hover-text); }
.menu-item.danger { color: var(--status-error); font-weight: 700; }
.menu-item.danger:hover { background: var(--status-error-bg); }
.menu-sep { height: 1px; background: var(--border-subtle); margin: 5px 6px; }

/* --- toast --- */

/* ---------------- TOAST ---------------- */
.toast-wrap { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 2147483001; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 15px; border-radius: var(--r);
  background: var(--surface-elevated); color:var(--text-primary); font-size: 13px; font-weight: var(--body-medium-weight);
  box-shadow: var(--shadow-high); animation: bctoast .18s ease; pointer-events: auto;
}
.toast .t-ico { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; background: var(--surface-secondary); flex: none; }
.toast.ok .t-ico { color: var(--status-success); }
.toast.warn .t-ico { color: var(--status-warning); }
.toast.err .t-ico { color: var(--status-error); }

/* --- refined buttons / badges / avatars / search glyphs --- */
.btn {
  min-height: var(--h-control);
  padding: 7px 13px;
  gap: 7px;
  border-radius: var(--r);
  border-color: var(--border-default);
  background: var(--surface-primary);
  color: var(--text-secondary);
  box-shadow: none;
  font-size: var(--text-md);
  font-weight: var(--fw-semibold);
  line-height: 1;
  transition:
    background-color var(--dur-base) var(--ease-standard),
    border-color var(--dur-base) var(--ease-standard),
    color var(--dur-base) var(--ease-standard),
    box-shadow var(--dur-base) var(--ease-standard),
    transform var(--dur-fast) var(--ease-standard);
}
.btn:hover:not(:disabled) {
  filter: none;
  background: var(--action-secondary-hover);
  border-color: var(--border-strong);
  color: var(--action-secondary-hover-text);
}
.btn:active:not(:disabled) { transform: scale(.985); }
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.btn.sm {
  min-height: var(--h-control-sm);
  padding: 6px 11px;
  border-radius: var(--r);
  font-size: var(--text-sm);
}
.btn.xs {
  min-height: 28px;
  padding: 5px 9px;
  border-radius: var(--r-sm);
  font-size: var(--text-xs);
}
.btn.primary {
  color:var(--action-primary-text);
  border-color: transparent;
  background: var(--text-primary);
  box-shadow: none;
}
.btn.primary:hover:not(:disabled) {
  background: var(--action-primary-hover);
  color:var(--action-primary-hover-text);
}
.btn.ghost {
  border-color: var(--border-default);
  background: var(--surface-primary);
  box-shadow: none;
}
.btn.soft {
  color: var(--brand-accent-text);
  background: var(--brand-accent-soft);
}
.btn.link {
  color: var(--brand-accent-strong);
  background: transparent;
  padding-inline: 7px;
}
.btn.icon-btn {
  width: var(--h-control);
  height: var(--h-control);
  border-radius: var(--r);
  border-color: var(--border-default);
  background: var(--surface-primary);
}
.btn.icon-btn.sm {
  width: var(--h-control-sm);
  height: var(--h-control-sm);
  border-radius: var(--r);
}
.btn svg,
.menu-item svg,
.search-box svg {
  flex: none;
}

.badge,
.chip,
.delta {
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  line-height: 1.2;
}
.badge { padding: 3px 8px; }
.chip {
  padding: 4px 9px;
  background: var(--surface-secondary);
  border-color: var(--border-default);
}
.badge.tag,
.kpi-label,
.search-group,
.invoice-line-head,
table.data th {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-weight: 700;
  letter-spacing: .07em;
}

.avatar {
  border-radius: var(--r);
  font-size: var(--text-md);
  font-weight: var(--fw-bold);
}
.avatar.sm {
  width: 30px;
  height: 30px;
  font-size: var(--text-2xs);
}

/* --- refined search box, results, popover, 'More' module menu --- */
.search-box {
  min-height: var(--h-control);
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--r);
  border-color: var(--border-default);
  box-shadow: none;
  transition:
    background-color var(--dur-base) var(--ease-standard),
    border-color var(--dur-base) var(--ease-standard),
    box-shadow var(--dur-base) var(--ease-standard);
}
.search-box:focus-within {
  border-color: color-mix(in srgb, var(--brand-accent) 70%, var(--border-default));
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.search-box input {
  font-size: var(--text-md);
}
.search-box kbd {
  height: 18px;
  padding: 0 5px;
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
}
.search-panel,
.pop {
  padding: 6px;
  border-color: var(--border-default);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-high);
  animation: bcpop var(--dur-base) var(--ease-out);
}
.search-group {
  padding: 9px 9px 6px;
}
.search-item,
.menu-item {
  border-radius: var(--r);
  transition:
    background-color var(--dur-base) var(--ease-standard),
    color var(--dur-base) var(--ease-standard);
}
.search-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 8px 9px;
}
.search-item:hover,
.search-item.active,
.menu-item:hover {
  background: var(--hover-bg);
  color: var(--hover-text);
}
.search-item:hover small,.menu-item:hover small { color:var(--hover-muted); }
.search-item:hover svg,.menu-item:hover svg { color:var(--hover-icon); }
.search-item strong {
  font-size: var(--text-md);
  font-weight: var(--fw-semibold);
}
.search-item small {
  font-size: var(--text-xs);
}
.menu-item {
  min-height: var(--h-control-sm);
  padding: 7px 9px;
  gap: 8px;
  color: var(--text-secondary);
  font-size: var(--text-md);
  font-weight: var(--fw-medium);
}

.module-menu {
  width: min(300px, calc(100vw - 28px));
  display: grid;
  gap: 2px;
  padding: 2px;
}
.module-menu-group {
  padding: 9px 9px 5px;
  color: var(--text-subtle);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-weight: 700;
  letter-spacing: .07em;
  line-height: 1;
  text-transform: uppercase;
}
.module-menu-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 42px;
  padding: 7px 9px;
  border: 0;
  border-radius: var(--r);
  background: transparent;
  color: var(--text-secondary);
  text-align: left;
  transition:
    background-color var(--dur-base) var(--ease-standard),
    color var(--dur-base) var(--ease-standard),
    transform var(--dur-fast) var(--ease-standard);
}
.module-menu-item:hover,
.module-menu-item.active {
  background: var(--hover-bg);
  color: var(--hover-text);
}
.module-menu-item:active {
  transform: scale(.99);
}
.module-menu-ico {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--r);
  background: color-mix(in srgb, var(--surface-secondary) 75%, var(--surface-primary));
  color: var(--text-muted);
}
.module-menu-item.active .module-menu-ico {
  background: var(--selected-bg);
  color: var(--selected-icon);
}
.module-menu-item strong,
.module-menu-item small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.module-menu-item strong {
  font-size: var(--text-md);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
}
.module-menu-item small {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: var(--text-xs);
  line-height: 1.25;
}

/* --- mobile dock (bottom nav) --- */
/* ---------------- DOCK (mobile bottom nav) ---------------- */
.dock { display: none; }
@media (max-width: 900px) {
  .dock {
    display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
    position: fixed; left: 10px; right: 10px; bottom: 10px; z-index: 50;
    background: color-mix(in srgb, var(--surface-primary) 92%, transparent);
    border: 1px solid var(--border-default);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-high);
    backdrop-filter: blur(14px) saturate(1.2);
    padding: 5px 5px calc(5px + env(safe-area-inset-bottom));
  }
  .dock a {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    min-width: 0; padding: 6px 0; border-radius: var(--r);
    color: var(--text-muted); font-size: 9.5px; font-weight: var(--fw-semibold);
    transition: background-color var(--dur-base) var(--ease-standard), color var(--dur-base) var(--ease-standard), transform var(--dur-fast) var(--ease-standard);
  }
  .dock a svg { width: 18px; height: 18px; }
  .dock a:active { transform: scale(.97); }
  .dock a.on { color: var(--brand-accent-strong); background: var(--brand-accent-soft); }
}


/* --- sidebar user chevron, account menu, notification tray --- */
.side-user-chev {
  display: grid;
  place-items: center;
  flex: none;
  color: var(--sidebar-muted);
  transform: rotate(180deg);
}
.side-card {
  background: color-mix(in srgb, var(--sidebar-selected) 70%, transparent);
}

.account-menu {
  width: min(268px, calc(100vw - 24px));
}
.account-menu-head {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 9px;
}
.account-menu-head strong,
.account-menu-head small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-menu-head strong {
  color: var(--text-primary);
  font-size: var(--text-md);
  font-weight: var(--fw-bold);
}
.account-menu-head small {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: var(--text-xs);
  line-height: 1.3;
}

.notification-tray {
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 24px));
}
.notification-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 8px 6px;
}
.notification-head strong,
.notification-head small {
  display: block;
}
.notification-head strong {
  color: var(--text-primary);
  font-size: var(--text-lg);
  line-height: var(--lh-title);
  font-weight: var(--fw-bold);
}
.notification-head small {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: var(--text-xs);
}
.notification-list {
  display: grid;
  gap: 4px;
}
.notification-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  padding: 9px;
  border: 0;
  border-radius: var(--r);
  background: transparent;
  color: var(--text-primary);
  text-align: left;
  transition:
    background-color var(--dur-base) var(--ease-standard),
    transform var(--dur-fast) var(--ease-standard);
}
.notification-row:hover {
  background: var(--hover-bg);
  color: var(--hover-text);
}
.notification-row:active {
  transform: scale(.99);
}
.notification-row:focus-visible {
  outline: 2px solid var(--brand-accent);
  outline-offset: 2px;
}
.notification-row.read {
  opacity: .64;
}
.notification-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--r);
}
.notification-copy {
  min-width: 0;
}
.notification-copy strong,
.notification-copy small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notification-copy strong {
  font-size: var(--text-md);
  line-height: var(--lh-title);
  font-weight: var(--fw-bold);
}
.notification-copy small,
.notification-row time {
  color: var(--text-muted);
  font-size: var(--text-xs);
  line-height: 1.35;
}
.notification-row time {
  align-self: start;
  padding-top: 2px;
  white-space: nowrap;
}

/* --- notification tray finish --- */
.notification-tray {
  gap: 0;
  width: min(392px, calc(100vw - 24px));
  padding: 0;
  overflow: hidden;
  border-color: color-mix(in srgb, var(--text-primary) 12%, var(--border-default));
  border-radius: 16px;
  background:var(--surface-primary);
  box-shadow: var(--shadow-high);
}
.notification-head {
  align-items: center;
  min-height: 70px;
  padding: 14px 16px 13px;
  border-bottom: 1px solid var(--border-subtle);
}
.notification-head strong {
  font-size: 16px;
  letter-spacing: -.02em;
}
.notification-head small {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 650;
}
.notification-head small:before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--status-error);
  content: "";
}
.notification-head .btn.ghost {
  min-height: 32px;
  padding: 6px 8px;
  border-radius: 8px;
  color: var(--brand-accent-strong);
  font-size: 11px;
  font-weight: 800;
}
.notification-head .btn.ghost:hover { background:var(--action-secondary-hover);color:var(--action-secondary-hover-text); }
.notification-list {
  gap: 2px;
  padding: 6px;
}
.notification-row {
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 11px;
  min-height: 68px;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 11px;
}
.notification-row:not(.read) {
  background: linear-gradient(90deg, color-mix(in srgb, var(--brand-accent-faint) 58%, var(--surface-primary)), var(--surface-primary) 62%);
}
.notification-row:hover {
  border-color: color-mix(in srgb, var(--brand-accent) 24%, var(--border-default));
  background: var(--hover-bg);
  color: var(--hover-text);
}
.notification-row:hover .notification-copy strong { color:var(--hover-text); }
.notification-row:hover .notification-copy small,.notification-row:hover time { color:var(--hover-muted); }
.notification-row.read { opacity: 1; }
.notification-row.read .notification-copy strong,
.notification-row.read .notification-copy small,
.notification-row.read time { color: var(--text-muted); }
.notification-icon {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 12%, transparent);
}
.notification-icon:before {
  position: static;
  display: block;
  box-sizing: border-box;
  width: 21px;
  height: 21px;
  background: currentColor;
  content: "";
  -webkit-mask: var(--notification-lucide-icon) center / contain no-repeat;
  mask: var(--notification-lucide-icon) center / contain no-repeat;
}
.notification-icon:after { display: none; }
.notification-icon.tint-coral { --notification-lucide-icon: url('../icons/lucide/circle-alert.svg'); }
.notification-icon.tint-accent { --notification-lucide-icon: url('../icons/lucide/circle-dollar-sign.svg'); }
.notification-icon.tint-amber { --notification-lucide-icon: url('../icons/lucide/file-pen-line.svg'); }
.notification-icon.tint-violet { --notification-lucide-icon: url('../icons/lucide/file-clock.svg'); }
.notification-copy strong {
  color: var(--text-primary);
  font-size: 12px;
  letter-spacing: -.01em;
}
.notification-copy small,
.notification-row time { font-size: 10.5px; }
.notification-row time { padding-top: 4px; }
.notification-anchor > .btn.icon-btn:hover,
.notification-anchor > .btn.icon-btn:focus-visible {
  border-color:var(--border-strong);
  background:var(--action-secondary-hover);
  color:var(--action-secondary-hover-icon);
}
