/* ==========================================================================
   Dispatch: the B2BTaskManager visual system.

   Loaded after site.css, features.css and customers.css, so rules here win
   at equal specificity. This layer only restyles: it never depends on new
   markup, and every class, id and data-* hook used by the scripts is left
   exactly as it was.

   Principles
   - Status is the main source of color. Primary actions are ink, the brand
     teal marks selection, links and focus, and neutrals stay quiet.
   - Every status has its own glyph (ring, half, pause, check...) so it never
     depends on color alone.
   - Three surface tiers: shell (sidebar) < canvas < sheet (white panels).
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */

:root {
  --shell-bg: oklch(0.956 0.006 186);
  --sheet: var(--color-surface);
  --fill: var(--color-surface-muted);
  --fill-hover: oklch(0.945 0.007 186);
  --line: var(--color-border);
  --line-strong: oklch(0.855 0.008 200);
  --ink: var(--color-ink);
  --ink-2: oklch(0.40 0.012 200);
  --ink-3: var(--color-ink-muted);
  --accent: var(--color-teal-700);
  --accent-soft: var(--color-teal-100);
  --primary-bg: oklch(0.24 0.014 200);
  --primary-bg-hover: oklch(0.33 0.016 200);
  --primary-ink: oklch(0.99 0 0);
  --ring: 0 0 0 3px color-mix(in oklab, var(--color-focus) 24%, transparent);
  --shadow-pop: 0 1px 2px oklch(0.22 0.012 200 / 0.06), 0 12px 32px -8px oklch(0.22 0.012 200 / 0.18);
  --shadow-dialog: 0 24px 64px -16px oklch(0.22 0.012 200 / 0.32);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);

  --text-2xs: 0.75rem;
  --text-xs: 0.8125rem;
  --text-sm: 0.875rem;
  --text-md: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: 1.625rem;

  /* Status palette: one hue per workflow state, used everywhere. */
  --status-new: oklch(0.60 0.110 235);
  --status-assigned: oklch(0.53 0.170 262);
  --status-working: oklch(0.69 0.150 62);
  --status-pending: oklch(0.64 0.165 42);
  --status-review: oklch(0.54 0.180 300);
  --status-done: oklch(0.56 0.140 152);
  --status-rejected: oklch(0.56 0.200 26);
  --status-cancelled: oklch(0.60 0.012 220);
  --status-text-mix: 64%;

  /* Status glyphs (alpha masks, drawn in the status color). */
  --icon-new: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='6.1' fill='none' stroke='black' stroke-width='1.8' stroke-dasharray='2.4 2.39'/%3E%3C/svg%3E");
  --icon-assigned: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='6.1' fill='none' stroke='black' stroke-width='1.8'/%3E%3C/svg%3E");
  --icon-working: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='6.1' fill='none' stroke='black' stroke-width='1.8'/%3E%3Cpath d='M8 4.3a3.7 3.7 0 0 1 0 7.4z'/%3E%3C/svg%3E");
  --icon-pending: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='6.1' fill='none' stroke='black' stroke-width='1.8'/%3E%3Crect x='5.7' y='5.3' width='1.6' height='5.4' rx='.5'/%3E%3Crect x='8.7' y='5.3' width='1.6' height='5.4' rx='.5'/%3E%3C/svg%3E");
  --icon-review: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='6.1' fill='none' stroke='black' stroke-width='1.8'/%3E%3Cpath d='M8 4.3a3.7 3.7 0 1 1-3.7 3.7H8z'/%3E%3C/svg%3E");
  --icon-done: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M8 1a7 7 0 1 1 0 14A7 7 0 0 1 8 1Zm3.53 4.97a.75.75 0 0 0-1.06 0L7.25 9.19 5.53 7.47a.75.75 0 1 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.06 0l3.75-3.75a.75.75 0 0 0 0-1.06Z'/%3E%3C/svg%3E");
  --icon-rejected: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M8 1a7 7 0 1 1 0 14A7 7 0 0 1 8 1ZM5.97 4.91a.75.75 0 0 0-1.06 1.06L6.94 8l-2.03 2.03a.75.75 0 1 0 1.06 1.06L8 9.06l2.03 2.03a.75.75 0 1 0 1.06-1.06L9.06 8l2.03-2.03a.75.75 0 0 0-1.06-1.06L8 6.94 5.97 4.91Z'/%3E%3C/svg%3E");
  --icon-cancelled: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='6.1' fill='none' stroke='black' stroke-width='1.8'/%3E%3Cpath d='M4.7 11.3 11.3 4.7' stroke='black' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
}

:root[data-theme="dark"] {
  --shell-bg: oklch(0.145 0.006 200);
  --fill-hover: oklch(0.255 0.010 200);
  --line-strong: oklch(0.375 0.012 200);
  --ink-2: oklch(0.82 0.008 200);
  --primary-bg: oklch(0.94 0.006 200);
  --primary-bg-hover: oklch(0.86 0.008 200);
  --primary-ink: oklch(0.17 0.008 200);
  --shadow-pop: 0 1px 2px oklch(0 0 0 / 0.4), 0 16px 40px -8px oklch(0 0 0 / 0.55);
  --shadow-dialog: 0 24px 64px -16px oklch(0 0 0 / 0.7);

  --status-new: oklch(0.76 0.100 235);
  --status-assigned: oklch(0.74 0.130 262);
  --status-working: oklch(0.81 0.130 72);
  --status-pending: oklch(0.77 0.130 48);
  --status-review: oklch(0.75 0.140 300);
  --status-done: oklch(0.76 0.130 152);
  --status-rejected: oklch(0.73 0.150 26);
  --status-cancelled: oklch(0.68 0.012 220);
  --status-text-mix: 78%;
}

/* Per-status bindings. Every component that is colored by status reads
   --st (color) and --st-icon (glyph). */
.status-badge,
.task-state-dot {
  --st: var(--status-cancelled);
  --st-icon: var(--icon-assigned);
}

.status-badge--new, .task-state-dot--new, .kanban-lane--new, .kanban-move-option--new,
.dashboard-status-track__segment--new, .dashboard-task-row--new, .metric-row--new {
  --st: var(--status-new);
  --st-icon: var(--icon-new);
}

.status-badge--assigned, .task-state-dot--assigned, .kanban-lane--assigned, .kanban-move-option--assigned,
.dashboard-status-track__segment--assigned, .dashboard-task-row--assigned, .metric-row--assigned {
  --st: var(--status-assigned);
  --st-icon: var(--icon-assigned);
}

.status-badge--working, .task-state-dot--working, .kanban-lane--working, .kanban-move-option--working,
.dashboard-status-track__segment--working, .dashboard-task-row--working, .metric-row--working {
  --st: var(--status-working);
  --st-icon: var(--icon-working);
}

.status-badge--pending, .task-state-dot--pending, .kanban-lane--pending, .kanban-move-option--pending,
.dashboard-status-track__segment--pending, .dashboard-task-row--pending, .metric-row--pending {
  --st: var(--status-pending);
  --st-icon: var(--icon-pending);
}

.status-badge--review, .task-state-dot--review, .kanban-lane--review, .kanban-move-option--review,
.dashboard-status-track__segment--review, .dashboard-task-row--review, .metric-row--review {
  --st: var(--status-review);
  --st-icon: var(--icon-review);
}

.status-badge--done, .task-state-dot--done, .kanban-lane--done, .kanban-move-option--done,
.dashboard-status-track__segment--done, .dashboard-task-row--done, .metric-row--done {
  --st: var(--status-done);
  --st-icon: var(--icon-done);
}

.status-badge--rejected, .task-state-dot--rejected, .kanban-lane--rejected, .kanban-move-option--rejected,
.dashboard-status-track__segment--rejected, .dashboard-task-row--rejected, .metric-row--rejected {
  --st: var(--status-rejected);
  --st-icon: var(--icon-rejected);
}

.status-badge--cancelled, .task-state-dot--cancelled, .kanban-lane--cancelled, .kanban-move-option--cancelled,
.dashboard-status-track__segment--cancelled, .dashboard-task-row--cancelled, .metric-row--cancelled {
  --st: var(--status-cancelled);
  --st-icon: var(--icon-cancelled);
}

.kanban-lane,
.kanban-move-option,
:root[data-theme="dark"] .kanban-lane,
:root[data-theme="dark"] .kanban-move-option {
  --lane-color: var(--st, var(--color-ink-muted));
  --lane-soft: color-mix(in oklab, var(--st, var(--color-ink-muted)) 9%, var(--sheet));
  --move-color: var(--st, var(--color-ink-muted));
  --move-soft: color-mix(in oklab, var(--st, var(--color-ink-muted)) 9%, var(--sheet));
}

/* 2. Base ------------------------------------------------------------------ */

html {
  font-size: 16px;
}

body,
:root[data-theme="dark"] body {
  background: var(--color-bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 400;
  line-height: 1.5;
  font-feature-settings: "kern", "liga", "calt";
}

html[lang^="ar"] body {
  font-family: var(--font-arabic);
}

h1, h2, h3, h4 {
  color: var(--ink);
  text-wrap: balance;
}

:is(h1, h2, h3, h4, strong, b) {
  font-weight: 600;
}

time,
.date-time,
[data-countdown],
.nav-count,
.summary-item strong,
.dashboard-visualization__total strong {
  font-variant-numeric: tabular-nums;
}

::selection {
  background: color-mix(in oklab, var(--color-focus) 26%, transparent);
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: 4px;
}

a {
  text-underline-offset: 0.18em;
}

.eyebrow,
.section-label,
.page-heading__context {
  color: var(--ink-3);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

/* Icons drawn with strokes keep one weight across the product. */
.primary-nav__item svg,
.mobile-nav__item svg,
.logout-button svg,
.topbar-logout svg,
.icon-button svg {
  stroke-width: 1.7;
}

/* 3. Shell: sidebar --------------------------------------------------------- */

.app-sidebar {
  padding: 14px 12px 14px;
  border-inline-end: 1px solid var(--line);
  background: var(--shell-bg);
  color: var(--ink);
}

.brand {
  min-height: 44px;
  gap: 10px;
  padding-inline: 8px;
  border-radius: var(--radius-md);
}

.brand strong,
.mobile-brand strong {
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.brand small {
  margin-block-start: 1px;
  color: var(--ink-3);
  font-size: var(--text-2xs);
}

/* The mark: three rising bars on an ink tile (the markup always had them). */
.brand-mark,
.brand-mark--compact {
  display: inline-flex;
  width: 30px;
  height: 30px;
  align-items: flex-end;
  justify-content: center;
  gap: 2.5px;
  padding: 7px 7px 8px;
  border-radius: 8px;
  background: var(--primary-bg);
  box-shadow: none;
}

.brand-mark span,
.brand-mark span:first-child {
  display: block;
  width: 3.5px;
  border-radius: 1.5px;
  background: var(--primary-ink);
  box-shadow: none;
}

.brand-mark span:nth-child(1) { height: 7px; }
.brand-mark span:nth-child(2) { height: 14px; background: var(--color-teal-500); }
.brand-mark span:nth-child(3) { height: 10px; }

:root[data-theme="dark"] .brand-mark span:nth-child(2) {
  background: var(--color-teal-600);
}

.primary-nav {
  gap: 1px;
  margin-block-start: 20px;
}

.primary-nav__item,
:root[data-theme="dark"] .primary-nav__item {
  min-height: 38px;
  gap: 10px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-2);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.25;
}

.primary-nav__item svg {
  width: 18px;
  height: 18px;
  color: var(--ink-3);
  transition: color var(--motion-fast) var(--ease-out-quart);
}

.primary-nav__item:hover,
:root[data-theme="dark"] .primary-nav__item:hover {
  background: color-mix(in oklab, var(--ink) 5%, transparent);
  color: var(--ink);
}

.primary-nav__item:hover svg {
  color: var(--ink-2);
}

.primary-nav__item.is-active,
:root[data-theme="dark"] .primary-nav__item.is-active {
  border-color: var(--line);
  background: var(--sheet);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 2px oklch(0.22 0.012 200 / 0.05);
}

.primary-nav__item.is-active svg {
  color: var(--accent);
}

.notification-nav-button {
  width: 100%;
  cursor: pointer;
  text-align: start;
}

.nav-count {
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--color-danger);
  color: oklch(0.99 0 0);
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.5;
}

.sidebar-footer {
  gap: 10px;
}

.sidebar-utilities {
  gap: 6px;
  padding: 12px 0 0;
  border-block-start: 1px solid var(--line);
}

.sidebar-utility-row {
  gap: 8px;
  padding-inline: 2px;
}

.theme-toggle--sidebar,
.location-sharing--sidebar .location-sharing__button {
  min-height: 34px;
  gap: 9px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-2);
  font-size: var(--text-xs);
  font-weight: 500;
}

.theme-toggle--sidebar:hover,
.location-sharing--sidebar .location-sharing__button:hover {
  border-color: transparent;
  background: color-mix(in oklab, var(--ink) 5%, transparent);
  color: var(--ink);
}

.theme-toggle__icon,
.theme-toggle__icon svg {
  width: 17px;
  height: 17px;
}

.location-sharing--sidebar.is-sharing .location-sharing__button {
  border-color: color-mix(in oklab, var(--color-success) 30%, transparent);
  background: var(--color-success-bg);
  color: var(--color-success);
}

.network-state,
.network-state--sidebar {
  min-height: 26px;
  gap: 6px;
  padding-inline: 8px;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font-size: var(--text-2xs);
  font-weight: 500;
}

.network-state__dot {
  width: 8px;
  height: 8px;
  background: var(--color-success);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--color-success) 18%, transparent);
}

.network-state.is-offline,
.network-state--sidebar.is-offline {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

.network-state.is-offline .network-state__dot {
  background: var(--color-danger);
  box-shadow: none;
}

.language-switch,
.language-switch--sidebar {
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--fill);
}

.language-switch__button,
.language-switch--sidebar .language-switch__button {
  min-width: 34px;
  min-height: 26px;
  border-radius: 6px;
  color: var(--ink-3);
  font-size: var(--text-2xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.language-switch__button:hover {
  color: var(--ink);
}

.language-switch__button.is-active,
.language-switch--sidebar .language-switch__button.is-active,
:root[data-theme="dark"] .language-switch__button.is-active {
  background: var(--sheet);
  color: var(--ink);
  box-shadow: 0 1px 2px oklch(0.22 0.012 200 / 0.08);
}

.user-summary {
  gap: 10px;
  padding: 12px 4px 0;
  border-block-start: 1px solid var(--line);
}

.user-summary strong {
  overflow: hidden;
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-summary small {
  color: var(--ink-3);
  font-size: var(--text-2xs);
}

.user-summary__identity {
  min-width: 0;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-bg);
  color: var(--primary-ink);
  font-size: var(--text-2xs);
  font-weight: 600;
}

.logout-button {
  width: 100%;
  min-height: 34px;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font-size: var(--text-xs);
  cursor: pointer;
}

.logout-button svg {
  width: 17px;
  height: 17px;
}

.logout-button:hover {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

/* 4. Shell: frame, mobile top bar and bottom navigation --------------------- */

.app-content {
  padding: 28px 32px 64px;
}

@media (min-width: 901px) {
  :root {
    --sidebar-width: 240px;
    --content-width: 1440px;
  }

  html {
    font-size: 16px;
  }

  .app-content {
    padding: 28px clamp(20px, 2.6vw, 40px) 64px;
  }
}

.icon-button {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  color: var(--ink-2);
  cursor: pointer;
  transition: background-color var(--motion-fast) var(--ease-out-quart), color var(--motion-fast) var(--ease-out-quart);
}

.icon-button:hover {
  background: color-mix(in oklab, var(--ink) 6%, transparent);
  color: var(--ink);
}

@media (max-width: 900px) {
  .app-topbar,
  .app-topbar--mobile {
    min-height: 56px;
    padding-inline: max(12px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-right));
    border-block-end: 1px solid var(--line);
    background: var(--sheet);
  }

  .topbar-actions {
    gap: 4px;
  }

  .topbar-actions .icon-button,
  .topbar-actions .location-sharing__button {
    width: 44px;
    height: 44px;
  }

  .topbar-actions .language-switch__button {
    min-width: 40px;
    min-height: 36px;
  }

  .app-content {
    padding: 20px 16px calc(96px + env(safe-area-inset-bottom));
  }

  .mobile-nav {
    inset-inline: 0;
    inset-block-end: 0;
    min-height: calc(64px + env(safe-area-inset-bottom));
    padding: 6px max(6px, env(safe-area-inset-left)) calc(6px + env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-right));
    border: 0;
    border-block-start: 1px solid var(--line);
    border-radius: 0;
    background: var(--sheet);
    box-shadow: none;
  }

  .mobile-nav--technician {
    right: 0;
    left: 0;
    width: auto;
    transform: none;
  }

  .mobile-nav__item,
  :root[data-theme="dark"] .mobile-nav__item {
    min-height: 52px;
    gap: 3px;
    border-radius: 10px;
    background: transparent;
    color: var(--ink-3);
    font-size: 0.6875rem;
    font-weight: 500;
  }

  .mobile-nav__item svg {
    width: 52px;
    height: 28px;
    padding: 4px 15px;
    border-radius: 999px;
    color: currentColor;
    transition: background-color var(--motion-fast) var(--ease-out-quart);
  }

  .mobile-nav__item.is-active,
  :root[data-theme="dark"] .mobile-nav__item.is-active {
    background: transparent;
    color: var(--ink);
    font-weight: 600;
  }

  .mobile-nav__item.is-active svg {
    background: var(--accent-soft);
    color: var(--accent);
  }
}

/* 5. Page heading ----------------------------------------------------------- */

.page-heading {
  align-items: flex-end;
  gap: 20px;
  margin-block-end: 20px;
}

.page-heading h1,
.page-heading h1:only-child {
  color: var(--ink);
  font-size: var(--text-2xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

[dir="rtl"] .page-heading h1 {
  letter-spacing: 0;
}

.page-heading > div > p:last-child,
.page-heading p {
  max-width: 68ch;
  margin-block-start: 6px;
  color: var(--ink-3);
  font-size: var(--text-sm);
  line-height: 1.5;
}

@media (max-width: 700px) {
  .page-heading {
    align-items: stretch;
    margin-block-end: 16px;
  }

  .page-heading h1 {
    font-size: var(--text-xl);
  }
}

/* 6. Buttons ---------------------------------------------------------------- */

.button {
  min-height: 38px;
  gap: 7px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0;
  white-space: nowrap;
  transition:
    background-color var(--motion-fast) var(--ease-out-quart),
    border-color var(--motion-fast) var(--ease-out-quart),
    color var(--motion-fast) var(--ease-out-quart),
    box-shadow var(--motion-fast) var(--ease-out-quart),
    transform 120ms var(--ease-out-quart);
}

.button svg {
  width: 17px;
  height: 17px;
}

.button:active:not(:disabled) {
  transform: translateY(1px);
}

.button:disabled,
.button[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
}

.button--primary,
:root[data-theme="dark"] .button--primary {
  border-color: var(--primary-bg);
  background: var(--primary-bg);
  color: var(--primary-ink);
  box-shadow: 0 1px 2px oklch(0.22 0.012 200 / 0.14);
}

.button--primary:hover:not(:disabled),
:root[data-theme="dark"] .button--primary:hover:not(:disabled) {
  border-color: var(--primary-bg-hover);
  background: var(--primary-bg-hover);
  color: var(--primary-ink);
  box-shadow: 0 1px 2px oklch(0.22 0.012 200 / 0.14);
}

.button--secondary,
:root[data-theme="dark"] .button--secondary {
  border-color: var(--line-strong);
  background: var(--sheet);
  color: var(--ink);
  box-shadow: 0 1px 1px oklch(0.22 0.012 200 / 0.04);
}

.button--secondary:hover:not(:disabled),
:root[data-theme="dark"] .button--secondary:hover:not(:disabled) {
  border-color: color-mix(in oklab, var(--line-strong) 60%, var(--ink-3));
  background: var(--fill);
  color: var(--ink);
}

.button--quiet,
:root[data-theme="dark"] .button--quiet {
  border-color: transparent;
  background: transparent;
  color: var(--ink-2);
}

.button--quiet:hover:not(:disabled),
:root[data-theme="dark"] .button--quiet:hover:not(:disabled) {
  border-color: transparent;
  background: color-mix(in oklab, var(--ink) 6%, transparent);
  color: var(--ink);
}

/* A quiet button standing on its own (page headings, toolbars) still needs an edge. */
.page-heading .button--quiet,
.page-actions .button--quiet,
.task-overview__actions .button--quiet,
.location-permission .button--quiet + .button--quiet {
  border-color: var(--line-strong);
  background: var(--sheet);
  color: var(--ink);
}

.page-heading .button--quiet:hover:not(:disabled),
.page-actions .button--quiet:hover:not(:disabled),
.task-overview__actions .button--quiet:hover:not(:disabled) {
  border-color: color-mix(in oklab, var(--line-strong) 60%, var(--ink-3));
  background: var(--fill);
}

.button--danger,
:root[data-theme="dark"] .button--danger {
  border-color: var(--color-danger);
  background: var(--color-danger);
  color: oklch(0.99 0 0);
}

:root[data-theme="dark"] .button--danger {
  color: oklch(0.17 0.008 200);
}

.button--danger:hover:not(:disabled) {
  border-color: color-mix(in oklab, var(--color-danger) 85%, black);
  background: color-mix(in oklab, var(--color-danger) 85%, black);
}

.button--quiet-danger {
  border-color: transparent;
  background: transparent;
  color: var(--color-danger);
}

.button--quiet-danger:hover:not(:disabled) {
  background: var(--color-danger-bg);
}

.button--compact {
  min-height: 32px;
  padding: 0 11px;
  font-size: var(--text-xs);
}

.text-button {
  border: 0;
  background: none;
  color: var(--accent);
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
}

.text-button:hover {
  text-decoration: underline;
}

@media (max-width: 900px) {
  .button {
    min-height: 44px;
    padding: 0 16px;
  }

  .button--compact {
    min-height: 40px;
  }
}

/* 7. Form controls ---------------------------------------------------------- */

.field {
  gap: 6px;
}

.field label,
.field legend,
.technician-picker legend,
.auth-method legend {
  color: var(--ink-2);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.field input:not([type="checkbox"]):not([type="radio"]),
.field select,
.field textarea,
.searchable-select__trigger,
.search-input,
.employee-search input {
  min-height: 38px;
  padding: 7px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--sheet);
  color: var(--ink);
  font-size: var(--text-sm);
  box-shadow: 0 1px 1px oklch(0.22 0.012 200 / 0.03);
  transition:
    border-color var(--motion-fast) var(--ease-out-quart),
    box-shadow var(--motion-fast) var(--ease-out-quart),
    background-color var(--motion-fast) var(--ease-out-quart);
}

.field textarea {
  min-height: 96px;
  line-height: 1.5;
}

.field input:not([type="checkbox"]):not([type="radio"]):hover,
.field select:hover,
.field textarea:hover,
.searchable-select__trigger:hover {
  border-color: color-mix(in oklab, var(--line-strong) 55%, var(--ink-3));
}

.field input:not([type="checkbox"]):not([type="radio"]):focus,
.field select:focus,
.field textarea:focus,
.searchable-select__trigger:focus-visible,
.searchable-select.is-open .searchable-select__trigger,
.search-input:focus,
.employee-search input:focus {
  border-color: var(--color-focus);
  outline: 0;
  box-shadow: var(--ring);
}

.field input::placeholder,
.field textarea::placeholder,
.searchable-select__input::placeholder {
  color: color-mix(in oklab, var(--ink-3) 88%, var(--sheet));
  opacity: 1;
}

.field input:disabled,
.field select:disabled,
.field textarea:disabled {
  background: var(--fill);
  color: var(--ink-3);
  cursor: not-allowed;
}

.field input.input-validation-error,
.field select.input-validation-error,
.field textarea.input-validation-error,
.field .is-invalid {
  border-color: var(--color-danger);
}

.field-hint {
  color: var(--ink-3);
  font-size: var(--text-xs);
  line-height: 1.45;
}

.form-section + .form-section {
  border-color: var(--line);
}

.form-section__heading h2 {
  font-size: var(--text-md);
  font-weight: 600;
}

.form-section__heading p {
  color: var(--ink-3);
  font-size: var(--text-xs);
}

.form-actions {
  border-color: var(--line);
  background: color-mix(in oklab, var(--fill) 55%, var(--sheet));
}

.field-error,
.field-validation-error {
  color: var(--color-danger);
  font-size: var(--text-xs);
  font-weight: 500;
}

.searchable-select__value {
  color: var(--ink);
  font-size: var(--text-sm);
}

.searchable-select__chevron {
  color: var(--ink-3);
}

.searchable-select__popover {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--sheet);
  box-shadow: var(--shadow-pop);
}

.searchable-select__input {
  min-height: 36px;
  border-radius: 7px;
  font-size: var(--text-sm);
}

.searchable-select__option {
  min-height: 36px;
  border-radius: 6px;
  color: var(--ink);
  font-size: var(--text-sm);
}

.searchable-select__option:hover,
.searchable-select__option:focus-visible,
.searchable-select__option[aria-selected="true"] {
  background: var(--fill);
}

.searchable-select__check {
  color: var(--accent);
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--primary-bg);
}

.check-field--filter {
  min-height: 38px;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--sheet);
  color: var(--ink-2);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
}

.check-field--filter:has(input:checked) {
  border-color: var(--ink);
  color: var(--ink);
}

.check-field--filter input {
  width: 16px;
  height: 16px;
}

@media (max-width: 900px) {
  .field input:not([type="checkbox"]):not([type="radio"]),
  .field select,
  .searchable-select__trigger,
  .check-field--filter {
    min-height: 44px;
    font-size: var(--text-md);
  }
}

/* Validation and feedback messages. */
.validation-summary,
.feedback {
  border-radius: 8px;
  font-size: var(--text-sm);
}

.feedback--success {
  border: 1px solid color-mix(in oklab, var(--color-success) 26%, transparent);
  background: var(--color-success-bg);
  color: color-mix(in oklab, var(--color-success) 80%, var(--ink));
}

.feedback--error,
.validation-summary-errors {
  border: 1px solid color-mix(in oklab, var(--color-danger) 26%, transparent);
  background: var(--color-danger-bg);
  color: color-mix(in oklab, var(--color-danger) 85%, var(--ink));
}

/* 8. Status: badges, glyphs, type tags -------------------------------------- */

.status-badge,
:root[data-theme="dark"] .status-badge,
:root[data-theme="dark"] .status-badge--working,
:root[data-theme="dark"] .status-badge--review,
:root[data-theme="dark"] .status-badge--pending,
:root[data-theme="dark"] .status-badge--cancelled {
  min-height: 24px;
  gap: 6px;
  padding: 0 9px 0 7px;
  border: 1px solid color-mix(in oklab, var(--st) 26%, transparent);
  border-radius: 999px;
  background: color-mix(in oklab, var(--st) 9%, var(--sheet));
  color: color-mix(in oklab, var(--st) var(--status-text-mix), var(--ink));
  font-size: var(--text-2xs);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  box-shadow: none;
}

.status-badge > span[aria-hidden="true"],
.status-badge > span:empty,
.task-state-dot,
:root[data-theme="dark"] .task-state-dot {
  display: inline-block;
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 0;
  background: var(--st);
  box-shadow: none;
  -webkit-mask: var(--st-icon) center / contain no-repeat;
  mask: var(--st-icon) center / contain no-repeat;
}

.task-state-dot {
  width: 15px;
  height: 15px;
}

.task-type-badge,
.dashboard-type-badge {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--fill);
  color: var(--ink-2);
  font-size: var(--text-2xs);
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

.person-chip {
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--fill);
  color: var(--ink-2);
  font-size: var(--text-2xs);
  font-weight: 500;
}

.avatar-stack span {
  background: var(--fill);
  color: var(--ink-2);
  border-color: var(--sheet);
  font-weight: 600;
}

/* 9. Surfaces: one sheet style for every grouped block ---------------------- */

.task-filter,
.operations-list,
.dashboard-visualization,
.dashboard-task-list,
.task-form,
.workflow-panel,
.detail-section,
.activity-panel,
.team-assignment,
.employee-table-wrap,
.employee-tools,
.report-filter-panel,
.report-panel,
.report-chart-panel,
.management-kpis,
.report-kpis,
.task-map-workspace,
.technician-status-summary,
.next-task,
.task-list-section,
.filter-panel,
.team-panel,
.empty-state,
.dev-role-lab {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--sheet);
  box-shadow: none;
}

.danger-zone {
  border: 1px solid color-mix(in oklab, var(--color-danger) 28%, var(--line));
  border-radius: var(--radius-lg);
  background: var(--sheet);
  box-shadow: none;
}

/* Section headers inside sheets. */
.section-heading,
.report-panel > header,
.dashboard-visualization__header,
.technician-task-section__heading {
  border-color: var(--line);
}

.section-heading h2,
.report-panel > header h2,
.dashboard-visualization__header h2,
.technician-task-section__heading h2,
.detail-section h2,
.workflow-panel h2,
.activity-panel h2,
.form-section__heading h2 {
  color: var(--ink);
  font-size: var(--text-md);
  font-weight: 600;
  letter-spacing: -0.005em;
}

.results-heading,
.dashboard-results-heading {
  min-height: 32px;
  color: var(--ink-3);
  font-size: var(--text-xs);
  font-weight: 500;
}

.results-heading strong,
.dashboard-results-heading strong {
  color: var(--ink-2);
  font-weight: 600;
}

/* Empty states teach the next step instead of shrugging. */
.empty-state,
.compact-empty-state,
.technician-empty-state {
  color: var(--ink-3);
}

.empty-state > span[aria-hidden="true"] {
  display: inline-grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: var(--fill);
  color: var(--ink-3);
  font-size: var(--text-md);
  font-weight: 600;
}

.empty-state h2,
.compact-empty-state strong,
.technician-empty-state strong {
  color: var(--ink);
  font-size: var(--text-md);
  font-weight: 600;
}

.empty-state p,
.compact-empty-state span,
.technician-empty-state p {
  max-width: 48ch;
  color: var(--ink-3);
  font-size: var(--text-sm);
}

/* 10. Filters: a compact toolbar, not a form card --------------------------- */

.task-filter-panel {
  margin-block-end: 16px;
}

.task-filter-panel > summary {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--sheet);
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: 600;
  box-shadow: none;
}

.task-filter {
  gap: 12px;
  padding: 14px;
}

.task-filter__row {
  gap: 10px;
}

.task-filter .field > label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 901px) {
  .task-filter__row--primary,
  .kanban-filter-wrap .task-filter__row--primary {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  .task-filter__row--primary .field--search {
    grid-column: 1 / -1;
  }
}

@media (min-width: 1360px) {
  .task-filter__row--primary .field--search {
    grid-column: span 2;
  }
}

.task-filter__row--secondary {
  padding-block-start: 12px;
  border-block-start: 1px solid var(--line);
}

.task-filter__actions {
  gap: 6px;
}

.task-date-filter__quick,
.segmented-control,
.report-presets,
.report-view-switcher,
.site-survey-segmented {
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--fill);
}

.task-date-filter__option,
.segmented-control button,
.segmented-control a,
.report-presets button,
.report-view-switcher a,
.report-view-switcher button {
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-2);
  font-size: var(--text-xs);
  font-weight: 500;
  cursor: pointer;
  transition: background-color var(--motion-fast) var(--ease-out-quart), color var(--motion-fast) var(--ease-out-quart);
}

.task-date-filter__option:hover,
.segmented-control button:hover,
.segmented-control a:hover,
.report-presets button:hover,
.report-view-switcher a:hover {
  color: var(--ink);
}

.task-date-filter__option.is-active,
.segmented-control button.is-active,
.segmented-control a.is-active,
.report-presets button.is-active,
.report-view-switcher .is-active,
:root[data-theme="dark"] .task-date-filter__option.is-active,
:root[data-theme="dark"] .report-presets button.is-active {
  border-color: transparent;
  background: var(--sheet);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 2px oklch(0.22 0.012 200 / 0.10), 0 0 0 1px var(--line);
}

/* 11. Dashboard (managers) -------------------------------------------------- */

.dashboard-alert {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-block-end: 16px;
  padding: 10px 12px 10px 10px;
  border: 1px solid color-mix(in oklab, var(--status-review) 28%, var(--line));
  border-radius: var(--radius-lg);
  background: color-mix(in oklab, var(--status-review) 7%, var(--sheet));
  color: var(--ink);
  font-size: var(--text-sm);
}

.dashboard-alert > span[aria-hidden="true"] {
  display: inline-grid;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 7px;
  background: var(--status-review);
  color: oklch(0.99 0 0);
  font-size: var(--text-xs);
  font-weight: 700;
}

.dashboard-alert strong {
  flex: 1;
  font-weight: 500;
}

.dashboard-alert a {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--sheet);
  color: var(--ink);
  font-size: var(--text-xs);
  font-weight: 600;
  text-decoration: none;
}

.dashboard-alert a:hover {
  background: var(--fill);
}

.dashboard-visualization {
  padding: 18px 20px 20px;
  margin-block-end: 20px;
}

.dashboard-visualization__header {
  padding: 0 0 16px;
  border: 0;
}

.dashboard-visualization__header p {
  color: var(--ink-3);
  font-size: var(--text-xs);
}

.dashboard-visualization__total {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.dashboard-visualization__total span {
  color: var(--ink-3);
  font-size: var(--text-xs);
  font-weight: 500;
}

.dashboard-visualization__total strong {
  color: var(--ink);
  font-size: 1.875rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
}

.dashboard-status-track {
  height: 10px;
  gap: 2px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--fill);
}

.dashboard-status-track__segment {
  min-width: 4px;
  border-radius: 2px;
  background: var(--st) !important;
}

.dashboard-status-legend {
  gap: 2px 18px;
  margin-block-start: 14px;
}

.dashboard-status-legend__item {
  min-height: 34px;
  gap: 8px;
  padding: 6px 0;
  border: 0;
  border-block-end: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--ink-2);
  font-size: var(--text-xs);
}

.dashboard-status-legend__item strong {
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.dashboard-status-legend__item small {
  color: var(--ink-3);
  font-size: var(--text-2xs);
  font-variant-numeric: tabular-nums;
}

.dashboard-visualization__overdue {
  border: 1px solid color-mix(in oklab, var(--color-danger) 22%, var(--line));
  border-radius: var(--radius-md);
  background: color-mix(in oklab, var(--color-danger) 6%, var(--sheet));
  box-shadow: none;
}

.dashboard-visualization__overdue span {
  color: color-mix(in oklab, var(--color-danger) 80%, var(--ink));
  font-size: var(--text-xs);
  font-weight: 600;
}

.dashboard-visualization__overdue strong {
  color: var(--color-danger);
  font-size: 1.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.dashboard-visualization__overdue small {
  color: var(--ink-2);
  font-size: var(--text-2xs);
}

/* Task rows on the dashboard read as one list, not a stack of cards. */
.dashboard-task-list {
  display: block;
  overflow: hidden;
}

.dashboard-task-row,
:root[data-theme="dark"] .dashboard-task-row,
:root[data-theme="dark"] .dashboard-task-row--working,
:root[data-theme="dark"] .dashboard-task-row--assigned,
:root[data-theme="dark"] .dashboard-task-row--review,
:root[data-theme="dark"] .dashboard-task-row--done,
:root[data-theme="dark"] .dashboard-task-row--rejected,
:root[data-theme="dark"] .dashboard-task-row--pending,
:root[data-theme="dark"] .dashboard-task-row--cancelled,
.dashboard-task-row--working,
.dashboard-task-row--assigned,
.dashboard-task-row--review,
.dashboard-task-row--done,
.dashboard-task-row--rejected,
.dashboard-task-row--pending,
.dashboard-task-row--cancelled {
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.dashboard-task-row {
  min-height: 60px;
  padding: 10px 16px;
  transition: background-color var(--motion-fast) var(--ease-out-quart);
}

.dashboard-task-row + .dashboard-task-row {
  border-block-start: 1px solid var(--line);
}

.dashboard-task-row:hover {
  background: color-mix(in oklab, var(--fill) 70%, var(--sheet));
}

.dashboard-task-row__identity {
  color: inherit;
  text-decoration: none;
}

.dashboard-task-row__identity strong {
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: 600;
}

.dashboard-task-row__identity:hover strong {
  color: var(--accent);
}

.dashboard-task-row__identity > span {
  color: var(--ink-3);
  font-size: var(--text-xs);
}

.dashboard-task-row__meta {
  gap: 10px;
}

.dashboard-task-row__meta time {
  color: var(--ink-2);
  font-size: var(--text-xs);
}

.dashboard-task-row__quick-actions a {
  color: var(--accent);
  font-size: var(--text-xs);
  font-weight: 600;
}

.compact-empty-state {
  padding: 32px 20px;
}

/* 12. Technician workspace -------------------------------------------------- */

.technician-status-summary {
  overflow: hidden;
  gap: 0;
  padding: 0;
  margin-block-end: 20px;
}

.technician-status-summary > div {
  min-height: 74px;
  gap: 2px;
  padding: 12px 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.technician-status-summary > div + div {
  border-inline-start: 1px solid var(--line);
}

.technician-status-summary strong {
  color: var(--ink);
  font-size: var(--text-xl);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.technician-status-summary span {
  color: var(--ink-3);
  font-size: var(--text-2xs);
  font-weight: 500;
}

.technician-status-summary .is-working strong,
:root[data-theme="dark"] .technician-status-summary .is-working strong {
  color: color-mix(in oklab, var(--status-working) var(--status-text-mix), var(--ink));
}

.technician-status-summary .is-pending strong,
:root[data-theme="dark"] .technician-status-summary .is-pending strong {
  color: color-mix(in oklab, var(--status-pending) var(--status-text-mix), var(--ink));
}

.technician-status-summary .is-review strong,
:root[data-theme="dark"] .technician-status-summary .is-review strong {
  color: color-mix(in oklab, var(--status-review) var(--status-text-mix), var(--ink));
}

.technician-status-summary .is-done strong,
:root[data-theme="dark"] .technician-status-summary .is-done strong {
  color: color-mix(in oklab, var(--status-done) var(--status-text-mix), var(--ink));
}

.technician-task-section__heading {
  min-height: 36px;
  border: 0;
}

.technician-task-section__heading span {
  color: var(--ink-3);
  font-size: var(--text-xs);
}

.technician-task-list {
  gap: 10px;
}

.technician-task-card {
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--sheet);
  box-shadow: 0 1px 2px oklch(0.22 0.012 200 / 0.04);
}

.technician-task-card__topline time {
  color: var(--ink-2);
  font-size: var(--text-xs);
  font-weight: 600;
}

.technician-task-card__identity strong {
  color: var(--ink);
  font-size: var(--text-lg);
  font-weight: 600;
  line-height: 1.3;
}

.technician-task-card__identity span {
  color: var(--ink-2);
  font-size: var(--text-sm);
}

.technician-task-card__identity small {
  color: var(--ink-3);
  font-size: var(--text-xs);
}

.technician-task-card__actions {
  gap: 8px;
}

.technician-task-card__actions .button--quiet {
  border-color: var(--line-strong);
  background: var(--sheet);
  color: var(--ink);
}

.technician-task-card--completed {
  background: color-mix(in oklab, var(--fill) 50%, var(--sheet));
}

/* 13. Task list ------------------------------------------------------------- */

.operations-list {
  overflow: hidden;
}

.operation-item {
  min-height: 60px;
  padding: 10px 14px 10px 16px;
  border: 0;
  background: transparent;
}

.operation-item + .operation-item {
  border-block-start: 1px solid var(--line);
}

.operation-item:hover {
  background: color-mix(in oklab, var(--fill) 70%, var(--sheet));
}

.operation-item__main {
  color: inherit;
  text-decoration: none;
}

.operation-item__content strong {
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: 600;
}

.operation-item__main:hover .operation-item__content strong {
  color: var(--accent);
}

.operation-item__content > span,
.operation-item__reference,
.operation-item__due {
  color: var(--ink-3);
  font-size: var(--text-xs);
  font-weight: 400;
}

.operation-item__due {
  color: var(--ink-2);
  font-weight: 500;
}

.operation-item__reference {
  overflow: hidden;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.operation-item > .status-badge {
  justify-self: start;
  width: max-content;
  max-width: 100%;
}

.operation-item__content > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-action {
  border-radius: 8px;
  color: var(--ink-3);
}

.row-action:hover {
  background: var(--fill);
  color: var(--ink);
}

.row-action--label {
  min-height: 32px;
  padding-inline: 10px;
  border: 1px solid var(--line-strong);
  background: var(--sheet);
  color: var(--ink);
  font-size: var(--text-2xs);
  font-weight: 600;
}

.inline-team-editor {
  border-color: var(--line);
  background: var(--fill);
}

/* 14. Kanban ---------------------------------------------------------------- */

.kanban-lane {
  border: 0;
  background: transparent;
}

@media (min-width: 901px) {
  .kanban-lane {
    flex: 0 0 clamp(272px, 21vw, 340px);
  }
}

.kanban-board__track {
  gap: 12px;
}

.kanban-lane__header {
  min-height: 40px;
  grid-template-columns: 15px minmax(0, 1fr) auto;
  gap: 8px;
  padding: 0 6px 4px;
  border: 0;
  background: transparent;
  color: var(--ink);
}

.kanban-lane__header .task-state-dot,
:root[data-theme="dark"] .kanban-lane__header .task-state-dot {
  width: 15px;
  height: 15px;
  background: var(--st);
}

.kanban-lane__header h2 {
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.3;
}

.kanban-filter-wrap .field > label {
  font-size: var(--text-2xs);
}

.kanban-lane__count {
  min-width: 24px;
  padding: 1px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--sheet);
  color: var(--ink-2);
  font-size: var(--text-2xs);
  font-weight: 600;
}

.kanban-lane__body,
.kanban-lane__body:is(*) {
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in oklab, var(--fill) 80%, var(--color-bg));
}

.kanban-lane.is-drag-over .kanban-lane__body,
.kanban-lane.is-drop-available .kanban-lane__body {
  border-color: color-mix(in oklab, var(--st) 50%, transparent);
  background: color-mix(in oklab, var(--st) 8%, var(--sheet));
}

.kanban-card,
:root[data-theme="dark"] .kanban-card {
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--sheet);
  box-shadow: 0 1px 2px oklch(0.22 0.012 200 / 0.05);
  transition: border-color var(--motion-fast) var(--ease-out-quart), box-shadow var(--motion-fast) var(--ease-out-quart);
}

.kanban-card:hover,
.kanban-card:focus-within {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}

.kanban-card.is-dragging {
  box-shadow: var(--shadow-pop);
}

.kanban-card__topline time {
  color: var(--ink-3);
  font-size: var(--text-2xs);
}

.kanban-card__title {
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.35;
  text-decoration: none;
}

.kanban-card__title:hover {
  color: var(--accent);
}

.kanban-card__context span,
.kanban-card__engineers {
  color: var(--ink-3);
  font-size: var(--text-2xs);
}

.kanban-card__context svg {
  color: var(--ink-3);
  opacity: 0.8;
}

.kanban-card__engineers strong {
  color: var(--ink-2);
  font-weight: 500;
}

.kanban-card__actions {
  border-color: var(--line);
}

.kanban-card__actions a,
.kanban-card__actions button {
  border-radius: 6px;
  color: var(--ink-2);
  font-size: var(--text-2xs);
  font-weight: 600;
}

.kanban-card__actions a:hover,
.kanban-card__actions button:hover {
  background: var(--fill);
  color: var(--ink);
}

.kanban-card__drag-handle {
  color: var(--ink-3);
}

.kanban-empty,
:root[data-theme="dark"] .kanban-empty {
  border: 1px dashed var(--line-strong);
  background: transparent;
  color: var(--ink-3);
  font-size: var(--text-xs);
}

.kanban-load-more {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--sheet);
  color: var(--ink-2);
  font-size: var(--text-xs);
  font-weight: 600;
}

.kanban-load-more:hover {
  border-color: color-mix(in oklab, var(--line-strong) 55%, var(--ink-3));
  background: var(--fill);
  color: var(--ink);
}

/* 15. Task details ---------------------------------------------------------- */

/* Heading: back link on its own line, then title and actions side by side. */
@media (min-width: 761px) {
  .task-details-heading {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "back back"
      "content actions";
    align-items: end;
    gap: 6px 24px;
    padding-block: 0 18px;
    margin-block-end: 16px;
  }

  .task-details-heading .page-actions {
    display: flex;
    max-width: min(560px, 52vw);
    flex-wrap: wrap;
    justify-content: flex-end;
    align-self: end;
    gap: 8px;
  }
}

@media (min-width: 761px) and (max-width: 1359px) {
  .task-details-heading {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "back"
      "content"
      "actions";
    gap: 8px;
  }

  .task-details-heading .page-actions {
    max-width: none;
    justify-content: flex-start;
    margin-block-start: 8px;
  }
}

.task-details-heading {
  border-color: var(--line);
}

.task-details-back,
.back-link {
  display: inline-flex;
  width: fit-content;
  min-height: 32px;
  align-items: center;
  gap: 4px;
  margin-inline-start: -6px;
  padding-inline: 6px 10px;
  border-radius: 7px;
  color: var(--ink-3);
  font-size: var(--text-xs);
  font-weight: 500;
  text-decoration: none;
}

.task-details-back:hover,
.back-link:hover {
  background: color-mix(in oklab, var(--ink) 5%, transparent);
  color: var(--ink);
}

.task-details-back svg,
.back-link svg {
  width: 16px;
  height: 16px;
}

[dir="rtl"] .task-details-back svg,
[dir="rtl"] .back-link svg {
  transform: scaleX(-1);
}

.task-details-heading__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.task-reference {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--fill);
  color: var(--ink-2);
  font-size: var(--text-2xs);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.task-reference svg {
  width: 13px;
  height: 13px;
  color: var(--ink-3);
}

.task-details-heading h1 {
  margin-block-start: 8px;
  font-size: var(--text-2xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

[dir="rtl"] .task-details-heading h1 {
  letter-spacing: 0;
}

.task-details-heading__location {
  margin-block-start: 4px;
  color: var(--ink-3);
  font-size: var(--text-sm);
}

/* Overview strip: the four facts a technician checks first. */
.task-overview {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--sheet);
  box-shadow: none;
}

.task-overview__fact {
  border-color: var(--line);
}

.task-overview__icon {
  border-radius: 8px;
  background: var(--fill);
  color: var(--ink-2);
}

.task-overview__fact dt {
  color: var(--ink-3);
  font-size: var(--text-2xs);
  font-weight: 500;
}

.task-overview__fact dd {
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: 600;
}

.task-overview__fact.is-overdue .task-overview__icon {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

.task-overview__fact.is-overdue dd {
  color: var(--color-danger);
}

.task-overview__alert {
  border-radius: 999px;
  background: var(--color-danger-bg);
  color: var(--color-danger);
  font-weight: 600;
}

.task-overview__actions {
  border-color: var(--line);
  background: color-mix(in oklab, var(--fill) 55%, var(--sheet));
}

.detail-grid {
  border-color: var(--line);
}

.detail-grid > div {
  border-color: var(--line);
}

.detail-grid dt,
.task-facts dt {
  color: var(--ink-3);
  font-size: var(--text-2xs);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.detail-grid dd,
.task-facts dd {
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: 500;
}

.workflow-progress__step > span {
  border-color: var(--sheet);
}

/* Timing and work sessions: one data block with rows, no cards in cards. */
.task-timing,
.task-work-sessions {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--sheet);
}

.task-timing__item + .task-timing__item,
.task-work-session__facts > div + div {
  border-color: var(--line);
}

.task-timing dt,
.task-work-session__facts dt,
.task-work-sessions__total span {
  color: var(--ink-3);
  font-size: var(--text-2xs);
  font-weight: 500;
}

.task-timing dd,
.task-work-session__facts dd {
  color: var(--ink);
  font-size: var(--text-xs);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.task-timing__item--duration,
.task-work-session__duration {
  background: var(--fill);
}

.task-timing__item--duration dd,
.task-work-session__duration dd,
.task-work-sessions__total strong {
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: 600;
}

.task-work-sessions__heading {
  padding: 14px 16px;
  border-color: var(--line);
  background: transparent;
}

.task-work-sessions__heading h3 {
  font-size: var(--text-sm);
  font-weight: 600;
}

.task-work-sessions__heading p {
  color: var(--ink-3);
  font-size: var(--text-xs);
}

.task-work-sessions__total {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--fill);
}

.task-work-sessions__list {
  gap: 0;
  padding: 0;
}

.task-work-session,
.task-work-session.is-active {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.task-work-session + .task-work-session {
  border-block-start: 1px solid var(--line);
}

.task-work-session.is-active {
  background: color-mix(in oklab, var(--color-success) 5%, var(--sheet));
}

.task-work-session__header {
  padding: 10px 16px 4px;
  border: 0;
}

.task-work-session__header > strong {
  font-size: var(--text-sm);
  font-weight: 600;
}

.task-work-session__number {
  padding: 2px 8px;
  border: 1px solid var(--line);
  background: var(--fill);
  color: var(--ink-2);
  font-size: var(--text-2xs);
  font-weight: 500;
}

.task-work-session__state {
  color: var(--ink-3);
  font-size: var(--text-2xs);
  font-weight: 500;
}

.task-work-session__facts {
  margin: 0 16px 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.task-work-session__facts > div {
  padding: 8px 12px;
}

.task-timing__live {
  color: var(--color-success);
  font-weight: 600;
}

.task-timing__live > span {
  background: var(--color-success);
  box-shadow: 0 0 0 0 color-mix(in oklab, var(--color-success) 40%, transparent);
  animation: live-pulse 1.8s var(--ease-out-quart) infinite;
}

@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in oklab, var(--color-success) 45%, transparent); }
  70%, 100% { box-shadow: 0 0 0 6px color-mix(in oklab, var(--color-success) 0%, transparent); }
}

@media (prefers-reduced-motion: reduce) {
  .task-timing__live > span {
    animation: none;
    box-shadow: 0 0 0 3px color-mix(in oklab, var(--color-success) 18%, transparent);
  }
}

/* Workflow panel and its primary action. */
.workflow-panel .section-heading,
.workflow-panel__heading {
  border-color: var(--line);
}

.workflow-panel__heading p,
.section-heading p {
  color: var(--ink-3);
  font-size: var(--text-xs);
}

.workflow-primary-action,
.submit-review-action,
:root[data-theme="dark"] .submit-review-action {
  border-color: var(--line);
  background: color-mix(in oklab, var(--fill) 55%, var(--sheet));
}

.workflow-primary-action strong,
.submit-review-action strong {
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: 600;
}

.workflow-primary-action span,
.submit-review-action span {
  color: var(--ink-3);
  font-size: var(--text-xs);
}

.workflow-message--success {
  border-radius: 8px;
  background: var(--color-success-bg);
  color: color-mix(in oklab, var(--color-success) 80%, var(--ink));
}

.rejection-notice,
.pending-notice,
:root[data-theme="dark"] .pending-notice {
  border: 1px solid color-mix(in oklab, var(--notice) 26%, transparent);
  border-radius: var(--radius-md);
  background: color-mix(in oklab, var(--notice) 8%, var(--sheet));
  color: color-mix(in oklab, var(--notice) var(--status-text-mix), var(--ink));
}

.rejection-notice {
  --notice: var(--status-rejected);
}

.pending-notice,
:root[data-theme="dark"] .pending-notice {
  --notice: var(--status-pending);
}

.pending-notice p,
:root[data-theme="dark"] .pending-notice p,
.rejection-notice p {
  color: var(--ink-2);
}

/* Activity log: a quiet timeline. */
.activity-panel .section-heading h2 + span,
.section-count {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--fill);
  color: var(--ink-2);
  font-size: var(--text-2xs);
  font-weight: 600;
}

.activity-item__content > strong {
  color: var(--ink);
  font-size: var(--text-xs);
  font-weight: 600;
}

.activity-item__meta span,
.activity-item__meta time {
  color: var(--ink-3);
  font-size: var(--text-2xs);
}

.activity-item {
  border-color: var(--line);
}

/* 16. Reports --------------------------------------------------------------- */

.report-kpis article,
.management-kpis > * {
  border-color: var(--line);
}

.report-kpis strong,
.management-kpis strong {
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.015em;
}

.report-panel > header {
  border-block-end: 1px solid var(--line);
}

.metric-track {
  background: var(--fill);
}

.metric-row .metric-track > span {
  background: var(--st, var(--accent));
}

/* Charts: neutral bars by default, status color where the bar is a status. */
.report-bar-chart__track {
  background: var(--fill);
}

.report-bar-chart__track > span {
  background: color-mix(in oklab, var(--ink) 72%, var(--sheet));
}

.report-bar-chart__row--status .report-bar-chart__track > span {
  background: var(--st);
}

.report-bar-chart__row:hover .report-bar-chart__track > span {
  opacity: 0.8;
}

.report-column-chart__bar--count {
  background: var(--status-done);
}

.report-column-chart__bar--hours {
  background: var(--status-assigned);
}

.report-column-chart__value,
.report-column-chart__item time {
  color: var(--ink-3);
  font-size: var(--text-2xs);
  font-variant-numeric: tabular-nums;
}

.report-chart-panel > header,
.report-chart-panel header {
  border-color: var(--line);
}

.report-chart-panel header h2 {
  font-size: var(--text-md);
  font-weight: 600;
}

.report-chart-panel header p {
  color: var(--ink-3);
  font-size: var(--text-xs);
}

.report-view-switcher a.is-active,
.report-view-switcher a[aria-current="page"] {
  background: var(--sheet);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 2px oklch(0.22 0.012 200 / 0.10), 0 0 0 1px var(--line);
}

.report-definition-note {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--sheet);
  color: var(--ink-2);
  font-size: var(--text-xs);
}

.report-definition-note svg {
  color: var(--ink-3);
}

.management-kpis > article span,
.report-kpis article span {
  color: var(--ink-3);
  font-size: var(--text-2xs);
  font-weight: 500;
}

.management-kpi--danger strong {
  color: var(--color-danger);
}

.management-kpi--success strong {
  color: color-mix(in oklab, var(--status-done) 80%, var(--ink));
}

/* 17. Map ------------------------------------------------------------------- */

.task-map-item:hover,
.task-map-item.is-active,
.technician-map-item:hover,
.technician-map-item.is-active,
.report-task-list > a:hover {
  background: var(--fill);
}

/* 18. Employees ------------------------------------------------------------- */

.employee-table th {
  background: color-mix(in oklab, var(--fill) 70%, var(--sheet));
  color: var(--ink-3);
  font-size: var(--text-2xs);
  font-weight: 600;
}

.employee-table td {
  border-color: var(--line);
  color: var(--ink);
  font-size: var(--text-xs);
}

.employee-table tbody tr:hover {
  background: color-mix(in oklab, var(--fill) 70%, var(--sheet));
}

.employee-avatar {
  background: var(--fill);
  color: var(--ink-2);
}

/* 19. Dialogs and popovers -------------------------------------------------- */

dialog::backdrop {
  background: oklch(0.20 0.012 200 / 0.38);
}

.notification-center__surface,
.location-permission__surface,
.kanban-move-dialog,
.kanban-task-dialog__content {
  border: 1px solid var(--line);
  background: var(--sheet);
  box-shadow: var(--shadow-dialog);
}

.notification-center__header .eyebrow {
  display: block;
  margin-block-end: 2px;
  color: var(--ink-3);
  font-size: var(--text-2xs);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.notification-center__toolbar {
  border-color: var(--line);
  color: var(--ink-3);
  font-size: var(--text-xs);
}

.notification-center__header h2,
.location-permission h2 {
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.push-preference {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--fill);
}

.push-preference__icon,
.location-permission__icon {
  background: var(--sheet);
  color: var(--accent);
  box-shadow: 0 0 0 1px var(--line);
}

.notification-item {
  border-color: var(--line);
}

.notification-item:hover {
  background: var(--fill);
}

/* 20. Sign in --------------------------------------------------------------- */

.auth-page {
  background: var(--color-bg);
}

/* The split dark half behind the page is retired: the card carries the contrast. */
.auth-page::before {
  display: none;
}

.auth-topbar {
  background: transparent;
}

.auth-brand,
.auth-brand strong {
  color: var(--ink);
}

.auth-brand strong {
  font-size: var(--text-sm);
  font-weight: 600;
}

.auth-brand small {
  color: var(--ink-3);
  font-size: var(--text-2xs);
}

.auth-topbar .theme-toggle--icon {
  border: 1px solid var(--line);
  background: var(--sheet);
}

.auth-experience,
:root[data-theme="dark"] .auth-experience {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--sheet);
  box-shadow: 0 1px 2px oklch(0.22 0.012 200 / 0.05), 0 24px 48px -24px oklch(0.22 0.012 200 / 0.18);
}

.auth-context {
  background: oklch(0.22 0.012 200);
  color: oklch(0.95 0.005 200);
}

:root[data-theme="dark"] .auth-context {
  background: oklch(0.13 0.006 200);
}

.auth-context h2 {
  color: oklch(0.98 0.004 200);
  font-weight: 600;
  letter-spacing: -0.025em;
}

[dir="rtl"] .auth-context h2 {
  letter-spacing: 0;
}

.auth-context__eyebrow {
  color: oklch(0.80 0.06 186);
  font-weight: 500;
}

.auth-context__copy,
.auth-benefits small {
  color: oklch(0.80 0.008 200);
}

.auth-context__status {
  border: 1px solid oklch(1 0 0 / 0.10);
  background: oklch(1 0 0 / 0.05);
  color: oklch(0.88 0.06 152);
}

.auth-benefits li {
  border-color: oklch(1 0 0 / 0.10);
}

.auth-benefits strong {
  color: oklch(0.97 0.004 200);
  font-weight: 600;
}

.auth-benefits__icon {
  border: 1px solid oklch(1 0 0 / 0.10);
  background: oklch(1 0 0 / 0.04);
  color: oklch(0.82 0.08 186);
}

.auth-panel__heading h1 {
  font-size: var(--text-2xl);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.auth-panel__heading p,
.auth-help {
  color: var(--ink-3);
}

.directory-chip {
  border: 1px solid var(--line);
  background: var(--fill);
  color: var(--ink-2);
  font-weight: 500;
}

.auth-method__surface {
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--sheet);
  transition: border-color var(--motion-fast) var(--ease-out-quart), box-shadow var(--motion-fast) var(--ease-out-quart), background-color var(--motion-fast) var(--ease-out-quart);
}

.auth-method__option:hover .auth-method__surface {
  border-color: color-mix(in oklab, var(--line-strong) 55%, var(--ink-3));
}

.auth-method__option input:checked + .auth-method__surface {
  border-color: var(--ink);
  background: var(--sheet);
  box-shadow: 0 0 0 1px var(--ink);
}

.auth-method__option input:focus-visible + .auth-method__surface {
  box-shadow: 0 0 0 1px var(--ink), var(--ring);
}

.auth-method__icon {
  background: var(--fill);
  color: var(--ink-2);
}

.auth-method__option input:checked + .auth-method__surface .auth-method__icon {
  background: var(--primary-bg);
  color: var(--primary-ink);
}

.auth-method__check {
  border-color: var(--line-strong);
}

.auth-method__option input:checked + .auth-method__surface .auth-method__check {
  border-color: var(--ink);
  background: var(--ink);
  box-shadow: inset 0 0 0 3px var(--sheet);
}

.auth-input {
  min-height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--sheet);
  box-shadow: 0 1px 1px oklch(0.22 0.012 200 / 0.03);
}

.auth-input:hover {
  border-color: color-mix(in oklab, var(--line-strong) 55%, var(--ink-3));
}

.auth-input:focus-within {
  border-color: var(--color-focus);
  background: var(--sheet);
  box-shadow: var(--ring);
}

.field .auth-input input:not([type="checkbox"]):not([type="radio"]),
.field .auth-input input:not([type="checkbox"]):not([type="radio"]):hover,
.field .auth-input input:not([type="checkbox"]):not([type="radio"]):focus {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: var(--text-md);
  box-shadow: none;
  outline: 0;
}

.auth-input > svg {
  color: var(--ink-3);
}

.auth-submit {
  min-height: 46px;
  font-size: var(--text-sm);
}

.dev-role-lab__heading {
  border-color: var(--line);
  background: color-mix(in oklab, var(--fill) 60%, var(--sheet));
}

.dev-role-row + .dev-role-row {
  border-color: var(--line);
}

.dev-role-row__avatar {
  background: var(--fill);
  color: var(--ink-2);
}

/* 21. ERP customers --------------------------------------------------------- */

/* Catalog sync status, shared by every customer and deal page. */
.erp-health {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
  margin-block: 0 16px;
  color: var(--ink-3);
  font-size: var(--text-xs);
}

.erp-health > span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-2);
  font-weight: 500;
}

.erp-health > span:first-child::before {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--ink-3);
  content: "";
}

.erp-health--fresh > span:first-child::before {
  background: var(--color-success);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--color-success) 18%, transparent);
}

.erp-health--stale > span:first-child::before {
  background: var(--color-warning);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--color-warning) 22%, transparent);
}

.erp-health strong {
  flex-basis: 100%;
  color: color-mix(in oklab, var(--color-warning) 62%, var(--ink));
  font-weight: 500;
}

.erp-list,
.erp-details,
.erp-picker,
.erp-task-context {
  border-color: var(--line);
  border-radius: var(--radius-lg);
}

.erp-list__row {
  border-color: var(--line);
}

.erp-list__row h2 a {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

.erp-list__row h2 a:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* Customer record header. */
.customer-back {
  margin-block-end: 10px;
}

.customer-record {
  overflow: hidden;
  margin-block-end: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--sheet);
}

.customer-record__main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px 20px;
  padding: 20px 22px;
}

.customer-record__mark {
  display: inline-grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 12px;
  background: var(--primary-bg);
  color: var(--primary-ink);
}

.customer-record__mark svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.customer-record__identity {
  min-width: 0;
}

.customer-record__identity h1 {
  margin: 0;
  color: var(--ink);
  font-size: var(--text-2xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

[dir="rtl"] .customer-record__identity h1 {
  letter-spacing: 0;
}

.customer-record__alt-name {
  margin: 4px 0 0;
  color: var(--ink-3);
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}

.customer-record__facts {
  display: flex;
  margin: 0;
}

.customer-record__facts > div {
  min-width: 112px;
  padding-inline: 20px;
  border-inline-start: 1px solid var(--line);
}

.customer-record__facts > div:last-child {
  padding-inline-end: 0;
}

.customer-record__facts dt {
  color: var(--ink-3);
  font-size: var(--text-2xs);
  font-weight: 500;
}

.customer-record__facts dd {
  margin: 2px 0 0;
  color: var(--ink);
  font-size: var(--text-lg);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.customer-record__sync {
  padding: 10px 22px;
  border-block-start: 1px solid var(--line);
  background: color-mix(in oklab, var(--fill) 55%, var(--sheet));
}

.customer-record__sync .erp-health {
  margin: 0;
}

.customer-record__sync .feedback,
.customer-record__sync .validation-summary {
  margin: 10px 0 0;
}

/* Deals sheet. */
.customer-deals {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--sheet);
}

.customer-deals__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  padding-block: 12px;
  padding-inline: 20px 12px;
  border-block-end: 1px solid var(--line);
}

.customer-deals__header h2 {
  margin: 0;
  color: var(--ink);
  font-size: var(--text-md);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.customer-stage-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--fill);
}

.customer-stage-filter__option {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border-radius: 6px;
  color: var(--ink-2);
  font-size: var(--text-xs);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--motion-fast) var(--ease-out-quart), color var(--motion-fast) var(--ease-out-quart);
}

.customer-stage-filter__option:hover {
  background: color-mix(in oklab, var(--ink) 5%, transparent);
  color: var(--ink);
}

.customer-stage-filter__option.is-active,
.customer-stage-filter__option.is-active:hover {
  background: var(--sheet);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 2px oklch(0.22 0.012 200 / 0.10), 0 0 0 1px var(--line);
}

.customer-deal-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.customer-deal {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px 24px;
  padding-block: 14px;
  padding-inline: 20px 16px;
  transition: background-color var(--motion-fast) var(--ease-out-quart);
}

.customer-deal + .customer-deal {
  border-block-start: 1px solid var(--line);
}

.customer-deal:hover {
  background: color-mix(in oklab, var(--fill) 60%, var(--sheet));
}

.customer-deal__main {
  min-width: 0;
}

.customer-deal__topline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}

.customer-deal__id {
  min-width: 0;
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
  text-decoration: none;
}

.customer-deal__id:hover {
  color: var(--accent);
  text-decoration: underline;
}

.customer-deal__stage {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--fill);
  color: var(--ink-2);
  font-size: var(--text-2xs);
  font-weight: 500;
  white-space: nowrap;
}

.customer-deal__stage::before {
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: var(--ink-3);
  content: "";
}

.customer-deal__stage--installation::before {
  background: var(--accent);
}

.customer-deal__stage--survey::before {
  border-radius: 50%;
  background: var(--status-review);
}

.customer-deal__place {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 0;
  margin: 6px 0 0;
  color: var(--ink-3);
  font-size: var(--text-xs);
  line-height: 1.45;
}

.customer-deal__place svg {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  align-self: center;
  margin-inline-end: 6px;
  color: var(--ink-3);
}

.customer-deal__address {
  overflow-wrap: anywhere;
}

.customer-deal__governorate {
  color: var(--ink-2);
  font-weight: 500;
}

.customer-deal__separator {
  margin-inline: 6px;
  color: var(--ink-3);
}

.customer-deal__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.customer-deals__empty {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 44px 24px 48px;
  text-align: center;
}

.customer-deals__empty-icon {
  display: inline-grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: var(--fill);
  color: var(--ink-3);
}

.customer-deals__empty-icon svg {
  width: 22px;
  height: 22px;
}

.customer-deals__empty p {
  max-width: 52ch;
  margin: 0;
  color: var(--ink-2);
  font-size: var(--text-sm);
  line-height: 1.55;
  text-wrap: pretty;
}

.customer-deals__empty-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-block-start: 4px;
}

.customer-deals__pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-block: 10px;
  padding-inline: 20px 16px;
  border-block-start: 1px solid var(--line);
  background: color-mix(in oklab, var(--fill) 55%, var(--sheet));
  color: var(--ink-3);
  font-size: var(--text-xs);
  font-weight: 500;
}

.customer-deals__pagination > div {
  display: flex;
  gap: 8px;
}

@media (max-width: 760px) {
  .customer-record__main {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 14px;
    padding: 16px;
  }

  .customer-record__mark {
    width: 44px;
    height: 44px;
    border-radius: 10px;
  }

  .customer-record__mark svg {
    width: 22px;
    height: 22px;
  }

  .customer-record__identity h1 {
    font-size: var(--text-xl);
  }

  .customer-record__facts {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-block-start: 14px;
    border-block-start: 1px solid var(--line);
  }

  .customer-record__facts > div:first-child {
    padding-inline-start: 0;
    border-inline-start: 0;
  }

  .customer-record__sync {
    padding: 10px 16px;
  }

  .customer-deals__header {
    padding: 14px 16px;
  }

  .customer-stage-filter {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .customer-stage-filter__option {
    min-height: 40px;
    padding: 4px 8px;
    text-align: center;
    white-space: normal;
  }

  .customer-deal {
    grid-template-columns: minmax(0, 1fr);
    padding: 14px 16px;
  }

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

  .customer-deal__actions .button {
    min-height: 44px;
  }

  .customer-deals__pagination {
    padding-inline: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .customer-stage-filter__option,
  .customer-deal {
    transition: none;
  }
}

/* 22. Motion ---------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .button,
  .primary-nav__item svg,
  .mobile-nav__item svg,
  .kanban-card,
  .dashboard-task-row,
  .operation-item {
    transition: none;
  }
}
