/* Светлая тема и переключатель темы. Подключается после остальных стилей. */

/* ---------- переключатель в шапке ---------- */
.theme-switch { display: inline-flex; flex: none; gap: 2px; padding: 3px; border: 1px solid var(--control); border-radius: 999px; background: var(--surface); }
.theme-switch button { display: grid; place-items: center; width: 30px; height: 28px; padding: 0; border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; transition: background-color var(--t-hover) ease, color var(--t-hover) ease; }
.theme-switch button:hover { color: var(--text); background: var(--raised); }
.theme-switch button[aria-checked="true"] { color: var(--text); background: var(--raised); box-shadow: inset 0 0 0 1px var(--control); }
.theme-switch svg, .theme-option-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.theme-switch .theme-fill, .theme-option-icon .theme-fill { fill: currentColor; stroke: none; }
.title-row .theme-switch { margin-left: auto; align-self: flex-end; }
.theme-cycle { display: none; }
@media (max-width: 860px) {
  .title-row { flex-wrap: wrap; }
  .title-row .title-group { flex: 1 1 0; }
  .title-row .title-group > div { min-width: 0; }
  .title-row .theme-switch { display: none; }
  .theme-cycle { display: inline-grid; place-items: center; flex: none; width: 38px; height: 38px; margin-top: 4px; padding: 0; border: 1px solid var(--control); border-radius: var(--radius-control); background: var(--surface); color: var(--text); cursor: pointer; }
  .theme-cycle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
  .theme-cycle .theme-fill { fill: currentColor; stroke: none; }
  .title-row h1 { overflow-wrap: break-word; hyphens: auto; }
  :root[data-theme="light"] .sidebar:not(.open) { box-shadow: none; }
}
@media (max-width: 400px) { .title-row h1 { font-size: 21px; } }

/* ---------- настройки оформления ---------- */
.theme-options { display: grid; gap: 10px; margin: 18px 0 24px; }
.theme-option { display: flex; align-items: center; gap: 14px; min-width: 0; padding: 14px 16px; border: 1px solid var(--border); border-radius: 14px; cursor: pointer; }
.theme-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.theme-option input { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.theme-option-icon { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 10px; background: var(--raised); color: var(--text); }
.theme-option-icon svg { width: 20px; height: 20px; }
.theme-option strong { display: block; font-weight: 500; }
.theme-option small { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; line-height: 16px; }
.theme-hours h3 { font-size: 14px; font-weight: 500; margin-bottom: 12px; }
.theme-hours-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 180px)); gap: 12px; }
.theme-hours .field { display: grid; gap: 6px; min-width: 0; }
.theme-hours .field span { color: var(--muted); font-size: 12px; }
.theme-hours .input { width: 100%; min-width: 0; }
.theme-hours .field-error:empty { display: none; }
.theme-hours .btn { margin-top: 14px; }
.theme-settings #themeStatus { margin-top: 18px; }
@media (max-width: 640px) { .theme-hours-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .theme-hours .btn { width: 100%; } }

/* ---------- сообщение о существующей компании ---------- */
.cc-error .cc-error-open { margin-top: 10px; color: var(--text); }
.cc-legal-name { color: var(--text) !important; opacity: .86; }

/* ---------- светлая палитра ---------- */
:root[data-theme="light"] {
  color-scheme: light;
  --ground: #f4f4f6;
  --surface: rgba(255, 255, 255, 0.92);
  --raised: rgba(0, 0, 0, 0.055);
  --active: rgba(0, 0, 0, 0.065);
  --border: #dcdce2;
  --rule: rgba(0, 0, 0, 0.09);
  --control: rgba(0, 0, 0, 0.16);
  --text: #1d1d1f;
  --muted: #5c5c66;
  --faint: #6b6b74;
  --overlay-surface: rgba(255, 255, 255, 0.97);
  --hover-primary: #2a58b8;

  --accent: #2f6be0;
  --accent-soft: rgba(47, 107, 224, 0.09);
  --accent-track: rgba(47, 107, 224, 0.18);
  --accent-ink: #1f56c2;

  --primary: #3465c9;
  --primary-ink: #ffffff;

  --positive: #18804a;
  --negative: #c9303d;
  --warning: #93630a;

  --pill-positive-bg: rgba(24, 128, 74, 0.10); --pill-positive-ink: #146b3e;
  --pill-negative-bg: rgba(201, 48, 61, 0.10); --pill-negative-ink: #b32733;
  --pill-warning-bg: rgba(147, 99, 10, 0.12); --pill-warning-ink: #7d5306;
  --pill-neutral-bg: rgba(0, 0, 0, 0.06); --pill-neutral-ink: #45454d;
  --pill-accent-bg: rgba(47, 107, 224, 0.11); --pill-accent-ink: #1f56c2;
}
:root[data-theme="light"] .sidebar { background: rgba(255, 255, 255, 0.78); }
:root[data-theme="light"] .qa { color: var(--muted); }
:root[data-theme="light"] .task:hover, :root[data-theme="light"] .inv-row:hover, :root[data-theme="light"] .pay-row:hover, :root[data-theme="light"] .advice:hover { background: rgba(0, 0, 0, 0.03); }
:root[data-theme="light"] .overlay { background: rgba(20, 20, 24, 0.35); }
:root[data-theme="light"] .scrim { background: rgba(20, 20, 24, 0.28); }
:root[data-theme="light"] .calc-product-list { background: #ffffff; }
:root[data-theme="light"] .settings-card, :root[data-theme="light"] .card { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04); }
@media (max-width: 860px) { :root[data-theme="light"] .sidebar { background: var(--overlay-surface); } }

/* клиенты */
:root[data-theme="light"] .cc-dialog { background: #ffffff; }
:root[data-theme="light"] .cc-dialog::backdrop { background: rgba(20, 20, 24, 0.35); }
:root[data-theme="light"] .cc-field select { background-color: #ffffff; }
:root[data-theme="light"] .cc-big-messenger, :root[data-theme="light"] .cc-import-state, :root[data-theme="light"] .cc-file { background: rgba(0, 0, 0, 0.02); }
:root[data-theme="light"] .cc-tabs button[aria-current] { background: var(--accent-soft); }
:root[data-theme="light"] .cc-status.is-warning { color: var(--warning); }
:root[data-theme="light"] .cc-avatar { background: var(--accent-soft); border-color: rgba(47, 107, 224, 0.2); }

/* настройки */
:root[data-theme="light"] .channel-icon { color: var(--muted); }
:root[data-theme="light"] .sipuni-avatar { background: #e2ebfc; color: #1f56c2; }
:root[data-theme="light"] .sipuni-pending { border-color: #b9b9c2; }
:root[data-theme="light"] .sipuni-guide summary, :root[data-theme="light"] .sipuni-guide a, :root[data-theme="light"] .tg-policy-link { color: var(--accent-ink); }
:root[data-theme="light"] .tg-mode:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
:root[data-theme="light"] .tg-consent { border-left-color: var(--accent); }
:root[data-theme="light"] .tg-preview { background: var(--accent-soft); border-color: #c4d3ef; }
:root[data-theme="light"] .security-switch { background: rgba(0, 0, 0, 0.03); }
:root[data-theme="light"] .pw-eye:hover, :root[data-theme="light"] .pw-eye[aria-pressed="true"] { background: rgba(0, 0, 0, 0.06); }
:root[data-theme="light"] .auth-mock-badge, :root[data-theme="light"] .auth-email-password { color: var(--accent-ink); }
:root[data-theme="light"] .auth-provider-icon, :root[data-theme="light"] .auth-chevron { color: var(--accent-ink); }
:root[data-theme="light"] .auth-email-warning, :root[data-theme="light"] .security-temporary-notice { color: #7d5306; }
:root[data-theme="light"] .security-recovery-link { color: var(--accent-ink); }

/* рабочее пространство и отчёты */
:root[data-theme="light"] .person-avatar { color: var(--accent-ink); }
:root[data-theme="light"] .chat-message.own { background: rgba(47, 107, 224, 0.1); }
