/* ============================================================
   NexaGrid - Reusable components
   ============================================================ */

/* Alias used by widget-card (kept for stability) */
:root { --radius-card: var(--radius-lg); }

/* ================= Controls ================= */
.input-flat {
  height: var(--control-height);
  padding: 0 16px;
  border-radius: var(--radius-lg);
  border: none;
  background: var(--canvas-1);
  box-shadow: inset 0 0 0 1px var(--border);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  outline: none;
  transition: box-shadow 0.15s ease, background-color 0.15s ease;
}

html.dark .input-flat {
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border);
  color: #e7edf7;
}

.input-flat:focus {
  background: var(--canvas) !important;
  box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 4px rgb(var(--accent-rgb) / 18%);
}

.input-flat:focus-visible {
  box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 4px rgb(var(--accent-rgb) / 18%);
}

.input-flat::placeholder {
  color: var(--muted-2);
}

/* Selection highlight */
::selection {
  background: var(--accent);
  color: #fff;
}

::-moz-selection {
  background: var(--accent);
  color: #fff;
}

/* ================= Buttons ================= */
.btn-flat {
  height: var(--control-height);
  padding: 0 18px;
  border-radius: var(--radius-lg);
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  white-space: nowrap;
}

.btn-flat svg {
  width: 16px;
  height: 16px;
}

.btn-flat:active {
  transform: scale(0.98);
}

.btn-flat.primary {
  background: var(--accent);
  color: #fff;
}

.btn-flat.primary:hover {
  background: var(--accent-hover);
}

.btn-flat.secondary {
  background: var(--surface-inset);
  color: var(--ink);
}

.btn-flat.secondary:hover {
  background: var(--surface-inset);
}

.btn-flat.soft {
  background: var(--accent-soft);
  color: var(--accent);
}

.btn-flat.soft:hover {
  background: var(--accent-bg);
}

.btn-flat.sm {
  height: var(--control-height-sm);
  padding: 0 12px;
  border-radius: var(--radius-md);
  font-size: 12px;
}

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

/* ================= Button variants (shared) ================= */
.btn-flat.danger {
  background: var(--danger);
  color: #fff;
}

.btn-flat.danger:hover { background: #e11d48; }

.btn-flat.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn-flat.ghost:hover { background: var(--surface-inset); color: var(--ink); }

/* ================= Native select chevron (shared) ================= */
select.input-flat {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2379879c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

/* ================= Chips / filters ================= */
.chip-filter {
  height: var(--control-height-sm);
  padding: 0 14px;
  border-radius: var(--radius-md);
  background: var(--surface-inset);
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  user-select: none;
}

.chip-filter svg {
  width: 14px;
  height: 14px;
}

.chip-filter:hover {
  color: var(--ink);
  background: var(--surface-inset);
}

.chip-filter.active {
  background: var(--accent) !important;
  color: #fff !important;
}

.chip-filter.soft {
  background: var(--accent-soft);
  color: var(--accent);
}

.chip-filter.soft:hover {
  background: var(--accent-bg);
  color: var(--accent);
}

/* ================= Switch (toggle) - flat, compact ================= */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  cursor: pointer;
}

.switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
}

.switch-track {
  display: block;
  width: 44px;
  height: 24px;
  border-radius: var(--radius-pill);
  background: var(--border-strong);
  transition: background 0.15s ease;
}

.switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: var(--radius-round);
  background: #fff;
  box-shadow: 0 1px 3px rgb(15 23 42 / 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.switch input:checked + .switch-track {
  background: var(--accent);
}
.switch input:checked ~ .switch-thumb {
  transform: translateX(20px);
}
.switch input:focus-visible + .switch-track {
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.switch input:disabled { cursor: not-allowed; }
.switch input:disabled + .switch-track { opacity: 0.45; }
.switch input:disabled ~ .switch-thumb { opacity: 0.6; }

/* ================= Custom checkbox / radio ================= */
.ui-check,
.ui-radio {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  user-select: none;
}

.ui-check input,
.ui-radio input {
  appearance: none;
  width: 17px;
  height: 17px;
  margin: 0;
  border: 1.5px solid var(--border);
  background: var(--canvas);
  border-radius: 5px;
  display: inline-grid;
  place-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s, background 0.15s;
}

.ui-radio input { border-radius: var(--radius-round); }

.ui-check input::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: #fff;
  transform: scale(0);
  transition: transform 0.12s;
}

.ui-radio input::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: var(--radius-round);
  background: #fff;
  transform: scale(0);
  transition: transform 0.12s;
}

.ui-check input:checked,
.ui-radio input:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.ui-check input:checked::before,
.ui-radio input:checked::before { transform: scale(1); }

/* ================= Textarea ================= */
.input-flat.textarea {
  height: auto;
  min-height: 92px;
  padding: 12px 16px;
  resize: vertical;
  line-height: 1.55;
}

/* ============================================================
   Unified Overlay / Modal / Drawer system (nx-*)
   One component used by every dialog in the template:
     • nx-drawer — right-side panel (forms & large dialogs)
     • nx-dialog — centered dialog (confirmations & info)
   Sizing tokens live in these rules only.
   ============================================================ */
.nx-overlay {
  position: fixed;
  inset: 0;
  z-index: 99990;
  background: rgb(3 7 18 / 0.55);
  display: flex;
  justify-content: flex-end;
  align-items: stretch;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.nx-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.nx-overlay--center {
  justify-content: center;
  align-items: center;
  padding: 16px;
}

/* -- Drawer: right slide-in, full height -- */
.nx-drawer {
  width: min(50vw, 900px);
  min-width: 620px;
  max-width: 100vw;
  height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -24px 0 64px rgb(15 23 42 / 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.nx-drawer--medium { width: min(42vw, 760px); min-width: 520px; }
.nx-drawer--wide { width: min(60vw, 1120px); min-width: 720px; }
.nx-drawer--compact { width: 420px; min-width: 420px; max-width: 420px; }

.nx-overlay.open .nx-drawer {
  transform: translateX(0);
}

/* -- Dialog: centered -- */
.nx-dialog {
  width: min(480px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgb(15 23 42 / 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(16px) scale(0.98);
  transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

.nx-dialog--narrow { width: min(420px, calc(100vw - 32px)); }
.nx-dialog--wide { width: min(600px, calc(100vw - 32px)); }

.nx-overlay.open .nx-dialog {
  transform: translateY(0) scale(1);
}

/* -- Shared header / body / footer -- */
.nx-drawer__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 22px 26px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.nx-drawer__heading { min-width: 0; }

.nx-drawer__heading h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.nx-drawer__heading p {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.5;
}

.nx-drawer__close {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  color: var(--muted);
  background: var(--canvas-1);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.nx-drawer__close:hover {
  background: var(--surface-inset);
  color: var(--ink);
}

.nx-drawer__close svg { width: 15px; height: 15px; }

.nx-drawer__body {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 20px 26px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

.nx-drawer__footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 26px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.nx-dialog .nx-drawer__header { padding: 20px 24px 14px; }
.nx-dialog .nx-drawer__body { padding: 18px 24px; }
.nx-dialog .nx-drawer__footer { padding: 12px 24px; }

/* -- Responsive: 70vw tablet, 100vw mobile -- */
@media (min-width: 769px) and (max-width: 1100px) {
  .nx-drawer,
  .nx-drawer--wide,
  .nx-drawer--medium {
    width: 70vw;
    min-width: 0;
  }
}

@media (max-width: 768px) {
  .nx-drawer,
  .nx-drawer--wide,
  .nx-drawer--medium {
    width: 100vw;
    min-width: 0;
  }
  .nx-drawer--compact {
    width: 100vw;
    min-width: 0;
    max-width: 100vw;
  }
  .nx-drawer__header { padding: 18px 20px 14px; }
  .nx-drawer__body { padding: 16px 20px; }
  .nx-drawer__footer { padding: 12px 20px; }
}

/* Backwards-compatible aliases (kept for legacy CSS hooks) */
.ng-modal-backdrop.nx-overlay { }
.ng-modal-dialog { }
.ng-modal-head, .ng-modal-foot { }
.ng-modal-close { }
/* legacy hook for ai-chat inside dialog body */
.ng-modal-body { }

/* ================= Recent activity ================= */
.activity-list {
  margin-top: 2px;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
}

.activity-item + .activity-item {
  border-top: 1px solid var(--surface-inset);
}

.activity-dot {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--surface-inset);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.activity-dot svg {
  width: 15px;
  height: 15px;
}

.activity-copy {
  flex: 1;
  min-width: 0;
}

.activity-copy b {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-copy span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-time {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  margin-top: 2px;
}


.ng-modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* ================= Tabs ================= */
.boards-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  padding: 4px;
  background: var(--surface-inset);
  border-radius: 14px;
  width: fit-content;
}

.boards-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: var(--control-height-sm);
  padding: 0 14px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.boards-tab:hover {
  color: var(--accent);
}

.boards-tab.active {
  background: var(--accent);
  color: #fff;
}

/* ================= Cards ================= */
.widget-card {
  background: var(--surface);
  border-radius: var(--radius-card);
  padding: 24px;
  min-width: 0;
}

.widget-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.widget-heading h2 {
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
}

.widget-heading p,
.metric p,
.settings-subtitle {
  font-size: 12px;
  color: var(--muted);
  margin-top: 5px;
}

.widget-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

.widget-link:hover {
  color: var(--accent-hover);
}

.widget-link svg {
  width: 13px;
  height: 13px;
}

/* ================= Widget heading icon badge ================= */
.widget-heading .wdg-title,
.revenue-title-row .wdg-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.wdg-ic {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px var(--accent-bg);
}

.wdg-ic svg {
  width: 18px;
  height: 18px;
}

.widget-empty {
  padding: 16px 0;
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted);
}

/* ================= KPI cards with ring indicator ================= */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.overview-kpis .kpi-card {
  position: relative;
  min-height: 108px;
padding: 18px 84px 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.overview-kpis .kpi-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.overview-kpis .kpi-card > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.overview-kpis .kpi-card > span svg {
  width: 14px;
  height: 14px;
}

.overview-kpis .kpi-card strong {
  display: block;
  color: var(--ink);
  font-size: 28px;
  font-weight: 600;
  line-height: 1.1;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}

.overview-kpis .kpi-card p {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.kpi-card-ring {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
}

.kpi-card-ring svg {
  width: 52px;
  height: 52px;
  display: block;
  transform: rotate(-90deg);
}

.kpi-card-ring .ring-track {
  fill: none;
  stroke: var(--surface-inset);
  stroke-width: 6;
}

.kpi-card-ring .ring-value {
  fill: none;
  stroke: var(--accent);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 125.66;
}

.kpi-card-ring .ring-value.down {
  stroke: var(--danger);
}

.kpi-card-ring .ring-value.warn {
  stroke: var(--warning);
}

.kpi-card-ring .ring-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.change-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 7px;
}

.change-chip svg {
  width: 10px;
  height: 10px;
}

.change-chip.up {
  color: var(--success);
  background: var(--success-soft);
}

.change-chip.down {
  color: var(--danger);
  background: var(--danger-soft);
}

/* ================= Metric icon (circle) ================= */
.metric-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
}

.metric-icon svg {
  width: 20px;
  height: 20px;
}

/* ================= Stat rows & progress ================= */
.stat-list {
  display: flex;
  flex-direction: column;
}

.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
}

.stat-row + .stat-row {
  border-top: 1px solid var(--surface-inset);
}

.stat-row-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-weight: 600;
  font-size: 12px;
}

.stat-row-label small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  margin-top: 2px;
}

.stat-row-count {
  text-align: right;
  color: var(--accent);
  font-weight: 600;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.stat-track {
  display: block;
  height: 8px;
  background: var(--surface-inset);
  border-radius: var(--radius-pill);
  overflow: hidden;
  width: 100%;
  box-shadow: inset 0 1px 2px rgb(15 23 42 / 0.08);
}

.stat-track span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

html.dark .stat-track {
  background: var(--border);
  box-shadow: inset 0 1px 2px rgb(0 0 0 / 0.3);
}

/* ================= Badges ================= */
.widget-badge {
  display: inline-block;
  padding: 4px 9px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 7px;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.widget-badge.success {
  background: var(--success-soft);
  color: var(--success);
}

.widget-badge.warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.widget-badge.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.widget-badge.neutral {
  background: var(--surface-inset);
  color: var(--muted);
}

/* ================= Tables ================= */
.widget-table {
  width: 100%;
  border-collapse: collapse;
}

.widget-table th {
  font-size: 10px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: left;
  padding: 12px 8px 10px;
  border-bottom: 1px solid var(--border);
}

.widget-table td {
  padding: 14px 8px;
  border-bottom: 1px solid var(--surface-inset);
  font-size: 12px;
  color: var(--ink);
  vertical-align: middle;
}

.widget-table tr:last-child td {
  border-bottom: none;
}

.widget-table tbody tr {
  transition: background 0.12s ease;
}

.widget-table tbody tr:hover {
  background: var(--canvas);
}

.widget-table .product-cell {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.widget-table .product-cell .product-thumb {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.widget-table .product-cell .product-thumb svg {
  width: 16px;
  height: 16px;
}

.widget-table .product-cell b {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.widget-table .product-cell small {
  display: block;
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 2px;
}

.widget-table .revenue-cell {
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.widget-table .mini-track {
  width: 84px;
}

/* ================= Custom select ================= */
.csel-trigger {
  height: var(--control-height);
  min-height: var(--control-height);
  padding: 0 12px 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
gap: 8px;
  background: var(--surface-inset);
  border-radius: 14px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.csel-trigger svg {
  width: 15px;
  height: 15px;
  color: var(--muted);
  flex-shrink: 0;
}

.csel-trigger:hover {
  background: var(--surface-inset);
}

.custom-dropdown-popover {
  position: absolute;
  z-index: 99999;
  top: calc(100% + 8px);
  right: 0;
  min-width: 100%;
max-width: 280px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 7px;
  box-shadow: 0 18px 44px rgb(15 23 42 / 0.14);
  opacity: 0;
  transform: translateY(4px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.16s, transform 0.16s;
}

.custom-dropdown-popover.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.custom-dropdown-popover .csel-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, color 0.12s;
}

.custom-dropdown-popover .csel-opt:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.custom-dropdown-popover .csel-opt.selected {
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 600;
}

.custom-dropdown-popover .csel-opt svg {
  width: 14px;
  height: 14px;
  color: var(--accent);
}

.custom-dropdown-popover .csel-opt-head {
  padding: 6px 11px 5px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

/* ================= Header dropdowns (bookmarks / notifications) ================= */
.hdr-drop-wrap {
  position: relative;
}

.hdr-drop {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
max-width: calc(100vw - 24px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 8px;
  box-shadow: 0 18px 44px rgb(15 23 42 / 0.14);
  opacity: 0;
  transform: translateY(4px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.16s, transform 0.16s;
  z-index: 99999;
}

.hdr-drop.left { right: auto; left: 0; }

.hdr-drop.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.hdr-drop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px 9px;
}

.hdr-drop-head b {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
}

.hdr-drop-head .hdr-drop-mark {
  font-size: 10.5px;
  font-weight: 600;
color: var(--muted);
  background: var(--surface-inset);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.hdr-drop-item {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 11px;
  color: var(--ink);
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.hdr-drop-item:hover {
  background: var(--accent-soft);
}

.hdr-drop-item .hdr-drop-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--surface-inset);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hdr-drop-item:hover .hdr-drop-icon {
  background: var(--accent-bg);
  color: var(--accent);
}

.hdr-drop-item .hdr-drop-icon svg { width: 15px; height: 15px; }

.hdr-drop-item-copy {
  min-width: 0;
  flex: 1;
}

.hdr-drop-item-copy b {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hdr-drop-item-copy span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hdr-drop-item .hdr-drop-time {
  font-size: 10px;
  color: var(--muted-2);
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 2px;
}

.hdr-drop-item.unread { background: var(--accent-bg); }
.hdr-drop-item.unread:hover { background: var(--accent-soft); }

.hdr-drop-footer {
  padding: 9px 6px 2px;
  border-top: 1px solid var(--border);
  margin-top: 6px;
}

.hdr-drop-footer a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  padding: 8px;
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.12s;
}

.hdr-drop-footer a:hover { background: var(--accent-soft); }

.hdr-drop-footer a svg { width: 13px; height: 13px; }

.hdr-drop-action {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, color 0.12s;
}

.hdr-drop-action svg {
  width: 15px;
  height: 15px;
  color: var(--muted-2);
  flex-shrink: 0;
}

.hdr-drop-action:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.hdr-drop-action.danger { color: var(--danger); }
.hdr-drop-action.danger:hover { background: var(--danger-soft); color: var(--danger); }

/* Header avatar button (account dropdown) */
.hdr-account-btn {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--surface-inset);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  cursor: pointer;
  flex-shrink: 0;
}

.hdr-account-btn:hover,
.hdr-account-btn[aria-expanded="true"] {
  background: var(--accent);
}

.hdr-account-popover .sp-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 10px;
}

@media (max-width: 560px) {
  .hdr-drop { width: min(320px, calc(100vw - 24px)); }
  .hdr-drop.left { right: 0; left: auto; }
}

/* ================= Toast (bottom-center) ================= */
#toast-center-root {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: min(400px, calc(100vw - 40px));
  pointer-events: none;
}

.toast-animate {
  pointer-events: auto;
  min-height: 52px;
  padding: 12px 16px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--canvas) 86%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 18px 48px rgb(15 23 42 / 0.16), 0 2px 8px rgb(15 23 42 / 0.06);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  animation: toast-in 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes toast-in {
  from { transform: translateY(15px) scale(0.96); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* ================= Dashboard grid & banner (shared) ================= */
.ana-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
  align-items: stretch;
}

.ana-grid > .col-8 { grid-column: span 8; }
.ana-grid > .col-6 { grid-column: span 6; }
.ana-grid > .col-4 { grid-column: span 4; }
.ana-grid > .col-3 { grid-column: span 3; }
.ana-grid > .col-12 { grid-column: span 12; }

.perf-banner {
  position: relative;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 30px;
  border-radius: 18px;
  background: var(--accent);
  color: #fff;
  min-height: 190px;
  overflow: hidden;
}

.perf-banner::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(640px 240px at 88% -20%, rgb(255 255 255 / 0.22), transparent 60%),
    radial-gradient(480px 220px at 8% 130%, rgb(0 40 120 / 0.28), transparent 62%);
  pointer-events: none;
}

.perf-banner .banner-copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 460px;
}

.perf-banner .banner-eyebrow {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgb(255 255 255 / 0.75);
  display: flex;
  align-items: center;
  gap: 8px;
}

.perf-banner h2 {
  font-size: 30px;
  font-weight: 600;
  line-height: 1.15;
  margin: 10px 0 6px;
  font-variant-numeric: tabular-nums;
}

.perf-banner .banner-sub {
  font-size: 13px;
  color: rgb(255 255 255 / 0.85);
  margin-bottom: 16px;
}

.perf-mini-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.perf-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  background: rgb(255 255 255 / 0.14);
  font-size: 11px;
  font-weight: 700;
}

.perf-chip svg {
  width: 13px;
  height: 13px;
}

.perf-chip b {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.banner-stats {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  align-items: center;
  padding: 12px 0;
}

.banner-stat {
  min-width: 96px;
  padding-left: 18px;
  border-left: 1px solid rgb(255 255 255 / 0.22);
}

.banner-stat span {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgb(255 255 255 / 0.7);
}

.banner-stat b {
  display: block;
  font-size: 22px;
  font-weight: 600;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

.banner-stat small {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  color: rgb(255 255 255 / 0.85);
  margin-top: 2px;
}

/* ===== Welcome hero (index) — premium flat card ===== */
.perf-banner.perf-hero {
  background:
    radial-gradient(760px 300px at 92% -35%, var(--accent-bg) 0%, transparent 62%),
    radial-gradient(480px 230px at -4% 135%, var(--accent-soft) 0%, transparent 60%),
    var(--surface);
  border: 1px solid var(--border);
}

.perf-hero::before {
  content: "";
  position: absolute;
  right: 84px;
  top: -110px;
  width: 220px;
  height: 220px;
  border: 26px solid var(--accent-soft);
  border-radius: 50%;
  opacity: 0.7;
  pointer-events: none;
}

.perf-hero::after {
  content: "";
  position: absolute;
  right: 330px;
  bottom: -70px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: var(--accent-bg);
  opacity: 0.55;
  pointer-events: none;
}

.perf-hero .banner-copy {
  max-width: 500px;
  z-index: 1;
}

.perf-hero .banner-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-hover);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--accent);
}

.perf-hero .banner-eyebrow svg {
  color: var(--accent);
}

.perf-hero h2 {
  color: var(--ink);
  margin: 14px 0 8px;
}

.perf-hero .banner-sub {
  color: var(--muted);
  margin-bottom: 18px;
}

.perf-hero .perf-chip {
  background: var(--surface-inset);
  color: var(--ink);
  border: 1px solid var(--border);
}

.perf-hero .perf-chip b {
  color: var(--accent);
}

.perf-hero .hero-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
  box-shadow: 0 10px 20px rgb(var(--accent-rgb) / 0.22);
}

.hero-cta:hover {
  background: var(--accent-hover);
  box-shadow: 0 12px 24px rgb(var(--accent-rgb) / 0.3);
  transform: translateY(-1px);
}

.hero-cta svg {
  width: 15px;
  height: 15px;
}

.perf-hero .banner-stats {
  z-index: 1;
}

.perf-hero .banner-stat {
  border-left-color: var(--accent-bg);
}

.perf-hero .banner-stat span {
  color: var(--muted-2);
}

.perf-hero .banner-stat b {
  color: var(--ink);
}

.perf-hero .banner-stat small {
  color: var(--muted);
}

.perf-hero .banner-stat:nth-child(2) small {
  color: var(--success);
}

.perf-hero .perf-banner-balls .b-ball {
  background: var(--accent-soft);
  border: 1px solid var(--accent-bg);
}

.perf-hero .perf-banner-balls .b-ball.b2 {
  background: var(--accent-bg);
}

.perf-hero .perf-banner-balls {
  flex-shrink: 0;
}

@media (max-width: 1280px) {
  .ana-grid > .col-8 { grid-column: span 12; }
  .ana-grid > .col-6 { grid-column: span 12; }
}

@media (max-width: 1024px) {
  .ana-grid > .col-4 { grid-column: span 6; }
  .ana-grid > .col-3 { grid-column: span 6; }
}

@media (max-width: 640px) {
  .perf-banner {
    flex-direction: column;
    padding: 22px;
  }

  .perf-banner h2 { font-size: 24px; }

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

  .ana-grid > .col-3,
  .ana-grid > .col-4,
  .ana-grid > .col-6,
  .ana-grid > .col-8 { grid-column: span 12; }
}

@media (max-width: 440px) {
  .banner-stats { grid-template-columns: 1fr; }
}

/* ================= Custom select ================= */
select.sel-native {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
  border: 0;
  padding: 0;
  margin: 0;
}

.sel-cust {
  position: relative;
  display: inline-block;
  vertical-align: middle;
}

.sel-box {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 38px;
  padding: 0 11px;
border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-inset);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.select-field .sel-box,
.set-field .sel-box,
.profile-field .sel-box {
  height: 40px;
}

.sel-box:hover {
  border-color: var(--accent);
}

.sel-box.open {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.sel-value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sel-chev {
  width: 14px;
  height: 14px;
  color: var(--muted-2);
  flex-shrink: 0;
  transition: transform 0.16s;
}

.sel-box.open .sel-chev {
  transform: rotate(180deg);
}

.sel-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 300;
  min-width: 100%;
  max-height: 224px;
  overflow-y: auto;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 14px 40px rgb(0 0 0 / 0.14);
  opacity: 0;
  transform: translateY(4px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.15s, transform 0.15s;
}

.sel-cust.open .sel-menu {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

html.dark .sel-menu {
  box-shadow: 0 14px 40px rgb(0 0 0 / 0.5);
}

.sel-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  background: transparent;
  border: 0;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.sel-opt:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.sel-opt.active {
  color: var(--accent);
}

.sel-opt.active::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.sel-box:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* ================= Misc ================= */
.flex {
  display: flex;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; min-width: 0; }
.flex-shrink-0 { flex-shrink: 0; }
.text-right { text-align: right; }
.hidden { display: none; }

/* ================= AI Assistant ================= */
.ai-chat {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 208px;
  overflow-y: auto;
  padding: 2px 2px 8px;
}

.ai-msg {
  max-width: 88%;
  padding: 9px 12px;
  border-radius: 14px;
  font-size: 12.5px;
  line-height: 1.5;
}

.ai-msg.bot {
  align-self: flex-start;
  background: var(--surface-inset);
  color: var(--ink);
  border-bottom-left-radius: 4px;
}

.ai-msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.ai-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 10px;
}

.ai-suggestions button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.ai-suggestions button:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.ai-input {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 4px 4px 14px;
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.ai-input:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.ai-input input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-size: 12.5px;
  color: var(--ink);
}

.ai-input button {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  flex-shrink: 0;
  transition: filter 0.15s;
}

.ai-input button:hover { filter: brightness(1.08); }

.ai-input button svg {
  width: 15px;
  height: 15px;
}
.ng-modal-body .ai-chat,
.nx-drawer__body .ai-chat {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  padding: 2px 2px 8px;
}

.ng-modal-body .ai-suggestions,
.nx-drawer__body .ai-suggestions {
  flex-shrink: 0;
}

.ng-modal-body .ai-input,
.nx-drawer__body .ai-input {
  flex-shrink: 0;
  margin-top: 14px;
}

/* ================= Announcements ================= */
.ann-list {
  display: flex;
  flex-direction: column;
}

.ann-item {
  display: flex;
  gap: 12px;
  padding: 12px 2px;
  border-bottom: 1px solid var(--border);
}

.ann-item:last-child { border-bottom: none; }
.ann-item.pinned .ann-copy { padding-left: 0; }

.ann-badge {
  flex-shrink: 0;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  text-transform: uppercase;
}

.ann-badge[data-tone="accent"] { background: var(--accent-soft); color: var(--accent); }
.ann-badge[data-tone="success"] { background: var(--success-soft); color: var(--color-success); }
.ann-badge[data-tone="warning"] { background: var(--warning-soft); color: var(--color-warning); }
.ann-badge[data-tone="neutral"] { background: var(--surface-inset); color: var(--muted); }

.ann-copy { min-width: 0; }
.ann-title-row { display: flex; align-items: center; gap: 6px; margin-top: 1px; }
.ann-title-row b { font-size: 13px; font-weight: 700; color: var(--ink); }
.ann-pin { color: var(--accent); display: inline-flex; }
.ann-pin svg { width: 12px; height: 12px; }
.ann-text { display: block; font-size: 12px; line-height: 1.5; color: var(--muted); margin-top: 2px; }
.ann-time { display: block; font-size: 11px; color: var(--muted-2); margin-top: 5px; }

/* ================= Announcement strip (index) ================= */
.ann-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: 14px;
  background: var(--accent-soft);
  border: 1px solid rgb(var(--accent-rgb) / 0.18);
  margin-bottom: 18px;
  color: var(--ink);
  transition: opacity 0.2s, margin 0.2s;
}

.ann-strip.hidden { display: none; }

.ann-strip-ic {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ann-strip-ic svg { width: 18px; height: 18px; }

.ann-strip-copy { flex: 1; min-width: 0; }
.ann-strip-copy b { font-size: 13px; font-weight: 700; color: var(--ink); display: block; }
.ann-strip-copy span { font-size: 12px; color: var(--muted); display: block; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ann-strip-actions { display: flex; gap: 8px; flex-shrink: 0; align-items: center; }

.ann-strip-close {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.ann-strip-close:hover { border-color: var(--accent); color: var(--accent); }
.ann-strip-close svg { width: 14px; height: 14px; }

a.header-action-btn { text-decoration: none; }

