/* 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;
}

a:visited {
  color: var(--primary);
}

/* 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);
}

/* 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;
}

.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;
}

.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;
}

.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(185, 28, 28, 0.1); color: #b91c1c; }
.kanban-status-blocked i { color: #b91c1c; }
.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-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
  line-height: 1.35;
}

.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;
}

.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; }

/* 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.25rem;
}

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

.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-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-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;
}

.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-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);
}

.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);
  }
}

@media (max-width: 768px) {
  .sidebar {
    width: 72px;
    padding: 0;
  }

  .sidebar-brand .company,
  .sidebar-brand .platform span,
  .sidebar-nav a span,
  .sidebar-nav-group-title,
  .sidebar-footer {
    display: none;
  }

  .sidebar-brand {
    padding: 1rem;
    text-align: center;
  }

  .sidebar-brand .platform {
    justify-content: center;
    font-size: 17px;
  }

  .sidebar-logo {
    height: 24px;
  }

  .sidebar-nav a {
    justify-content: center;
    padding: 0.75rem;
  }

  .sidebar-nav a i {
    margin-right: 0;
  }

  .content {
    padding: 1.25rem;
  }

  .stats-row {
    grid-template-columns: 1fr 1fr;
  }

  .header {
    padding: 0 1.25rem;
  }
}

/* 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-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;
}

.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;
}

/* 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) */
}

/* ── 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-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); }
}
