/*
 * Стили дашборда «Сегодня» и карточки человека.
 * Цвета берутся из переменных темы Unfold (--color-base-*, --color-primary-*),
 * поэтому всё само подстраивается под светлую и тёмную тему.
 */

.fx {
  --fx-radius: var(--border-radius, 8px);
  --fx-border: var(--color-base-200);
  --fx-surface: #fff;
  --fx-surface-2: var(--color-base-50);
  --fx-text: var(--color-base-900);
  --fx-muted: var(--color-base-500);
  --fx-primary: var(--color-primary-600);
  --fx-primary-soft: var(--color-primary-50);
  --fx-danger: oklch(57.7% .245 27.325);
  --fx-danger-soft: oklch(97.1% .013 17.38);
  --fx-warn: oklch(64.6% .222 41.116);
  --fx-warn-soft: oklch(98% .016 73.684);
  --fx-success: oklch(62.7% .194 149.214);
  --fx-success-soft: oklch(98.2% .018 155.826);
  color: var(--fx-text);
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.dark .fx {
  --fx-border: var(--color-base-800);
  --fx-surface: var(--color-base-900);
  --fx-surface-2: color-mix(in oklch, var(--color-base-800) 45%, transparent);
  --fx-text: var(--color-base-100);
  --fx-muted: var(--color-base-400);
  --fx-primary: var(--color-primary-400);
  --fx-primary-soft: color-mix(in oklch, var(--color-primary-500) 18%, transparent);
  --fx-danger-soft: color-mix(in oklch, var(--fx-danger) 18%, transparent);
  --fx-warn-soft: color-mix(in oklch, var(--fx-warn) 18%, transparent);
  --fx-success-soft: color-mix(in oklch, var(--fx-success) 18%, transparent);
}

.fx .material-symbols-outlined { font-size: 20px; line-height: 1; }

/* ---------- шапка страницы ---------- */
.fx-head { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; justify-content: space-between; }
.fx-head h1 { font-size: 24px; font-weight: 600; letter-spacing: -.02em; margin: 0; }
.fx-head p { color: var(--fx-muted); margin: 2px 0 0; }
.fx-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.fx-seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--fx-radius); background: var(--color-base-100); }
.dark .fx-seg { background: rgb(255 255 255 / .06); }
.fx-seg a { padding: 5px 10px; border-radius: calc(var(--fx-radius) - 2px); color: var(--fx-muted); font-weight: 500; white-space: nowrap; transition: background .15s, color .15s; }
.fx-seg a:hover { color: var(--fx-text); }
.fx-seg a.on { background: var(--fx-surface); color: var(--fx-text); box-shadow: 0 1px 2px rgb(0 0 0 / .06); }
.dark .fx-seg a.on { background: var(--color-base-700); }

.fx-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: var(--fx-radius); font-weight: 500; border: 1px solid var(--fx-border); background: var(--fx-surface); color: var(--fx-text); cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s; }
.fx-btn:hover { background: var(--fx-surface-2); }
.fx-btn.primary { background: var(--color-primary-600); border-color: var(--color-primary-600); color: #fff; }
.fx-btn.primary:hover { background: var(--color-primary-700); }
.fx-btn.sm { min-height: 30px; padding: 0 10px; font-size: 13px; }
.fx-btn:focus-visible, .fx-seg a:focus-visible, .fx a:focus-visible { outline: 2px solid var(--fx-primary); outline-offset: 2px; }

/* ---------- сетка и карточки ---------- */
.fx-grid { display: grid; gap: 16px; }
.fx-grid.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); }
.fx-grid.kpi { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.fx-grid.wide-left { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
@media (max-width: 1100px) { .fx-grid.wide-left { grid-template-columns: 1fr; } }

.fx-card { background: var(--fx-surface); border: 1px solid var(--fx-border); border-radius: calc(var(--fx-radius) + 4px); box-shadow: 0 1px 2px rgb(0 0 0 / .04); display: flex; flex-direction: column; min-width: 0; }
.fx-card-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--fx-border); }
.fx-card-head h2 { font-size: 15px; font-weight: 600; margin: 0; }
.fx-card-head .hint { color: var(--fx-muted); font-size: 12px; margin: 1px 0 0; }
.fx-card-head .end { margin-left: auto; }
.fx-card-body { padding: 16px 18px; }
.fx-card-body.flush { padding: 0; }
.fx-icon { width: 32px; height: 32px; flex: none; border-radius: var(--fx-radius); display: grid; place-items: center; background: var(--fx-primary-soft); color: var(--fx-primary); }
.fx-icon.warn { background: var(--fx-warn-soft); color: var(--fx-warn); }
.fx-icon.danger { background: var(--fx-danger-soft); color: var(--fx-danger); }
.fx-icon.success { background: var(--fx-success-soft); color: var(--fx-success); }

.fx-count { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; display: inline-grid; place-items: center; font-size: 12px; font-weight: 600; background: var(--color-base-100); color: var(--fx-muted); }
.dark .fx-count { background: rgb(255 255 255 / .08); }
.fx-count.warn { background: var(--fx-warn-soft); color: var(--fx-warn); }
.fx-count.danger { background: var(--fx-danger-soft); color: var(--fx-danger); }

/* ---------- KPI ---------- */
.fx-kpi { padding: 16px 18px; display: flex; gap: 14px; align-items: flex-start; }
.fx-kpi .v { font-size: 28px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.fx-kpi .l { font-weight: 500; margin-top: 4px; }
.fx-kpi .s { color: var(--fx-muted); font-size: 12px; margin-top: 2px; }

/* ---------- списки людей ---------- */
.fx-list { list-style: none; margin: 0; padding: 0; }
.fx-list li + li { border-top: 1px solid var(--fx-border); }
.fx-person { display: flex; align-items: center; gap: 12px; padding: 12px 18px; color: inherit; transition: background .15s; }
a.fx-person:hover { background: var(--fx-surface-2); }
.fx-avatar { width: 36px; height: 36px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 600; background: var(--fx-primary-soft); color: var(--fx-primary); }
.fx-person .main { min-width: 0; flex: 1; }
.fx-person .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fx-person .meta { color: var(--fx-muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fx-person .side { text-align: right; flex: none; font-size: 12px; color: var(--fx-muted); }
.fx-person .side .date { font-weight: 600; color: var(--fx-text); }
.fx-person .side .date.overdue { color: var(--fx-danger); }

.fx-empty { padding: 28px 18px; text-align: center; color: var(--fx-muted); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.fx-empty .material-symbols-outlined { font-size: 28px; color: var(--color-base-300); }
.dark .fx-empty .material-symbols-outlined { color: var(--color-base-600); }

.fx-tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 5px; font-size: 11px; font-weight: 600; background: var(--color-base-100); color: var(--color-base-700); white-space: nowrap; }
.dark .fx-tag { background: rgb(255 255 255 / .08); color: var(--color-base-200); }
.fx-tag.primary { background: var(--fx-primary-soft); color: var(--fx-primary); }
.fx-tag.success { background: var(--fx-success-soft); color: var(--fx-success); }
.fx-tag.warn { background: var(--fx-warn-soft); color: var(--fx-warn); }
.fx-tag.danger { background: var(--fx-danger-soft); color: var(--fx-danger); }

/* ---------- воронка ---------- */
.fx-funnel { display: flex; flex-direction: column; gap: 10px; }
.fx-funnel-row { display: grid; grid-template-columns: minmax(0, 1fr) 44px 48px; gap: 4px 12px; align-items: center; }
.fx-funnel-row .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fx-funnel-row .t a { color: inherit; }
.fx-funnel-row .t a:hover { color: var(--fx-primary); }
.fx-funnel-row .n { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.fx-funnel-row .p { text-align: right; color: var(--fx-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.fx-bar { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--color-base-100); overflow: hidden; }
.dark .fx-bar { background: rgb(255 255 255 / .06); }
.fx-bar > i { display: block; height: 100%; border-radius: 3px; background: var(--color-primary-500); }
.fx-funnel-row.key .t { font-weight: 600; }
.fx-funnel-row.success .fx-bar > i { background: var(--fx-success); }
.fx-funnel-row.warn .fx-bar > i { background: var(--fx-warn); }
.fx-sep { border: 0; border-top: 1px dashed var(--fx-border); margin: 4px 0; }

/* ---------- таблицы ---------- */
.fx-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.fx-table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--fx-muted); padding: 10px 18px; border-bottom: 1px solid var(--fx-border); white-space: nowrap; background: var(--fx-surface-2); }
.fx-table td { padding: 11px 18px; border-bottom: 1px solid var(--fx-border); vertical-align: middle; }
.fx-table tr:last-child td { border-bottom: 0; }
.fx-table .num { text-align: right; }
.fx-table td a { font-weight: 500; }
.fx-table .sub { color: var(--fx-muted); font-size: 12px; }
.fx-scroll { overflow-x: auto; }

.fx-copy { display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 6px; border: 1px solid var(--fx-border); background: var(--fx-surface); color: var(--fx-muted); font-size: 12px; cursor: pointer; white-space: nowrap; }
.fx-copy:hover { color: var(--fx-text); background: var(--fx-surface-2); }
.fx-copy .material-symbols-outlined { font-size: 16px; }
.fx-copy.done { color: var(--fx-success); border-color: var(--fx-success); }

/* ---------- мини-статистика ---------- */
.fx-stats { display: flex; flex-direction: column; }
.fx-stat { display: flex; align-items: center; gap: 12px; padding: 11px 18px; }
.fx-stat + .fx-stat { border-top: 1px solid var(--fx-border); }
.fx-stat .material-symbols-outlined { color: var(--fx-muted); }
.fx-stat .v { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- быстрые действия ---------- */
.fx-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 12px; }
.fx-action { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border: 1px solid var(--fx-border); border-radius: calc(var(--fx-radius) + 4px); background: var(--fx-surface); color: inherit; transition: border-color .15s, background .15s; }
.fx-action:hover { border-color: var(--color-primary-300); background: var(--fx-surface-2); }
.fx-action .t { font-weight: 600; }
.fx-action .d { color: var(--fx-muted); font-size: 12px; }

/* ---------- карточка человека (над формой профиля) ---------- */
.fx-profile { display: flex; flex-direction: row; flex-wrap: wrap; gap: 16px 24px; align-items: center; padding: 18px 20px; margin-bottom: 20px; }
.fx-profile .fx-avatar { width: 52px; height: 52px; font-size: 18px; }
.fx-profile .who { min-width: 200px; flex: 1; }
.fx-profile .who .name { font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.fx-profile .who .meta { color: var(--fx-muted); margin-top: 2px; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.fx-facts { display: flex; flex-wrap: wrap; gap: 8px 28px; }
.fx-fact .k { color: var(--fx-muted); font-size: 12px; }
.fx-fact .v { font-weight: 600; margin-top: 2px; }
.fx-fact .v.danger { color: var(--fx-danger); }

/* ---------- подсказка над списками ---------- */
.fx-callout { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; margin-bottom: 16px; border-radius: calc(var(--fx-radius) + 2px); background: var(--fx-primary-soft); color: var(--fx-text); }
.fx-callout .material-symbols-outlined { color: var(--fx-primary); margin-top: 1px; }
.fx-callout p { margin: 0; }
.fx-callout p + p { margin-top: 4px; }
.fx-callout b { font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  .fx * { transition: none !important; }
}

/* Предупреждение на странице удаления */
.fx-callout.warn { background: var(--fx-warn-soft); }
.fx-callout.warn > .material-symbols-outlined { color: var(--fx-warn); }
.fx-delete-notes { line-height: 1.5; }
.fx-delete-notes .fx-dn-head { font-weight: 600; font-size: 15px; }
.fx-delete-notes .fx-dn-note, .fx-delete-notes .fx-dn-advice { margin-top: 12px; }
.fx-delete-notes .fx-dn-title { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.fx-delete-notes .fx-dn-title .material-symbols-outlined { font-size: 18px; color: var(--fx-warn); }
.fx-delete-notes ul { list-style: disc; margin: 4px 0 0; padding-left: 20px; }
.fx-delete-notes li + li { margin-top: 2px; }
.fx-delete-notes .fx-dn-more { margin-top: 8px; color: var(--fx-muted); }
.fx-delete-notes .fx-dn-advice { padding-top: 12px; border-top: 1px solid color-mix(in oklch, var(--fx-warn) 25%, transparent); }

/* ---- Переключатель темы в меню пользователя: подписи не вылезают за край ---- */
.\@container > a[x-on\:click^="switchTheme"] {
  min-width: 0;
  padding-left: 0.25rem;
  padding-right: 0.25rem;
  gap: 0.25rem;
  justify-content: center;
}
.\@container > a[x-on\:click^="switchTheme"] > .material-symbols-outlined {
  font-size: 20px;
}
.\@container > a[x-on\:click^="switchTheme"] > span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Поиск стал type="search" (против автозаполнения) — прячем встроенный крестик браузера */
#searchbar::-webkit-search-cancel-button,
#searchbar::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}
