/* H2O Shift Operator – shadcn-like main UI, sidebar unchanged */
:root {
  --primary: #156382;
  --primary-hover: #0f4a62;
  --primary-muted: rgba(21, 99, 130, 0.08);
  --primary-muted-strong: rgba(21, 99, 130, 0.14);
  --secondary: #ec7b03;
  --secondary-hover: #d66d02;
  --secondary-muted: rgba(236, 123, 3, 0.08);
  /* Main area – shadcn-style neutrals */
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --text: #0a0a0a;
  --text-secondary: #525252;
  --text-muted: #737373;
  --border: #e5e5e5;
  --border-subtle: #f5f5f5;
  --ring: rgba(21, 99, 130, 0.2);
  --sidebar-width: 260px;
  --header-height: 64px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  /* Sidebar (unchanged) */
  --sidebar-bg: #0f2c47;
  --sidebar-bg-hover: rgba(255, 255, 255, 0.06);
  --sidebar-active: #0d516c;
  --sidebar-text: rgba(255, 255, 255, 0.85);
  --sidebar-text-active: #fff;
}

a {
  color: var(--primary);
  text-decoration: underline;
}


/* Operator dark mode */
body.theme-dark {
  --bg: #0f0f0f;
  --surface: #171717;
  --surface-elevated: #262626;
  --text: #fafafa;
  --text-secondary: #a3a3a3;
  --text-muted: #737373;
  --border: #262626;
  --border-subtle: #262626;
  --bg-muted: #262626;
  --primary-muted: rgba(21, 99, 130, 0.25);
  --primary-muted-strong: rgba(21, 99, 130, 0.35);
  --secondary-muted: rgba(236, 123, 3, 0.2);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.2);
}

body.theme-dark input,
body.theme-dark textarea,
body.theme-dark select {
  background: var(--surface-elevated);
  color: var(--text);
  border-color: var(--border);
}

body.theme-dark input::placeholder,
body.theme-dark textarea::placeholder {
  color: var(--text-muted);
}

/* The search wrap is the field; the input inside it stays transparent. */
body.theme-dark .orders-search-input {
  background: none;
}

/* Primary text on the dark surface is too dark to read. */
body.theme-dark .btn-outline,
body.theme-dark .btn-outline:hover {
  color: #7dd3ec;
}
body.theme-dark .btn-outline:hover {
  border-color: #389bc8;
}

/* Job status overview (kanban) in dark mode */
body.theme-dark .kanban-column {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
}

body.theme-dark .kanban-card {
  background: var(--surface);
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.25), 0 1px 2px -1px rgba(0, 0, 0, 0.2);
}

body.theme-dark .kanban-card:hover {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
}

body.theme-dark .kanban-status-planned {
  background: rgba(161, 161, 170, 0.25);
  color: #d4d4d8;
}

body.theme-dark .kanban-status-planned i {
  color: #a1a1aa;
}

body.theme-dark .view-toggle {
  background: var(--surface-elevated);
}

body.theme-dark .view-toggle-btn.active {
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Theme toggle icon visibility: show moon in light mode, sun in dark mode */
#operator-theme-toggle [data-operator-icon-dark] {
  display: none;
}
#operator-theme-toggle [data-operator-icon-light] {
  display: inline-block;
}
body.theme-dark #operator-theme-toggle [data-operator-icon-dark] {
  display: inline-block;
}
body.theme-dark #operator-theme-toggle [data-operator-icon-light] {
  display: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  font-weight: 400;
  color: var(--text);
  background: var(--bg);
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}

/* Layout – fixed viewport, sidebar and main scroll independently */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar – dark, fixed height, no scroll (nav scrolls internally if needed) */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-brand {
  padding: 1.5rem 1.5rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand .company {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
}

.sidebar-brand .platform {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-top: 4px;
  color: var(--sidebar-text-active);
}

.sidebar-logo {
  height: 28px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.sidebar-nav {
  flex: 1;
  min-height: 0;
  padding: 1rem 0.75rem;
  padding-top: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.sidebar-nav-group {
  margin-bottom: 1.25rem;
}

.sidebar-nav-group:last-child {
  margin-bottom: 0;
}

/* Partner switcher */
.sidebar-partner-switcher {
    position: relative;
    padding: 1rem 0 1.25rem;
    position: sticky;
    top: 0px;
    background: var(--sidebar-bg);
    margin-top: 0;
}

.sidebar-partner-btn {
  display: flex;
  align-items: center;
  gap: .55rem;
  width: 100%;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 7px;
  color: #fff;
  padding: .9rem .75rem;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: border-color .15s, background .15s;
}

.sidebar-partner-btn:hover {
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-partner-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-partner-chevron {
  font-size: .65rem;
  opacity: .7;
  flex-shrink: 0;
}

.sidebar-partner-btn[aria-expanded="true"] .sidebar-partner-chevron {
  transform: rotate(180deg);
}

.sidebar-partner-dropdown {
  position: absolute;
  top: calc(100% - 1rem);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  z-index: 200;
  overflow: hidden;
}

.sidebar-partner-dropdown[hidden] { display: none; }

.sidebar-partner-dropdown-item {
  padding: .6rem .9rem;
  font-size: .8rem;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .5rem;
  transition: background .12s;
}

.sidebar-partner-dropdown-item:hover {
  background: var(--surface-alt, #f5f5f5);
}

.sidebar-partner-dropdown-item--active {
  font-weight: 600;
  color: var(--color-primary);
}

.sidebar-nav-group-title {
  padding: 0 1rem 0.5rem;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  padding: 0.625rem 1rem;
  margin-bottom: 2px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  border-radius: var(--radius-sm);
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-nav a:hover {
  background: var(--sidebar-bg-hover);
  color: var(--sidebar-text-active);
}

.sidebar-nav a.active {
  background: #0d516c;
  color: #ffffff;
}

.sidebar-nav a i {
  width: 20px;
  margin-right: 12px;
  font-size: 15px;
  flex-shrink: 0;
  text-align: center;
}

.sidebar-nav .nav-count {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: var(--sidebar-text-active);
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 500;
}

/* Main – scrollable pane, detached from sidebar */
.main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.header {
  height: var(--header-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem 0 2rem;
  flex-shrink: 0;
}

.header h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--text);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* ── System status pill ─────────────────────────────────────────────── */
.sys-status-wrap {
  position: relative;
  display: inline-flex;
}
.sys-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, #16a34a 35%, var(--border));
  background: color-mix(in srgb, #16a34a 10%, var(--surface));
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: inherit;
  cursor: default;
  white-space: nowrap;
  transition: background 0.12s;
}
.sys-status-pill:hover { background: color-mix(in srgb, #16a34a 16%, var(--surface)); }
.sys-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 0 3px color-mix(in srgb, #16a34a 22%, transparent);
  flex-shrink: 0;
}
.sys-status-tip {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 200;
  min-width: 240px;
  padding: 0.75rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-md, 0 8px 28px rgba(0,0,0,.14));
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.12s, transform 0.12s, visibility 0.12s;
  pointer-events: none;
}
.sys-status-wrap:hover .sys-status-tip,
.sys-status-wrap:focus-within .sys-status-tip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.sys-status-tip-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}
.sys-status-tip-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8125rem;
  color: var(--text);
  padding: 0.15rem 0;
}
.sys-status-tip-sync {
  justify-content: space-between;
}
.sys-status-tip-sync span:last-child {
  color: var(--text-muted);
  font-size: 0.78rem;
  white-space: nowrap;
}
.sys-status-tip-sep {
  height: 1px;
  background: var(--border);
  margin: 0.6rem 0;
}
@media (max-width: 720px) {
  .sys-status-text { display: none; }
  .sys-status-pill { padding: 0.4rem; }
}

.header-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Profile: avatar + dropdown */
.profile-wrap {
  position: relative;
}

.profile-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  transition: box-shadow 0.15s ease, opacity 0.15s ease;
}

.profile-trigger:hover {
  opacity: 0.9;
}

.profile-trigger:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--primary);
}

.profile-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-avatar-initials {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.02em;
}

.profile-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0.35rem 0;
  z-index: 100;
}

.profile-dropdown[hidden] {
  display: none;
}

.profile-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.5rem 0.85rem;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background 0.1s ease;
}

.profile-dropdown-item:hover {
  background: var(--bg-muted);
}

.profile-dropdown-item i {
  width: 1em;
  color: var(--text-muted);
}

.profile-dropdown-section {
  padding: 0.5rem 0.85rem;
  border-top: 1px solid var(--border);
}

.profile-dropdown-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.profile-lang-select {
  width: 100%;
  padding: 0.4rem 0.5rem;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.profile-dropdown-footer {
  border-top: 1px solid var(--border);
  padding-top: 0.35rem;
}

.profile-dropdown-logout {
  color: var(--text-muted);
}

.profile-dropdown-logout:hover {
  color: var(--text);
}

/* Alerts (bell) dropdown */
.lang-wrap {
  position: relative;
}

.lang-trigger-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-family: inherit;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}

.lang-trigger-btn:hover {
  background: var(--surface-hover, rgba(0,0,0,0.04));
}

.lang-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  min-width: 160px;
  z-index: 200;
  padding: 0.35rem 0;
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.55rem 1rem;
  background: none;
  border: none;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.lang-option:hover {
  background: var(--surface-hover, rgba(0,0,0,0.04));
}

.lang-option.is-active {
  color: var(--primary);
  font-weight: 600;
}

.alerts-wrap {
  position: relative;
}

.header-icon-btn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.header-icon-btn:hover {
  background: var(--border-subtle);
  color: var(--text);
}

.header-icon-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--primary);
}

.header-icon-btn i {
  font-size: 1.1rem;
}

.alerts-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 320px;
  max-width: 380px;
  max-height: 400px;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 100;
}

.alerts-dropdown[hidden] {
  display: none;
}

.alerts-dropdown-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.alerts-dropdown-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.75rem 1rem;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.1s ease;
}

.alerts-dropdown-item:hover {
  background: var(--bg-muted);
}

.alerts-dropdown-item:last-of-type {
  border-bottom: none;
}

.alerts-dropdown-item-text {
  color: var(--text);
}

.alerts-dropdown-item-time {
  font-size: 11px;
  color: var(--text-muted);
}

.alerts-dropdown-footer {
  padding: 0.5rem 1rem;
  border-top: 1px solid var(--border);
}

.alerts-dropdown-link {
  font-size: 12px;
  font-weight: 500;
  color: var(--primary);
  text-decoration: none;
}

.alerts-dropdown-link:hover {
  text-decoration: underline;
}

/* Role switcher – header icon + dropdown */
.role-switcher-wrap {
  position: relative;
  display: none;
}

.role-switcher-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 260px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0.35rem 0;
  z-index: 1;
}

.role-switcher-dropdown[hidden] {
  display: none;
}

.role-switcher-dropdown-header {
  padding: 0.5rem 0.85rem;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.role-switcher-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.5rem 0.85rem;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background 0.1s ease;
}

.role-switcher-option:hover {
  background: var(--bg-muted);
}

.role-switcher-option i {
  width: 1em;
  color: var(--text-muted);
}

.role-switcher-option.is-active {
  background: var(--primary-muted);
  color: var(--primary);
  font-weight: 500;
}

.role-switcher-option.is-active i {
  color: var(--primary);
}

.header-actions .user {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.header-actions .btn-ghost {
  font-size: 13px;
}

/* Buttons – shadcn-like */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  text-decoration: none;
}

/* [hidden] must override display so el.hidden = true actually works */
.btn[hidden] {
  display: none;
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 12px;
}

.btn-primary {
  background: var(--primary);
  color: #fff !important;
}

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

.btn-secondary {
  background: var(--secondary);
  color: #fff;
}

.btn-secondary:hover {
  background: var(--secondary-hover);
  color: #fff;
}

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

.btn-ghost:hover {
  background: var(--border-subtle);
  color: var(--text);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  background: var(--primary-muted);
  border-color: var(--primary);
  color: var(--primary);
}

/* Content */
.content {
  flex: 1;
  min-height: 0;
  padding: 1.5rem 2rem;
  overflow: auto;
}

.view {
  display: none;
}

.view.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Cards – shadcn-like */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.02em;
  color: var(--text);
}

.card-header-with-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.view-toggle {
  display: inline-flex;
  background: var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 2px;
}

.view-toggle-btn {
  padding: 0.35rem 0.75rem;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.view-toggle-btn:hover {
  color: var(--text);
}

.view-toggle-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.card-body {
  padding: 1.5rem;
  font-size: 14px;
}

/* Schedule visits – calendar */
.calendar-header {
  margin-bottom: 0.75rem;
}

.calendar-title {
  margin: 0 0 0.2em;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
}

.calendar-subtitle {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
}

.calendar-hint {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.85rem;
  margin-bottom: 1.25rem;
  background: var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-muted);
}

.calendar-hint i {
  color: var(--text-secondary);
}

.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.calendar-month-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.calendar-nav-btn {
  padding: 0.4rem 0.5rem;
  min-width: 36px;
}

.calendar-month-year {
  font-size: 16px;
  font-weight: 600;
  min-width: 140px;
  text-align: center;
  color: var(--text);
}

.calendar-main {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1.5rem;
  align-items: start;
}

.calendar-grid-wrap {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.calendar-weekdays span {
  text-align: center;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: 110px;
  padding: 0.75rem;
  gap: 2px;
  min-height: 320px;
}

.calendar-day {
  min-height: 110px;
  overflow: hidden;
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 2px solid transparent;
  cursor: default;
}

.calendar-day.today {
  background: var(--primary-muted);
}

.calendar-day.selected {
  border-color: var(--primary);
  background: var(--primary-muted);
}

.calendar-day.other-month {
  opacity: 0.5;
}

.calendar-day-num {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.calendar-day-events {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  overflow: hidden;
}

.calendar-event {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.4rem;
  font-size: 11px;
  font-weight: 500;
  border-radius: 4px;
  border: 1px solid;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.calendar-event.busy {
  background: rgba(124, 58, 237, 0.1);
  border-color: rgba(124, 58, 237, 0.4);
  color: #5b21b6;
}

.calendar-event.visit {
  background: rgba(236, 123, 3, 0.12);
  border-color: rgba(236, 123, 3, 0.45);
  color: var(--secondary-hover);
}

.calendar-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: sticky;
  top: 0;
}

.calendar-sidebar-card .card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.calendar-sidebar-card .card-header i {
  font-size: 13px;
  color: var(--text-muted);
}

.calendar-sources {
  padding-top: 0.5rem;
}

.calendar-source {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 13px;
  color: var(--text);
  padding: 0.35rem 0;
}

.calendar-source-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.calendar-selected-date {
  font-weight: 600;
  font-size: 14px;
  margin: 0 0 0.25rem;
  color: var(--text);
}

.calendar-selected-events {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

.calendar-pending {
  text-align: center;
  padding: 1.5rem 1rem !important;
}

.calendar-pending-illus {
  font-size: 2rem;
  color: var(--border);
  margin-bottom: 0.5rem;
}

.calendar-pending p {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

@media (max-width: 1024px) {
  .calendar-main {
    grid-template-columns: 1fr;
  }

  .calendar-sidebar {
    position: static;
  }
}

/* Planning filters */
.planning-filters {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 1rem;
}
.planning-filter-select {
  padding: 0.35rem 0.625rem;
  font-size: 0.8125rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text);
  cursor: pointer;
}
.planning-filter-select:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

/* Job overview – Kanban (modern board style) */
.job-overview-kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  min-height: 200px;
}

.job-overview-table {
  display: block;
}

/* [hidden] must override display so toggle works */
.job-overview-kanban[hidden],
.job-overview-table[hidden] {
  display: none !important;
}

.kanban-column {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 120px;
  background: #f1f3f4;
  border-radius: var(--radius-lg);
  padding: 0.75rem;
}

.kanban-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0 0 0.75rem;
  flex-shrink: 0;
}

.kanban-column-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.kanban-column-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.kanban-column-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--primary);
  background: var(--primary-muted);
  border-radius: 9999px;
}

.kanban-column-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.kanban-col-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  font-size: 12px;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.kanban-col-btn:hover {
  color: var(--text);
  background: var(--border-subtle);
}

.kanban-cards {
  flex: 1;
  padding: 0.25rem 0;
  overflow-y: auto;
  min-height: 80px;
}

.kanban-column .kanban-cards {
  padding-right: 2px;
}

.kanban-card {
  padding: 1rem;
  margin-bottom: 0.75rem;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.06), 0 1px 2px -1px rgba(0, 0, 0, 0.06);
  transition: box-shadow 0.15s ease;
}

.kanban-card:hover {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.06);
}

.kanban-card:last-child {
  margin-bottom: 0;
}

.kanban-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.kanban-card-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.5rem;
  font-size: 11px;
  font-weight: 500;
  border-radius: 9999px;
}

.kanban-card-status i {
  font-size: 5px;
  vertical-align: middle;
  margin-top: -1px;
}

.kanban-status-planned { background: rgba(113, 113, 122, 0.12); color: #52525b; }
.kanban-status-planned i { color: #71717a; }
.kanban-status-assigned { background: var(--primary-muted); color: var(--primary); }
.kanban-status-assigned i { color: var(--primary); }
.kanban-status-progress { background: var(--secondary-muted); color: var(--secondary-hover); }
.kanban-status-progress i { color: var(--secondary); }
.kanban-status-blocked { background: rgba(107, 114, 128, 0.12); color: #4b5563; }
.kanban-status-blocked i { color: #4b5563; }
.kanban-status-done { background: rgba(22, 163, 74, 0.12); color: #15803d; }
.kanban-status-done i { color: #16a34a; }

.kanban-card-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  font-size: 12px;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.kanban-card-more:hover {
  opacity: 1;
  color: var(--text);
  background: var(--border-subtle);
}

.kanban-card-top-right {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

.kanban-card-id {
  font-size: .72rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.kanban-delete-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: none;
  background: none;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-muted);
  opacity: 0.5;
  font-size: 11px;
  padding: 0;
  margin-left: 2px;
  transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.kanban-delete-btn:hover {
  opacity: 1;
  color: #dc2626;
  background: rgba(220, 38, 38, 0.08);
}

/* ─────────────────────────────────────────────────────────────
   Location / Area / Installation tree  (.li-*)
   Shared by customer.php tabs and operator visit.php
   ───────────────────────────────────────────────────────────── */
.li-badge {
  display: inline-flex; align-items: center;
  font-size: .65rem; font-weight: 700;
  letter-spacing: .03em;
  padding: .08rem .45rem; border-radius: 99px;
  vertical-align: middle; white-space: nowrap;
}
.li-badge--location     { background: rgba(21,99,130,.12); color: #156382; }
.li-badge--area         { background: rgb(19 19 19 / 10%); color: #434343; }
.li-badge--installation { background: rgba(21,130,61,.12); color: #15803d; }

.li-tree { display: flex; flex-direction: column; gap: .75rem; }

.li-loc { border: 1.5px solid #b3d4e4; border-radius: 10px; overflow: hidden; }
.li-loc-hd {
  display: flex; align-items: center; gap: .75rem;
  padding: .75rem 1rem;
  background: #eaf4f9; border-bottom: 1.5px solid #b3d4e4;
}
.li-loc-hd-icon { color: #156382; font-size: .95rem; flex-shrink: 0; margin-top: .1rem; }
.li-loc-hd-main { flex: 1; min-width: 0; }
.li-loc-name { font-size: .9375rem; font-weight: 700; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; line-height: 1.3; cursor: pointer; }
.li-loc-name:hover { text-decoration: underline; }
.li-loc-meta { font-size: .775rem; color: #5a7a8a; margin-top: .15rem; }
.li-loc-content { padding: .625rem .875rem .875rem; display: flex; flex-direction: column; gap: .375rem; }

.li-area { border: 1px solid #dbdbdb; border-radius: 7px; overflow: hidden; margin-left: .75rem; }
.li-area-hd {
  display: flex; align-items: center; gap: .6rem;
  padding: .5rem .875rem;
  background: #f3f3f3; border-bottom: 1px solid #dbdbdb;
}
.li-area-hd-icon { color: #5f5f5f; font-size: .85rem; flex-shrink: 0; }
.li-area-hd-main { flex: 1; min-width: 0; }
.li-area-name { font-size: .875rem; font-weight: 600; display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; line-height: 1.3; cursor: pointer; }
.li-area-name:hover { text-decoration: underline; }
.li-area-meta { font-size: .75rem; color: var(--text-muted, #6b7280); margin-top: .1rem; }
.li-area-content { padding: .5rem .875rem .625rem; display: flex; flex-direction: column; gap: .275rem; }

.li-inst-group { display: flex; flex-direction: column; gap: .5rem; }
.li-inst {
  display: flex; align-items: center; gap: .625rem;
  padding: .5rem .75rem;
  border: 1px solid var(--border, #e5e8ef); border-radius: 7px;
  background: var(--surface, #fff);
  transition: background .1s, border-color .1s;
}
.li-inst:hover { background: #f8fbfc; border-color: #c8d8e0; }
.li-inst-icon { color: #15803d; font-size: .8rem; flex-shrink: 0; }
.li-inst--measured { border-color: rgba(16,185,129,.45); background: rgba(16,185,129,.04); }
.li-inst--measured .li-inst-icon { color: #059669; }
.li-measured-tick { color: #059669; font-size: .75rem; font-weight: 700; white-space: nowrap; display: flex; align-items: center; gap: .25rem; flex-shrink: 0; }
.li-inst-body { flex: 1; min-width: 0; cursor: pointer; }
.li-inst-name { font-size: .875rem; font-weight: 600; display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; line-height: 1.3; }
.li-inst-meta { font-size: .75rem; color: var(--text-muted, #8a93a3); margin-top: .15rem; display: flex; flex-wrap: wrap; column-gap: 1rem; row-gap: .1rem; }
.li-inst-products { font-size: .75rem; color: var(--text-muted, #8a93a3); min-width: 140px; flex-shrink: 0; padding-top: .2rem; line-height: 1.55; }
.li-inst-actions { display: flex; align-items: center; gap: .3rem; flex-shrink: 0; }
.li-actions { display: flex; align-items: center; gap: .3rem; flex-shrink: 0; }
.li-add-row { padding: .1rem 0; }
.li-add-area-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .375rem; padding-top: .5rem; border-top: 1px dashed var(--border, #e5e8ef); }

/* Coach mark callouts — light blue info box above an action button */
.li-coach-wrap { display: inline-flex; flex-direction: column; align-items: flex-start; gap: .4rem; }
.li-coach-tip {
  display: flex; align-items: center; gap: .45rem;
  background: #eff6ff; color: #1d4ed8;
  border: 1px solid #bfdbfe;
  font-size: .8rem; font-weight: 500; line-height: 1.4;
  padding: .45rem .85rem; border-radius: 6px;
  width: 100%; box-sizing: border-box;
}
/* When tip is a direct flex child of li-add-area-row, span full width so buttons stay on one row below */
.li-add-area-row > .li-coach-tip { flex-basis: 100%; }

/* Dark mode — the tree's header bars and badges are hardcoded light colors above
   (shared with visit.php print/light contexts), so they need explicit dark variants
   rather than picking up var(--text), which would otherwise print light text on them. */
body.theme-dark .li-badge--location { background: rgba(56, 155, 200, .22); color: #7dd3ec; }
body.theme-dark .li-badge--area     { background: rgba(255, 255, 255, .12); color: #d4d4d8; }
body.theme-dark .li-badge--installation { background: rgba(34, 197, 94, .18); color: #4ade80; }

body.theme-dark .li-loc { border-color: rgba(56, 155, 200, .4); }
body.theme-dark .li-loc-hd { background: rgba(21, 99, 130, .22); border-bottom-color: rgba(56, 155, 200, .4); }
body.theme-dark .li-loc-hd-icon { color: #7dd3ec; }
body.theme-dark .li-loc-meta { color: #9cc4d6; }

body.theme-dark .li-area { border-color: var(--border); }
body.theme-dark .li-area-hd { background: var(--surface-elevated); border-bottom-color: var(--border); }
body.theme-dark .li-area-hd-icon { color: var(--text-secondary); }

body.theme-dark .li-inst:hover { background: var(--surface-elevated); border-color: rgba(56, 155, 200, .4); }

body.theme-dark .li-coach-tip { background: rgba(59, 130, 246, .15); color: #93c5fd; border-color: rgba(59, 130, 246, .35); }

/* ───────────────────────────────────────────────────────────── */

.kanban-card-title {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
  line-height: 1.35;
  text-decoration: none;
}
.kanban-card-title:hover {
  color: var(--primary);
  text-decoration: underline;
}

.kanban-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.kanban-card-plan-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.625rem;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff !important;
  background: var(--primary);
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: opacity 0.15s;
}
.kanban-card-plan-btn:hover {
  opacity: 0.88;
  color: #fff !important;
}

.kanban-card-due {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.kanban-card-due i {
  font-size: 11px;
  color: var(--text-muted);
}

.kanban-card-priority {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  font-size: 11px;
  font-weight: 500;
  border-radius: 4px;
}

.priority-low { background: rgba(59, 130, 246, 0.12); color: #2563eb; }
.priority-medium { background: rgba(234, 88, 12, 0.12); color: #c2410c; }
.priority-high { background: rgba(185, 28, 28, 0.1); color: #b91c1c; }

@media (max-width: 1200px) {
  .job-overview-kanban {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .job-overview-kanban {
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }
}

/* Stats row – shadcn-like */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.stat-card .label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.stat-card .value {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text);
}

.stat-card.primary .value { color: var(--primary); }
.stat-card.secondary .value { color: var(--secondary); }

/* Flow hint – shadcn-like */
.flow-hint {
  background: var(--border-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.875rem 1.25rem;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.flow-hint strong { color: var(--text); font-weight: 600; }

/* Dashboards view */
.dashboard-selector-card .card-body { padding: 1rem 1.25rem; }
.dashboard-customer-form {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.dashboard-customer-label {
  font-weight: 500;
  color: var(--text);
  margin: 0;
}
.dashboard-customer-select {
  min-width: 220px;
  padding: 0.4rem 0.6rem;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}
.dashboard-customer-name {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1rem;
}
.dashboard-metrics-row { margin-bottom: 1.5rem; }
.dashboard-charts-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
.dashboard-chart-card .card-body {
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dashboard-chart-card canvas { max-width: 100%; }
.dashboard-pains-card { margin-bottom: 1.5rem; }
.dashboard-pains-empty,
.dashboard-select-hint,
.dashboard-no-customer {
  color: var(--text-muted);
  margin: 0;
  font-size: 14px;
}
.dashboard-pains-table { width: 100%; }
@media (max-width: 900px) {
  .dashboard-charts-row { grid-template-columns: 1fr; }
}

/* Settings pages – secondary left nav + content */
.settings-layout {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

.settings-nav {
  flex-shrink: 0;
  width: 200px;
  padding: 0.5rem 0;
  border-right: 1px solid var(--border);
}

.settings-nav-item {
  display: block;
  padding: 0.5rem 0.75rem;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  margin-bottom: 2px;
  transition: background 0.15s ease, color 0.15s ease;
}

.settings-nav-item:hover {
  color: var(--text);
  background: var(--border-subtle);
}

.settings-nav-item.active {
  color: var(--primary);
  background: var(--primary-muted);
}

.settings-content {
  flex: 1;
  min-width: 0;
}

.settings-page {
  display: none;
}

.settings-page.active {
  display: block;
}

.integrations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
}

.integration-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  min-height: 120px;
  text-align: center;
}

.integration-tile:hover {
  background: var(--border-subtle);
  border-color: var(--border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.integration-tile:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.integration-tile-logo {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
  flex-shrink: 0;
}

.integration-tile-logo img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.integration-tile-initial {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-muted);
  border-radius: var(--radius-md);
}

.integration-tile-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.nav-settings-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 1rem;
}

.nav-order-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-width: 400px;
}

.nav-order-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.35rem;
  background: var(--surface);
}

.nav-order-item.nav-order-section {
  background: var(--border-subtle);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.nav-order-item.nav-order-section .nav-order-actions {
  display: none;
}

.nav-order-label {
  font-size: 14px;
}

.nav-order-actions {
  display: flex;
  gap: 2px;
}

.nav-order-move {
  padding: 0.25rem 0.4rem;
}

.nav-order-item[draggable="true"] {
  cursor: grab;
}
.nav-order-item.nav-order-dragging {
  opacity: 0.6;
  cursor: grabbing;
}
.nav-order-droppable.nav-order-drag-over {
  outline: 2px dashed var(--border);
  outline-offset: 2px;
}

#app-nav-order-list .nav-order-item.nav-item-hidden .nav-order-label,
#app-settings-nav-order-list .nav-order-item.nav-item-hidden .nav-order-label {
  opacity: 0.6;
}

.nav-order-visibility {
  padding: 0.25rem 0.4rem;
  color: var(--text-muted);
}
.nav-order-visibility:hover {
  color: var(--text);
}
#app-nav-order-list .nav-order-item.nav-item-hidden .nav-order-visibility,
#app-settings-nav-order-list .nav-order-item.nav-item-hidden .nav-order-visibility {
  color: var(--primary);
}

.nav-settings-card + .nav-settings-card {
  margin-top: 1.5rem;
}

.card-mt {
  margin-top: 1.5rem;
}

.nav-visibility-table {
  font-size: 13px;
}

.nav-visibility-table th {
  padding: 0.5rem 0.65rem;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  white-space: nowrap;
}

.nav-visibility-table td {
  padding: 0.5rem 0.65rem;
  vertical-align: middle;
}

.nav-visibility-section-row td {
  background: var(--border-subtle);
  font-weight: 600;
  padding: 0.5rem 0.75rem;
}

.nav-visibility-indent {
  padding-left: 1.5rem;
}

.nav-visibility-table input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  margin: 0;
}

/* App layout: two columns + phone preview */
.app-layout-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 900px) {
  .app-layout-columns {
    grid-template-columns: 1fr;
  }
}

.app-layout-left {
  min-width: 0;
}

.app-layout-right {
  display: flex;
  justify-content: center;
  padding: 1rem 0;
}

.app-phone-mockup {
  flex-shrink: 0;
  transform: scale(0.8);
  transform-origin: center top;
}

.app-phone-frame {
  width: 320px;
  height: 640px;
  border-radius: 36px;
  background: #1a1a1a;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35), 0 0 0 3px rgba(255,255,255,0.08);
  padding: 12px;
  position: relative;
  box-sizing: content-box;
}

.app-phone-notch {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 24px;
  background: #1a1a1a;
  border-radius: 0 0 20px 20px;
  z-index: 1;
  pointer-events: none;
}

.app-phone-screen {
  width: 320px;
  height: 616px;
  border: none;
  border-radius: 24px;
  display: block;
  background: var(--surface);
}

/* Wrapper clips the scaled iframe so it doesn’t affect layout */
.app-phone-screen-wrap {
  width: 320px;
  height: 616px;
  border-radius: 24px;
  overflow: hidden;
  position: relative;
}

/* Scale iframe content so text and UI are smaller in the preview.
   Render at 400px then scale to 80% so content (including text) is scaled down. */
.app-phone-screen-wrap .app-phone-screen {
  width: 400px;
  height: 770px;
  transform: scale(0.8);
  transform-origin: 0 0;
}

/* Tables – shadcn-like */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  font-weight: 500;
  color: var(--text-muted);
  font-size: 12px;
  background: transparent;
}

tbody tr:hover td {
  background: var(--border-subtle);
}

tbody tr:last-child td {
  border-bottom: none;
}

/* Neutral in-table links that match UI (no browser blue/underline) */
.table-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}

/* [hidden] must override display so el.hidden = true actually works */
.table-link[hidden] {
  display: none;
}

.table-link:hover {
  color: var(--primary);
  text-decoration: none;
}

.table-row-link {
  cursor: pointer;
}

/* Badges – shadcn-like */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  font-size: 11px;
  font-weight: 500;
  border-radius: var(--radius-full);
}

.badge-planned { background: var(--border-subtle); color: var(--text-muted); }
.badge-assigned { background: var(--primary-muted); color: var(--primary); }
.badge-progress { background: var(--secondary-muted); color: var(--secondary-hover); }
.badge-completed { background: rgba(34, 139, 34, 0.1); color: #15803d; }
.badge-blocked { background: rgba(185, 28, 28, 0.1); color: #b91c1c; }
.badge-active { background: rgba(34, 139, 34, 0.12); color: #15803d; }

/* ── Testing: live run-status pill (matches .sys-status-pill's language) ──── */
/* [hidden] must override display so toggle works */
.test-status-pill[hidden] {
  display: none;
}

.test-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--primary) 35%, var(--border));
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
}

.test-status-pill i.fa-circle-notch { color: var(--primary); }

.test-status-pill a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

.test-status-pill a:hover { text-decoration: underline; }

/* ── Testing: per-test run-history strip (oldest→newest, left→right) ─────── */
.test-history-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.test-history-dot {
  width: 10px;
  height: 18px;
  border-radius: 2px;
  display: inline-block;
}

.test-history-dot.is-pass { background: #22c55e; }
.test-history-dot.is-fail { background: #dc2626; }
.test-history-dot.is-other { background: var(--border-subtle); }

.test-failure-details {
  margin-top: .4rem;
}

.test-failure-details summary {
  cursor: pointer;
  font-size: 11px;
  color: var(--primary);
  user-select: none;
}

.test-failure-screenshot {
  display: block;
  max-width: 360px;
  width: 100%;
  margin-top: .5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.test-failure-error,
.test-failure-stack {
  margin-top: .5rem;
  padding: .6rem .75rem;
  background: var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 11px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 260px;
  overflow-y: auto;
  color: #b91c1c;
}

.test-failure-stack {
  color: var(--text-muted);
}

.test-failure-stack-details summary {
  margin-top: .4rem;
}

/* ── Impersonation banner ───────────────────────────────────────────────── */
.impersonate-bar {
  position: sticky;
  top: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem 1rem;
  background: #7c3aed;
  color: #fff;
  font-size: .8125rem;
  font-weight: 500;
  flex-wrap: wrap;
}
.impersonate-bar i { opacity: .85; }
.impersonate-bar strong { font-weight: 700; }
.impersonate-bar span  { opacity: .8; }
.impersonate-bar-stop {
  padding: .25rem .7rem;
  background: rgba(255,255,255,.2);
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 6px;
  color: #fff;
  font-size: .75rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .12s;
}
.impersonate-bar-stop:hover { background: rgba(255,255,255,.32); }

/* Products page (operator) – Power2Air / Power2H2O catalog */
.products-view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.products-view-subtitle {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.4;
}
.products-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.products-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.products-stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.products-stat-icon-box { background: rgba(34, 139, 34, 0.12); color: #15803d; }
.products-stat-icon-air { background: rgba(59, 130, 246, 0.12); color: #2563eb; }
.products-stat-icon-water { background: rgba(14, 165, 233, 0.12); color: #0ea5e9; }
.products-stat-value {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text);
}
.products-stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}
.products-search-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem;
  margin-bottom: 1.5rem;
  max-width: 400px;
}
.products-search-wrap i {
  color: var(--text-muted);
  font-size: 13px;
}
.products-search-input {
  flex: 1;
  border: none;
  background: none;
  font-size: 14px;
  color: var(--text);
}
.products-search-input::placeholder {
  color: var(--text-muted);
}
.products-search-input:focus {
  outline: none;
}
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}
.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.product-card:hover {
  border-color: var(--border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}
.product-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.product-card-icon-air { background: rgba(59, 130, 246, 0.12); color: #2563eb; }
.product-card-icon-water { background: rgba(14, 165, 233, 0.12); color: #0ea5e9; }
.product-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.25rem;
}
.product-card-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  flex: 1;
  min-width: 0;
}
.product-card-line {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
  background: var(--border-subtle);
  color: var(--text-muted);
  width: fit-content;
}
.product-card-desc {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
  flex: 1;
}
.product-card-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.product-card-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--primary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.product-card-link:hover {
  text-decoration: underline;
}
.product-card-link i {
  font-size: 11px;
}

.product-units-hint {
  margin: 0 0 1rem;
  font-size: 13px;
  color: var(--text-muted);
}
.product-units-empty {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
}

.product-units-add-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.product-units-add-row .product-units-add-select {
  max-width: 280px;
}
.product-units-edit-actions {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 900px) {
  .products-view-header {
    flex-direction: column;
    align-items: stretch;
  }
  .products-stats {
    grid-template-columns: 1fr;
  }
  .products-grid {
    grid-template-columns: 1fr;
  }
}

/* Orders page (operator) */
.orders-toolbar {
  margin-bottom: 1rem;
}

.orders-sync-hint {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 13px;
  color: var(--text-muted);
}

.orders-sync-hint i:first-child {
  color: var(--primary);
}

.orders-sync-btn {
  margin-left: 0.5rem;
}

.orders-search-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.orders-search-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  min-width: 220px;
}

.orders-search-wrap i {
  color: var(--text-muted);
  font-size: 13px;
}

.orders-search-input {
  border: none;
  background: none;
  font-size: 13px;
  font-family: inherit;
  flex: 1;
  min-width: 0;
}

.orders-search-input:focus {
  outline: none;
}

.orders-filters {
  display: flex;
  gap: 0.5rem;
}

.orders-filter-select {
  padding: 0.4rem 0.75rem;
  font-size: 13px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
}

.master-log-toolbar .orders-search-filter {
  flex-wrap: wrap;
  gap: 0.75rem;
}

.master-log-filters-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.master-log-date-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-right: 0.25rem;
}

.master-log-date-input {
  min-width: 130px;
}

.master-log-filter-secondary {
  display: inline-flex;
}

.master-log-summary {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.master-log-pagination {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.master-log-page-info {
  font-size: 13px;
  color: var(--text-muted);
}

.orders-col-action {
  white-space: nowrap;
}

.orders-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.orders-action-form {
  display: inline;
}

.orders-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.orders-create-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.orders-create-label {
  font-size: 13px;
  color: var(--text-muted);
}

.orders-table th.sortable-col {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.orders-table th .sort-indicator {
  display: inline-block;
  margin-left: 4px;
  font-size: 10px;
  opacity: 0.4;
}

.orders-table th.sort-asc .sort-indicator::before {
  content: "▲";
}

.orders-table th.sort-desc .sort-indicator::before {
  content: "▼";
}

/* Customers page pagination */
.customers-pagination {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
  padding: 0.5rem 0;
}

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

.customers-pagination-ellipsis {
  display: inline-flex;
  align-items: center;
  padding: 0 0.25rem;
  color: var(--text-muted);
  font-size: 13px;
  user-select: none;
}

/* Order detail page (order.php) */
.order-breadcrumb {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.order-breadcrumb-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.order-breadcrumb a {
  color: var(--primary);
  text-decoration: none;
}

.order-breadcrumb a:hover {
  text-decoration: underline;
}

.order-breadcrumb-sep {
  margin: 0 0.35rem;
}

.order-deal-meta {
  margin-bottom: 1.5rem;
}

/* Order process steps (order.php 4-step flow) */
.order-steps-bar {
  width: 100%;
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.order-process-steps {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
  width: 100%;
  max-width: 100%;
}

.order-step {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
  justify-content: center;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.order-step:hover {
  color: var(--primary);
  background: var(--primary-muted);
}

.order-step.active {
  color: var(--primary);
  background: var(--primary-muted);
}

.order-step.done {
  color: var(--text-secondary);
}

.order-step.done .order-step-num {
  background: var(--primary);
  color: #fff;
}

.order-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--border);
  font-size: 12px;
  font-weight: 600;
}

.order-step.active .order-step-num {
  background: var(--primary);
  color: #fff;
}

.order-step-connector {
  flex-shrink: 0;
  width: 24px;
  height: 2px;
  background: var(--border);
  margin: 0 0.25rem;
}

.order-installation-block {
  margin-bottom: 1.5rem;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.order-installation-block:last-child {
  margin-bottom: 0;
}

/* Step 3 – installation drag/drop */
.inst-drag-col {
  width: 28px;
  padding-right: 0 !important;
}

.inst-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 28px;
  cursor: grab;
  color: var(--muted, #9ca3af);
  border-radius: 4px;
}

.inst-drag-handle:hover {
  color: var(--text);
  background: var(--surface-alt, #f3f4f6);
}

tr[draggable].inst-dragging {
  opacity: 0.4;
}

.inst-drop-zone.inst-drop-over {
  background: color-mix(in srgb, var(--primary) 6%, transparent);
  outline: 2px dashed var(--primary);
  outline-offset: -2px;
  border-radius: var(--radius-sm, 4px);
}

tr.inst-drop-indicator td {
  padding: 0;
  height: 3px;
  background: var(--primary);
  border: none;
}

.inst-drop-empty td {
  color: var(--muted);
  font-style: italic;
  font-size: 0.85rem;
  min-height: 48px;
  padding: 0.75rem 0.75rem;
}

/* Location table – area sub-rows */
.loc-row td {
  border-bottom: none;
}

.loc-area-row,
.loc-area-add-row {
}

.loc-area-row td,
.loc-area-add-row td {
  padding-top: 0.3rem;
  padding-bottom: 0.3rem;
  font-size: 0.875rem;
  color: var(--text-secondary, #6b7280);
  border-bottom: none;
}


.loc-area-name-cell {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.loc-area-indent {
  display: inline-block;
  width: 1.2rem;
  height: 1em;
  border-left: 2px solid var(--border);
  border-bottom: 2px solid var(--border);
  border-bottom-left-radius: 3px;
  margin-left: 0.5rem;
  flex-shrink: 0;
}

.loc-area-icon {
  color: var(--primary);
  font-size: 0.75rem;
  flex-shrink: 0;
}

.loc-area-desc {
  color: var(--text-secondary, #6b7280);
  font-style: italic;
}

.loc-area-add-row:hover td {
  background: none;
}

.loc-area-add-row .btn {
  color: var(--primary);
  font-size: 0.8rem;
  padding: 0.2rem 0.5rem;
}

.order-area-block {
  margin-top: 1.25rem;
  padding: 14px 16px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.02);
}

.order-form-area-title {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--primary);
  margin: 0 0 0.75rem 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.order-form-area-desc {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.order-step4-drop-zone-area {
  color: var(--primary);
}

.order-map-product-form {
  margin-top: 0.5rem;
}

.order-map-product-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.order-map-product-row select,
.order-map-product-row input {
  margin: 0;
}

/* Step 4: Map products – drag and drop layout */
.order-step4-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 900px) {
  .order-step4-layout {
    grid-template-columns: 1fr;
  }
}

.order-step4-sources,
.order-step4-targets {
  min-width: 0;
}

.order-step4-source-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.order-step4-draggable {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: grab;
  transition: box-shadow 0.15s, border-color 0.15s;
}

.order-step4-draggable:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.order-step4-draggable:active {
  cursor: grabbing;
}

.order-step4-draggable.order-step4-dragging {
  opacity: 0.85;
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.order-step4-draggable-grip {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 12px;
}

.order-step4-draggable-name {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-step4-draggable-disabled {
  cursor: default;
  opacity: 0.85;
  background: var(--bg);
}

.order-step4-draggable-disabled:hover {
  border-color: var(--border);
  box-shadow: none;
}

.order-step4-draggable-disabled:active {
  cursor: default;
}

.order-step4-draggable-badge {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}

.order-step4-drop-zones {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.order-step4-drop-zone {
  min-height: 80px;
  padding: 1rem;
  background: var(--bg);
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  transition: border-color 0.15s, background 0.15s;
}

.order-step4-drop-zone.order-step4-drop-zone-active {
  border-color: var(--primary);
  background: var(--primary-muted);
}

.order-step4-drop-zone-header {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.5rem;
}

.order-step4-drop-zone-header strong {
  font-size: 14px;
}

.order-step4-drop-zone-location {
  font-size: 12px;
  color: var(--text-muted);
}

.order-step4-drop-zone-pains {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 0.15rem;
}
.order-step4-pains-label { font-weight: 500; color: var(--text); }
.order-step4-pains-list { font-style: normal; }

.order-step4-drop-zone-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-height: 2rem;
}

.order-step4-drop-zone-empty {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
}

.order-step4-mapped-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 13px;
  padding: 0.25rem 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.order-step4-mapped-item-label {
  flex: 1;
  min-width: 0;
}

.order-step4-mapped-qty {
  color: var(--text-secondary);
  margin-left: 0.25rem;
}

.order-step4-remove-form {
  display: inline;
  margin: 0;
}

.order-step4-remove-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  transition: background 0.15s, color 0.15s;
}

.order-step4-remove-btn:hover {
  background: var(--border-subtle);
  color: var(--text);
}

.order-form-pains-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 160px;
  overflow-y: auto;
  padding-right: 0.5rem;
  /* Always show the scrollbar: macOS hides overlay scrollbars until you
     scroll, so a list longer than the box looked complete. A styled
     ::-webkit-scrollbar is drawn permanently (Chrome, Safari, Edge). The
     standard scrollbar-* properties are kept to Firefox below, because
     Chrome ignores ::-webkit-scrollbar as soon as they are set. */
}
@supports (-moz-appearance: none) {
  .order-form-pains-list { scrollbar-width: thin; scrollbar-color: #9ca3af var(--input-bg, #f3f4f6); }
}
.order-form-pains-list::-webkit-scrollbar { width: 8px; -webkit-appearance: none; }
.order-form-pains-list::-webkit-scrollbar-track { background: var(--input-bg, #f3f4f6); border-radius: 4px; }
.order-form-pains-list::-webkit-scrollbar-thumb { background: #9ca3af; border-radius: 4px; }
.order-form-pains-list::-webkit-scrollbar-thumb:hover { background: #6b7280; }

/* order.php: Order info and Products side by side at the top of the page,
   stacking on narrow screens — order-info-card/order-lines-card are grid
   children here, each still margin-bottom:1.5rem for the stacked fallback. */
.order-top-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 900px) {
  .order-top-grid {
    grid-template-columns: 1fr;
  }
}

.order-info-card {
  margin-bottom: 1.5rem;
  background: transparent;
  border: 1px solid var(--border);
}

.order-pains-solved { margin: 0; padding-left: 1.1em; }
.order-pains-solved li + li { margin-top: .2em; }

.order-location-picker {
  margin-top: 1.25rem;
  padding: 1rem;
  background: var(--bg-subtle, #f8f6f2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 10px);
}

.order-location-picker-option {
  margin: 0 0 0.4rem;
}

.order-location-picker-btn {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.6rem;
  background: var(--card-bg, #fff);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

.order-location-picker-btn:hover {
  border-color: var(--primary);
}

.order-location-picker-btn i {
  margin-top: 0.15rem;
  color: var(--primary);
  flex-shrink: 0;
}

.order-location-picker-btn.is-default i {
  color: var(--text-muted);
}

.order-location-picker-hint {
  margin: 0.5rem 0 0.75rem;
  font-size: 12px;
  color: var(--text-muted);
}

.order-info-body {
  padding: 1rem 1.5rem;
}

.order-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

@media (max-width: 768px) {
  .order-info-grid {
    grid-template-columns: 1fr;
  }
}

.order-info-block-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.75rem;
}

.order-info-code {
  font-size: 12px;
  padding: 0.2rem 0.4rem;
  background: var(--border-subtle);
  border-radius: var(--radius-sm);
  font-family: ui-monospace, monospace;
}

.order-info-link {
  color: var(--primary);
  font-size: 13px;
  text-decoration: none;
}

.order-info-link:hover {
  text-decoration: underline;
}

.order-info-link i {
  font-size: 11px;
  margin-right: 0.25rem;
}

.order-customer-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.order-customer-id {
  font-size: 11px;
  font-family: ui-monospace, monospace;
  color: var(--text-muted);
}

.order-change-customer-toggle {
  margin-left: 0.25rem;
}

.order-change-customer-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

/* [hidden] must override display so el.hidden = true actually works */
.order-change-customer-form[hidden] {
  display: none;
}

.order-change-customer-select {
  max-width: 320px;
}

.order-change-customer-actions {
  display: flex;
  gap: 0.4rem;
}

.order-info-customer-btn {
  margin-top: 0.25rem;
}

/* Customer secondary subnav (customer.php) – full-height sidebar style */
.customer-subnav {
  width: 240px;
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.customer-subnav-header {
  padding: 0 1.25rem;
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 0.625rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  overflow: hidden;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.12s;
}

.customer-subnav-header:hover {
  color: var(--primary);
  text-decoration: none;
}

.customer-subnav-title {
  padding: 1rem 1.25rem 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
}

.customer-subnav-nav {
  flex: 1;
  padding: 0.75rem 0.5rem;
  overflow-y: auto;
  overflow-x: hidden;
}

.customer-subnav-group-title {
  padding: 0.5rem 0.75rem 0.25rem;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.customer-subnav-link {
  display: flex;
  align-items: center;
  padding: 0.5625rem 0.75rem;
  margin-bottom: 2px;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 400;
  font-size: 0.875rem;
  border-radius: var(--radius-sm);
  transition: background 0.12s, color 0.12s;
}

.customer-subnav-link:hover {
  background: var(--primary-muted);
  color: var(--primary);
  text-decoration: none;
}

.customer-subnav-link.active {
  background: var(--primary-muted-strong);
  color: var(--primary);
  font-weight: 600;
}

.customer-subnav-link i {
  width: 20px;
  margin-right: 10px;
  font-size: 0.875rem;
  flex-shrink: 0;
  text-align: center;
}

.customer-subnav-divider {
  height: 1px;
  background: var(--border);
  margin: 0.375rem 0.25rem;
}

/* Counts beside a sub-nav link, and the Location › Installation tree */
.customer-subnav-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.customer-subnav-count {
  margin-left: auto;
  padding-left: .5rem;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}
.customer-subnav-link .customer-subnav-count {
  background: var(--border);
  border-radius: 999px;
  padding: 0 7px;
  line-height: 18px;
  margin-left: auto;
}
.customer-subnav-group + .customer-subnav-divider { margin-top: .5rem; }
.customer-subnav-tree .customer-subnav-link { padding-top: .375rem; padding-bottom: .375rem; font-size: .8125rem; }
.customer-subnav-loc-row {
  display: flex;
  align-items: center;
  gap: 2px;
}
.customer-subnav-loc-row .customer-subnav-link { flex: 1 1 auto; min-width: 0; margin-bottom: 0; padding-left: .375rem; font-weight: 600; color: var(--text); }
.customer-subnav-caret {
  flex-shrink: 0;
  width: 22px;
  height: 26px;
  border: 0;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 10px;
  padding: 0;
}
.customer-subnav-caret:hover { background: var(--primary-muted); color: var(--primary); }
.customer-subnav-caret i { transition: transform .15s; }
.customer-subnav-node.is-open > .customer-subnav-loc-row .customer-subnav-caret i { transform: rotate(90deg); }
.customer-subnav-node { margin-bottom: 2px; }
.customer-subnav-children { display: none; padding: 2px 0 6px; }
.customer-subnav-node.is-open > .customer-subnav-children { display: block; }
.customer-subnav-link.lvl2 { padding-left: 2rem; }

/* Locations pages: the location's header card and the tab bar
   (inc/customer-location-tabs.php) */
.cl-head { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 1rem; margin-bottom: 1.25rem; align-items: stretch; }
.cl-head-img { position: relative; border-radius: var(--radius); overflow: hidden; background: var(--input-bg, #f3f4f6); min-height: 200px; }
.cl-head-img.is-empty { border: 1px dashed var(--border); }
.cl-head-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.cl-head-photo[hidden], .cl-head-placeholder[hidden] { display: none; }
.cl-head-placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6rem; padding: 1rem; text-align: center; color: var(--text-muted); font-size: .85rem; }
.cl-head-placeholder > i { font-size: 2rem; opacity: .45; }
.cl-head-img-btn {
  position: absolute; right: .6rem; bottom: .6rem;
  display: inline-flex; align-items: center; gap: .35rem;
  border: none; border-radius: 999px; padding: .3rem .7rem;
  background: rgba(17, 24, 39, .65); color: #fff; font: inherit; font-size: .75rem; font-weight: 600; cursor: pointer;
  opacity: 0; transition: opacity .15s;
}
.cl-head-img:hover .cl-head-img-btn, .cl-head-img-btn:focus-visible { opacity: 1; }
.cl-head-img.is-empty .cl-head-img-btn { display: none; }
.cl-head-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.25rem 1rem; min-width: 0; }
.cl-head-name { margin: 0; font-size: 1.35rem; font-weight: 700; color: var(--text); }
.cl-head-addr { margin-top: .3rem; color: var(--text-muted); font-size: .9rem; }
.cl-head-dl { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: .55rem 1rem; margin: 1.1rem 0 0; font-size: .875rem; }
.cl-head-dl dt { color: var(--text-muted); }
.cl-head-dl dd { margin: 0; color: var(--text); line-height: 1.55; }
.cl-head-chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.cl-chip { background: var(--input-bg, #f3f4f6); border: 1px solid var(--border); border-radius: 6px; padding: .1rem .5rem; font-size: .8rem; }

/* overflow-x: auto alone makes overflow-y auto too, so nothing may poke out
   below the bar: the active line is drawn inside the tab, not over the border. */
.cl-tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin: 0 0 1.25rem; overflow-x: auto; overflow-y: hidden; }
.cl-tab {
  display: inline-flex; align-items: center; gap: .45rem; white-space: nowrap;
  padding: .6rem .9rem;
  color: var(--text-muted); font-size: .9rem; font-weight: 500; text-decoration: none;
}
.cl-tab:hover { color: var(--text); text-decoration: none; }
.cl-tab.active { color: var(--text); font-weight: 600; box-shadow: inset 0 -2px 0 var(--secondary, #ec7b03); }
.cl-tab-count { font-size: .72rem; color: var(--text-muted); background: var(--border); border-radius: 999px; padding: 0 .45rem; line-height: 1.5; }

.cl-gallery-bar { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; justify-content: space-between; margin-bottom: .9rem; color: var(--text-muted); font-size: .85rem; }
/* A location's gallery: nested Location › Area › Installation › (Measurement |
   Report) sections, the hierarchy the photo modals use. */
.cl-gal-node { margin: 0 0 .75rem; }
.cl-gal-title { font-size: .9rem; font-weight: 700; color: var(--text); margin: 1rem 0 .5rem; }
.cl-gal-depth-0 > .cl-gal-title { margin-top: 0; font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); }
.cl-gal-depth-1, .cl-gal-depth-2, .cl-gal-depth-3 { margin-left: .75rem; padding-left: .75rem; border-left: 2px solid var(--border); }
.cl-gal-depth-2 > .cl-gal-title { font-size: .85rem; color: var(--text-secondary, var(--text)); }
.cl-gal-depth-3 > .cl-gal-title { font-size: .8rem; color: var(--text-muted); font-weight: 600; }
.cl-gal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .5rem; }
.cl-gal-item { position: relative; }
.cl-gal-thumb { display: block; aspect-ratio: 1; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); background: var(--input-bg, #f3f4f6); }
.cl-gal-thumb:hover { border-color: var(--primary); }
.cl-gal-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cl-gal-star {
  position: absolute; top: .35rem; right: .35rem; width: 26px; height: 26px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; border: none; cursor: pointer;
  background: rgba(255, 255, 255, .9); color: #9ca3af; font-size: .8rem; box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.cl-gal-star:hover { color: #d97706; }
.cl-gal-star.is-primary { color: #d97706; cursor: default; }
.cl-lightbox { position: fixed; inset: 0; z-index: 9500; background: rgba(0,0,0,.9); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1rem; }
.cl-lightbox[hidden] { display: none; }
.cl-lightbox img { max-width: 90vw; max-height: 80vh; object-fit: contain; border-radius: 6px; }
.cl-lightbox-caption { color: #e5e7eb; font-size: .85rem; margin-top: .75rem; text-align: center; max-width: 90vw; }
.cl-lightbox-close, .cl-lightbox-nav { position: absolute; border: none; border-radius: 50%; background: rgba(255,255,255,.14); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.cl-lightbox-close { top: 1rem; right: 1rem; width: 2.25rem; height: 2.25rem; }
.cl-lightbox-nav { top: 50%; transform: translateY(-50%); width: 2.5rem; height: 2.5rem; }
.cl-lightbox-prev { left: 1rem; } .cl-lightbox-next { right: 1rem; }

@media (max-width: 900px) {
  .cl-head { grid-template-columns: minmax(0, 1fr); }
  .cl-head-dl { grid-template-columns: minmax(0, 1fr); gap: .2rem; }
  .cl-head-dl dd { margin-bottom: .5rem; }
}

.customer-subnav-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-muted);
}

.customer-overview-cols {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

.customer-overview-cols > .card {
  flex: 1;
  min-width: 0;
}

/* Customer pains list (overview tab) */
.customer-pains-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.customer-pain-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: #fffbeb;
  border: 1px solid #f0d070;
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
}

.customer-pain-icon {
  width: 28px;
  height: 28px;
  border-radius: 9999px;
  background: rgba(236, 123, 3, 0.1);
  color: var(--secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.75rem;
  margin-top: 1px;
}

.customer-pain-body {
  flex: 1;
  min-width: 0;
}

.customer-pain-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.customer-pain-unit {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--border-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.0625rem 0.375rem;
}

.customer-pain-desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-top: 0.125rem;
}

.customer-pain-installs {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.customer-pain-installs i {
  font-size: 0.6875rem;
}

/* Customer details (customer.php) */
.customer-details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem 2rem;
}

.customer-detail-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.customer-detail-item.customer-detail-notes {
  grid-column: 1 / -1;
}

.customer-detail-icon {
  width: 32px;
  height: 32px;
  border-radius: 9999px;
  background: var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
}

.customer-detail-icon i {
  font-size: 14px;
}

.customer-detail-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.customer-detail-value {
  font-size: 14px;
  color: var(--text);
}

.customer-detail-value a {
  color: var(--primary);
  text-decoration: none;
}

.customer-detail-value a:hover {
  text-decoration: underline;
}

.order-deal-title {
  font-size: 16px;
  font-weight: 600;
  display: block;
  margin-bottom: 0.5rem;
}

.order-deal-currency {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 13px;
  color: var(--text-muted);
}

.order-currency-select,
.order-amounts-select {
  padding: 0.25rem 0.5rem;
  font-size: 13px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.order-tax-link {
  color: var(--primary);
  font-size: 13px;
  margin-left: 0.25rem;
}

.card-header-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.order-lines-card .card-body {
  padding: 0;
}

.order-lines-wrap {
  border-radius: 0;
}

.order-lines-table {
  font-size: 12px;
}

.order-lines-table th {
  padding: 0.5rem 0.65rem;
  white-space: nowrap;
}

.order-lines-table td {
  padding: 0.4rem 0.65rem;
  vertical-align: middle;
}

.order-lines-table tbody tr:hover td,
.order-form-table tbody tr:hover td {
  background: transparent;
}

.order-line-col-toggle {
  width: 36px;
}

.order-line-toggle {
  display: inline-block;
  width: 36px;
  height: 20px;
  border-radius: 10px;
  background: var(--border);
  cursor: pointer;
  position: relative;
}

.order-line-toggle.is-on {
  background: var(--primary);
}

.order-line-toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s ease;
}

.order-line-toggle.is-on::after {
  transform: translateX(16px);
}

.order-line-input {
  width: 100%;
  min-width: 60px;
  padding: 0.35rem 0.5rem;
  font-size: 12px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.order-line-input.order-line-date { min-width: 90px; }
.order-line-input.order-line-num { min-width: 56px; max-width: 80px; }
.order-line-input.order-line-qty-new { max-width: 56px; }

.order-line-select {
  padding: 0.35rem 0.5rem;
  font-size: 12px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  min-width: 100px;
}

.order-line-price-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.order-line-price-wrap .order-line-num {
  min-width: 70px;
}

.order-line-currency-select {
  padding: 0.35rem 0.5rem;
  font-size: 12px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  min-width: 64px;
}

.order-line-col-qty {
  white-space: nowrap;
}

.order-line-qty-original {
  display: inline-block;
  font-size: 11px;
  color: var(--text-muted);
  margin-right: 0.35rem;
  padding: 0.2rem 0.35rem;
  background: var(--border-subtle);
  border-radius: var(--radius-sm);
}

.order-line-amount {
  font-weight: 500;
}

.order-line-col-actions {
  white-space: nowrap;
}

.order-line-tcv {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.order-line-row-actions {
  display: inline-flex;
  gap: 0.2rem;
}

.order-line-action-btn {
  padding: 0.25rem;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.order-line-action-btn:hover {
  color: var(--primary);
  background: var(--border-subtle);
}

.order-line-variation {
  font-size: 11px;
  color: var(--text-muted);
}

.order-lines-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
}

/* Align summary row with Products card when inside Locations card (card-body has 1.5rem padding) */
.order-form-card .order-lines-summary-row {
  margin-left: -1.5rem;
  margin-right: -1.5rem;
  padding-left: 1rem;
  padding-right: 1rem;
}

.order-lines-summary {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.order-lines-add-form {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.order-lines-product-select {
  min-width: 180px;
  padding: 0.35rem 0.5rem;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.order-lines-add-qty-label { margin: 0; }
.order-lines-add-qty {
  width: 4rem;
  padding: 0.35rem 0.5rem;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.order-line-col-handle {
  width: 2rem;
  min-width: 2rem;
  padding: 0.5rem;
  vertical-align: middle;
}

.order-line-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
  cursor: grab;
  color: var(--text-muted);
  user-select: none;
  border-radius: var(--radius-sm);
}

.order-line-drag-handle:hover {
  color: var(--text-secondary);
}

.order-line-drag-handle:active {
  cursor: grabbing;
}

.order-line-row-dragging {
  opacity: 0.6;
}

.order-line-drop-indicator td {
  height: 0;
  padding: 2px 0;
  margin: 0;
  border: none;
  border-top: 3px solid var(--primary);
  background: transparent;
  vertical-align: middle;
  pointer-events: none;
}

.order-line-drop-indicator {
  background: transparent;
}

/* Order additional data form */
.order-form-card .card-body {
  padding: 1.5rem 1.5rem 1rem 1.5rem;
}

.order-form-section {
  margin-bottom: 0;
  margin-top: 0;
  padding: 1.5rem 1.25rem;
  border-radius: var(--radius-md);
  background: var(--bg);
  border: 1px solid var(--border);
}

.order-form-section:first-of-type {
  margin-top: 0;
}

.order-form-section + .order-form-section {
  margin-top: 1.25rem;
}

.order-form-section:last-of-type {
  margin-bottom: 0;
}

.order-form-section-title {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 0.75rem;
  color: var(--text);
}

.order-form-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
}

.order-form-table-wrap {
  margin-bottom: 1rem;
}

.order-form-table {
  width: 100%;
  max-width: 640px;
  border-collapse: collapse;
  font-size: 13px;
}

.order-form-table th {
  width: 40%;
  padding: 0.5rem 0.75rem 0.5rem 0;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: left;
  vertical-align: top;
  border: none;
  background: none;
}

.order-form-table td {
  padding: 0.5rem 0;
  border: none;
  vertical-align: top;
}

.order-form-input,
.order-form-textarea {
  width: 100%;
  max-width: 320px;
  padding: 0.45rem 0.65rem;
  font-size: 13px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.order-form-textarea {
  min-height: 80px;
  resize: vertical;
}

.order-form-input-num {
  max-width: 120px;
}

.order-form-check {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-right: 1rem;
  font-weight: 400;
  cursor: pointer;
}

.order-form-note {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0.35rem 0 0;
}

.order-form-installation-block {
  margin-bottom: 1.5rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
}

.order-form-installation-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  font-weight: 600;
  font-size: 13px;
}

.order-form-installation-block .order-form-table {
  max-width: 100%;
}

.order-form-installation-block .order-form-table th {
  width: 220px;
}

.order-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* order.php: "Kundens aftalte pain" bar — the customer's agreed pains as
   tags, with the Schedule visit CTA folded in. No date/timeframe/contract
   fields — that data isn't captured anywhere in this app yet. */
.order-pain-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  padding: 1.1rem 1.4rem;
  background: var(--card-bg, #fff);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-md, 10px);
}

.order-pain-bar-main {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-width: 0;
}

.order-pain-bar-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.order-pain-bar-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.order-pain-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  background: var(--bg-subtle, #f8f6f2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  color: var(--text);
}

.order-pain-tag i {
  color: var(--primary);
  font-size: 11px;
}

.order-pain-bar-cta {
  flex-shrink: 0;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .order-pain-bar {
    align-items: stretch;
  }
  .order-pain-bar-cta {
    width: 100%;
    text-align: center;
  }
}

.order-form-actions .btn {
  padding: 0.6rem 1.25rem;
  font-size: 14px;
}

.order-form-actions .btn-primary {
  color: #fff !important;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-muted);
  font-size: 14px;
}

.empty-state .icon { font-size: 36px; margin-bottom: 0.75rem; opacity: 0.5; }

/* Customer edit form */
.customer-edit-form .customer-edit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem 1.5rem;
  margin-bottom: 1rem;
}
.customer-edit-form .form-control { max-width: none; }

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.form-control {
  width: 100%;
  max-width: 320px;
  padding: 0.5rem 0.75rem;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--ring);
}

/* A textarea holds prose, not a short value: the 320px cap that keeps inputs
   from stretching across a wide card leaves a textarea stranded in it. */
textarea.form-control {
  max-width: 100%;
  min-height: 70px;
  resize: vertical;
}

/* Stacked field: label over control, hint under it.
   These three classes are used in seven files — login, product, customer,
   qr-codes, visit, forgot-password, reset-password — and not one of them had
   a rule anywhere in this stylesheet, so a <label> stayed inline and sat on
   the same line as its own field. Every single usage puts the label above the
   control (one even carries a `margin-bottom:0` override for a margin that
   was never there), which is what these rules finally give them. */
.form-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.form-hint {
  margin: 0.3rem 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
}

.form-group,
.order-form-group {
  margin-bottom: 1rem;
}

.form-group:last-child,
.order-form-group:last-child {
  margin-bottom: 0;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

/* Documentation placeholders */
.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
}

.doc-placeholder {
  aspect-ratio: 1;
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
}

/* Mobile */
@media (max-width: 1024px) {
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Below 900px the sidebar is an off-canvas drawer (see "Mobile shell" at the
   end of this file), so it keeps its full width and labels — the icon-rail
   collapse that used to live here would have made the drawer icon-only. */
@media (max-width: 768px) {
  .stats-row { grid-template-columns: 1fr 1fr; }
}

/* Modal (Units & Metrics etc.) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}
.modal-overlay[hidden] {
  display: none;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  max-width: 420px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.modal-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
}
.modal-close {
  padding: 0.35rem;
  color: var(--text-muted);
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.modal-close:hover {
  color: var(--text);
  background: var(--border-subtle);
}
.modal-body {
  padding: 1.5rem;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
}
.modal-body .form-control {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}

/* Wide modal variant (installation modal with product panel) */
.modal--wide {
  max-width: 900px;
}
.modal-body-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 0;
  gap: 0;
}
.modal-col-left {
  padding: 1.5rem;
  min-width: 0;
}
#add-installation-modal .modal-col-left {
  padding-bottom: 0;
}
.modal-col-right {
  padding: 1.5rem;
  border-left: 1px solid var(--border);
  background: var(--bg);
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.inst-order-resume {
  background: var(--surface-alt, #f8f9fa);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem;
  margin-bottom: 1rem;
}

.inst-modal-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.85rem 0;
}

.inst-order-resume-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.inst-order-resume-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.8rem;
}

.inst-order-resume-name {
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inst-order-resume-qty {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}

.inst-order-resume-empty {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
}

.inst-modal-products-heading {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text);
}
.inst-modal-new-hint {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-style: italic;
}
.inst-modal-product-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.inst-modal-product-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.375rem 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.875rem;
}
.inst-modal-product-item-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inst-modal-product-item-qty {
  color: var(--text-muted);
  font-size: 0.8125rem;
  white-space: nowrap;
}
.inst-modal-product-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem 0.3rem;
  border-radius: var(--radius-sm);
  line-height: 1;
  flex-shrink: 0;
}
.inst-modal-product-remove:hover {
  color: #c0392b;
  background: rgba(192, 57, 43, 0.08);
}
.inst-modal-empty-hint {
  font-size: 0.8125rem;
  color: var(--text-muted);
  padding: 0.25rem 0;
}
.inst-modal-add-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.inst-modal-product-select {
  flex: 1;
  min-width: 0;
  padding: 0.375rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  background: var(--surface);
  color: var(--text);
}
.inst-modal-product-qty {
  width: 64px;
  padding: 0.375rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  background: var(--surface);
  color: var(--text);
}
.inst-modal-product-status {
  font-size: 0.8125rem;
  color: var(--text-muted);
  min-height: 1.2em;
}

/* Step 4: Image upload notice */
.order-image-notice {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  background: #fff8ec;
  border: 1px solid #f5d99a;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.dark-mode .order-image-notice {
  background: rgba(236, 123, 3, 0.08);
  border-color: rgba(236, 123, 3, 0.3);
}
.order-image-notice-icon {
  flex-shrink: 0;
  font-size: 1.125rem;
  color: #ec7b03;
  margin-top: 0.1rem;
}
.order-image-notice-body {
  flex: 1;
  min-width: 0;
}
.order-image-notice-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.375rem;
}
.order-image-notice-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.75rem;
}
.order-image-notice-list li {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}
.order-image-notice-type {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #ec7b03;
  margin-right: 0.2rem;
}
.order-image-notice-action {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-top: 0.75rem;
}
.order-image-notice-copied {
  font-size: 0.75rem;
  color: var(--primary);
  font-weight: 500;
}

.order-img-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 99px;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  margin-left: 2px;
}

.order-img-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-align: center;
}
.order-img-dropzone:hover,
.order-img-dropzone.drag-over {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 5%, transparent);
}

/* Step 4: Review order details */
.order-review-location:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}
.order-review-label {
  font-weight: 400;
  color: var(--text-secondary);
  font-size: 0.8em;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 0.2rem;
}

.order-review-location-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.2rem;
}
.order-review-location-addr {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0 0 0.875rem;
}
.order-review-area {
  margin-bottom: 1rem;
}
.order-review-area:last-child {
  margin-bottom: 0;
}
.order-review-area-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0 0 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.order-review-installations {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.order-review-inst {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.875rem 1rem;
  background: var(--surface);
}
.order-review-inst-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.order-review-inst-name {
  font-weight: 600;
  color: var(--text);
}
.order-review-inst-meta {
  font-size: 0.8125rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.order-review-pains {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.5rem;
}
.order-review-pain-tag {
  font-size: 0.75rem;
  padding: 0.175rem 0.5rem;
  border-radius: 9999px;
  background: rgba(236, 123, 3, 0.1);
  color: #d4700a;
  font-weight: 500;
}
.order-review-products {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.order-review-product-row {
  font-size: 0.8125rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.order-review-product-name {
  color: var(--text);
}
.order-review-product-qty {
  color: var(--text-muted);
}
.order-review-no-products {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-style: italic;
  margin: 0.25rem 0 0;
}
.table-cell-actions {
  width: 1%;
  white-space: nowrap;
}

/* ============================================================
   Schedule visits – wizard (schedule-visits.php)
   ============================================================ */

/* Step 1 – task list filters */
.sv-filters {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.sv-filter-select {
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
}

.sv-sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 14px;
}

.sv-tasks-table {
  width: 100%;
}

.sv-th-date {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.sv-sort-icon {
  font-size: 11px;
  opacity: 0.55;
  margin-left: 2px;
}

.sv-td-date {
  white-space: nowrap;
  color: var(--text-secondary);
  font-size: 13.5px;
}

.sv-td-action {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

/* Task type badges */
.sv-type-badge {
  display: inline-block;
  padding: 0.2em 0.65em;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

.sv-type-baseline {
  background: #e0f2fe;
  color: #0369a1;
}

.sv-type-1month {
  background: #fef9c3;
  color: #854d0e;
}

.sv-type-installation {
  background: #d1fae5;
  color: #065f46;
}

.sv-type-performance {
  background: #f3e8ff;
  color: #6b21a8;
}

.sv-empty-msg {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem 0;
  font-size: 14px;
}

/* Task context bar (steps 2 & 3) */
.sv-task-context {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.sv-task-context-main {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.sv-task-context-main .sv-type-badge {
  font-size: 13px;
  padding: 0.3em 0.8em;
}

.sv-task-context-customer {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
}

.sv-task-context-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.sv-task-context-due {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.sv-task-context-change {
  font-size: 13px;
  color: var(--primary);
  text-decoration: none;
  white-space: nowrap;
}

.sv-task-context-change:hover {
  text-decoration: underline;
}

/* Step 2 – geographic filters (in left sidebar card) */
.sv-geo-card {
  margin-top: 0.75rem;
}

.sv-geo-body {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding-top: 0.75rem !important;
  padding-bottom: 0.75rem !important;
}

.sv-geo-filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.sv-geo-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sv-geo-input {
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--text-primary);
  font-size: 13.5px;
  font-family: inherit;
  width: 100%;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.sv-geo-input:focus {
  outline: none;
  border-color: var(--primary);
}

.sv-postcode-range {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.sv-postcode-input {
  width: 0;
  flex: 1;
}

.sv-postcode-sep {
  color: var(--text-muted);
  font-size: 14px;
  flex-shrink: 0;
}

.sv-city-input {
  width: 100%;
}

.sv-region-btns {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.sv-geo-actions {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding-top: 0.25rem;
  border-top: 1px solid var(--border);
  margin-top: 0.25rem;
}

.sv-geo-actions .btn {
  width: 100%;
  justify-content: center;
}

.sv-region-btn {
  flex: 1;
  padding: 0.38rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.sv-region-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-muted);
}

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

/* Step 2 – two-column layout */
.sv-step2-layout {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

/* Left: technician panel */
.sv-techs-panel {
  flex-shrink: 0;
  width: 270px;
}

.sv-techs-card {
  position: sticky;
  top: 1rem;
}

.sv-techs-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.sv-sync-gcal-btn {
  font-size: 12px;
  padding: 0.25rem 0.6rem;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  transition: color 0.15s;
}

.sv-sync-gcal-btn:hover {
  color: var(--primary);
}

.sv-sync-btn--done {
  color: #16a34a !important;
}

.sv-tech-list {
  padding: 0 !important;
  display: flex;
  flex-direction: column;
}

.sv-tech-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}

.sv-tech-item:last-child {
  border-bottom: none;
}

.sv-tech-item--selected {
  background: var(--primary-muted);
}

.sv-tech-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.sv-tech-check {
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: var(--primary);
}

.sv-tech-dot {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.sv-tech-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sv-tech-name {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sv-tech-email {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sv-select-tech-btn {
  flex-shrink: 0;
  font-size: 12px;
  padding: 0.25rem 0.6rem;
}

/* Right: calendar column */
.sv-calendar-col {
  flex: 1;
  min-width: 0;
}

.sv-cal-toolbar {
  margin-bottom: 0.75rem;
}

/* Time picker row */
.sv-time-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  flex-wrap: wrap;
}

.sv-time-label {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.sv-duration-label {
  margin-left: 0.5rem;
}

.sv-time-input {
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  width: 120px;
}

.sv-duration-input {
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  width: 64px;
  text-align: center;
}

.sv-time-unit {
  font-size: 13.5px;
  color: var(--text-muted);
}

/* Step navigation bar */
.sv-step-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

/* Calendar task chip (shown on selected date in step 2) */
.sv-cal-task-chip {
  display: flex;
  flex-direction: column;
  padding: 0.25rem 0.45rem;
  border-radius: 4px;
  border-left: 3px solid;
  margin-bottom: 3px;
  font-size: 11px;
  line-height: 1.35;
  max-width: 100%;
  overflow: hidden;
  cursor: pointer;
}

.sv-cal-task-label {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sv-cal-task-customer {
  font-weight: 400;
  opacity: 0.8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* One technician per line, each on its own .sv-cal-task-tech row. */
.sv-cal-task-tech-names {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.sv-cal-task-tech {
  font-weight: 400;
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 3px;
}

.sv-cal-task-location {
  font-weight: 400;
  opacity: 0.65;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 3px;
}

.sv-cal-task-dur {
  margin-top: auto;
  font-size: 10px;
  font-weight: 700;
  opacity: 0.65;
  padding-top: 3px;
}

.sv-cal-task-baseline {
  background: #dbeafe;
  border-color: #2563eb;
  color: #1d4ed8;
}

.sv-cal-task-1month {
  background: #fef9c3;
  border-color: #ca8a04;
  color: #92400e;
}

.sv-cal-task-performance {
  background: #f3e8ff;
  border-color: #9333ea;
  color: #6b21a8;
}

.sv-cal-task-installation {
  background: #d6e9f1;
  border-color: #156382;
  color: #0f4e66;
}

/* Completed visit: stays on the calendar, dimmed and badged rather than removed. */
.sv-cal-task-chip.sv-cal-task-done {
  opacity: 0.6;
  border-left-style: dashed;
  cursor: pointer;
}

.sv-cal-task-done-badge {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  width: fit-content;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 1px 5px;
  border-radius: 3px;
  background: #16a34a;
  color: #fff;
  opacity: 1;
}

/* Step 3 placeholder */
.sv-step3-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  gap: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

.sv-step3-icon {
  font-size: 2rem;
  opacity: 0.4;
}

@media (max-width: 860px) {
  .sv-step2-layout {
    flex-direction: column;
  }
  .sv-techs-panel {
    width: 100%;
    position: static;
  }
}

/* ── Calendar toolbar row (view toggle + nav) ─────────────────── */
.sv-cal-toolbar-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.sv-cal-view-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  flex-shrink: 0;
}

.sv-cal-view-btn {
  padding: 0.35rem 0.9rem;
  background: var(--bg);
  border: none;
  border-right: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.sv-cal-view-btn:last-child { border-right: none; }

.sv-cal-view-btn:hover {
  background: var(--surface-hover, #f5f7fa);
  color: var(--primary);
}

.sv-cal-view-btn.active {
  background: var(--primary);
  color: #fff;
}

/* ── Week view ─────────────────────────────────────────────────── */
#sv-cal-week-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow-x: auto;
}

.sv-cal-week-grid {
  display: grid;
  /* columns set by JS: 80px + repeat(N_HOURS, 120px) */
}

.sv-week-time-spacer {
  height: 36px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  box-sizing: border-box;
}

.sv-week-col-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 0.25rem 0.4rem;
  background: var(--surface);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  gap: 0.1rem;
  box-sizing: border-box;
}

.sv-week-col-header--today {
  background: var(--primary-muted);
  color: var(--primary);
}

.sv-week-day-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sv-week-col-header--today .sv-week-day-name {
  color: var(--primary);
}

.sv-week-day-num {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.sv-week-col-header--today .sv-week-day-num {
  color: var(--primary);
}

.sv-week-time-label {
  height: 36px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.25rem 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.sv-week-cell {
  min-height: 80px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: visible;
  background: var(--bg);
  transition: background 0.1s;
  box-sizing: border-box;
}

.sv-week-cell--today {
  background: color-mix(in srgb, var(--primary-muted) 40%, var(--bg));
}

/* ── Day view ──────────────────────────────────────────────────── */
#sv-cal-day-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow-x: auto;
}

.sv-cal-day-slots {
  display: grid;
  /* columns set by JS: 80px + repeat(N_HOURS, 120px) */
}

/* ── Month view ───────────────────────────────────────────────── */
#sv-cal-month-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: visible;
}

.sv-cal-month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: minmax(100px, auto);
  align-content: start;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.sv-month-dow-header {
  background: var(--surface);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  text-align: center;
  box-sizing: border-box;
}
.sv-month-dow-header:last-child { border-right: none; }

.sv-month-cell {
  min-height: 100px;
  padding: 0.35rem 0.4rem 0.4rem;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  box-sizing: border-box;
  vertical-align: top;
  transition: background 0.1s;
  position: relative;
}
.sv-month-cell:nth-child(7n) { border-right: none; }
.sv-month-cell--other { background: var(--bg); }
.sv-month-cell--today { background: color-mix(in srgb, var(--primary) 6%, var(--bg)); }

.sv-month-day-num {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
  line-height: 1;
  display: inline-block;
}
.sv-month-day-num--today {
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}

.sv-month-chip {
  display: block;
  background: color-mix(in srgb, var(--primary) 15%, var(--surface));
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  margin-bottom: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: background 0.1s;
}
.sv-month-chip:hover { background: color-mix(in srgb, var(--primary) 25%, var(--surface)); }

.sv-month-more {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
  padding: 0.1rem 0.2rem;
}

/* ── Draggable task cards (step 1 left panel) ─────────────────── */
.sv-tasks-card {
  position: sticky;
  top: 1rem;
}

.sv-drag-task-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 500px;
  transition: background 0.15s, outline 0.15s;
  border-radius: var(--radius-sm);
}

.sv-drag-task-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex: 1;
  min-height: 500px;
  color: var(--text-muted);
  font-size: 0.8125rem;
  text-align: center;
  padding: 2rem;
}

.sv-drag-task-empty i {
  font-size: 1.75rem;
  opacity: 0.35;
}
.sv-techs-panel.sv-drop-target {
  outline: 2px dashed var(--primary);
  background: color-mix(in srgb, var(--primary) 6%, transparent);
}

.sv-drag-task-card {
  border-bottom: 1px solid var(--border);
  cursor: grab;
  transition: background 0.12s, opacity 0.15s;
  user-select: none;
}

.sv-drag-task-card:last-child {
  border-bottom: none;
}

.sv-drag-task-card:hover {
  background: var(--surface-hover, #f5f7fa);
}

.sv-drag-task-card--dragging {
  opacity: 0.4;
  cursor: grabbing;
}

.sv-drag-task-card--scheduled {
  cursor: default;
  opacity: 0.65;
}

.sv-drag-task-card--scheduled:hover {
  background: transparent;
}

.sv-drag-task-card-inner {
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.sv-drag-task-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.sv-drag-handle {
  color: var(--text-muted);
  font-size: 13px;
  flex-shrink: 0;
}

.sv-drag-task-customer {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.3;
}

.sv-drag-task-due {
  font-size: 12.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.sv-scheduled-badge {
  font-size: 12px;
  color: #16a34a;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.1rem;
}

/* ── Drop target highlight ────────────────────────────────────── */
.sv-drop-target {
  background: var(--primary-muted, #e0f2fe) !important;
  outline: 2px dashed var(--primary);
  outline-offset: -2px;
}

/* ── Drop hint below calendar ─────────────────────────────────── */
.sv-drop-hint {
  margin-top: 0.75rem;
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* ── Next step button dimmed until first assignment ──────────── */
.sv-next-btn {
  opacity: 0.45;
  pointer-events: none;
}

.sv-next-btn.sv-next-btn--active {
  opacity: 1;
  pointer-events: auto;
}

/* ── Technician assignment modal ──────────────────────────────── */
.sv-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 900;
}

.sv-modal-overlay.is-open {
  display: block;
}

.sv-modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 910;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  width: min(480px, calc(100vw - 2rem));
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
  flex-direction: column;
}

.sv-modal.is-open {
  display: flex;
}

.sv-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: grab;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sv-modal-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.sv-modal-close-btn {
  flex-shrink: 0;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  color: var(--text-muted);
}

.sv-modal-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sv-modal-task-info {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.sv-modal-customer {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.sv-modal-date-info {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.45rem 0.75rem;
}

.sv-modal-section-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sv-modal-tech-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.sv-modal-tech-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
}

.sv-modal-tech-item:last-child {
  border-bottom: none;
}

.sv-modal-tech-item:not(.sv-modal-tech-busy):hover {
  background: var(--primary-muted, #e0f2fe);
}

.sv-modal-tech-item input[type="radio"] {
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  accent-color: var(--primary);
  cursor: pointer;
}

.sv-modal-tech-busy {
  opacity: 0.5;
  cursor: not-allowed;
}

.sv-modal-tech-busy input[type="radio"] {
  cursor: not-allowed;
}

.sv-contacts-tag {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--secondary-hover);
  background: var(--secondary-muted);
  border-radius: var(--radius-full);
  padding: 0.1rem 0.5rem;
  text-transform: none;
  letter-spacing: 0;
}

.sv-contacts-box {
  margin-top: 0.4rem;
  background: var(--secondary-muted);
  border: 1px solid rgba(236, 123, 3, 0.25);
  border-radius: var(--radius-md);
  padding: 0.6rem;
}

.sv-contacts-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sv-contact-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  background: var(--surface, #fff);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color 0.1s, background 0.1s;
}

.sv-contact-item:hover {
  border-color: var(--primary);
}

.sv-contact-item.is-selected {
  border-color: var(--primary);
  border-width: 2px;
  padding: calc(0.6rem - 1px) calc(0.75rem - 1px);
  background: var(--primary-muted);
}

.sv-contact-item input[type="radio"] {
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  margin-top: 2px;
  accent-color: var(--primary);
  cursor: pointer;
}

.sv-contact-item-body {
  min-width: 0;
  flex: 1 1 auto;
}

.sv-contact-item-name-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.sv-contact-item-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}

.sv-contact-badge {
  font-size: 10px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-muted-strong);
  border-radius: var(--radius-sm);
  padding: 0.05rem 0.4rem;
  white-space: nowrap;
}

.sv-contact-item-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.sv-contact-add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.55rem 0.75rem;
  font-size: 13px;
  font-weight: 500;
  color: var(--primary);
  background: transparent;
  border: 1px dashed var(--primary);
  border-radius: var(--radius-md);
  cursor: pointer;
}

.sv-contact-add-btn:hover {
  background: var(--primary-muted);
}

.sv-contact-add-form {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.sv-contact-add-form-row {
  display: flex;
  gap: 0.4rem;
}

.sv-contact-add-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
  margin-top: 0.1rem;
}

.sv-modal-date-pick {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.sv-modal-date-input {
  width: 100%;
  box-sizing: border-box;
}

.sv-modal-time-row {
  margin-top: 0;
}

.sv-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

@keyframes sv-shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-5px); }
  60%       { transform: translateX(5px); }
  80%       { transform: translateX(-3px); }
}

/* ── Portal switcher (header) ──────────────────────────────────────────────
   Mirrors the switcher in the technician app header (app/inc/header.php). */
.portal-wrap { position: relative; }
.portal-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 240px;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  overflow: hidden;
}
.portal-dropdown.is-open { display: block; }
.portal-heading {
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: .75rem 1rem .4rem;
}
.portal-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem 1rem;
  text-decoration: none;
  color: var(--text);
  transition: background .1s;
}
.portal-item:hover { background: var(--bg-muted, rgba(0,0,0,.04)); }
.portal-item--active { background: var(--primary-muted); }
.portal-item-icon {
  width: 36px; height: 36px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: .95rem;
  flex-shrink: 0;
}
.portal-item-icon--platform { background: rgba(21,99,130,.1); color: var(--primary); }
.portal-item-icon--app      { background: rgba(236,123,3,.1); color: var(--secondary); }
.portal-item-body  { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.portal-item-title { font-size: .875rem; font-weight: 600; line-height: 1.3; }
.portal-item-desc  { font-size: .72rem; color: var(--text-muted); line-height: 1.3; }
.portal-item-arrow { font-size: .7rem; color: var(--text-muted); flex-shrink: 0; }
.portal-item-check { font-size: .8rem; color: var(--primary); flex-shrink: 0; }

/* ── Dashboard metrics row ─────────────────────────────────────────────────── */
.dash-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.btn.header-help-btn { display: flex; align-items: center; gap: .35rem; font-size: .8rem; padding: .3rem .7rem; }

/* ── Mobile shell ──────────────────────────────────────────────────────────────
   The operator layout is a fixed 260px sidebar next to a scrolling main area,
   which leaves nothing for content on a phone. Below 900px the sidebar becomes
   an off-canvas drawer opened from the header, and the page scrolls normally. */
.nav-toggle {
  display: none;
  width: 38px; height: 38px;
  margin-right: .5rem;
  border: none; border-radius: var(--radius-sm);
  background: none; color: var(--text);
  font-size: 1.05rem; cursor: pointer;
  flex-shrink: 0;
}
.nav-toggle:hover { background: var(--bg-muted, rgba(0,0,0,.05)); }
.nav-backdrop { display: none; }

@media (max-width: 900px) {
  .app     { display: block; height: auto; overflow: visible; }
  .main    { overflow: visible; }
  .content { overflow: visible; padding: 1rem; }

  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }

  .sidebar {
    position: fixed;
    top: 0; bottom: 0; left: 0;
    height: 100vh;
    z-index: 1200;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: var(--shadow-lg);
  }
  body.nav-open .sidebar { transform: none; }

  .nav-backdrop {
    display: block;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1100;
  }
  .nav-backdrop[hidden] { display: none; }
  body.nav-open { overflow: hidden; }

  /* Customer sub-nav becomes a scrollable strip above the content */
  .customer-subnav {
    width: auto; height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .customer-subnav-nav {
    flex-direction: row;
    overflow-x: auto;
    gap: .25rem;
    padding: .5rem;
  }
  .customer-subnav-group { display: flex; flex-direction: row; gap: .25rem; }
  .customer-subnav-group-title { display: none; }
  .customer-subnav-link { white-space: nowrap; }
  .customer-subnav-divider { width: 1px; height: auto; flex-shrink: 0; }
  /* The location tree does not fit a strip; Locations leads to it instead */
  .customer-subnav-tree, .customer-subnav-tree + .customer-subnav-divider { display: none; }

  /* Header: keep one row of icons, drop the labels that do not fit */
  .header { padding: 0 .75rem; gap: .5rem; }
  .header h1 { font-size: 1rem; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .header-actions { gap: .35rem; flex-shrink: 0; }
  .sys-status-wrap, #lang-trigger-label { display: none; }
  /* "Help" is a bare text node next to its icon — zero the button's font size
     and restore it on the icon to leave just the icon. */
  .btn.header-help-btn { font-size: 0; padding: .3rem .5rem; }
  .btn.header-help-btn i { font-size: .95rem; }

  /* Dashboard content */
  .dash-metrics { grid-template-columns: 1fr; gap: .75rem; margin-bottom: 1rem; }
  .planning-filters { flex-wrap: wrap; gap: .5rem; }
  .planning-filter-select { flex: 1 1 45%; min-width: 0; }
  .job-overview-kanban { grid-template-columns: 1fr; gap: .75rem; }
  .kanban-column-name { white-space: normal; }
}

@media (max-width: 480px) {
  .planning-filter-select { flex-basis: 100%; }
  .header h1 { font-size: .9rem; }
  .header-icon-btn, .nav-toggle { width: 34px; height: 34px; }
  .lang-trigger-btn { padding: .25rem .35rem; }
  .content { padding: .75rem; }
}

/* ── customer.php ▸ Details, read mode (inc/customer-details-view.php) ───── */
.cd { display: flex; flex-direction: column; gap: 1rem; }
.cd-muted { color: var(--text-muted); font-size: .8rem; font-weight: 400; }
.cd-empty { margin: 0; padding: .9rem 1.1rem; color: var(--text-muted); font-size: .85rem; }
.cd-fact-label { display: block; font-size: .7rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); margin-bottom: .15rem; }

.cd-hero { display: flex; gap: 1.5rem; justify-content: space-between; align-items: flex-start; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.4rem; }
.cd-hero-main { flex: 1 1 520px; min-width: 0; }
.cd-hero-title { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.cd-hero-title h2 { margin: 0; font-size: 1.4rem; font-weight: 700; color: var(--text); }
.cd-pill { font-size: .72rem; font-weight: 600; text-transform: capitalize; padding: .15rem .6rem; border-radius: 999px; background: var(--primary-muted); color: var(--primary); }
.cd-hero-sub { display: flex; gap: 1.1rem; flex-wrap: wrap; margin-top: .3rem; font-size: .85rem; color: var(--text-muted); }
.cd-hero-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .9rem 1.5rem; margin-top: 1.1rem; }
.cd-fact { display: flex; gap: .65rem; align-items: flex-start; min-width: 0; font-size: .875rem; color: var(--text); }
.cd-fact > i { width: 28px; height: 28px; flex-shrink: 0; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-muted); color: var(--primary); font-size: .8rem; }
.cd-fact a { color: var(--primary); overflow-wrap: anywhere; }
.cd-hero-actions { display: flex; flex-direction: column; gap: .45rem; align-items: stretch; flex: 0 0 auto; }
.cd-hero-actions form { margin: 0; }
.cd-hero-actions .btn { width: 100%; justify-content: center; }

.cd-notes { display: flex; gap: .65rem; align-items: flex-start; background: #fffbeb; border: 1px solid #fde68a; border-radius: var(--radius);
  padding: .8rem 1.1rem; font-size: .875rem; color: var(--text); }
.cd-notes > i { color: #b45309; margin-top: .15rem; }

.cd-cols { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.cd-main, .cd-side { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.cd-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cd-card-head { display: flex; align-items: center; gap: .6rem; justify-content: space-between; padding: .8rem 1.1rem; border-bottom: 1px solid var(--border); }
.cd-card-head h3 { margin: 0; font-size: .95rem; font-weight: 700; color: var(--text); }
.cd-sub { padding: .75rem 1.1rem 0; font-size: .7rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); }

.cd-dl { display: grid; grid-template-columns: minmax(0, 42%) minmax(0, 1fr); gap: .45rem .9rem; margin: 0; padding: .75rem 1.1rem 1rem; font-size: .85rem; }
.cd-dl dt { color: var(--text-muted); }
.cd-dl dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }

.cd-seg { display: inline-flex; background: var(--input-bg, #f3f4f6); border-radius: 8px; padding: 2px; }
.cd-seg-btn { border: none; background: none; font: inherit; font-size: .8rem; font-weight: 600; color: var(--text-muted); padding: .3rem .7rem; border-radius: 6px; cursor: pointer; }
.cd-seg-btn span { font-weight: 500; opacity: .7; margin-left: .2rem; }
.cd-seg-btn.is-active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.cd-seg-pane[hidden] { display: none; }

.cd-visit { display: flex; align-items: center; gap: .9rem; padding: .7rem 1.1rem; border-top: 1px solid var(--border); color: var(--text); text-decoration: none; }
.cd-seg-pane > .cd-visit:first-child { border-top: none; }
.cd-visit:hover { background: var(--primary-muted); text-decoration: none; }
.cd-visit-date { width: 52px; flex-shrink: 0; display: flex; flex-direction: column; align-items: center; line-height: 1.1; padding-right: .9rem; border-right: 1px solid var(--border); }
.cd-visit-date b { font-size: 1.15rem; font-weight: 700; }
.cd-visit-date span { font-size: .68rem; color: var(--text-muted); white-space: nowrap; }
.cd-visit-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: .2rem; }
.cd-visit-top { display: flex; align-items: center; gap: .45rem; }
.cd-visit-meta { display: flex; gap: .9rem; flex-wrap: wrap; font-size: .78rem; color: var(--text-muted); }
.cd-visit-meta i { opacity: .6; margin-right: .15rem; }
.cd-visit-status { flex-shrink: 0; font-size: .7rem; }
.cd-more { border-top: 1px solid var(--border); }
.cd-more > summary { cursor: pointer; padding: .6rem 1.1rem; font-size: .82rem; font-weight: 600; color: var(--primary); list-style: none; }
.cd-more > summary::-webkit-details-marker { display: none; }
.cd-more[open] > summary { border-bottom: 1px solid var(--border); }
.cd-more > .cd-visit:first-of-type { border-top: none; }

.cd-sales { margin: .9rem 1.1rem 0; padding: .7rem .9rem; border-left: 3px solid var(--secondary, #ec7b03); background: var(--input-bg, #f9fafb); border-radius: 0 8px 8px 0; font-size: .85rem; }
.cd-sales-title { font-size: .7rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); margin-bottom: .35rem; }
.cd-sales p { margin: .2rem 0 0; }
.cd-pains { list-style: none; margin: 0; padding: .4rem 0; }
.cd-pain { padding: .7rem 1.1rem; border-top: 1px solid var(--border); }
.cd-pain:first-child { border-top: none; }
.cd-pain-head { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; }
.cd-pain-name { font-weight: 600; font-size: .9rem; color: var(--text); }
.cd-pain-count { font-size: .75rem; color: var(--text-muted); white-space: nowrap; }
.cd-pain-desc { margin-top: .2rem; font-size: .83rem; color: var(--text-secondary, var(--text)); }
.cd-pain-meta { margin-top: .3rem; font-size: .76rem; color: var(--text-muted); }
.cd-pain-meta i { opacity: .6; margin-right: .2rem; }
.cd-chips { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .45rem; }
.cd-chip { font-size: .74rem; padding: .1rem .5rem; border-radius: 6px; background: var(--input-bg, #f3f4f6); border: 1px solid var(--border); color: var(--text); }

.cd-toggle { display: flex; gap: .55rem; align-items: flex-start; padding: 0 1.1rem; font-size: .85rem; cursor: pointer; }
.cd-toggle input { width: 16px; height: 16px; margin-top: .1rem; flex-shrink: 0; accent-color: var(--primary); }
.cd-hint { padding: .35rem 1.1rem 1rem 2.75rem; font-size: .78rem; color: var(--text-muted); }
.cd-hint > summary { cursor: pointer; color: var(--primary); font-weight: 500; margin-bottom: .25rem; }

.cd-link { padding: .7rem 1.1rem; border-top: 1px solid var(--border); }
.cd-card-head + .cd-link { border-top: none; }
.cd-link-row { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.cd-link-row a { flex: 1 1 auto; min-width: 0; font-size: .82rem; color: var(--primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cd-link-row .detail-copy-btn { flex-shrink: 0; background: none; border: 1px solid var(--border); border-radius: 6px; padding: .2rem .45rem; cursor: pointer; color: var(--text-muted); font-size: .75rem; }
.cd-link-row .detail-copy-btn:hover { color: var(--primary); border-color: var(--primary); }

@media (max-width: 1100px) {
  .cd-cols { grid-template-columns: minmax(0, 1fr); }
  .cd-hero-actions { flex-direction: row; flex-wrap: wrap; }
  .cd-hero-actions .btn { width: auto; }
}

/* Details ▸ Actions (inc/actions.php) */
.cd-act-group[hidden], .cd-act[hidden] { display: none; }
.cd-act-loc { display: flex; align-items: center; gap: .4rem; padding: .7rem 1.1rem .3rem; font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); }
.cd-act-loc a { color: inherit; }
.cd-act-loc a:hover { color: var(--primary); }
.cd-act-group + .cd-act-group { border-top: 1px solid var(--border); }
.cd-acts { list-style: none; margin: 0; padding: 0 0 .3rem; }
.cd-act { display: flex; gap: .75rem; align-items: flex-start; padding: .6rem 1.1rem; border-top: 1px solid var(--border-subtle, #f1f2f5); }
.cd-acts .cd-act:first-child { border-top: none; }
.cd-act-status { flex: 0 0 auto; font: inherit; font-size: .72rem; font-weight: 700; border-radius: 999px; padding: .2rem .5rem; border: 1px solid transparent; cursor: pointer; }
.cd-act-status--agreed    { background: #e0f2fe; color: #075985; }
.cd-act-status--pending   { background: #fef3c7; color: #92400e; }
.cd-act-status--completed { background: #dcfce7; color: #166534; }
.cd-act-main { flex: 1 1 auto; min-width: 0; }
.cd-act-todo { font-size: .875rem; color: var(--text); overflow-wrap: anywhere; }
.cd-act.is-done .cd-act-todo { color: var(--text-muted); text-decoration: line-through; }
.cd-act-meta { display: flex; flex-wrap: wrap; gap: .3rem .9rem; margin-top: .2rem; font-size: .76rem; color: var(--text-muted); }
.cd-act-meta i { opacity: .65; margin-right: .15rem; }
.cd-act-nobody { color: #b45309; }
.cd-act-src { color: var(--text-muted); }
a.cd-act-src:hover { color: var(--primary); }
.cd-act-tools { display: flex; gap: .15rem; flex: 0 0 auto; }
.cd-act-tools form { margin: 0; }
.cd-act-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: .25rem .35rem; border-radius: 6px; font-size: .8rem; }
.cd-act-btn:hover { color: var(--primary); background: var(--primary-muted); }

/* Location header card ▸ Actions (inc/customer-location-tabs.php) */
.cl-acts { margin-top: 1.1rem; padding-top: .9rem; border-top: 1px solid var(--border); }
.cl-acts-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .35rem; }
.cl-acts-title { font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); }
.cl-acts-count { font-size: .7rem; font-weight: 700; color: var(--primary); background: var(--primary-muted); border-radius: 999px; padding: .1rem .5rem; }
.cl-acts-link { font-size: .8rem; color: var(--primary); }
.cl-acts-head .cl-acts-link:first-of-type { margin-left: auto; }
.cl-acts-empty { font-size: .85rem; color: var(--text-muted); }
.cl-acts-list .cd-act { padding-left: 0; padding-right: 0; }

/* Details ▸ Actions: "Synlig i Partner portal" switch */
.cd-act-portal { display: inline-flex; align-items: center; gap: .4rem; flex: 0 0 auto; cursor: pointer; font-size: .72rem; color: var(--text-muted); white-space: nowrap; margin-top: .15rem; }
.cd-act-portal input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.cd-act-switch { position: relative; width: 28px; height: 16px; border-radius: 999px; background: var(--border); transition: background .15s; flex-shrink: 0; }
.cd-act-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.cd-act-portal input:checked + .cd-act-switch { background: var(--primary); }
.cd-act-portal input:checked + .cd-act-switch::after { transform: translateX(12px); }
.cd-act-portal input:focus-visible + .cd-act-switch { outline: 2px solid var(--primary); outline-offset: 2px; }
.cd-act-portal input:disabled + .cd-act-switch { opacity: .5; }
@media (max-width: 700px) { .cd-act { flex-wrap: wrap; } .cd-act-portal { order: 3; margin-left: auto; } }
