/* ==========================================================================
   FinScheduler — visual layer on top of PlainAdmin
   ========================================================================== */

:root {
  --c-meal: #f59e0b;
  --c-dog: #10b981;
  --c-focus: #6366f1;
  --c-habit: #a855f7;
  --c-event: #3b82f6;
  --c-break: #94a3b8;
  --c-errand: #f97316;
  --c-personal: #ec4899;
  --radius: 16px;
  --radius-sm: 10px;
  --sidebar: 240px;
}

body {
  --bg: #f4f5f9;
  --surface: #ffffff;
  --surface-2: #f7f8fb;
  --line: #e8eaf0;
  --text: #171a26;
  --muted: #6b7285;
  --faint: #a2a8b8;
  --accent: #5b5bd6;
  --accent-2: #7c6cf2;
  --accent-soft: rgba(91, 91, 214, 0.1);
  --shadow: 0 1px 2px rgba(20, 24, 40, 0.04), 0 4px 16px rgba(20, 24, 40, 0.04);
  --tint: 14%;
  background: var(--bg) !important;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
body.darkTheme {
  --bg: #0d0f15;
  --surface: #151821;
  --surface-2: #1b1f2a;
  --line: #252a37;
  --text: #e8eaf1;
  --muted: #8b92a5;
  --faint: #5b6275;
  --accent: #8484f7;
  --accent-2: #a193ff;
  --accent-soft: rgba(132, 132, 247, 0.14);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.2);
  --tint: 18%;
}
html.pre-dark body { background: #0d0f15 !important; }

h1, h2, h3, h4, h5, h6 { color: var(--text); }
::selection { background: var(--accent-soft); }

/* ---------- sidebar ---------- */
.sidebar-nav-wrapper,
.darkTheme .sidebar-nav-wrapper {
  width: var(--sidebar); background: var(--surface); border-right: 1px solid var(--line);
  box-shadow: none; padding: 22px 14px; overflow-y: auto; display: flex; flex-direction: column;
}
.main-wrapper { margin-left: var(--sidebar); padding-bottom: 40px; }
@media (max-width: 1199px) {
  .main-wrapper { margin-left: 0; }
  .sidebar-nav-wrapper { transform: translateX(-100%); }
  .sidebar-nav-wrapper.active { transform: none; }
}
@media (min-width: 1200px) {
  .fs-menu-btn { display: none !important; }
}

.fs-brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 22px; font-weight: 700; font-size: 17px; color: var(--text); letter-spacing: -0.01em; }
.fs-brand:hover { color: var(--text); }
.fs-logo { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); display: grid; place-items: center; box-shadow: 0 4px 12px rgba(91, 91, 214, 0.35); }
.fs-logo svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; }

.fs-nav { display: flex; flex-direction: column; gap: 2px; }
.fs-nav-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--faint); padding: 16px 12px 6px; margin: 0; }
.fs-nav a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--radius-sm); color: var(--muted); font-size: 14px; font-weight: 500; transition: background 0.15s, color 0.15s; }
.fs-nav a i { font-size: 17px; width: 18px; }
.fs-nav a:hover { background: var(--surface-2); color: var(--text); }
.fs-nav a.active { background: var(--accent-soft); color: var(--accent); }

.fs-legend { margin-top: auto; padding: 16px 12px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; border-top: 1px solid var(--line); }
.fs-legend span { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.fs-legend i { width: 8px; height: 8px; border-radius: 3px; background: var(--cat); }

.overlay.active { background: rgba(0, 0, 0, 0.4); }

/* ---------- header ---------- */
.fs-header {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 16px; padding: 18px 28px;
  background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(12px);
}
.fs-greeting h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.fs-greeting p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.fs-header-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.fs-dayprogress { width: 150px; font-size: 12px; color: var(--muted); margin-right: 8px; }
.fs-bar { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; margin-top: 5px; }
.fs-bar > div { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 0.6s; }

/* ---------- buttons ---------- */
.fs-btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid transparent; font-size: 14px; font-weight: 600; transition: all 0.15s; white-space: nowrap; }
.fs-btn-primary { background: var(--accent); color: #fff; box-shadow: 0 4px 14px rgba(91, 91, 214, 0.3); }
.fs-btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); color: #fff; }
.fs-btn-ghost { background: transparent; color: var(--muted); border-color: var(--line); }
.fs-btn-ghost:hover { color: var(--text); background: var(--surface-2); }
.fs-btn-ghost.danger:hover { color: #ef4444; border-color: rgba(239, 68, 68, 0.4); }
.fs-icon-btn { width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); color: var(--muted); transition: all 0.15s; flex-shrink: 0; }
.fs-icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.fs-icon-btn.sm { width: 28px; height: 28px; border-radius: 8px; font-size: 13px; }

/* ---------- layout ---------- */
.fs-content { padding: 4px 28px 28px; }
.fs-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
@media (max-width: 1100px) {
  /* single column: Now + stats first, then the calendar, then everything else */
  .fs-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .fs-grid .fs-side { display: contents; }
  .fs-grid > *, .fs-side > * { order: 4; min-width: 0; }
  .fs-now { order: 1; }
  .fs-stats { order: 2; }
  .fs-calendar-card { order: 3; }
}
@media (max-width: 575px) { .fs-content, .fs-header { padding-left: 16px; padding-right: 16px; } }
.fs-side { display: flex; flex-direction: column; gap: 16px; }
.fs-side > * { flex-shrink: 0; }
@media (min-width: 1101px) {
  .fs-side {
    position: sticky; top: 84px; max-height: calc(100vh - 96px); overflow-y: auto; scrollbar-width: none;
    padding: 6px 2px 24px; margin: -6px -2px 0;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 14px, #000 calc(100% - 28px), transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0, #000 14px, #000 calc(100% - 28px), transparent 100%);
  }
  .fs-side::-webkit-scrollbar { display: none; }
}

.fs-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.fs-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.fs-card-head h2 { font-size: 14px; font-weight: 650; margin: 0; display: flex; align-items: center; gap: 8px; }
.fs-card-head h2 i { color: var(--faint); font-size: 15px; }
.fs-hint { font-size: 12px; color: var(--faint); }
.fs-count { font-size: 11px; font-weight: 600; background: var(--accent-soft); color: var(--accent); padding: 1px 7px; border-radius: 99px; }
.fs-count:empty { display: none; }
.fs-muted { color: var(--muted); font-size: 13px; }
.fs-empty { color: var(--faint); font-size: 13px; text-align: center; padding: 10px 0 4px; }
.fs-success { color: #10b981; font-size: 14px; }

/* ---------- category icon badge ---------- */
.fs-ico { width: 30px; height: 30px; border-radius: 9px; display: inline-grid; place-items: center; flex-shrink: 0; font-size: 15px;
  background: color-mix(in srgb, var(--cat) var(--tint), transparent); color: var(--cat); }
.fs-ico svg { width: 16px; height: 16px; fill: currentColor; }
.fs-ico.lg { width: 44px; height: 44px; border-radius: 13px; font-size: 21px; }
.fs-ico.lg svg { width: 22px; height: 22px; }

/* ---------- now card ---------- */
.fs-now { position: relative; overflow: hidden; padding: 20px;
  background: linear-gradient(145deg, color-mix(in srgb, var(--cat, var(--accent)) calc(var(--tint) - 4%), var(--surface)), var(--surface) 70%); }
.fs-now .label { font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--cat, var(--accent)); display: flex; align-items: center; gap: 6px; }
.fs-now .label .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 20%, transparent); animation: fs-pulse 2s infinite; }
@keyframes fs-pulse { 50% { box-shadow: 0 0 0 7px transparent; } }
.fs-now .row1 { display: flex; align-items: center; gap: 14px; margin: 14px 0 16px; }
.fs-now h3 { font-size: 19px; font-weight: 700; margin: 0; letter-spacing: -0.01em; line-height: 1.25; }
.fs-now .sub { font-size: 13px; color: var(--muted); }
.fs-now .big { font-size: 34px; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1; color: var(--text); }
.fs-now .big small { font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-left: 6px; }
.fs-now .fs-bar { margin-top: 14px; height: 5px; }
.fs-now .fs-bar > div { background: var(--cat, var(--accent)); }
.fs-now .next { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.fs-now .next b { color: var(--text); font-weight: 600; }
.fs-now .actions { display: flex; gap: 8px; margin-top: 14px; }
.fs-now .actions .fs-btn { height: 32px; padding: 0 12px; font-size: 13px; }

/* ---------- stats ---------- */
.fs-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.fs-stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 6px; text-align: center; box-shadow: var(--shadow); }
.fs-stat b { display: block; font-size: 17px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.fs-stat span { font-size: 11px; color: var(--muted); }

/* ---------- countdowns ---------- */
.fs-cd { display: flex; align-items: center; gap: 12px; padding: 9px 0; }
.fs-cd + .fs-cd { border-top: 1px solid var(--line); }
.fs-cd .grow { flex: 1; min-width: 0; }
.fs-cd .t { font-size: 14px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fs-cd .s { font-size: 12px; color: var(--muted); }
.fs-cd .time { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 14px; color: var(--text); text-align: right; white-space: nowrap; }
.fs-cd .time small { display: block; font-size: 11px; font-weight: 500; color: var(--faint); }
.fs-cd .del { border: 0; background: none; color: var(--faint); opacity: 0; padding: 0 0 0 4px; transition: opacity 0.15s; }
.fs-cd:hover .del { opacity: 1; }
.fs-cd .del:hover { color: #ef4444; }

/* ---------- quick blocks ---------- */
.fs-quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.fs-quick { cursor: grab; user-select: none; border: 1px solid var(--line); border-radius: 12px; padding: 10px 6px 8px; text-align: center; background: var(--surface-2); transition: all 0.15s; }
.fs-quick:hover { border-color: var(--cat); transform: translateY(-2px); box-shadow: 0 6px 16px color-mix(in srgb, var(--cat) 20%, transparent); }
.fs-quick:active { cursor: grabbing; }
.fs-quick .fs-ico { margin-bottom: 6px; }
.fs-quick .n { font-size: 12px; font-weight: 600; color: var(--text); line-height: 1.2; }
.fs-quick .d { font-size: 11px; color: var(--faint); }

/* ---------- inbox ---------- */
.fs-add { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; padding: 4px 6px 4px 12px; margin-bottom: 10px; transition: border-color 0.15s, box-shadow 0.15s; }
.fs-add:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.fs-add > i { color: var(--faint); }
.fs-add input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); padding: 7px 0; font-size: 14px; outline: none; }
.fs-add input::placeholder { color: var(--faint); }
.fs-add kbd { background: var(--surface); border: 1px solid var(--line); color: var(--faint); font-size: 11px; padding: 2px 6px; border-radius: 6px; box-shadow: none; }

.fs-task { display: flex; align-items: center; gap: 10px; padding: 8px; margin: 0 -8px; border-radius: 10px; cursor: grab; transition: background 0.15s; }
.fs-task:hover { background: var(--surface-2); }
.fs-task .grow { flex: 1; min-width: 0; }
.fs-task .t { font-size: 14px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fs-task .m { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.fs-pill { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 1px 6px; border-radius: 5px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.fs-pill.high { background: rgba(239, 68, 68, 0.12); color: #ef4444; border-color: transparent; }
.fs-task .del, .fs-routine .del { border: 0; background: none; color: var(--faint); opacity: 0; transition: opacity 0.15s; }
.fs-task:hover .del, .fs-routine:hover .del { opacity: 1; }
.fs-task .del:hover, .fs-routine .del:hover { color: #ef4444; }

/* ---------- goals ---------- */
.fs-goal + .fs-goal { margin-top: 14px; }
.fs-goal .top { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; }
.fs-goal .top b { font-weight: 600; }
.fs-goal .top span { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.fs-goal .fs-bar { position: relative; height: 7px; margin: 7px 0 4px; }
.fs-goal .fs-bar .planned { position: absolute; inset: 0 auto 0 0; background: var(--accent-soft); border-radius: 99px; }
.fs-goal .fs-bar .done { position: absolute; inset: 0 auto 0 0; }
.fs-goal .why { font-size: 12px; color: var(--faint); display: flex; justify-content: space-between; }
.fs-goal .why button { border: 0; background: none; color: var(--faint); font-size: 12px; opacity: 0; }
.fs-goal:hover .why button { opacity: 1; }

/* ---------- calendar ---------- */
.fs-calendar-card { padding: 16px 16px 8px; }
.fc { --fc-border-color: var(--line); --fc-page-bg-color: var(--surface); --fc-neutral-bg-color: var(--surface-2); --fc-today-bg-color: transparent; --fc-now-indicator-color: #ef4444; --fc-highlight-color: var(--accent-soft); color: var(--text); font-size: 13px; }
.fc .fc-toolbar.fc-header-toolbar { margin-bottom: 14px; flex-wrap: wrap; gap: 10px; }
.fc .fc-toolbar-title { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.fc .fc-button { transition: none; background: var(--surface) !important; border: 1px solid var(--line) !important; color: var(--muted) !important; font-size: 13px; font-weight: 600; text-transform: capitalize; box-shadow: none !important; padding: 6px 12px; }
.fc .fc-button:hover { color: var(--text) !important; background: var(--surface-2) !important; }
.fc .fc-button:disabled { opacity: 1; color: var(--faint) !important; cursor: default; }
.fc .fc-button-group > .fc-button:first-child { border-radius: 9px 0 0 9px; }
.fc .fc-button-group > .fc-button:last-child { border-radius: 0 9px 9px 0; }
.fc .fc-button-group > .fc-button:not(:first-child) { margin-left: -1px; }
.fc .fc-button { height: 34px; display: inline-flex; align-items: center; }
.fc .fc-button-primary:not(:disabled).fc-button-active { background: var(--accent-soft) !important; color: var(--accent) !important; }

.fc-theme-standard .fc-scrollgrid { border: 0; }
.fc-theme-standard td, .fc-theme-standard th { border-color: var(--line); }
.fc .fc-col-header-cell { border: 0; padding: 6px 0 10px; }
.fc .fc-col-header-cell-cushion { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; }
.fc .fc-day-today .fc-col-header-cell-cushion { color: var(--accent); }
.fc .fc-timegrid-slot { height: 22px; border-bottom: 0; }
.fc .fc-timegrid-slot-minor { border-top-color: transparent; }
.fc .fc-timegrid-slot-label { border: 0; vertical-align: top; }
.fc .fc-timegrid-slot-label-cushion { color: var(--faint); font-size: 11px; font-weight: 500; font-variant-numeric: tabular-nums; position: relative; top: -8px; padding-right: 10px; }
.fc .fc-timegrid-axis { border: 0; }
.fc .fc-timegrid-col.fc-day-today { background: transparent; }
.fc .fc-timegrid-now-indicator-line { border-width: 2px 0 0; }
.fc .fc-timegrid-now-indicator-line::before { content: ''; position: absolute; left: -5px; top: -6px; width: 10px; height: 10px; border-radius: 50%; background: #ef4444; }
.fc .fc-timegrid-now-indicator-arrow { display: none; }
.fc .fc-scroller { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }

/* events */
.fc .fc-timegrid-event, .fc .fc-daygrid-block-event {
  background: color-mix(in srgb, var(--cat) var(--tint), var(--surface)) !important;
  border: 0 !important; border-left: 3px solid var(--cat) !important; border-radius: 8px;
  box-shadow: 0 0 0 1px var(--surface); cursor: pointer; transition: filter 0.15s, box-shadow 0.15s;
}
.fc .fc-timegrid-event:hover { box-shadow: 0 0 0 1px var(--surface), 0 6px 18px color-mix(in srgb, var(--cat) 25%, transparent); }
.fc .fc-timegrid-event .fc-event-main { padding: 4px 8px; color: var(--text); }
/* tracking states */
.fc .fc-event.is-past .fs-ev-title { color: var(--muted); }
.fc .fc-event.is-past .fs-ev .i { opacity: 0.7; }
.fc .fc-event.is-done { background: color-mix(in srgb, var(--cat) calc(var(--tint) / 2), var(--surface)) !important; }
.fc .fc-event.is-done .fs-ev-title { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); }
.fc .fc-event.is-skipped { background: repeating-linear-gradient(135deg, var(--surface-2) 0 6px, var(--surface) 6px 12px) !important; border-left-color: var(--faint) !important; }
.fc .fc-event.is-skipped .fs-ev-title, .fc .fc-event.is-skipped .fs-ev .i { color: var(--faint); text-decoration: line-through; }
.fc .fc-event.needs-review { box-shadow: 0 0 0 1px var(--surface), inset 0 0 0 1px color-mix(in srgb, #fab219 55%, transparent) !important; }

.fs-ev { position: relative; }
.fs-ev-check {
  margin-left: auto; align-self: flex-start; flex-shrink: 0; width: 20px; height: 20px; border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--cat) 60%, var(--muted)); background: var(--surface); color: #fff;
  display: grid; place-items: center; font-size: 10px; padding: 0; cursor: pointer; opacity: 0.55;
  transition: opacity 0.15s, transform 0.15s, background 0.15s, border-color 0.15s;
}
.fs-ev.compact .fs-ev-check { align-self: center; }
.fc-event:hover .fs-ev-check, .fs-ev-check:focus-visible { opacity: 1; }
.fs-ev-check:hover { transform: scale(1.12); border-color: #0ca30c; }
.is-needs-review .fs-ev-check, .needs-review .fs-ev-check { opacity: 1; border-color: #fab219; }
.is-done .fs-ev-check { opacity: 1; background: #0ca30c; border-color: #0ca30c; }
.is-skipped .fs-ev-check { opacity: 1; background: var(--faint); border-color: var(--faint); }
@media (hover: none) { .fs-ev-check { opacity: 1; width: 24px; height: 24px; } }
.fc .fc-event-mirror { opacity: 0.9; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18) !important; }

.fs-ev { display: flex; gap: 7px; height: 100%; overflow: hidden; }
.fs-ev .i { color: var(--cat); font-size: 13px; line-height: 1.35; flex-shrink: 0; }
.fs-ev .i svg { width: 13px; height: 13px; fill: currentColor; vertical-align: -2px; }
.fs-ev-body { min-width: 0; }
.fs-ev-title { font-weight: 600; font-size: 13px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fs-ev-time { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.fs-ev.compact { align-items: center; }
.fs-ev.compact .fs-ev-body { display: flex; gap: 8px; align-items: baseline; }

/* month view */
.fc .fc-daygrid-day-number { color: var(--muted); font-size: 12px; font-weight: 600; padding: 6px 8px; }
.fc .fc-day-today .fc-daygrid-day-number { background: var(--accent); color: #fff; border-radius: 8px; margin: 4px; padding: 2px 7px; }
.fc .fc-daygrid-event { border-radius: 6px; padding: 1px 4px; font-size: 12px; }
.fc .fc-daygrid-dot-event .fc-event-title { font-weight: 500; color: var(--text); }
.fc .fc-daygrid-event-dot { border-color: var(--cat); }
.fc .fc-event-time { color: var(--muted); }

/* ---------- modals ---------- */
.modal-backdrop.show { opacity: 0.35; }
.fs-modal { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 24px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25); color: var(--text); }
.fs-modal h3 { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.fs-modal h4 { font-size: 14px; font-weight: 650; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.fs-title-input { width: 100%; border: 0; background: transparent; font-size: 22px; font-weight: 700; color: var(--text); outline: none; padding: 0 0 12px; letter-spacing: -0.01em; }
.fs-title-input::placeholder { color: var(--faint); }
.fs-cat-picker { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.fs-cat-picker button { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 99px; padding: 4px 11px 4px 8px; font-size: 12px; font-weight: 600; transition: all 0.15s; }
.fs-cat-picker button i { color: var(--cat); }
.fs-cat-picker button svg { fill: var(--cat); width: 13px; height: 13px; }
.fs-cat-picker button.on { background: color-mix(in srgb, var(--cat) var(--tint), var(--surface)); border-color: var(--cat); color: var(--text); }
.fs-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fs-field { display: block; margin-bottom: 14px; width: 100%; min-width: 0; }
.fs-field > span { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.fs-field input, .fs-field select, .fs-field textarea, .fs-routine-row input, .fs-routine-row select {
  width: 100%; min-width: 0; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); border-radius: 10px; padding: 9px 10px; font-size: 14px; outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.fs-field input:focus, .fs-field select:focus, .fs-field textarea:focus, .fs-routine-row input:focus, .fs-routine-row select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.darkTheme input, .darkTheme select { color-scheme: dark; }
.darkTheme select option { background: var(--surface); }
/* segmented control (status, range) */
.fs-seg { display: inline-flex; padding: 3px; gap: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; }
.fs-seg label { margin: 0; cursor: pointer; }
.fs-seg input { position: absolute; opacity: 0; pointer-events: none; }
.fs-seg span { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); transition: all 0.15s; }
.fs-seg label:hover span { color: var(--text); }
.fs-seg input:checked + span { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); }
.fs-seg label.ok input:checked + span { color: #0ca30c; }
.fs-seg label.no input:checked + span { color: #d03b3b; }
.fs-seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.fs-seg-sm span { padding: 4px 10px; font-size: 12px; }
.fs-link { border: 0; background: none; color: var(--accent); font-size: 12px; font-weight: 600; padding: 0; }
.fs-link:hover { text-decoration: underline; }
.fs-modal-actions { display: flex; align-items: center; gap: 8px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.fs-import { display: grid; gap: 22px; margin-top: 14px; }
.fs-import .form-control { background: var(--surface-2); border-color: var(--line); color: var(--text); border-radius: 10px; }

.fs-routine { display: flex; align-items: center; gap: 12px; padding: 8px; margin: 0 -8px; border-radius: 10px; }
.fs-routine:hover { background: var(--surface-2); }
.fs-routine .tm { font-weight: 700; font-variant-numeric: tabular-nums; width: 48px; color: var(--text); }
.fs-routine .grow { flex: 1; }
.fs-routine .t { font-weight: 600; font-size: 14px; }
.fs-routine .m { font-size: 12px; color: var(--muted); }
.fs-routine-row { display: grid; grid-template-columns: 2fr 1fr 0.9fr 1fr 1fr auto; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
@media (max-width: 767px) { .fs-routine-row { grid-template-columns: 1fr 1fr; } }

/* ---------- phone ---------- */
@media (max-width: 575px) {
  .fs-header { gap: 10px; padding-top: 12px; padding-bottom: 12px; }
  .fs-greeting { min-width: 0; }
  .fs-greeting h1 { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .fs-greeting p { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .fs-header-right { gap: 8px; }
  .fs-btn#optimize-btn { width: 38px; padding: 0; justify-content: center; }
  .fs-content { padding-top: 0; }
  .fs-card { padding: 14px; border-radius: 14px; }
  .fs-calendar-card { padding: 12px 8px 4px 4px; }
  .fs-now { padding: 16px; }
  .fs-now .row1 { margin: 10px 0 12px; }
  .fs-now .big { font-size: 30px; }
  .fs-stats { gap: 8px; }
  .fs-stat { padding: 10px 4px; border-radius: 12px; }
  .fs-stat b { font-size: 15px; }
  .fc .fc-toolbar.fc-header-toolbar { flex-direction: column; align-items: stretch; gap: 10px; padding-left: 8px; }
  .fc .fc-toolbar-title { font-size: 17px; }
  .fc .fc-toolbar-chunk:last-child { display: flex; justify-content: space-between; }
  .fc .fc-button { padding: 6px 9px; font-size: 12px; }
  .fc .fc-toolbar-chunk:last-child > .fc-button-group:last-child { margin-left: 8px; }
  .fc .fc-timegrid-slot-label-cushion { padding-right: 6px; }
  .fs-field-row { grid-template-columns: 1fr; gap: 0; }
  .fs-modal { padding: 20px; border-radius: 18px; }
  .fs-modal-actions { flex-wrap: wrap; }
  .fs-toasts { left: 16px; right: 16px; bottom: 16px; }
  .fs-toast { max-width: none; }
  /* no hover on touch: keep delete buttons visible */
  .fs-task .del, .fs-routine .del, .fs-cd .del, .fs-goal .why button { opacity: 0.6; }
}

/* ---------- toasts ---------- */
.fs-toasts { position: fixed; right: 20px; bottom: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.fs-toast { display: flex; align-items: center; gap: 10px; background: #171a26; color: #fff; padding: 12px 16px; border-radius: 12px; max-width: 340px; font-size: 14px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3); animation: fs-in 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.2); }
.darkTheme .fs-toast { background: #2a2f3d; }
.fs-toast i { color: var(--accent-2); font-size: 16px; }
@keyframes fs-in { from { transform: translateY(12px) scale(0.97); opacity: 0; } }

/* ---------- sign-in page ---------- */
.fs-login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.fs-login { width: 100%; max-width: 380px; }
.fs-login .fs-brand { justify-content: center; padding-bottom: 20px; font-size: 20px; }
.fs-login .fs-card { padding: 28px; }
.fs-login h1 { font-size: 22px; font-weight: 700; margin: 0 0 4px; letter-spacing: -0.01em; }
.fs-login-error { color: #ef4444; font-size: 13px; min-height: 18px; margin: -4px 0 10px; }
.fs-login code { background: var(--surface-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; color: var(--text); }

/* ---------- account panel ---------- */
.fs-account-section + .fs-account-section { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.fs-token-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 14px; }
.fs-token-row + .fs-token-row { border-top: 1px solid var(--line); }
.fs-token-row .grow { flex: 1; min-width: 0; }
.fs-token-row .m { font-size: 12px; color: var(--muted); }
.fs-secret { font-family: ui-monospace, monospace; font-size: 13px; word-break: break-all; background: var(--surface-2); border: 1px dashed var(--accent); border-radius: 10px; padding: 10px 12px; margin: 10px 0 0; }
.fs-user-chip { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin: 0 0 12px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 13px; color: var(--muted); }
.fs-user-chip b { color: var(--text); }
.fs-avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 13px; text-transform: uppercase; }
.fs-modal code, .fs-login code { background: var(--surface-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; color: var(--text); font-size: 12px; }

/* ---------- tracking: review card ---------- */
.fs-review { border-color: color-mix(in srgb, #fab219 35%, var(--line)); }
.fs-review .fs-card-head h2 i { color: #fab219; }
.fs-review-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; transition: opacity 0.2s, transform 0.2s; }
.fs-review-row + .fs-review-row { border-top: 1px solid var(--line); }
.fs-review-row.leaving { opacity: 0; transform: translateX(8px); }
.fs-review-row .grow { flex: 1; min-width: 0; }
.fs-review-row .t { font-size: 14px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fs-review-row .m { font-size: 12px; color: var(--muted); }
.fs-mark { width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); display: grid; place-items: center; transition: all 0.15s; flex-shrink: 0; }
.fs-mark.ok:hover { background: #0ca30c; border-color: #0ca30c; color: #fff; }
.fs-mark.no:hover { background: #d03b3b; border-color: #d03b3b; color: #fff; }

/* ---------- progress view ---------- */
.fs-progress { padding: 26px; }
.fs-progress-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.fs-progress-head > div:first-child { flex: 1; }
.fs-kpis { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.fs-kpi { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.fs-kpi span { font-size: 12px; color: var(--muted); font-weight: 600; }
.fs-kpi b { font-size: 26px; font-weight: 700; color: var(--text); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.fs-kpi.hero b { font-size: 48px; letter-spacing: -0.03em; }
.fs-kpi small { font-size: 12px; color: var(--faint); }
.fs-chart-card { border: 1px solid var(--line); border-radius: 14px; padding: 16px 16px 12px; margin-bottom: 16px; }
.fs-chart-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.fs-chart-title h4 { font-size: 14px; font-weight: 650; margin: 0; }
.fs-chart-title .fs-muted { font-size: 12px; }
.fs-progress-grid { display: grid; grid-template-columns: 1fr 1.25fr; gap: 16px; }
.fs-progress-grid .fs-chart-card { margin-bottom: 0; }
@media (max-width: 900px) { .fs-kpis { grid-template-columns: 1fr 1fr; } .fs-kpi.hero { grid-column: span 2; } .fs-progress-grid { grid-template-columns: 1fr; } }

.fs-chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.fs-chart .grid { stroke: var(--line); stroke-width: 1; }
.fs-chart .axis { fill: var(--faint); font-size: 11px; font-variant-numeric: tabular-nums; }
.fs-chart .axis.today { fill: var(--text); font-weight: 700; }
.fs-chart .cap { fill: var(--text); font-size: 11px; font-weight: 700; }
.fs-chart .col { fill: var(--accent); transition: opacity 0.15s; }
.fs-chart .none { stroke: var(--faint); stroke-width: 2; stroke-linecap: round; }
.fs-chart .hit { fill: transparent; cursor: default; }
.fs-chart .colg.hover .hit { fill: var(--accent-soft); }
.fs-chart svg:hover .col { opacity: 0.55; }
.fs-chart svg:hover .colg.hover .col { opacity: 1; }

.fs-catbar { display: grid; grid-template-columns: 96px 1fr 44px; align-items: center; gap: 10px; padding: 6px 0; font-size: 13px; }
.fs-catbar .lbl { display: flex; align-items: center; gap: 7px; color: var(--text); }
.fs-catbar .lbl i { width: 8px; height: 8px; border-radius: 3px; background: var(--cat); flex-shrink: 0; }
.fs-catbar .track { height: 10px; background: var(--surface-2); border-radius: 0 5px 5px 0; overflow: hidden; }
.fs-catbar .fill { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.fs-catbar .val { text-align: right; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.fs-catbar:hover .fill { filter: brightness(1.1); }

.fs-status-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); margin: -2px 0 10px; }
.fs-status-legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.fs-routine-track { display: grid; grid-template-columns: 44px 1fr auto 96px; align-items: center; gap: 10px; padding: 7px 0; font-size: 13px; }
.fs-routine-track + .fs-routine-track { border-top: 1px solid var(--line); }
.fs-routine-track .tm { font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.fs-routine-track .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fs-routine-track .chips { display: flex; gap: 4px; }
.fs-routine-track .streak { text-align: right; font-size: 12px; color: var(--muted); }
.fs-routine-track .streak b { color: var(--text); font-size: 14px; }
.st { width: 20px; height: 20px; border-radius: 6px; display: inline-grid; place-items: center; font-size: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--faint); }
.st.done { background: #0ca30c; border-color: #0ca30c; color: #fff; }
.st.skipped { background: #d03b3b; border-color: #d03b3b; color: #fff; }
.st.missed { background: #fab219; border-color: #fab219; color: #1a1a19; font-weight: 800; font-size: 11px; }
.st.upcoming { border-style: dashed; }
.st.none { opacity: 0.4; }

.fs-table-toggle summary { font-size: 12px; color: var(--muted); cursor: pointer; margin-top: 6px; }
.fs-table { width: 100%; font-size: 12px; margin-top: 8px; border-collapse: collapse; color: var(--text); font-variant-numeric: tabular-nums; }
.fs-table th, .fs-table td { padding: 5px 8px; border-bottom: 1px solid var(--line); text-align: right; }
.fs-table th:first-child, .fs-table td:first-child { text-align: left; }
.fs-table th { color: var(--muted); font-weight: 600; }

.fs-tooltip {
  position: fixed; left: 0; top: 0; z-index: 3000; pointer-events: none; max-width: 280px;
  background: #171a26; color: #fff; font-size: 12px; line-height: 1.45; padding: 8px 10px; border-radius: 9px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}
.darkTheme .fs-tooltip { background: #2a2f3d; }
.fs-tooltip b { font-weight: 700; }
@media (max-width: 575px) {
  .fs-progress { padding: 18px; }
  .fs-routine-track { grid-template-columns: 40px 1fr 70px; }
  .fs-routine-track .chips { grid-column: 1 / -1; order: 5; }
  .fs-catbar { grid-template-columns: 80px 1fr 40px; }
}

/* week view: narrow columns get a smaller check */
.fc-timeGridWeek-view .fs-ev-check { width: 16px; height: 16px; font-size: 8px; }
.fc-timeGridWeek-view .fs-ev.compact .fs-ev-time { display: none; }
.fs-review .fs-link.more { display: block; margin: 8px auto 0; }
