/* Shared appearance controls: collapsible desktop navigation and dark theme. */

.sidebar-collapse-toggle {
  width: 100%;
  min-height: 36px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin-bottom: 7px;
  border: 0;
  border-radius: 10px;
  padding: 0 10px;
  background: transparent;
  color: #8fa3ad;
  text-align: left;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.sidebar-collapse-toggle:hover {
  background: rgba(255,255,255,.07);
  color: #fff;
}

.sidebar-collapse-toggle svg {
  width: 16px;
  height: 16px;
  transform: rotate(180deg);
  transition: transform .18s ease;
}

@media (min-width: 761px) {
  body.sidebar-collapsed:not(.compact-ui) .app-shell {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  body.sidebar-collapsed:not(.compact-ui) .sidebar {
    padding-inline: 10px;
  }

  body.sidebar-collapsed:not(.compact-ui) .brand {
    justify-content: center;
    padding-inline: 0;
  }

  body.sidebar-collapsed:not(.compact-ui) .brand strong,
  body.sidebar-collapsed:not(.compact-ui) .main-nav a span,
  body.sidebar-collapsed:not(.compact-ui) .profile-mini div,
  body.sidebar-collapsed:not(.compact-ui) .profile-mini > svg,
  body.sidebar-collapsed:not(.compact-ui) .sidebar-collapse-toggle span {
    display: none;
  }

  body.sidebar-collapsed:not(.compact-ui) .main-nav a {
    position: relative;
    grid-template-columns: 1fr;
    place-items: center;
    padding: 0;
  }

  body.sidebar-collapsed:not(.compact-ui) .main-nav a svg {
    width: 21px;
    height: 21px;
  }

  body.sidebar-collapsed:not(.compact-ui) .main-nav a em {
    position: absolute;
    top: 3px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border: 2px solid #172530;
    font-size: 8px;
  }

  body.sidebar-collapsed:not(.compact-ui) .sidebar-foot {
    display: grid;
    justify-items: center;
  }

  body.sidebar-collapsed:not(.compact-ui) .sidebar-collapse-toggle {
    width: 40px;
    grid-template-columns: 1fr;
    place-items: center;
    padding: 0;
  }

  body.sidebar-collapsed:not(.compact-ui) .sidebar-collapse-toggle svg {
    transform: rotate(0deg);
  }

  body.sidebar-collapsed:not(.compact-ui) .profile-mini {
    width: 40px;
    justify-content: center;
    padding: 4px;
  }

  body.compact-ui .sidebar-collapse-toggle {
    display: none;
  }
}

html.dark-theme {
  --canvas: #101820;
  --surface: #18242d;
  --surface-soft: #1d2b35;
  --ink: #eaf1f4;
  --muted: #91a1ac;
  --line: #2c3b45;
  --line-strong: #3b4c57;
  --accent: #3ca5aa;
  --accent-soft: #19373b;
  --accent-dark: #78cbd0;
  --danger: #e07772;
  --shadow: 0 20px 58px rgba(0,0,0,.36);
  color-scheme: dark;
  background: var(--canvas);
}

html.dark-theme body {
  background: var(--canvas);
  color: var(--ink);
}

html.dark-theme body * {
  scrollbar-color: #50616b transparent;
}

html.dark-theme body ::selection {
  background: rgba(72,174,180,.38);
  color: #fff;
}

html.dark-theme body :is(input, textarea, select) {
  color: var(--ink);
  caret-color: #8cd7da;
}

html.dark-theme body :is(input, textarea, select)::placeholder {
  color: #71838f;
}

html.dark-theme body .sidebar {
  background: #111d26;
  color: #d7e4e8;
}

html.dark-theme body .main-nav a {
  color: #94a7b1;
}

html.dark-theme body .main-nav a:hover {
  background: rgba(255,255,255,.07);
  color: #f8fbfc;
}

html.dark-theme body .main-nav a.is-active {
  background: #1c3a44;
  color: #fff;
  box-shadow: inset 3px 0 #4bb5ba;
}

html.dark-theme body.sidebar-collapsed:not(.compact-ui) .main-nav a em {
  border-color: #111d26;
}

html.dark-theme body .topbar {
  border-color: var(--line);
  background: rgba(20,32,41,.93);
}

html.dark-theme body :is(.global-search, .clients-search, .chat-list-search, .chat-inline-search, .phone-search-row label) {
  border-color: var(--line-strong);
  background: #17242d;
  color: #8ea0aa;
}

html.dark-theme body :is(.global-search, .clients-search, .chat-list-search, .chat-inline-search, .phone-search-row label):focus-within {
  border-color: #4d9da2;
  background: #1a2a34;
  box-shadow: 0 0 0 3px rgba(60,165,170,.14);
}

html.dark-theme body kbd,
html.dark-theme body .top-profile-button {
  border-color: var(--line-strong);
  background: #1c2a34;
  color: #9aabb5;
}

html.dark-theme body .icon-button:hover {
  background: #23333d;
  color: var(--ink);
}

html.dark-theme body .connection-status {
  border-color: #2f5c4d;
  background: #172a24;
  color: #78b79a;
}

html.dark-theme body .connection-status.is-loading {
  border-color: var(--line);
  background: #1b2831;
  color: #91a1aa;
}

html.dark-theme body .connection-status.is-error {
  border-color: #68423f;
  background: #30211f;
  color: #e18a83;
}

html.dark-theme body :is(.view-switcher, .phase-switcher, .quick-views, .calendar-scope-switch, .calendar-view-switch, .calendar-section-switch, .clients-tabs, .calls-tabs, .reports-tabs, .deletions-toolbar nav, .calls-history-switch) {
  border-color: var(--line);
  background: #202e38;
}

html.dark-theme body :is(.view-switcher, .phase-switcher, .quick-views, .calendar-scope-switch, .calendar-view-switch, .calendar-section-switch, .clients-tabs, .calls-tabs, .reports-tabs, .deletions-toolbar nav, .calls-history-switch) button {
  color: #91a1ab;
}

html.dark-theme body :is(.view-switcher, .phase-switcher, .quick-views, .calendar-scope-switch, .calendar-view-switch, .calendar-section-switch, .clients-tabs, .calls-tabs, .reports-tabs, .deletions-toolbar nav, .calls-history-switch) button.is-active {
  background: #293945;
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

html.dark-theme body :is(.control-bar, .applied-filters, .filter-popover, .list-status-filter, .list-panel, .focus-primary, .day-card, .detail-drawer, .account-menu, .settings-panel) {
  border-color: var(--line);
  background: var(--surface);
}

html.dark-theme body :is(.filters button, .filter-options button, .filter-popover-foot button, .status-jump button) {
  border-color: var(--line-strong);
  background: var(--surface);
  color: #9babb4;
}

html.dark-theme body :is(.filters button, .filter-options button, .filter-popover-foot button, .status-jump button):hover {
  background: #23333d;
  color: var(--ink);
}

html.dark-theme body :is(.quick-views button.is-active, .filter-options button.is-active, .applied-filters button, .status-jump button.is-active) {
  border-color: #35646a;
  background: #1b383d;
  color: #82d1d4;
}

html.dark-theme body :is(.filter-popover-head, .filter-popover section, .drawer-head, .drawer-section, .account-menu-head) {
  border-color: var(--line);
}

html.dark-theme body .filter-popover-foot {
  background: #152129;
}

html.dark-theme body :is(.page-subtitle, .task-code, .created-line, .client-line, .drawer-meta dt, .drawer-section > p, .comments-empty) {
  color: var(--muted);
}

/* Home */
html.dark-theme body .home-welcome {
  border-color: #315057;
  background: linear-gradient(112deg,#183038 0%,#17282f 42%,#18242d 100%);
  box-shadow: 0 10px 30px rgba(0,0,0,.16);
}

html.dark-theme body .home-welcome-copy > p:last-child {
  color: #9aaab3;
}

html.dark-theme body :is(.home-panel, .home-pulse > button, .home-quick-actions button) {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 5px 18px rgba(0,0,0,.11);
}

html.dark-theme body :is(.home-pulse > button, .home-quick-actions button):hover {
  border-color: #45757a;
  background: #20313b;
}

html.dark-theme body .home-section-head,
html.dark-theme body .home-resume-foot,
html.dark-theme body :is(.home-change-row, .home-attention-item, .home-calendar-item) {
  border-color: var(--line);
}

html.dark-theme body :is(.home-change-row, .home-attention-item, .home-calendar-item):hover {
  background: #203139;
}

html.dark-theme body .home-resume-card {
  border-color: color-mix(in srgb,var(--home-status) 32%,var(--line));
  border-left-color: var(--home-status);
  background: linear-gradient(120deg,color-mix(in srgb,var(--home-status) 8%,var(--surface)),var(--surface) 70%);
  color: var(--ink);
  box-shadow: 0 7px 22px rgba(0,0,0,.12);
}

html.dark-theme body .home-quick-actions {
  border-color: var(--line);
  background: #15212a;
}

/* Tasks, focus view and task drawer */
html.dark-theme body .kanban-column {
  border-color: var(--line);
  border-top-color: var(--status-color);
  background: color-mix(in srgb,var(--status-color) 5%,#15212a);
}

html.dark-theme body .kanban-column.is-drop-target {
  border-color: var(--status-color);
  background: color-mix(in srgb,var(--status-color) 11%,#15212a);
}

html.dark-theme body .column-title span,
html.dark-theme body :is(.status-pill, .list-status-filter button.is-active) {
  background: color-mix(in srgb,var(--status-color,var(--accent)) 17%,#1b2932);
  color: color-mix(in srgb,var(--status-color,var(--accent)) 65%,#f0f5f6);
}

html.dark-theme body :is(.task-card, .task-row) {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 2px 7px rgba(0,0,0,.12);
}

html.dark-theme body :is(.task-card, .task-row):hover,
html.dark-theme body .task-card.is-selected {
  background: #1d2c35;
}

html.dark-theme body :is(.card-bottom, .list-heading, .task-row, .focus-section + .focus-section) {
  border-color: var(--line);
}

html.dark-theme body .list-heading {
  background: #15212a;
  color: #82939d;
}

html.dark-theme body .list-status-menu {
  border-color: var(--line);
  background: var(--surface);
  box-shadow: 0 13px 30px rgba(0,0,0,.28);
}

html.dark-theme body :is(.focus-intro, .day-card, .focus-primary) {
  border-color: var(--line);
  background: var(--surface);
}

html.dark-theme body .focus-intro {
  background: linear-gradient(120deg,var(--surface) 0 65%,#1a3337 100%);
}

html.dark-theme body .focus-task:hover {
  background: #22313b;
}

html.dark-theme body .time-bar {
  background: #2b3a44;
}

html.dark-theme body .detail-drawer {
  color: var(--ink);
}

html.dark-theme body .drawer-backdrop.is-open {
  background: rgba(0,0,0,.46);
}

html.dark-theme body :is(.drawer-actions button, .checklist-item, .checklist-add, .comment-box, .task-client-link) {
  border-color: var(--line-strong);
  background: #1a2831;
  color: var(--ink);
}

html.dark-theme body :is(.checklist-item, .task-client-link):hover,
html.dark-theme body .comment-box:focus-within,
html.dark-theme body .checklist-add:focus-within {
  border-color: #4b8f94;
  background: #1d3038;
}

html.dark-theme body :is(.checklist-item input, .checklist-add input, .comment-box textarea) {
  background: transparent;
  color: var(--ink);
}

html.dark-theme body :is(.task-form-attachments, .draft-file-card) {
  border-color: var(--line-strong);
  background: #1a2831;
}

html.dark-theme body .draft-file-card.is-error {
  border-color: #85514f;
  background: #352426;
}

html.dark-theme body :is(.draft-file-preview, .draft-file-icon, .image-preview-fallback) {
  background: #253741;
  color: #9aacb6;
}

html.dark-theme body .draft-file-copy strong,
html.dark-theme body .task-form-attachments-head strong {
  color: var(--ink);
}

html.dark-theme body .task-form-attachments-head button {
  border-color: var(--line-strong);
  background: #21313a;
}

html.dark-theme body .task-rich-content {
  color: #afbdc5;
}

html.dark-theme body :is(.task-rich-content h2, .task-rich-content h3, .task-rich-content h4, .task-rich-editor h2, .task-rich-editor h3, .task-rich-editor h4) {
  color: var(--ink);
}

html.dark-theme body :is(.task-rich-content blockquote, .task-rich-editor blockquote) {
  border-color: #4e9599;
  background: #1b3036;
  color: #a8bec2;
}

html.dark-theme body :is(.task-rich-content code, .task-rich-editor code) {
  background: #24333d;
  color: #c6d3d9;
}

html.dark-theme body :is(.task-rich-content pre, .task-rich-editor pre) {
  background: #0f181f;
  color: #dbe6ea;
}

html.dark-theme body :is(.task-rich-image, .task-editor-image, .task-content-editor) {
  border-color: var(--line-strong);
  background: #18262f;
}

html.dark-theme body :is(.task-rich-image-preview, .task-editor-image .task-rich-image-preview) {
  background: #101c23;
}

html.dark-theme body .task-editor-toolbar {
  border-color: var(--line);
  background: #142129;
}

html.dark-theme body .task-editor-toolbar > span {
  background: #34444e;
}

html.dark-theme body .task-editor-toolbar button {
  color: #9babb4;
}

html.dark-theme body .task-editor-toolbar button:hover,
html.dark-theme body .task-editor-toolbar button:focus-visible {
  background: #253942;
  color: #84ced1;
}

html.dark-theme body .task-rich-editor {
  color: #c1cdd3;
}

html.dark-theme body .task-editor-checklist {
  border-color: var(--line);
  background: #15232b;
}

html.dark-theme body .task-editor-checklist-head strong {
  color: #aebdc5;
}

html.dark-theme body .task-editor-checklist-head span {
  background: #263943;
  color: #9fafb8;
}

html.dark-theme body .task-form-checklist-add {
  border-color: var(--line-strong);
  background: #1a2831;
}

html.dark-theme body .task-form-checklist-add input {
  color: var(--ink);
}

html.dark-theme body .task-form-checklist-add button {
  background: #244047;
  color: #86cdd0;
}

html.dark-theme body .task-content-checklist {
  border-color: var(--line);
}

/* Chat */
html.dark-theme body .chat-shell {
  border-color: var(--line);
  background: var(--surface);
  box-shadow: 0 7px 24px rgba(0,0,0,.14);
}

html.dark-theme body :is(.chat-roster, .chat-conversation, .chat-conversation-head, .chat-list-head, .chat-info-panel) {
  border-color: var(--line);
  background: var(--surface);
}

html.dark-theme body .chat-dialog {
  border-color: var(--line);
  color: var(--ink);
}

html.dark-theme body .chat-dialog:hover {
  background: #1e2e37;
}

html.dark-theme body .chat-dialog.is-active {
  background: #1b393e;
}

html.dark-theme body .chat-messages {
  background-color: #121e26;
  background-image: radial-gradient(rgba(91,126,134,.12) .7px, transparent .7px);
}

html.dark-theme body .chat-bubble {
  border-color: #33444e;
  background: #1d2b34;
  color: var(--ink);
  box-shadow: 0 2px 6px rgba(0,0,0,.14);
}

html.dark-theme body .chat-message-row.is-own .chat-bubble {
  border-color: #28565a;
  background: #18383c;
}

html.dark-theme body .chat-bubble > p {
  color: #dce7eb;
}

html.dark-theme body :is(.chat-quote, .chat-reference, .chat-file, .chat-pinned, .chat-reply-preview, .chat-attachment-draft) {
  border-color: var(--line);
  background: #17262f;
}

html.dark-theme body .chat-compose-zone {
  border-color: var(--line);
  background: rgba(20,32,41,.97);
}

html.dark-theme body .chat-composer textarea {
  border-color: var(--line-strong);
  background: #17242d;
  color: var(--ink);
}

html.dark-theme body .chat-composer textarea:focus {
  border-color: #4d9da2;
  background: #1b2a33;
}

html.dark-theme body :is(.chat-mention-menu, .chat-emoji-menu, .chat-message-menu, .chat-modal-sheet, .chat-info-panel) {
  border-color: var(--line);
  background: rgba(25,37,46,.985);
  color: var(--ink);
  box-shadow: 0 20px 54px rgba(0,0,0,.38);
}

html.dark-theme body :is(.chat-mention-menu button, .chat-emoji-menu button, .chat-message-menu button, .chat-forward-target) {
  color: var(--ink);
}

html.dark-theme body :is(.chat-mention-menu button, .chat-emoji-menu button, .chat-message-menu button, .chat-forward-target):hover,
html.dark-theme body .chat-forward-target.is-selected {
  background: #24343e;
}

html.dark-theme body .chat-message-menu .chat-menu-separator,
html.dark-theme body :is(.chat-modal-sheet > header, .chat-forward-sheet footer, .chat-receipts-note) {
  border-color: var(--line);
}

html.dark-theme body .chat-receipts-note {
  background: #15212a;
}

html.dark-theme body .chat-jump-bottom,
html.dark-theme body .chat-load-older {
  border-color: var(--line-strong);
  background: #24343e;
  color: #a9bac2;
}

/* Knowledge base */
html.dark-theme body .knowledge-shell,
html.dark-theme body :is(.knowledge-categories, .knowledge-index, .knowledge-reader) {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

html.dark-theme body .knowledge-categories {
  background: #15212a;
}

html.dark-theme body :is(.knowledge-categories > header, .knowledge-index > header, .knowledge-reader-head, .knowledge-attachments) {
  border-color: var(--line);
}

html.dark-theme body .knowledge-category {
  color: #9aabb4;
}

html.dark-theme body .knowledge-category:hover {
  background: #20313a;
  color: var(--ink);
}

html.dark-theme body .knowledge-category.is-active {
  background: #1b393e;
  color: #84d1d4;
}

html.dark-theme body .knowledge-category > span,
html.dark-theme body .knowledge-card-mark,
html.dark-theme body .knowledge-reader-empty > span,
html.dark-theme body .knowledge-reader-loading > span:not(.knowledge-state-icon),
html.dark-theme body .knowledge-article-kicker > span {
  background: #20383d;
  color: #78cbd0;
}

html.dark-theme body .knowledge-category em {
  background: #24333d;
  color: #9babb4;
}

html.dark-theme body .knowledge-card {
  color: var(--ink);
}

html.dark-theme body .knowledge-card:hover {
  border-color: var(--line-strong);
  background: #1d2d36;
}

html.dark-theme body .knowledge-card.is-active {
  border-color: #315d62;
  background: #1b383d;
}

html.dark-theme body .knowledge-card-copy small,
html.dark-theme body .knowledge-reader-head > p,
html.dark-theme body .knowledge-article-body {
  color: #afbec6;
}

html.dark-theme body .knowledge-search {
  border-color: var(--line-strong);
  background: #17242d;
  color: #8ea0aa;
}

html.dark-theme body .knowledge-search:focus-within {
  border-color: #4d9da2;
  background: #1a2a34;
}

html.dark-theme body .knowledge-reader-head {
  background: linear-gradient(115deg, #182a31 0%, var(--surface) 72%);
}

html.dark-theme body .knowledge-article-meta span,
html.dark-theme body .knowledge-attachments h3 span {
  background: #1c3a3e;
  color: #82d1d4;
}

html.dark-theme body .knowledge-article-body :is(h1, h2, h3, h4, h5, h6) {
  color: var(--ink);
}

html.dark-theme body .knowledge-article-body blockquote {
  border-color: #4d9599;
  background: #1a3036;
  color: #afc3c7;
}

html.dark-theme body .knowledge-article-body code {
  background: #25353f;
  color: #d1dde2;
}

html.dark-theme body .knowledge-article-body pre {
  background: #0d171d;
  color: #e5eef1;
}

html.dark-theme body .knowledge-article-body :is(th, td) {
  border-color: var(--line-strong);
}

html.dark-theme body .knowledge-article-body th {
  background: #21313a;
  color: #bdcbd2;
}

html.dark-theme body .knowledge-inline-image,
html.dark-theme body .knowledge-attachments a {
  border-color: var(--line-strong);
  background: #17252e;
  color: var(--ink);
}

html.dark-theme body .knowledge-attachments a:hover {
  border-color: #477c81;
  background: #1d3038;
}

html.dark-theme body .knowledge-create,
html.dark-theme body .knowledge-category-create,
html.dark-theme body .knowledge-reader-actions button {
  border-color: #35535a;
  background: #1c373c;
  color: #82d0d3;
}

html.dark-theme body .knowledge-status {
  background: #293943;
  color: #a9b8bf;
}

html.dark-theme body .knowledge-status.is-published {
  background: #1d3b31;
  color: #89c2a0;
}

html.dark-theme body .knowledge-status.is-in-review {
  background: #41351f;
  color: #d6ae68;
}

html.dark-theme body .knowledge-form-layer {
  background: rgba(5,10,14,.64);
}

html.dark-theme body .knowledge-form-sheet,
html.dark-theme body .knowledge-form-sheet > footer {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

html.dark-theme body .knowledge-form-sheet > header,
html.dark-theme body .knowledge-editor,
html.dark-theme body .knowledge-editor > header,
html.dark-theme body .knowledge-form-categories {
  border-color: var(--line);
}

html.dark-theme body .knowledge-form-sheet > header button,
html.dark-theme body .knowledge-editor-toolbar button {
  color: #9badb5;
}

html.dark-theme body .knowledge-form-sheet > header button:hover,
html.dark-theme body .knowledge-editor-toolbar button:hover,
html.dark-theme body .knowledge-form-categories label:hover {
  background: #24343e;
  color: var(--ink);
}

html.dark-theme body .knowledge-form-field > :is(input, select, textarea),
html.dark-theme body .knowledge-editor-body {
  border-color: var(--line-strong);
  background: #17242d;
  color: var(--ink);
  color-scheme: dark;
}

html.dark-theme body .knowledge-editor > header {
  background: #1c2b34;
}

html.dark-theme body .knowledge-editor-body :is(h1, h2, h3, h4, h5, h6) {
  color: var(--ink);
}

html.dark-theme body .knowledge-editor-body blockquote {
  background: #1b3439;
  color: #b5c5cb;
}

html.dark-theme body .knowledge-form-categories label {
  color: #afbec5;
}

html.dark-theme body .knowledge-form-cancel {
  border-color: var(--line-strong);
  background: #1b2932;
  color: #afbec5;
}

/* Calendar and payments */
html.dark-theme body :is(.calendar-shell, .payment-calendar-pane) {
  border-color: var(--line);
  background: var(--surface);
  box-shadow: 0 7px 24px rgba(0,0,0,.14);
}

html.dark-theme body :is(.calendar-toolbar, .calendar-people, .calendar-week-header, .calendar-deadlines, .calendar-month-weekdays, .calendar-agenda-group) {
  border-color: var(--line);
}

html.dark-theme body :is(.calendar-today, .calendar-arrows button, .calendar-scope-switch button, .calendar-view-switch button, .calendar-person, .calendar-status-options button, .calendar-reminder-options button, .calendar-datetime-trigger) {
  border-color: var(--line-strong);
  background: var(--surface);
  color: #9babb4;
}

html.dark-theme body :is(.calendar-today, .calendar-arrows button, .calendar-person, .calendar-status-options button, .calendar-reminder-options button):hover {
  background: #23333d;
  color: var(--ink);
}

html.dark-theme body .calendar-week-header,
html.dark-theme body .calendar-month-weekdays,
html.dark-theme body .calendar-time-labels {
  background: #15212a;
}

html.dark-theme body .calendar-deadlines {
  background: #24231f;
}

html.dark-theme body .calendar-week-day,
html.dark-theme body .calendar-month-day {
  border-color: var(--line);
  background: var(--surface);
}

html.dark-theme body .calendar-week-day.is-selected,
html.dark-theme body .calendar-month-day.is-selected {
  background: #172b31;
}

html.dark-theme body .calendar-month-day.is-outside {
  background: #131e26;
}

html.dark-theme body .calendar-time-slot {
  border-color: #263640;
}

html.dark-theme body :is(.calendar-week-event, .calendar-month-event) {
  background: color-mix(in srgb,var(--event-color) 18%,#1b2932);
  color: color-mix(in srgb,var(--event-color) 42%,#f0f4f5);
}

html.dark-theme body .calendar-week-day.is-calendar-drop-target {
  background: #183037;
  box-shadow: inset 0 0 0 1px rgba(83,185,191,.24);
}

html.dark-theme body .calendar-week-event.calendar-event-drag-preview {
  background: color-mix(in srgb,var(--event-color) 28%,#22343f);
  box-shadow: 0 12px 28px rgba(0,0,0,.34);
}

html.dark-theme body .calendar-context-menu {
  border-color: var(--line);
  background: rgba(25,37,46,.985);
  box-shadow: 0 20px 54px rgba(0,0,0,.4);
}

html.dark-theme body .calendar-context-menu header {
  border-color: var(--line);
  background: #15212a;
}

html.dark-theme body .calendar-context-menu header strong,
html.dark-theme body .calendar-context-menu > button {
  color: var(--ink);
}

html.dark-theme body .calendar-context-menu > button:hover {
  background: #24343e;
  color: #82d0d3;
}

html.dark-theme body .calendar-context-menu > button.is-danger {
  color: #df817b;
}

html.dark-theme body .calendar-context-menu > button.is-danger:hover {
  background: #402827;
  color: #f09a94;
}

html.dark-theme body .calendar-duplicate {
  border-color: var(--line-strong) !important;
  color: #aebdc4 !important;
}

html.dark-theme body .calendar-duplicate:hover {
  background: #24343e !important;
  color: #82d0d3 !important;
}

html.dark-theme body :is(.calendar-date-popover, .payment-date-popover, .calls-date-popover) {
  border-color: var(--line);
  background: #1c2a34;
  box-shadow: 0 22px 55px rgba(0,0,0,.4);
}

html.dark-theme body :is(.calendar-dialog form, .payment-dialog form) {
  background: var(--surface);
  color: var(--ink);
}

html.dark-theme body .calendar-dialog-assignee {
  border-color: var(--line);
  background: #182630;
  color: var(--ink);
}

html.dark-theme body .calendar-dialog-assignee.is-other {
  border-color: #31575c;
  background: #1a3035;
}

html.dark-theme body .calendar-dialog-assignee-copy small,
html.dark-theme body .calendar-dialog-assignee > em {
  color: #8fafb3;
}

html.dark-theme body :is(.payment-summary-card, .payment-controls, .payment-record, .calendar-agenda-card) {
  border-color: var(--line);
  background: var(--surface);
}

/* Clients */
html.dark-theme body :is(.clients-shell, .client-dialog form) {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

html.dark-theme body :is(.clients-toolbar, .clients-list-head, .client-dialog-tabs, .client-dialog-foot) {
  border-color: var(--line);
  background: #15212a;
}

html.dark-theme body .client-list-row {
  border-color: var(--line);
  background: var(--surface);
}

html.dark-theme body .client-list-row:hover {
  background: #1e2e37;
}

html.dark-theme body .client-list-row.is-selected {
  background: #1b393e;
}

html.dark-theme body .client-detail {
  background: #131f27;
}

html.dark-theme body .client-profile-head {
  border-color: var(--line);
  background: linear-gradient(135deg,var(--surface) 0 65%,#173238 100%);
}

html.dark-theme body :is(.client-detail-tabs, .client-info-field, .client-detail-section, .client-related-list button, .client-task-list button, .client-edit) {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

html.dark-theme body :is(.client-related-list button, .client-task-list button):hover {
  background: #203039;
}

html.dark-theme body .client-info-field strong {
  color: #dce6ea;
}

html.dark-theme body .client-sla-card {
  border-color: #315743;
  background: linear-gradient(120deg,#1a2d23,#182820);
}

html.dark-theme body .client-sla-card strong {
  color: #8fc6a5;
}

html.dark-theme body :is(.client-form-field input, .client-form-field textarea, .client-account-relation input, .client-account-combo > label, .client-choice-field button, .client-switch-field) {
  border-color: var(--line-strong);
  background: #17242d;
  color: var(--ink);
}

html.dark-theme body :is(.client-form-field input, .client-form-field textarea, .client-account-relation input):focus,
html.dark-theme body .client-account-combo > label:focus-within {
  border-color: #4d9da2;
  background: #1a2a34;
}

html.dark-theme body .client-account-options {
  border-color: var(--line);
  background: #1d2b35;
  box-shadow: 0 14px 35px rgba(0,0,0,.35);
}

html.dark-theme body .client-account-options button:hover {
  background: #263842;
}

/* Calls and detached phone */
html.dark-theme body :is(.calls-shell, .phone-surface, .calls-phone-layout > main, .calls-history, .phone-team, .phone-keypad, .phone-transfer) {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

html.dark-theme body :is(.calls-toolbar, .calls-history-heading, .phone-team > header, .phone-transfer > header) {
  border-color: var(--line);
  background: #15212a;
}

html.dark-theme body :is(.phone-status-card, .phone-search-results, .phone-recents, .phone-person, .phone-call-card, .phone-call-likely, .calls-client-tasks, .call-history-card, .calls-archive-filters) {
  border-color: var(--line);
  background: #1a2831;
  color: var(--ink);
}

html.dark-theme body :is(.phone-person, .phone-search-results button, .phone-recents > div > button, .calls-task-row):hover {
  background: #22343d;
}

html.dark-theme body :is(.phone-search-row input, .calls-filter-row input, .calls-date-trigger) {
  border-color: var(--line-strong);
  background: #17242d;
  color: var(--ink);
}

html.dark-theme body .phone-call-actions button,
html.dark-theme body .phone-keypad button {
  border-color: var(--line-strong);
  background: #20303a;
  color: #d8e4e8;
}

html.dark-theme body .phone-call-actions button:hover,
html.dark-theme body .phone-keypad button:hover {
  background: #293c46;
}

html.dark-theme body .phone-call-actions button.is-hangup {
  border-color: #6e403d;
  background: #352321;
  color: #ee8a84;
}

html.dark-theme body .phone-surface[data-phone-phase="incoming"] .phone-call-actions button.is-answer {
  border-color: #315e46;
  background: #1b3327;
  color: #8bc5a1;
}

html.dark-theme body .call-history-card.is-missed {
  background: #2b201f;
}

html.dark-theme body[data-phone-surface="detached"] {
  background: #101820;
}

html.dark-theme body[data-phone-surface="detached"] .detached-phone-root {
  background: #101820;
  color: var(--ink);
}

/* Mail */
html.dark-theme body :is(.mail-workspace, .mail-folders-pane, .mail-list-pane, .mail-reader, .mail-compose-dialog, .mail-compose-dialog form) {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

html.dark-theme body :is(.mail-folders-pane > header, .mail-list-toolbar, .mail-reader-head, .mail-letter-head, .mail-compose-dialog header, .mail-compose-dialog footer) {
  border-color: var(--line);
  background: #15212a;
}

html.dark-theme body .mail-folder:hover {
  background: #20313a;
}

html.dark-theme body .mail-folder.is-active {
  background: #1b393e;
  color: #85d0d3;
}

html.dark-theme body .mail-row {
  border-color: var(--line);
  background: var(--surface);
}

html.dark-theme body .mail-row:hover {
  background: #1f2f38;
}

html.dark-theme body .mail-row.is-selected {
  background: #1a383d;
}

html.dark-theme body .mail-reader-content,
html.dark-theme body .mail-letter-body {
  background: var(--surface);
}

html.dark-theme body .mail-letter-frame {
  border-radius: 9px;
  background: #fff;
}

html.dark-theme body :is(.mail-toolbar-actions button, .mail-reader-actions button, .mail-list-state button, .mail-letter-attachments a, .mail-parent-link) {
  border-color: var(--line-strong);
  background: #1b2a33;
  color: #a8bac2;
}

html.dark-theme body :is(.mail-toolbar-actions button, .mail-reader-actions button, .mail-list-state button, .mail-letter-attachments a):hover {
  background: #253741;
}

html.dark-theme body :is(.mail-compose-fields input:not([type="hidden"]), .mail-compose-fields textarea, .mail-from-select > button, .mail-compose-fields details, .mail-compose-attachments > span) {
  border-color: var(--line-strong);
  background: #17242d;
  color: var(--ink);
}

html.dark-theme body #mail-from-options {
  border-color: var(--line);
  background: #1d2b35;
  box-shadow: 0 14px 35px rgba(0,0,0,.36);
}

html.dark-theme body #mail-from-options button {
  color: var(--ink);
}

html.dark-theme body #mail-from-options button:hover,
html.dark-theme body #mail-from-options button[aria-selected="true"] {
  background: #233740;
}

/* Reports */
html.dark-theme body :is(.reports-shell, .reports-result-card, .reports-metric-card, .reports-panel, .reports-table-wrap, .reports-method, .reports-detail-section) {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

html.dark-theme body :is(.reports-toolbar, .reports-filters, .reports-content, .reports-section-head) {
  border-color: var(--line);
  background: #15212a;
}

html.dark-theme body :is(.reports-period > button, .reports-filter-select > button, .reports-export, .reports-metric-switch) {
  border-color: var(--line-strong);
  background: #1b2a33;
  color: #9faeb7;
}

html.dark-theme body .reports-filter-menu {
  border-color: var(--line);
  background: #1d2b35;
  box-shadow: 0 16px 35px rgba(0,0,0,.36);
}

html.dark-theme body .reports-filter-menu button {
  color: var(--ink);
}

html.dark-theme body :is(.reports-filter-menu button:hover, .reports-filter-menu button.is-active, .reports-metric-switch button.is-active) {
  background: #21383e;
  color: #83ced2;
}

html.dark-theme body .reports-table :is(th, td) {
  border-color: var(--line);
}

html.dark-theme body .reports-table th {
  background: #15212a;
  color: #84949e;
}

html.dark-theme body .reports-table tbody tr:hover td {
  background: #203039;
}

/* Deletion requests */
html.dark-theme body :is(.deletions-shell, .deletions-access-denied) {
  border-color: var(--line);
  background: var(--surface);
}

html.dark-theme body .deletions-toolbar {
  border-color: var(--line);
  background: #15212a;
}

html.dark-theme body .deletions-summary > div,
html.dark-theme body .deletion-card {
  border-color: var(--line);
  background: #1a2831;
}

html.dark-theme body .deletions-list {
  background: #131f27;
}

html.dark-theme body .deletion-card-actions button,
html.dark-theme body .deletions-refresh {
  border-color: var(--line-strong);
  background: #20303a;
  color: #a8b8c0;
}

/* Menus, settings, login and shared dialogs */
html.dark-theme body .account-menu {
  box-shadow: 0 18px 50px rgba(0,0,0,.4);
}

html.dark-theme body .account-menu > button {
  color: #b0bec5;
}

html.dark-theme body .account-menu > button:hover {
  background: #25353f;
  color: var(--ink);
}

html.dark-theme body .settings-user,
html.dark-theme body .settings-options {
  border-color: var(--line);
  background: #17252e;
}

html.dark-theme body .settings-options label {
  border-color: var(--line);
}

html.dark-theme body .settings-options label:hover {
  background: #1d2d36;
}

html.dark-theme body .settings-options label > i {
  background: #42535d;
}

html.dark-theme body .login-layer {
  background: radial-gradient(circle at 18% 15%,rgba(60,165,170,.13),transparent 34%),#0f181f;
}

html.dark-theme body .login-card {
  border-color: var(--line);
  background: rgba(24,36,45,.97);
  box-shadow: 0 28px 74px rgba(0,0,0,.42);
}

html.dark-theme body .login-card input {
  border-color: var(--line-strong);
  background: #121f27;
  color: var(--ink);
}

html.dark-theme body :is(dialog, .form-dialog, .calendar-dialog, .payment-dialog) {
  color: var(--ink);
}

html.dark-theme body :is(.form-field input, .form-field textarea, .form-field select) {
  border-color: var(--line-strong);
  background: #17242d;
  color: var(--ink);
}

html.dark-theme body :is(.media-viewer-toolbar, .mobile-nav, .mobile-more-sheet) {
  border-color: var(--line);
  background: #15212a;
  color: var(--ink);
}

@media (max-width: 760px) {
  html.dark-theme body .global-search {
    background: #17242d;
  }

  html.dark-theme body :is(.mail-list-pane, .mail-folders-pane, .mail-reader) {
    background: var(--surface);
  }
}
