/* Небольшие правки поверх Tailwind (подключён через CDN в index.html).
   Палитра и радиусы подобраны по образцу Fresha (референс от владельца). */

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

input, select, textarea {
  outline: none;
}

table th, table td {
  vertical-align: top;
}

/* Перекраска flatpickr (используется для выбора периода дат) под акцент
   и скругления проекта вместо стандартной темы библиотеки. */
.flatpickr-calendar {
  font-family: inherit;
  border-radius: 1rem;
  box-shadow: 0 10px 25px -5px rgb(0 0 0 / 0.15);
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
  background: #7c3aed;
  border-color: #7c3aed;
}

.flatpickr-day.inRange {
  background: #ede9fe;
  border-color: #ede9fe;
  box-shadow: -5px 0 0 #ede9fe, 5px 0 0 #ede9fe;
}

.flatpickr-day:hover {
  background: #f5f3ff;
}

/* ===== Owner dashboard (2026-07-09) — ported from
   docs/superpowers/mockups/2026-07-06-owner-dashboard-mockup.html.
   Scoped under #owner-view so these class names/custom properties never
   touch the Tailwind-based rest of the app. ===== */

#owner-view {
  --page: #f4f2fb; --sidebar: #ffffff; --surface: #ffffff; --surface-2: #f6f4fc;
  --ink: #1e1b2e; --ink-2: #6b6780; --ink-muted: #9995ab; --border: rgba(30,27,46,0.08);
  --accent: #7c3aed; --accent-ink: #6425d0; --accent-soft: #f2ecfe; --accent-2: #a78bfa;
  --good: #16a34a; --bad: #e11d48; --good-bg: rgba(22,163,74,0.12); --bad-bg: rgba(225,29,72,0.12);
  --track: #eae6f6; --neutral-bg: rgba(107,98,89,0.10);
  --c-income: #7c3aed; --c-expense: #f59e0b; --c-wages: #0ea5e9; --c-admin: #ec4899;
  --shadow: 0 1px 2px rgba(30,27,46,0.05), 0 10px 30px -18px rgba(30,27,46,0.35);
  --shadow-pop: 0 12px 32px -12px rgba(30,27,46,0.35), 0 2px 8px rgba(30,27,46,0.08);
  color-scheme: light;
  background: var(--page); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
/* #owner-view is an ID selector (specificity 1,0,0) — it would beat
   Tailwind's ".hidden{display:none}" (specificity 0,1,0) and stay visible
   forever if display were set directly on #owner-view. Scoping the flex
   layout to :not(.hidden) keeps the show/hide toggle in app.js
   (classList.add/remove('hidden')) working exactly like every other
   top-level view section. */
#owner-view:not(.hidden) { display: flex; height: 100vh; overflow: hidden; }

@media (prefers-color-scheme: dark) {
  #owner-view {
    --page: #16141f; --sidebar: #1c1929; --surface: #1c1929; --surface-2: #241f36;
    --ink: #f1eef9; --ink-2: #b9b3cf; --ink-muted: #857f9c; --border: rgba(255,255,255,0.08);
    --accent: #a78bfa; --accent-ink: #c4b1fb; --accent-soft: #2c2645; --accent-2: #8b6ff0;
    --good: #34d374; --bad: #fb5273; --good-bg: rgba(52,211,116,0.16); --bad-bg: rgba(251,82,115,0.16);
    --track: #2c2645; --neutral-bg: rgba(201,188,172,0.12);
    --c-wages: #38bdf8; --c-admin: #f472b6;
    --shadow: 0 1px 0 rgba(0,0,0,0.4), 0 14px 32px -18px rgba(0,0,0,0.7);
    --shadow-pop: 0 16px 36px -12px rgba(0,0,0,0.6), 0 2px 8px rgba(0,0,0,0.4);
    color-scheme: dark;
  }
}

#owner-view aside {
  width: 232px; flex-shrink: 0; background: var(--sidebar);
  border-right: 1px solid var(--border); padding: 1.4rem 1rem;
  display: flex; flex-direction: column; gap: 1.75rem;
  height: 100%; overflow-y: auto;
}
@media (max-width: 880px) { #owner-view aside { display: none; } }

#owner-view .brand { display: flex; align-items: center; gap: 0.6rem; padding: 0 0.35rem; }
#owner-view .brand-mark {
  width: 72px; height: 72px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
}
#owner-view .brand-name { font-weight: 700; font-size: 0.95rem; }

#owner-view .nav-group { display: flex; flex-direction: column; gap: 0.15rem; }
#owner-view .nav-label {
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.08em; color: var(--ink-muted);
  text-transform: uppercase; padding: 0.4rem 0.6rem 0.3rem;
}
#owner-view .nav-item {
  display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 0.6rem; border-radius: 10px;
  font-size: 0.85rem; color: var(--ink-2); text-decoration: none; background: transparent; border: none;
  font: inherit; cursor: pointer; width: 100%; text-align: left;
}
#owner-view .nav-item:hover { background: var(--surface-2); color: var(--ink); }
#owner-view .nav-item.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
#owner-view .sidebar-foot { margin-top: auto; }

#owner-view .nav-icon {
  width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; transition: transform 0.15s ease;
}
#owner-view .nav-item:hover .nav-icon { transform: scale(1.06); }
#owner-view .nav-icon-dashboard    { background: rgba(124,58,237,0.14); color: #7c3aed; }
#owner-view .nav-icon-visits       { background: rgba(20,184,166,0.14); color: #14b8a6; }
#owner-view .nav-icon-expenses     { background: rgba(245,158,11,0.16); color: #d97706; }
#owner-view .nav-icon-packages     { background: rgba(59,130,246,0.14); color: #3b82f6; }
#owner-view .nav-icon-certificates { background: rgba(244,63,94,0.14); color: #f43f5e; }
#owner-view .nav-icon-logout       { background: var(--neutral-bg); color: var(--ink-muted); }

#owner-view > main { flex: 1; min-width: 0; height: 100%; overflow-y: auto; padding: 2rem 2.25rem 3rem; }
#owner-view .wrap { max-width: 1040px; }

#owner-view header.page-head {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start;
  gap: 1rem; margin-bottom: 1.25rem;
}
#owner-view h1 { font-size: 1.5rem; margin: 0 0 0.3rem; letter-spacing: -0.01em; }
#owner-view .page-head p { margin: 0; color: var(--ink-2); font-size: 0.88rem; }

#owner-view .period-control { position: relative; }
#owner-view .segmented {
  display: flex; align-items: center; gap: 0.2rem; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 12px; padding: 0.22rem; box-shadow: var(--shadow);
}
#owner-view .seg-btn {
  font: inherit; font-size: 0.82rem; font-weight: 600; color: var(--ink-2); background: transparent;
  border: none; padding: 0.5rem 0.85rem; border-radius: 9px; cursor: pointer; white-space: nowrap;
  display: flex; align-items: center; gap: 0.35rem;
}
#owner-view .seg-btn:hover { color: var(--ink); }
#owner-view .seg-btn[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
#owner-view .seg-more .chev { font-size: 0.65rem; color: var(--ink-muted); transition: transform 0.15s ease; }
#owner-view .seg-more[aria-expanded="true"] .chev { transform: rotate(180deg); }

#owner-view .period-pop {
  position: absolute; top: calc(100% + 8px); right: 0; width: 280px; z-index: 20;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow-pop); padding: 0.5rem; display: none;
}
#owner-view .period-pop.open { display: block; }

#owner-view .preset-row {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; width: 100%;
  font: inherit; font-size: 0.85rem; color: var(--ink); background: transparent; border: none;
  padding: 0.55rem 0.65rem; border-radius: 10px; cursor: pointer; text-align: left;
}
#owner-view .preset-row:hover { background: var(--surface-2); }
#owner-view .preset-row .name { display: flex; flex-direction: column; gap: 0.1rem; }

#owner-view .pop-divider { height: 1px; background: var(--border); margin: 0.4rem 0.2rem; }

#owner-view .custom-block { padding: 0.3rem 0.65rem 0.5rem; }
#owner-view .custom-block .lbl {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-muted); margin: 0 0 0.5rem;
}
#owner-view .custom-dates { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.6rem; }
#owner-view .custom-dates input[type="date"] {
  font: inherit; font-size: 0.8rem; color: var(--ink); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 8px; padding: 0.4rem 0.45rem; width: 100%;
  color-scheme: inherit;
}
#owner-view .custom-dates span { color: var(--ink-muted); font-size: 0.78rem; flex-shrink: 0; }
#owner-view .custom-apply {
  width: 100%; font: inherit; font-size: 0.83rem; font-weight: 600; color: #fff; background: var(--accent);
  border: none; border-radius: 9px; padding: 0.5rem; cursor: pointer;
}
#owner-view .custom-apply:hover { background: var(--accent-ink); }

#owner-view .freshness {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 0.9rem 1.1rem 1.15rem; margin-bottom: 1.5rem; box-shadow: var(--shadow);
}
#owner-view .freshness-top {
  display: flex; justify-content: space-between; align-items: baseline;
  flex-wrap: wrap; gap: 0.4rem; margin-bottom: 2rem;
}
#owner-view .freshness-top .lead { font-size: 0.85rem; }
#owner-view .freshness-top .lead strong { font-variant-numeric: tabular-nums; }
#owner-view .freshness-top .note { font-size: 0.76rem; color: var(--ink-muted); }
#owner-view .freshness-track { position: relative; height: 10px; border-radius: 999px; background: var(--track); margin: 0 2rem; }
#owner-view .freshness-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--good), #4ade80); transition: width 0.25s ease; }
#owner-view .freshness-marker { position: absolute; top: -7px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 2px; transition: left 0.25s ease; }
#owner-view .freshness-marker .pin { width: 3px; height: 24px; border-radius: 2px; background: var(--ink); opacity: 0.55; }
#owner-view .freshness-marker .day-label { position: absolute; top: -20px; font-size: 0.68rem; font-weight: 700; color: var(--ink-2); white-space: nowrap; }

#owner-view .row { display: grid; gap: 1rem; margin-bottom: 1rem; }
#owner-view .row-2 { grid-template-columns: repeat(2, 1fr); }
#owner-view .row-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { #owner-view .row-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 720px) { #owner-view .row-2 { grid-template-columns: 1fr; } }
@media (max-width: 480px) { #owner-view .row-3 { grid-template-columns: 1fr; } }

#owner-view .card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 0.65rem;
}
#owner-view .card.hero { background: linear-gradient(150deg, var(--accent), var(--accent-2)); color: #fff; border: none; }
#owner-view .card.hero .stat-label { color: rgba(255,255,255,0.78); }
#owner-view .card.hero .stat-sub { color: rgba(255,255,255,0.72); }

#owner-view .stat-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.6rem; }
#owner-view .stat-label { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-muted); margin: 0; }
#owner-view .stat-badge {
  font-size: 0.74rem; font-weight: 700; padding: 0.15rem 0.55rem; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 0.25rem; white-space: nowrap;
}
#owner-view .stat-badge.good { color: var(--good); background: var(--good-bg); }
#owner-view .stat-badge.neutral { color: var(--ink-muted); background: var(--neutral-bg); }
#owner-view .card.hero .stat-badge.good { color: #fff; background: rgba(255,255,255,0.22); }
#owner-view .card.hero .stat-badge.neutral { color: rgba(255,255,255,0.85); background: rgba(255,255,255,0.18); }

#owner-view .stat-figure { font-size: 2.1rem; font-weight: 700; line-height: 1; margin: 0.15rem 0 0; font-variant-numeric: tabular-nums; }
#owner-view .stat-sub { font-size: 0.78rem; color: var(--ink-muted); margin: 0; }
#owner-view .card.hero .stat-sub { color: rgba(255,255,255,0.72); }

#owner-view .card.donut { gap: 0.9rem; }
#owner-view .donut-head { min-height: 4.5rem; }
#owner-view .donut-head h3 { font-size: 0.95rem; margin: 0 0 0.15rem; }
#owner-view .donut-head p { margin: 0; font-size: 0.78rem; color: var(--ink-muted); }
#owner-view .acct-badge { margin-top: 0.4rem; }
#owner-view .acct-note { width: 100%; margin: 0.2rem 0 0; font-size: 0.74rem; color: var(--ink-muted); line-height: 1.5; }
#owner-view .donut-body { display: flex; align-items: center; gap: 1.4rem; flex-wrap: wrap; width: 100%; }
#owner-view .donut-chart { position: relative; flex-shrink: 0; width: 168px; height: 168px; }
#owner-view .donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 0.4rem; }
#owner-view .donut-center .val { font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; white-space: nowrap; } /* font-size задаётся из donutChart.js:centerValueFontSize() */
#owner-view .donut-center .lbl { font-size: 0.62rem; color: var(--ink-muted); margin-top: 0.2rem; max-width: 92px; line-height: 1.25; }

#owner-view .legend { display: flex; flex-direction: column; gap: 0.5rem; flex: 1; min-width: 150px; }
#owner-view .legend-row { display: flex; align-items: center; gap: 0.55rem; font-size: 0.8rem; }
#owner-view .legend-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
#owner-view .legend-name { flex: 1; color: var(--ink-2); }
#owner-view .legend-val { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 5.6rem; text-align: right; }
#owner-view .legend-pct { color: var(--ink-muted); font-size: 0.76rem; width: 2.6rem; text-align: right; font-variant-numeric: tabular-nums; }

#owner-view .board-list { display: flex; flex-direction: column; gap: 0.65rem; width: 100%; }
#owner-view .board-row { display: flex; align-items: center; gap: 0.7rem; }
#owner-view .board-rank { font-size: 0.75rem; color: var(--ink-muted); width: 1.1rem; flex-shrink: 0; font-variant-numeric: tabular-nums; }
#owner-view .board-avatar {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  object-fit: cover;
}
#owner-view .board-avatar-fallback {
  background: var(--accent-soft); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center; font-size: 0.85rem; font-weight: 700;
}
#owner-view .board-info { flex: 1; min-width: 0; }
#owner-view .board-name-row { display: flex; justify-content: space-between; gap: 0.5rem; font-size: 0.83rem; margin-bottom: 0.3rem; }
#owner-view .board-name { color: var(--ink); font-weight: 600; }
#owner-view .board-count { color: var(--ink-2); font-variant-numeric: tabular-nums; }
#owner-view .board-bar-track { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
#owner-view .board-bar-fill { height: 100%; border-radius: 999px; background: var(--accent); transition: width 0.25s ease; }

#owner-view .seg-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#owner-view .custom-dates input[type="date"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
#owner-view .custom-apply:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
