:root {
  --bg: #f5f8fc;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: rgba(148, 163, 184, 0.36);
  --border: #e5e7eb;
  --accent-violet: #7c6ee6;
  --accent-blue: #4f8ff7;
  --accent-green: #35b37e;
  --accent-pink: #d279a4;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: "Inter", "Segoe UI", sans-serif;
  color: var(--text);
  background: #f5f8fc;
}

.dashboard {
  width: 100%;
  position: relative;
  padding: min(1vh, 8px) min(2vw, 24px);
  overflow: hidden;
}

.top-hud {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  width: min(520px, 52vw);
  display: grid;
  gap: 10px;
}

.top-score {
  position: relative;
  z-index: 5;
  width: 100%;
  margin: 0 auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 8px 12px;
  backdrop-filter: blur(10px);
  box-shadow:
    0 10px 30px rgba(15, 23, 42, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);
  animation: softFloat 4.8s ease-in-out infinite;
}

.top-hud-badges {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
}

.top-score h1 {
  margin: 0 0 4px;
  font-size: clamp(16px, 1.5vw, 22px);
  font-weight: 700;
}

.quality-row {
  width: 100%;
  margin: 0;
  display: grid;
  grid-template-columns: 110px 1fr;
  align-items: center;
  gap: 8px;
}

.quality-label {
  color: var(--muted);
  font-size: clamp(11px, 0.9vw, 13px);
  text-align: right;
}

.quality-bar-track {
  width: 100%;
  margin: 0;
  height: 10px;
  border-radius: 999px;
  background: #e9eef7;
  box-shadow: inset 0 1px 3px rgba(15, 23, 42, 0.1);
  overflow: hidden;
}

.quality-bar-fill {
  height: 100%;
  width: 0;
  transition: width 0.3s ease;
  box-shadow: 0 4px 10px rgba(79, 143, 247, 0.35);
  background-image: linear-gradient(90deg, rgba(255, 255, 255, 0.32), rgba(255, 255, 255, 0));
}

.quality-bar-fill.intermediate {
  opacity: 0.86;
}

.quality-split {
  display: flex;
  justify-content: center;
  gap: clamp(14px, 4vw, 40px);
  color: var(--muted);
  font-size: clamp(14px, 1.08vw, 18px);
  font-weight: 700;
}

.quality-split span {
  padding: 0;
  border-radius: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.last-percent-change {
  margin: 2px 0 0;
  font-size: clamp(10px, 0.82vw, 12px);
  line-height: 1.35;
  color: var(--muted);
  font-weight: 600;
}

.last-percent-change.up {
  color: #2f6b3f;
}

.last-percent-change.down {
  color: #9b4d57;
}

.last-percent-change.hidden {
  display: none;
}

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: min(360px, 100%);
  padding: 24px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.1);
}

.login-error {
  color: #9b4d57;
  font-size: 13px;
}

.app-shell {
  display: grid;
  grid-template-columns: 64px 1fr;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
}

.app-shell.hidden,
.hidden {
  display: none !important;
}

.app-sidebar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 8px;
  background: rgba(255, 255, 255, 0.95);
  border-right: 1px solid var(--border);
}

.sidebar-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.sidebar-link:hover {
  background: #f0f4fa;
  color: #334155;
}

.sidebar-link.active {
  background: #e8f0ff;
  color: #2f65b0;
}

.sidebar-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.sidebar-icon-fallback {
  font-size: 18px;
  line-height: 1;
}

.app-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.app-topbar {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.85);
}

/* Область под topbar: дашборд без скролла, модули — со скроллом */
.app-main > .app-view {
  flex: 1 1 0;
  min-height: 0;
}

.app-main > .dashboard {
  overflow: hidden;
}

.app-main > .module-view {
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.module-view {
  padding: 20px 24px 88px;
  background: linear-gradient(180deg, #eef2f8 0%, #f8fafc 160px);
  --fam-accent: #4f8ff7;
  --fam-accent-soft: #eef4ff;
  --fam-success: #2a9d6a;
  --fam-success-soft: #e8faf0;
  --fam-warn: #b8860b;
  --fam-danger: #c45c6a;
  --fam-radius: 14px;
  --fam-shadow: none;
}

#viewFinance,
#viewTasks,
#viewActivityLogs {
  position: relative;
}

.fam-logs-page {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.fam-logs-page .fam-page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 16px;
}

.fam-logs-page .fam-page-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.fam-logs-page .fam-page-desc {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.45;
}

.fam-header-icon.logs {
  background: linear-gradient(135deg, #5b6b8a, #3d4a63);
  color: #fff;
}

.fam-logs-tabs {
  margin-bottom: 18px;
}

.fam-log-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fam-log-item {
  padding: 14px 16px;
  background: #fff;
  border-radius: var(--fam-radius, 14px);
  border: 1px solid #e8eef5;
  box-shadow: var(--fam-shadow);
}

.fam-log-item-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 8px;
}

.fam-log-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.fam-log-badge-create {
  background: #e8faf0;
  color: #1d7a4a;
}

.fam-log-badge-update {
  background: #eef4ff;
  color: #2f65b0;
}

.fam-log-badge-delete {
  background: #fdeef0;
  color: #a63d4d;
}

.fam-log-badge-status {
  background: #fff8e6;
  color: #8a6d00;
}

.fam-log-badge-upload {
  background: #f0f4fa;
  color: #4a5568;
}

.fam-log-badge-snooze {
  background: #f3efff;
  color: #5b4d8a;
}

.fam-log-module {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.fam-log-time {
  margin-left: auto;
  font-size: 12px;
  color: #a0aec0;
}

.fam-log-summary {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
}

.fam-log-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}

.fam-log-user {
  font-weight: 600;
  color: #4a5568;
}

.fam-log-entity {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  opacity: 0.85;
}

.fam-log-changes {
  list-style: none;
  margin: 10px 0 0;
  padding: 10px 12px;
  background: #f6f8fb;
  border-radius: 10px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fam-log-changes li {
  display: grid;
  grid-template-columns: minmax(80px, 1fr) auto auto 1fr;
  gap: 6px;
  align-items: baseline;
}

.fam-log-change-label {
  font-weight: 600;
  color: var(--muted);
}

.fam-log-change-from {
  color: #a0aec0;
  text-decoration: line-through;
}

.fam-log-change-arrow {
  color: #c5d0e0;
}

.fam-log-change-to {
  font-weight: 600;
  color: var(--text);
}

.fam-logs-more {
  display: block;
  margin: 16px auto 0;
}

.fam-fab {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 20;
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f8ff7, #3d7ae0);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(61, 122, 224, 0.45);
  transition: transform 0.15s, box-shadow 0.15s;
}

.fam-fab .fam-ico {
  width: 26px;
  height: 26px;
}

.fam-fab:hover {
  transform: scale(1.05);
  box-shadow: 0 10px 28px rgba(61, 122, 224, 0.5);
}

.fam-fab:active {
  transform: scale(0.98);
}

.fam-fab-tasks {
  background: linear-gradient(135deg, #35b37e, #2a9d6a);
  box-shadow: 0 8px 24px rgba(42, 157, 106, 0.42);
}

.fam-fab-tasks:hover {
  box-shadow: 0 10px 28px rgba(42, 157, 106, 0.48);
}

/* ─── Family modules (Finance & Tasks) ─── */
.fam-ico {
  flex-shrink: 0;
  display: block;
}

.fam-ico-sm { width: 16px; height: 16px; }
.fam-ico-md { width: 20px; height: 20px; }
.fam-ico-lg { width: 24px; height: 24px; }

.fam-wrap {
  max-width: 920px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.fam-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 16px;
}

.fam-header-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--fam-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.fam-header-icon.finance {
  background: var(--fam-accent-soft);
  color: #3d7ae0;
}

.fam-header-icon.tasks {
  background: var(--fam-success-soft);
  color: var(--fam-success);
}

.fam-header-text {
  flex: 1;
  min-width: 0;
}

.fam-title {
  margin: 0 0 4px;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.fam-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.fam-month-picker {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
}

.fam-month-picker input[type="month"] {
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text);
  padding: 0;
  min-width: 0;
}

.fam-month-picker input[type="month"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.5;
}

.fam-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.fam-card {
  background: var(--card);
  border: none;
  border-radius: 20px;
  padding: 16px 18px;
  box-shadow: none;
}

.fam-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.fam-card-title {
  margin: 0 0 4px;
  font-size: 1.05rem;
  font-weight: 600;
}

.fam-card-desc {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.4;
}

.fam-section-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.fam-section-head.compact h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.fam-section-head .fam-card-title {
  margin: 0;
}

.fam-section-head .fam-card-desc {
  margin-top: 2px;
}

.fam-section-head .fam-ico-lg {
  margin-top: 2px;
  color: var(--fam-accent);
}

.fam-dialog-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.fam-dialog-title h3 {
  margin: 0;
  font-size: 1.15rem;
}

.fam-dialog-title .fam-ico {
  color: var(--fam-accent);
}

.fam-alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--fam-radius);
  border: 1px solid;
}

.fam-alert .fam-ico {
  flex-shrink: 0;
  margin-top: 2px;
}

.fam-alert > div {
  flex: 1;
  min-width: 0;
}

.fam-alert-urgent {
  background: #fff5f5;
  border-color: #f5c6cb;
  color: #7a2e3a;
}

.fam-alert-warning {
  background: #fffbeb;
  border-color: #fde68a;
  color: #7a5c1e;
}

.fam-alert p {
  margin: 6px 0 12px;
  font-size: 0.9rem;
}

.fam-budget-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.fam-metric {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  background: var(--fam-muted-surface, #f6f8fb);
  border-radius: 12px;
  border: 1px solid #eef2f8;
}

.fam-metric .fam-ico {
  color: var(--muted);
  margin-top: 2px;
}

.fam-metric-body {
  min-width: 0;
}

.fam-metric-hero {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #eef4ff 0%, #f8fafc 100%);
  border-color: #d4e4ff;
}

.fam-metric-hero .fam-ico {
  color: var(--fam-accent);
}

.fam-metric-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.fam-metric-value {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.fam-metric-hero .fam-metric-value {
  font-size: 1.5rem;
  color: #2f65b0;
}

.fam-metric-hint {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.fam-progress-wrap {
  margin-top: 8px;
}

.fam-progress-bar {
  height: 10px;
  background: #eef2f8;
  border-radius: 999px;
  overflow: hidden;
}

.fam-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #4f8ff7, #35b37e);
  transition: width 0.3s ease;
}

.fam-progress-fill.over,
.fam-progress-fill.unset {
  background: linear-gradient(90deg, #e07a8a, #d4a574);
}

.fam-progress-fill.warning {
  background: linear-gradient(90deg, #e6b84d, #4f8ff7);
}

.fam-progress-caption {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.fam-pace-msg {
  margin: 12px 0 0;
  font-size: 0.9rem;
}

.fam-pace-over { color: #9b4d57; }
.fam-pace-warning { color: #8a6d3b; }
.fam-pace-unset { color: var(--muted); }

.fam-stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.fam-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #f6f8fb;
  border-radius: 12px;
  border: 1px solid #eef2f8;
  font-size: 13px;
}

.fam-stat-pill .fam-ico {
  color: var(--muted);
}

.fam-stat-pill-text span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.fam-stat-pill-text b {
  font-size: 0.95rem;
  font-weight: 700;
}

.fam-stat-pill.warn {
  background: #fff5f5;
  border-color: #f5c6cb;
}

.fam-category-bars {
  list-style: none;
  padding: 0;
  margin: 0;
}

.fam-category-bars li {
  display: grid;
  grid-template-columns: 100px 1fr 80px;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #eef2f8;
  font-size: 13px;
}

.fam-cat-bar {
  height: 8px;
  background: #eef2f8;
  border-radius: 4px;
  overflow: hidden;
}

.fam-cat-bar div {
  height: 100%;
  background: #4f8ff7;
  border-radius: 4px;
  transition: width 0.25s ease, background 0.25s ease;
}

.fam-category-limit-bars li {
  display: block;
  padding: 12px 0;
}

.fam-cat-limit-item.over,
.fam-category-limit-edit-item.over {
  background: #fff8f8;
  border-radius: 10px;
  padding-left: 10px;
  padding-right: 10px;
}

.fam-cat-limit-item.warn,
.fam-category-limit-edit-item.warn {
  background: #fffbf3;
  border-radius: 10px;
  padding-left: 10px;
  padding-right: 10px;
}

.fam-cat-limit-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 6px;
}

.fam-cat-limit-meta {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.fam-cat-pace {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: #4a6a8a;
}

.fam-cat-pace.warn {
  color: #9a6b12;
}

.fam-cat-pace.over {
  color: #9b2c42;
  font-weight: 600;
}

.fam-cat-archived-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #eef2f8;
  color: #6b7c93;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ─── Доступ: общий/личный (сегмент-контрол + бейджи) ─── */

.fam-access-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.fam-access-opt {
  position: relative;
  cursor: pointer;
}

.fam-access-opt input {
  position: absolute;
  opacity: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.fam-access-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.fam-access-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 9px;
  background: #f1f5fb;
  color: #6b7c93;
  transition: background 0.15s ease, color 0.15s ease;
}

.fam-access-ico .fam-ico {
  width: 17px;
  height: 17px;
}

.fam-access-txt {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;
}

.fam-access-txt b {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.fam-access-txt small {
  font-size: 11.5px;
  color: var(--muted);
}

.fam-access-opt:hover .fam-access-card {
  border-color: #c5d4e8;
}

.fam-access-opt:has(input:checked) .fam-access-card {
  border-color: transparent;
  background: var(--fam-accent-soft);
  box-shadow: 0 0 0 2px var(--fam-accent);
}

.fam-access-opt:has(input:checked) .fam-access-ico {
  background: var(--fam-accent);
  color: #fff;
}

.fam-access-opt:has(input:checked) .fam-access-txt b {
  color: #2f65b0;
}

.fam-access-opt input:focus-visible + .fam-access-card {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--fam-accent);
}

/* Бейдж «Личное» */
.fam-private-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  padding: 2px 8px 2px 6px;
  border-radius: 999px;
  background: #eef2f8;
  color: #64748b;
  font-size: 11px;
  font-weight: 600;
  vertical-align: middle;
}

.fam-private-badge .fam-ico {
  width: 12px;
  height: 12px;
}

/* Угловой бейдж на обложке карточки цели */
.goal-card-private {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px 4px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
}

.goal-card-private .fam-ico {
  width: 13px;
  height: 13px;
}

.goal-hero-badge-private {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.goal-hero-badge-private .fam-ico {
  width: 13px;
  height: 13px;
}

.fam-category-limit-edit-item.archived {
  background: #f3f5f8;
  border-style: dashed;
}

.fam-category-limit-readonly {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: #5c6b80;
}

.fam-cat-limit-bar {
  margin-top: 4px;
}

.fam-category-limits-form {
  margin-top: 4px;
}

.fam-category-limit-edit-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fam-category-limit-edit-item {
  display: grid;
  grid-template-columns: 1fr minmax(140px, 180px);
  gap: 10px 16px;
  padding: 14px 12px;
  border: 1px solid #e8edf4;
  border-radius: 12px;
  background: #f8fafc;
}

.fam-category-limit-edit-item .fam-cat-limit-bar {
  grid-column: 1 / -1;
}

.fam-category-limit-edit-main {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.fam-category-limit-edit-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.fam-category-limit-edit-text strong {
  font-size: 14px;
}

.fam-category-limit-field {
  margin: 0;
}

.fam-category-limit-field input {
  width: 100%;
}

.fam-muted {
  color: var(--muted);
  font-size: 0.85rem;
}

.fam-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  border: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, filter 0.15s;
}

.fam-btn-with-icon .fam-ico {
  width: 16px;
  height: 16px;
}

.fam-btn-icon-only {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 12px;
}

.fam-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.fam-icon-btn:hover {
  background: var(--fam-accent-soft);
  border-color: #c5d4e8;
  color: var(--fam-accent);
}

.fam-icon-btn .fam-ico {
  width: 18px;
  height: 18px;
}

.fam-icon-btn-success {
  border-color: #c8ead8;
  color: var(--fam-success);
  background: var(--fam-success-soft);
}

.fam-icon-btn-success:hover {
  background: #d4f0e0;
  border-color: var(--fam-success);
}

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

.fam-btn-primary {
  background: linear-gradient(135deg, #4f8ff7, #3d7ae0);
  color: #fff;
}

.fam-btn-primary:hover {
  filter: brightness(1.05);
}

.fam-btn-ghost {
  background: #f0f4fa;
  color: var(--text);
  border: 1px solid var(--border);
}

.fam-btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.fam-btn-danger {
  background: #fff5f5;
  color: #9b4d57;
  border: 1px solid #f5c6cb;
}

.fam-btn-danger:hover {
  background: #f8d7da;
}

.fam-form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.fam-form-grid-tasks {
  grid-template-columns: repeat(3, 1fr);
}

.fam-create-task-dates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.fam-assignee-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.fam-assignee-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 6px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 0 1px #e2e8f0;
  cursor: pointer;
  transition: box-shadow 0.15s ease, background 0.15s ease;
}

.fam-assignee-pill:hover {
  box-shadow: 0 0 0 1px #c5d4e8;
  background: #f8fafc;
}

.fam-assignee-pill input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.fam-assignee-pill:has(input:checked) {
  background: #eef4ff;
  box-shadow: 0 0 0 2px #4f8ff7;
}

.fam-assignee-pill:has(input:focus-visible) {
  outline: 2px solid #4f8ff7;
  outline-offset: 2px;
}

.fam-assignee-pill .fam-user-avatar {
  width: 28px;
  height: 28px;
  font-size: 11px;
}

.fam-assignee-pill-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.fam-create-task-more {
  margin-top: 20px;
  border: 1px solid #e8eef5;
  border-radius: 12px;
  background: #fafbfd;
  overflow: hidden;
}

.fam-task-create-form .fam-create-task-more {
  margin-top: 22px;
}

.fam-create-task-more summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.fam-create-task-more summary .fam-ico {
  color: var(--muted);
  flex-shrink: 0;
}

.fam-create-task-more summary::-webkit-details-marker {
  display: none;
}

.fam-create-task-more summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.fam-create-task-more[open] summary::after {
  transform: rotate(-135deg);
  margin-top: 4px;
}

.fam-create-task-more-hint {
  margin-left: auto;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.fam-create-task-more[open] summary {
  border-bottom: 1px solid #eef2f8;
}

.fam-create-task-more-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fam-field textarea {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.45;
  resize: vertical;
  min-height: 64px;
}

.fam-empty-celebrate {
  list-style: none;
  text-align: center;
  padding: 32px 20px;
  border-radius: 14px;
  background: linear-gradient(165deg, #f0faf4 0%, #e8f5ee 100%);
  border: 1px solid #d0eadc;
}

.fam-empty-celebrate-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, #35b37e, #2a9d6a);
  color: #fff;
  box-shadow: 0 6px 16px rgba(42, 157, 106, 0.28);
}

.fam-empty-celebrate-icon .fam-ico {
  width: 28px;
  height: 28px;
}

.fam-empty-celebrate strong {
  display: block;
  font-size: 1.15rem;
  margin-bottom: 6px;
  color: #2d6b4a;
}

.fam-empty-celebrate p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

.fam-task-desc {
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}

.fam-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fam-field span {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.fam-field input,
.fam-field select {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
}

.fam-field-span2 {
  grid-column: span 2;
}

.fam-field-grow {
  flex: 1;
  min-width: 180px;
}

/* Кастомная галочка (Финансы, Задачи) */
.fam-check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  margin: 4px 0 0;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: linear-gradient(180deg, #fafbfd 0%, #f4f7fb 100%);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.fam-check:hover {
  border-color: #c5d4e8;
  background: #f0f5fc;
}

.fam-check-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.fam-check-box {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  border: 2px solid #b8c5d8;
  border-radius: 7px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.fam-check-input:focus-visible + .fam-check-box {
  outline: 2px solid #4f8ff7;
  outline-offset: 2px;
}

.fam-check-input:checked + .fam-check-box {
  background: linear-gradient(135deg, #4f8ff7, #3d7ae0);
  border-color: #3d7ae0;
  box-shadow: 0 2px 8px rgba(61, 122, 224, 0.32);
}

.fam-check-input:checked + .fam-check-box::after {
  content: "";
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg) translateY(-1px);
}

.fam-check-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding-top: 1px;
}

.fam-check-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
}

.fam-check-hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.fam-form-grid > .fam-check {
  grid-column: 1 / -1;
}

.fam-dialog-body > .fam-check {
  margin: 6px 0 14px;
}

.fam-check-compact {
  padding: 0;
  margin: 2px 0 0;
  border: none;
  background: none;
  align-items: center;
}

.fam-check-compact:hover {
  background: none;
  border-color: transparent;
}

.fam-check-compact .fam-check-box {
  margin-top: 0;
}

.fam-form-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.fam-form-actions-split {
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.fam-form-actions-end {
  display: flex;
  gap: 8px;
}

.fam-form-collapsed.hidden {
  display: none !important;
}

.fam-upload-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.fam-add-choice-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 16px 0;
}

.fam-add-choice {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.fam-add-choice:hover {
  border-color: #4f8ff7;
  background: #f0f6ff;
  box-shadow: 0 4px 14px rgba(79, 143, 247, 0.12);
}

.fam-add-choice-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--fam-accent-soft);
  color: var(--fam-accent);
  flex-shrink: 0;
}

.fam-add-choice-icon .fam-ico {
  width: 22px;
  height: 22px;
}

.fam-add-choice-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.fam-add-choice-text strong {
  font-size: 15px;
  color: var(--text);
}

.fam-add-choice-text span {
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

.fam-btn-block {
  width: 100%;
  justify-content: center;
}

.fam-obl-list,
.fam-tx-list,
.fam-task-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.fam-obl-item {
  display: grid;
  grid-template-columns: minmax(88px, auto) 1fr auto auto auto;
  gap: 10px 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #eef2f8;
}

.fam-obl-date {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.fam-obl-date .fam-ico {
  opacity: 0.7;
}

.fam-obl-item:last-child {
  border-bottom: none;
}

.fam-obl-item.status-overdue {
  background: linear-gradient(90deg, rgba(248, 215, 218, 0.25), transparent);
  margin: 0 -12px;
  padding-left: 12px;
  padding-right: 12px;
  border-radius: 8px;
}

.fam-obl-title {
  display: block;
  font-size: 1rem;
}

.fam-obl-notes {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.fam-obl-amount {
  font-weight: 700;
  white-space: nowrap;
}

.fam-obl-actions {
  display: flex;
  flex-direction: row;
  gap: 6px;
}

.fam-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.fam-status .fam-ico {
  width: 12px;
  height: 12px;
}

.fam-status-pending {
  background: #fff3cd;
  color: #856404;
}

.fam-status-paid {
  background: #d4edda;
  color: #2f6b3f;
}

.fam-status-overdue {
  background: #f8d7da;
  color: #9b4d57;
}

.fam-status-warning {
  background: #fff3cd;
  color: #856404;
}

.fam-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  padding: 3px 8px;
  background: #e8f0ff;
  color: #2f65b0;
  border-radius: 6px;
  margin-top: 4px;
}

.fam-tag .fam-ico {
  width: 12px;
  height: 12px;
}

.fam-empty-list,
.fam-empty-inline {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 16px 0;
}

.fam-empty-inline p {
  margin: 0 0 12px;
}

.fam-tx-list > li {
  list-style: none;
}

.fam-tx-item {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 12px;
  width: 100%;
  padding: 12px 8px;
  margin: 0 -8px;
  border: none;
  border-bottom: 1px solid #eef2f8;
  border-radius: 10px;
  background: transparent;
  font-size: 13px;
  align-items: center;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  transition: background 0.15s ease;
}

.fam-tx-item:hover {
  background: #f6f9fc;
}

.fam-tx-item:active {
  background: #eef4fa;
}

.fam-tx-chevron {
  display: flex;
  align-items: center;
  color: #a0aec0;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.fam-tx-item:hover .fam-tx-chevron {
  opacity: 1;
}

.fam-tx-edit-source {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.fam-tx-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #f6f8fb;
  color: var(--muted);
}

.fam-tx-main strong {
  display: block;
  font-weight: 600;
  margin-top: 2px;
}

.fam-tx-date {
  font-size: 11px;
  color: var(--muted);
}

.fam-tx-meta {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.fam-tx-amt {
  font-weight: 700;
  color: #9b4d57;
  white-space: nowrap;
}

.fam-details-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}

.fam-details-summary::after {
  content: "";
  width: 8px;
  height: 8px;
  margin-left: auto;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}

.fam-details[open] .fam-details-summary::after {
  transform: rotate(-135deg);
}

.fam-details summary {
  cursor: pointer;
  font-weight: 600;
  padding: 2px 0;
  list-style: none;
}

.fam-details summary::-webkit-details-marker {
  display: none;
}

.fam-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  font-size: 11px;
  font-weight: 700;
  background: var(--fam-accent-soft);
  color: #2f65b0;
  border-radius: 999px;
}

.fam-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 56px 24px;
  text-align: center;
  color: var(--muted);
  list-style: none;
}

.fam-empty-state .fam-ico-lg {
  width: 40px;
  height: 40px;
  color: var(--muted);
  opacity: 0.4;
}

.fam-empty-state strong {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}

.fam-empty-state p {
  margin: 0;
  font-size: 12px;
}

.fam-dialog {
  border: none;
  border-radius: 16px;
  padding: 0;
  max-width: 420px;
  width: calc(100% - 32px);
  box-shadow: 0 24px 48px rgba(31, 41, 55, 0.2);
}

.fam-dialog-wide {
  max-width: 440px;
}

.fam-dialog-manual-tx,
.fam-dialog-upload-pdf {
  max-width: 420px;
}

.fam-upload-pdf-form {
  display: flex;
  flex-direction: column;
  padding: 28px 28px 24px;
  gap: 0;
}

.fam-upload-pdf-form .fam-field {
  gap: 10px;
  margin-bottom: 20px;
}

.fam-bank-pills {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}

.fam-bank-pill {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 16px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 0 0 1px #e2e8f0;
  cursor: pointer;
  transition: box-shadow 0.15s ease, background 0.15s ease;
}

.fam-bank-pill:hover {
  box-shadow: 0 0 0 1px #c5d4e8;
  background: #f8fafc;
}

.fam-bank-pill input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.fam-bank-pill:has(input:checked) {
  background: var(--fam-accent-soft);
  box-shadow: 0 0 0 2px var(--fam-accent);
}

.fam-bank-pill-freedom:has(input:checked) {
  background: #f0faf4;
  box-shadow: 0 0 0 2px var(--fam-success);
}

.fam-bank-pill-label {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.fam-file-drop {
  display: block;
  cursor: pointer;
  margin-bottom: 4px;
}

.fam-file-input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.fam-file-drop-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 28px 20px;
  text-align: center;
  background: linear-gradient(180deg, #fafbfd 0%, #f4f7fb 100%);
  border: 2px dashed #d0dae8;
  border-radius: 16px;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.fam-file-drop:hover .fam-file-drop-inner,
.fam-file-drop.dragover .fam-file-drop-inner {
  border-color: var(--fam-accent);
  background: #f0f6ff;
}

.fam-file-drop.dragover .fam-file-drop-inner {
  box-shadow: 0 0 0 3px rgba(79, 143, 247, 0.12);
}

.fam-file-drop.has-file .fam-file-drop-inner {
  border-style: solid;
  border-color: #c8ead8;
  background: linear-gradient(180deg, #f6fcf9 0%, #f0faf4 100%);
}

.fam-file-drop-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin-bottom: 4px;
  border-radius: 14px;
  background: #fff;
  color: var(--fam-accent);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.fam-file-drop.has-file .fam-file-drop-icon {
  color: var(--fam-success);
  background: var(--fam-success-soft);
}

.fam-file-drop-icon .fam-ico {
  width: 26px;
  height: 26px;
}

.fam-file-drop-inner strong {
  font-size: 15px;
  color: var(--text);
}

.fam-file-drop-hint {
  font-size: 12px;
  color: var(--muted);
}

.fam-file-name {
  display: block;
  margin-top: 8px;
  padding: 8px 12px;
  max-width: 100%;
  font-size: 13px;
  font-weight: 600;
  color: #2f6b4a;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 0 0 1px #d0eadc;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fam-file-name[hidden] {
  display: none !important;
}

.fam-manual-tx-form,
.fam-task-create-form {
  display: flex;
  flex-direction: column;
  padding: 28px 28px 24px;
  gap: 0;
}

.fam-manual-tx-form .fam-dialog-title,
.fam-task-create-form .fam-dialog-title {
  margin-bottom: 10px;
}

.fam-dialog-task-create {
  max-width: 440px;
}

.fam-dialog-header {
  margin-bottom: 22px;
}

.fam-dialog-lead {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
  background: #f6f8fb;
  border-radius: 10px;
  border: 1px solid #eef2f8;
}

.fam-dialog-lead .fam-ico {
  color: var(--fam-accent);
  flex-shrink: 0;
}

.fam-field-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.fam-field-label em {
  font-style: normal;
  font-size: 10px;
  font-weight: 500;
  color: #a0aec0;
  margin-left: 2px;
}

.fam-field-amount,
.fam-field-title {
  margin-bottom: 22px;
}

.fam-task-create-form .fam-input-hero {
  width: 100%;
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  font-family: inherit;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.fam-task-create-form .fam-input-hero::placeholder {
  color: #b8c5d8;
  font-weight: 500;
}

.fam-task-create-form .fam-input-hero:focus {
  outline: none;
  border-color: #4f8ff7;
  box-shadow: 0 0 0 3px rgba(79, 143, 247, 0.1);
}

.fam-manual-tx-form .fam-input-amount {
  width: 100%;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  font-family: inherit;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.fam-manual-tx-form .fam-input-amount::placeholder {
  color: #b8c5d8;
  font-weight: 500;
}

.fam-manual-tx-form .fam-input-amount:focus {
  outline: none;
  border-color: #4f8ff7;
  box-shadow: 0 0 0 3px rgba(79, 143, 247, 0.1);
}

.fam-form-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.fam-form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.fam-manual-tx-form .fam-field,
.fam-task-create-form .fam-field {
  gap: 8px;
}

.fam-manual-tx-form .fam-field input:not(.fam-input-amount),
.fam-manual-tx-form .fam-field select,
.fam-task-create-form .fam-field input:not(.fam-input-hero),
.fam-task-create-form .fam-field select,
.fam-task-create-form .fam-field textarea {
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 15px;
}

.fam-task-create-form .fam-form-stack {
  margin-bottom: 0;
}

.fam-task-create-form .fam-assignee-pills {
  margin-top: 2px;
}

.fam-task-create-form .fam-field input[type="date"] {
  width: 100%;
}

.fam-field-optional .fam-field-label em {
  margin-left: auto;
}

.fam-dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid #eef2f8;
}

.fam-dialog-footer .fam-btn {
  min-width: 108px;
}

.fam-dialog::backdrop {
  background: rgba(15, 23, 42, 0.4);
}

.fam-dialog-body {
  padding: 24px;
}

.fam-dialog-body h3 {
  margin: 0 0 8px;
}

.fam-filter-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  padding: 0;
  background: transparent;
  border-radius: 0;
}

.fam-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 1 auto;
  min-height: 32px;
  padding: 0 14px;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  font-weight: 500;
  font-size: 13px;
  color: var(--muted);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.fam-tab .fam-ico {
  width: 16px;
  height: 16px;
}

.fam-tab.active {
  background: #4f8ff7;
  border-color: #4f8ff7;
  color: #fff;
  box-shadow: none;
}

.fam-tab.active .fam-ico {
  color: #fff;
}

#viewFinance.module-view {
  padding-top: 0;
}

#viewFinance .fam-wrap > .fam-header-minimal {
  padding-top: 16px;
}

#viewFinance .fam-finance-tabs {
  display: flex;
  gap: 0;
  margin: 0 -24px 16px;
  padding: 0 24px;
  background: transparent;
  border-radius: 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(8px);
  background: rgba(245, 247, 250, 0.95);
}

.fam-finance-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  justify-content: center;
  min-height: 36px;
  padding: 8px 10px;
  border: none;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  cursor: pointer;
  font-weight: 500;
  font-size: 13px;
  color: var(--muted);
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -1px;
}

.fam-finance-tab.active {
  background: transparent;
  color: #2f65b0;
  border-bottom-color: #4f8ff7;
  box-shadow: none;
}

.fam-merchant-form,
.fam-category-form {
  margin-bottom: 16px;
}

.fam-category-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fam-category-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e8edf4;
}

.fam-category-icon {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
  width: 32px;
  text-align: center;
}

.fam-category-main {
  flex: 1;
  min-width: 0;
}

.fam-category-main strong {
  font-size: 14px;
  word-break: break-word;
}

.fam-category-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.fam-merchant-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fam-merchant-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e8edf4;
}

.fam-merchant-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.fam-merchant-main strong {
  font-size: 14px;
  word-break: break-word;
}

.fam-merchant-cat {
  font-size: 12px;
  color: var(--muted);
}

.fam-merchant-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.fam-freedom-import-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 50vh;
  overflow: auto;
}

.fam-freedom-import-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e8edf4;
}

.fam-freedom-import-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  grid-column: 1;
}

.fam-freedom-import-main strong {
  flex: 1 1 100%;
  font-size: 14px;
}

.fam-freedom-import-amt {
  font-weight: 700;
  color: #b42318;
  white-space: nowrap;
}

.fam-freedom-import-cat {
  grid-column: 2;
  grid-row: 1 / span 2;
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}

.fam-freedom-import-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 4px 0;
}

.fam-freedom-import-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.fam-freedom-import-desc {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  word-break: break-word;
}

.fam-freedom-import-hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
}

.fam-freedom-import-footer {
  width: 100%;
}

.fam-freedom-import-skipped {
  opacity: 0.55;
}

.fam-freedom-import-skipped .fam-freedom-import-cat {
  color: var(--muted);
  font-style: italic;
}

.fam-freedom-import-duplicate .fam-freedom-import-cat {
  color: var(--warn, #b8860b);
}

/* ── Goals ─────────────────────────────────────────────── */
.goals-wrap {
  max-width: 1100px;
}

.goals-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.goals-page-intro {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.goals-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  padding: 56px 24px;
  background: linear-gradient(160deg, #f8f6ff 0%, #f0f7ff 50%, #fff 100%);
  border-radius: 20px;
  border: 1px dashed #d4ddf0;
}

.goals-empty .fam-ico-lg {
  color: #8b7cf7;
  opacity: 0.85;
}

.goals-empty h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
}

.goals-empty p {
  margin: 0;
  max-width: 360px;
  color: var(--muted);
  line-height: 1.5;
}

.goals-cards-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.goal-card {
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  background: #fff;
  overflow: hidden;
  cursor: pointer;
  border: none;
  box-shadow: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.goal-card:hover,
.goal-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
  outline: none;
}

.goal-card-cover {
  position: relative;
  height: 220px;
  background: linear-gradient(135deg, #5b21b6 0%, #2563eb 55%, #0891b2 100%);
  background-size: cover;
  background-position: center;
}

.goal-card-cover-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.08) 0%, rgba(0, 0, 0, 0.55) 100%);
  pointer-events: none;
}

.goal-card-cover-ring {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
}

.goal-card-cover-text {
  position: absolute;
  left: 20px;
  right: 96px;
  bottom: 18px;
  z-index: 2;
}

.goal-card-title {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.25;
  color: #fff;
  letter-spacing: -0.02em;
}

.goal-card-date {
  margin: 8px 0 0;
  font-size: 14px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
}

.goal-card-footer {
  padding: 16px 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.goal-card-stats {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: #64748b;
}

.goal-card-progress {
  height: 6px;
  border-radius: 999px;
  background: #eef2f7;
  overflow: hidden;
}

.goal-card-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #6c63ff, #3b82f6);
  transition: width 0.35s ease;
}

.goal-ring-card .goal-ring-label,
.goal-ring-light .goal-ring-label {
  color: #fff;
}

.goal-ring-light .goal-ring-track {
  stroke: rgba(255, 255, 255, 0.35);
}

.goal-ring-light .goal-ring-fill {
  stroke: #fff;
}

.goal-ring {
  position: relative;
  flex-shrink: 0;
}

.goal-ring svg {
  display: block;
  transform: rotate(-90deg);
}

.goal-ring-sm {
  width: 64px;
  height: 64px;
}

.goal-ring-card {
  width: 72px;
  height: 72px;
}

.goal-ring-lg {
  width: 96px;
  height: 96px;
}

.goal-ring-track {
  fill: none;
  stroke: #e8eef5;
  stroke-width: 4;
}

.goal-ring-fill {
  fill: none;
  stroke: #6c63ff;
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.4s ease;
}

.goal-ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #1a2332;
}

.goal-ring-lg .goal-ring-label {
  font-size: 18px;
}

.goal-ring-lg .goal-ring-track,
.goal-ring-lg .goal-ring-fill {
  stroke-width: 5;
}

.goal-ring-lg .goal-ring-track {
  stroke: rgba(255, 255, 255, 0.35);
}

.goal-ring-lg .goal-ring-fill {
  stroke: #fff;
}

.goal-ring-lg .goal-ring-label {
  color: #fff;
}

/* Detail page */
.goals-detail-page {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.goal-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  background: #fff;
  border: 1px solid #e8eef5;
  border-radius: 10px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.goal-back-btn:hover {
  color: #1a2332;
  border-color: #c5d4e8;
  background: #fafbfd;
}

.goal-hero {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 24px;
  min-height: 280px;
  padding: 32px 36px;
  border-radius: 22px;
  overflow: hidden;
  background: linear-gradient(135deg, #5b21b6 0%, #2563eb 50%, #0891b2 100%);
  background-size: cover;
  background-position: center;
}

.goal-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(15, 23, 42, 0.72) 0%,
    rgba(30, 27, 75, 0.55) 45%,
    rgba(15, 23, 42, 0.35) 100%
  );
  pointer-events: none;
}

.goal-hero-content,
.goal-hero-progress {
  position: relative;
  z-index: 1;
}

.goal-hero-content h1 {
  margin: 10px 0 8px;
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 800;
  line-height: 1.2;
  color: #fff;
  letter-spacing: -0.02em;
}

.goal-hero-badge {
  display: inline-flex;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  backdrop-filter: blur(6px);
}

.goal-hero-date {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.85);
}

.goal-hero-date .fam-ico {
  width: 15px;
  height: 15px;
  opacity: 0.9;
}

.goal-hero-desc {
  margin: 12px 0 0;
  max-width: 520px;
  font-size: 15px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.9);
}

.goal-hero-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding-bottom: 4px;
}

.goal-hero-progress-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
}

.goal-detail-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.goal-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.goal-panel {
  background: #fff;
  border: 1px solid #e8eef5;
  border-radius: 18px;
  padding: 20px 22px 22px;
  box-shadow: 0 2px 12px rgba(30, 50, 90, 0.04);
}

.goal-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.goal-panel-head h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 4px;
  font-size: 1.05rem;
  font-weight: 700;
}

.goal-panel-head h2 .fam-ico {
  width: 18px;
  height: 18px;
  color: #6c63ff;
}

.goal-panel-head p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.goal-panel-progress {
  height: 8px;
  margin-bottom: 16px;
  background: #eef2f8;
  border-radius: 999px;
  overflow: hidden;
}

.goal-panel-progress i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #6c63ff, #4f8ff7);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.goal-panel-progress-gold i {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.goal-steps-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.goal-step-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}

.goal-step-item:hover {
  background: #f3f6fb;
  border-color: #e8eef5;
}

.goal-step-item.is-done {
  opacity: 0.72;
}

.goal-step-item.is-done .goal-step-text strong {
  color: var(--muted);
}

.goal-step-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.goal-step-text strong {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
}

.goal-step-text span {
  font-size: 12px;
  color: var(--muted);
}

.goal-step-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.goal-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid #e8eef5;
  border-radius: 9px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.goal-icon-btn:hover {
  color: #1a2332;
  border-color: #c5d4e8;
  background: #fafbfd;
}

.goal-icon-btn-danger:hover {
  color: #dc2626;
  border-color: #fecaca;
  background: #fef2f2;
}

.goal-icon-btn .fam-ico {
  width: 16px;
  height: 16px;
}

.goal-steps-empty {
  padding: 20px 12px;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
  font-style: italic;
}

.goal-savings-amount {
  font-size: 1.15rem !important;
  font-weight: 700 !important;
  color: #1a2332 !important;
}

.goal-savings-amount span {
  font-weight: 500;
  color: var(--muted);
}

.goal-savings-pct {
  margin: 0 0 18px;
  font-size: 13px;
  color: var(--muted);
}

.goal-savings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.goal-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.fam-dialog-goal {
  max-width: 480px;
}

@media (max-width: 640px) {
  .goals-page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .goal-card-cover {
    height: 180px;
  }

  .goal-card-cover-text {
    left: 16px;
    right: 80px;
    bottom: 14px;
  }

  .goal-card-title {
    font-size: 1.25rem;
  }

  .goal-card-footer {
    padding: 14px 16px 16px;
  }

  .goal-hero {
    grid-template-columns: 1fr;
    padding: 24px 20px;
    min-height: 240px;
  }

  .goal-hero-progress {
    align-self: flex-start;
  }

  .goal-detail-grid {
    grid-template-columns: 1fr;
  }
}

.fam-task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.fam-meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  font-size: 11px;
  color: var(--muted);
  background: #f6f8fb;
  border-radius: 6px;
}

.fam-meta-chip .fam-ico {
  width: 12px;
  height: 12px;
  opacity: 0.75;
}

.fam-meta-chip-deadline {
  background: #fff8e6;
  color: #8a6d3b;
}

.fam-task-list .fam-task-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.fam-task-item.done strong,
.fam-task-row.is-done .fam-task-row-title {
  text-decoration: none;
  color: var(--muted);
}

.fam-task-item.warning,
.fam-task-item.overdue {
  background: transparent;
  margin: 0;
  padding-left: 0;
  border-radius: 0;
  border-left: none;
}

.fam-task-list .fam-check-compact .fam-check-input:checked + .fam-check-box {
  background: linear-gradient(135deg, #35b37e, #2a9d6a);
  border-color: #2a9d6a;
  box-shadow: 0 2px 8px rgba(42, 157, 106, 0.28);
}

.fam-task-body {
  flex: 1;
  min-width: 0;
}

.fam-task-body strong {
  display: block;
  font-size: 1rem;
}

.fam-task-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: auto;
}

.fam-task-people {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.fam-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 6px;
  border-radius: 999px;
  background: #f8fafc;
  border: 1px solid #e8eef5;
  max-width: 100%;
}

.fam-user-chip-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.fam-user-chip-icon svg {
  width: 15px;
  height: 15px;
}

.fam-user-chip-assignee .fam-user-chip-icon {
  color: #3d7ae0;
}

.fam-user-chip-creator .fam-user-chip-icon {
  color: #b06b94;
}

.fam-user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: -0.02em;
}

.fam-user-avatar.owner {
  background: linear-gradient(135deg, #4f8ff7, #3d7ae0);
  color: #fff;
  box-shadow: 0 2px 6px rgba(61, 122, 224, 0.28);
}

.fam-user-avatar.partner {
  background: linear-gradient(135deg, #e891b8, #d4739f);
  color: #fff;
  box-shadow: 0 2px 6px rgba(212, 115, 159, 0.28);
}

.fam-user-chip-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.2;
  min-width: 0;
}

.fam-user-chip-kind {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.fam-user-chip-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.fam-card-projects {
  margin-bottom: 4px;
}

.fam-card-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.fam-card-head-row .fam-section-head {
  flex: 1;
  min-width: 200px;
}

.fam-savings-overview {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.fam-savings-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.fam-savings-metric {
  padding: 8px 0;
  border: none;
  border-radius: 0;
  background: transparent;
}

.fam-savings-metric-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.fam-savings-metric-value {
  display: block;
  margin-top: 6px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.fam-savings-overall-progress {
  border-top: 1px solid #eef2f8;
  padding-top: 12px;
}

.fam-savings-overall-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--muted);
}

.fam-savings-overall-head strong {
  font-size: 14px;
  color: var(--text);
}

.fam-savings-card .fam-card-head-row {
  margin-bottom: 18px;
}

.fam-savings-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fam-savings-item {
  display: block;
  padding: 14px 16px;
  border: 1px solid #e8eef5;
  border-radius: 14px;
  background: #fff;
}

.fam-savings-wrap-detail .fam-savings-detail {
  margin-top: 2px;
}

.fam-savings-item-clickable {
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.fam-savings-item-clickable:hover,
.fam-savings-item-clickable:focus-visible {
  border-color: #c7d8ef;
  background: #fbfdff;
  box-shadow: 0 6px 22px rgba(47, 101, 176, 0.08);
  transform: translateY(-1px);
  outline: none;
}

.fam-savings-item-main {
  min-width: 0;
}

.fam-savings-item-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.fam-savings-item-title-row strong {
  font-size: 15px;
  line-height: 1.35;
}

.fam-savings-pill {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  color: #2f65b0;
  background: #e8f0ff;
  border-radius: 999px;
}

.fam-savings-item-amount {
  margin-top: 4px;
  margin-bottom: 8px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.fam-savings-item-amount span {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.fam-savings-item-meta {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.fam-savings-actions {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  justify-content: flex-end;
  gap: 8px;
  max-width: 300px;
}

.fam-savings-actions .fam-btn {
  min-width: 112px;
  justify-content: center;
}

.fam-savings-detail {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.fam-savings-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid #e8eef5;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.fam-savings-back:hover {
  color: var(--text);
  border-color: #c7d8ef;
  background: #fbfdff;
}

.fam-savings-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.fam-savings-detail-head h3 {
  margin: 0;
  font-size: 1.1rem;
}

.fam-savings-detail-head p {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}

.fam-savings-actions-detail {
  justify-content: flex-start;
  max-width: none;
}

.fam-savings-history {
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid #eef2f8;
}

.fam-savings-history h4 {
  margin: 0 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
}

.fam-savings-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fam-savings-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #e8eef5;
  background: #fff;
}

.fam-savings-history-item.plus {
  border-left: 3px solid #22c55e;
}

.fam-savings-history-item.minus {
  border-left: 3px solid #f59e0b;
}

.fam-savings-history-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.fam-savings-history-main strong {
  font-size: 14px;
}

.fam-savings-history-main span {
  font-size: 12px;
  color: var(--muted);
}

.fam-projects-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.fam-project-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: transparent;
  border-radius: 12px;
  border: none;
  min-width: 160px;
  max-width: 240px;
  flex: 1 1 160px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
  box-shadow: none;
}

.fam-project-card:hover {
  background: rgba(0, 0, 0, 0.03);
}

.fam-project-card.active {
  background: rgba(79, 143, 247, 0.08);
  box-shadow: none;
}

.fam-project-card-add {
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  min-height: 88px;
  border-style: dashed;
  background: #f8fafc;
  color: var(--muted);
}

.fam-project-card-add .fam-ico-lg {
  color: #94a3b8;
}

.fam-project-card-add:hover {
  color: var(--fam-accent);
  border-color: #4f8ff7;
}

.fam-project-card-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.fam-project-card-text strong {
  font-size: 15px;
  line-height: 1.3;
}

.fam-project-ring-wrap {
  position: relative;
  width: 56px;
  height: 56px;
  flex-shrink: 0;
}

.fam-project-ring-svg {
  width: 56px;
  height: 56px;
  transform: rotate(-90deg);
}

.fam-project-ring-track {
  fill: none;
  stroke: #e8eef5;
  stroke-width: 3;
}

.fam-project-ring-fill {
  fill: none;
  stroke: #4f8ff7;
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.35s ease;
}

.fam-project-ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #4a5568;
}

.fam-task-dates-wrap.fam-task-dates-locked .fam-field input[type="date"] {
  background: #f1f5f9;
  color: #64748b;
  border-color: #e2e8f0;
  cursor: not-allowed;
  opacity: 0.92;
}

.fam-task-dates-wrap.fam-task-dates-locked .fam-field-label {
  color: #94a3b8;
}

.fam-task-dates-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -4px 0 12px;
  padding: 8px 12px;
  font-size: 13px;
  color: #64748b;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px dashed #e2e8f0;
}

.fam-task-dates-hint.hidden {
  display: none;
}

.fam-recurrence-block {
  margin: 4px 0 16px;
  padding: 16px 18px;
  background: linear-gradient(180deg, #f9fafb 0%, #f3f6fa 100%);
  border: 1px solid #dde5ef;
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.fam-recurrence-toggle {
  margin: 0;
}

.fam-recurrence-toggle-text {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
}

.fam-recurrence-panel {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.fam-recurrence-panel.hidden {
  display: none;
}

.fam-recurrence-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.fam-recurrence-static-label {
  font-size: 14px;
  color: #4a5568;
  min-width: 108px;
}

.fam-recurrence-select,
.fam-recurrence-interval-input,
.fam-recurrence-weekday-select {
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font-size: 14px;
  background: #fff;
  color: #1a202c;
}

.fam-recurrence-select {
  min-width: 160px;
  flex: 1;
  max-width: 240px;
}

.fam-recurrence-interval-input {
  width: 64px;
  text-align: center;
}

.fam-recurrence-unit-label {
  font-size: 14px;
  color: #4a5568;
}

.fam-recurrence-weekdays {
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid #e2e8f0;
  border-radius: 12px;
}

.fam-recurrence-weekdays.hidden {
  display: none;
}

.fam-recurrence-schedule {
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid #e2e8f0;
  border-radius: 12px;
}

.fam-recurrence-schedule.hidden {
  display: none;
}

.fam-recurrence-date-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
}

.fam-recurrence-date-label {
  flex-shrink: 0;
  width: 96px;
  font-size: 14px;
  font-weight: 500;
  color: #4a5568;
}

.fam-recurrence-date-pick {
  display: inline-flex;
  align-items: center;
  gap: 0;
  flex: 1;
  min-width: 0;
  max-width: 280px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.fam-recurrence-date-pick:focus-within {
  border-color: #94b4d8;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.fam-recurrence-date-num,
.fam-recurrence-date-month {
  border: none;
  background: transparent;
  font-size: 14px;
  font-family: inherit;
  color: #1a202c;
  outline: none;
  min-height: 38px;
}

.fam-recurrence-date-num {
  width: 56px;
  padding: 0 8px;
  text-align: center;
  font-weight: 600;
  -moz-appearance: textfield;
}

.fam-recurrence-date-num::-webkit-outer-spin-button,
.fam-recurrence-date-num::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

select.fam-recurrence-date-num {
  width: 72px;
  padding: 0 28px 0 12px;
  text-align: left;
  font-weight: 500;
  cursor: pointer;
  border-right: 1px solid #e8eef5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23718096' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  appearance: none;
}

.fam-recurrence-date-pick-yearly .fam-recurrence-date-num {
  border-right: 1px solid #e8eef5;
}

.fam-recurrence-date-month {
  flex: 1;
  min-width: 0;
  padding: 0 32px 0 12px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23718096' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  appearance: none;
}

.fam-recurrence-date-suffix {
  padding: 0 14px 0 4px;
  font-size: 14px;
  color: #718096;
  white-space: nowrap;
  background: #f8fafc;
  border-left: 1px solid #e8eef5;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
}

.fam-recurrence-weekdays-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fam-recurrence-weekday-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fam-recurrence-weekday-prefix {
  width: 20px;
  font-size: 14px;
  color: #718096;
  text-align: right;
}

.fam-recurrence-weekday-select {
  flex: 1;
  min-width: 0;
}

.fam-recurrence-weekday-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.fam-recurrence-weekday-btn {
  width: 30px;
  height: 30px;
  border: 1px solid #cbd5e1;
  border-radius: 50%;
  background: #fff;
  color: #4a5568;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}

.fam-recurrence-weekday-btn:hover {
  background: #edf2f7;
  border-color: #a0aec0;
}

.fam-recurrence-preview {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: #fff;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
}

.fam-recurrence-preview-dates {
  flex: 1;
  font-size: 13px;
  line-height: 1.5;
  color: #2d3748;
  word-break: break-word;
}

.fam-recurrence-ends {
  margin: 0;
  padding: 0;
  border: none;
  min-width: 0;
}

.fam-recurrence-ends legend {
  display: block;
  width: 100%;
  font-size: 14px;
  font-weight: 600;
  color: #4a5568;
  margin: 0 0 10px;
  padding: 0;
}

.fam-recurrence-ends-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
}

.fam-recurrence-end-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.fam-recurrence-end-row:hover {
  background: rgba(255, 255, 255, 0.9);
}

.fam-recurrence-end-row:has(input[type="radio"]:checked) {
  background: #fff;
  border-color: #dbe4ef;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.fam-recurrence-end-row input[type="radio"] {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--fam-accent);
}

.fam-recurrence-end-body {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  flex: 1;
  min-width: 0;
  font-size: 14px;
  line-height: 1.3;
}

.fam-recurrence-end-text {
  color: #2d3748;
  white-space: nowrap;
}

.fam-recurrence-end-suffix {
  color: #4a5568;
  white-space: nowrap;
}

.fam-recurrence-end-date,
.fam-recurrence-end-count {
  padding: 7px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: #1a202c;
  min-height: 36px;
}

.fam-recurrence-end-date {
  flex: 1;
  min-width: 0;
  max-width: 180px;
}

.fam-recurrence-end-count {
  width: 72px;
  text-align: center;
}

.fam-recurrence-end-date:disabled,
.fam-recurrence-end-count:disabled {
  opacity: 0.38;
  background: #f7fafc;
  cursor: not-allowed;
}

.fam-recurrence-end-row:not(:has(input[type="radio"]:checked)) .fam-recurrence-end-date,
.fam-recurrence-end-row:not(:has(input[type="radio"]:checked)) .fam-recurrence-end-count {
  opacity: 0.38;
  background: #f7fafc;
}

.fam-meta-chip-project {
  background: #eef4ff;
  color: #2f65b0;
}

.fam-meta-chip-repeat {
  background: #f3efff;
  color: #5b4d8a;
}

.fam-dialog-project-detail {
  max-width: 560px;
  width: calc(100% - 24px);
}

.fam-project-detail-body {
  padding: 24px 24px 20px;
  max-height: min(85vh, 720px);
  display: flex;
  flex-direction: column;
}

.fam-project-detail-head {
  flex-shrink: 0;
  margin-bottom: 16px;
}

.fam-project-detail-top {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.fam-project-detail-info {
  flex: 1;
  min-width: 0;
}

.fam-project-detail-info h3 {
  margin: 0 0 6px;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
}

.fam-project-detail-date {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.fam-project-task-list {
  flex: 1;
  min-height: 120px;
  max-height: min(50vh, 400px);
  overflow-y: auto;
  margin: 0;
  padding-right: 4px;
}

.fam-project-detail-footer {
  flex-shrink: 0;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #eef2f8;
}

.fam-project-card {
  cursor: pointer;
}

.fam-task-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}

.fam-card-tasks {
  padding-top: 16px;
}

.fam-empty-inline {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 8px 0;
}

.fam-empty-inline .fam-ico-lg {
  color: #c5d0e0;
}

@media (max-width: 720px) {
  .fam-header {
    gap: 12px;
  }

  .fam-month-picker {
    width: 100%;
    margin-left: 0;
    order: 3;
  }

  .fam-task-stats {
    width: 100%;
    margin-left: 0;
  }

  .fam-obl-item {
    grid-template-columns: 1fr auto;
    gap: 8px;
  }

  .fam-obl-date {
    grid-column: 1;
  }

  .fam-obl-body {
    grid-column: 1 / -1;
  }

  .fam-obl-amount {
    grid-column: 2;
    grid-row: 1;
    text-align: right;
  }

  .fam-status {
    grid-column: 1;
  }

  .fam-obl-actions {
    grid-column: 2;
    grid-row: 2 / 4;
    flex-direction: column;
  }

  .fam-tab span {
    display: none;
  }

  .fam-tab {
    padding: 10px;
  }

  .fam-obl-actions {
    flex-direction: row;
  }
  .fam-form-grid,
  .fam-form-grid-tasks {
    grid-template-columns: 1fr;
  }

  .fam-create-task-dates {
    grid-template-columns: 1fr;
  }

  .fam-form-row-2 {
    grid-template-columns: 1fr;
  }

  .fam-category-limit-edit-item {
    grid-template-columns: 1fr;
  }

  .fam-manual-tx-form,
  .fam-upload-pdf-form,
  .fam-task-create-form {
    padding: 22px 20px 20px;
  }

  .fam-file-drop-inner {
    padding: 24px 16px;
  }

  .fam-dialog-footer {
    flex-direction: column-reverse;
  }

  .fam-dialog-footer .fam-btn {
    width: 100%;
    min-width: 0;
  }
  .fam-field-span2 {
    grid-column: span 1;
  }
  .fam-header {
    flex-direction: column;
  }
  .fam-month-picker,
  .fam-task-stats {
    margin-left: 0;
  }
}

#globalScoreText {
  color: #7f5969;
}

#intermediateScoreText {
  color: #4f7b63;
}

.bottom-deadline {
  position: static;
  color: var(--muted);
  font-size: clamp(11px, 0.88vw, 13px);
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  justify-self: center;
}

.bottom-trend {
  position: absolute;
  left: 50%;
  top: calc(50% + clamp(98px, 10.2vw, 138px));
  transform: translate(-50%, 0);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: clamp(13px, 1.02vw, 15px);
  font-weight: 800;
  letter-spacing: 0.01em;
  border-radius: 16px;
  padding: 10px 16px;
  border: none;
  background:
    linear-gradient(160deg, rgba(248, 251, 255, 0.98), rgba(238, 246, 255, 0.95)),
    radial-gradient(circle at 14% 14%, rgba(255, 255, 255, 0.9), transparent 55%);
  backdrop-filter: blur(8px);
  box-shadow:
    0 16px 30px rgba(45, 61, 86, 0.2),
    0 0 20px rgba(125, 156, 214, 0.2),
    0 1px 0 rgba(255, 255, 255, 0.9) inset;
  z-index: 5;
  white-space: nowrap;
  color: #5a667b;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.bottom-trend:hover {
  transform: translate(-50%, -1px);
  box-shadow:
    0 18px 30px rgba(45, 61, 86, 0.2),
    0 1px 0 rgba(255, 255, 255, 0.9) inset;
}

.trend-emoji {
  font-size: clamp(22px, 1.8vw, 30px);
  line-height: 1;
  filter: drop-shadow(0 3px 5px rgba(20, 24, 35, 0.2));
}

.bottom-trend.trend-up {
  color: #1f9667;
  background:
    linear-gradient(160deg, rgba(238, 255, 246, 0.98), rgba(222, 252, 236, 0.95)),
    radial-gradient(circle at 14% 14%, rgba(255, 255, 255, 0.9), transparent 55%);
  box-shadow:
    0 16px 30px rgba(31, 150, 103, 0.24),
    0 0 22px rgba(84, 203, 151, 0.3);
}

.bottom-trend.trend-flat {
  color: #b08519;
  background:
    linear-gradient(160deg, rgba(255, 251, 235, 0.98), rgba(255, 242, 194, 0.95)),
    radial-gradient(circle at 14% 14%, rgba(255, 255, 255, 0.9), transparent 55%);
  box-shadow:
    0 16px 30px rgba(176, 133, 25, 0.22),
    0 0 22px rgba(242, 197, 83, 0.28);
}

.bottom-trend.trend-down {
  color: #c55763;
  background:
    linear-gradient(160deg, rgba(255, 245, 247, 0.98), rgba(255, 227, 232, 0.95)),
    radial-gradient(circle at 14% 14%, rgba(255, 255, 255, 0.9), transparent 55%);
  box-shadow:
    0 16px 30px rgba(197, 87, 99, 0.24),
    0 0 22px rgba(235, 133, 144, 0.3);
}

.login-streak-badge {
  position: relative;
  justify-self: start;
  border: none;
  border-radius: 16px;
  padding: 10px 14px;
  cursor: pointer;
  color: #fff;
  font-weight: 700;
  font-size: clamp(13px, 1vw, 15px);
  background: linear-gradient(135deg, #ef7a42, #d94f70);
  box-shadow: 0 14px 26px rgba(217, 79, 112, 0.3);
  z-index: 6;
}

.reward-tracker-badge {
  position: relative;
  justify-self: end;
  width: fit-content;
  max-width: 100%;
  border: 1px solid rgba(160, 176, 206, 0.35);
  cursor: pointer;
  border-radius: 16px;
  padding: 12px 14px;
  color: #3f485e;
  font-weight: 700;
  font-size: clamp(12px, 0.95vw, 14px);
  background:
    linear-gradient(160deg, rgba(250, 246, 255, 0.96), rgba(238, 248, 255, 0.93)),
    radial-gradient(circle at 12% 12%, rgba(255, 255, 255, 0.85), transparent 60%);
  box-shadow: 0 14px 26px rgba(52, 72, 109, 0.2);
  z-index: 6;
  display: inline-grid;
  gap: 6px;
  text-align: left;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.reward-tracker-badge:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 28px rgba(52, 72, 109, 0.24);
}

#rewardProgressText {
  color: #4256a8;
}

#rewardStreakText {
  color: #2d7d62;
}

.mindmap-zone {
  position: relative;
  width: 100%;
  height: 100%;
}

.avatar-wrap {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.avatar-ring {
  width: clamp(190px, 20vw, 290px);
  height: clamp(190px, 20vw, 290px);
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  padding: clamp(9px, 1vw, 12px);
  box-shadow:
    0 24px 48px rgba(15, 23, 42, 0.16),
    0 0 0 8px rgba(255, 255, 255, 0.45);
  overflow: hidden;
}

.center-avatar {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  display: block;
  border-radius: 50%;
  border: 4px solid #fff;
  object-fit: cover;
  object-position: center;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
}

.spheres-layer {
  position: absolute;
  inset: 0;
}

.sphere-node {
  position: absolute;
  transform: translate(-50%, -50%);
  width: clamp(228px, 22.8vw, 334px);
}

.sphere-line {
  position: absolute;
  top: 50%;
  height: 2px;
  background: var(--line);
  width: clamp(70px, 8vw, 125px);
}

.sphere-line.left {
  left: 100%;
}

.sphere-line.right {
  right: 100%;
}

.sphere-circle {
  border-radius: 22px;
  border: 1px solid var(--border);
  background: #ffffff;
  padding: clamp(6px, 0.65vw, 9px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  box-shadow:
    0 10px 20px rgba(15, 23, 42, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
  max-height: none;
  overflow: visible;
}

.sphere-progress-ring {
  border-radius: 24px;
  padding: 3px;
  box-shadow:
    0 12px 24px rgba(15, 23, 42, 0.12),
    0 0 10px rgba(79, 143, 247, 0.2);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.sphere-node:hover .sphere-progress-ring {
  transform: translateY(-2px) scale(1.015);
  box-shadow:
    0 18px 34px rgba(66, 74, 88, 0.25),
    0 0 16px rgba(143, 122, 230, 0.28);
}

.sphere-circle strong {
  font-size: clamp(12px, 1vw, 15px);
}

.sphere-title-btn {
  border: none;
  background: transparent;
  color: var(--text);
  font-weight: 700;
  font-size: clamp(12px, 1vw, 15px);
  cursor: pointer;
  padding: 0;
}

.sphere-title-btn:hover {
  color: var(--accent-blue);
  text-decoration: underline;
}

.sphere-header-inline {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.sphere-score-inline {
  color: var(--sphere-color);
  font-weight: 700;
  font-size: clamp(12px, 1vw, 14px);
  white-space: nowrap;
}

.sphere-circle span {
  color: var(--sphere-color);
  font-weight: 700;
}

.sphere-metrics {
  margin: 0;
  padding-left: 16px;
  width: 100%;
  text-align: left;
  color: #5e5550;
  font-size: clamp(10px, 0.82vw, 12px);
  line-height: 1.2;
  overflow: visible;
}

.sphere-metrics li {
  margin-bottom: 4px;
  list-style: none;
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: start;
  gap: 6px;
}

.sphere-metrics li b,
.sphere-metrics li small {
  display: block;
}

.metric-emoji {
  line-height: 1.2;
  font-size: 13px;
}

.sphere-metrics li b {
  font-weight: 600;
}

.sphere-metrics li small {
  color: #7b716b;
  font-size: 0.92em;
}

.dashboard-footer {
  position: fixed;
  left: 50%;
  bottom: clamp(6px, 1vh, 12px);
  transform: translateX(-50%);
  width: min(1200px, 96vw);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 8px 12px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.1);
  z-index: 5;
}

.floating-actions {
  display: flex;
  gap: 8px;
}

.left-actions {
  justify-self: start;
}

.right-actions {
  justify-self: end;
}

.action-btn,
.mini-btn,
.close-btn {
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: 0.2s ease;
}

.action-btn {
  padding: 11px 15px;
  background: linear-gradient(135deg, var(--accent-violet), var(--accent-blue));
  color: #fff;
  font-weight: 600;
  box-shadow: 0 10px 20px rgba(79, 143, 247, 0.32);
}

.action-btn.secondary {
  background: linear-gradient(135deg, var(--accent-green), #8ecdb0);
  box-shadow: 0 10px 20px rgba(53, 179, 126, 0.28);
}

.action-btn:hover,
.mini-btn:hover,
.close-btn:hover {
  filter: brightness(1.08) saturate(1.08);
  transform: translateY(-1px);
}

.pin-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 15% 20%, rgba(140, 87, 117, 0.28), transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(84, 133, 111, 0.24), transparent 40%),
    rgba(20, 18, 22, 0.62);
}

html.pin-locked .pin-gate {
  display: grid;
}

html.pin-locked body > :not(#pinGate) {
  visibility: hidden;
  pointer-events: none;
}

.pin-gate-card {
  width: min(360px, 92vw);
  padding: 28px 24px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
  box-shadow:
    0 20px 48px rgba(15, 23, 42, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  display: grid;
  gap: 12px;
}

.pin-gate-card h2 {
  margin: 0;
  font-size: 1.35rem;
}

.pin-gate-hint {
  margin: 0;
  color: var(--muted, #6b7280);
  font-size: 0.92rem;
}

.pin-gate-label {
  font-size: 0.9rem;
  font-weight: 600;
}

.pin-gate-input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 1.1rem;
  letter-spacing: 0.2em;
  text-align: center;
}

.pin-gate-submit {
  width: 100%;
  justify-self: stretch;
  padding: 12px;
}

.pin-gate-error {
  margin: 0;
  color: #b42318;
  font-size: 0.9rem;
  text-align: center;
}

.pin-gate-lock {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(180, 35, 24, 0.08);
  color: #9f1239;
  font-size: 0.9rem;
  text-align: center;
  line-height: 1.4;
}

.pin-gate-input:disabled,
.pin-gate-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.modal {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 15% 20%, rgba(140, 87, 117, 0.28), transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(84, 133, 111, 0.24), transparent 40%),
    rgba(20, 18, 22, 0.5);
  display: grid;
  place-items: center;
  z-index: 20;
}

.hidden {
  display: none;
}

.modal-card {
  width: min(1100px, 92vw);
  max-height: 90vh;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  box-shadow: none;
  backdrop-filter: none;
}

.rollover-card {
  width: min(980px, 92vw);
}

.principles-card {
  width: min(900px, 92vw);
}

.principles-list {
  margin: 0;
  padding-left: 24px;
  display: grid;
  gap: 10px;
  color: #413742;
  font-size: clamp(14px, 1.05vw, 16px);
  line-height: 1.45;
}

.principles-list li {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(167, 184, 205, 0.3);
  background: linear-gradient(160deg, rgba(251, 248, 255, 0.95), rgba(244, 250, 255, 0.92));
  box-shadow:
    0 8px 18px rgba(43, 52, 72, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.principles-list strong {
  color: #2d3f70;
}

.rollover-intro {
  margin-bottom: 12px;
  color: var(--text);
}

.rollover-intro p {
  margin: 0 0 6px;
}

.rollover-plan-list {
  display: grid;
  gap: 10px;
  max-height: 58vh;
  overflow: auto;
  margin-bottom: 12px;
}

.rollover-item {
  border: 1px solid rgba(167, 184, 205, 0.32);
  border-radius: 12px;
  padding: 10px;
  background: linear-gradient(165deg, rgba(255, 253, 249, 0.96), rgba(246, 241, 233, 0.9));
}

.rollover-item-title {
  font-weight: 700;
  margin-bottom: 4px;
}

.rollover-item-meta {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.sphere-history-card {
  width: min(1080px, 94vw);
}

.sphere-history-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.sphere-history-toolbar label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.sphere-history-toolbar select {
  min-width: 260px;
}

.sphere-history-modes {
  display: flex;
  gap: 8px;
}

.mini-btn.active {
  box-shadow: 0 0 0 2px rgba(79, 143, 247, 0.25);
}

.sphere-history-chart-wrap {
  margin-top: 12px;
  border: 1px solid rgba(167, 184, 205, 0.38);
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(247, 251, 255, 0.92), rgba(240, 247, 255, 0.88));
  padding: 10px;
}

.history-chart-svg {
  width: 100%;
  height: 280px;
  display: block;
}

.history-chart-axis {
  font-size: 11px;
  fill: #6a7488;
}

.sphere-history-meta {
  margin-top: 8px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}

.sphere-history-list {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}

.sphere-history-list h3 {
  margin: 0;
  font-size: 15px;
}

.history-row {
  border: 1px solid rgba(167, 184, 205, 0.32);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.8);
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text);
}

.history-empty {
  color: var(--muted);
  font-size: 14px;
  padding: 10px 4px;
}

.login-history-list {
  display: grid;
  gap: 8px;
}

.reward-timeline {
  position: relative;
  display: grid;
  gap: 10px;
  padding-left: 8px;
}

.reward-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.reward-filter-btn {
  padding: 6px 10px;
  font-size: 12px;
}

.reward-input-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.reward-input-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.reward-editor-item {
  border: 1px solid rgba(167, 184, 205, 0.34);
  border-radius: 12px;
  padding: 11px 12px;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.95), rgba(246, 250, 255, 0.9));
  display: grid;
  gap: 8px;
}

.reward-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.reward-editor-index {
  font-size: 13px;
  color: #5e6983;
  font-weight: 700;
}

.reward-editor-current {
  border: 1px solid rgba(130, 157, 206, 0.3);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  color: #344463;
  background: rgba(240, 247, 255, 0.78);
  min-height: 36px;
  display: flex;
  align-items: center;
}

.reward-settings-panel {
  grid-column: 1 / -1;
  padding: 14px;
}

.reward-settings-head p:last-child {
  color: #5f6d87;
}

.reward-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 12px;
}

.reward-stat {
  border: 1px solid rgba(162, 178, 206, 0.34);
  border-radius: 10px;
  background: linear-gradient(160deg, rgba(244, 248, 255, 0.95), rgba(252, 254, 255, 0.9));
  padding: 9px 10px;
  font-size: 13px;
  color: #425171;
}

.reward-group-head {
  margin: 6px 0 8px;
}

.reward-group-head p {
  margin: 0;
}

.reward-warning p {
  margin: 0 0 8px;
}

.reward-reset-note {
  margin-top: 8px;
  border: 1px solid rgba(218, 156, 69, 0.4);
  border-radius: 10px;
  background: linear-gradient(150deg, rgba(255, 246, 225, 0.95), rgba(255, 239, 209, 0.9));
  color: #7b4e0b;
}

.reward-actions {
  justify-content: flex-end;
  padding-top: 6px;
}

.reward-clear-btn {
  padding: 5px 8px;
  font-size: 11px;
}

.custom-alert-toast {
  position: fixed;
  right: 22px;
  top: 18px;
  max-width: min(460px, 86vw);
  padding: 12px 14px;
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(255, 242, 214, 0.98), rgba(255, 230, 189, 0.96));
  border: 1px solid rgba(214, 152, 55, 0.42);
  color: #6b4a08;
  font-weight: 700;
  font-size: 13px;
  box-shadow: 0 14px 28px rgba(120, 84, 19, 0.22);
  z-index: 50;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.custom-alert-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.custom-alert-toast--in-dialog {
  position: absolute;
  top: 12px;
  right: 12px;
  left: auto;
  z-index: 1;
}

.reward-timeline::before {
  content: "";
  position: absolute;
  left: 15px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: linear-gradient(180deg, rgba(94, 132, 214, 0.5), rgba(112, 182, 151, 0.4));
}

.reward-timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 10px;
  align-items: start;
}

.reward-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
  border: 1px solid rgba(150, 171, 208, 0.6);
  box-shadow: 0 6px 12px rgba(39, 57, 92, 0.16);
  z-index: 1;
}

.reward-card {
  border-radius: 12px;
  border: 1px solid rgba(167, 184, 205, 0.34);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.94), rgba(246, 250, 255, 0.9));
  padding: 9px 11px;
}

.reward-card-head {
  font-size: 12px;
  color: #65708a;
  margin-bottom: 4px;
}

.reward-card-text {
  font-size: 13px;
  color: #344158;
  font-weight: 600;
}

.reward-timeline-item.tone-bonus .reward-card {
  background: linear-gradient(160deg, rgba(235, 255, 245, 0.95), rgba(226, 250, 237, 0.9));
}

.reward-timeline-item.tone-comeback .reward-card {
  background: linear-gradient(160deg, rgba(255, 248, 231, 0.95), rgba(255, 241, 213, 0.9));
}

.reward-timeline-item.tone-result .reward-card {
  background: linear-gradient(160deg, rgba(243, 247, 255, 0.95), rgba(233, 241, 255, 0.9));
}

.reward-timeline-item.tone-reset .reward-card {
  background: linear-gradient(160deg, rgba(255, 243, 235, 0.95), rgba(255, 233, 219, 0.9));
}

.modal-header {
  padding: 14px 20px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
}

.modal-header h2 {
  margin: 0;
}

.modal-content {
  padding: 16px 20px;
  overflow: auto;
}

.modal-tools {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.segmented-btn:focus-visible,
.icon-delete-btn:focus-visible,
.toggle-input:focus-visible + .toggle-switch {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px rgba(79, 143, 247, 0.35);
}

select {
  width: 100%;
}

.stack-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.sphere-box,
.item-card {
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 12px;
  background: #ffffff;
  box-shadow: none;
  transform: none;
}

.sphere-header {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.sphere-title {
  font-weight: 700;
  flex: 1;
  min-width: 180px;
}

.sphere-weight-field {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.sphere-weight {
  width: 76px;
}

.metrics-list {
  margin-top: 10px;
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
}

.item-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.metric-row {
  display: grid;
  gap: 8px;
}

.metric-row-name-unit {
  grid-template-columns: minmax(0, 1.2fr) minmax(90px, 0.5fr) minmax(110px, 0.7fr) minmax(120px, 0.8fr);
}

.metric-row-targets {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric-row-flags {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.check-row {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 8px;
  margin-bottom: 0 !important;
  color: var(--muted);
  font-size: 13px;
}

.check-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mini-btn {
  padding: 7px 10px;
  background: linear-gradient(135deg, var(--accent-violet), var(--accent-blue));
  color: #fff;
  box-shadow: 0 8px 16px rgba(79, 143, 247, 0.28);
}

.mini-btn.warn {
  background: linear-gradient(135deg, #bd6f92, var(--accent-pink));
}

.mini-btn.secondary {
  background: linear-gradient(135deg, var(--accent-green), #8ecdb0);
}

.close-btn {
  width: 30px;
  height: 30px;
  font-size: 19px;
  background: rgba(125, 99, 112, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.split {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  margin: 6px 0;
  font-size: 14px;
}

/* ——— Редактировать / Прогресс (автосейв UX) ——— */

.edit-summary,
.progress-sphere-header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
}

.cloud-sync-icon {
  font-size: 22px;
  line-height: 1;
  color: var(--accent-green);
  flex-shrink: 0;
}

.edit-summary-title,
.progress-sphere-header-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
}

.edit-summary-hint,
.progress-sphere-header-sub {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--muted);
}

.edit-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.sphere-edit-head .sphere-title {
  flex: 1;
  font-size: 17px;
  font-weight: 700;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px 10px;
  min-width: 0;
}

.sphere-weight-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.sphere-weight-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sphere-weight-label {
  font-size: 14px;
  font-weight: 600;
}

.sphere-weight-hint {
  font-size: 11px;
  color: var(--muted);
}

.edit-sphere-card .sphere-weight {
  width: 88px;
  flex-shrink: 0;
  text-align: center;
}

.edit-divider {
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 10px 0;
}

.metrics-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.metrics-section-title {
  font-size: 14px;
  font-weight: 700;
}

.count-badge {
  display: inline-block;
  min-width: 20px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #eef2f7;
  font-size: 12px;
  font-weight: 600;
  color: #4b5563;
  text-align: center;
}

.metrics-empty {
  padding: 14px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  border: 1px dashed #e5e7eb;
  border-radius: 10px;
}

.mini-btn.soft-green {
  background: rgba(53, 179, 126, 0.14);
  color: #1d6b4a;
  box-shadow: none;
  border: 1px solid rgba(53, 179, 126, 0.35);
}

.icon-delete-btn {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: rgba(220, 68, 68, 0.12);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: grid;
  place-items: center;
  padding: 0;
}

.autosave-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.autosave-status[data-state="saving"],
.autosave-status[data-state="saved"],
.autosave-status[data-state="failed"] {
  opacity: 1;
}

.autosave-status[data-state="saving"] {
  color: var(--muted);
}

.autosave-status[data-state="saved"] {
  color: var(--accent-green);
}

.autosave-status[data-state="failed"] {
  color: #b42318;
}

.autosave-spinner {
  width: 12px;
  height: 12px;
  border: 2px solid #d1d5db;
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: autosaveSpin 0.7s linear infinite;
}

@keyframes autosaveSpin {
  to {
    transform: rotate(360deg);
  }
}

.metric-edit-card .edit-card-head {
  margin-bottom: 8px;
}

.metric-emoji-input {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  text-align: center;
  font-size: 18px;
  padding: 4px;
}

.metric-name-input {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  font-weight: 600;
}

.metric-type-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 10px;
}

.metric-unit-field {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.segmented {
  display: inline-flex;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  background: #f9fafb;
}

.segmented-btn {
  border: none;
  background: transparent;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.segmented-btn.active {
  background: #fff;
  color: var(--text);
  box-shadow: inset 0 0 0 1px #e5e7eb;
}

.goals-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 6px;
}

.goals-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.goals-grid label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.goals-block.is-disabled,
.goals-block.is-disabled input {
  opacity: 0.45;
  pointer-events: none;
}

.edit-metric-card.is-boolean .metric-unit-field input,
.edit-metric-card.is-boolean .goals-block input,
.edit-metric-card.is-boolean [data-field="includeGlobal"] {
  opacity: 0.45;
}

.toggle-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  margin: 0 !important;
  flex-direction: row !important;
}

.toggle-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.toggle-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.toggle-hint {
  font-size: 11px;
  color: var(--muted);
}

.toggle-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-switch {
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: #e5e7eb;
  flex-shrink: 0;
  position: relative;
  transition: background 0.2s ease;
}

.toggle-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.toggle-input:checked + .toggle-switch {
  background: var(--accent-blue);
}

.toggle-input:checked + .toggle-switch::after {
  transform: translateX(18px);
}

.toggle-input:disabled + .toggle-switch {
  opacity: 0.45;
  cursor: not-allowed;
}

.progress-sphere-ring {
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.progress-sphere-header-text {
  flex: 1;
  min-width: 0;
}

.progress-metric-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.progress-metric-emoji {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #eef2f7;
  display: grid;
  place-items: center;
  font-size: 20px;
  flex-shrink: 0;
}

.progress-metric-name {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}

.progress-metric-sphere {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.progress-metric-head .autosave-status {
  margin-left: auto;
}

.progress-stats-row {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin-bottom: 12px;
  padding: 8px 0;
  border-top: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
}

.progress-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 10px;
}

.progress-stat-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.progress-stat-value {
  font-size: 14px;
  font-weight: 700;
}

.progress-stat-divider {
  width: 1px;
  background: #e5e7eb;
  align-self: stretch;
}

.progress-value-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.progress-value-label {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
}

.progress-value-input {
  width: 110px;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}

.progress-value-unit {
  font-size: 12px;
  color: var(--muted);
  min-width: 32px;
}

.progress-toggle-title {
  font-size: 14px;
  font-weight: 600;
}

.progress-mid-row,
.progress-boolean-row {
  margin-top: 4px;
}

.confirm-dialog {
  max-width: 420px;
}

.confirm-dialog::backdrop {
  background: rgba(15, 23, 42, 0.55);
}

.confirm-dialog-body {
  padding: 28px;
}

.confirm-message {
  margin: 0 0 16px;
  font-size: 15px;
  line-height: 1.45;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.confirm-actions-stack {
  flex-direction: column;
  align-items: stretch;
}

.confirm-actions-stack .mini-btn {
  width: 100%;
  justify-content: center;
}

.create-metric-form .field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.create-metric-footnote {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}

.sheet-card {
  width: min(480px, 92vw);
}

.progress-sphere-picker {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}

.edit-sphere-picker {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}

.edit-spheres-grid {
  grid-column: 1 / -1;
  display: grid;
  gap: 12px;
}

.edit-spheres-grid.all-mode {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.edit-spheres-grid.single-mode {
  grid-template-columns: 1fr;
}

.sphere-tab {
  border: 1px solid var(--border);
  background: #fff;
  color: #5c5058;
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s ease;
}

.sphere-tab.active {
  background: linear-gradient(135deg, var(--accent-violet), var(--accent-blue));
  color: #fff;
  box-shadow: 0 8px 18px rgba(79, 143, 247, 0.3);
}

.progress-metrics-list {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 1050px) {
  .stack-list {
    grid-template-columns: 1fr;
  }

  .progress-metrics-list {
    grid-template-columns: 1fr;
  }

  .reward-input-grid {
    grid-template-columns: 1fr;
  }

  .reward-stats {
    grid-template-columns: 1fr;
  }

  .edit-spheres-grid.all-mode,
  .edit-spheres-grid.single-mode {
    grid-template-columns: 1fr;
  }

  .metric-row-name-unit,
  .metric-row-targets,
  .metric-row-flags {
    grid-template-columns: 1fr;
  }

  .metric-type-row,
  .goals-grid,
  .create-goals-grid {
    grid-template-columns: 1fr;
  }

  .sphere-weight-row {
    flex-direction: column;
    align-items: stretch;
  }

  .edit-sphere-card .sphere-weight {
    width: 100%;
  }
}

@media (max-width: 950px) {
  .top-hud {
    width: min(82vw, 500px);
  }

  .top-score {
    width: min(82vw, 500px);
    padding: 7px 10px;
  }

  .top-hud-badges {
    grid-template-columns: 1fr;
  }

  .login-streak-badge,
  .reward-tracker-badge {
    justify-self: center;
    width: min(92vw, 500px);
  }

  .quality-row {
    width: 100%;
    margin: 0;
    grid-template-columns: 86px 1fr;
    gap: 6px;
  }

  .sphere-node {
    width: 193px;
  }

  .sphere-circle strong {
    font-size: 12px;
  }

  .sphere-title-btn {
    font-size: 12px;
  }

  .sphere-line {
    width: 48px;
  }

  .dashboard-footer {
    width: min(96vw, 760px);
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .left-actions,
  .right-actions {
    justify-self: center;
  }
}

@media (max-width: 720px) {
  .fam-savings-item {
    grid-template-columns: 1fr;
  }

  .fam-savings-actions {
    max-width: none;
    justify-content: flex-start;
  }

  .fam-savings-actions .fam-btn {
    min-width: 0;
  }
}

/* ── Things-style minimal overrides ───────────────────── */
.fam-header-minimal {
  margin-bottom: 4px;
}

.fam-month-picker-minimal {
  border: none;
  background: transparent;
  padding: 4px 0;
  box-shadow: none;
}

.fam-section-title .fam-card-title {
  margin: 0;
}

.fam-section-title .fam-card-desc {
  margin-top: 4px;
}

.fam-card-tasks,
.fam-task-group-card {
  padding: 8px 12px 12px;
}

.fam-task-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 4px 4px 12px;
  font-size: 16px;
  font-weight: 600;
}

.fam-task-group-head-main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.fam-task-group-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.fam-task-group-add:hover {
  background: rgba(15, 23, 42, 0.06);
  color: var(--text);
}

.fam-task-group-head.tone-rose .fam-ico { color: #e07a8a; }
.fam-task-group-head.tone-coral .fam-ico { color: #e6a06a; }
.fam-task-group-head.tone-blue .fam-ico { color: #4f8ff7; }
.fam-task-group-head.tone-violet .fam-ico { color: #8b7cf6; }

.fam-task-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.fam-task-row + .fam-task-row {
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.fam-task-row-main {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  cursor: pointer;
}

.fam-task-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 24px;
  height: 32px;
  margin: -4px 0;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: grab;
  touch-action: none;
}

.fam-task-drag-handle:hover,
.fam-task-drag-handle:focus-visible {
  color: var(--text);
  background: rgba(0, 0, 0, 0.04);
}

.fam-task-row.is-dragging {
  opacity: 0.35;
}

.fam-task-drag-ghost {
  position: fixed;
  z-index: 10050;
  list-style: none;
  margin: 0;
  padding: 0;
  width: min(420px, calc(100vw - 32px));
  pointer-events: none;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
  border-radius: 12px;
  background: var(--card);
  transform: rotate(-1deg);
}

.fam-task-drag-ghost .fam-task-row-main {
  cursor: grabbing;
}

.fam-task-drag-ghost .fam-task-drag-handle {
  cursor: grabbing;
  color: var(--text);
}

.fam-task-drop-indicator {
  position: fixed;
  z-index: 10049;
  height: 2px;
  border-radius: 999px;
  background: #4f8ff7;
  box-shadow: 0 0 0 1px rgba(79, 143, 247, 0.25);
  pointer-events: none;
}

.fam-task-list.is-dnd-target {
  outline: 1px dashed rgba(79, 143, 247, 0.35);
  outline-offset: 2px;
  border-radius: 8px;
}

.fam-task-row-content {
  flex: 1;
  min-width: 0;
}

.fam-task-row-title-line {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.fam-task-row-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fam-task-row.is-expanded .fam-task-row-title {
  white-space: normal;
}

.fam-task-row-project {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
}

.fam-task-row-aside {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.fam-task-row-date {
  font-size: 11px;
  color: var(--muted);
}

.fam-task-assignee {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
}

.fam-task-assignee.owner { background: #4f8ff7; }
.fam-task-assignee.partner { background: #e07a8a; }

.fam-task-urgency-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #e07a8a;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.fam-task-row-expanded {
  padding: 4px 4px 16px 46px;
}

.fam-task-row-expanded[hidden] {
  display: none !important;
}

.fam-task-expanded-title {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 500;
}

.fam-task-expanded-urgency {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--muted);
}

.fam-task-expanded-urgency.is-overdue { color: #c44; }

.fam-task-inline-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.fam-task-inline-field > span {
  font-size: 12px;
  color: var(--muted);
}

.fam-task-inline-notes,
.fam-task-inline-date {
  width: 100%;
  border: 1px solid #e8edf3;
  border-radius: 4px;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  background: #fff;
  transition: border-color 0.15s;
}

.fam-task-inline-notes:focus,
.fam-task-inline-date:focus {
  outline: none;
  border-color: #c5d4e8;
}

.fam-task-inline-date-remind {
  display: flex;
  align-items: center;
  gap: 6px;
}

.fam-task-inline-date-remind .fam-task-inline-date {
  width: auto;
  flex: 1 1 0;
  min-width: 0;
}

.fam-task-inline-remind-sep {
  flex-shrink: 0;
  color: var(--muted);
  display: flex;
  align-items: center;
}

.fam-task-inline-remind-time {
  flex: 0 0 auto;
  width: 90px;
  border: 1px solid #e8edf3;
  border-radius: 4px;
  padding: 10px 8px;
  font: inherit;
  font-size: 14px;
  background: #fff;
  transition: border-color 0.15s;
  color: #1a2332;
}

.fam-task-inline-remind-time:focus {
  outline: none;
  border-color: #c5d4e8;
}

.fam-task-inline-remind-time:not(:valid),
.fam-task-inline-remind-time[value=""] {
  color: var(--muted);
}

.fam-task-inline-notes {
  resize: none;
  min-height: 40px;
  line-height: 1.45;
}

.fam-task-expanded-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.fam-mini-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  font-size: 10px;
  color: #2f65b0;
  background: rgba(79, 143, 247, 0.1);
  border-radius: 999px;
}

.fam-mini-chip .fam-ico {
  width: 9px;
  height: 9px;
}

.fam-task-expanded-actions {
  display: flex;
  gap: 8px;
}

.fam-task-checklist {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 6px 0 16px;
  border-top: 1px solid #eef2f7;
  padding-top: 10px;
}

.fam-task-checklist-item,
.fam-task-checklist-add {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 6px 0;
  cursor: default;
}

.fam-task-checklist-add {
  cursor: text;
  margin-top: 2px;
}

.fam-task-checklist-check {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.fam-task-checklist-mark {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #3b82f6;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, background 0.15s;
}

.fam-task-checklist-mark-placeholder {
  border-color: #cbd5e1;
  background: transparent;
}

.fam-task-checklist-check:checked + .fam-task-checklist-mark {
  border-color: transparent;
  background: transparent;
}

.fam-task-checklist-check:checked + .fam-task-checklist-mark::after {
  content: "";
  width: 10px;
  height: 6px;
  border-left: 2px solid #94a3b8;
  border-bottom: 2px solid #94a3b8;
  transform: rotate(-45deg) translateY(-1px);
}

.fam-task-checklist-text {
  flex: 1;
  font-size: 15px;
  line-height: 1.35;
  color: #1a2332;
}

.fam-task-checklist-item.is-done .fam-task-checklist-text {
  color: #94a3b8;
}

.fam-task-checklist-input {
  flex: 1;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 15px;
  line-height: 1.4;
  color: #1a2332;
  padding: 6px 0;
  outline: none;
  box-shadow: none;
}

.fam-task-checklist-input:focus {
  outline: none;
  box-shadow: none;
}

.fam-task-checklist-input::placeholder {
  color: #94a3b8;
}

.fam-task-checklist-check-label {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  cursor: pointer;
}

.fam-task-checklist-drag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 20px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #cbd5e1;
  cursor: grab;
  touch-action: none;
  opacity: 0;
  transition: opacity 0.1s;
}

.fam-task-checklist-item:hover .fam-task-checklist-drag,
.fam-task-checklist-item:focus-within .fam-task-checklist-drag {
  opacity: 1;
}

.fam-task-checklist-drag:hover {
  color: #64748b;
  background: rgba(0, 0, 0, 0.04);
}

.fam-task-checklist-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #cbd5e1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.1s, color 0.1s;
  margin-left: auto;
}

.fam-task-checklist-item:hover .fam-task-checklist-delete,
.fam-task-checklist-item:focus-within .fam-task-checklist-delete {
  opacity: 1;
}

.fam-task-checklist-delete:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
}

.fam-task-checklist-text-edit {
  flex: 1;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 15px;
  line-height: 1.4;
  color: #1a2332;
  padding: 0;
  outline: none;
  box-shadow: none;
  min-width: 0;
}

.fam-task-checklist-item.is-dragging {
  opacity: 0.4;
}

.fam-task-completed-wrap {
  margin-top: 8px;
}

.fam-task-completed-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 4px;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
}

.fam-task-completed-toggle:hover {
  color: #1a2332;
}

.fam-task-completed-toggle .fam-ico {
  width: 16px;
  height: 16px;
  opacity: 0.7;
}

.fam-task-completed-count {
  margin-left: auto;
  font-size: 13px;
  font-weight: 600;
  color: #94a3b8;
}

.fam-task-completed-section.hidden {
  display: none !important;
}

.fam-task-completed-empty {
  margin: 0;
  padding: 12px 4px 4px;
  font-size: 13px;
  color: var(--muted);
}

.fam-project-detail-footer {
  justify-content: space-between;
}

.fam-project-detail-footer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.fam-task-icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}

.fam-task-icon-action:hover {
  color: var(--text);
  background: #f8fafc;
}

.fam-task-icon-danger:hover {
  color: #c44;
  border-color: #fecaca;
}

.fam-task-icon-action-success:hover {
  color: #2a9d6a;
  border-color: #c6f0d9;
}

.fam-project-card-text strong {
  font-size: 14px;
  font-weight: 500;
}

.fam-project-card-date {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
}

.fam-budget-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.fam-budget-card-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.fam-budget-hero-value {
  margin: 0;
  font-size: 1.875rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.fam-budget-hero-hint {
  margin: 4px 0 12px;
  font-size: 12px;
  color: var(--muted);
}

.fam-budget-progress {
  height: 5px;
  background: #eef2f8;
  border-radius: 999px;
  overflow: hidden;
}

.fam-budget-progress > .fam-progress-fill,
.fam-budget-progress > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #4f8ff7, #35b37e);
}

.fam-budget-progress > .fam-progress-fill.over,
.fam-budget-progress > .fam-progress-fill.unset {
  background: linear-gradient(90deg, #e07a8a, #d4a574);
}

.fam-budget-progress > .fam-progress-fill.warning {
  background: linear-gradient(90deg, #e6b84d, #4f8ff7);
}

.fam-budget-caption {
  margin: 8px 0 12px;
  font-size: 12px;
  color: var(--muted);
}

.fam-budget-stats-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.fam-budget-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.fam-budget-stat-label {
  font-size: 11px;
  color: var(--muted);
}

.fam-budget-stat-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.fam-budget-stat-divider {
  width: 1px;
  height: 16px;
  background: rgba(0, 0, 0, 0.08);
}

.fam-obl-list,
.fam-tx-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.fam-obl-row,
.fam-tx-row {
  list-style: none;
}

.fam-obl-row + .fam-obl-row,
.fam-tx-row + .fam-tx-row {
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.fam-obl-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
}

.fam-obl-row.is-paid .fam-obl-row-title {
  color: var(--muted);
}

.fam-obl-row.is-planned {
  opacity: 0.72;
}

.fam-obl-row.is-planned .fam-obl-row-date {
  font-style: italic;
}

.fam-obl-row-main {
  flex: 1;
  min-width: 0;
}

.fam-obl-row-title {
  display: block;
  font-size: 14px;
  font-weight: 500;
}

.fam-obl-row-date {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
}

.fam-obl-row-amount {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

.fam-obl-row-actions {
  display: flex;
  gap: 6px;
}

.fam-tx-row-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px 0;
  border: none;
  background: transparent;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.fam-tx-row-main {
  min-width: 0;
}

.fam-tx-row-main strong {
  display: block;
  font-size: 14px;
  font-weight: 500;
}

.fam-tx-row-main span {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
}

.fam-tx-row-amt {
  font-size: 14px;
  font-weight: 500;
  color: #c44;
  white-space: nowrap;
}

.fam-savings-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.fam-savings-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  cursor: pointer;
}

.fam-savings-row + .fam-savings-row {
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.fam-savings-row-main {
  flex: 1;
  min-width: 0;
}

.fam-savings-row-main strong {
  display: block;
  font-size: 14px;
  font-weight: 500;
}

.fam-savings-row-main span {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
}

.fam-savings-row-side {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
}

.fam-budget-progress-inline {
  flex: 1;
  min-width: 72px;
}

.fam-savings-row-pct {
  font-size: 11px;
  color: var(--muted);
  min-width: 28px;
  text-align: right;
}

.fam-savings-metric,
.fam-savings-item,
.fam-savings-history-item {
  border: none;
  box-shadow: none;
}

.fam-savings-item-clickable:hover {
  transform: none;
  box-shadow: none;
}

.goals-page-header {
  margin-bottom: 16px;
}

@media (max-width: 720px) {
  .fam-budget-stats-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .fam-budget-stat-divider {
    display: none;
  }
}

.fam-view-loading {
  padding: 24px 4px;
  font-size: 13px;
}

@keyframes softFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-2px);
  }
}

/* ─── Finance overview (Coinkeeper style) ─── */

.fin-ck-summary {
  margin-bottom: 20px;
}

.fin-ck-month-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
}

.fin-ck-month-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: #f1f5f9;
  color: var(--text);
  cursor: pointer;
}

.fin-ck-month-btn:hover {
  background: #e8edf5;
}

.fin-ck-month-label {
  min-width: 120px;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.fin-ck-summary-cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  text-align: center;
  align-items: start;
}

.fin-ck-summary-col {
  min-width: 0;
}

.fin-ck-summary-label {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  color: var(--muted);
}

.fin-ck-summary-value {
  display: block;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.fin-ck-summary-daily {
  display: block;
  min-height: 14px;
  margin-top: 2px;
  font-size: 10px;
  line-height: 1.2;
  color: var(--muted);
}

.fin-ck-summary-spent .fin-ck-summary-value {
  color: #d94f70;
}

.fin-ck-summary-balance .fin-ck-summary-value {
  color: var(--text);
}

.fin-ck-summary-balance.is-negative .fin-ck-summary-value {
  color: #d94f70;
}

.fin-ck-summary-budget {
  position: relative;
}

.fin-ck-summary-budget .fin-ck-summary-value {
  color: #35b37e;
}

.fin-ck-summary-edit {
  position: absolute;
  top: 0;
  right: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.fin-ck-summary-edit:hover {
  background: #f1f5f9;
  color: var(--text);
}

.fin-ck-budget-bar {
  margin-top: 14px;
  height: 4px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

.fin-ck-budget-bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  transition: width 0.25s ease;
}

.fin-ck-budget-cta {
  margin-top: 14px;
  display: flex;
  justify-content: center;
}

.fin-ck-cat-section {
  margin-bottom: 20px;
}

.fin-ck-cat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.fin-ck-cat-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.fin-ck-analytics-btn {
  flex: none;
}

.fin-ck-cat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px 10px;
  align-items: start;
}

.fin-ck-cat-empty {
  grid-column: 1 / -1;
  margin: 0;
}

.fin-ck-cat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px 2px 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 12px;
  min-width: 0;
  width: 100%;
  align-self: start;
}

.fin-ck-cat-card:hover {
  background: rgba(15, 23, 42, 0.04);
}

.fin-ck-cat-card:active {
  transform: scale(0.98);
}

.fin-ck-cat-ring-wrap {
  position: relative;
  width: 64px;
  height: 64px;
  min-width: 56px;
  min-height: 56px;
  flex-shrink: 0;
}

.fin-ck-cat-ring {
  display: block;
  width: 100%;
  height: 100%;
}

.fin-ck-cat-ring-track {
  stroke: rgba(15, 23, 42, 0.18);
}

.fin-ck-cat-emoji {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  line-height: 1;
  pointer-events: none;
}

.fin-ck-cat-name {
  max-width: 100%;
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fin-ck-cat-spent {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.fin-ck-cat-spent.is-over {
  color: #d94f70;
}

.fin-ck-cat-limit {
  display: block;
  min-height: 12px;
  font-size: 9px;
  line-height: 1.2;
  color: var(--muted);
}

.fin-ck-quick-tx-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.fin-ck-quick-tx-icon {
  font-size: 28px;
  line-height: 1;
}

.fin-ck-quick-tx-name {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.fam-dialog-cat-tx .fam-dialog-body {
  min-width: min(440px, 92vw);
}

.fam-cat-tx-total {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 12px 14px;
  margin: 4px 0 12px;
  border-radius: 14px;
  background: var(--fam-surface-2, rgba(120, 120, 128, 0.08));
}

.fam-cat-tx-total-label {
  font-size: 13px;
  color: var(--fam-muted, #8a8a8e);
}

.fam-cat-tx-total-value {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-right: auto;
}

.fam-cat-tx-total-count {
  font-size: 13px;
  color: var(--fam-muted, #8a8a8e);
}

.fam-cat-tx-list {
  max-height: 52vh;
  overflow-y: auto;
  margin: 0;
  padding: 0;
}

.fam-tx-row-comment {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
  font-size: 12px;
  color: var(--fam-muted, #8a8a8e);
  line-height: 1.3;
}

.fam-tx-row-comment .fam-ico {
  width: 12px;
  height: 12px;
  flex: none;
}

/* ── Аналитика финансов ─────────────────────────────────────────────── */
.fin-an-donut-wrap {
  display: flex;
  justify-content: center;
  padding: 8px 0 18px;
}

.fin-an-donut-box {
  position: relative;
  width: 200px;
  height: 200px;
}

.fin-an-donut-track {
  stroke: var(--fam-surface-2, #eef2f7);
}

.fin-an-donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.fin-an-donut-total {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.fin-an-donut-label {
  font-size: 12px;
  color: var(--fam-muted, #8a8a8e);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.fin-an-cat-list,
.fin-an-merchant-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.fin-an-cat-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.fin-an-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: none;
}

.fin-an-cat-emoji {
  font-size: 16px;
  line-height: 1;
}

.fin-an-cat-name {
  font-weight: 600;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fin-an-cat-share {
  font-variant-numeric: tabular-nums;
  color: var(--fam-muted, #8a8a8e);
  font-size: 13px;
}

.fin-an-cat-sum {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  min-width: 96px;
  text-align: right;
}

.fin-an-bar {
  height: 8px;
  border-radius: 6px;
  background: var(--fam-surface-2, #eef2f7);
  overflow: hidden;
}

.fin-an-bar i {
  display: block;
  height: 100%;
  border-radius: 6px;
  min-width: 4px;
}

.fin-an-merchant-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fin-an-merchant-rank {
  width: 22px;
  height: 22px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--fam-surface-2, #eef2f7);
  font-size: 12px;
  font-weight: 700;
  color: var(--fam-muted, #8a8a8e);
}

.fin-an-merchant-main {
  flex: 1;
  min-width: 0;
}

.fin-an-merchant-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
}

.fin-an-merchant-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fin-an-merchant-sum {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  flex: none;
}

.fin-an-merchant-share {
  font-variant-numeric: tabular-nums;
  color: var(--fam-muted, #8a8a8e);
  font-size: 13px;
  min-width: 44px;
  text-align: right;
  flex: none;
}

@media (max-width: 900px) {
  .fin-ck-cat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .fin-ck-summary-cols {
    gap: 4px;
  }

  .fin-ck-summary-value {
    font-size: 15px;
  }

  .fin-ck-cat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 8px;
  }
}

@media (max-width: 360px) {
  .fin-ck-cat-ring-wrap {
    width: 56px;
    height: 56px;
  }

  .fin-ck-cat-emoji {
    font-size: 22px;
  }
}

/* ─── Task project areas (Things-style) ─── */

.fam-areas-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.fam-area-group {
  margin: 0;
}

.fam-area-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

.fam-area-head .fam-ico {
  color: var(--muted);
}

.fam-area-projects {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.fam-area-project-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 8px 8px 4px;
  border: none;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: var(--text);
}

.fam-area-project-row:hover {
  background: rgba(15, 23, 42, 0.04);
}

.fam-area-project-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.fam-area-project-text strong {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fam-area-project-date {
  font-size: 11px;
  color: var(--muted);
}

.fam-area-empty {
  margin: 0;
  padding: 4px 4px 4px 36px;
  font-size: 12px;
  color: var(--muted);
}

.fam-area-picker {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fam-area-picker-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #e8edf5;
  border-radius: 10px;
  cursor: pointer;
}

.fam-area-picker-option:has(input:checked) {
  border-color: #4f8ff7;
  background: rgba(79, 143, 247, 0.06);
}

.fam-area-picker-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.fam-area-picker-icon {
  display: inline-flex;
  color: var(--muted);
}

.fam-project-area-readonly {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--muted);
}

.fam-shared-toggle {
  margin-bottom: 4px;
}

.fam-shared-options {
  display: flex;
  gap: 8px;
}

.fam-shared-option {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border: 1px solid #e8edf5;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}

.fam-shared-option:has(input:checked) {
  border-color: #4f8ff7;
  background: rgba(79, 143, 247, 0.06);
}

.fam-shared-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.fam-shared-hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

.fam-field-hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

/* ═══════════════════════════════════════════════════════════
   THREE-COLUMN NAVIGATION SPLIT VIEW — LAYOUT & INTERACTIONS
   Visual design (colors, fonts, shadows, radii) unchanged.
   ═══════════════════════════════════════════════════════════ */

/* Three-column shell */
.app-shell {
  grid-template-columns: 160px 240px 1fr;
  grid-template-areas: "sidebar nav detail";
}
.app-sidebar  { grid-area: sidebar; }
#contentList  { grid-area: nav; }
.detail-area  { grid-area: detail; }

/* Two-column when middle pane hidden (Dashboard / Goals / Logs) */
.app-shell.no-content-list {
  grid-template-columns: 160px 1fr;
  grid-template-areas: "sidebar detail";
}
.app-shell.no-content-list #contentList { display: none; }

/* ── Wider sidebar with text labels ── */
.app-sidebar {
  align-items: flex-start;
  width: 160px;
  padding: 8px 0;
  gap: 2px;
  overflow: hidden;
}
.sidebar-link {
  width: calc(100% - 12px);
  margin: 0 6px;
  height: 36px;
  justify-content: flex-start;
  padding: 0 10px;
  gap: 9px;
  border-radius: 8px;
}
.sidebar-label {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sidebar footer: avatar + username + logout */
.sidebar-footer {
  margin-top: auto;
  width: 100%;
  padding: 10px 6px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}
.sidebar-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.sidebar-user-name {
  flex: 1;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.sidebar-logout-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  padding: 4px 6px;
  cursor: pointer;
  color: var(--muted);
  border-radius: 6px;
  font-size: 13px;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
}
.sidebar-logout-btn:hover { color: var(--text); background: #f0f4fa; }

/* Hide old topbar (greeting/logout moved to sidebar footer) */
.app-topbar { display: none !important; }

/* Hide old dashboard footer (actions moved to detail toolbar) */
.dashboard-footer { display: none !important; }

/* ── Content list: middle column ── */
#contentList {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.62);
  padding: 6px 0;
}
.cl-header {
  padding: 6px 14px 4px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
  white-space: nowrap;
}
.cl-section {
  padding: 10px 14px 3px;
  font-size: 10px;
  font-weight: 700;
  color: #a0aec0;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}
.cl-item {
  display: flex;
  align-items: center;
  width: calc(100% - 12px);
  margin: 1px 6px;
  height: 34px;
  padding: 0 10px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 400;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: 8px;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s;
  gap: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cl-item:hover  { background: #f0f4fa; }
.cl-item.active { background: #e8f0ff; color: #2f65b0; font-weight: 500; }

/* ── Detail area: right column ── */
.detail-area {
  grid-area: detail;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

/* ── Thin toolbar above detail views ── */
#detailToolbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  height: 44px;
  min-height: 44px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
}
.dtb-title {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dtb-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Hide project carousel card in detail area (projects now in content list) */
.fam-card-projects { display: none !important; }

/* ── Inline create row (task or expense) ── */
.inline-create-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 8px 14px;
  background: rgba(79, 143, 247, 0.05);
  border: 1.5px dashed rgba(79, 143, 247, 0.32);
  border-radius: 10px;
  margin: 0 0 8px;
}
.inline-create-field {
  flex: 1;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  outline: none;
  min-width: 0;
}
.inline-create-field::placeholder { color: var(--muted); font-weight: 400; }
.inline-create-cancel {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 6px;
  transition: color 0.12s, background 0.12s;
}
.inline-create-cancel:hover { color: var(--text); background: #f0f4fa; }

/* ── Responsive: 600–899px — icon sidebar + horizontal tab strip ── */
@media (max-width: 899px) {
  .app-shell {
    grid-template-columns: 64px 1fr;
    grid-template-rows: 40px 1fr;
    grid-template-areas:
      "sidebar tabs"
      "sidebar detail";
  }
  .app-shell.no-content-list {
    grid-template-rows: 1fr;
    grid-template-areas: "sidebar detail";
  }
  #contentList { grid-area: tabs; }

  .app-sidebar { width: 64px; align-items: center; padding: 12px 8px; gap: 8px; }
  .sidebar-link { width: 44px; height: 44px; justify-content: center; padding: 0; margin: 0; border-radius: 12px; gap: 0; }
  .sidebar-label { display: none; }
  .sidebar-footer { flex-direction: column; padding: 8px 4px; gap: 5px; align-items: center; }
  .sidebar-user-name { display: none; }

  #contentList {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    min-height: 40px;
    max-height: 40px;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 0 6px;
    align-items: center;
    gap: 0;
  }
  .cl-header  { display: none; }
  .cl-section { display: none; }
  .cl-item {
    height: 30px;
    padding: 0 12px;
    margin: 0 3px;
    width: auto;
    flex-shrink: 0;
    border-radius: 999px;
    font-size: 13px;
  }
}

/* ── Responsive: <600px — single column stacked layout ── */
@media (max-width: 599px) {
  .app-shell,
  .app-shell.no-content-list {
    grid-template-columns: 1fr;
    grid-template-rows: 52px 1fr;
    grid-template-areas:
      "sidebar"
      "detail";
  }
  #contentList { display: none !important; }
  .app-sidebar {
    width: 100%;
    flex-direction: row;
    align-items: center;
    justify-content: space-around;
    padding: 6px 12px;
    height: 52px;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    gap: 4px;
  }
  .sidebar-link { width: 40px; height: 40px; justify-content: center; padding: 0; margin: 0; border-radius: 12px; gap: 0; }
  .sidebar-label { display: none; }
  .sidebar-footer { display: none; }
  .detail-area { overflow-y: auto; }
}
