/* HairDesk — оформление. Мобильный-first, тёмная тема автоматически. */

:root {
  --bg: #f5f4fb;
  --surface: #ffffff;
  --surface-2: #f0eefb;
  --text: #1b1a2b;
  --muted: #6f6c85;
  --border: #e3e0f0;
  --accent: #6d4aff;
  --accent-soft: #efeaff;
  --accent-text: #ffffff;
  --income: #109c5e;
  --income-soft: #e6f7ee;
  --expense: #d9414b;
  --expense-soft: #fdecec;
  --warn: #c07b17;
  --warn-soft: #fdf3e2;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 6px 24px rgba(27, 26, 43, 0.08);
  --shadow-sm: 0 2px 8px rgba(27, 26, 43, 0.06);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121120;
    --surface: #1c1b2e;
    --surface-2: #262440;
    --text: #f1efff;
    --muted: #a5a2c0;
    --border: #302d4d;
    --accent: #9a7dff;
    --accent-soft: #2a2450;
    --accent-text: #16142a;
    --income: #3ddc97;
    --income-soft: #17342a;
    --expense: #ff7b83;
    --expense-soft: #3a1f26;
    --warn: #f0b458;
    --warn-soft: #3a2f1c;
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body.no-scroll {
  overflow: hidden;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.25;
  font-weight: 650;
}

h1 {
  font-size: 1.35rem;
}

h2 {
  font-size: 1.1rem;
}

h3 {
  font-size: 1rem;
}

p {
  margin: 0.4em 0;
}

a {
  color: var(--accent);
  text-decoration: none;
}

code {
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  font-size: 0.9em;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.82rem;
}

.pos {
  color: var(--income);
}

.neg {
  color: var(--expense);
}

.full {
  width: 100%;
  justify-content: center;
}

/* ------------------------------- загрузка -------------------------------- */

.boot-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.boot-logo {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--accent);
}

/* -------------------------------- оболочка ------------------------------- */

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(10px + var(--safe-top)) 14px 10px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-name {
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--accent);
}

.topbar-title {
  flex: 1;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  gap: 6px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--surface-2);
}

.outlet {
  flex: 1;
  padding: 14px 14px calc(96px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}

.offline-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 0.85rem;
  justify-content: center;
}

.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  justify-content: space-around;
  align-items: center;
  gap: 2px;
  padding: 6px 4px calc(6px + var(--safe-bottom));
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 2px;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 550;
  border-radius: 12px;
  cursor: pointer;
}

.tab.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.tab-fab {
  flex: 0 0 auto;
  padding: 0 6px;
}

.fab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow);
  margin-top: -18px;
}

@media (min-width: 960px) {
  .app-shell {
    display: grid;
    grid-template-columns: 232px 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas: 'side top' 'side main';
    min-height: 100vh;
  }

  .topbar {
    grid-area: top;
    padding-left: 20px;
  }

  .tabbar {
    grid-area: side;
    position: sticky;
    top: 0;
    height: 100vh;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    gap: 6px;
    padding: 18px 12px;
    border-top: none;
    border-right: 1px solid var(--border);
  }

  .tab {
    flex: 0 0 auto;
    flex-direction: row;
    justify-content: flex-start;
    gap: 10px;
    font-size: 0.95rem;
    padding: 11px 14px;
  }

  .tab-fab {
    order: -1;
    margin-bottom: 8px;
  }

  .fab {
    width: auto;
    height: auto;
    border-radius: 14px;
    padding: 12px 16px;
    margin: 0;
    gap: 10px;
  }

  .outlet {
    grid-area: main;
    padding-bottom: 40px;
  }

  .topbar-brand .icon-btn {
    display: none;
  }
}

/* --------------------------------- шапка --------------------------------- */

.view-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  justify-content: space-between;
}

.view-head h1 {
  font-size: 1.5rem;
}

.view-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.client-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ------------------------------- карточки -------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.card-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.error-card {
  border-color: var(--expense);
}

.two-col {
  display: grid;
  gap: 14px;
}

@media (min-width: 820px) {
  .two-col {
    grid-template-columns: 1fr 1fr;
  }
}

/* -------------------------------- кнопки --------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 15px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 560;
  cursor: pointer;
  transition: transform 0.06s ease, background 0.15s ease;
  white-space: nowrap;
}

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

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

.btn.ghost {
  background: transparent;
  border-color: var(--border);
}

.btn.ghost:hover {
  background: var(--surface-2);
}

.btn.danger {
  background: var(--expense);
  border-color: var(--expense);
  color: #fff;
}

.btn.danger.ghost {
  background: transparent;
  color: var(--expense);
  border-color: color-mix(in srgb, var(--expense) 40%, transparent);
}

.btn.small {
  padding: 7px 11px;
  font-size: 0.85rem;
  border-radius: 10px;
}

.btn.big {
  padding: 14px 18px;
  font-size: 1rem;
  width: 100%;
}

.btn:disabled {
  opacity: 0.55;
  cursor: default;
}

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

/* ------------------------------- метрики --------------------------------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  box-shadow: var(--shadow-sm);
}

.stat-label {
  font-size: 0.78rem;
  color: var(--muted);
}

.stat-value {
  font-size: 1.35rem;
  font-weight: 680;
  letter-spacing: -0.02em;
}

.stat-sub {
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.stat-income .stat-value {
  color: var(--income);
}

.stat-expense .stat-value {
  color: var(--expense);
}

.stat-profit .stat-value {
  color: var(--accent);
}

.delta {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 7px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.74rem;
  background: var(--surface-2);
  color: var(--muted);
}

.delta-up {
  background: var(--income-soft);
  color: var(--income);
}

.delta-down {
  background: var(--expense-soft);
  color: var(--expense);
}

.mini-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

.mini-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* -------------------------------- чипсы ---------------------------------- */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.chip-on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.chip-price {
  opacity: 0.75;
  font-size: 0.78rem;
}

/* -------------------------------- бейджи --------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--muted);
  white-space: nowrap;
}

.badge-planned {
  background: var(--accent-soft);
  color: var(--accent);
}

.badge-done {
  background: var(--income-soft);
  color: var(--income);
}

.badge-cancelled,
.badge-noshow {
  background: var(--expense-soft);
  color: var(--expense);
}

.tag {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  background: var(--surface-2);
  color: var(--muted);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 3px;
}

/* -------------------------------- клиенты -------------------------------- */

.client-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 720px) {
  .client-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.client-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.client-card:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.05rem;
}

.client-main {
  min-width: 0;
}

.client-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 620;
}

.client-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  text-align: right;
}

/* ------------------------------ расписание ------------------------------- */

.week-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}

.week-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 8px 2px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 0.72rem;
}

.week-day.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.week-day.today:not(.active) {
  border-color: var(--accent);
}

.week-count {
  font-weight: 700;
  font-size: 0.8rem;
}

.empty-count {
  color: var(--muted);
  font-weight: 400;
}

.week-income {
  font-size: 0.64rem;
  color: var(--income);
}

.week-planned {
  font-size: 0.64rem;
  color: var(--accent);
}

.week-day.active .week-income,
.week-day.active .week-planned {
  color: #fff;
}

.day-nav {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
}

.day-nav .btn {
  flex: 0 0 auto;
}

.appt-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.appt-row {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.appt-planned {
  border-left-color: var(--accent);
}

.appt-done {
  border-left-color: var(--income);
}

.appt-cancelled,
.appt-noshow {
  border-left-color: var(--expense);
  opacity: 0.72;
}

.appt-time {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.appt-time strong {
  font-size: 1rem;
}

.appt-time span {
  font-size: 0.68rem;
  color: var(--muted);
}

.appt-info {
  min-width: 0;
}

.appt-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.appt-note {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--warn);
  margin-top: 2px;
}

.appt-amount {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}

.appt-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

@media (min-width: 640px) {
  .appt-row {
    grid-template-columns: 64px 1fr auto auto auto;
  }

  .appt-actions {
    grid-column: auto;
  }
}

/* -------------------------------- деньги --------------------------------- */

.money-days {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.money-day-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--border);
}

.money-day-totals {
  margin-left: auto;
  display: flex;
  gap: 10px;
  font-weight: 600;
  font-size: 0.88rem;
}

.tx-list {
  display: flex;
  flex-direction: column;
}

.tx-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 9px 2px;
  border-bottom: 1px solid var(--border);
}

.tx-row:last-child {
  border-bottom: none;
}

.tx-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tx-income {
  background: var(--income-soft);
  color: var(--income);
}

.tx-expense {
  background: var(--expense-soft);
  color: var(--expense);
}

.tx-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.tx-note {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.range-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.range-row .field {
  flex: 1 1 140px;
}

.report-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ------------------------------ прогресс/топ ----------------------------- */

.progress {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

.progress-income .progress-fill {
  background: var(--income);
}

.progress-expense .progress-fill {
  background: var(--expense);
}

.breakdown {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.breakdown-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
}

.breakdown-icon {
  color: var(--muted);
}

.breakdown-label {
  font-size: 0.9rem;
}

.breakdown-value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.breakdown-row .progress {
  grid-column: 1 / -1;
}

.top-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.top-row {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 10px;
  align-items: center;
}

.top-row.clickable {
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 4px 6px;
}

.top-row.clickable:hover {
  background: var(--surface-2);
}

.top-index {
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

.top-main {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

/* -------------------------------- график --------------------------------- */

.chart {
  width: 100%;
  height: auto;
  max-height: 220px;
  overflow: visible;
}

.bar-income {
  fill: var(--accent);
}

.bar-expense {
  fill: color-mix(in srgb, var(--expense) 55%, transparent);
}

.chart-label {
  fill: var(--muted);
  font-size: 11px;
}

.chart-value {
  fill: var(--text);
  font-size: 10px;
  font-weight: 600;
}

.legend {
  display: flex;
  gap: 14px;
  font-size: 0.8rem;
  color: var(--muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  display: inline-block;
}

.dot-income {
  background: var(--accent);
}

.dot-expense {
  background: color-mix(in srgb, var(--expense) 60%, transparent);
}

/* ------------------------------- теплокарта ------------------------------ */

.heatmap {
  display: grid;
  grid-template-columns: 34px repeat(14, minmax(16px, 1fr));
  gap: 2px;
  font-size: 0.68rem;
}

.heat-head,
.heat-corner,
.heat-day {
  color: var(--muted);
  text-align: center;
}

.heat-day {
  text-align: left;
}

.heat-cell {
  aspect-ratio: 1;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  color: transparent;
  font-size: 0.6rem;
}

.heat-1 {
  background: color-mix(in srgb, var(--accent) 25%, var(--surface-2));
}

.heat-2 {
  background: color-mix(in srgb, var(--accent) 45%, var(--surface-2));
}

.heat-3 {
  background: color-mix(in srgb, var(--accent) 70%, var(--surface-2));
  color: #fff;
}

.heat-4 {
  background: var(--accent);
  color: #fff;
}

/* -------------------------------- таблица -------------------------------- */

.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.table th {
  text-align: left;
  color: var(--muted);
  font-weight: 550;
  font-size: 0.8rem;
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 9px 6px;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}

.table tbody tr {
  cursor: pointer;
}

.table tbody tr:hover {
  background: var(--surface-2);
}

/* -------------------------------- таймлайн ------------------------------- */

.timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.timeline-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--border);
}

.timeline-date {
  display: flex;
  flex-direction: column;
}

.timeline-body {
  grid-column: 1 / -1;
  font-size: 0.9rem;
}

.timeline-amount {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}

/* ------------------------------- напоминания ----------------------------- */

.remind-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.remind-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.remind-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.debt-sum {
  color: var(--expense);
  font-weight: 650;
}

/* -------------------------------- быстрые -------------------------------- */

.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.quick {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

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

.quick-sheet {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quick-sheet-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  cursor: pointer;
}

.quick-sheet-row:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

/* -------------------------------- ближайшие ------------------------------ */

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

.upcoming-row {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.upcoming-row.static {
  cursor: default;
}

.upcoming-row:hover {
  border-color: var(--accent);
}

.upcoming-date {
  font-size: 0.78rem;
  color: var(--muted);
  min-width: 72px;
}

.upcoming-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upcoming-sum {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* --------------------------------- формы --------------------------------- */

.form-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

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

.field-label {
  font-size: 0.8rem;
  color: var(--muted);
}

.field-hint {
  font-size: 0.75rem;
  color: var(--muted);
}

.input {
  width: 100%;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  appearance: none;
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

textarea.input {
  resize: vertical;
  min-height: 70px;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}

.checkbox input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: 12px;
  background: var(--surface-2);
  gap: 2px;
}

.segment {
  padding: 8px 14px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 550;
  cursor: pointer;
}

.segment.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.segmented.small .segment {
  padding: 6px 11px;
  font-size: 0.85rem;
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.search-wrap {
  flex: 1 1 220px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
}

.search-wrap .input {
  border: none;
  padding-left: 0;
  background: transparent;
}

.search-wrap .input:focus {
  box-shadow: none;
}

.toolbar select.input {
  flex: 0 0 auto;
  width: auto;
}

/* ------------------------------- прайс/прочее ---------------------------- */

.service-list,
.backup-list {
  display: flex;
  flex-direction: column;
}

.service-row,
.backup-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--border);
}

@media (max-width: 640px) {
  .service-row {
    flex-wrap: wrap;
    row-gap: 4px;
  }

  .service-row .service-main {
    flex: 1 1 100%;
  }

  .service-row .service-price {
    margin-right: auto;
  }
}

.service-row:last-child,
.backup-row:last-child {
  border-bottom: none;
}

.service-row.inactive {
  opacity: 0.6;
}

.service-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.service-price {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.backup-row {
  justify-content: space-between;
  font-size: 0.85rem;
}

.url-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--accent);
  overflow-x: auto;
}

/* ------------------------------- пустое ---------------------------------- */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 26px 10px;
  color: var(--muted);
  text-align: center;
}

.empty.small {
  padding: 16px;
}

.empty-icon {
  color: var(--accent);
  opacity: 0.7;
}

/* ------------------------------- модалки --------------------------------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(15, 14, 28, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  animation: fade 0.15s ease;
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

.modal {
  background: var(--surface);
  width: min(560px, 100%);
  max-height: 92vh;
  border-radius: var(--radius) var(--radius) 0 0;
  display: flex;
  flex-direction: column;
  animation: slide-up 0.2s ease;
}

@keyframes slide-up {
  from {
    transform: translateY(16px);
  }
}

.modal-wide {
  width: min(760px, 100%);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.modal-body {
  padding: 16px;
  overflow-y: auto;
}

.modal-foot {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 16px calc(12px + var(--safe-bottom));
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

@media (min-width: 700px) {
  .overlay {
    align-items: center;
    padding: 24px;
  }

  .modal {
    border-radius: var(--radius);
  }
}

/* -------------------------------- тосты ---------------------------------- */

.toast-host {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(84px + var(--safe-bottom));
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: min(520px, calc(100vw - 24px));
}

.toast {
  background: var(--text);
  color: var(--bg);
  padding: 11px 16px;
  border-radius: 12px;
  font-size: 0.9rem;
  box-shadow: var(--shadow);
  animation: toast-in 0.2s ease;
  text-align: center;
}

.toast-ok {
  background: var(--income);
  color: #fff;
}

.toast-error {
  background: var(--expense);
  color: #fff;
}

.toast-out {
  opacity: 0;
  transition: opacity 0.2s ease;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* --------------------------------- вход ---------------------------------- */

body.auth-mode {
  background: linear-gradient(160deg, var(--accent-soft), var(--bg) 55%);
}

.auth-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px 16px;
}

.auth-card {
  width: min(460px, 100%);
  gap: 14px;
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-weight: 700;
  font-size: 1.05rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 460px;
  font-size: 0.82rem;
  text-align: center;
}

/* -------------------------------- печать --------------------------------- */

@media print {
  .topbar,
  .tabbar,
  .view-actions,
  .toast-host {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  .outlet {
    padding: 0;
  }

  .card {
    box-shadow: none;
    border-color: #ccc;
    break-inside: avoid;
  }
}
