@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

/* Modern Color Palette */
:root {
  --primary: #5c7cfa;
  --primary-dark: #4b64d8;
  --primary-light: #8fb3ff;
  --secondary: #6c7a91;
  --success: #2dd4bf;
  --warning: #fbbf24;
  --danger: #ef4444;
  --info: #38bdf8;

  --bg: #0b0f19;
  --surface: #0f141f;
  --card: #111827;
  --muted: #9aa8c2;
  --border: #1f2937;
  --white: #e8ecf5;

  --font-family: 'Space Grotesk', 'Inter', system-ui, -apple-system, sans-serif;

  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-light: #7c3aed;
  --secondary: #4b5563;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #0ea5e9;

  --bg: #f5f7fb;
  --surface: #ffffff;
  --card: #f7f9fc;
  --muted: #6b7280;
  --border: #d7deea;
  --white: #0f172a;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.08);
  --shadow: 0 6px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 15px 30px rgba(15, 23, 42, 0.1);

  /* Helpdesk light overrides */
  .kanban-wrapper {
    background: #f8fafc;
    border-color: #e5e7eb;
  }
  .kanban-column {
    background: #ffffff;
    border-color: #e5e7eb;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  }
  .kanban-card {
    background: #f8fafc;
    border-color: #e5e7eb;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
    color: #0f172a;
  }
  .kanban-card::before {
    opacity: 0.9;
  }
  .issue-detail-card {
    background: #ffffff;
    border-color: #e5e7eb;
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.14);
    color: #0f172a;
  }
  .issue-detail-head.sticky {
    background: #ffffff;
    border-bottom-color: #e5e7eb;
  }
  .issue-detail-description {
    background: #f8fafc;
    border-color: #e5e7eb;
  }
  .issue-context {
    background: #f8fafc;
    border-color: #e5e7eb;
  }
  #issue-view-assignee-tag {
    border-color: #e5e7eb;
    color: #4b5563;
  }
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background: var(--bg);
  color: var(--white);
  line-height: 1.6;
  font-size: 15px;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0 2px, transparent 2px 12px),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.02) 0 1px, transparent 1px 10px),
    linear-gradient(120deg, rgba(13, 15, 26, 0.92), rgba(8, 11, 20, 0.98));
  opacity: 1;
  pointer-events: none;
  z-index: -1;
}

[data-theme="light"] body::before {
  background:
    repeating-linear-gradient(135deg, rgba(15, 23, 42, 0.06) 0 2px, transparent 2px 12px),
    repeating-linear-gradient(45deg, rgba(15, 23, 42, 0.04) 0 1px, transparent 1px 10px),
    linear-gradient(120deg, rgba(247, 249, 252, 0.95), rgba(236, 242, 252, 0.98));
}

[data-theme="light"] .panel-header {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(236, 242, 252, 0.98));
  border-color: rgba(148, 163, 184, 0.35);
}

[data-theme="light"] .helpdesk-hero {
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.98), rgba(236, 242, 252, 0.98));
  border-color: rgba(148, 163, 184, 0.35);
}

[data-theme="light"] .helpdesk-command-bar {
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.98), rgba(236, 242, 252, 0.98));
  border-color: rgba(148, 163, 184, 0.35);
  box-shadow: 0 20px 36px rgba(15, 23, 42, 0.12);
}

[data-theme="light"] .helpdesk-summary .summary-pill {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(148, 163, 184, 0.4);
  color: #0f172a;
}

[data-theme="light"] .ticket-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(244, 246, 252, 0.98));
  border-color: rgba(148, 163, 184, 0.3);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.12);
}

[data-theme="light"] .ticket-card:hover {
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.18);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

/* Utility Classes */
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Auth Screen */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: linear-gradient(135deg, var(--bg) 0%, var(--surface) 100%);
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.auth-header {
  padding: 2rem 2rem 1rem;
  text-align: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
}

.logo-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.auth-logo {
  height: 120px;
  width: 120px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.1);
}

.logo-text h1 {
  color: white;
  font-size: 1.5rem;
  font-weight: 700;
}

.auth-body {
  padding: 2rem;
}

.auth-body h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.auth-subtitle {
  color: var(--muted);
  margin-bottom: 2rem;
}

.auth-links {
  margin-top: 0.75rem;
  text-align: center;
}

.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-weight: 600;
}

.link-btn:hover {
  text-decoration: underline;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.input-group {
  position: relative;
  display: flex;
  align-items: center;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.input-icon {
  position: absolute;
  left: 1rem;
  color: var(--muted);
  z-index: 1;
}

.input-group input {
  width: 100%;
  padding: 0.875rem 1rem 0.875rem 2.75rem;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--white);
  font-size: 1rem;
  box-shadow: none;
  transition: color 0.2s ease;
}

.input-group input:focus {
  outline: none;
  box-shadow: none;
}

.input-group:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(242, 106, 61, 0.1);
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-danger, .btn-icon, .btn-text {
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.75rem 1.25rem;
  min-height: 48px;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.btn-primary.small,
.btn-secondary.small,
.btn-danger.small,
.btn-text.small {
  padding: 0.5rem 0.85rem;
  font-size: 0.85rem;
  min-height: 44px;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: none;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--white);
  border: 1px solid var(--border);
}

.btn-secondary.ghost {
  background: transparent;
  border-style: dashed;
}

[data-theme="light"] .btn-secondary {
  background: rgba(15, 23, 42, 0.06);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--muted);
}

[data-theme="light"] .btn-primary:active,
[data-theme="light"] .btn-secondary:active,
.btn-secondary:active,
.btn-danger:active {
  transform: translateY(0);
  box-shadow: none;
}

[data-theme="light"] .btn-secondary:hover {
  background: rgba(15, 23, 42, 0.12);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-danger:focus-visible,
.btn-icon:focus-visible,
.btn-text:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(92, 124, 250, 0.25);
}

.btn-icon {
  padding: 0.5rem;
  width: 2.5rem;
  height: 2.5rem;
  justify-content: center;
}

.btn-text {
  background: transparent;
  color: var(--primary);
  padding: 0.5rem;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

/* App Shell */
.app-shell {
  min-height: 100vh;
  display: flex;
  background: var(--bg);
}

/* Mobile Header */
.mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
}

.mobile-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
}

.mobile-brand img {
  height: 32px;
  width: 32px;
  border-radius: var(--radius-sm);
}

/* Sidebar */
.sidebar {
  width: 280px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1rem;
  transition: transform 0.3s ease;
}

body.sidebar-open {
  overflow: hidden;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 20, 0.55);
  z-index: 80;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.sidebar-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

@media (min-width: 769px) {
  .sidebar-backdrop {
    display: none;
  }
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.1rem 0.75rem 1.35rem;
  margin: -1.25rem -1rem 1.5rem;
  background: #0b172f;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
}

.sidebar-brand[data-theme="light"],
[data-theme="light"] .sidebar-brand {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.sidebar-brand img {
  display: none;
}

[data-theme="light"] .sidebar-brand img {
  display: none;
}

.brand-title {
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 1rem;
  text-transform: uppercase;
  color: var(--white);
}

[data-theme="light"] .brand-title {
  color: var(--text, #0f172a);
}

.brand-title {
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 1rem;
  text-transform: uppercase;
  color: var(--white);
}

[data-theme="light"] .brand-title {
  color: var(--text);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.95rem;
  font-weight: 500;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--white);
}

.nav-btn.active {
  background: var(--primary);
  color: white;
  box-shadow: var(--shadow);
}

.sidebar-footer {
  margin-top: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-lg);
  flex-wrap: nowrap;
  max-width: 100%;
  overflow: hidden;
}

[data-theme="light"] .user-chip {
  background: rgba(15, 23, 42, 0.05);
}

.user-info span {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-info small {
  display: block;
  word-break: break-word;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-chip .btn-icon {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid transparent;
}

[data-theme="light"] .user-chip .btn-icon {
  background: rgba(15, 23, 42, 0.05);
}

.user-chip .btn-icon:hover {
  border-color: var(--primary);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
}

.user-chip-actions {
  display: flex;
  gap: 0.35rem;
  margin-left: auto;
}

.user-chip-actions .btn-icon {
  flex-shrink: 0;
}

/* Main Panel */
.main-panel {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 2rem;
  gap: 1rem;
  background: linear-gradient(135deg, rgba(26, 32, 50, 0.9), rgba(12, 18, 30, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.panel[data-panel="helpdesk"] .panel-header {
  padding: 0.9rem 1.1rem;
  margin-bottom: 1.1rem;
  border-radius: 18px;
}

.panel[data-panel="helpdesk"] .stats-deck .stat-card {
  padding: 1rem 1.1rem;
}

.panel[data-panel="helpdesk"] .card.ticket-stream {
  display: none;
}

.panel[data-panel="helpdesk"] .card.ticket-stream .card-header {
  padding: 0.9rem 1rem;
  align-items: center;
  gap: 0.75rem;
}

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

.panel-header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.panel[data-panel="helpdesk"] .panel-header h1 {
  font-size: 1.6rem;
  margin-bottom: 0.2rem;
}

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

.helpdesk-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  background: linear-gradient(120deg, rgba(20, 26, 44, 0.9), rgba(12, 16, 28, 0.96));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

.helpdesk-hero .hero-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.helpdesk-scoreboard {
  margin-bottom: 1rem;
}

.helpdesk-command-bar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  background: linear-gradient(140deg, rgba(17, 23, 41, 0.95), rgba(9, 13, 24, 0.98));
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 20px;
  padding: 1.2rem;
  box-shadow: 0 26px 48px rgba(8, 11, 20, 0.45);
}

.helpdesk-command-bar .command-main {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.helpdesk-command-bar .command-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.helpdesk-command-bar .command-meta {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.helpdesk-command-bar .search-box.large {
  flex: 1;
  min-width: 240px;
}

.helpdesk-command-bar .stats-deck.compact {
  flex: 1;
  min-width: 220px;
}

.helpdesk-summary-wrap {
  flex: 1;
  min-width: 220px;
}

.helpdesk-view-toggle {
  display: inline-flex;
  gap: 0.4rem;
  background: rgba(11, 15, 25, 0.5);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 999px;
  padding: 0.2rem;
}

.helpdesk-view-toggle .btn-secondary.small {
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
}

.helpdesk-view-toggle .btn-secondary.small.active {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.5);
  color: var(--white);
}

.helpdesk-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.helpdesk-summary .summary-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.95rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(7, 12, 22, 0.7);
  color: var(--white);
  font-size: 0.85rem;
  cursor: pointer;
}

.helpdesk-summary .summary-pill strong {
  font-size: 1rem;
}

.helpdesk-summary .summary-pill.plain {
  cursor: default;
  opacity: 0.8;
}

.helpdesk-summary .summary-pill:hover {
  border-color: rgba(59, 130, 246, 0.5);
}

.helpdesk-action-dropdown {
  position: relative;
}

.helpdesk-action-dropdown summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.helpdesk-action-dropdown summary::-webkit-details-marker {
  display: none;
}

.helpdesk-action-dropdown .helpdesk-filter-bar,
.helpdesk-action-dropdown .helpdesk-views-panel {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 280px;
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: var(--radius);
  box-shadow: 0 18px 30px rgba(15, 23, 42, 0.4);
  padding: 0.75rem;
  z-index: 12;
}

.helpdesk-action-dropdown .helpdesk-filter-bar {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.helpdesk-action-dropdown .helpdesk-views-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.helpdesk-action-dropdown .saved-views {
  max-height: 200px;
  overflow-y: auto;
}

.helpdesk-views-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-top: 0.75rem;
}

.helpdesk-views-panel .saved-views {
  flex: 1;
  min-width: 220px;
}

.helpdesk-filters-card {
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.helpdesk-filter-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: flex-end;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 180px;
  flex: 1;
}

.filter-field span {
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.filter-field select,
.filter-field input {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--white);
  padding: 0.6rem 0.75rem;
}

.helpdesk-filter-row button {
  align-self: flex-end;
  height: 44px;
}

.search-field {
  flex: 2;
}

.filter-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.35rem;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-height: 28px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(99, 102, 241, 0.12);
  color: var(--primary-light);
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.filter-chip i {
  font-size: 0.75rem;
}

.filter-chip:hover {
  background: rgba(99, 102, 241, 0.2);
  color: var(--white);
}

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

.clear-chip {
  border-color: rgba(255, 255, 255, 0.3);
  color: var(--muted);
  padding: 0.15rem 0.6rem;
  font-size: 0.8rem;
  line-height: 1.2;
  background: transparent;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border 0.2s ease;
}

.clear-chip:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
  border-color: var(--border);
}


.helpdesk-layout {
  display: grid;
  grid-template-columns: minmax(340px, 1fr) minmax(360px, 420px);
  gap: 1.5rem;
}

@media (max-width: 1080px) {
  .helpdesk-layout {
    grid-template-columns: 1fr;
  }
  .detail-column {
    order: 2;
  }
}

.tickets-column,
.detail-column {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.issue-detail-card {
  display: none;
  position: fixed;
  top: 8vh;
  left: 50%;
  transform: translateX(-50%);
  width: min(960px, 92vw);
  max-height: 84vh;
  overflow-y: auto;
  z-index: 1100;
  padding: 1.25rem;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 22px;
  background: linear-gradient(140deg, rgba(16, 21, 34, 0.96), rgba(7, 10, 18, 0.98));
  box-shadow: 0 24px 60px rgba(5, 8, 16, 0.45);
}

.ticket-wallpaper.issue-detail-card {
  background-image:
    linear-gradient(140deg, var(--ticket-surface), var(--ticket-surface-strong)),
    var(--ticket-wallpaper);
  background-blend-mode: overlay;
}

[data-theme="light"] .ticket-wallpaper.issue-detail-card {
  background-blend-mode: soft-light;
}

.issue-detail-page .helpdesk-layout {
  grid-template-columns: 1fr;
}

.issue-detail-page .tickets-column {
  display: none;
}

.issue-detail-page .detail-column {
  width: 100%;
}

.issue-detail-page .issue-detail-card {
  position: relative;
  top: 0;
  left: 0;
  transform: none;
  width: min(980px, 96vw);
  max-height: none;
  margin: 2.5rem auto 4rem;
}

.ticket-wallpaper {
  position: relative;
  overflow: hidden;
  color: var(--white);
  --ticket-surface: rgba(12, 18, 32, 0.78);
  --ticket-surface-strong: rgba(8, 12, 22, 0.86);
}

.ticket-wallpaper .muted,
.ticket-wallpaper .ticket-subtitle,
.ticket-wallpaper .ticket-meta,
.ticket-wallpaper .ticket-people,
.ticket-wallpaper .issue-detail-meta,
.ticket-wallpaper .issue-detail-description p,
.ticket-wallpaper .issue-context p,
.ticket-wallpaper .issue-timeline-header p {
  color: var(--muted);
}

.ticket-wallpaper::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--ticket-custom-wallpaper, none), var(--ticket-wallpaper, none);
  background-position: center center;
  background-repeat: no-repeat;
  background-size: cover;
  opacity: 0.24;
  pointer-events: none;
}

.ticket-wallpaper::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(5, 10, 22, 0.55) 0%, rgba(5, 10, 22, 0.12) 38%, rgba(5, 10, 22, 0.6) 100%);
  pointer-events: none;
}

[data-theme="light"] .ticket-wallpaper {
  --ticket-surface: rgba(255, 255, 255, 0.78);
  --ticket-surface-strong: rgba(244, 247, 252, 0.88);
}

.ticket-wallpaper[data-wallpaper="none"]:not([data-custom-wallpaper="true"])::before,
.ticket-wallpaper[data-wallpaper="none"]:not([data-custom-wallpaper="true"])::after {
  display: none;
}

.ticket-wallpaper > * {
  position: relative;
  z-index: 1;
}

.ticket-wallpaper[data-wallpaper="aurora"] {
  --ticket-wallpaper:
    radial-gradient(circle at 15% 20%, rgba(86, 197, 255, 0.55), transparent 55%),
    radial-gradient(circle at 80% 25%, rgba(100, 255, 190, 0.4), transparent 60%),
    linear-gradient(120deg, rgba(16, 32, 74, 0.9), rgba(8, 16, 34, 0.9));
  --ticket-accent: rgba(86, 197, 255, 0.65);
}

.ticket-wallpaper[data-wallpaper="nebula"] {
  --ticket-wallpaper:
    radial-gradient(circle at 25% 30%, rgba(139, 92, 246, 0.55), transparent 58%),
    radial-gradient(circle at 70% 15%, rgba(236, 72, 153, 0.45), transparent 55%),
    radial-gradient(circle at 60% 70%, rgba(14, 165, 233, 0.35), transparent 60%),
    linear-gradient(135deg, rgba(12, 18, 36, 0.92), rgba(8, 12, 22, 0.95));
  --ticket-accent: rgba(139, 92, 246, 0.6);
}

.ticket-wallpaper[data-wallpaper="grid"] {
  --ticket-wallpaper:
    linear-gradient(0deg, rgba(24, 42, 68, 0.6) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24, 42, 68, 0.6) 1px, transparent 1px),
    radial-gradient(circle at 20% 20%, rgba(56, 189, 248, 0.3), transparent 50%),
    linear-gradient(135deg, rgba(9, 14, 28, 0.95), rgba(5, 9, 18, 0.95));
  background-size: 36px 36px, 36px 36px, auto, auto;
  --ticket-accent: rgba(56, 189, 248, 0.55);
}

.ticket-wallpaper[data-wallpaper="topo"] {
  --ticket-wallpaper:
    repeating-radial-gradient(circle at 20% 20%, rgba(56, 189, 248, 0.25) 0 2px, transparent 2px 10px),
    repeating-radial-gradient(circle at 80% 70%, rgba(45, 212, 191, 0.2) 0 2px, transparent 2px 12px),
    linear-gradient(135deg, rgba(8, 17, 32, 0.96), rgba(6, 11, 22, 0.96));
  --ticket-accent: rgba(45, 212, 191, 0.55);
}

.ticket-wallpaper[data-wallpaper="signal"] {
  --ticket-wallpaper:
    linear-gradient(120deg, rgba(59, 130, 246, 0.35) 0%, transparent 40%),
    linear-gradient(300deg, rgba(34, 197, 94, 0.2) 0%, transparent 50%),
    repeating-linear-gradient(135deg, rgba(148, 163, 184, 0.18) 0 1px, transparent 1px 10px),
    linear-gradient(180deg, rgba(9, 15, 28, 0.96), rgba(6, 10, 20, 0.96));
  --ticket-accent: rgba(59, 130, 246, 0.5);
}

.issue-detail-card.modal-open {
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 8vh;
  left: 50%;
  transform: translateX(-50%);
  width: min(960px, 92vw);
  max-height: 84vh;
  padding: 1.25rem;
  z-index: 1200;
  overflow: hidden;
  overscroll-behavior: contain;
}

.issue-detail-card.modal-open #issue-detail-body {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.detail-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}

#issue-detail-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 70vh;
  overflow-y: auto;
  padding-right: 0.35rem;
}

.issue-detail-head.sticky {
  position: sticky;
  top: 0;
  background: linear-gradient(135deg, rgba(18, 24, 40, 0.98), rgba(10, 14, 24, 0.98));
  padding-bottom: 0.75rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  z-index: 5;
}

.ticket-wallpaper .issue-detail-head.sticky {
  background: rgba(11, 18, 32, 0.78);
  backdrop-filter: blur(4px);
}

.ticket-wallpaper .drawer-header {
  background: rgba(11, 18, 32, 0.82);
  backdrop-filter: blur(4px);
}

.ticket-wallpaper .issue-triage-bar,
.ticket-wallpaper .issue-detail-description,
.ticket-wallpaper .issue-context,
.ticket-wallpaper .detail-pane,
.ticket-wallpaper .issue-comments,
.ticket-wallpaper .issue-timeline-header,
.ticket-wallpaper .comment-form,
.ticket-wallpaper .issue-detail-status-row {
  background: linear-gradient(140deg, rgba(12, 18, 32, 0.85), rgba(7, 10, 18, 0.92));
  border-color: rgba(148, 163, 184, 0.25);
  box-shadow: 0 18px 36px rgba(5, 8, 16, 0.3);
}

.ticket-wallpaper .issue-detail-head.sticky,
.ticket-wallpaper .detail-tabs,
.ticket-wallpaper .issue-detail-description,
.ticket-wallpaper .issue-context,
.ticket-wallpaper .detail-pane,
.ticket-wallpaper .issue-comments,
.ticket-wallpaper .issue-timeline-header,
.ticket-wallpaper .comment-form,
.ticket-wallpaper .issue-detail-status-row {
  background-image:
    linear-gradient(140deg, var(--ticket-surface), var(--ticket-surface-strong)),
    var(--ticket-wallpaper);
  background-blend-mode: overlay;
  border-color: rgba(148, 163, 184, 0.25);
}

[data-theme="light"] .ticket-wallpaper .issue-detail-head.sticky,
[data-theme="light"] .ticket-wallpaper .detail-tabs,
[data-theme="light"] .ticket-wallpaper .issue-detail-description,
[data-theme="light"] .ticket-wallpaper .issue-context,
[data-theme="light"] .ticket-wallpaper .detail-pane,
[data-theme="light"] .ticket-wallpaper .issue-comments,
[data-theme="light"] .ticket-wallpaper .issue-timeline-header,
[data-theme="light"] .ticket-wallpaper .comment-form,
[data-theme="light"] .ticket-wallpaper .issue-detail-status-row {
  background-blend-mode: soft-light;
  border-color: rgba(148, 163, 184, 0.35);
}

.ticket-wallpaper .detail-tab-btn,
.ticket-wallpaper .chip,
.ticket-wallpaper .ticket-status-chip .chip,
.ticket-wallpaper .issue-detail-tags .chip {
  background: rgba(11, 18, 32, 0.68);
  border-color: rgba(148, 163, 184, 0.32);
}

.ticket-wallpaper .detail-tab-btn.active,
.ticket-wallpaper .chip.active {
  border-color: var(--ticket-accent, rgba(99, 102, 241, 0.6));
  background: rgba(11, 18, 32, 0.78);
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.2);
}

.ticket-wallpaper input,
.ticket-wallpaper select,
.ticket-wallpaper textarea {
  background: rgba(8, 14, 26, 0.6);
  border-color: rgba(148, 163, 184, 0.3);
  color: var(--white);
}

.ticket-wallpaper input::placeholder,
.ticket-wallpaper textarea::placeholder {
  color: rgba(154, 168, 194, 0.9);
}

.ticket-wallpaper input:focus,
.ticket-wallpaper select:focus,
.ticket-wallpaper textarea:focus {
  outline: none;
  border-color: var(--ticket-accent, rgba(99, 102, 241, 0.6));
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.25);
}

[data-theme="light"] .ticket-wallpaper .issue-triage-bar,
[data-theme="light"] .ticket-wallpaper .issue-detail-description,
[data-theme="light"] .ticket-wallpaper .issue-context,
[data-theme="light"] .ticket-wallpaper .detail-pane,
[data-theme="light"] .ticket-wallpaper .issue-comments,
[data-theme="light"] .ticket-wallpaper .issue-timeline-header,
[data-theme="light"] .ticket-wallpaper .comment-form,
[data-theme="light"] .ticket-wallpaper .issue-detail-status-row {
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.92), rgba(236, 242, 252, 0.96));
  border-color: rgba(148, 163, 184, 0.35);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.12);
}

[data-theme="light"] .ticket-wallpaper .detail-tab-btn,
[data-theme="light"] .ticket-wallpaper .chip {
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(203, 213, 225, 0.85);
}

/* Hard override: ensure wallpaper applies to every ticket section */
.ticket-wallpaper .issue-detail-head.sticky,
.ticket-wallpaper .issue-triage-bar,
.ticket-wallpaper .issue-detail-description,
.ticket-wallpaper .issue-context,
.ticket-wallpaper .detail-tabs,
.ticket-wallpaper .detail-pane,
.ticket-wallpaper .detail-pane.active,
.ticket-wallpaper .issue-comments,
.ticket-wallpaper .issue-timeline-header,
.ticket-wallpaper .comment-form,
.ticket-wallpaper .issue-detail-status-row,
.ticket-wallpaper .timeline-list {
  background-image:
    linear-gradient(140deg, var(--ticket-surface), var(--ticket-surface-strong)),
    var(--ticket-wallpaper) !important;
  background-blend-mode: overlay !important;
  background-color: transparent !important;
  background-repeat: no-repeat !important;
  background-size: cover !important;
  border-color: rgba(148, 163, 184, 0.28) !important;
}

[data-theme="light"] .ticket-wallpaper .issue-detail-head.sticky,
[data-theme="light"] .ticket-wallpaper .issue-triage-bar,
[data-theme="light"] .ticket-wallpaper .issue-detail-description,
[data-theme="light"] .ticket-wallpaper .issue-context,
[data-theme="light"] .ticket-wallpaper .detail-tabs,
[data-theme="light"] .ticket-wallpaper .detail-pane,
[data-theme="light"] .ticket-wallpaper .detail-pane.active,
[data-theme="light"] .ticket-wallpaper .issue-comments,
[data-theme="light"] .ticket-wallpaper .issue-timeline-header,
[data-theme="light"] .ticket-wallpaper .comment-form,
[data-theme="light"] .ticket-wallpaper .issue-detail-status-row,
[data-theme="light"] .ticket-wallpaper .timeline-list {
  background-blend-mode: soft-light !important;
  border-color: rgba(148, 163, 184, 0.35) !important;
}

[data-theme="light"] .ticket-wallpaper input,
[data-theme="light"] .ticket-wallpaper select,
[data-theme="light"] .ticket-wallpaper textarea {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(203, 213, 225, 0.9);
  color: var(--white);
}

[data-theme="light"] .ticket-wallpaper input::placeholder,
[data-theme="light"] .ticket-wallpaper textarea::placeholder {
  color: rgba(71, 85, 105, 0.7);
}

[data-theme="light"] .ticket-wallpaper input:focus,
[data-theme="light"] .ticket-wallpaper select:focus,
[data-theme="light"] .ticket-wallpaper textarea:focus {
  border-color: var(--ticket-accent, rgba(99, 102, 241, 0.5));
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.issue-detail-titles {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.issue-detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.issue-detail-actions {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 0.75rem;
}

.wallpaper-picker {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  align-items: flex-end;
}

.wallpaper-select {
  min-width: 150px;
  height: 34px;
  border-radius: 10px;
  background: rgba(11, 18, 32, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: var(--text);
  padding: 0 0.6rem;
  font-size: 0.85rem;
}

.drawer .wallpaper-select {
  width: 100%;
  background: rgba(15, 23, 42, 0.7);
}

.issue-detail-actions .btn-icon {
  order: 3;
  color: var(--muted);
}

.issue-detail-actions .chip {
  align-self: center;
}

.issue-detail-actions .btn-danger {
  height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.85rem;
}

.issue-detail-actions .btn-danger i {
  font-size: 0.9rem;
}

.detail-header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
  margin-bottom: 1rem;
}

.detail-column .chip {
  margin-top: 0.25rem;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pagination-controls button {
  padding: 0.25rem 0.75rem;
}

.pagination-controls button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ticket-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

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

.saved-views {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.35rem;
}

.saved-views-actions {
  display: grid;
  gap: 0.5rem;
  width: 100%;
}

.saved-view-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.4rem 0.6rem;
}

.saved-view-form input[type="text"] {
  flex: 1;
  min-width: 180px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 0.6rem;
  background: var(--card);
  color: var(--white);
}

.saved-view-form .inline-checkbox {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  font-size: 0.9rem;
  color: var(--muted);
}

.view-tab {
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.view-tab.active {
  color: var(--white);
  border-color: var(--primary);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.4);
}

.view-tab:hover {
  color: var(--white);
  border-color: var(--primary);
}

.ticket-toolbar .toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.ticket-toolbar .toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.ticket-toolbar .select-all {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.85rem;
}

.ticket-toolbar input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.ticket-toolbar .inline-field {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.ticket-toolbar .compact-select {
  height: 32px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--white);
  padding: 0 0.5rem;
}

.ticket-pagination {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1rem;
}

.ticket-card {
  display: flex;
  gap: 1.1rem;
  align-items: flex-start;
  padding: 1.1rem 1.2rem;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(17, 24, 39, 0.95), rgba(10, 14, 25, 0.95));
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.25);
  transition: border 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
  cursor: pointer;
}

.ticket-card.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.35);
}

.ticket-card.active-detail {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.2);
}

.ticket-card:hover {
  border-color: var(--primary);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.3);
  transform: translateY(-2px);
}

.ticket-checkbox {
  flex-shrink: 0;
  margin-top: 0.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(255, 255, 255, 0.02);
}

.ticket-checkbox input {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary);
}

@media (pointer: coarse) {
  .ticket-checkbox {
    width: 44px;
    height: 44px;
  }

  .ticket-checkbox input {
    width: 22px;
    height: 22px;
  }
}

.ticket-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ticket-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.ticket-details h4 {
  font-size: 1rem;
  margin-bottom: 0.15rem;
  line-height: 1.25;
}

.ticket-subtitle {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.2;
}

.ticket-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.9rem;
  color: var(--muted);
  align-items: center;
}

.ticket-people {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.ticket-people span {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

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

.assignee-row .ghost-btn {
  padding: 0.2rem 0.65rem;
  font-size: 0.75rem;
}

.assignee-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.ticket-preview {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.35rem;
  line-height: 1.35;
}

.ticket-actions-inline {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  justify-content: flex-end;
}

.ticket-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
  min-width: 120px;
}

.ticket-status time {
  font-size: 0.8rem;
  color: var(--muted);
}

.ticket-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.helpdesk-banner {
  margin: 1rem 0 0;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px dashed var(--border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
}

.helpdesk-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (max-width: 960px) {
  .helpdesk-grid {
    gap: 1.25rem;
  }
  .ticket-toolbar,
  #helpdesk-filters-card {
    overflow-x: visible;
  }
  .ticket-toolbar .toolbar-left {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
  }
  .ticket-toolbar .inline-field,
  .ticket-toolbar .inline-field select,
  .ticket-toolbar .inline-field button {
    width: 100%;
    min-width: 0;
  }
  .detail-column {
    width: 100%;
  }
  .issue-detail-card:not(.inline) {
    position: fixed;
    top: 6vh;
    left: 50%;
    transform: translateX(-50%);
    width: min(94vw, 720px);
    max-height: 88vh;
  }
  .issue-detail-head {
    position: sticky;
    top: 66px;
    z-index: 2;
  }
}

#issue-detail-close {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.6);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

#issue-detail-close:hover {
  background: rgba(59, 130, 246, 0.18);
  border-color: rgba(59, 130, 246, 0.5);
  transform: translateY(-1px);
}

#issue-detail-close i {
  color: var(--white);
  font-size: 0.9rem;
}

@media (pointer: coarse) {
  #issue-detail-close {
    width: 44px;
    height: 44px;
  }
}

.panel[data-panel="helpdesk"] #helpdesk-filters-card {
  position: relative;
}

.panel[data-panel="helpdesk"] #helpdesk-filters-card select,
.panel[data-panel="helpdesk"] #helpdesk-filters-card input,
.panel[data-panel="helpdesk"] #helpdesk-reporter-customer,
.panel[data-panel="helpdesk"] #helpdesk-reporter-status {
  min-width: 160px;
  height: 36px;
  background: rgba(11, 15, 25, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 10px;
  color: var(--white);
  padding: 0 0.65rem;
}

[data-theme="light"] .helpdesk-action-dropdown .helpdesk-filter-bar,
[data-theme="light"] .helpdesk-action-dropdown .helpdesk-views-panel {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 18px 30px rgba(15, 23, 42, 0.15);
}

[data-theme="light"] .panel[data-panel="helpdesk"] #helpdesk-filters-card select,
[data-theme="light"] .panel[data-panel="helpdesk"] #helpdesk-filters-card input,
[data-theme="light"] .panel[data-panel="helpdesk"] #helpdesk-reporter-customer,
[data-theme="light"] .panel[data-panel="helpdesk"] #helpdesk-reporter-status {
  background: #ffffff;
  border-color: #e2e8f0;
  color: #0f172a;
}

[data-theme="light"] .issue-detail-card,
[data-theme="light"] .issue-detail-head.sticky {
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.98), rgba(236, 242, 252, 0.98));
  border-color: rgba(148, 163, 184, 0.35);
}

[data-theme="light"] .card.issue-detail-card {
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.98), rgba(236, 242, 252, 0.98));
  border-color: rgba(148, 163, 184, 0.35);
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.18);
}

[data-theme="light"] .helpdesk-summary .summary-pill {
  background: #ffffff;
  border-color: #e2e8f0;
  color: #0f172a;
}

[data-theme="light"] .helpdesk-view-toggle {
  background: #ffffff;
  border-color: #e2e8f0;
}

[data-theme="light"] .issue-triage-bar {
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.98), rgba(236, 242, 252, 0.98));
  border-color: rgba(148, 163, 184, 0.35);
}

.ticket-toolbar .btn-secondary,
.ticket-toolbar .btn-danger {
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
}

.ticket-toolbar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  margin-top: 12px;
  position: sticky;
  top: 118px;
  z-index: 4;
}

.issue-triage-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0.75rem 0 1rem;
  padding: 1rem 1.25rem;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: linear-gradient(135deg, rgba(12, 18, 32, 0.85), rgba(6, 9, 18, 0.9));
}

.issue-triage-bar .triage-left {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.issue-triage-bar .triage-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.issue-triage-bar .triage-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.ticket-toolbar .btn-secondary {
  background: var(--card);
  border-color: var(--border);
}

.kanban-wrapper {
  padding: 0.75rem;
  overflow-x: auto;
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.kanban-empty {
  padding: 1rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  text-align: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
}

.kanban-board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(240px, 1fr);
  gap: 16px;
  align-items: flex-start;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 720px) {
  .kanban-board {
    grid-auto-columns: minmax(280px, 92vw);
  }
}

.kanban-column {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  min-height: 260px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

.kanban-column.drag-over {
  border-color: #4b9bff;
  box-shadow: 0 0 0 1px #4b9bff;
}

.kanban-column h4 {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #d9dde6;
}

.kanban-count {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 11px;
}

.kanban-lane {
  margin-top: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 220px;
}

.kanban-lane.drag-over {
  outline: 1px dashed #4b9bff;
  outline-offset: 4px;
  background: rgba(75, 155, 255, 0.06);
  border-radius: 12px;
  padding: 6px;
}


.kanban-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: border 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
  position: relative;
  overflow: hidden;
}

.kanban-card::before {
  content: "";
  position: absolute;
  inset: 0 0 0 auto;
  width: 4px;
  background: var(--severity-color, #3e8ef7);
}

.kanban-card.selected {
  border-color: #3e8ef7;
  box-shadow: 0 0 0 1px #3e8ef7, 0 10px 24px rgba(0, 0, 0, 0.25);
}

.kanban-card:hover {
  border-color: #3e8ef7;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
  transform: translateY(-1px);
}

.kanban-card.dragging {
  opacity: 0.7;
}

.kanban-card-body {
  flex: 1;
  min-width: 0;
}

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

.kanban-card-top {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
}

.kanban-select {
  margin-top: 0.1rem;
}

.kanban-select input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.kanban-title {
  font-weight: 600;
  font-size: 0.9rem;
  margin: 0;
}

.kanban-meta {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  align-items: center;
  margin: 0.15rem 0 0.25rem;
  color: var(--muted);
}

.kanban-chip {
  border: 1px solid var(--border);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
}

.kanban-chip.sla-warning {
  border-color: var(--warning);
  color: var(--warning);
}

.kanban-chip.sla-danger {
  border-color: var(--danger);
  color: var(--danger);
}

.kanban-chip.sla-ok {
  border-color: var(--success);
  color: var(--success);
}

.kanban-chip.severity-critical { border-color: var(--danger); color: var(--danger); }
.kanban-chip.severity-high { border-color: var(--warning); color: var(--warning); }
.kanban-chip.severity-medium { border-color: var(--info); color: var(--info); }
.kanban-chip.severity-low { border-color: var(--muted); color: var(--muted); }

.kanban-avatars {
  display: flex;
  gap: 0.25rem;
}

.avatar-circle {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
}

.kanban-card .muted.small {
  margin: 0.25rem 0 0;
}

.kanban-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

.kanban-quick-actions .ghost-btn {
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius);
  border: 1px dashed var(--border);
}

.kanban-quick-actions .ghost-btn:hover {
  border-color: var(--primary);
}

.severity-critical { --severity-color: #ff5a5f; }
.severity-high { --severity-color: #ff9f43; }
.severity-medium { --severity-color: #4b9bff; }
.severity-low { --severity-color: #4ade80; }

.kanban-card .severity-critical { background: rgba(255, 90, 95, 0.14); color: #ffb2b5; border-color: rgba(255, 90, 95, 0.4); }
.kanban-card .severity-high { background: rgba(255, 159, 67, 0.14); color: #ffd3a4; border-color: rgba(255, 159, 67, 0.4); }
.kanban-card .severity-medium { background: rgba(75, 155, 255, 0.14); color: #c2dcff; border-color: rgba(75, 155, 255, 0.4); }
.kanban-card .severity-low { background: rgba(74, 222, 128, 0.14); color: #c5f7d7; border-color: rgba(74, 222, 128, 0.4); }

@media (max-width: 900px) {
  .helpdesk-grid {
    gap: 0.75rem;
  }
  .kanban-board {
    grid-auto-flow: row;
    grid-template-columns: 1fr;
  }
  .kanban-column {
    min-width: auto;
    min-height: 220px;
  }
  .kanban-card {
    padding: 0.4rem 0.5rem;
  }
  .issue-detail-card {
    width: 94vw;
    left: 50%;
    transform: translateX(-50%);
    top: 5vh;
    max-height: 90vh;
  }
}

.tickets-column,
.detail-column {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.issue-detail-card {
  height: 100%;
}

#issue-view-sla {
  font-weight: 600;
}

#issue-view-assignee-tag {
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.issue-detail-description {
  margin-top: 0.5rem;
  padding: 1rem 1.25rem;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: linear-gradient(140deg, rgba(12, 18, 32, 0.85), rgba(8, 11, 20, 0.9));
}

.issue-context {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 18px;
  background: linear-gradient(140deg, rgba(12, 18, 32, 0.85), rgba(7, 10, 18, 0.92));
}

.context-list {
  display: grid;
  gap: 0.35rem;
}

.context-pill {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 14px;
  background: rgba(9, 13, 24, 0.7);
  font-size: 0.9rem;
}

.issue-next-step,
.issue-checklist,
.issue-attachments {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.02);
}

.next-step-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#issue-next-step-input {
  flex: 1;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--white);
}

.issue-checklist-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
}

.checklist-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.6rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
}

.checklist-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.checklist-text {
  flex: 1;
  color: var(--white);
}

.checklist-text.done {
  text-decoration: line-through;
  color: var(--muted);
}

.checklist-remove {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.issue-detail-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin: 1rem 0;
}

.status-select select {
  width: 200px;
}

.issue-attachments-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
}

.attachment-grid {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.attachment-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.attachment-card .file-thumb {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  display: grid;
  place-items: center;
  font-weight: 700;
  color: var(--primary-light);
}

.attachment-card .file-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.attachment-card .file-meta .name {
  font-weight: 600;
  font-size: 14px;
}

.attachment-card .file-meta .hint {
  color: var(--muted);
  font-size: 12px;
}

.issue-timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 0.35rem;
}

.mentions-helper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mention-list,
.watcher-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.mention-chip,
.watcher-chip {
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.85rem;
  cursor: pointer;
}

.mention-chip:hover,
.watcher-chip:hover {
  border-color: var(--primary);
  color: var(--white);
}

#issue-add-watcher.active {
  border-color: rgba(59, 130, 246, 0.6);
  background: rgba(59, 130, 246, 0.15);
  color: var(--white);
}

.triage-templates {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.triage-templates .chip.ghost {
  background: transparent;
  border-style: dashed;
}

.metric-block {
  margin-bottom: 1rem;
}

.metric-value {
  font-size: 1.8rem;
  font-weight: 700;
}

.histogram {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.histogram-bar {
  flex: 1;
  background: linear-gradient(180deg, var(--primary) 0%, rgba(99, 102, 241, 0.4) 100%);
  border-radius: var(--radius-sm);
  min-height: 6px;
  position: relative;
}

.histogram-bar span {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  color: var(--muted);
}

.histogram-label {
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.reports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  max-width: 1200px;
  margin: 0 auto 2rem;
}

.report-form {
  margin-bottom: 1rem;
}

.report-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  align-items: end;
}

.report-filters label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.report-filters input,
.report-filters select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--white);
  padding: 0.5rem 0.75rem;
}

.report-summary {
  margin-bottom: 1rem;
}

@media (max-width: 1024px) {
  .helpdesk-grid {
    grid-template-columns: 1fr;
  }
  .issue-detail-status-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .ticket-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Stats Deck */
.stats-deck {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stats-deck.compact {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.stats-deck,
.stats-deck.compact {
  width: 100%;
}

.stats-deck:has(.stat-card) {
  margin-top: var(--space-2);
}

@media (max-width: 768px) {
  .stats-deck,
  .stats-deck.compact {
    grid-template-columns: 1fr;
  }
}

.panel[data-panel="helpdesk"] .stats-deck.compact {
  margin-top: 0.2rem;
  margin-bottom: 0.6rem;
}

.stat-card {
  position: relative;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.04), rgba(99, 102, 241, 0.06));
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: transform 0.2s, box-shadow 0.2s;
}

.panel[data-panel="helpdesk"] .stat-card {
  padding: 1rem;
  border-radius: 14px;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.stat-card.primary { border-left: 4px solid var(--primary); }
.stat-card.success { border-left: 4px solid var(--success); }
.stat-card.warning { border-left: 4px solid var(--warning); }
.stat-card.danger { border-left: 4px solid var(--danger); }

.stat-pill {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  box-shadow: var(--shadow);
}

.stat-pill .label {
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.stat-pill strong {
  font-size: 1.5rem;
  font-weight: 600;
}

/* ── Enhanced Stats Deck v2 ── */
.stats-deck-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.stat-pill-v2 {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 1rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  min-width: 0;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}
.stat-pill-v2:hover {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-1px);
}
.stat-pill-v2 .stat-pill-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  background: rgba(92, 124, 250, 0.12);
  color: var(--primary);
  flex: 0 0 auto;
}
.stat-pill-v2.accent-green .stat-pill-icon {
  background: rgba(16, 185, 129, 0.12);
  color: #6ee7b7;
}
.stat-pill-v2.accent-red .stat-pill-icon {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
}
.stat-pill-v2.accent-amber .stat-pill-icon {
  background: rgba(245, 158, 11, 0.12);
  color: #fcd34d;
}
.stat-pill-v2 .stat-pill-body {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}
.stat-pill-v2 .stat-pill-value {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--white);
}
.stat-pill-v2 .stat-pill-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  white-space: nowrap;
}
.stat-pill-v2 .overdue-sub {
  color: #fca5a5;
  font-weight: 600;
}

/* ── Metric cells (ticket & invoice columns) ── */
.metric-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.metric-cell .metric-count {
  font-weight: 600;
  font-size: 0.95rem;
  min-width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  line-height: 1;
}
.metric-cell.metric-clear .metric-count {
  color: var(--muted);
}
.metric-cell.metric-warn .metric-count {
  background: rgba(245, 158, 11, 0.14);
  color: #fbbf24;
  padding: 0 6px;
}
.metric-cell.metric-critical .metric-count {
  background: rgba(239, 68, 68, 0.14);
  color: #f87171;
  padding: 0 6px;
}
.metric-cell .metric-sub {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.metric-cell .metric-sub.critical {
  color: #f87171;
}
.activity-cell {
  white-space: nowrap;
  font-size: 0.85rem;
  color: var(--muted);
}

/* ── Overflow menu for row actions ── */
.customer-row-overflow {
  position: relative;
}
.customer-row-overflow summary {
  list-style: none;
  cursor: pointer;
}
.customer-row-overflow summary::-webkit-details-marker { display: none; }
.customer-row-overflow .overflow-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 6px;
  font-size: 0.8rem;
}
.customer-row-overflow-menu {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 4px;
  z-index: 50;
  background: var(--surface, #0f141f);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  min-width: 160px;
  padding: 4px;
}
.overflow-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  border-radius: 4px;
  background: none;
  color: var(--white);
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s;
}
.overflow-item:hover {
  background: rgba(255, 255, 255, 0.08);
}
.overflow-item.danger {
  color: #f87171;
}
.overflow-item.danger:hover {
  background: rgba(239, 68, 68, 0.12);
}

/* ── Row action icon styling ── */
#customers-panel .customer-row-action i {
  font-size: 0.72rem;
  opacity: 0.8;
}
#customers-panel .customer-row-action.is-on i {
  opacity: 1;
}

/* ── Light theme overrides for v2 stats ── */
[data-theme="light"] .stat-pill-v2 {
  background: #fff;
  border-color: rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .stat-pill-v2 .stat-pill-value {
  color: #1e293b;
}
[data-theme="light"] .metric-cell.metric-warn .metric-count {
  background: rgba(245, 158, 11, 0.1);
  color: #d97706;
}
[data-theme="light"] .metric-cell.metric-critical .metric-count {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}
[data-theme="light"] .metric-cell .metric-sub.critical {
  color: #dc2626;
}
[data-theme="light"] .customer-row-overflow-menu {
  background: #fff;
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
[data-theme="light"] .overflow-item {
  color: #334155;
}
[data-theme="light"] .overflow-item:hover {
  background: rgba(0, 0, 0, 0.04);
}
[data-theme="light"] .overflow-item.danger {
  color: #dc2626;
}
[data-theme="light"] .overflow-item.danger:hover {
  background: rgba(239, 68, 68, 0.08);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.stat-card.primary .stat-icon { background: rgba(99, 102, 241, 0.1); color: var(--primary); }

.stat-card .label {
  text-transform: uppercase;
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.stat-card.stacked {
  flex-direction: column;
  align-items: flex-start;
}

.stat-card.stacked strong {
  font-size: 1.75rem;
  font-weight: 600;
}

.stat-card.actionable {
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.stat-card.actionable:hover {
  border-color: var(--primary);
  transform: translateY(-3px);
}

.stat-card.actionable:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

button.stat-card {
  background: var(--surface);
  text-align: left;
  width: 100%;
  color: inherit;
  font: inherit;
}
.stat-card.success .stat-icon { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.stat-card.warning .stat-icon { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.stat-card.danger .stat-icon { background: rgba(239, 68, 68, 0.1); color: var(--danger); }

.stat-content h3 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.stat-content p {
  color: var(--muted);
  font-size: 0.875rem;
}

/* Cards */
.card {
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.04));
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
  margin-bottom: 1.5rem;
}

.card.issue-detail-card {
  background: #0b1220;
  border-color: rgba(148, 163, 184, 0.28);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.35);
  backdrop-filter: none;
}

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

.card-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

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

.helpdesk-filters .btn-secondary.small {
  height: 38px;
}

.quick-log-card textarea {
  width: 100%;
  min-height: 120px;
}

.quick-log-inline {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
}

.quick-log-card form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  padding: 0 1.5rem 1.5rem;
}

.quick-log-card label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.quick-log-card label.wide {
  grid-column: 1 / -1;
}

.quick-log-card .note-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.quick-log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem 0.5rem;
}

.card-body {
  padding: 0 1.5rem 1.5rem;
}

.customer-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 1rem;
  align-items: start;
}

.customer-directory-card,
.customer-detail-panel {
  width: 100%;
}

@media (max-width: 1100px) {
  .customer-layout {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }
}

@media (min-width: 1101px) {
  .customer-detail-panel {
    position: sticky;
    top: 1rem;
    align-self: start;
    max-height: calc(100vh - 2rem);
    overflow: auto;
  }
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.chip-filter.selected {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 8px 20px rgba(92, 124, 250, 0.25);
}

.customer-summary-card {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.customer-detail-panel {
  margin-top: 0;
}

.customer-directory-card .table-container {
  position: relative;
  overflow: auto;
}

.customer-directory-card .data-table {
  width: 100%;
  min-width: 0;
  border-collapse: separate;
}

.customer-directory-card .data-table thead {
  display: none;
}

.customer-directory-card .data-table tbody {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.customer-directory-card .data-table tr {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.75rem;
  min-width: 280px;
  flex: 1 1 300px;
  width: calc(33.33% - 0.75rem);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.customer-directory-card .data-table tr::before {
  content: "";
  position: absolute;
  inset: 0 0 0 auto;
  width: 8px;
  background: linear-gradient(180deg, rgba(91, 141, 239, 0.5), rgba(91, 141, 239, 0));
  opacity: 0;
  transition: opacity 0.2s ease;
}

@media (max-width: 1100px) {
  .customer-directory-card .data-table tr {
    width: calc(50% - 0.75rem);
  }
}

@media (max-width: 768px) {
  .customer-directory-card .data-table tr {
    width: 100%;
    min-width: 0;
  }
}

.customer-directory-card .data-table tr:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
}

.customer-directory-card .data-table tr.active {
  background: rgba(92, 124, 250, 0.12);
  border-color: var(--primary);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
}

.customer-directory-card .data-table tr.active::before,
.customer-directory-card .data-table tr:hover::before {
  opacity: 1;
}

.customer-directory-card .data-table td {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0.35rem;
  padding: 0;
  border: none;
}

.customer-directory-card .data-table td.actions-col {
  justify-content: flex-end;
  width: 100%;
}

.customer-directory-card .customer-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  min-width: 0;
}

.customer-directory-card .customer-inline-main {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.customer-directory-card .customer-inline-main strong,
.customer-directory-card .customer-inline-main .muted {
  display: block;
  white-space: normal;
  overflow: visible;
  color: var(--white);
}

.customer-card-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.customer-card-name {
  font-weight: 700;
  color: var(--white);
  line-height: 1.25;
}

.customer-card-contact {
  font-size: 0.9rem;
  color: var(--muted);
}

.customer-card-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
}

.customer-card-avatar {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(91, 141, 239, 0.8), rgba(23, 37, 84, 0.9));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #fff;
  text-transform: uppercase;
  flex: 0 0 auto;
}

.customer-card-main {
  flex: 1;
  min-width: 0;
}

.customer-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.customer-card-last {
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  white-space: nowrap;
}

.customer-card-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  background: rgba(7, 12, 24, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  padding: 0.5rem;
}

.customer-card-kpi {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.customer-card-kpi span {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.customer-card-kpi strong {
  font-size: 1rem;
  color: var(--white);
}

.customer-card-chips {
  margin-top: 0.2rem;
}

.appointments-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 1rem;
}

.appointment-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.appointment-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.appointment-item.overdue {
  border-color: rgba(248, 113, 113, 0.6);
  background: rgba(248, 113, 113, 0.08);
}

.appointment-main {
  min-width: 0;
}

.appointment-actions {
  display: flex;
  gap: 0.35rem;
}

@media (max-width: 900px) {
  .appointments-grid {
    grid-template-columns: 1fr;
  }
  .appointment-item {
    flex-direction: column;
    align-items: flex-start;
  }
  .appointment-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

.customer-directory-card .chip-row.inline {
  gap: 0.35rem;
  flex-wrap: wrap;
  justify-content: flex-start;
  flex: 0 0 auto;
  max-width: 100%;
}

.customer-directory-card .data-table .btn-secondary.small {
  width: 100%;
  min-width: 88px;
}

.customer-directory-card .row-meta {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.customer-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  width: 100%;
}

.customer-card-meta span {
  background: rgba(255, 255, 255, 0.06);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

@media (max-width: 768px) {
  body {
    font-size: 15px;
    line-height: 1.5;
  }
  .main-panel {
    padding: 1rem;
  }
  .panel {
    padding: 1rem;
  }
  .card {
    margin-bottom: 1rem;
    border-radius: var(--radius);
  }
  .card-header,
  .card-body {
    padding: 1rem;
  }
  .filter-chips {
    gap: 0.35rem;
  }
  .chip {
    min-height: 32px;
    padding: 0.3rem 0.6rem;
  }
  .summary-metrics {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }
  .customer-detail-actions {
    position: sticky;
    top: 0;
    padding: 0.5rem 0;
    background: var(--bg);
    z-index: 5;
  }
}

.customer-detail-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.customer-summary-card {
  gap: 1rem;
  padding: 1.25rem;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01));
}

.summary-content {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.customer-summary-header {
  align-items: center;
}

.customer-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

.customer-header-main {
  min-width: 0;
}

.customer-card-avatar-lg {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  font-size: 1.05rem;
}

.customer-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.summary-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
}

.metric-chip {
  background: rgba(255, 255, 255, 0.04);
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  min-height: 96px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

@media (max-width: 1100px) {
  .customer-layout {
    grid-template-columns: 1fr;
  }
  .customer-detail-panel {
    margin-top: 1.5rem;
  }
}

.summary-content {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.customer-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.summary-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
}

.metric-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.metric-chip .label {
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.detail-grid.split {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.detail-tabs {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.detail-tab {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}

.detail-tab.active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
  box-shadow: var(--shadow-sm);
}

.detail-tab-panel {
  display: none;
}

.detail-tab-panel.active {
  display: block;
}

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

.detail-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.detail-card h4 {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.detail-card .detail-title {
  font-weight: 600;
}

.detail-placeholder {
  text-align: center;
  gap: 0.75rem;
}

.history-card .card-header {
  padding: 1.25rem 1.5rem 0.5rem;
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 0 1.5rem 1.5rem;
}

.timeline-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.02);
}

.timeline-meta {
  flex: 1;
}

.timeline-side {
  min-width: 180px;
  text-align: right;
}

.visit-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin: 0 1.5rem 1rem;
}

.visit-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.visit-form input,
.visit-form select {
  width: 100%;
}

.visit-form .visit-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.visit-form .flex-two {
  grid-column: 1 / -1;
}

.visit-list {
  padding: 0 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.visit-entry {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.02);
}

.visit-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.visit-amount {
  font-weight: 700;
}

.quick-log-card form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  padding: 0 1.5rem 1.5rem;
}

.quick-log-card label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.quick-log-card label.wide {
  grid-column: 1 / -1;
}

.quick-log-inline {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
}

.quick-log-card textarea {
  width: 100%;
  min-height: 120px;
}

.quick-log-card .note-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.conversation-list {
  padding: 0 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.conversation-entry {
  position: relative;
  padding: 0.75rem 0.5rem 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.conversation-entry:last-child {
  border-bottom: none;
}

.conversation-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.conversation-entry .btn-icon {
  position: absolute;
  top: 0.35rem;
  right: 0;
  opacity: 0.55;
}

.conversation-entry .btn-icon:hover {
  opacity: 1;
}

/* Content Grid */
.content-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
}

.content-col {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Activity List */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
}

.activity-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  flex-shrink: 0;
}

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

.activity-content strong {
  display: block;
  margin-bottom: 0.25rem;
}

.activity-meta {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.activity-item.invoice .activity-icon {
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary);
}

.activity-item.issue .activity-icon {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}

/* Quick Actions */
.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1.5rem 1rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

[data-theme="light"] .quick-action {
  background: rgba(15, 23, 42, 0.02);
}

.quick-action:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--primary);
  color: var(--white);
  transform: translateY(-2px);
}

[data-theme="light"] .quick-action:hover {
  background: rgba(15, 23, 42, 0.05);
}

.quick-action i {
  font-size: 1.5rem;
  color: var(--primary);
}

/* Tables */
.table-container {
  overflow-x: auto;
}

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

.table-select {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.table-select input {
  width: 1.1rem;
  height: 1.1rem;
}

.toolbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 100%;
}

.data-table tbody tr {
  cursor: pointer;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

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

.data-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  user-select: none;
}

.data-table.compact td,
.data-table.compact th {
  padding: 0.65rem 0.75rem;
}

.data-table .actions-col {
  width: 110px;
  text-align: right;
}

.data-table th.sortable {
  cursor: pointer;
}

.data-table th.sortable.sorted-asc::after,
.data-table th.sortable.sorted-desc::after {
  content: attr(data-sort-label);
  margin-left: 0.35rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.data-table th.sortable.sorted-asc {
  color: var(--white);
}

.data-table th.sortable.sorted-desc {
  color: var(--white);
}

.checkbox-cell {
  width: 36px;
}

.checkbox-cell input {
  width: 1rem;
  height: 1rem;
}

.data-table tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.data-table tbody tr.active {
  background: rgba(99, 102, 241, 0.08);
  box-shadow: inset 4px 0 0 var(--primary);
}

.customer-list-company {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.customer-inline.single-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.customer-inline-main {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.customer-inline-main strong {
  margin-bottom: 0;
}

.customer-table td {
  vertical-align: middle;
}

.customer-table .chip-row.inline {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  flex-wrap: wrap;
}

.customer-contact strong {
  display: block;
  margin-bottom: 0.15rem;
}

.customer-contact {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.status-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.35rem;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.ghost-btn {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--white);
  border-radius: var(--radius);
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  cursor: pointer;
  text-transform: none;
  transition: all 0.2s;
}

.ghost-btn.small {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
}

.ghost-btn:hover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.12);
  color: white;
}

/* Search & Filters */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box i {
  position: absolute;
  left: 0.75rem;
  color: var(--muted);
}

.search-box input {
  padding: 0.5rem 0.75rem 0.5rem 2.25rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--white);
  font-size: 0.875rem;
  min-width: 200px;
}

.filter-grid {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.filter-grid select {
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--white);
  font-size: 0.875rem;
  min-width: 120px;
}

.filter-grid input[type="search"] {
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--white);
  font-size: 0.875rem;
  min-width: 180px;
}

/* Toggle */
.toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  cursor: pointer;
}

.toggle input {
  display: none;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  background: var(--border);
  border-radius: 12px;
  transition: background 0.2s;
}

.toggle.small .toggle-switch {
  width: 40px;
  height: 20px;
}

.toggle.small .toggle-switch::before {
  width: 16px;
  height: 16px;
}

.toggle-switch::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle input:checked + .toggle-switch {
  background: var(--primary);
}

.toggle input:checked + .toggle-switch::before {
  transform: translateX(20px);
}

.toggle-label {
  font-size: 0.85rem;
  color: var(--muted);
}

/* Automation Deck */
.automation-deck {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.automation-deck .card {
  height: 100%;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.automation-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.automation-services-panel {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

[data-theme="light"] .automation-services-panel {
  background: rgba(15, 23, 42, 0.02);
}

.automation-services-panel.disabled {
  opacity: 0.6;
}

.automation-service-header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: flex-start;
}

.automation-service-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.automation-service-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-end;
}

.automation-service-row label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
  min-width: 180px;
  font-size: 0.85rem;
  color: var(--muted);
}

.automation-service-row input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.75rem;
  background: var(--bg);
  color: var(--white);
}

.automation-service-row input.qty {
  flex: 0 0 120px;
}

.automation-service-row .btn-icon {
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

[data-theme="light"] .automation-service-row .btn-icon {
  background: rgba(15, 23, 42, 0.08);
}
.automation-form button {
  width: 100%;
}
.automation-form label.toggle span {
  width: auto;
  min-width: 44px;
}

.automation-form input[type="month"],
.automation-form select {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--white);
  padding: 0.65rem 0.75rem;
}

.automation-form .btn-primary,
.automation-form .btn-secondary {
  justify-content: center;
}

.form-row {
  display: flex;
  gap: 0.75rem;
}

.form-row select,
.form-row input {
  flex: 1;
  padding: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--white);
}

/* Admin Tabs */
.admin-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: transparent;
  border: none;
  color: var(--muted);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.95rem;
}

.tab-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--white);
}

.tab-btn.active {
  background: var(--primary);
  color: white;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.customer-tab-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  align-items: center;
}

.customer-tab {
  display: none;
  flex-direction: column;
  gap: 1rem;
}

.customer-tab.active {
  display: flex;
}

.badge-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.compact-search {
  width: min(320px, 45vw);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--white);
  padding: 0.55rem 0.85rem;
}

.compact-search::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.code-block {
  margin: 0.5rem 0 0;
  padding: 0.75rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.35);
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.85rem;
  max-width: 520px;
  overflow: auto;
  white-space: pre-wrap;
}

td details > summary.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  list-style: none;
}

td details > summary::-webkit-details-marker {
  display: none;
}

/* Drawers */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 2rem 1rem;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.drawer-overlay.hidden {
  display: none;
}

body.modal-open,
body.issue-modal-open {
  overflow: hidden;
}

.issue-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: none;
  z-index: 1095;
  display: none;
  cursor: pointer;
}

.issue-modal-backdrop.open {
  display: block;
}

.drawer {
  width: min(480px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}

.drawer-wide {
  width: min(760px, 100%);
}

@media (min-width: 1200px) {
  .drawer-wide {
    width: min(920px, 100%);
  }
}

#customer-profile-modal.drawer-wide {
  width: min(1200px, 96vw);
  height: min(92vh, 900px);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

#customer-profile-modal .drawer-header {
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 3;
}

#customer-profile-modal .drawer-form {
  flex: 1;
  overflow: visible;
  padding: 1.5rem;
  min-height: 0;
}

.customer-profile-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 0.6));
  margin-bottom: 1rem;
}

.customer-profile-hero-main {
  flex: 1;
  min-width: 0;
}

.customer-profile-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  min-width: 240px;
}

.customer-profile-metrics .metric-chip {
  min-height: 84px;
}

@media (max-width: 900px) {
  #customer-profile-modal.drawer-wide {
    width: min(100%, 96vw);
    height: min(96vh, 100%);
  }
  .customer-profile-hero {
    flex-direction: column;
    align-items: flex-start;
  }
  .customer-profile-metrics {
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.drawer-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.drawer-form {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.drawer-form label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.drawer-form input,
.drawer-form select,
.drawer-form textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--white);
  padding: 0.6rem 0.75rem;
  font-size: 0.95rem;
}
.drawer-form input[type="file"] {
  padding: 0.45rem 0.5rem;
  background: var(--surface);
  border: 1px dashed var(--border);
  cursor: pointer;
}

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

.drawer-form .inline-checkbox {
  flex-direction: row;
  align-items: center;
  gap: 0.55rem;
  padding: 0.6rem 0.75rem;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(12, 18, 32, 0.35);
  color: var(--white);
}

.drawer-form .inline-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.drawer-advanced {
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  padding-top: 0.75rem;
}

.drawer-advanced summary {
  list-style: none;
}

.drawer-advanced summary::-webkit-details-marker {
  display: none;
}

.drawer-advanced-grid {
  display: grid;
  gap: 0.85rem;
  margin-top: 0.85rem;
}

@media (min-width: 520px) {
  .drawer-advanced-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: end;
  }
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.detail-grid.horizontal {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  align-items: center;
  gap: 0.75rem;
}

#issue-meta-row.hidden {
  display: none;
}

.detail-section {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
}

#issue-view-status-wrapper select {
  width: 100%;
  margin-top: 0.35rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--white);
  padding: 0.5rem 0.75rem;
}

.detail-section p,
.comment-entry .comment-body {
  white-space: pre-wrap;
}

.comment-section {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.comment-header h4 {
  margin: 0;
}

.comment-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.comment-entry {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.02);
}

.comment-entry .meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
  font-weight: 600;
}

.comment-attachments {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.5rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.attachment-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
}

.attachment-card.image {
  grid-template-columns: 96px 1fr auto;
}

.attachment-card.image img {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.attachment-card.image.image-fallback img {
  display: none;
}

.attachment-card.image.image-fallback .attachment-meta::before {
  content: "Image unavailable";
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
}

.attachment-icon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
}

.attachment-meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.attachment-meta .name {
  font-weight: 600;
}

.attachment-meta .tag {
  font-size: 0.75rem;
  color: var(--muted);
}

.attachment-link,
.attachment-card a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

.issue-attachments-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.25rem;
}

.comment-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.comment-form textarea {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--white);
  padding: 0.75rem;
}

.detail-tabs {
  display: inline-flex;
  gap: 0.35rem;
  margin: 0.75rem 0;
  padding: 0.25rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}

.detail-tab-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
}

.detail-tab-btn.active {
  background: var(--primary);
  color: white;
}

.detail-pane {
  display: none;
}

.detail-pane.active {
  display: block;
}

.invoice-detail-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.invoice-detail-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
}

.invoice-detail-meta .chip {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.6rem;
}

.invoice-visual-box {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
  display: grid;
  gap: 0.6rem;
}

.invoice-visual-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.7rem;
}

.invoice-visual-head p {
  margin: 0;
}

.invoice-detail-snippet {
  min-height: 120px;
}

.invoice-snippet-card {
  --snippet-primary: #0b1f44;
  --snippet-accent: #f97316;
  border: 1px solid color-mix(in srgb, var(--snippet-accent) 26%, transparent);
  border-radius: calc(var(--radius) + 2px);
  background: linear-gradient(
    145deg,
    color-mix(in srgb, var(--snippet-primary) 96%, #05070f 4%),
    color-mix(in srgb, var(--snippet-primary) 84%, #0d1427 16%)
  );
  color: rgba(241, 245, 249, 0.95);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.3);
  padding: 0.85rem;
  display: grid;
  gap: 0.75rem;
}

.invoice-snippet-card .eyebrow {
  color: color-mix(in srgb, var(--snippet-accent) 76%, white 24%);
  margin: 0;
}

.invoice-snippet-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.8rem;
}

.invoice-snippet-top strong {
  display: block;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  margin-top: 0.15rem;
}

.invoice-snippet-total {
  display: grid;
  justify-items: end;
  gap: 0.25rem;
}

.invoice-snippet-total strong {
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}

.invoice-snippet-total .chip {
  border-color: color-mix(in srgb, var(--snippet-accent) 48%, transparent);
  background: color-mix(in srgb, var(--snippet-accent) 18%, transparent);
  color: #e2e8f0;
}

.invoice-snippet-dates {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}

.invoice-snippet-dates > div {
  padding: 0.55rem 0.65rem;
  border-radius: 11px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.4);
  display: grid;
  gap: 0.2rem;
}

.invoice-snippet-dates span {
  font-size: 0.72rem;
  color: rgba(191, 203, 219, 0.84);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.invoice-snippet-dates strong {
  font-size: 0.9rem;
}

.invoice-snippet-parties {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}

.invoice-snippet-party {
  padding: 0.62rem 0.68rem;
  border: 1px dashed rgba(148, 163, 184, 0.32);
  border-radius: 12px;
  display: grid;
  gap: 0.22rem;
}

.invoice-snippet-party strong {
  font-size: 0.95rem;
}

.invoice-snippet-party p {
  margin: 0;
  font-size: 0.84rem;
  color: rgba(207, 216, 230, 0.9);
}

.invoice-snippet-lines {
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 12px;
  overflow: hidden;
}

.invoice-snippet-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 55px 95px 110px;
  gap: 0.5rem;
  align-items: center;
  padding: 0.5rem 0.62rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
  font-size: 0.84rem;
}

.invoice-snippet-line:last-child {
  border-bottom: none;
}

.invoice-snippet-line.head {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(191, 203, 219, 0.84);
  background: rgba(148, 163, 184, 0.08);
  border-bottom-color: rgba(148, 163, 184, 0.22);
}

.invoice-snippet-line .qty,
.invoice-snippet-line .rate,
.invoice-snippet-line .amount {
  justify-self: end;
  text-align: right;
}

.invoice-snippet-line .amount {
  font-weight: 700;
}

.invoice-snippet-empty {
  padding: 0.75rem;
  font-size: 0.9rem;
  color: rgba(191, 203, 219, 0.84);
}

.invoice-snippet-more {
  margin-top: -0.2rem;
}

.invoice-snippet-notes {
  border: 1px solid rgba(148, 163, 184, 0.26);
  border-radius: 11px;
  background: rgba(15, 23, 42, 0.35);
  padding: 0.55rem 0.65rem;
}

.invoice-snippet-notes p {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.4;
}

.invoice-send-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
}

.invoice-send-box input {
  max-width: 320px;
}

.invoice-send-box .send-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.timeline-list {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
  padding: 0.75rem;
}

.timeline-item {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

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

.timeline-item .meta {
  font-size: 0.8rem;
  color: var(--muted);
}

@media (max-width: 820px) {
  .invoice-send-box {
    flex-direction: column;
    align-items: stretch;
  }

  .invoice-send-box .send-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
  }

  .invoice-send-box input {
    max-width: none;
    width: 100%;
  }

  .invoice-snippet-dates,
  .invoice-snippet-parties {
    grid-template-columns: 1fr;
  }

  .invoice-snippet-line {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "desc amount"
      "meta meta";
  }

  .invoice-snippet-line.head {
    display: none;
  }

  .invoice-snippet-line .desc {
    grid-area: desc;
  }

  .invoice-snippet-line .amount {
    grid-area: amount;
  }

  .invoice-snippet-line .qty,
  .invoice-snippet-line .rate {
    grid-area: meta;
    justify-self: start;
    color: rgba(191, 203, 219, 0.84);
  }

  .invoice-snippet-line .qty::before {
    content: "Qty ";
  }

  .invoice-snippet-line .rate::before {
    content: " • Rate ";
  }
}

.health-list {
  margin-top: 0.5rem;
  display: grid;
  gap: 0.35rem;
}

.health-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
}

.health-icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  flex-shrink: 0;
}

.health-item .label {
  font-weight: 600;
}

.health-item .value {
  color: var(--muted);
  font-size: 0.9rem;
}

.health-item.ok .value {
  color: var(--success);
}

.health-item.error .value {
  color: var(--danger);
}

.health-item.warning .value {
  color: var(--warning);
}

.settings-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.settings-grid section {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.settings-grid section h3 {
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.settings-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.settings-grid input,
.settings-grid select,
.settings-grid textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--white);
  padding: 0.6rem 0.75rem;
  font-size: 0.95rem;
}

.settings-grid textarea {
  min-height: 60px;
}

.settings-main-grid {
  display: grid;
  grid-template-columns: minmax(320px, 480px) minmax(360px, 1fr);
  gap: 1.5rem;
  align-items: flex-start;
}

.settings-section[data-settings-panel="invoice-builder"] .settings-main-grid {
  grid-template-columns: 1fr;
  max-width: 1280px;
  margin: 0 auto;
  align-items: start;
}

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

.settings-column {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.settings-form-modern {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.settings-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  background: rgba(255, 255, 255, 0.02);
  box-shadow: var(--shadow);
}

.settings-panel-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.field-grid.two-column {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.field-grid .field.full {
  grid-column: 1 / -1;
}

.field span {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
  display: block;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--white);
  padding: 0.65rem 0.75rem;
  font-size: 0.95rem;
}

.field select {
  cursor: pointer;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 1.1rem) 50%, calc(100% - 0.75rem) 50%;
  background-size: 8px 8px, 8px 8px;
  background-repeat: no-repeat;
  padding-right: 2.5rem;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--muted);
  opacity: 0.85;
}

.settings-panel .field-grid label.toggle {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.02);
  gap: 0.75rem;
}

.settings-panel .field-grid label.toggle span {
  color: var(--white);
}

.builder-column {
  min-width: 260px;
}

.invoice-builder-card {
  margin-top: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.02);
  box-shadow: var(--shadow);
  padding: 1rem 1.25rem 1.25rem;
}

.invoice-builder-grid {
  display: grid;
  grid-template-columns: minmax(460px, 1fr) minmax(540px, 620px);
  gap: 1rem 2rem;
  padding: 0.25rem;
  align-items: start;
}

.invoice-builder-grid.split {
  grid-template-columns: minmax(500px, 1fr) minmax(620px, 1.2fr);
}

.invoice-builder-shell {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.builder-toolbar {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 1rem;
  align-items: center;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.03);
}

.builder-toolbar--wide {
  width: 100%;
}

.builder-pane-tabs {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.4rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.builder-pane-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
}

.builder-pane-tab.active {
  background: rgba(99, 102, 241, 0.22);
  color: white;
  border: 1px solid rgba(99, 102, 241, 0.35);
}

.builder-pane {
  display: none;
}

.builder-pane.active {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.switch-field {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
}

.switch-field input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.builder-toolbar-right label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

@media (max-width: 1280px) {
  .invoice-builder-grid {
    grid-template-columns: 1fr;
  }

  .builder-preview-panel {
    position: static;
  }

  .builder-pdf-stage {
    min-height: 580px;
  }

  .builder-pdf-stage iframe {
    min-height: 540px;
  }
}

.builder-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-right: 0.1rem;
}

.builder-panel input,
.builder-panel select {
  height: 44px;
  min-height: 44px;
}

.builder-panel label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.9rem;
}

.builder-template-meta {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.builder-template-description strong {
  display: block;
  color: var(--white);
}

.builder-template-description p {
  margin: 0;
}

.template-defaults {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.template-defaults .template-option input {
  height: 16px;
  min-height: 16px;
}

.swatch-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.color-swatch {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: linear-gradient(135deg, var(--swatch-primary, #0b1f44) 0%, var(--swatch-accent, #5b8def) 100%);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.color-swatch:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.7);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.builder-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.1rem;
  background: rgba(255, 255, 255, 0.02);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.builder-section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.builder-section-header h4 {
  margin: 0;
  color: var(--white);
}

.builder-section .muted.small {
  margin: 0;
}

.section-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.builder-subgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.65rem;
}

.brand-controls label,
.layout-controls label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.builder-preview-panel {
  position: sticky;
  top: 84px;
  align-self: start;
  margin-top: 0;
  flex: 1 1 420px;
  display: flex;
  align-items: stretch;
}

.builder-preview-frame {
  width: min(900px, 100%);
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(7, 15, 28, 0.6);
  box-shadow: var(--shadow-soft);
  padding: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.builder-preview-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
}

.builder-preview-switch {
  display: inline-flex;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.25rem;
}

.preview-mode-btn {
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.82rem;
  padding: 0.42rem 0.75rem;
  cursor: pointer;
}

.preview-mode-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--white);
}

.builder-preview-actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.builder-preview-actions .switch-field.compact {
  margin: 0;
  padding: 0.45rem 0.65rem;
  min-height: 0;
  background: rgba(255, 255, 255, 0.04);
}

.builder-preview-surface {
  display: none;
}

.builder-preview-surface.active {
  display: block;
}

.builder-pdf-stage {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  background: #d9dde8;
  padding: 0.7rem;
  min-height: 720px;
}

.builder-pdf-stage iframe {
  width: 100%;
  min-height: 680px;
  border: 0;
  border-radius: 10px;
  background: #fff;
}

.builder-preview-panel .template-preview {
  width: min(840px, 100%);
  margin: 0 auto 0;
}

.builder-field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.6rem;
}

.builder-field-grid input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--white);
  padding: 0.55rem 0.75rem;
}



.settings-tabs {
  display: inline-flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  background: var(--surface);
  padding: 0.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.settings-tab {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
}

.settings-tab.active {
  background: var(--primary);
  color: var(--white);
  box-shadow: var(--shadow-sm);
}

.settings-section {
  display: none;
}

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

.profile-card {
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.02);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.access-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.access-row {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.02);
}

.access-row--disabled {
  opacity: 0.6;
}

.access-select {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.access-select input {
  width: 1rem;
  height: 1rem;
}

.access-modules {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.module-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  background: rgba(255, 255, 255, 0.02);
  font-size: 0.8rem;
}

.module-chip input {
  margin: 0;
  width: 0.85rem;
  height: 0.85rem;
}

.chip-toggle {
  border-style: dashed;
}

.role-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
  background: rgba(255, 255, 255, 0.08);
}

.role-chip.role-super_admin {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.15);
}

.role-chip.role-director {
  color: #34d399;
  background: rgba(52, 211, 153, 0.15);
}

.role-chip.role-staff {
  color: #60a5fa;
  background: rgba(96, 165, 250, 0.15);
}

.role-chip.role-engineer {
  color: #a78bfa;
  background: rgba(167, 139, 250, 0.15);
}

.role-chip.role-customer {
  color: #f472b6;
  background: rgba(244, 114, 182, 0.15);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  min-height: 32px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  font-weight: 600;
  font-size: 13px;
  color: var(--white);
}

.chip.compact {
  padding: 0.2rem 0.6rem;
  min-height: 26px;
  font-size: 12px;
  border-radius: 12px;
  gap: 4px;
}

.chip.paid {
  border-color: var(--success);
  color: var(--success);
}

.chip.sent {
  border-color: var(--primary);
  color: var(--primary);
}

.chip.draft {
  border-color: var(--info);
  color: var(--info);
}

.chip.overdue {
  border-color: var(--danger);
  color: var(--danger);
}

.chip.open { border-color: var(--info); color: var(--info); }
.chip.pending { border-color: var(--warning); color: var(--warning); }
.chip.in_progress { border-color: var(--primary); color: var(--primary); }
.chip.completed,
.chip.closed { border-color: var(--success); color: var(--success); }
.chip.critical { border-color: var(--danger); color: var(--danger); }
.chip.high { border-color: var(--warning); color: var(--warning); }
.chip.medium { border-color: var(--info); color: var(--info); }
.chip.low { border-color: var(--muted); color: var(--muted); }
.chip.sla-ok { border-color: var(--success); color: var(--success); }
.chip.sla-warning { border-color: var(--warning); color: var(--warning); }
.chip.sla-danger { border-color: var(--danger); color: var(--danger); }

[data-theme="light"] .chip {
  color: var(--white);
}

.chip:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

[data-theme="light"] .chip:hover {
  background: rgba(15, 23, 42, 0.1);
}

.chip:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(92, 124, 250, 0.25);
}

.template-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  align-items: stretch;
}

.template-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.75rem;
}

.template-styles h4 {
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
  color: var(--white);
}

.template-styles label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.template-styles input[type="color"] {
  width: 100%;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  cursor: pointer;
}

.template-header-options {
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
  background: rgba(15, 23, 42, 0.4);
}

.template-preview {
  --preview-primary: #081a3d;
  --preview-accent: #0a2249;
  --preview-header-height: 60px;
  --preview-border-radius: 0px;
  --preview-border-width: 1px;
}

.template-preview-card {
  border-radius: var(--radius-lg);
  border: var(--preview-border-width) solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.preview-page {
  background: radial-gradient(circle at 10% 20%, rgba(255, 255, 255, 0.05), transparent 40%),
    radial-gradient(circle at 80% 0%, rgba(255, 255, 255, 0.05), transparent 40%),
    #0c1427;
  padding: 1rem;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.preview-page-inner {
  background: #0e1526;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1rem;
}

.preview-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--preview-primary);
  color: white;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  min-height: var(--preview-header-height);
}

.preview-title-block {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.preview-layout-region {
  border: var(--preview-border-width) solid var(--border);
  border-radius: var(--preview-border-radius);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.02);
}

.preview-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  align-items: start;
}

.preview-meta .eyebrow {
  margin-bottom: 4px;
}

.preview-invoice-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.preview-invoice-meta .meta-chip {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: #e5e7eb;
}

.preview-invoice-meta .meta-chip.status {
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.4);
  color: #c7d2fe;
}

.preview-payment,
.preview-notes {
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.02);
}

.template-preview .preview-payment.is-hidden,
.template-preview .preview-notes.is-hidden {
  display: none;
}

.preview-payment div {
  font-size: 13px;
  color: #e5e7eb;
}

.preview-notes p {
  margin: 0.25rem 0 0;
}

.template-preview .preview-body {
  margin-top: 0.5rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.preview-line-items .line-items-header,
.preview-line-items .line-item-row {
  display: grid;
  grid-template-columns: 2fr 0.5fr 0.8fr 0.9fr;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.preview-line-items .line-items-header {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-weight: 600;
}

.preview-line-items .line-item-row {
  padding: 6px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
}

.preview-line-items .line-item-row:last-child {
  border-bottom: none;
}

.preview-summary {
  margin-top: 4px;
  display: grid;
  gap: 6px;
}

.preview-summary .summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.preview-status[data-badge="paid"] {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.preview-status[data-badge="overdue"] {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.preview-summary .summary-row.total strong {
  font-size: 15px;
}

.preview-column {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.preview-block {
  border: 1px dashed rgba(255, 255, 255, 0.3);
  border-radius: var(--radius);
  padding: 0.65rem 0.75rem;
  font-size: 0.8rem;
  color: var(--muted);
  background: rgba(15, 23, 42, 0.45);
  min-height: 48px;
}

.preview-logo.align-center {
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

.preview-logo.align-right {
  margin-left: auto;
  text-align: right;
}

.preview-block strong {
  display: block;
  color: white;
  font-size: 0.9rem;
}

.preview-block p {
  margin: 0.15rem 0;
}

.preview-block.muted {
  color: var(--muted);
  font-style: italic;
}

.template-layout-builder {
  margin-top: 2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  background: rgba(255, 255, 255, 0.02);
  box-shadow: var(--shadow);
}

.builder-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.builder-columns {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.builder-column {
  flex: 1;
  min-width: 240px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  background: var(--surface);
}

.template-layout-builder.builder-disabled {
  opacity: 0.4;
  pointer-events: none;
}

.builder-column-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.builder-dropzone {
  min-height: 160px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.builder-dropzone.drag-over {
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  background: rgba(99, 102, 241, 0.12);
}

.builder-block {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: grab;
}

.builder-block i {
  color: var(--muted);
}

.builder-block.dragging {
  opacity: 0.4;
}

.builder-block .block-title {
  font-weight: 600;
  font-size: 0.9rem;
}

.builder-block .block-hint {
  font-size: 0.75rem;
  color: var(--muted);
}

.template-preview.layout-disabled .preview-layout-region {
  opacity: 0.4;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  background: var(--preview-primary);
  color: white;
  padding: 1rem;
  border-radius: var(--radius);
}

.preview-header[data-number-align="left"] {
  justify-content: flex-start;
}

.preview-header[data-number-align="center"] {
  justify-content: center;
}

.preview-title-block {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  text-align: left;
}

.preview-title-block[data-align="center"] {
  text-align: center;
  align-items: center;
}

.preview-title-block[data-align="right"] {
  text-align: right;
  align-items: flex-end;
}

.preview-label {
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.preview-status {
  background: rgba(255, 255, 255, 0.15);
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
}

.preview-amount {
  font-size: 1.3rem;
  font-weight: 700;
}

.preview-status-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
  margin-left: auto;
}

.preview-status-stack[data-align="left"] {
  align-items: flex-start;
  text-align: left;
  margin-left: 0;
  margin-right: auto;
}

.preview-status-stack[data-align="center"] {
  align-items: center;
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}

.preview-number {
  font-size: 0.95rem;
  font-weight: 600;
}

.template-note {
  margin-top: -0.25rem;
}

.preview-body .preview-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.preview-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0.5rem 0;
}

.preview-list li {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 0.35rem;
}

.preview-footer {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--border);
  padding-top: 0.5rem;
}

.template-preview-card strong {
  color: var(--preview-accent);
}

.user-table td:first-child {
  width: 60px;
}

.user-table td,
.user-table th {
  vertical-align: middle;
  white-space: nowrap;
}

.user-table th,
.user-table td {
  padding: 0.62rem 0.72rem;
}

.user-table .table-actions {
  gap: 0.3rem;
}

.user-table .table-actions .ghost-btn.small {
  padding: 0.24rem 0.58rem;
  font-size: 0.73rem;
}

.user-company-summary {
  display: inline-block;
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.user-management-actions {
  justify-content: flex-end;
  gap: 0.55rem;
}

.user-management-actions .compact-search {
  width: min(260px, 100%);
}

.user-management-actions .compact-select {
  min-height: 40px;
  border-radius: 999px;
  min-width: 150px;
  padding: 0.45rem 0.85rem;
}

#user-page-size {
  min-width: 118px;
}

.user-list-summary {
  margin: 0 0 0.6rem;
}

@media (max-width: 980px) {
  .user-management-actions {
    width: 100%;
    justify-content: stretch;
  }

  .user-management-actions .compact-search,
  .user-management-actions .compact-select,
  .user-management-actions .btn-primary {
    width: 100%;
    min-width: 0;
  }

  .user-company-summary {
    max-width: 170px;
  }
}

.line-items-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: rgba(255, 255, 255, 0.02);
}

.line-item-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.01);
}

.line-item-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.line-item-fields label {
  font-size: 0.8rem;
  color: var(--muted);
}

.line-item-fields input {
  width: 100%;
}
.drawer-form label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.drawer-form input,
.drawer-form select,
.drawer-form textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--white);
  padding: 0.6rem 0.75rem;
  font-size: 0.95rem;
}

.form-grid {
  display: grid;
  gap: 1rem;
}

.form-grid.two-col {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.form-actions {
  display: flex;
  justify-content: flex-end;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0;
}

.automation-log {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

#invoice-status-filter {
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--white);
}

.automation-entry {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
  align-items: flex-start;
}

.automation-entry span {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
}

.automation-entry strong {
  color: var(--white);
  font-size: 1rem;
}

.automation-entry .entry-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
}

.automation-entry .entry-actions button {
  font-size: 0.8rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius);
}

.pause-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.pause-entry {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
}

.pause-entry strong {
  display: block;
  font-size: 1rem;
  color: var(--white);
}

.pause-entry span {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1rem 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 1100;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.toast.show {
  opacity: 1;
}

.toast::before {
  content: '';
  width: 4px;
  height: 100%;
  background: var(--success);
  border-radius: 2px;
  position: absolute;
  left: 0;
  top: 0;
}

.token-popup {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  z-index: 1200;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 0.75rem 1rem;
  min-width: 260px;
}

.token-popup__message {
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.token-popup__value {
  display: block;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  word-break: break-all;
  margin-bottom: 0.5rem;
}

.token-popup__actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

[data-report-card="invoices"],
[data-report-card="customers"] {
  display: none;
}

.card.hidden {
  display: none !important;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .content-grid {
    grid-template-columns: 1fr;
  }
  
  .stats-deck {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
}

@media (max-width: 768px) {
  .mobile-header {
    display: flex;
    background: linear-gradient(120deg, rgba(99, 102, 241, 0.9), rgba(14, 165, 233, 0.9));
    color: #fff;
  }
  
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 90;
    transform: translateX(-100%);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .main-panel {
    padding: 1rem;
    margin-top: 64px;
  }

  .panel-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem 1.25rem;
  }

  .panel-header h1 {
    font-size: 1.5rem;
  }

  .card {
    margin-bottom: 1rem;
  }

  .helpdesk-filter-bar {
    overflow-x: auto;
    padding: 0.5rem 0;
    gap: 0.35rem;
    scrollbar-width: thin;
  }

  .ticket-card {
    padding: 0.75rem;
  }

  .ticket-meta span {
    display: inline-block;
    margin-right: 0.35rem;
  }

  .issue-detail-card {
    width: 100%;
    left: 0;
    transform: none;
    border-radius: var(--radius);
  }
  
  .panel-header {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }
  
  .header-actions {
    justify-content: flex-end;
  }
  
  .stats-deck {
    grid-template-columns: 1fr;
  }
  
  .quick-actions-grid {
    grid-template-columns: 1fr;
  }
  
  .automation-deck {
    grid-template-columns: 1fr;
  }
  
  .form-row {
    flex-direction: column;
  }
  
  .admin-tabs {
    flex-wrap: wrap;
  }
}

@media (max-width: 640px) {
  .card-actions {
    flex-direction: column;
    align-items: stretch;
  }
  
  .timeline-item {
    flex-direction: column;
  }
  
  .timeline-side {
    text-align: left;
    min-width: auto;
  }
  
  .search-box input {
    min-width: auto;
    width: 100%;
  }
  
  .filter-grid {
    flex-direction: column;
    align-items: stretch;
  }
  
  .filter-grid select {
    min-width: auto;
  }
}

/* Loading States */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--surface) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  border-radius: var(--radius);
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.status-badge.success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.status-badge.warning {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}

.status-badge.danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

.status-badge.info {
  background: rgba(6, 182, 212, 0.1);
  color: var(--info);
}
.ticket-stream .card-body {
  max-height: 70vh;
  overflow-y: auto;
}

.ticket-list {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.helpdesk-filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.helpdesk-filter-bar .compact-select {
  min-width: 140px;
}
.ticket-status-chip {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.ticket-view-btn {
  text-decoration: none;
}
.profile-form textarea,
.profile-form input {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--white);
  padding: 0.75rem;
}

.profile-form label span {
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.form-feedback {
  min-height: 1.25rem;
  font-size: 0.85rem;
  margin-top: 0.75rem;
  color: var(--muted);
}

.form-feedback.success {
  color: var(--success);
}

.form-feedback.error {
  color: var(--danger);
}

/* Customers redesign */
.panel[data-panel="customers"] .customer-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.7fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
  align-items: stretch;
}

.panel[data-panel="customers"] .customer-toolbar .stats-deck {
  margin: 0;
}

.panel[data-panel="customers"] .customer-filter-card {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.9), rgba(30, 41, 59, 0.7));
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: var(--shadow);
}

.panel[data-panel="customers"] .customer-filter-controls {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.panel[data-panel="customers"] .customer-filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.panel[data-panel="customers"] .search-box.large input {
  width: 100%;
  min-width: 0;
  padding: 0.65rem 0.85rem 0.65rem 2.5rem;
  border-radius: var(--radius-lg);
  background: rgba(11, 15, 25, 0.65);
  font-size: 0.95rem;
}

.panel[data-panel="customers"] .search-box.large i {
  color: var(--primary-light);
}

.panel[data-panel="helpdesk"] .search-box.large i {
  color: var(--primary-light);
}

.panel[data-panel="customers"] .customer-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  gap: 1.25rem;
  align-items: start;
}

.panel[data-panel="customers"] .customer-rail {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.panel[data-panel="customers"] .customer-directory-card {
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.65);
  box-shadow: var(--shadow);
}

.panel[data-panel="customers"] .customer-filter-rail {
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.65);
  box-shadow: var(--shadow);
}

.panel[data-panel="customers"] .customer-command-bar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(12, 16, 28, 0.85);
  box-shadow: 0 18px 32px rgba(15, 23, 42, 0.35);
  margin-bottom: 1rem;
}

.panel[data-panel="customers"] .customer-command-bar .command-main {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.panel[data-panel="customers"] .customer-command-bar .command-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.panel[data-panel="customers"] .customer-command-bar .command-meta {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.panel[data-panel="customers"] .customer-command-bar .search-box.large {
  flex: 1;
  min-width: 240px;
}

.panel[data-panel="customers"] .customer-command-bar .stats-deck.compact {
  flex: 1;
  min-width: 220px;
}

.panel[data-panel="customers"] .customer-mobile-toggle {
  display: none;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.panel[data-panel="customers"] .customer-directory-card .card-body {
  padding-top: 0.5rem;
}

.panel[data-panel="customers"] .customer-directory-card .data-table tbody {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.9rem;
}

.panel[data-panel="customers"] .customer-directory-card.compact .data-table tbody {
  gap: 0.6rem;
}

.panel[data-panel="customers"] .customer-directory-card .data-table tr {
  display: block;
  padding: 0;
  border: none;
  background: transparent;
  min-width: 0;
  width: 100%;
}

.panel[data-panel="customers"] .customer-directory-card .data-table td {
  display: block;
  padding: 0;
  border: none;
}

.panel[data-panel="customers"] .customer-card-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: linear-gradient(145deg, rgba(12, 16, 28, 0.9), rgba(30, 41, 59, 0.7));
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.28);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.panel[data-panel="customers"] .customer-directory-card.compact .customer-card-shell {
  padding: 0.75rem;
  gap: 0.6rem;
}

.panel[data-panel="customers"] .customer-card-shell::after {
  content: "";
  position: absolute;
  right: -10px;
  top: -10px;
  width: 90px;
  height: 90px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.35), transparent 70%);
  opacity: 0.7;
  pointer-events: none;
}

.panel[data-panel="customers"] .customer-card:hover .customer-card-shell {
  transform: translateY(-2px);
  border-color: rgba(94, 234, 212, 0.45);
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.38);
}

.panel[data-panel="customers"] .customer-card.active .customer-card-shell {
  border-color: rgba(96, 165, 250, 0.75);
  box-shadow: 0 18px 40px rgba(59, 130, 246, 0.2);
}

.panel[data-panel="customers"] .customer-card-header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
}

.panel[data-panel="customers"] .customer-card-identity {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.panel[data-panel="customers"] .customer-card-text {
  min-width: 0;
}

.panel[data-panel="customers"] .customer-card-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--white);
}

.panel[data-panel="customers"] .customer-card-contact {
  font-size: 0.85rem;
  color: var(--muted);
}

.panel[data-panel="customers"] .customer-card-activity {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--muted);
  text-align: right;
}

.panel[data-panel="customers"] .customer-card-id {
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
  font-size: 0.7rem;
  color: var(--white);
}

.panel[data-panel="customers"] .customer-card-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  padding: 0.6rem;
  border-radius: var(--radius);
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(8, 13, 24, 0.55);
}

.panel[data-panel="customers"] .customer-card-metric {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.panel[data-panel="customers"] .customer-card-metric span {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.panel[data-panel="customers"] .customer-card-metric strong {
  font-size: 1rem;
}

.panel[data-panel="customers"] .customer-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.panel[data-panel="customers"] .customer-card-footer .btn-secondary.small {
  min-width: 96px;
}

.panel[data-panel="customers"] .customer-card-avatar {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.85), rgba(16, 185, 129, 0.7));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.panel[data-panel="customers"] .customer-detail-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.panel[data-panel="customers"] .customer-hero-card {
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 64, 175, 0.12));
  box-shadow: 0 22px 48px rgba(15, 23, 42, 0.35);
}

.panel[data-panel="customers"] .customer-hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.panel[data-panel="customers"] .customer-identity {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

.panel[data-panel="customers"] .customer-identity-text h2 {
  font-size: 1.45rem;
  margin-bottom: 0.25rem;
}

.panel[data-panel="customers"] .customer-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.panel[data-panel="customers"] .customer-hero-meta .meta-pill {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.panel[data-panel="customers"] .customer-hero-badges {
  margin-top: 0.5rem;
}

.panel[data-panel="customers"] .customer-hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}

.panel[data-panel="customers"] .customer-hero-metrics .metric-chip {
  background: rgba(11, 15, 25, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.panel[data-panel="customers"] .detail-tabs {
  background: rgba(11, 15, 25, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.2);
  padding: 0.4rem;
  border-radius: var(--radius-lg);
  flex-wrap: wrap;
  position: sticky;
  top: 0.5rem;
  z-index: 6;
  backdrop-filter: blur(10px);
}

.panel[data-panel="customers"] .customer-detail-panel.has-action-bar .detail-tabs {
  top: 3.6rem;
}

.panel[data-panel="customers"] .detail-tab {
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 0.45rem 0.9rem;
}

.panel[data-panel="customers"] .detail-tab.active {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.9), rgba(16, 185, 129, 0.9));
  color: #fff;
  box-shadow: 0 10px 24px rgba(16, 185, 129, 0.3);
}

.panel[data-panel="customers"] .detail-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.25);
}

.panel[data-panel="customers"].simple-mode .customer-views-bar,
.panel[data-panel="customers"].simple-mode .customer-segments {
  display: none;
}

.panel[data-panel="customers"].simple-mode .detail-tab.advanced-tab {
  display: none;
}

.panel[data-panel="customers"] .view-disclosure,
.panel[data-panel="customers"] .filter-disclosure {
  margin-top: 0.75rem;
  border-radius: var(--radius);
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.55);
  padding: 0.6rem 0.75rem;
}

.panel[data-panel="customers"] .view-disclosure summary,
.panel[data-panel="customers"] .filter-disclosure summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--muted);
  list-style: none;
}

.panel[data-panel="customers"] .view-disclosure summary::-webkit-details-marker,
.panel[data-panel="customers"] .filter-disclosure summary::-webkit-details-marker {
  display: none;
}

.panel[data-panel="customers"] .view-disclosure summary::after,
.panel[data-panel="customers"] .filter-disclosure summary::after {
  content: "▾";
  float: right;
  color: var(--muted);
}

.panel[data-panel="customers"] .view-disclosure[open] summary::after,
.panel[data-panel="customers"] .filter-disclosure[open] summary::after {
  content: "▴";
}

.panel[data-panel="customers"] .view-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  margin-top: 0.6rem;
}

.panel[data-panel="customers"] .basic-filters {
  margin-bottom: 0.6rem;
}

.form-disclosure {
  margin-top: 0.75rem;
  border-radius: var(--radius);
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.55);
  padding: 0.6rem 0.75rem;
}

.form-disclosure summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--muted);
  list-style: none;
}

.form-disclosure summary::-webkit-details-marker {
  display: none;
}

.form-disclosure summary::after {
  content: "▾";
  float: right;
  color: var(--muted);
}

.form-disclosure[open] summary::after {
  content: "▴";
}

[data-theme="light"] .form-disclosure {
  background: #ffffff;
  border-color: #e2e8f0;
}

[data-theme="light"] .panel[data-panel="customers"] .view-disclosure,
[data-theme="light"] .panel[data-panel="customers"] .filter-disclosure {
  background: #ffffff;
  border-color: #e2e8f0;
}

.panel[data-panel="customers"] .customer-result-count {
  margin-top: 0.35rem;
}

.panel[data-panel="customers"].compact .customer-layout {
  gap: 0.85rem;
}

.panel[data-panel="customers"].compact .customer-rail {
  gap: 0.85rem;
}

.panel[data-panel="customers"].compact .card-header {
  padding: 1rem 1rem 0.65rem;
}

.panel[data-panel="customers"].compact .card-body {
  padding: 0 1rem 1rem;
}

.panel[data-panel="customers"].compact .customer-summary-card {
  gap: 1rem;
}

.panel[data-panel="customers"].compact .customer-hero-top {
  gap: 0.5rem;
}

.panel[data-panel="customers"].compact .customer-hero-metrics .metric-chip {
  padding: 0.7rem 0.8rem;
}

.panel[data-panel="customers"].compact .detail-grid {
  gap: 0.75rem;
  margin: 1rem 0;
}

.panel[data-panel="customers"].compact .detail-card {
  padding: 0.9rem;
}

.panel[data-panel="customers"].compact .detail-tabs {
  gap: 0.35rem;
  padding: 0.3rem;
}

.panel[data-panel="customers"].compact .detail-tab {
  padding: 0.35rem 0.7rem;
  font-size: 0.85rem;
}

.panel[data-panel="customers"] .detail-card select {
  width: 100%;
  margin-top: 0.35rem;
  background: rgba(11, 15, 25, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.2);
  color: var(--white);
  border-radius: var(--radius);
  padding: 0.45rem 0.6rem;
}

.panel[data-panel="customers"] .quick-log-card {
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(11, 15, 25, 0.7);
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.25);
}

.panel[data-panel="customers"] .quick-log-card .card-header {
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.panel[data-panel="customers"] .history-card .card-header {
  padding-top: 1.5rem;
}

.panel[data-panel="customers"] .timeline-item {
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.6);
}

.panel[data-panel="customers"] .timeline-item.ticket {
  border-left: 3px solid rgba(56, 189, 248, 0.7);
}

.panel[data-panel="customers"] .timeline-item.invoice {
  border-left: 3px solid rgba(251, 191, 36, 0.7);
}

.panel[data-panel="customers"] .timeline-item.note,
.panel[data-panel="customers"] .timeline-item.conversation {
  border-left: 3px solid rgba(16, 185, 129, 0.7);
}

.panel[data-panel="customers"] .timeline-item.visit {
  border-left: 3px solid rgba(124, 58, 237, 0.65);
}

.panel[data-panel="customers"] .visit-entry,
.panel[data-panel="customers"] .appointment-item {
  background: rgba(11, 15, 25, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.panel[data-panel="customers"] .conversation-entry {
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

[data-theme="light"] .panel[data-panel="customers"] .customer-filter-card,
[data-theme="light"] .panel[data-panel="customers"] .customer-directory-card,
[data-theme="light"] .panel[data-panel="customers"] .customer-filter-rail,
[data-theme="light"] .panel[data-panel="customers"] .quick-log-card,
[data-theme="light"] .panel[data-panel="customers"] .detail-card {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .panel[data-panel="customers"] .customer-command-bar {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .panel[data-panel="customers"] .customer-card-shell {
  background: linear-gradient(145deg, #ffffff, #f8fafc);
  border-color: #e2e8f0;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .panel[data-panel="customers"] .customer-card-shell::after {
  opacity: 0.25;
}

[data-theme="light"] .panel[data-panel="customers"] .search-box.large input {
  background: #f8fafc;
  border-color: #e2e8f0;
}

[data-theme="light"] .panel[data-panel="customers"] .customer-card-id {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #0f172a;
}

[data-theme="light"] .panel[data-panel="customers"] .customer-directory-card.list-view .data-table tr.customer-card.active td {
  background: rgba(59, 130, 246, 0.12);
}

[data-theme="light"] .panel[data-panel="customers"] .customer-card-metrics {
  background: #f8fafc;
  border-color: #e2e8f0;
}

[data-theme="light"] .panel[data-panel="customers"] .customer-hero-card {
  background: linear-gradient(135deg, #ffffff, rgba(59, 130, 246, 0.08));
  border-color: #e2e8f0;
}

[data-theme="light"] .panel[data-panel="customers"] .customer-hero-meta .meta-pill {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #475569;
}

[data-theme="light"] .customer-action-bar {
  background: #ffffff;
  border-color: #e2e8f0;
}

[data-theme="light"] .customer-action-bar .action-menu {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 18px 30px rgba(15, 23, 42, 0.15);
}

[data-theme="light"] .panel[data-panel="customers"] .detail-tabs {
  background: #f8fafc;
  border-color: #e2e8f0;
}

[data-theme="light"] .panel[data-panel="customers"] .detail-card select {
  background: #ffffff;
  border-color: #e2e8f0;
  color: #0f172a;
}

[data-theme="light"] .attachment-preview-card {
  background: #ffffff;
  border-color: #e2e8f0;
  color: #475569;
}

[data-theme="light"] .attachment-file {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #475569;
}

[data-theme="light"] .timeline-search {
  background: #ffffff;
  border-color: #e2e8f0;
}

[data-theme="light"] .timeline-search input {
  color: #0f172a;
}

[data-theme="light"] .customer-alert {
  background: #fee2e2;
  border-color: #fecaca;
}

[data-theme="light"] .panel[data-panel="customers"] .timeline-item,
[data-theme="light"] .panel[data-panel="customers"] .visit-entry,
[data-theme="light"] .panel[data-panel="customers"] .appointment-item {
  background: #f8fafc;
  border-color: #e2e8f0;
}

@media (min-width: 1101px) {
  .panel[data-panel="customers"] .customer-detail-panel {
    position: sticky;
    top: 1.25rem;
    align-self: start;
    max-height: calc(100vh - 2.5rem);
    overflow: auto;
  }
}

@media (max-width: 1100px) {
  .panel[data-panel="customers"] .customer-toolbar {
    grid-template-columns: 1fr;
  }
  .panel[data-panel="customers"] .customer-layout {
    grid-template-columns: 1fr;
  }
  .panel[data-panel="customers"] .customer-card-metrics {
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  }
  .panel[data-panel="customers"] .customer-hero-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 768px) {
  .panel[data-panel="customers"] .customer-card-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .panel[data-panel="customers"] .customer-card-activity {
    align-items: flex-start;
    text-align: left;
  }
  .panel[data-panel="customers"] .customer-card-footer {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Global search */
.global-search {
  position: relative;
  flex: 1;
  max-width: 520px;
  min-width: 220px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.global-search input {
  width: 100%;
  padding: 0.6rem 2.5rem 0.6rem 2.5rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(11, 15, 25, 0.7);
  color: var(--white);
  font-size: 0.95rem;
}

.global-search i {
  position: absolute;
  left: 0.85rem;
  color: var(--primary-light);
}

.global-search .btn-icon {
  position: absolute;
  right: 0.5rem;
  opacity: 0.6;
}

.global-search .btn-icon:hover {
  opacity: 1;
}

#global-search-clear {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.6);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

#global-search-clear:hover {
  background: rgba(59, 130, 246, 0.18);
  border-color: rgba(59, 130, 246, 0.5);
  transform: translateY(-1px);
}

#global-search-clear i {
  color: var(--white);
  font-size: 0.9rem;
}

.global-search-results {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  right: 0;
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 40px rgba(15, 23, 42, 0.35);
  z-index: 30;
  padding: 0.65rem;
  max-height: 420px;
  overflow-y: auto;
}

.global-search-results .result-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
}

.global-search-results .result-group:last-child {
  margin-bottom: 0;
}

.global-search-results .result-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.global-search-results .result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  width: 100%;
  text-align: left;
}

.global-search-results .result-item:hover,
.global-search-results .result-item.active {
  border-color: rgba(59, 130, 246, 0.5);
  background: rgba(59, 130, 246, 0.12);
}

.global-search-results .result-meta {
  font-size: 0.78rem;
  color: var(--muted);
}

[data-theme="light"] .global-search input {
  background: #ffffff;
  border-color: #e2e8f0;
  color: #0f172a;
}

[data-theme="light"] .global-search-results {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 24px 40px rgba(15, 23, 42, 0.1);
}

[data-theme="light"] .global-search-results .result-item {
  background: #f8fafc;
}

[data-theme="light"] #global-search-clear,
[data-theme="light"] #issue-detail-close {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
}

[data-theme="light"] #global-search-clear:hover,
[data-theme="light"] #issue-detail-close:hover {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.35);
}

[data-theme="light"] #global-search-clear i,
[data-theme="light"] #issue-detail-close i {
  color: #0f172a;
}

[data-theme="light"] .customer-filter-rail select {
  background: #ffffff;
  border-color: #e2e8f0;
  color: #0f172a;
}

[data-theme="light"] .customer-filter-rail input {
  background: #ffffff;
  border-color: #e2e8f0;
  color: #0f172a;
}

/* Customer views + segments */
.customer-views-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.customer-view-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

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

.customer-directory-actions .btn-secondary.small {
  white-space: nowrap;
}

.customer-segments {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.segment-chip {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  padding: 0.35rem 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.88rem;
  transition: all 0.2s ease;
}

.segment-chip.active,
.segment-chip:hover {
  color: var(--white);
  border-color: rgba(59, 130, 246, 0.6);
  background: rgba(59, 130, 246, 0.15);
}

.customer-filter-rail .form-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.customer-filter-rail select {
  background: rgba(11, 15, 25, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.2);
  color: var(--white);
  border-radius: var(--radius);
  padding: 0.5rem 0.6rem;
}

.customer-filter-rail input {
  background: rgba(11, 15, 25, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.2);
  color: var(--white);
  border-radius: var(--radius);
  padding: 0.5rem 0.6rem;
}

.view-toggle {
  display: inline-flex;
  gap: 0.4rem;
  background: rgba(11, 15, 25, 0.5);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 999px;
  padding: 0.2rem;
}

.view-toggle .btn-secondary.small {
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
}

.view-toggle .btn-secondary.small.active {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.5);
  color: var(--white);
}

/* Customer table view */
.panel[data-panel="customers"] .customer-directory-card.list-view .data-table tbody {
  display: table-row-group;
}

.panel[data-panel="customers"] .customer-directory-card.list-view .data-table tr {
  display: table-row;
  background: transparent;
  border: none;
  padding: 0;
  gap: 0;
}

.panel[data-panel="customers"] .customer-directory-card.list-view .data-table tbody tr {
  cursor: pointer;
}

.panel[data-panel="customers"] .customer-directory-card.list-view .data-table tr.customer-list-head {
  cursor: default;
}

.panel[data-panel="customers"] .customer-directory-card.list-view .data-table td,
.panel[data-panel="customers"] .customer-directory-card.list-view .data-table th {
  display: table-cell;
  padding: 0.75rem 0.6rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  text-align: left;
  vertical-align: middle;
}

.panel[data-panel="customers"] .customer-directory-card.list-view .data-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: rgba(11, 15, 25, 0.5);
  white-space: nowrap;
}

.panel[data-panel="customers"] .customer-directory-card.list-view .data-table th i {
  margin-right: 0.3em;
  font-size: 0.68rem;
  opacity: 0.6;
}

.panel[data-panel="customers"] .customer-directory-card.list-view .data-table tr:hover td {
  background: rgba(59, 130, 246, 0.06);
  transition: background 0.15s ease;
}

.panel[data-panel="customers"] .customer-directory-card.list-view .data-table tr.customer-card.active td {
  background: rgba(59, 130, 246, 0.13);
  border-bottom-color: rgba(92, 124, 250, 0.25);
}

.panel[data-panel="customers"] .customer-directory-card.list-view.compact td,
.panel[data-panel="customers"] .customer-directory-card.list-view.compact th {
  padding: 0.45rem 0.55rem;
}

.customer-list-name {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.customer-list-meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.health-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  border: 1px solid transparent;
}

.health-badge i {
  font-size: 0.7rem;
}

.health-badge.great {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.4);
}

.health-badge.watch {
  background: rgba(251, 191, 36, 0.15);
  color: #fcd34d;
  border-color: rgba(251, 191, 36, 0.4);
}

.health-badge.risk {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.4);
}

.customer-action-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(11, 15, 25, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: var(--radius-lg);
  padding: 0.6rem 0.75rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  backdrop-filter: blur(10px);
}

.customer-action-bar .action-disclosure {
  position: relative;
}

.customer-action-bar .action-disclosure summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.customer-action-bar .action-disclosure summary::-webkit-details-marker {
  display: none;
}

.customer-action-bar .action-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 180px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: var(--radius);
  box-shadow: 0 18px 30px rgba(15, 23, 42, 0.4);
  padding: 0.5rem;
  display: none;
  flex-direction: column;
  gap: 0.4rem;
  z-index: 15;
}

.customer-action-bar .action-menu .btn-secondary.small {
  width: 100%;
  justify-content: flex-start;
}

.customer-action-bar .action-disclosure[open] .action-menu {
  display: flex;
}

.panel[data-panel="customers"] .customer-hero-actions .action-disclosure {
  position: relative;
}

.panel[data-panel="customers"] .customer-hero-actions .action-disclosure summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.panel[data-panel="customers"] .customer-hero-actions .action-disclosure summary::-webkit-details-marker {
  display: none;
}

.panel[data-panel="customers"] .customer-hero-actions .action-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 180px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: var(--radius);
  box-shadow: 0 18px 30px rgba(15, 23, 42, 0.4);
  padding: 0.5rem;
  display: none;
  flex-direction: column;
  gap: 0.4rem;
  z-index: 12;
}

.panel[data-panel="customers"] .customer-hero-actions .action-disclosure[open] .action-menu {
  display: flex;
}

[data-theme="light"] .panel[data-panel="customers"] .customer-hero-actions .action-menu {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 18px 30px rgba(15, 23, 42, 0.15);
}
.customer-completeness {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.customer-completeness-bar {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.2);
  overflow: hidden;
}

.customer-completeness-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #22c55e);
}

.customer-alert {
  border: 1px solid rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.08);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.customer-alert strong {
  color: #fecaca;
}

.customer-tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

.customer-tag {
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.35);
  font-size: 0.75rem;
}

.customer-tag button {
  background: none;
  border: none;
  color: inherit;
  margin-left: 0.35rem;
  cursor: pointer;
}

.customer-tag-input {
  border: 1px dashed rgba(148, 163, 184, 0.35);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  background: transparent;
  color: var(--muted);
  font-size: 0.75rem;
  min-width: 120px;
}

.attachment-preview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 0.5rem;
  margin-top: 0.45rem;
}

.attachment-preview-card {
  border-radius: var(--radius);
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.5);
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: center;
  text-align: center;
  font-size: 0.7rem;
  color: var(--muted);
}

.attachment-preview-card img {
  width: 100%;
  height: 70px;
  object-fit: cover;
  border-radius: var(--radius);
}

.attachment-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.attachment-thumb {
  width: 88px;
  height: 68px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.6);
  display: inline-flex;
}

.attachment-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attachment-file {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: var(--muted);
  font-size: 0.75rem;
  text-decoration: none;
  background: rgba(15, 23, 42, 0.45);
}

.attachment-file i {
  font-size: 0.7rem;
}

.customer-focus {
  outline: 2px solid rgba(59, 130, 246, 0.6);
  outline-offset: 2px;
}

.timeline-filters {
  gap: 0.35rem;
  flex-wrap: wrap;
}

.timeline-search {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.45);
  max-width: 240px;
}

.timeline-search input {
  background: transparent;
  border: none;
  color: var(--white);
  width: 100%;
  font-size: 0.8rem;
}

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

.timeline-search i {
  color: var(--muted);
  font-size: 0.8rem;
}

.empty-state {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
  padding: 1.5rem;
  text-align: center;
}

.customer-tags-label {
  margin-top: 0.75rem;
}

@media (max-width: 768px) {
  .global-search {
    width: 100%;
    max-width: none;
  }
  .customer-action-bar {
    position: static;
  }
}

@media (max-width: 900px) {
  .panel[data-panel="customers"] .customer-mobile-toggle {
    display: flex;
  }
  .panel[data-panel="customers"] .customer-layout {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }
  .panel[data-panel="customers"] .customer-detail-panel {
    position: static;
    max-height: none;
    overflow: visible;
  }
  .panel[data-panel="customers"]:not(.show-detail) .customer-detail-panel {
    display: none;
  }
  .panel[data-panel="customers"].show-detail .customer-rail {
    display: none;
  }
  .panel[data-panel="customers"].show-detail .customer-detail-panel {
    display: flex;
  }
  .panel[data-panel="customers"] .customer-command-bar .command-main {
    flex-direction: column;
    align-items: stretch;
  }
  .panel[data-panel="customers"] .customer-command-bar .command-actions {
    justify-content: flex-start;
  }
  .panel[data-panel="customers"] .customer-command-bar .command-meta {
    flex-direction: column;
    align-items: stretch;
  }
  .panel[data-panel="helpdesk"] .helpdesk-command-bar .command-main {
    flex-direction: column;
    align-items: stretch;
  }
  .panel[data-panel="helpdesk"] .helpdesk-command-bar .command-actions {
    justify-content: flex-start;
  }
  .panel[data-panel="helpdesk"] .helpdesk-command-bar .command-meta {
    flex-direction: column;
    align-items: stretch;
  }
  .panel[data-panel="helpdesk"] .helpdesk-views-panel {
    flex-direction: column;
    align-items: stretch;
  }
  .panel[data-panel="helpdesk"] .helpdesk-action-dropdown .helpdesk-filter-bar,
  .panel[data-panel="helpdesk"] .helpdesk-action-dropdown .helpdesk-views-panel {
    position: static;
    min-width: 100%;
    box-shadow: none;
  }
  .panel[data-panel="helpdesk"] .helpdesk-command-bar .command-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .panel[data-panel="helpdesk"] .helpdesk-view-toggle {
    width: 100%;
    justify-content: space-between;
  }
  .panel[data-panel="helpdesk"] .helpdesk-view-toggle .btn-secondary.small {
    flex: 1;
    justify-content: center;
  }
  .panel[data-panel="helpdesk"] .ticket-stream .card-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .panel[data-panel="helpdesk"] .ticket-toolbar .toolbar-right {
    width: 100%;
    text-align: left;
  }
  .panel[data-panel="helpdesk"] .kanban-wrapper {
    overflow-x: hidden;
  }
  .panel[data-panel="helpdesk"] .kanban-board {
    grid-auto-flow: row;
    grid-auto-columns: 1fr;
    overflow-x: hidden;
  }
  .panel[data-panel="helpdesk"] .ticket-list {
    width: 100%;
  }
  .panel[data-panel="helpdesk"] .ticket-card {
    width: 100%;
  }
  .panel[data-panel="helpdesk"] .ticket-meta {
    flex-wrap: wrap;
  }
  .panel[data-panel="helpdesk"] .issue-triage-bar {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Force ticket wallpaper onto all ticket sections */
.ticket-wallpaper .issue-detail-head.sticky,
.ticket-wallpaper .issue-triage-bar,
.ticket-wallpaper .issue-detail-description,
.ticket-wallpaper .issue-context,
.ticket-wallpaper .detail-tabs,
.ticket-wallpaper .detail-pane,
.ticket-wallpaper .issue-comments,
.ticket-wallpaper .issue-timeline-header,
.ticket-wallpaper .comment-form,
.ticket-wallpaper .issue-detail-status-row {
  background-image:
    linear-gradient(140deg, var(--ticket-surface), var(--ticket-surface-strong)),
    var(--ticket-wallpaper);
  background-blend-mode: overlay;
  background-repeat: no-repeat;
  background-size: cover;
}

[data-theme="light"] .ticket-wallpaper .issue-detail-head.sticky,
[data-theme="light"] .ticket-wallpaper .issue-triage-bar,
[data-theme="light"] .ticket-wallpaper .issue-detail-description,
[data-theme="light"] .ticket-wallpaper .issue-context,
[data-theme="light"] .ticket-wallpaper .detail-tabs,
[data-theme="light"] .ticket-wallpaper .detail-pane,
[data-theme="light"] .ticket-wallpaper .issue-comments,
[data-theme="light"] .ticket-wallpaper .issue-timeline-header,
[data-theme="light"] .ticket-wallpaper .comment-form,
[data-theme="light"] .ticket-wallpaper .issue-detail-status-row {
  background-blend-mode: soft-light;
}

/* Helpdesk full-canvas list + dashboard */
.helpdesk-dashboard {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr);
  gap: 0.85rem;
  margin: 0.35rem 0 1rem;
}

.helpdesk-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.65rem;
}

.kpi-card.chart {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.65rem;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(12, 18, 32, 0.45);
  color: var(--white);
  text-align: left;
  min-height: 64px;
  box-shadow: 0 12px 22px rgba(8, 10, 18, 0.22);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.kpi-card.chart:hover {
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.45);
}

.kpi-card.chart.static {
  cursor: default;
}

.kpi-bar {
  width: 56px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(99, 132, 255, 0.25), rgba(143, 178, 255, 0.08));
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.35);
  position: relative;
  overflow: hidden;
}

.kpi-bar::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: var(--kpi-fill, 40%);
  background: linear-gradient(180deg, rgba(120, 164, 255, 0.9), rgba(176, 200, 255, 0.4));
}

.kpi-label {
  font-size: 0.66rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.kpi-value {
  font-size: 0.95rem;
  font-weight: 700;
}

.helpdesk-trends {
  display: grid;
  gap: 0.55rem;
}

.trend-card {
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: linear-gradient(145deg, rgba(14, 20, 34, 0.9), rgba(9, 13, 24, 0.95));
  padding: 0.75rem;
  box-shadow: 0 12px 22px rgba(8, 10, 18, 0.28);
}

.trend-bars {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.35rem;
  align-items: end;
  margin-top: 0.5rem;
}

.trend-bar {
  display: grid;
  align-items: end;
  gap: 0.25rem;
  justify-items: center;
  color: var(--muted);
}

.trend-bar::before {
  content: "";
  display: block;
  width: 100%;
  height: var(--trend-height, 18px);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.8), rgba(59, 130, 246, 0.2));
}

.trend-bar span {
  font-size: 0.7rem;
  color: var(--white);
}

.trend-bar em {
  font-style: normal;
  font-size: 0.7rem;
  color: var(--muted);
}

.trend-value {
  font-size: 1.35rem;
  font-weight: 700;
  margin-top: 0.25rem;
}

.ticket-card-wrap {
  display: grid;
  gap: 0.6rem;
}

.ticket-card {
  align-items: flex-start;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  gap: 0.9rem;
  background: linear-gradient(135deg, rgba(17, 24, 39, 0.94), rgba(10, 14, 25, 0.96));
}

.ticket-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.ticket-pill {
  padding: 0.12rem 0.45rem;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(15, 23, 42, 0.35);
}

.ticket-expand {
  margin-left: auto;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.4);
}

body.helpdesk-reporter-mode .ticket-expand,
body.helpdesk-reporter-mode .ticket-inline-slot {
  display: none;
}

body.helpdesk-reporter-mode .wallpaper-picker,
body.helpdesk-reporter-mode .mentions-helper {
  display: none;
}

body.helpdesk-reporter-mode .detail-tab-btn[data-detail-tab="details"],
body.helpdesk-reporter-mode .detail-pane[data-detail-pane="details"] {
  display: none !important;
}

.ticket-card.active-detail .ticket-expand {
  transform: rotate(180deg);
  border-color: rgba(99, 102, 241, 0.45);
  color: var(--white);
}

.ticket-inline-slot {
  display: block;
}

.ticket-inline-slot .issue-detail-card {
  margin-top: 0.5rem;
}

.ticket-detail-shelf {
  display: none;
}

@media (min-width: 1101px) {
  #helpdesk-panel.split-view .helpdesk-grid {
    grid-template-columns: minmax(520px, 1fr) minmax(420px, 520px);
    align-items: start;
  }

  #helpdesk-panel.split-view .ticket-detail-shelf {
    display: block;
  }

  #helpdesk-panel.split-view .ticket-inline-slot,
  #helpdesk-panel.split-view .ticket-expand {
    display: none;
  }

  #helpdesk-panel.split-view .issue-detail-card.inline {
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 6rem);
    overflow: hidden;
  }

  #helpdesk-panel.split-view .issue-detail-card.inline #issue-detail-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
  }
}

.tickets-column {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tickets-column .ticket-toolbar {
  margin-bottom: 0;
  padding: 0.6rem 0.8rem;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(12, 16, 28, 0.45);
}

[data-theme="light"] .tickets-column .ticket-toolbar {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(203, 213, 225, 0.7);
}

.issue-detail-card.inline {
  display: flex;
  flex-direction: column;
  position: static;
  width: 100%;
  max-height: none;
  transform: none;
  margin: 0;
  box-shadow: 0 18px 40px rgba(10, 12, 20, 0.4);
  height: auto;
}

.issue-detail-card.inline #issue-detail-body {
  max-height: none;
}

@media (max-width: 1100px) {
  .helpdesk-dashboard {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 960px) {
  .issue-detail-card.inline {
    position: static;
    width: 100%;
    max-height: none;
    transform: none;
  }

  .issue-detail-card.modal-open:not(.inline) {
    inset: 0;
    top: 0;
    left: 0;
    transform: none;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
    padding:
      calc(env(safe-area-inset-top, 0px) + 0.9rem)
      0.9rem
      calc(env(safe-area-inset-bottom, 0px) + 0.9rem);
  }
}

@media (max-width: 640px) {
  .ticket-toolbar:not(.has-selection) .toolbar-left > button,
  .ticket-toolbar:not(.has-selection) .toolbar-left > .inline-field {
    display: none;
  }

  .issue-detail-card.modal-open:not(.inline) {
    inset: 0;
    top: 0;
    left: 0;
    transform: none;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
    padding:
      calc(env(safe-area-inset-top, 0px) + 0.9rem)
      0.9rem
      calc(env(safe-area-inset-bottom, 0px) + 0.9rem);
  }

  #issue-detail-close {
    width: 44px;
    height: 44px;
  }

  .issue-detail-card.modal-open #issue-comments {
    padding-bottom: 9.5rem;
  }

  .issue-detail-card.modal-open .comment-form {
    position: sticky;
    bottom: 0;
    padding-top: 0.75rem;
    margin-top: 0.5rem;
    border-top: 1px solid rgba(148, 163, 184, 0.25);
  }

  .detail-tabs {
    display: flex;
    width: 100%;
    flex-wrap: wrap;
  }

  .detail-tab-btn {
    flex: 1 1 auto;
    text-align: center;
  }
}

[data-theme="light"] .kpi-card,
[data-theme="light"] .trend-card {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(203, 213, 225, 0.8);
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.08);
  color: var(--text);
}

[data-theme="light"] .kpi-bar {
  background: linear-gradient(180deg, rgba(120, 164, 255, 0.15), rgba(187, 207, 255, 0.08));
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.35);
}

[data-theme="light"] .kpi-label,
[data-theme="light"] .trend-bar em {
  color: rgba(71, 85, 105, 0.7);
}

[data-theme="light"] .ticket-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(241, 245, 249, 0.98));
  border-color: rgba(203, 213, 225, 0.8);
}

[data-theme="light"] .ticket-pill {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(203, 213, 225, 0.6);
  color: rgba(51, 65, 85, 0.9);
}

[data-theme="light"] .ticket-expand {
  background: rgba(255, 255, 255, 0.8);
  border-color: rgba(203, 213, 225, 0.8);
  color: rgba(71, 85, 105, 0.8);
}

/* Ticket wallpaper: final consistency + adaptive text */
.ticket-wallpaper {
  --ticket-text: #f8fafc;
  --ticket-muted: rgba(226, 232, 240, 0.78);
  --ticket-field-border: rgba(148, 163, 184, 0.35);
  color: var(--ticket-text);
}

[data-theme="light"] .ticket-wallpaper {
  --ticket-text: #0f172a;
  --ticket-muted: rgba(71, 85, 105, 0.8);
  --ticket-field-border: rgba(148, 163, 184, 0.35);
}

.ticket-wallpaper .muted,
.ticket-wallpaper .ticket-subtitle,
.ticket-wallpaper .ticket-meta,
.ticket-wallpaper .ticket-people,
.ticket-wallpaper .issue-detail-meta,
.ticket-wallpaper .issue-detail-description p,
.ticket-wallpaper .issue-context p,
.ticket-wallpaper .issue-timeline-header p,
.ticket-wallpaper .timeline-item .meta,
.ticket-wallpaper .comment-entry .meta {
  color: var(--ticket-muted) !important;
}

.ticket-wallpaper .detail-tab-btn {
  color: var(--ticket-muted) !important;
}

.ticket-wallpaper .detail-tab-btn.active {
  color: var(--ticket-text) !important;
}

.ticket-wallpaper input,
.ticket-wallpaper select,
.ticket-wallpaper textarea,
.ticket-wallpaper .comment-form textarea,
.ticket-wallpaper .comment-form input[type="file"],
.ticket-wallpaper .timeline-list,
.ticket-wallpaper .timeline-item,
.ticket-wallpaper .comment-entry,
.ticket-wallpaper .detail-section,
.ticket-wallpaper #issue-view-status-wrapper select,
.ticket-wallpaper .health-item,
.ticket-wallpaper .attachment-card {
  background-image:
    linear-gradient(140deg, var(--ticket-surface), var(--ticket-surface-strong)),
    var(--ticket-wallpaper) !important;
  background-blend-mode: overlay !important;
  background-color: transparent !important;
  background-repeat: no-repeat !important;
  background-size: cover !important;
  border-color: var(--ticket-field-border) !important;
  color: var(--ticket-text) !important;
}

[data-theme="light"] .ticket-wallpaper input,
[data-theme="light"] .ticket-wallpaper select,
[data-theme="light"] .ticket-wallpaper textarea,
[data-theme="light"] .ticket-wallpaper .comment-form textarea,
[data-theme="light"] .ticket-wallpaper .comment-form input[type="file"],
[data-theme="light"] .ticket-wallpaper .timeline-list,
[data-theme="light"] .ticket-wallpaper .timeline-item,
[data-theme="light"] .ticket-wallpaper .comment-entry,
[data-theme="light"] .ticket-wallpaper .detail-section,
[data-theme="light"] .ticket-wallpaper #issue-view-status-wrapper select,
[data-theme="light"] .ticket-wallpaper .health-item,
[data-theme="light"] .ticket-wallpaper .attachment-card {
  background-blend-mode: soft-light !important;
}

.ticket-wallpaper input::placeholder,
.ticket-wallpaper textarea::placeholder {
  color: var(--ticket-muted) !important;
}

/* OnlineServices 2026 refresh */
:root {
  --primary: #f26a3d;
  --primary-dark: #d85224;
  --primary-light: #ffb07f;
  --secondary: #9aa6b2;
  --success: #27c59a;
  --warning: #f2aa3d;
  --danger: #ef5f67;
  --info: #4eb8ff;

  --bg: #131517;
  --surface: #181c20;
  --card: #1d2228;
  --muted: #99a6b5;
  --border: rgba(255, 248, 235, 0.09);
  --white: #f7f1e5;

  --font-family: "Space Grotesk", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;

  --shadow-sm: 0 8px 20px rgba(0, 0, 0, 0.14);
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.22);
  --shadow-lg: 0 28px 70px rgba(0, 0, 0, 0.28);
}

[data-theme="light"] {
  --primary: #d95d2f;
  --primary-dark: #b94b22;
  --primary-light: #f0a46b;
  --secondary: #596677;
  --success: #0f9b72;
  --warning: #d88920;
  --danger: #da4f57;
  --info: #2d7fcf;

  --bg: #f4ecdf;
  --surface: #fff9f0;
  --card: #ffffff;
  --muted: #667381;
  --border: rgba(27, 31, 38, 0.1);
  --white: #171a1f;

  --shadow-sm: 0 8px 18px rgba(34, 24, 12, 0.08);
  --shadow: 0 20px 42px rgba(34, 24, 12, 0.1);
  --shadow-lg: 0 30px 60px rgba(34, 24, 12, 0.14);
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(242, 106, 61, 0.2), transparent 26%),
    radial-gradient(circle at 85% 12%, rgba(78, 184, 255, 0.12), transparent 22%),
    linear-gradient(180deg, #121416 0%, #171b1f 38%, #131517 100%);
  color: var(--white);
}

body::before {
  background:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    radial-gradient(circle at 20% 20%, rgba(242, 106, 61, 0.12), transparent 0 30%),
    radial-gradient(circle at 80% 0%, rgba(78, 184, 255, 0.08), transparent 0 26%);
  background-size: 36px 36px, 36px 36px, auto, auto;
  opacity: 1;
}

[data-theme="light"] body {
  background:
    radial-gradient(circle at top left, rgba(217, 93, 47, 0.12), transparent 24%),
    radial-gradient(circle at 85% 10%, rgba(45, 127, 207, 0.08), transparent 22%),
    linear-gradient(180deg, #f5efe5 0%, #f0e7d8 100%);
}

[data-theme="light"] body::before {
  background:
    linear-gradient(rgba(23, 26, 31, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 26, 31, 0.04) 1px, transparent 1px),
    radial-gradient(circle at 20% 20%, rgba(217, 93, 47, 0.08), transparent 0 28%),
    radial-gradient(circle at 80% 0%, rgba(45, 127, 207, 0.06), transparent 0 24%);
  background-size: 36px 36px, 36px 36px, auto, auto;
}

.eyebrow,
.workspace-kicker,
.toolbar-kicker,
.auth-kicker,
.auth-stage-label,
.signal-pill span,
.hero-pill span,
.workspace-mini-card .eyebrow,
.brand-subtitle,
.mobile-brand-page {
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-screen {
  min-height: 100vh;
  padding: clamp(20px, 3vw, 40px);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-shell {
  width: min(460px, 100%);
  display: flex;
  justify-content: center;
  align-items: center;
}

.auth-card {
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(22px);
}

.auth-stage {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
  min-height: 720px;
  padding: clamp(28px, 4vw, 52px);
  border-radius: 36px;
  background:
    radial-gradient(circle at 0% 0%, rgba(242, 106, 61, 0.22), transparent 32%),
    radial-gradient(circle at 100% 0%, rgba(78, 184, 255, 0.16), transparent 26%),
    linear-gradient(145deg, rgba(24, 28, 32, 0.92), rgba(17, 20, 24, 0.98));
}

[data-theme="light"] .auth-stage {
  background:
    radial-gradient(circle at 0% 0%, rgba(217, 93, 47, 0.12), transparent 30%),
    radial-gradient(circle at 100% 0%, rgba(45, 127, 207, 0.08), transparent 24%),
    linear-gradient(145deg, rgba(255, 251, 244, 0.92), rgba(247, 239, 225, 0.98));
}

.auth-stage::after {
  content: "";
  position: absolute;
  right: -120px;
  bottom: -120px;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(242, 106, 61, 0.2), transparent 68%);
  pointer-events: none;
}

.auth-stage-copy {
  position: relative;
  z-index: 1;
  max-width: 720px;
}

.auth-stage-copy h1 {
  font-size: clamp(2.5rem, 5.2vw, 4.8rem);
  line-height: 0.96;
  letter-spacing: -0.05em;
  margin-bottom: 18px;
}

.auth-stage-copy p {
  max-width: 58ch;
  color: color-mix(in srgb, var(--white) 80%, var(--muted));
  font-size: 1.05rem;
}

.auth-kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  margin-bottom: 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
}

[data-theme="light"] .auth-kicker {
  background: rgba(23, 26, 31, 0.05);
  color: #3b4652;
}

.auth-stage-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.auth-stage-card {
  min-height: 180px;
  padding: 22px 20px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
}

[data-theme="light"] .auth-stage-card {
  border-color: rgba(23, 26, 31, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 251, 244, 0.75));
}

.auth-stage-card strong {
  display: block;
  font-size: 1.05rem;
  line-height: 1.25;
  margin-bottom: 10px;
}

.auth-stage-card p {
  color: var(--muted);
  font-size: 0.94rem;
}

.auth-stage-label {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--primary-light);
  font-size: 0.74rem;
}

[data-theme="light"] .auth-stage-label {
  color: var(--primary-dark);
}

.auth-signal-strip {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.signal-pill {
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(8, 10, 12, 0.26);
}

[data-theme="light"] .signal-pill {
  border-color: rgba(23, 26, 31, 0.08);
  background: rgba(255, 255, 255, 0.76);
}

.signal-pill span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.72rem;
}

.signal-pill strong {
  font-size: 0.95rem;
}

.auth-card {
  align-self: center;
  width: 100%;
  max-width: 460px;
  border-radius: 32px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(26, 30, 35, 0.96), rgba(19, 22, 27, 0.96));
}

[data-theme="light"] .auth-card {
  background: linear-gradient(180deg, rgba(255, 253, 248, 0.97), rgba(252, 247, 239, 0.96));
}

.auth-header {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 28px 30px 10px;
  background: transparent;
  text-align: left;
}

.auth-brand-mark,
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--primary) 0%, #ff925e 100%);
  color: #fff8ef;
  font-weight: 700;
  letter-spacing: 0.08em;
  box-shadow: 0 18px 30px rgba(242, 106, 61, 0.28);
}

.auth-header h2 {
  margin: 0;
  font-size: 1.9rem;
  letter-spacing: -0.04em;
}

.auth-body {
  padding: 12px 30px 30px;
}

.auth-subtitle {
  margin-bottom: 24px;
  color: var(--muted);
}

.input-group {
  gap: 12px;
  min-height: 60px;
  padding-inline: 18px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
}

[data-theme="light"] .input-group {
  background: rgba(23, 26, 31, 0.025);
}

.input-group input {
  background: transparent;
  color: var(--white);
}

.input-group input::placeholder {
  color: color-mix(in srgb, var(--muted) 88%, transparent);
}

.btn-primary,
.btn-secondary,
.btn-danger,
.quick-action,
.ghost-btn {
  border-radius: 16px;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background 180ms ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff9f2;
  box-shadow: 0 18px 30px rgba(242, 106, 61, 0.25);
}

.btn-primary:hover,
.btn-secondary:hover,
.btn-danger:hover,
.quick-action:hover,
.ghost-btn:hover,
.nav-btn:hover {
  transform: translateY(-1px);
}

.btn-secondary,
.ghost-btn {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--white);
}

[data-theme="light"] .btn-secondary,
[data-theme="light"] .ghost-btn {
  background: rgba(23, 26, 31, 0.03);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #ff8b82);
  color: #fff8f8;
}

.auth-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.link-btn {
  color: var(--white);
  opacity: 0.82;
}

.app-shell {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  min-height: 100vh;
}

.mobile-header {
  display: none;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  width: auto;
  padding: 22px 18px;
  border-right: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(15, 17, 19, 0.96), rgba(23, 27, 31, 0.94)),
    radial-gradient(circle at top, rgba(242, 106, 61, 0.1), transparent 28%);
}

[data-theme="light"] .sidebar {
  background:
    linear-gradient(180deg, rgba(255, 251, 243, 0.98), rgba(247, 239, 225, 0.95)),
    radial-gradient(circle at top, rgba(217, 93, 47, 0.06), transparent 28%);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.03));
}

[data-theme="light"] .sidebar-brand {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 249, 240, 0.88));
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 0.7rem;
}

.sidebar-nav {
  padding: 24px 0;
  gap: 10px;
}

.nav-btn {
  position: relative;
  justify-content: flex-start;
  gap: 14px;
  min-height: 54px;
  padding: 0 16px;
  border-radius: 18px;
  border: 1px solid transparent;
  background: transparent;
  color: color-mix(in srgb, var(--white) 88%, var(--muted));
}

.nav-btn i {
  width: 18px;
}

.nav-btn.active {
  border-color: rgba(242, 106, 61, 0.28);
  background: linear-gradient(135deg, rgba(242, 106, 61, 0.16), rgba(255, 176, 127, 0.07));
  color: var(--white);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.16);
}

[data-theme="light"] .nav-btn.active {
  background: linear-gradient(135deg, rgba(217, 93, 47, 0.12), rgba(240, 164, 107, 0.06));
}

.sidebar-footer {
  display: grid;
  gap: 16px;
  margin-top: auto;
}

.workspace-mini-card,
.user-chip {
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
}

[data-theme="light"] .workspace-mini-card,
[data-theme="light"] .user-chip {
  background: rgba(255, 255, 255, 0.74);
}

.workspace-mini-card strong {
  display: block;
  margin: 6px 0 4px;
  font-size: 0.96rem;
}

.user-chip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
}

.user-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

#current-user-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#current-user-email,
#current-user-role {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.main-panel {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: clamp(20px, 2.4vw, 34px);
  background: transparent;
}

.workspace-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.95fr);
  gap: 20px;
  align-items: end;
  padding: clamp(24px, 3vw, 34px);
  border-radius: 30px;
  border: 1px solid var(--border);
  background:
    radial-gradient(circle at top right, rgba(78, 184, 255, 0.16), transparent 24%),
    radial-gradient(circle at 0% 0%, rgba(242, 106, 61, 0.18), transparent 28%),
    linear-gradient(140deg, rgba(23, 27, 31, 0.98), rgba(20, 23, 27, 0.92));
  box-shadow: var(--shadow);
}

[data-theme="light"] .workspace-hero {
  background:
    radial-gradient(circle at top right, rgba(45, 127, 207, 0.08), transparent 24%),
    radial-gradient(circle at 0% 0%, rgba(217, 93, 47, 0.1), transparent 28%),
    linear-gradient(140deg, rgba(255, 252, 246, 0.98), rgba(251, 246, 237, 0.94));
}

.workspace-hero::after {
  content: "";
  position: absolute;
  right: -110px;
  bottom: -140px;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(242, 106, 61, 0.16), transparent 68%);
  pointer-events: none;
}

.workspace-hero-copy {
  position: relative;
  z-index: 1;
}

.workspace-kicker {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  margin-bottom: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--white);
  font-size: 0.72rem;
}

[data-theme="light"] .workspace-kicker {
  background: rgba(23, 26, 31, 0.05);
  color: #3b4652;
}

.workspace-hero h1 {
  font-size: clamp(2.2rem, 4vw, 3.8rem);
  line-height: 0.95;
  letter-spacing: -0.06em;
  margin: 0 0 12px;
}

.workspace-hero p {
  max-width: 60ch;
}

.workspace-hero-meta {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.hero-pill {
  min-height: 112px;
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

[data-theme="light"] .hero-pill {
  background: rgba(255, 255, 255, 0.72);
}

.hero-pill span {
  color: var(--muted);
  font-size: 0.68rem;
}

.hero-pill strong {
  font-size: 1rem;
  line-height: 1.25;
}

#workspace-role-chip[data-role="super_admin"] {
  color: #ffd39c;
}

#workspace-role-chip[data-role="engineer"] {
  color: #8fd5ff;
}

#workspace-role-chip[data-role="customer"] {
  color: #98e7c1;
}

.main-toolbar {
  position: sticky;
  top: 18px;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 18px;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: rgba(24, 28, 32, 0.82);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-sm);
}

[data-theme="light"] .main-toolbar {
  background: rgba(255, 250, 243, 0.86);
}

.toolbar-copy {
  min-width: 190px;
}

.toolbar-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.72rem;
}

.global-search {
  min-height: 58px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
}

[data-theme="light"] .global-search {
  background: rgba(23, 26, 31, 0.03);
}

.global-search input {
  font-size: 0.98rem;
}

.panel {
  animation: panel-reveal 240ms ease;
}

@keyframes panel-reveal {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel-header,
.card,
.customer-command-bar,
.helpdesk-command-bar,
.customer-views-bar,
.customer-segments,
.customer-mobile-toggle,
.automation-deck .card,
.report-card,
.drawer,
.issue-detail-card,
.kanban-wrapper,
.helpdesk-hero {
  border-color: var(--border);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(27, 31, 36, 0.96), rgba(21, 24, 28, 0.94));
  box-shadow: var(--shadow-sm);
}

[data-theme="light"] .panel-header,
[data-theme="light"] .card,
[data-theme="light"] .customer-command-bar,
[data-theme="light"] .helpdesk-command-bar,
[data-theme="light"] .customer-views-bar,
[data-theme="light"] .customer-segments,
[data-theme="light"] .customer-mobile-toggle,
[data-theme="light"] .automation-deck .card,
[data-theme="light"] .report-card,
[data-theme="light"] .drawer,
[data-theme="light"] .issue-detail-card,
[data-theme="light"] .kanban-wrapper,
[data-theme="light"] .helpdesk-hero {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(251, 246, 237, 0.92));
}

.panel[data-panel="dashboard"] > .stats-deck,
.stats-deck.compact,
.stats-deck {
  gap: 16px;
}

.stat-card {
  position: relative;
  overflow: hidden;
  min-height: 154px;
  padding: 22px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  box-shadow: 0 22px 38px rgba(0, 0, 0, 0.16);
}

[data-theme="light"] .stat-card {
  border-color: rgba(23, 26, 31, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(249, 244, 235, 0.92));
}

.stat-card::after {
  content: "";
  position: absolute;
  inset: auto -30px -52px auto;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.08), transparent 70%);
}

.stat-card .stat-icon {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
}

.stat-card h3 {
  font-size: clamp(1.9rem, 2.6vw, 2.6rem);
  line-height: 1;
  letter-spacing: -0.05em;
}

.card-header,
.card-body {
  position: relative;
  z-index: 1;
}

.content-grid {
  gap: 18px;
}

.quick-actions-grid {
  gap: 14px;
}

.quick-action {
  min-height: 126px;
  padding: 18px;
  align-items: flex-start;
  text-align: left;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
}

[data-theme="light"] .quick-action {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(249, 244, 235, 0.88));
}

.quick-action i {
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: rgba(242, 106, 61, 0.16);
  color: var(--primary-light);
}

.customer-layout,
.invoices-layout,
.reports-grid {
  gap: 18px;
}

.customer-layout {
  grid-template-columns: minmax(320px, 1fr) minmax(0, 1.45fr);
}

.customer-detail-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.search-box.large,
.inline-field,
.compact-select,
select,
input[type="text"],
input[type="search"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="month"],
input[type="number"],
textarea {
  border-radius: 16px;
  border-color: var(--border);
}

input,
select,
textarea {
  background: rgba(255, 255, 255, 0.04);
  color: var(--white);
}

[data-theme="light"] input,
[data-theme="light"] select,
[data-theme="light"] textarea {
  background: rgba(23, 26, 31, 0.03);
  color: var(--white);
}

::placeholder {
  color: color-mix(in srgb, var(--muted) 86%, transparent);
}

.table-container,
.data-table,
.timeline-list,
.report-summary,
.filter-chips,
.saved-views,
.customer-segments,
.automation-log-list {
  color: inherit;
}

.toast {
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(21, 24, 28, 0.94);
  backdrop-filter: blur(12px);
  color: #f8fafc;
}

[data-theme="light"] .toast {
  background: rgba(255, 251, 244, 0.94);
  color: #0f172a;
}

body.marketing-mode .toast {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(148, 163, 184, 0.42);
  color: #0f172a;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.2);
}

body.marketing-mode .toast::before {
  background: #0f766e;
}

@media (max-width: 1200px) {
  .workspace-hero {
    grid-template-columns: 1fr;
  }

  .workspace-hero-meta,
  .auth-stage-grid,
  .auth-signal-strip {
    grid-template-columns: 1fr;
  }
}

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

  .mobile-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: rgba(24, 28, 32, 0.9);
    backdrop-filter: blur(18px);
  }

  [data-theme="light"] .mobile-header {
    background: rgba(255, 250, 243, 0.92);
  }

  .mobile-brand {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .mobile-brand-name {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .mobile-brand-page {
    font-size: 0.72rem;
    color: var(--muted);
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 20;
    width: min(88vw, 320px);
    height: 100vh;
    transform: translateX(-108%);
    transition: transform 220ms ease;
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-panel {
    padding-top: 16px;
  }

  .main-toolbar {
    top: 72px;
    flex-wrap: wrap;
  }

  .toolbar-copy {
    min-width: 0;
    width: 100%;
  }

  .global-search {
    width: 100%;
  }

  .customer-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .auth-screen {
    padding: 14px;
  }

  .auth-card,
  .workspace-hero,
  .main-toolbar,
  .card,
  .customer-command-bar,
  .helpdesk-command-bar {
    border-radius: 24px;
  }

  .auth-header,
  .auth-body,
  .workspace-hero,
  .main-toolbar,
  .sidebar-brand,
  .workspace-mini-card,
  .user-chip {
    padding-left: 18px;
    padding-right: 18px;
  }

  .workspace-hero h1 {
    font-size: 2.05rem;
  }

  .hero-pill,
  .signal-pill,
  .auth-stage-card {
    min-height: unset;
  }

  .btn-primary,
  .btn-secondary,
  .btn-danger {
    min-height: 48px;
  }
}

/* OnlineServices layout tuning */
.app-shell {
  grid-template-columns: 276px minmax(0, 1fr);
}

.sidebar {
  padding: 20px 16px;
}

.sidebar-brand {
  padding: 16px;
}

.brand-title {
  font-size: 1.02rem;
}

.sidebar-nav {
  padding: 20px 0;
  gap: 8px;
}

.nav-btn {
  min-height: 50px;
  font-size: 0.98rem;
}

.workspace-mini-card strong {
  font-size: 0.9rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.workspace-hero {
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.9fr);
  gap: 16px;
  padding: clamp(20px, 2.2vw, 28px);
}

.workspace-hero h1 {
  font-size: clamp(1.95rem, 3vw, 3.2rem);
  margin-bottom: 10px;
}

.workspace-hero p {
  max-width: 52ch;
  font-size: 1rem;
}

.workspace-hero-meta {
  min-width: 0;
  gap: 10px;
}

.hero-pill {
  min-width: 0;
  min-height: 98px;
  padding: 14px 15px;
  gap: 8px;
  justify-content: flex-start;
}

.hero-pill span {
  font-size: 0.64rem;
}

.hero-pill strong {
  display: block;
  min-width: 0;
  font-size: 0.9rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
  word-break: break-word;
}

#workspace-role-chip {
  font-weight: 700;
}

[data-theme="light"] #workspace-role-chip[data-role="super_admin"] {
  color: #cf6427;
}

[data-theme="light"] #workspace-role-chip[data-role="engineer"] {
  color: #14638d;
}

[data-theme="light"] #workspace-role-chip[data-role="customer"] {
  color: #217354;
}

.main-panel {
  gap: 18px;
  padding: clamp(18px, 2vw, 28px);
}

.main-toolbar {
  gap: 12px;
  padding: 12px 16px;
}

.toolbar-copy {
  min-width: 168px;
  max-width: 260px;
}

.global-search {
  flex: 1 1 360px;
  min-height: 54px;
}

.global-search input {
  font-size: 0.95rem;
}

.panel[data-panel="helpdesk"] .panel-header {
  margin-bottom: 0.85rem;
  padding: 0.8rem 1rem;
}

.panel[data-panel="helpdesk"] .panel-header h1 {
  font-size: 1.45rem;
}

.panel[data-panel="helpdesk"] .panel-header p {
  font-size: 0.98rem;
}

.helpdesk-command-bar {
  gap: 0.85rem;
  padding: 1rem;
}

.helpdesk-command-bar .command-main {
  align-items: flex-start;
  gap: 0.85rem;
}

.helpdesk-command-bar .search-box.large {
  flex: 1 1 340px;
  min-width: min(100%, 340px);
}

.helpdesk-command-bar .command-actions {
  flex: 1 1 560px;
  gap: 0.55rem;
}

.helpdesk-command-bar .btn-primary,
.helpdesk-command-bar .btn-secondary.small,
.helpdesk-command-bar .compact-select,
.helpdesk-command-bar select {
  min-height: 44px;
  font-size: 0.94rem;
}

.ticket-toolbar {
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
}

.ticket-toolbar .toolbar-left {
  gap: 0.55rem;
}

.ticket-toolbar .toolbar-right {
  margin-left: auto;
  min-height: 40px;
}

.ticket-toolbar .btn-secondary,
.ticket-toolbar .btn-danger,
.ticket-toolbar .compact-select {
  min-height: 42px;
  font-size: 0.92rem;
}

.ticket-toolbar .select-all {
  min-height: 42px;
  padding: 0.4rem 0.75rem;
  font-size: 0.88rem;
}

@media (max-width: 1280px) {
  .helpdesk-command-bar .command-actions {
    flex-basis: 100%;
  }
}

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

  .workspace-hero {
    grid-template-columns: 1fr;
  }
}

/* OnlineServices interface upgrade */
.toolbar-kicker {
  white-space: nowrap;
}

.workspace-mini-card strong,
.workspace-hero-meta .hero-pill strong {
  overflow-wrap: anywhere;
}

.workspace-mini-card strong {
  font-size: 0.9rem;
  line-height: 1.45;
}

.workspace-mini-card .muted {
  line-height: 1.55;
}

.user-chip {
  padding: 14px 16px;
}

.user-info {
  gap: 1px;
}

#current-user-name {
  font-size: 0.98rem;
}

#current-user-email,
#current-user-role {
  font-size: 0.88rem;
}

.panel[data-panel="helpdesk"] > .panel-header,
.panel[data-panel="customers"] > .panel-header {
  display: none;
}

.panel[data-panel="invoices"] > .panel-header {
  margin-bottom: 0.9rem;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  justify-content: flex-end;
}

.panel[data-panel="invoices"] > .panel-header > div:first-child {
  display: none;
}

.panel[data-panel="invoices"] > .panel-header .header-actions {
  width: 100%;
  justify-content: flex-end;
  gap: 0.7rem;
}

.panel[data-panel="invoices"] > .panel-header .btn-primary,
.panel[data-panel="invoices"] > .panel-header .btn-secondary {
  min-height: 46px;
}

.empty-state {
  gap: 0.75rem;
  justify-content: center;
  min-height: 180px;
  padding: 2rem 1.4rem;
  border: 1px dashed rgba(148, 163, 184, 0.28);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.015));
}

[data-theme="light"] .empty-state {
  border-color: #d8e1eb;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 253, 0.94));
}

.empty-state strong {
  font-size: 1.08rem;
  letter-spacing: -0.02em;
}

.ticket-list > .empty-state {
  margin-top: 0.15rem;
}

.panel[data-panel="helpdesk"] .helpdesk-command-bar {
  padding: 1rem 1.1rem;
  gap: 0.8rem;
}

.panel[data-panel="helpdesk"] .helpdesk-command-bar .command-main {
  gap: 0.8rem;
}

.panel[data-panel="helpdesk"] .helpdesk-command-bar .search-box.large {
  min-width: 0;
}

.panel[data-panel="helpdesk"] .helpdesk-command-bar .command-actions > * {
  flex: 0 0 auto;
}

.panel[data-panel="helpdesk"] .helpdesk-action-dropdown summary {
  white-space: nowrap;
}

.panel[data-panel="helpdesk"] .helpdesk-command-bar .command-meta {
  padding-top: 0.1rem;
}

.panel[data-panel="helpdesk"] .filter-chip-row {
  margin-top: 0;
}

@media (min-width: 1180px) {
  .panel[data-panel="helpdesk"] .helpdesk-command-bar .command-main {
    display: grid;
    grid-template-columns: minmax(300px, 1fr) auto;
    align-items: start;
  }

  .panel[data-panel="helpdesk"] .helpdesk-command-bar .command-actions {
    justify-content: flex-end;
  }
}

.ticket-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 0.75rem 0.9rem;
}

.ticket-toolbar .toolbar-left {
  gap: 0.6rem;
}

.ticket-toolbar .inline-field {
  flex-wrap: nowrap;
}

.ticket-toolbar .inline-field select {
  min-width: 190px;
}

.ticket-toolbar .toolbar-right {
  justify-self: end;
  margin-left: 0;
}

.ticket-toolbar:not(.has-selection) .toolbar-left > button,
.ticket-toolbar:not(.has-selection) .toolbar-left > .inline-field {
  display: none;
}

.ticket-toolbar:not(.has-selection) {
  grid-template-columns: auto 1fr;
}

#helpdesk-selection-count {
  font-weight: 600;
}

@media (min-width: 1280px) {
  #helpdesk-panel.split-view .helpdesk-grid {
    grid-template-columns: minmax(520px, 1.02fr) minmax(520px, 0.98fr);
    gap: 1rem;
  }

  #helpdesk-panel.split-view .issue-detail-card.inline {
    top: 1rem;
    max-height: calc(100vh - 2rem);
  }
}

.issue-detail-card.inline {
  overflow: hidden;
  border-radius: 28px;
}

.issue-detail-card.inline .issue-detail-head.sticky {
  top: 0;
}

.issue-detail-card.inline .issue-detail-actions {
  align-items: center;
  gap: 0.55rem;
}

.issue-detail-card.inline .wallpaper-picker {
  align-items: flex-start;
}

.issue-detail-card.inline #issue-detail-close {
  width: 42px;
  height: 42px;
  min-height: 42px;
}

.issue-detail-card.inline .issue-detail-head {
  gap: 1rem;
}

.issue-detail-card.inline .ticket-subject {
  line-height: 1.08;
}

.issue-detail-card.inline .issue-triage-bar {
  padding: 0.9rem 1rem;
  gap: 0.75rem;
}

.issue-detail-card.inline .issue-triage-bar .triage-actions {
  margin-left: auto;
  justify-content: flex-end;
}

.issue-detail-card.inline .issue-triage-bar .btn-secondary,
.issue-detail-card.inline .issue-triage-bar .btn-danger {
  min-height: 42px;
  padding-inline: 0.95rem;
  white-space: nowrap;
}

[data-theme="light"] #helpdesk-panel.split-view .ticket-wallpaper::before {
  opacity: 0.12;
}

[data-theme="light"] #helpdesk-panel.split-view .ticket-wallpaper::after {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.5) 0%,
    rgba(248, 250, 253, 0.12) 38%,
    rgba(255, 255, 255, 0.42) 100%
  );
}

[data-theme="light"] #helpdesk-panel.split-view .ticket-wallpaper .issue-detail-head.sticky,
[data-theme="light"] #helpdesk-panel.split-view .ticket-wallpaper .issue-triage-bar,
[data-theme="light"] #helpdesk-panel.split-view .ticket-wallpaper .issue-detail-description,
[data-theme="light"] #helpdesk-panel.split-view .ticket-wallpaper .issue-context,
[data-theme="light"] #helpdesk-panel.split-view .ticket-wallpaper .detail-tabs,
[data-theme="light"] #helpdesk-panel.split-view .ticket-wallpaper .detail-pane,
[data-theme="light"] #helpdesk-panel.split-view .ticket-wallpaper .issue-comments,
[data-theme="light"] #helpdesk-panel.split-view .ticket-wallpaper .issue-timeline-header,
[data-theme="light"] #helpdesk-panel.split-view .ticket-wallpaper .comment-form,
[data-theme="light"] #helpdesk-panel.split-view .ticket-wallpaper .issue-detail-status-row {
  background-image:
    linear-gradient(140deg, rgba(255, 255, 255, 0.94), rgba(246, 248, 252, 0.96)),
    var(--ticket-wallpaper) !important;
  background-blend-mode: screen !important;
  border-color: rgba(148, 163, 184, 0.25);
}

[data-theme="light"] #helpdesk-panel.split-view .ticket-wallpaper .muted,
[data-theme="light"] #helpdesk-panel.split-view .ticket-wallpaper .ticket-subtitle,
[data-theme="light"] #helpdesk-panel.split-view .ticket-wallpaper .ticket-meta,
[data-theme="light"] #helpdesk-panel.split-view .ticket-wallpaper .ticket-people,
[data-theme="light"] #helpdesk-panel.split-view .ticket-wallpaper .issue-detail-meta,
[data-theme="light"] #helpdesk-panel.split-view .ticket-wallpaper .issue-detail-description p,
[data-theme="light"] #helpdesk-panel.split-view .ticket-wallpaper .issue-context p,
[data-theme="light"] #helpdesk-panel.split-view .ticket-wallpaper .issue-timeline-header p,
[data-theme="light"] #helpdesk-panel.split-view .ticket-wallpaper .timeline-item .meta,
[data-theme="light"] #helpdesk-panel.split-view .ticket-wallpaper .comment-entry .meta {
  color: rgba(71, 85, 105, 0.88) !important;
}

.issue-compose-drawer {
  width: min(720px, 96vw);
  max-height: 92vh;
  overflow-x: hidden;
  overflow-y: auto;
}

.issue-compose-drawer .drawer-header {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 1.25rem 1.35rem 1rem;
  background: linear-gradient(135deg, rgba(12, 23, 43, 0.98), rgba(27, 61, 108, 0.9));
  border-bottom-color: rgba(148, 163, 184, 0.18);
}

.issue-compose-drawer .drawer-header h3,
.issue-compose-drawer .drawer-header p {
  color: #eef4ff;
}

.issue-compose-form {
  gap: 1rem;
  padding: 1.2rem 1.35rem 1.35rem;
}

.issue-compose-grid {
  align-items: start;
}

.issue-compose-support {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

.issue-compose-urgent {
  min-height: 54px;
}

.issue-compose-actions {
  margin-top: 0.25rem;
}

.issue-compose-actions #issue-drawer-submit {
  min-width: 180px;
}

@media (min-width: 760px) {
  .issue-compose-support {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }

  .issue-compose-urgent {
    min-width: 270px;
    align-self: end;
  }
}

[data-theme="light"] .issue-compose-drawer {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.985), rgba(250, 245, 237, 0.96));
  border-color: #d8e1eb;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.25);
}

[data-theme="light"] .issue-compose-drawer .drawer-form label {
  color: #566579;
}

[data-theme="light"] .issue-compose-drawer .drawer-form input,
[data-theme="light"] .issue-compose-drawer .drawer-form select,
[data-theme="light"] .issue-compose-drawer .drawer-form textarea {
  background: #ffffff;
  border-color: #d8e1eb;
  color: #0f172a;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

[data-theme="light"] .issue-compose-drawer .drawer-form textarea {
  min-height: 168px;
}

[data-theme="light"] .issue-compose-drawer .drawer-form input[type="file"] {
  background: #f8fafc;
  border-color: #d8e1eb;
}

[data-theme="light"] .issue-compose-drawer .drawer-form .inline-checkbox {
  background: #f8fafc;
  border-color: #d8e1eb;
  color: #0f172a;
}

[data-theme="light"] .issue-compose-drawer .drawer-form .muted.small {
  color: #64748b;
}

.panel[data-panel="customers"] .customer-command-bar {
  padding: 1rem 1.1rem;
}

.panel[data-panel="customers"] .customer-layout {
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
}

.panel[data-panel="customers"] .customer-directory-card .data-table tbody {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.panel[data-panel="customers"] .customer-directory-card.list-view .table-container {
  overflow-x: auto;
}

.panel[data-panel="customers"] .customer-directory-card.list-view .data-table {
  width: 100%;
  min-width: 860px;
  table-layout: fixed;
}

@media (max-width: 900px) {
  .panel[data-panel="customers"] .customer-directory-card.list-view .table-container {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .panel[data-panel="customers"] .customer-directory-card.list-view .data-table {
    min-width: 860px;
  }

  .customer-directory-card .data-table tr {
    overflow: visible;
  }

  .panel[data-panel="customers"] .customer-directory-card.list-view .customer-list-meta strong,
  .panel[data-panel="customers"] .customer-directory-card.list-view .customer-list-meta .muted {
    overflow-wrap: normal;
    word-break: normal;
  }
}

.panel[data-panel="customers"] .customer-directory-card.list-view .data-table th:nth-child(1),
.panel[data-panel="customers"] .customer-directory-card.list-view .data-table td:nth-child(1) {
  width: 38%;
}

.panel[data-panel="customers"] .customer-directory-card.list-view .data-table th:nth-child(2),
.panel[data-panel="customers"] .customer-directory-card.list-view .data-table td:nth-child(2) {
  width: 13%;
}

.panel[data-panel="customers"] .customer-directory-card.list-view .data-table th:nth-child(3),
.panel[data-panel="customers"] .customer-directory-card.list-view .data-table td:nth-child(3),
.panel[data-panel="customers"] .customer-directory-card.list-view .data-table th:nth-child(4),
.panel[data-panel="customers"] .customer-directory-card.list-view .data-table td:nth-child(4) {
  width: 8%;
}

.panel[data-panel="customers"] .customer-directory-card.list-view .data-table th:nth-child(5),
.panel[data-panel="customers"] .customer-directory-card.list-view .data-table td:nth-child(5) {
  width: 12%;
}

.panel[data-panel="customers"] .customer-directory-card.list-view .data-table th:nth-child(6),
.panel[data-panel="customers"] .customer-directory-card.list-view .data-table td:nth-child(6) {
  width: 21%;
}

.panel[data-panel="customers"] .customer-list-meta {
  min-width: 0;
}

.panel[data-panel="customers"] .customer-list-meta strong,
.panel[data-panel="customers"] .customer-list-meta .muted {
  overflow-wrap: break-word;
  word-break: normal;
}

[data-theme="light"] .panel[data-panel="customers"] .customer-directory-card.list-view .data-table th {
  background: #f8fafc;
  color: #64748b;
}

.panel[data-panel="invoices"] #invoice-stats {
  margin-top: 0;
  margin-bottom: 1rem;
  gap: 1rem;
}

.panel[data-panel="invoices"] #invoice-stats .stat-card {
  min-height: 130px;
  padding: 1rem 1.1rem;
}

.panel[data-panel="invoices"] #invoice-stats .stat-card h3 {
  font-size: clamp(1.7rem, 2.1vw, 2.3rem);
}

.automation-deck {
  align-items: start;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.automation-deck .card {
  height: auto;
  min-height: 0;
}

#automation-pauses-card .card-body {
  min-height: 180px;
}

#automation-pauses-card .pause-list > p,
#automation-log > span.muted.small {
  display: flex;
  align-items: center;
  min-height: 132px;
  padding: 1rem 1.1rem;
  border: 1px dashed var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.02);
}

[data-theme="light"] #automation-pauses-card .pause-list > p,
[data-theme="light"] #automation-log > span.muted.small {
  background: #f8fafc;
  border-color: #d8e1eb;
}

.panel[data-panel="invoices"] .card-actions,
.panel[data-panel="invoices"] .table-toolbar,
.panel[data-panel="invoices"] .toolbar-actions {
  flex-wrap: wrap;
}

.panel[data-panel="invoices"] .toolbar-actions {
  margin-left: auto;
}

.panel[data-panel="invoices"] .card-actions {
  gap: 0.65rem;
}

.panel[data-panel="invoices"] .card-actions select {
  min-width: 160px;
}

@media (max-width: 1279px) {
  .ticket-toolbar {
    grid-template-columns: 1fr;
  }

  .ticket-toolbar .toolbar-right {
    justify-self: start;
  }
}

/* OnlineServices consistency and mobile pass */
:root {
  --os-shell-gap: clamp(14px, 1.8vw, 20px);
  --os-surface-padding: clamp(16px, 1.8vw, 22px);
}

.panel.active {
  display: grid;
  gap: var(--os-shell-gap);
  align-content: start;
}

.panel[data-panel="reports"] > .panel-header,
.panel[data-panel="admin"] > .panel-header {
  display: none;
}

.panel[data-panel="settings"] > .panel-header,
.panel[data-panel="invoices"] > .panel-header {
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  justify-content: flex-end;
}

.panel[data-panel="settings"] > .panel-header > div:first-child,
.panel[data-panel="invoices"] > .panel-header > div:first-child {
  display: none;
}

.panel[data-panel="settings"] > .panel-header .header-actions,
.panel[data-panel="invoices"] > .panel-header .header-actions {
  width: 100%;
  justify-content: flex-end;
}

.panel[data-panel="settings"] > .panel-header .btn-primary,
.panel[data-panel="invoices"] > .panel-header .btn-primary,
.panel[data-panel="invoices"] > .panel-header .btn-secondary {
  min-height: 46px;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.85rem 1rem;
  padding: var(--os-surface-padding) var(--os-surface-padding) 0;
}

.card-header h3 {
  margin: 0;
  font-size: clamp(1.15rem, 1.55vw, 1.65rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.card-header p {
  max-width: 60ch;
}

.card-body {
  padding: 1rem var(--os-surface-padding) var(--os-surface-padding);
}

.card .pagination-controls {
  padding: 0 var(--os-surface-padding) var(--os-surface-padding);
}

.reports-grid {
  max-width: none;
  margin: 0;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  align-items: start;
}

.panel[data-panel="reports"] .reports-grid > .card {
  height: 100%;
}

.admin-tabs,
.settings-tabs {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0;
  padding: 0.45rem;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
}

[data-theme="light"] .admin-tabs,
[data-theme="light"] .settings-tabs {
  background: rgba(255, 255, 255, 0.82);
}

.tab-btn,
.settings-tab {
  min-height: 44px;
  padding: 0.6rem 1rem;
  border: 1px solid transparent;
  border-radius: 16px;
}

.tab-btn.active,
.settings-tab.active {
  box-shadow: var(--shadow-sm);
}

.customer-views-bar {
  display: grid;
  gap: 0.8rem;
  padding: 0.95rem 1rem;
}

.saved-views,
.customer-view-actions,
.customer-segments {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.customer-segments {
  padding: 0.95rem 1rem;
}

.header-actions,
.card-actions,
.toolbar-actions,
.form-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.report-filters {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.report-filters.inline {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.compact-search {
  min-height: 44px;
}

.panel[data-panel="settings"] .settings-section.active {
  display: grid;
  gap: var(--os-shell-gap);
}

.panel[data-panel="settings"] .settings-main-grid,
.panel[data-panel="settings"] .settings-form-modern,
.panel[data-panel="settings"] .settings-column {
  gap: var(--os-shell-gap);
}

.panel[data-panel="settings"] .settings-panel,
.profile-card {
  border-radius: 24px;
}

.global-search-results {
  max-height: min(52vh, 420px);
  overflow: auto;
}

@media (max-width: 980px) {
  .mobile-header {
    padding: 12px 14px;
  }

  .mobile-brand {
    min-width: 0;
    flex: 1 1 auto;
  }

  .mobile-brand-name,
  .mobile-brand-page {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .main-panel {
    gap: 14px;
    padding: 12px 12px 24px;
  }

  .main-toolbar {
    position: static;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
  }

  .toolbar-copy {
    display: none;
  }

  .main-toolbar .header-actions {
    justify-self: end;
  }

  .global-search {
    order: 2;
    grid-column: 1 / -1;
    min-height: 52px;
  }

  .workspace-hero {
    padding: 1rem;
    gap: 0.9rem;
  }

  .workspace-hero-meta {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(170px, 1fr);
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.15rem;
    scrollbar-width: thin;
  }

  .workspace-hero-meta .hero-pill {
    min-height: 92px;
  }

  .panel[data-panel="customers"] .customer-command-bar,
  .panel[data-panel="helpdesk"] .helpdesk-command-bar {
    padding: 0.9rem;
  }

  .panel[data-panel="customers"] .customer-command-bar .command-main,
  .panel[data-panel="helpdesk"] .helpdesk-command-bar .command-main {
    display: grid;
    gap: 0.75rem;
  }

  .panel[data-panel="customers"] .customer-command-bar .search-box.large,
  .panel[data-panel="helpdesk"] .helpdesk-command-bar .search-box.large {
    width: 100%;
  }

  .panel[data-panel="customers"] .customer-command-bar .command-actions,
  .panel[data-panel="helpdesk"] .helpdesk-command-bar .command-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 0.65rem;
  }

  .panel[data-panel="customers"] .customer-command-bar .command-actions > *,
  .panel[data-panel="helpdesk"] .helpdesk-command-bar .command-actions > * {
    width: 100%;
    min-width: 0;
  }

  .panel[data-panel="helpdesk"] .helpdesk-action-dropdown,
  .panel[data-panel="customers"] .customer-command-bar .inline-field,
  .panel[data-panel="helpdesk"] .helpdesk-command-bar .inline-field {
    width: 100%;
  }

  .panel[data-panel="helpdesk"] .helpdesk-action-dropdown summary {
    width: 100%;
    justify-content: center;
  }

  .panel[data-panel="customers"] .customer-command-bar .inline-field select,
  .panel[data-panel="helpdesk"] .helpdesk-command-bar .inline-field select,
  .compact-search {
    width: 100%;
  }

  .customer-views-bar {
    padding: 0.85rem 0.95rem;
  }

  .customer-segments {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 0.35rem;
    scrollbar-width: thin;
  }

  .settings-tabs,
  .admin-tabs {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    overflow-x: auto;
    padding-bottom: 0.35rem;
    scrollbar-width: thin;
  }

  .table-toolbar {
    align-items: stretch;
  }

  .toolbar-actions,
  .card-actions {
    width: 100%;
  }

  .toolbar-actions > *,
  .card-actions > * {
    flex: 1 1 220px;
  }

  .report-filters,
  .report-filters.inline {
    grid-template-columns: 1fr;
  }

  .report-filters > button,
  .form-actions > button,
  .panel[data-panel="settings"] > .panel-header .header-actions > button {
    width: 100%;
    justify-content: center;
  }

  .panel[data-panel="reports"] .data-table,
  .panel[data-panel="invoices"] .data-table {
    min-width: 680px;
  }

  .panel[data-panel="admin"] [data-admin-section="events"] .data-table {
    min-width: 680px;
  }

  .panel[data-panel="admin"] [data-admin-section="users"] .table-container {
    overflow: visible;
  }

  .panel[data-panel="admin"] [data-admin-section="users"] .data-table {
    min-width: 0;
    width: 100%;
  }

  .panel[data-panel="admin"] [data-admin-section="users"] .data-table thead {
    display: none;
  }

  .panel[data-panel="admin"] [data-admin-section="users"] .data-table tbody {
    display: grid;
    gap: 0.7rem;
  }

  .panel[data-panel="admin"] [data-admin-section="users"] .data-table tbody tr {
    display: grid;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.04);
    padding: 0.45rem 0.65rem;
  }

  .panel[data-panel="admin"] [data-admin-section="users"] .data-table tbody tr.user-empty-row {
    display: table-row;
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 0;
  }

  .panel[data-panel="admin"] [data-admin-section="users"] .data-table td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.65rem;
    border-bottom: 1px dashed var(--border);
    padding: 0.42rem 0.2rem;
    white-space: normal;
  }

  .panel[data-panel="admin"] [data-admin-section="users"] .data-table td::before {
    content: attr(data-label);
    display: inline-block;
    min-width: 88px;
    flex: 0 0 88px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.68rem;
    line-height: 1.3;
  }

  .panel[data-panel="admin"] [data-admin-section="users"] .data-table td:last-child {
    border-bottom: 0;
    padding-bottom: 0.2rem;
  }

  .panel[data-panel="admin"] [data-admin-section="users"] .data-table td strong {
    word-break: break-word;
    overflow-wrap: anywhere;
    text-align: right;
  }

  .panel[data-panel="admin"] [data-admin-section="users"] .data-table td.table-actions {
    display: block;
  }

  .panel[data-panel="admin"] [data-admin-section="users"] .data-table td.table-actions::before {
    display: block;
    margin-bottom: 0.35rem;
    min-width: 0;
  }

  .panel[data-panel="admin"] [data-admin-section="users"] .data-table td.table-actions .ghost-btn,
  .panel[data-panel="admin"] [data-admin-section="users"] .data-table td.table-actions .chip {
    margin-right: 0.3rem;
    margin-bottom: 0.3rem;
  }

  .panel[data-panel="admin"] [data-admin-section="users"] .data-table tbody tr.user-empty-row td {
    display: table-cell;
    border-bottom: 0;
    padding: 0.8rem 0.2rem 0.2rem;
    white-space: normal;
  }

  .panel[data-panel="admin"] [data-admin-section="users"] .data-table tbody tr.user-empty-row td::before {
    display: none;
  }

  .panel[data-panel="settings"] .field-grid.two-column,
  .panel[data-panel="settings"] .builder-field-grid,
  .panel[data-panel="settings"] .builder-subgrid,
  .panel[data-panel="settings"] .template-controls {
    grid-template-columns: 1fr;
  }

  .panel[data-panel="settings"] .builder-toolbar,
  .panel[data-panel="settings"] .builder-toolbar--wide,
  .panel[data-panel="settings"] .builder-columns {
    grid-template-columns: 1fr;
  }

  .panel[data-panel="settings"] .builder-columns {
    display: grid;
  }

  .invoice-builder-grid,
  .invoice-builder-grid.split {
    grid-template-columns: 1fr;
  }

  .builder-preview-panel {
    position: static;
    top: auto;
    order: 2;
  }

  .panel[data-panel="settings"] > .panel-header .header-actions,
  .panel[data-panel="invoices"] > .panel-header .header-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .mobile-header {
    padding: 10px 12px;
  }

  .workspace-hero,
  .main-toolbar,
  .card,
  .customer-command-bar,
  .helpdesk-command-bar,
  .customer-views-bar,
  .customer-segments,
  .customer-mobile-toggle {
    border-radius: 22px;
  }

  .workspace-hero h1 {
    font-size: clamp(1.8rem, 8vw, 2.4rem);
    line-height: 0.98;
  }

  .workspace-hero p {
    font-size: 0.95rem;
  }

  .workspace-hero-meta {
    grid-auto-columns: minmax(145px, 82vw);
  }

  .hero-pill {
    padding: 12px 13px;
    border-radius: 18px;
  }

  .card-header,
  .card-body {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .panel[data-panel="customers"] .customer-command-bar .command-actions,
  .panel[data-panel="helpdesk"] .helpdesk-command-bar .command-actions {
    grid-template-columns: 1fr;
  }

  .panel[data-panel="customers"] .customer-mobile-toggle {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
  }

  .panel[data-panel="customers"] .customer-mobile-toggle > * {
    width: 100%;
    justify-content: center;
  }

  .ticket-toolbar {
    grid-template-columns: 1fr;
  }

  .ticket-toolbar .toolbar-right {
    justify-self: start;
  }

  .pagination-controls {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .stats-deck,
  .stats-deck.compact {
    grid-template-columns: 1fr;
  }

  .quick-actions-grid {
    grid-template-columns: 1fr;
  }
}

/* OnlineServices requester helpdesk mode */
body.helpdesk-reporter-mode #helpdesk-panel .helpdesk-command-bar,
body.helpdesk-reporter-mode #helpdesk-panel .helpdesk-banner,
body.helpdesk-reporter-mode #helpdesk-panel .helpdesk-grid {
  width: min(100%, 980px);
  margin-inline: auto;
}

body.helpdesk-reporter-mode #helpdesk-panel .helpdesk-grid {
  grid-template-columns: minmax(0, 1fr) !important;
  align-items: start;
}

body.helpdesk-reporter-mode #helpdesk-panel .ticket-detail-shelf {
  display: none !important;
}

body.helpdesk-reporter-mode #helpdesk-panel .tickets-column {
  gap: 0.9rem;
}

body.helpdesk-reporter-mode #helpdesk-panel .helpdesk-banner {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.95rem 1.05rem;
  border-radius: 22px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background:
    radial-gradient(circle at top right, rgba(242, 106, 61, 0.14), transparent 26%),
    linear-gradient(145deg, rgba(17, 24, 39, 0.96), rgba(10, 14, 25, 0.95));
  box-shadow: 0 18px 34px rgba(8, 11, 20, 0.18);
}

body.helpdesk-reporter-mode #helpdesk-panel .helpdesk-banner::before {
  content: "Requester view";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.38rem 0.72rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: var(--white);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

body.helpdesk-reporter-mode .ticket-list {
  gap: 0.95rem;
}

body.helpdesk-reporter-mode .ticket-card {
  padding: 1rem 1.1rem;
  border-radius: 22px;
  border-color: rgba(148, 163, 184, 0.18);
  background:
    radial-gradient(circle at top right, rgba(76, 153, 255, 0.08), transparent 26%),
    linear-gradient(145deg, rgba(17, 24, 39, 0.97), rgba(10, 14, 25, 0.95));
  box-shadow: 0 18px 34px rgba(8, 11, 20, 0.18);
}

body.helpdesk-reporter-mode .ticket-card:hover,
body.helpdesk-reporter-mode .ticket-card.active-detail {
  border-color: rgba(242, 106, 61, 0.42);
  box-shadow: 0 22px 38px rgba(8, 11, 20, 0.22);
}

body.helpdesk-reporter-mode .ticket-title-row {
  align-items: center;
  gap: 0.75rem;
}

body.helpdesk-reporter-mode .ticket-details h4 {
  font-size: 1.12rem;
  margin-bottom: 0.2rem;
}

body.helpdesk-reporter-mode .ticket-subtitle {
  font-size: 0.92rem;
}

body.helpdesk-reporter-mode .ticket-status-chip {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin-left: auto;
}

body.helpdesk-reporter-mode .ticket-pill-row {
  gap: 0.45rem;
}

body.helpdesk-reporter-mode .ticket-pill {
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
}

body.helpdesk-reporter-mode .ticket-preview {
  margin: 0.1rem 0 0;
  font-size: 0.96rem;
  line-height: 1.45;
}

body.helpdesk-reporter-mode .ticket-view-btn {
  min-height: 40px;
  padding-inline: 0.9rem;
}

body.helpdesk-reporter-mode .ticket-wallpaper::before,
body.helpdesk-reporter-mode .ticket-wallpaper::after {
  opacity: 0.04;
}

body.helpdesk-reporter-mode .issue-detail-card.modal-open {
  top: 5vh;
  width: min(860px, 94vw);
  max-height: 88vh;
  padding: 1rem;
  border-radius: 26px;
}

body.helpdesk-reporter-mode .issue-detail-card.modal-open #issue-detail-body {
  gap: 0.85rem;
}

body.helpdesk-reporter-mode .issue-detail-card.modal-open .issue-detail-head.sticky {
  padding-bottom: 0.6rem;
  margin-bottom: 0.25rem;
}

body.helpdesk-reporter-mode .issue-detail-card.modal-open .issue-triage-bar,
body.helpdesk-reporter-mode .issue-detail-card.modal-open .issue-detail-description,
body.helpdesk-reporter-mode .issue-detail-card.modal-open .detail-tabs,
body.helpdesk-reporter-mode .issue-detail-card.modal-open .detail-pane,
body.helpdesk-reporter-mode .issue-detail-card.modal-open .issue-comments,
body.helpdesk-reporter-mode .issue-detail-card.modal-open .issue-timeline-header,
body.helpdesk-reporter-mode .issue-detail-card.modal-open .comment-form,
body.helpdesk-reporter-mode .issue-detail-card.modal-open .issue-detail-status-row {
  background-image: none !important;
}

[data-theme="light"] body.helpdesk-reporter-mode #helpdesk-panel .helpdesk-banner {
  border-color: #d8e1eb;
  background:
    radial-gradient(circle at top right, rgba(217, 93, 47, 0.12), transparent 26%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 253, 0.96));
  color: #415064;
}

[data-theme="light"] body.helpdesk-reporter-mode #helpdesk-panel .helpdesk-banner::before {
  border-color: rgba(217, 93, 47, 0.18);
  background: rgba(217, 93, 47, 0.08);
  color: #b45522;
}

[data-theme="light"] body.helpdesk-reporter-mode .ticket-card {
  border-color: #d8e1eb;
  background:
    radial-gradient(circle at top right, rgba(45, 127, 207, 0.06), transparent 26%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 253, 0.96));
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.08);
}

[data-theme="light"] body.helpdesk-reporter-mode .ticket-card:hover,
[data-theme="light"] body.helpdesk-reporter-mode .ticket-card.active-detail {
  border-color: rgba(217, 93, 47, 0.34);
  box-shadow: 0 18px 34px rgba(15, 23, 42, 0.1);
}

[data-theme="light"] body.helpdesk-reporter-mode .ticket-preview,
[data-theme="light"] body.helpdesk-reporter-mode .issue-detail-card.modal-open .muted,
[data-theme="light"] body.helpdesk-reporter-mode .issue-detail-card.modal-open .ticket-meta,
[data-theme="light"] body.helpdesk-reporter-mode .issue-detail-card.modal-open .ticket-subtitle,
[data-theme="light"] body.helpdesk-reporter-mode .issue-detail-card.modal-open .issue-detail-meta {
  color: #5a6b80;
}

[data-theme="light"] body.helpdesk-reporter-mode .issue-detail-card.modal-open .issue-triage-bar,
[data-theme="light"] body.helpdesk-reporter-mode .issue-detail-card.modal-open .issue-detail-description,
[data-theme="light"] body.helpdesk-reporter-mode .issue-detail-card.modal-open .detail-tabs,
[data-theme="light"] body.helpdesk-reporter-mode .issue-detail-card.modal-open .detail-pane,
[data-theme="light"] body.helpdesk-reporter-mode .issue-detail-card.modal-open .issue-comments,
[data-theme="light"] body.helpdesk-reporter-mode .issue-detail-card.modal-open .issue-timeline-header,
[data-theme="light"] body.helpdesk-reporter-mode .issue-detail-card.modal-open .comment-form,
[data-theme="light"] body.helpdesk-reporter-mode .issue-detail-card.modal-open .issue-detail-status-row {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 253, 0.96)) !important;
  border-color: #d8e1eb;
}

/* Ticket detail readability pass */
.ticket-wallpaper.issue-detail-card {
  --ticket-detail-text: #e8eef8;
  --ticket-detail-heading: #f8fbff;
  --ticket-detail-meta: rgba(203, 213, 225, 0.84);
  --ticket-detail-subtle: rgba(226, 232, 240, 0.74);
  --ticket-detail-shell: linear-gradient(180deg, rgba(9, 13, 22, 0.96), rgba(12, 17, 28, 0.98));
  --ticket-detail-panel: linear-gradient(180deg, rgba(11, 16, 26, 0.82), rgba(9, 13, 22, 0.9));
  --ticket-detail-item: linear-gradient(180deg, rgba(12, 18, 30, 0.92), rgba(9, 13, 22, 0.96));
  --ticket-detail-chip: rgba(15, 23, 42, 0.72);
  --ticket-detail-border: rgba(148, 163, 184, 0.2);
  --ticket-detail-shadow: 0 14px 30px rgba(2, 6, 23, 0.14);
}

[data-theme="light"] .ticket-wallpaper.issue-detail-card {
  --ticket-detail-text: #132033;
  --ticket-detail-heading: #0f172a;
  --ticket-detail-meta: #5f6f84;
  --ticket-detail-subtle: #6f8095;
  --ticket-detail-shell: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 248, 252, 0.98));
  --ticket-detail-panel: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 249, 252, 0.98));
  --ticket-detail-item: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(243, 246, 251, 0.98));
  --ticket-detail-chip: rgba(255, 255, 255, 0.9);
  --ticket-detail-border: rgba(196, 206, 220, 0.9);
  --ticket-detail-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.ticket-wallpaper.issue-detail-card::before {
  opacity: 0.09;
}

[data-theme="light"] .ticket-wallpaper.issue-detail-card::before {
  opacity: 0.05;
}

.ticket-wallpaper.issue-detail-card::after {
  background: linear-gradient(180deg, rgba(7, 10, 18, 0.28), rgba(7, 10, 18, 0.12) 32%, rgba(7, 10, 18, 0.34));
}

[data-theme="light"] .ticket-wallpaper.issue-detail-card::after {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.58),
    rgba(248, 250, 253, 0.28) 34%,
    rgba(255, 255, 255, 0.66)
  );
}

.ticket-wallpaper.issue-detail-card .issue-detail-head.sticky {
  background: var(--ticket-detail-shell) !important;
  background-image: none !important;
  border-bottom: 1px solid var(--ticket-detail-border) !important;
  box-shadow: none;
}

.ticket-wallpaper.issue-detail-card .issue-triage-bar,
.ticket-wallpaper.issue-detail-card .issue-detail-description,
.ticket-wallpaper.issue-detail-card .issue-context,
.ticket-wallpaper.issue-detail-card .issue-next-step,
.ticket-wallpaper.issue-detail-card .detail-tabs,
.ticket-wallpaper.issue-detail-card .detail-pane,
.ticket-wallpaper.issue-detail-card .detail-pane.active,
.ticket-wallpaper.issue-detail-card .issue-comments,
.ticket-wallpaper.issue-detail-card .issue-timeline-header,
.ticket-wallpaper.issue-detail-card .comment-form,
.ticket-wallpaper.issue-detail-card .issue-detail-status-row {
  background: var(--ticket-detail-panel) !important;
  background-image: none !important;
  background-blend-mode: normal !important;
  border: 1px solid var(--ticket-detail-border) !important;
  box-shadow: var(--ticket-detail-shadow);
}

.ticket-wallpaper.issue-detail-card .comment-entry,
.ticket-wallpaper.issue-detail-card .attachment-card,
.ticket-wallpaper.issue-detail-card .mention-chip,
.ticket-wallpaper.issue-detail-card .watcher-chip,
.ticket-wallpaper.issue-detail-card input,
.ticket-wallpaper.issue-detail-card select,
.ticket-wallpaper.issue-detail-card textarea,
.ticket-wallpaper.issue-detail-card .comment-form input[type="file"],
.ticket-wallpaper.issue-detail-card #issue-view-status-wrapper select,
.ticket-wallpaper.issue-detail-card .wallpaper-select,
.ticket-wallpaper.issue-detail-card .issue-detail-actions .btn-icon {
  background: var(--ticket-detail-item) !important;
  background-image: none !important;
  color: var(--ticket-detail-text) !important;
  border-color: var(--ticket-detail-border) !important;
  box-shadow: none;
}

.ticket-wallpaper.issue-detail-card .detail-tab-btn,
.ticket-wallpaper.issue-detail-card .chip,
.ticket-wallpaper.issue-detail-card .ticket-status-chip .chip,
.ticket-wallpaper.issue-detail-card .issue-detail-tags .chip {
  background: var(--ticket-detail-chip) !important;
  color: var(--ticket-detail-text) !important;
  border-color: var(--ticket-detail-border) !important;
}

.ticket-wallpaper.issue-detail-card .detail-tab-btn.active,
.ticket-wallpaper.issue-detail-card .chip.active {
  background: var(--ticket-detail-item) !important;
  color: var(--ticket-detail-heading) !important;
  border-color: rgba(79, 70, 229, 0.42) !important;
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.12);
}

.ticket-wallpaper.issue-detail-card,
.ticket-wallpaper.issue-detail-card .ticket-subject,
.ticket-wallpaper.issue-detail-card .comment-entry .comment-body,
.ticket-wallpaper.issue-detail-card .attachment-meta,
.ticket-wallpaper.issue-detail-card .attachment-meta .name,
.ticket-wallpaper.issue-detail-card .attachment-link,
.ticket-wallpaper.issue-detail-card #issue-view-description,
.ticket-wallpaper.issue-detail-card .issue-detail-description p,
.ticket-wallpaper.issue-detail-card .detail-pane,
.ticket-wallpaper.issue-detail-card .detail-pane label,
.ticket-wallpaper.issue-detail-card .issue-comments,
.ticket-wallpaper.issue-detail-card .wallpaper-select,
.ticket-wallpaper.issue-detail-card #issue-next-step-input {
  color: var(--ticket-detail-text) !important;
}

.ticket-wallpaper.issue-detail-card .muted,
.ticket-wallpaper.issue-detail-card .ticket-subtitle,
.ticket-wallpaper.issue-detail-card .ticket-meta,
.ticket-wallpaper.issue-detail-card .ticket-people,
.ticket-wallpaper.issue-detail-card .issue-detail-meta,
.ticket-wallpaper.issue-detail-card .issue-detail-description .eyebrow,
.ticket-wallpaper.issue-detail-card .issue-context .eyebrow,
.ticket-wallpaper.issue-detail-card .issue-timeline-header p,
.ticket-wallpaper.issue-detail-card .comment-entry .meta,
.ticket-wallpaper.issue-detail-card .attachment-meta .tag,
.ticket-wallpaper.issue-detail-card .wallpaper-picker label,
.ticket-wallpaper.issue-detail-card .watchers label,
.ticket-wallpaper.issue-detail-card .mentions-helper > p,
.ticket-wallpaper.issue-detail-card .eyebrow {
  color: var(--ticket-detail-meta) !important;
}

.ticket-wallpaper.issue-detail-card input::placeholder,
.ticket-wallpaper.issue-detail-card textarea::placeholder {
  color: var(--ticket-detail-subtle) !important;
}

.ticket-wallpaper.issue-detail-card input:focus,
.ticket-wallpaper.issue-detail-card select:focus,
.ticket-wallpaper.issue-detail-card textarea:focus,
.ticket-wallpaper.issue-detail-card .wallpaper-select:focus {
  border-color: rgba(79, 70, 229, 0.42) !important;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.ticket-wallpaper.issue-detail-card .issue-timeline-header {
  align-items: flex-start;
  gap: 0.95rem;
}

.ticket-wallpaper.issue-detail-card .mentions-helper {
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 0.55rem 0.8rem;
  max-width: min(360px, 100%);
}

.ticket-wallpaper.issue-detail-card .watchers {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.45rem;
}

.ticket-wallpaper.issue-detail-card .watchers label {
  flex-basis: 100%;
  margin: 0;
}

.ticket-wallpaper.issue-detail-card .comment-entry .comment-body {
  line-height: 1.55;
}

.ticket-wallpaper.issue-detail-card .issue-detail-actions .btn-icon:hover,
.ticket-wallpaper.issue-detail-card .watcher-chip:hover,
.ticket-wallpaper.issue-detail-card .mention-chip:hover {
  background: linear-gradient(180deg, rgba(79, 70, 229, 0.18), rgba(79, 70, 229, 0.1)) !important;
  color: var(--ticket-detail-heading) !important;
}

.issue-detail-card.inline .issue-timeline-header,
.issue-detail-card.modal-open .issue-timeline-header {
  flex-wrap: wrap;
}

@media (max-width: 1100px) {
  .ticket-wallpaper.issue-detail-card .issue-timeline-header {
    flex-direction: column;
  }

  .ticket-wallpaper.issue-detail-card .mentions-helper,
  .ticket-wallpaper.issue-detail-card .watchers {
    justify-content: flex-start;
    max-width: 100%;
  }
}

@media (max-width: 980px) {
  body.helpdesk-reporter-mode #helpdesk-panel .helpdesk-command-bar,
  body.helpdesk-reporter-mode #helpdesk-panel .helpdesk-banner,
  body.helpdesk-reporter-mode #helpdesk-panel .helpdesk-grid {
    width: 100%;
  }

  body.helpdesk-reporter-mode .issue-detail-card.modal-open {
    top: 3vh;
    width: min(96vw, 720px);
  }
}

@media (max-width: 640px) {
  body.helpdesk-reporter-mode #helpdesk-panel .helpdesk-banner {
    padding: 0.85rem 0.95rem;
  }

  body.helpdesk-reporter-mode #helpdesk-panel .helpdesk-banner::before {
    display: none;
  }

  body.helpdesk-reporter-mode .ticket-card {
    padding: 0.95rem;
  }

  body.helpdesk-reporter-mode .ticket-status-chip {
    margin-left: 0;
  }
}

/* OnlineServices topbar + density pass */
:root {
  --os-shell-gap: clamp(10px, 1.35vw, 16px);
  --os-surface-padding: clamp(14px, 1.4vw, 18px);
}

.main-panel {
  gap: 14px;
  padding: clamp(14px, 1.6vw, 22px);
}

.main-toolbar {
  position: sticky;
  top: 12px;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 20px;
}

.theme-toggle-btn {
  min-width: 124px;
  justify-content: center;
  white-space: nowrap;
}

.theme-toggle-label {
  font-size: 0.88rem;
  font-weight: 600;
}

.workspace-hero {
  gap: 14px;
  padding: clamp(16px, 1.8vw, 22px);
}

.workspace-kicker {
  margin-bottom: 10px;
  padding: 6px 10px;
}

.workspace-hero h1 {
  font-size: clamp(1.85rem, 2.8vw, 2.85rem);
  margin-bottom: 8px;
}

.workspace-hero p {
  max-width: 48ch;
  font-size: 0.96rem;
}

.workspace-hero-meta {
  gap: 8px;
}

.hero-pill {
  min-height: 84px;
  padding: 12px 14px;
  gap: 6px;
}

.hero-pill strong {
  font-size: 0.88rem;
}

.panel.active {
  gap: 12px;
}

.stats-deck {
  gap: 12px;
  margin-bottom: 1.15rem;
}

.stat-card {
  min-height: 136px;
  padding: 18px;
}

.content-grid,
.customer-layout,
.invoices-layout,
.reports-grid,
.helpdesk-grid {
  gap: 14px;
}

.card-header {
  gap: 0.7rem 0.85rem;
}

.card-body {
  padding-top: 0.85rem;
}

.helpdesk-command-bar,
.panel[data-panel="helpdesk"] .helpdesk-command-bar {
  gap: 0.7rem;
  padding: 0.9rem 1rem;
}

.helpdesk-command-bar .command-main,
.panel[data-panel="helpdesk"] .helpdesk-command-bar .command-main {
  gap: 0.7rem;
}

.ticket-toolbar {
  gap: 0.65rem 0.85rem;
  padding: 0.65rem 0.8rem;
}

.ticket-list {
  gap: 0.7rem;
}

.ticket-card-wrap {
  gap: 0.45rem;
}

.ticket-card {
  padding: 0.8rem 0.9rem;
  gap: 0.75rem;
}

.quick-actions-grid {
  gap: 12px;
}

@media (max-width: 980px) {
  .main-panel {
    gap: 12px;
    padding: 12px 12px 22px;
  }

  .main-toolbar {
    padding: 10px 12px;
  }

  .workspace-hero {
    padding: 0.95rem;
  }
}

@media (max-width: 640px) {
  .theme-toggle-btn {
    min-width: 48px;
    padding-inline: 0.85rem;
  }

  .theme-toggle-label {
    display: none;
  }

  .workspace-hero {
    gap: 0.75rem;
  }

  .hero-pill {
    min-height: 72px;
  }
}

/* OnlineServices horizontal shell */
.app-shell {
  grid-template-columns: minmax(0, 1fr);
}

.mobile-header,
.sidebar-backdrop {
  display: none !important;
}

body.sidebar-open {
  overflow: auto;
}

.sidebar,
.sidebar.open {
  position: sticky;
  top: 0;
  left: auto;
  right: auto;
  transform: none;
  height: auto;
  width: auto;
  max-width: none;
  padding: 10px clamp(12px, 1.5vw, 20px) 0;
  border-right: 0;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  overflow: visible;
  backdrop-filter: blur(20px);
  background:
    linear-gradient(180deg, rgba(15, 18, 22, 0.96), rgba(20, 24, 29, 0.92)),
    radial-gradient(circle at top left, rgba(242, 106, 61, 0.11), transparent 22%);
}

[data-theme="light"] .sidebar,
[data-theme="light"] .sidebar.open {
  background:
    linear-gradient(180deg, rgba(255, 251, 244, 0.96), rgba(248, 241, 230, 0.92)),
    radial-gradient(circle at top left, rgba(217, 93, 47, 0.07), transparent 22%);
}

.sidebar-brand {
  min-height: 64px;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 16px;
  flex: 0 0 auto;
}

.sidebar-brand .brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  font-size: 1.15rem;
  box-shadow: 0 10px 22px rgba(242, 106, 61, 0.22);
}

.brand-copy {
  gap: 2px;
}

.brand-title {
  font-size: 1rem;
}

.brand-subtitle {
  font-size: 0.76rem;
  line-height: 1.2;
  max-width: 26ch;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  justify-content: flex-start;
  padding: 0;
  gap: 6px;
  min-width: 0;
  flex: 1 1 auto;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}

.sidebar-nav::-webkit-scrollbar {
  display: none;
}

.nav-btn {
  position: relative;
  min-height: 38px;
  padding: 0 11px;
  border-radius: 14px;
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 0.9rem;
  line-height: 1;
}

.sidebar-nav .nav-btn {
  border-color: rgba(255, 255, 255, 0.04);
  background: rgba(255, 255, 255, 0.02);
}

[data-theme="light"] .sidebar-nav .nav-btn {
  border-color: rgba(23, 26, 31, 0.05);
  background: rgba(255, 255, 255, 0.6);
}

.sidebar-nav .nav-btn.active {
  background: linear-gradient(135deg, rgba(242, 106, 61, 0.18), rgba(255, 176, 127, 0.08));
  box-shadow: 0 10px 24px rgba(242, 106, 61, 0.16);
}

[data-theme="light"] .sidebar-nav .nav-btn.active {
  background: linear-gradient(135deg, rgba(217, 93, 47, 0.12), rgba(240, 164, 107, 0.08));
}

.sidebar-nav .nav-btn i {
  width: 16px;
  font-size: 0.94rem;
}

.sidebar-footer {
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 0;
  min-width: 0;
  flex: 0 0 auto;
}

.user-chip {
  min-height: 64px;
  padding: 10px 12px;
  border-radius: 16px;
}

.user-chip {
  min-width: 220px;
  max-width: 280px;
}

.user-avatar-btn {
  appearance: none;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.user-chip .user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 12px;
}

.user-chip .btn-icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
}

.user-info {
  gap: 1px;
}

#current-user-name {
  font-size: 0.88rem;
}

#current-user-email,
#current-user-role {
  font-size: 0.76rem;
}

.user-avatar-btn:hover,
.user-avatar-btn:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
  background: rgba(255, 255, 255, 0.12);
}

[data-theme="light"] .user-avatar-btn:hover,
[data-theme="light"] .user-avatar-btn:focus-visible {
  background: rgba(23, 26, 31, 0.06);
}

.main-panel {
  padding-top: 8px;
}

.main-toolbar {
  position: static;
  top: auto;
  display: grid;
  grid-template-columns: minmax(280px, 1.15fr) minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 20px;
}

.toolbar-copy {
  display: none;
}

.toolbar-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.toolbar-pill {
  min-width: 0;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

[data-theme="light"] .toolbar-pill {
  background: rgba(255, 255, 255, 0.76);
}

.toolbar-pill span {
  color: var(--muted);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.toolbar-pill strong {
  font-size: 0.84rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.theme-toggle-btn {
  min-width: 132px;
  min-height: 48px;
  border-radius: 14px;
}

.main-toolbar .global-search {
  min-height: 50px;
  border-radius: 16px;
}

.main-toolbar .global-search input {
  font-size: 0.94rem;
}

.main-toolbar #global-search-clear,
.main-toolbar .global-search .btn-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
}

@media (max-width: 1024px) {
  .sidebar,
  .sidebar.open {
    grid-template-columns: minmax(0, 1fr);
    padding-bottom: 8px;
  }

  .sidebar-nav {
    justify-content: flex-start;
  }

  .main-toolbar {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .header-actions {
    justify-content: flex-start;
    grid-column: 1 / -1;
  }
}

@media (max-width: 980px) {
  .sidebar,
  .sidebar.open {
    padding: 10px 12px 0;
  }

  .sidebar-nav {
    padding-bottom: 4px;
  }

  .sidebar-footer {
    flex-direction: column;
  }

  .user-chip {
    min-width: 0;
    width: 100%;
    max-width: none;
  }

  .main-toolbar {
    grid-template-columns: minmax(0, 1fr);
  }

  .toolbar-meta {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .header-actions {
    grid-column: auto;
  }

  .theme-toggle-btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 640px) {
  .sidebar,
  .sidebar.open {
    gap: 8px;
    padding: 8px 10px 0;
  }

  .sidebar-brand {
    gap: 12px;
    min-height: auto;
  }

  .brand-title {
    font-size: 1rem;
  }

  .nav-btn {
    min-height: 38px;
    padding: 0 10px;
  }

  .toolbar-meta {
    grid-template-columns: 1fr;
  }

  .workspace-mini-card,
  .user-chip {
    padding: 10px 12px;
  }
}

/* OnlineServices full shell redesign */
:root {
  --os-warm-shadow: 0 18px 38px rgba(101, 70, 38, 0.08);
  --os-warm-shadow-lg: 0 26px 56px rgba(101, 70, 38, 0.12);
  --os-surface-light: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(249, 243, 233, 0.94));
  --os-surface-soft: linear-gradient(180deg, rgba(255, 253, 249, 0.9), rgba(244, 235, 223, 0.84));
  --os-surface-dark: linear-gradient(180deg, rgba(26, 30, 35, 0.96), rgba(17, 20, 25, 0.94));
}

.sidebar,
.sidebar.open {
  padding: 10px clamp(10px, 1.25vw, 16px) 2px;
  gap: 12px;
  border-bottom-color: rgba(217, 93, 47, 0.14);
  backdrop-filter: blur(26px) saturate(1.2);
}

[data-theme="light"] .sidebar,
[data-theme="light"] .sidebar.open {
  background:
    linear-gradient(180deg, rgba(255, 252, 247, 0.98), rgba(245, 237, 226, 0.94)),
    radial-gradient(circle at top left, rgba(227, 107, 56, 0.08), transparent 24%);
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.72), 0 14px 28px rgba(94, 66, 39, 0.05);
}

[data-theme="dark"] .sidebar,
[data-theme="dark"] .sidebar.open {
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.06), 0 14px 32px rgba(0, 0, 0, 0.22);
}

.sidebar-brand {
  background: var(--os-surface-light);
  border: 1px solid rgba(217, 93, 47, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82), var(--os-warm-shadow);
}

[data-theme="dark"] .sidebar-brand {
  background: var(--os-surface-dark);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 18px 36px rgba(0, 0, 0, 0.2);
}

.sidebar-brand .eyebrow {
  color: #8c6a56;
  letter-spacing: 0.16em;
}

[data-theme="dark"] .sidebar-brand .eyebrow {
  color: #a9b3c0;
}

.brand-title {
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.brand-subtitle {
  color: #5e6d7b;
  font-weight: 500;
}

[data-theme="dark"] .brand-subtitle {
  color: #9aa6b4;
}

.sidebar-nav {
  gap: 8px;
  padding: 2px 0;
}

.sidebar-nav .nav-btn {
  min-height: 40px;
  padding: 0 14px 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(217, 93, 47, 0.12);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(250, 242, 232, 0.9));
  color: #25313d;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

[data-theme="dark"] .sidebar-nav .nav-btn {
  border-color: rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  color: #edf1f6;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.sidebar-nav .nav-btn i {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: rgba(217, 93, 47, 0.08);
  color: #d46838;
}

[data-theme="dark"] .sidebar-nav .nav-btn i {
  background: rgba(255, 255, 255, 0.08);
  color: #ffb087;
}

.sidebar-nav .nav-btn span {
  font-weight: 600;
  letter-spacing: -0.01em;
}

.sidebar-nav .nav-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(217, 93, 47, 0.12);
}

.sidebar-nav .nav-btn.active {
  border-color: transparent;
  background: linear-gradient(135deg, #df6b3b, #f2a46d);
  color: #fffdf8;
  box-shadow: 0 12px 24px rgba(223, 107, 59, 0.22);
}

.sidebar-nav .nav-btn.active span {
  color: inherit;
}

[data-theme="light"] .sidebar-nav .nav-btn.active {
  border-color: rgba(217, 93, 47, 0.22);
  background: linear-gradient(135deg, rgba(242, 106, 61, 0.22), rgba(255, 189, 145, 0.42));
  color: #2b1a12;
  box-shadow: 0 12px 22px rgba(223, 107, 59, 0.14);
}

[data-theme="light"] .sidebar-nav .nav-btn.active span {
  color: #2b1a12;
}

[data-theme="light"] .sidebar-nav .nav-btn {
  color: #4a2d1d;
}

[data-theme="light"] .sidebar-nav .nav-btn span,
[data-theme="light"] .sidebar-nav .nav-btn i {
  color: inherit;
}

.sidebar-nav .nav-btn.active i {
  background: rgba(255, 255, 255, 0.92);
  color: #d86434;
}

.user-chip {
  background: var(--os-surface-light);
  border: 1px solid rgba(217, 93, 47, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82), var(--os-warm-shadow);
}

[data-theme="dark"] .user-chip {
  background: var(--os-surface-dark);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 18px 36px rgba(0, 0, 0, 0.2);
}

.user-chip .user-avatar {
  background: linear-gradient(135deg, rgba(223, 107, 59, 0.12), rgba(242, 164, 109, 0.28));
}

[data-theme="dark"] .user-chip .user-avatar {
  background: linear-gradient(135deg, rgba(223, 107, 59, 0.2), rgba(242, 164, 109, 0.1));
}

.user-chip .btn-icon {
  border: 1px solid rgba(217, 93, 47, 0.12);
  background: rgba(255, 255, 255, 0.78);
}

[data-theme="dark"] .user-chip .btn-icon {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.07);
}

#current-user-name {
  font-weight: 700;
  color: #202a35;
}

[data-theme="dark"] #current-user-name {
  color: #f4f7fb;
}

.main-toolbar {
  background: var(--os-surface-light);
  border: 1px solid rgba(217, 93, 47, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82), var(--os-warm-shadow);
}

[data-theme="dark"] .main-toolbar {
  background: var(--os-surface-dark);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 18px 40px rgba(0, 0, 0, 0.24);
}

.main-toolbar .global-search {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(247, 239, 228, 0.88));
  border-color: rgba(217, 93, 47, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

[data-theme="dark"] .main-toolbar .global-search {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.toolbar-pill {
  min-height: 58px;
  background: var(--os-surface-soft);
  border: 1px solid rgba(217, 93, 47, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

[data-theme="dark"] .toolbar-pill {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.toolbar-pill span {
  color: #8b6a56;
}

[data-theme="dark"] .toolbar-pill span {
  color: #9aa6b4;
}

.toolbar-pill strong {
  color: #202a35;
  font-weight: 700;
}

[data-theme="dark"] .toolbar-pill strong {
  color: #f1f5f9;
}

.btn-primary,
.btn-secondary,
.btn-danger,
.btn-icon,
.btn-text,
.quick-action,
.ghost-btn {
  min-height: 44px;
  border-radius: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.btn-primary.small,
.btn-secondary.small,
.btn-danger.small,
.btn-text.small {
  min-height: 38px;
  padding: 0.45rem 0.82rem;
}

.btn-primary {
  border: 1px solid rgba(223, 107, 59, 0.12);
  background: linear-gradient(135deg, #df6b3b, #f2a46d);
  color: #fffdf8;
  box-shadow: 0 14px 26px rgba(223, 107, 59, 0.24);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #d86335, #ef9c62);
  box-shadow: 0 18px 30px rgba(223, 107, 59, 0.28);
}

.btn-secondary,
.ghost-btn {
  border: 1px solid rgba(217, 93, 47, 0.12);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(247, 239, 228, 0.86));
  color: #24303c;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

[data-theme="dark"] .btn-secondary,
[data-theme="dark"] .ghost-btn {
  border-color: rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  color: #edf1f6;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.btn-secondary:hover,
.ghost-btn:hover {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 235, 223, 0.9));
  border-color: rgba(217, 93, 47, 0.18);
  box-shadow: 0 10px 22px rgba(100, 71, 42, 0.08);
}

[data-theme="dark"] .btn-secondary:hover,
[data-theme="dark"] .ghost-btn:hover {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.04));
}

.btn-danger {
  border: 1px solid rgba(224, 87, 87, 0.16);
  background: linear-gradient(135deg, #ea645b, #f49b78);
  color: #fffaf8;
  box-shadow: 0 14px 26px rgba(234, 100, 91, 0.18);
}

.btn-icon {
  width: 44px;
  height: 44px;
  justify-content: center;
  padding: 0;
}

.quick-action {
  border: 1px solid rgba(217, 93, 47, 0.12);
  background: var(--os-surface-light);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82), var(--os-warm-shadow);
}

[data-theme="dark"] .quick-action {
  background: var(--os-surface-dark);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 18px 40px rgba(0, 0, 0, 0.24);
}

.panel-header,
.card,
.customer-command-bar,
.helpdesk-command-bar,
.customer-views-bar,
.customer-segments,
.customer-mobile-toggle,
.automation-deck .card,
.report-card,
.drawer,
.issue-detail-card,
.kanban-wrapper,
.helpdesk-hero,
.ticket-toolbar {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid rgba(217, 93, 47, 0.12);
  background: var(--os-surface-light);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82), var(--os-warm-shadow);
}

[data-theme="dark"] .panel-header,
[data-theme="dark"] .card,
[data-theme="dark"] .customer-command-bar,
[data-theme="dark"] .helpdesk-command-bar,
[data-theme="dark"] .customer-views-bar,
[data-theme="dark"] .customer-segments,
[data-theme="dark"] .customer-mobile-toggle,
[data-theme="dark"] .automation-deck .card,
[data-theme="dark"] .report-card,
[data-theme="dark"] .drawer,
[data-theme="dark"] .issue-detail-card,
[data-theme="dark"] .kanban-wrapper,
[data-theme="dark"] .helpdesk-hero,
[data-theme="dark"] .ticket-toolbar {
  border-color: rgba(255, 255, 255, 0.08);
  background: var(--os-surface-dark);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 18px 40px rgba(0, 0, 0, 0.24);
}

.panel-header::before,
.card::before,
.customer-command-bar::before,
.helpdesk-command-bar::before,
.customer-views-bar::before,
.customer-segments::before,
.customer-mobile-toggle::before,
.automation-deck .card::before,
.report-card::before,
.drawer::before,
.issue-detail-card::before,
.kanban-wrapper::before,
.helpdesk-hero::before,
.ticket-toolbar::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0));
  pointer-events: none;
}

[data-theme="dark"] .panel-header::before,
[data-theme="dark"] .card::before,
[data-theme="dark"] .customer-command-bar::before,
[data-theme="dark"] .helpdesk-command-bar::before,
[data-theme="dark"] .customer-views-bar::before,
[data-theme="dark"] .customer-segments::before,
[data-theme="dark"] .customer-mobile-toggle::before,
[data-theme="dark"] .automation-deck .card::before,
[data-theme="dark"] .report-card::before,
[data-theme="dark"] .drawer::before,
[data-theme="dark"] .issue-detail-card::before,
[data-theme="dark"] .kanban-wrapper::before,
[data-theme="dark"] .helpdesk-hero::before,
[data-theme="dark"] .ticket-toolbar::before {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0));
}

/* Keep modal/drawer forms scrollable when content exceeds viewport height. */
.drawer {
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.card-header {
  padding: 1.08rem 1.18rem 0.82rem;
}

.card-header h3 {
  margin: 0;
  font-size: 1.12rem;
  letter-spacing: -0.03em;
}

.card-body {
  padding: 0.92rem 1.18rem 1.12rem;
}

.panel-header,
.helpdesk-command-bar,
.customer-command-bar {
  padding: 14px 16px;
}

.stats-deck,
.stats-deck.compact {
  gap: 14px;
  margin-bottom: 1.2rem;
}

.stat-card {
  position: relative;
  min-height: 132px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 14px;
  padding: 18px;
  border-radius: 22px;
  border-left: 0;
  border: 1px solid rgba(217, 93, 47, 0.12);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(249, 243, 233, 0.94));
  box-shadow: var(--os-warm-shadow);
}

[data-theme="dark"] .stat-card {
  border-color: rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(26, 30, 35, 0.98), rgba(18, 22, 27, 0.94));
  box-shadow: 0 22px 44px rgba(0, 0, 0, 0.28);
}

.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  border-radius: 24px 24px 0 0;
  background: var(--stat-accent, linear-gradient(90deg, #df6b3b, #f2a46d));
}

.stat-card.primary { --stat-accent: linear-gradient(90deg, #df6b3b, #f2a46d); }
.stat-card.success { --stat-accent: linear-gradient(90deg, #28b27d, #73d8ad); }
.stat-card.warning { --stat-accent: linear-gradient(90deg, #f0a133, #f6c16d); }
.stat-card.danger { --stat-accent: linear-gradient(90deg, #e4675f, #f2a08c); }

.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: rgba(217, 93, 47, 0.08);
  color: #d46838;
}

[data-theme="dark"] .stat-card .stat-icon {
  background: rgba(255, 255, 255, 0.08);
  color: #ffb087;
}

.stat-content h3,
.stat-card h3 {
  margin: 0 0 4px;
  font-size: clamp(1.85rem, 2.2vw, 2.35rem);
  letter-spacing: -0.05em;
}

.stat-content p,
.stat-card p {
  margin: 0;
  font-size: 0.88rem;
}

.helpdesk-command-bar,
.customer-command-bar,
.ticket-toolbar {
  gap: 12px;
}

.helpdesk-command-bar .command-main,
.customer-command-bar .command-main {
  gap: 12px;
}

.helpdesk-command-bar .command-actions,
.customer-command-bar .command-actions {
  gap: 10px;
}

.helpdesk-command-bar .search-box.large,
.customer-command-bar .search-box.large {
  min-height: 46px;
  border-radius: 14px;
}

.card-actions,
.header-actions {
  gap: 10px;
}

@media (max-width: 1180px) {
  .sidebar {
    gap: 10px;
  }

  .sidebar-brand {
    min-width: 0;
  }

  .sidebar-footer {
    min-width: 200px;
  }
}

@media (max-width: 1024px) {
  .sidebar,
  .sidebar.open {
    gap: 10px;
  }

  .sidebar-nav {
    gap: 7px;
  }

  .sidebar-footer {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

/* OnlineServices helpdesk workflow redesign */
:root {
  --os-helpdesk-shell: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 244, 237, 0.96));
  --os-helpdesk-panel: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 244, 237, 0.94));
  --os-helpdesk-panel-strong: linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(244, 239, 231, 0.96));
  --os-helpdesk-border: rgba(204, 174, 146, 0.48);
  --os-helpdesk-text: #182331;
  --os-helpdesk-muted: #627285;
  --os-helpdesk-subtle: #8795a7;
  --os-helpdesk-shadow: 0 18px 42px rgba(71, 53, 36, 0.08);
}

[data-theme="dark"] {
  --os-helpdesk-shell: linear-gradient(180deg, rgba(19, 23, 30, 0.98), rgba(14, 17, 23, 0.96));
  --os-helpdesk-panel: linear-gradient(180deg, rgba(23, 29, 38, 0.96), rgba(18, 22, 29, 0.94));
  --os-helpdesk-panel-strong: linear-gradient(180deg, rgba(30, 36, 47, 0.96), rgba(21, 26, 34, 0.96));
  --os-helpdesk-border: rgba(148, 163, 184, 0.18);
  --os-helpdesk-text: #edf2f8;
  --os-helpdesk-muted: #9aa7b6;
  --os-helpdesk-subtle: #7d8a99;
  --os-helpdesk-shadow: 0 22px 44px rgba(0, 0, 0, 0.3);
}

#helpdesk-panel {
  gap: 16px;
}

#helpdesk-panel > .panel-header {
  padding: 2px 4px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#helpdesk-panel > .panel-header::before {
  display: none;
}

#helpdesk-panel > .panel-header h1 {
  margin: 0 0 0.2rem;
  font-size: clamp(1.55rem, 1.9vw, 1.95rem);
  letter-spacing: -0.05em;
}

#helpdesk-panel > .panel-header p {
  margin: 0;
  color: var(--os-helpdesk-muted);
}

#helpdesk-panel .helpdesk-command-bar {
  padding: 18px;
  border-radius: 28px;
  background: var(--os-helpdesk-shell);
  border-color: var(--os-helpdesk-border);
  box-shadow: var(--os-helpdesk-shadow);
}

#helpdesk-panel .helpdesk-command-bar::before,
#helpdesk-panel .ticket-toolbar::before,
#issue-detail-panel::before {
  display: none;
}

#helpdesk-panel .helpdesk-command-bar .command-main {
  display: grid;
  grid-template-columns: minmax(320px, 1.25fr) minmax(0, 1fr);
  align-items: start;
  gap: 14px;
}

#helpdesk-panel .helpdesk-command-bar .command-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

#helpdesk-panel .helpdesk-command-bar .search-box.large {
  min-height: 56px;
  padding: 0 12px 0 16px;
  border-radius: 18px;
  border: 1px solid var(--os-helpdesk-border);
  background: var(--os-helpdesk-panel);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

#helpdesk-panel .helpdesk-command-bar .search-box.large input {
  font-size: 1rem;
  color: var(--os-helpdesk-text);
}

#helpdesk-panel .helpdesk-command-bar .search-box.large i {
  color: #dd6d3d;
}

#helpdesk-panel .helpdesk-command-bar .btn-primary,
#helpdesk-panel .helpdesk-command-bar .btn-secondary,
#helpdesk-panel .helpdesk-command-bar .compact-select,
#helpdesk-panel .helpdesk-command-bar select {
  min-height: 44px;
  border-radius: 14px;
}

#helpdesk-panel .helpdesk-action-dropdown > summary {
  list-style: none;
}

#helpdesk-panel .helpdesk-action-dropdown[open] > summary {
  border-color: rgba(223, 107, 59, 0.24);
  box-shadow: 0 12px 24px rgba(71, 53, 36, 0.08);
}

#helpdesk-panel .helpdesk-action-dropdown[open] > summary::-webkit-details-marker {
  display: none;
}

#helpdesk-panel .helpdesk-filter-bar,
#helpdesk-panel .helpdesk-views-panel {
  margin-top: 12px;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid var(--os-helpdesk-border);
  background: var(--os-helpdesk-panel-strong);
  box-shadow: none;
}

#helpdesk-panel .saved-view-form {
  background: transparent;
  border-color: var(--os-helpdesk-border);
}

#helpdesk-panel .saved-view-form input[type="text"] {
  background: var(--os-helpdesk-panel-strong);
  border-color: var(--os-helpdesk-border);
  color: var(--os-helpdesk-text);
}

#helpdesk-panel .command-meta {
  padding-top: 8px;
  border-top: 1px solid var(--os-helpdesk-border);
}

#helpdesk-panel .filter-chip-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

#helpdesk-panel .filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#helpdesk-panel .helpdesk-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 22px;
  border: 1px solid rgba(223, 107, 59, 0.18);
  background:
    radial-gradient(circle at top right, rgba(223, 107, 59, 0.12), transparent 28%),
    linear-gradient(180deg, rgba(255, 253, 249, 0.98), rgba(247, 242, 234, 0.96));
  color: #5f6f82;
  box-shadow: var(--os-helpdesk-shadow);
}

#helpdesk-panel .helpdesk-banner::before {
  content: "Workflow";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.34rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(223, 107, 59, 0.18);
  background: rgba(223, 107, 59, 0.08);
  color: #b45522;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}

[data-theme="dark"] #helpdesk-panel .helpdesk-banner {
  border-color: rgba(148, 163, 184, 0.18);
  background:
    radial-gradient(circle at top right, rgba(79, 70, 229, 0.14), transparent 28%),
    linear-gradient(180deg, rgba(22, 27, 36, 0.96), rgba(16, 20, 28, 0.96));
  color: #b7c0cb;
}

[data-theme="dark"] #helpdesk-panel .helpdesk-banner::before {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  color: #f6c7a8;
}

#helpdesk-panel .helpdesk-grid {
  gap: 16px;
  align-items: start;
}

#helpdesk-panel .tickets-column {
  gap: 12px;
}

#helpdesk-panel .ticket-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 0;
  border-radius: 22px;
  border: 1px solid var(--os-helpdesk-border);
  background: var(--os-helpdesk-panel);
  box-shadow: var(--os-helpdesk-shadow);
}

#helpdesk-panel .ticket-toolbar .toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

#helpdesk-panel .ticket-toolbar .toolbar-right {
  justify-self: end;
  color: var(--os-helpdesk-muted);
}

#helpdesk-panel .ticket-toolbar .select-all,
#helpdesk-panel .ticket-toolbar .compact-select {
  min-height: 40px;
  border-radius: 14px;
  border: 1px solid var(--os-helpdesk-border);
  background: var(--os-helpdesk-panel-strong);
  color: var(--os-helpdesk-text);
}

#helpdesk-panel .ticket-toolbar .select-all {
  padding: 0 12px;
}

#helpdesk-panel .ticket-toolbar .inline-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

#helpdesk-panel .ticket-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#helpdesk-panel .ticket-list-pagination {
  justify-content: center;
  margin-top: 16px;
}

#helpdesk-panel .ticket-card-wrap {
  position: relative;
}

#helpdesk-panel .ticket-card {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  padding: 15px 16px 15px 18px;
  border-radius: 22px;
  border: 1px solid var(--os-helpdesk-border);
  background: var(--os-helpdesk-panel);
  box-shadow: 0 14px 28px rgba(71, 53, 36, 0.07);
  overflow: hidden;
}

#helpdesk-panel .ticket-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 4px;
  border-radius: 999px;
  background: var(--ticket-accent, #4b9bff);
}

#helpdesk-panel .ticket-card:hover {
  transform: translateY(-2px);
  border-color: rgba(223, 107, 59, 0.28);
  box-shadow: 0 18px 34px rgba(71, 53, 36, 0.1);
}

#helpdesk-panel .ticket-card.selected {
  border-color: rgba(79, 70, 229, 0.34);
  box-shadow: 0 0 0 1px rgba(79, 70, 229, 0.1), 0 16px 30px rgba(71, 53, 36, 0.09);
}

#helpdesk-panel .ticket-card.active-detail {
  border-color: rgba(223, 107, 59, 0.34);
  box-shadow: 0 0 0 1px rgba(223, 107, 59, 0.12), 0 18px 34px rgba(71, 53, 36, 0.1);
}

[data-theme="dark"] #helpdesk-panel .ticket-card {
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.28);
}

[data-theme="dark"] #helpdesk-panel .ticket-card:hover,
[data-theme="dark"] #helpdesk-panel .ticket-card.active-detail {
  box-shadow: 0 24px 46px rgba(0, 0, 0, 0.34);
}

#helpdesk-panel .ticket-checkbox {
  width: 38px;
  height: 38px;
  margin-top: 2px;
  border-radius: 13px;
  border: 1px solid var(--os-helpdesk-border);
  background: var(--os-helpdesk-panel-strong);
}

#helpdesk-panel .ticket-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#helpdesk-panel .ticket-topline,
#helpdesk-panel .ticket-footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

#helpdesk-panel .ticket-reference-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

#helpdesk-panel .ticket-reference {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(223, 107, 59, 0.08);
  color: #b45522;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

[data-theme="dark"] #helpdesk-panel .ticket-reference {
  background: rgba(255, 255, 255, 0.08);
  color: #ffcfb2;
}

#helpdesk-panel .ticket-activity-label,
#helpdesk-panel .ticket-footnote {
  color: var(--os-helpdesk-subtle);
  font-size: 0.8rem;
}

#helpdesk-panel .ticket-status-stack {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

#helpdesk-panel .ticket-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

#helpdesk-panel .ticket-title-stack {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

#helpdesk-panel .ticket-avatar-badge {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--ticket-accent, #4b9bff), rgba(16, 24, 40, 0.35));
  color: #fff;
  font-size: 0.88rem;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

#helpdesk-panel .ticket-details h4 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.2;
  letter-spacing: -0.03em;
  color: var(--os-helpdesk-text);
}

#helpdesk-panel .ticket-subtitle {
  margin: 3px 0 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--os-helpdesk-muted);
  font-size: 0.94rem;
}

#helpdesk-panel .ticket-dot {
  opacity: 0.45;
}

#helpdesk-panel .ticket-severity-chip {
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
}

#helpdesk-panel .ticket-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

#helpdesk-panel .ticket-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--os-helpdesk-border);
  background: var(--os-helpdesk-panel-strong);
  color: var(--os-helpdesk-muted);
  font-size: 0.78rem;
}

#helpdesk-panel .ticket-assignee-pill {
  font: inherit;
  appearance: none;
}

#helpdesk-panel .ticket-assignee-pill.actionable {
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}

#helpdesk-panel .ticket-assignee-pill.actionable:hover,
#helpdesk-panel .ticket-assignee-pill.actionable:focus-visible {
  border-color: rgba(223, 107, 59, 0.28);
  background: rgba(223, 107, 59, 0.08);
  color: #b45522;
  transform: translateY(-1px);
}

#helpdesk-panel .ticket-pill.sla-ok {
  border-color: rgba(40, 178, 125, 0.26);
  background: rgba(40, 178, 125, 0.08);
  color: #1f8b63;
}

#helpdesk-panel .ticket-pill.sla-warning {
  border-color: rgba(240, 163, 51, 0.3);
  background: rgba(240, 163, 51, 0.1);
  color: #a05d08;
}

#helpdesk-panel .ticket-pill.sla-danger {
  border-color: rgba(228, 103, 95, 0.3);
  background: rgba(228, 103, 95, 0.1);
  color: #b63a36;
}

[data-theme="dark"] #helpdesk-panel .ticket-pill.sla-ok {
  color: #8de5be;
}

[data-theme="dark"] #helpdesk-panel .ticket-pill.sla-warning {
  color: #ffd48f;
}

[data-theme="dark"] #helpdesk-panel .ticket-pill.sla-danger {
  color: #ffb2ab;
}

#helpdesk-panel .ticket-preview {
  margin: 0;
  color: var(--os-helpdesk-muted);
  line-height: 1.48;
  max-width: 76ch;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

#helpdesk-panel .ticket-footer-row {
  padding-top: 1px;
  border-top: 1px dashed rgba(148, 163, 184, 0.24);
}

#helpdesk-panel .ticket-inline-hint {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(223, 107, 59, 0.08);
  color: #b45522;
  font-size: 0.69rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#helpdesk-panel .ticket-expand {
  align-self: center;
  width: 38px;
  height: 38px;
  border-radius: 13px;
  border: 1px solid var(--os-helpdesk-border);
  background: var(--os-helpdesk-panel-strong);
  color: var(--os-helpdesk-muted);
}

#helpdesk-panel .ticket-card.active-detail .ticket-expand {
  background: rgba(223, 107, 59, 0.1);
  border-color: rgba(223, 107, 59, 0.24);
  color: #b45522;
}

#issue-detail-panel {
  border-radius: 28px;
  border: 1px solid var(--os-helpdesk-border);
  background: var(--os-helpdesk-shell);
  box-shadow: var(--os-helpdesk-shadow);
}

#issue-detail-panel #issue-detail-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#issue-detail-panel .issue-detail-head.sticky {
  padding: 0 0 12px;
  margin-bottom: 0;
  background: transparent !important;
  border-bottom: 1px solid var(--os-helpdesk-border) !important;
  box-shadow: none;
}

#issue-detail-panel .issue-detail-titles h3 {
  margin: 0;
  font-size: clamp(1.35rem, 1.8vw, 1.68rem);
  letter-spacing: -0.04em;
  color: var(--os-helpdesk-text);
}

#issue-detail-panel #issue-view-meta {
  color: var(--os-helpdesk-muted) !important;
}

#issue-detail-panel .issue-detail-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

#issue-detail-panel .watchers-disclosure {
  position: relative;
}

#issue-detail-panel .watchers-summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 64px;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--os-helpdesk-border);
  background: var(--os-helpdesk-panel-strong);
  color: var(--os-helpdesk-muted);
  cursor: pointer;
}

#issue-detail-panel .watchers-summary::-webkit-details-marker {
  display: none;
}

#issue-detail-panel .watchers-summary i {
  font-size: 0.96rem;
}

#issue-detail-panel .watchers-summary span {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--os-helpdesk-text);
}

#issue-detail-panel .watchers-disclosure[open] .watchers-summary {
  border-color: rgba(223, 107, 59, 0.24);
  background: rgba(223, 107, 59, 0.08);
  color: #b45522;
}

#issue-detail-panel .watchers-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 20;
  min-width: 280px;
  max-width: min(340px, calc(100vw - 48px));
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--os-helpdesk-border);
  background: var(--os-helpdesk-panel);
  box-shadow: var(--os-helpdesk-shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#issue-detail-panel .watchers-popover .eyebrow {
  margin: 0;
}

#issue-detail-panel .watchers-popover .watcher-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#issue-detail-panel .watchers-popover .watcher-chip {
  cursor: default;
}

#issue-detail-panel .watchers-popover .btn-secondary {
  align-self: flex-end;
}

#issue-detail-panel .wallpaper-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 16px;
  border: 1px solid var(--os-helpdesk-border);
  background: var(--os-helpdesk-panel-strong);
}

#issue-detail-panel .wallpaper-picker label {
  margin: 0;
}

#issue-detail-panel .wallpaper-select,
#issue-detail-panel #issue-view-status-select,
#issue-detail-panel #issue-next-step-input,
#issue-detail-panel textarea,
#issue-detail-panel input,
#issue-detail-panel select,
#issue-detail-panel .comment-form input[type="file"] {
  background: var(--os-helpdesk-panel-strong) !important;
  border: 1px solid var(--os-helpdesk-border) !important;
  color: var(--os-helpdesk-text) !important;
}

#issue-detail-panel .issue-triage-bar,
#issue-detail-panel .issue-detail-description,
#issue-detail-panel .issue-context,
#issue-detail-panel .issue-next-step,
#issue-detail-panel .detail-tabs,
#issue-detail-panel .detail-pane,
#issue-detail-panel .issue-comments,
#issue-detail-panel .issue-timeline-header,
#issue-detail-panel .comment-form,
#issue-detail-panel .issue-detail-status-row {
  background: var(--os-helpdesk-panel) !important;
  border: 1px solid var(--os-helpdesk-border) !important;
  box-shadow: none !important;
}

#issue-detail-panel .issue-triage-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  padding: 14px 18px;
  border-radius: 22px;
}

#issue-detail-panel .triage-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

#issue-detail-panel .triage-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

#issue-detail-panel .triage-field > .muted.small {
  margin: 0;
  color: var(--os-helpdesk-muted);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
}

#issue-detail-panel .triage-field .chip,
#issue-detail-panel .triage-field select {
  min-height: 40px;
}

#issue-detail-panel .triage-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

#issue-detail-panel #issue-meta-row {
  display: flex !important;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px 18px;
  padding: 0 0 14px;
  margin: 0 0 14px;
  border-bottom: 1px solid var(--os-helpdesk-border);
  background: transparent !important;
  border-radius: 0;
  border-top: 0 !important;
  border-left: 0 !important;
  border-right: 0 !important;
}

#issue-detail-panel .detail-stat {
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent !important;
  flex: 0 1 auto;
}

#issue-detail-panel .detail-stat-label {
  display: block;
  margin-bottom: 2px;
  color: var(--os-helpdesk-muted);
  font-size: 0.64rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#issue-detail-panel .detail-stat strong {
  display: block;
  color: var(--os-helpdesk-text);
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.35;
}

#issue-detail-panel .detail-stat-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

#issue-detail-panel .detail-stat-sla {
  min-width: min(320px, 100%);
}

#issue-detail-panel #issue-meta-row.limited-meta {
  gap: 10px 18px;
}

#issue-detail-panel .issue-detail-description #issue-view-description {
  margin-bottom: 0;
}

#issue-detail-panel .issue-fyi-bar .chip {
  min-height: 32px;
  padding: 0.35rem 0.7rem;
  font-size: 0.85rem;
}

#issue-detail-panel .issue-fyi-bar #issue-view-sla-detail {
  font-size: 0.8rem;
  line-height: 1.45;
}

@media (max-width: 900px) {
  #issue-detail-panel .issue-triage-bar {
    align-items: flex-start;
  }

  #issue-detail-panel .triage-actions {
    width: 100%;
    justify-content: flex-start;
  }

  #issue-detail-panel .issue-timeline-header,
  #issue-detail-panel .mentions-helper,
  #issue-detail-panel .watchers {
    justify-content: flex-start;
  }

  #issue-detail-panel #issue-meta-row {
    gap: 10px 14px;
  }
}

#issue-detail-panel .issue-detail-description,
#issue-detail-panel .detail-pane,
#issue-detail-panel .issue-next-step,
#issue-detail-panel .issue-context {
  padding: 16px 18px;
  border-radius: 22px;
}

#issue-detail-panel .issue-comments,
#issue-detail-panel .issue-history {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: transparent !important;
  border: 0 !important;
  padding: 0 !important;
}

#issue-detail-panel .issue-timeline-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  background: transparent !important;
  border: 0 !important;
  padding: 0 !important;
  margin-bottom: 0;
}

#issue-detail-panel .mentions-helper {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 8px 12px;
  max-width: min(360px, 100%);
}

#issue-detail-panel .mentions-helper > p {
  margin: 0;
}

#issue-detail-panel .watchers {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

#issue-detail-panel .watchers label {
  margin: 0;
  flex-basis: 100%;
}

#issue-detail-panel .issue-thread,
#issue-detail-panel .issue-history-stream {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--os-helpdesk-border);
  border-radius: 20px;
  background: var(--os-helpdesk-panel-strong);
  overflow: hidden;
}

#issue-detail-panel .issue-thread .comment-entry,
#issue-detail-panel .issue-history-stream .history-entry {
  padding: 14px 16px;
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--os-helpdesk-border);
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
}

#issue-detail-panel .issue-thread .comment-entry:last-child,
#issue-detail-panel .issue-history-stream .history-entry:last-child {
  border-bottom: 0;
}

#issue-detail-panel .issue-thread .comment-entry .meta,
#issue-detail-panel .issue-history-stream .history-entry .meta {
  margin-bottom: 6px;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--os-helpdesk-muted);
}

#issue-detail-panel .issue-thread .comment-entry .comment-body,
#issue-detail-panel .issue-history-stream .history-entry .comment-body {
  line-height: 1.6;
  white-space: pre-wrap;
}

#issue-detail-panel .thread-empty {
  margin: 0;
  padding: 14px 16px;
}

#issue-detail-panel .detail-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  border-radius: 18px;
}

#issue-detail-panel .detail-tab-btn {
  min-height: 38px;
  border-radius: 999px;
  border: 1px solid var(--os-helpdesk-border);
  background: var(--os-helpdesk-panel-strong);
  color: var(--os-helpdesk-muted);
}

#issue-detail-panel .detail-tab-btn.active {
  background: rgba(223, 107, 59, 0.12);
  border-color: rgba(223, 107, 59, 0.22);
  color: #b45522;
  box-shadow: none;
}

[data-theme="dark"] #issue-detail-panel .detail-tab-btn.active {
  color: #ffd1b4;
}

#issue-detail-panel .issue-timeline-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
}

#issue-detail-panel .mentions-helper {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px 12px;
  max-width: min(360px, 100%);
}

#issue-detail-panel .watchers,
#issue-detail-panel .watcher-list {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

#issue-detail-panel .watchers label {
  flex-basis: 100%;
}

#issue-detail-panel #issue-comments {
  display: grid;
  gap: 10px;
}

#issue-detail-panel .comment-entry {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--os-helpdesk-border);
  background: var(--os-helpdesk-panel-strong) !important;
  box-shadow: none;
}

#issue-detail-panel .comment-entry .meta {
  margin-bottom: 8px;
  color: var(--os-helpdesk-muted) !important;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#issue-detail-panel .comment-entry .comment-body,
#issue-detail-panel .attachment-meta,
#issue-detail-panel .attachment-link,
#issue-detail-panel #issue-view-description {
  color: var(--os-helpdesk-text) !important;
}

#issue-detail-panel .comment-form {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 22px;
}

#issue-detail-panel .comment-form textarea {
  min-height: 120px;
}

#issue-detail-panel .comment-actions {
  display: flex;
  justify-content: flex-end;
}

#issue-detail-panel .issue-attachments-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

#issue-detail-panel .attachment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

#issue-detail-panel .attachment-card {
  border-radius: 18px;
  border: 1px solid var(--os-helpdesk-border);
  background: var(--os-helpdesk-panel-strong) !important;
  box-shadow: none;
}

#issue-detail-panel .watcher-chip,
#issue-detail-panel .mention-chip,
#issue-detail-panel .issue-detail-tags .chip,
#issue-detail-panel .issue-triage-bar .chip,
#issue-detail-panel #issue-view-sla {
  border-color: var(--os-helpdesk-border) !important;
  background: var(--os-helpdesk-panel-strong) !important;
  color: var(--os-helpdesk-text) !important;
}

#issue-detail-panel #issue-view-sla.sla-ok {
  background: rgba(40, 178, 125, 0.08) !important;
  border-color: rgba(40, 178, 125, 0.24) !important;
  color: #1f8b63 !important;
}

#issue-detail-panel #issue-view-sla.sla-warning {
  background: rgba(240, 163, 51, 0.1) !important;
  border-color: rgba(240, 163, 51, 0.28) !important;
  color: #a05d08 !important;
}

#issue-detail-panel #issue-view-sla.sla-danger {
  background: rgba(228, 103, 95, 0.1) !important;
  border-color: rgba(228, 103, 95, 0.28) !important;
  color: #b63a36 !important;
}

[data-theme="dark"] #issue-detail-panel #issue-view-sla.sla-ok {
  color: #8de5be !important;
}

[data-theme="dark"] #issue-detail-panel #issue-view-sla.sla-warning {
  color: #ffd48f !important;
}

[data-theme="dark"] #issue-detail-panel #issue-view-sla.sla-danger {
  color: #ffb2ab !important;
}

@media (min-width: 1101px) {
  #helpdesk-panel.split-view .helpdesk-grid {
    grid-template-columns: minmax(560px, 1.08fr) minmax(380px, 0.92fr);
    gap: 16px;
  }

  #helpdesk-panel.split-view #issue-detail-panel.inline {
    top: 0;
    max-height: calc(100vh - 5.5rem);
  }
}

@media (max-width: 1180px) {
  #helpdesk-panel .helpdesk-command-bar .command-main {
    grid-template-columns: 1fr;
  }

  #helpdesk-panel .helpdesk-command-bar .command-actions {
    justify-content: flex-start;
  }

  #issue-detail-panel #issue-meta-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  #helpdesk-panel .ticket-toolbar {
    grid-template-columns: 1fr;
  }

  #helpdesk-panel .ticket-toolbar .toolbar-right {
    justify-self: start;
  }

  #issue-detail-panel .issue-triage-bar,
  #issue-detail-panel .issue-timeline-header {
    grid-template-columns: 1fr;
  }

  #issue-detail-panel .mentions-helper {
    justify-content: flex-start;
    max-width: 100%;
  }

  #issue-detail-panel #issue-meta-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  #helpdesk-panel > .panel-header {
    padding-inline: 0;
  }

  #helpdesk-panel .helpdesk-command-bar,
  #helpdesk-panel .ticket-toolbar,
  #issue-detail-panel {
    border-radius: 22px;
  }

  #helpdesk-panel .ticket-card {
    grid-template-columns: auto minmax(0, 1fr);
    padding: 16px 16px 16px 18px;
  }

  #helpdesk-panel .ticket-title-row {
    grid-template-columns: 1fr;
  }

  #helpdesk-panel .ticket-severity-chip {
    justify-content: flex-start;
  }

  #helpdesk-panel .ticket-expand {
    display: none;
  }

  #issue-detail-panel #issue-meta-row {
    grid-template-columns: 1fr;
  }

  #issue-detail-panel .issue-detail-actions,
  #issue-detail-panel .triage-actions {
    justify-content: flex-start;
  }
}

/* OnlineServices final shell nav pass */
@media (min-width: 981px) {
  .sidebar,
  .sidebar.open {
    display: grid !important;
    grid-template-columns: minmax(136px, 180px) minmax(0, 1fr) minmax(168px, 220px) !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 10px clamp(12px, 1.35vw, 18px) 4px !important;
  }

  .sidebar-brand {
    min-width: 0;
    width: 100%;
    max-width: 180px;
    min-height: 52px;
    padding: 8px 10px;
    margin: 0;
  }

  .sidebar-brand .brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    font-size: 1.05rem;
  }

  .brand-copy {
    min-width: 0;
  }

  .brand-title {
    font-size: 0.94rem;
  }

  .brand-subtitle {
    max-width: 22ch;
    font-size: 0.74rem;
  }

  .sidebar-nav {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    min-width: 0;
    width: 100%;
    padding: 0 !important;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }

  .sidebar-nav::-webkit-scrollbar {
    display: none;
  }

  .sidebar-nav .nav-btn,
  .nav-btn {
    display: inline-flex;
    flex: 0 0 auto !important;
    width: auto !important;
    max-width: none !important;
    min-height: 36px;
    padding: 0 10px 0 8px;
    border-radius: 999px;
    white-space: nowrap;
    justify-content: center;
    gap: 6px;
  }

  .sidebar-nav .nav-btn i {
    width: 20px;
    height: 20px;
    border-radius: 7px;
    font-size: 0.82rem;
  }

  .sidebar-nav .nav-btn span {
    font-size: 0.84rem;
  }

  .sidebar-footer {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    min-width: 0;
    width: 100%;
    max-width: 220px;
    margin-top: 0 !important;
    padding-top: 0 !important;
    border-top: 0 !important;
  }

  .user-chip {
    width: 100%;
    min-width: 0 !important;
    max-width: 220px;
    min-height: 52px;
    padding: 8px 10px;
    gap: 8px;
  }

  .user-chip .user-avatar,
  .user-chip .btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
  }

  .user-info {
    min-width: 0;
    flex: 1 1 auto;
    gap: 0;
  }

  #current-user-name,
  #current-user-email,
  #current-user-role {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #current-user-name {
    font-size: 0.82rem;
  }

  #current-user-role {
    font-size: 0.72rem;
  }

  #current-user-email {
    display: none;
  }
}

@media (max-width: 980px) {
  .sidebar,
  .sidebar.open {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .sidebar-nav {
    justify-content: flex-start !important;
  }
}

/* OnlineServices shell + helpdesk bugfix pass */
.app-shell {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  grid-template-rows: auto minmax(0, 1fr);
  align-content: start;
}

.sidebar,
.sidebar.open {
  z-index: 6;
}

.main-panel {
  min-width: 0;
  width: 100%;
  overflow-x: clip;
}

.main-toolbar {
  position: static !important;
  top: auto !important;
  z-index: 1 !important;
}

@media (min-width: 981px) {
  .sidebar-nav {
    justify-content: flex-start !important;
  }
}

#helpdesk-panel .helpdesk-command-bar .command-meta.hidden {
  display: none !important;
}

#helpdesk-panel .helpdesk-command-bar {
  gap: 14px;
}

#helpdesk-panel .helpdesk-command-bar .command-actions {
  align-items: flex-start;
}

#helpdesk-panel .ticket-toolbar {
  position: static !important;
  top: auto !important;
  z-index: 1 !important;
  margin-top: 0 !important;
  margin-bottom: 12px !important;
}

#helpdesk-panel .ticket-toolbar:not(.has-selection) {
  grid-template-columns: auto 1fr;
}

#helpdesk-panel .ticket-toolbar:not(.has-selection) .toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

#helpdesk-panel .ticket-toolbar:not(.has-selection) .toolbar-left > button,
#helpdesk-panel .ticket-toolbar:not(.has-selection) .toolbar-left > .inline-field {
  display: none !important;
}

#helpdesk-panel .ticket-card-wrap {
  overflow: visible;
}

body.helpdesk-reporter-mode #helpdesk-panel .helpdesk-command-bar {
  padding-bottom: 16px;
}

body.helpdesk-reporter-mode #helpdesk-panel .helpdesk-banner {
  margin-top: -4px;
}

body.helpdesk-reporter-mode #helpdesk-panel .ticket-toolbar {
  display: none !important;
}

/* OnlineServices unified helpdesk RBAC pass */
#helpdesk-panel .helpdesk-banner::before {
  content: attr(data-role-label);
}

#helpdesk-panel .helpdesk-banner[data-role-label=""]::before {
  display: none;
}

#helpdesk-panel .helpdesk-command-bar .command-actions > * {
  flex: 0 0 auto;
}

#helpdesk-panel .ticket-view-btn {
  min-height: 36px;
  padding-inline: 0.85rem;
}

#helpdesk-panel .ticket-status-stack .chip,
#helpdesk-panel .ticket-severity-chip .chip {
  min-height: 34px;
}

#helpdesk-panel .ticket-chip-select-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

#helpdesk-panel .ticket-chip-select-wrap::after {
  content: "\f078";
  position: absolute;
  right: 11px;
  top: 50%;
  transform: translateY(-50%);
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-size: 0.68rem;
  opacity: 0.72;
  pointer-events: none;
}

#helpdesk-panel .ticket-chip-select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  background: var(--os-helpdesk-panel-strong);
  padding-right: 1.9rem;
  line-height: 1;
}

#helpdesk-panel .ticket-chip-select[data-ticket-status-select] {
  min-width: 138px;
}

#helpdesk-panel .ticket-chip-select[data-ticket-severity-select] {
  min-width: 112px;
}

#helpdesk-panel .ticket-chip-select:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(75, 155, 255, 0.18);
}

#helpdesk-panel .ticket-chip-select option {
  color: #0f172a;
}

#helpdesk-panel .ticket-footer-row {
  align-items: center;
}

#helpdesk-panel .ticket-inline-hint {
  letter-spacing: 0.1em;
}

#issue-detail-panel .wallpaper-picker {
  display: none !important;
}

#issue-detail-panel .issue-detail-actions {
  justify-content: flex-end;
}

#helpdesk-panel .helpdesk-grid {
  grid-template-columns: minmax(0, 1fr);
}

#helpdesk-panel .ticket-detail-shelf {
  display: none;
}

@media (min-width: 1280px) {
  #helpdesk-panel.split-view .helpdesk-grid {
    grid-template-columns: minmax(580px, 1.06fr) minmax(420px, 0.94fr) !important;
  }

  #helpdesk-panel.split-view .ticket-detail-shelf {
    display: block;
  }

  #helpdesk-panel.split-view #issue-detail-panel.inline {
    position: sticky;
    top: 0;
    max-height: calc(100vh - 5rem);
  }
}

/* OnlineServices redundant toolbar removal */
.app-shell.hidden,
#app-shell.hidden {
  display: none !important;
}

/* OnlineServices helpdesk command-bar polish */
#helpdesk-panel .helpdesk-command-bar {
  padding: 16px 18px 14px;
}

#helpdesk-panel .helpdesk-command-bar .command-main {
  grid-template-columns: minmax(320px, 1fr) auto;
  align-items: center;
  gap: 12px;
}

#helpdesk-panel .helpdesk-command-bar .search-box.large {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  padding: 0;
  overflow: hidden;
}

#helpdesk-panel .helpdesk-command-bar .search-box.large i {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 1;
}

#helpdesk-panel .helpdesk-command-bar .search-box.large input {
  width: 100%;
  min-width: 0;
  min-height: 54px;
  padding: 0 18px 0 52px !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

#helpdesk-panel .helpdesk-command-bar .search-box.large input::placeholder {
  color: var(--os-helpdesk-muted);
}

#helpdesk-panel .helpdesk-command-bar .command-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
  scrollbar-width: none;
}

#helpdesk-panel .helpdesk-command-bar .command-actions::-webkit-scrollbar {
  display: none;
}

#helpdesk-panel .helpdesk-command-bar .btn-primary,
#helpdesk-panel .helpdesk-command-bar .btn-secondary,
#helpdesk-panel .helpdesk-command-bar .compact-select,
#helpdesk-panel .helpdesk-command-bar select,
#helpdesk-panel .helpdesk-action-dropdown > summary {
  min-height: 42px;
  padding: 0 14px;
  border-radius: 16px;
  white-space: nowrap;
}

#helpdesk-panel .helpdesk-command-bar .btn-primary {
  padding-inline: 18px;
}

#helpdesk-panel .helpdesk-command-bar #refresh-issues {
  width: 42px;
  min-width: 42px;
  padding: 0;
}

#helpdesk-panel .helpdesk-command-bar .btn-secondary,
#helpdesk-panel .helpdesk-action-dropdown > summary,
#helpdesk-panel .helpdesk-command-bar .compact-select,
#helpdesk-panel .helpdesk-command-bar select {
  background: var(--os-helpdesk-panel-strong);
  box-shadow: none;
}

.main-toolbar {
  display: none !important;
}

.main-panel {
  gap: 18px !important;
  padding-top: 12px !important;
}

@media (min-width: 1280px) {
  #helpdesk-panel.split-view #issue-detail-panel.inline {
    top: 12px !important;
    max-height: calc(100vh - 6rem) !important;
  }
}

@media (max-width: 1180px) {
  #helpdesk-panel .helpdesk-command-bar .command-main {
    grid-template-columns: 1fr;
    align-items: start;
  }

  #helpdesk-panel .helpdesk-command-bar .command-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
    overflow: visible;
  }
}

/* Ticket detail polish */
#issue-detail-panel .issue-detail-description {
  position: relative;
  padding: 20px 22px 22px 24px !important;
  border-color: rgba(223, 107, 59, 0.22) !important;
  background: linear-gradient(135deg, rgba(223, 107, 59, 0.08), rgba(255, 255, 255, 0.02)) !important;
}

#issue-detail-panel .issue-detail-description::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 18px;
  bottom: 18px;
  width: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, #df6b3b, rgba(223, 107, 59, 0.18));
}

#issue-detail-panel .issue-detail-description .eyebrow {
  margin-left: 18px;
  color: #b45522 !important;
}

#issue-detail-panel .issue-detail-description #issue-view-description {
  margin: 10px 0 0 18px;
  max-width: 72ch;
  font-size: 1.08rem;
  line-height: 1.72;
  font-weight: 500;
  white-space: pre-wrap;
  color: var(--os-helpdesk-text) !important;
}

[data-theme="light"] #issue-detail-panel .issue-detail-description {
  background: linear-gradient(135deg, rgba(247, 170, 138, 0.18), rgba(255, 255, 255, 0.92)) !important;
}

#issue-detail-panel #issue-comments.issue-thread {
  display: flex !important;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  border-radius: 22px;
  border: 1px solid var(--os-helpdesk-border);
  background: var(--os-helpdesk-panel-strong);
}

#issue-detail-panel #issue-comments.issue-thread .comment-entry {
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

#issue-detail-panel #issue-comments.issue-thread .comment-entry + .comment-entry {
  margin-top: 0 !important;
}

#issue-detail-panel #issue-comments.issue-thread .comment-entry .meta {
  margin: 0 0 8px;
  padding: 0 4px;
}

#issue-detail-panel #issue-comments.issue-thread .comment-entry .comment-body {
  display: block;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(255, 255, 255, 0.04);
  line-height: 1.65;
}

[data-theme="light"] #issue-detail-panel #issue-comments.issue-thread .comment-entry .comment-body {
  background: rgba(255, 255, 255, 0.84);
  border-color: rgba(215, 222, 234, 0.92);
}

/* OnlineServices mobile helpdesk rescue */
@media (max-width: 820px) {
  .sidebar,
  .sidebar.open {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: start !important;
    gap: 10px !important;
    padding: 8px 10px 4px !important;
    position: static !important;
    top: auto !important;
    transform: none !important;
    height: auto !important;
    overflow: visible !important;
  }

  .sidebar-brand {
    width: 100% !important;
    max-width: none !important;
    min-height: auto !important;
    padding: 12px 14px !important;
    border-radius: 18px !important;
  }

  .sidebar-brand .brand-mark {
    width: 54px !important;
    height: 54px !important;
    flex: 0 0 54px !important;
    border-radius: 18px !important;
  }

  .brand-title {
    font-size: 0.98rem !important;
    line-height: 1.08 !important;
  }

  .brand-subtitle {
    max-width: none !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    line-height: 1.2 !important;
  }

  .sidebar-nav {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 8px !important;
    width: 100% !important;
    padding: 2px 2px 6px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar-nav .nav-btn,
  .nav-btn {
    display: inline-flex !important;
    flex: 0 0 auto !important;
    width: auto !important;
    max-width: none !important;
    min-height: 42px !important;
    padding: 0 12px 0 10px !important;
    border-radius: 999px !important;
    white-space: nowrap !important;
  }

  .sidebar-footer {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
  }

  .user-chip {
    width: 100% !important;
    max-width: none !important;
    min-height: auto !important;
    padding: 12px !important;
  }

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

  #current-user-name,
  #current-user-email {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .main-panel {
    gap: 14px !important;
    padding-top: 10px !important;
  }

  .main-toolbar {
    padding: 10px !important;
    gap: 10px !important;
    border-radius: 22px !important;
  }

  .toolbar-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .toolbar-pill:last-child {
    grid-column: 1 / -1;
  }

  #helpdesk-panel .helpdesk-command-bar {
    padding: 12px !important;
    border-radius: 22px !important;
  }

  #helpdesk-panel .helpdesk-command-bar .command-main {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  #helpdesk-panel .helpdesk-command-bar .search-box.large input {
    min-height: 48px !important;
    padding: 0 16px 0 46px !important;
    font-size: 0.98rem !important;
  }

  #helpdesk-panel .helpdesk-command-bar .search-box.large i {
    left: 14px !important;
  }

  #helpdesk-panel .helpdesk-command-bar .command-actions {
    flex-wrap: nowrap !important;
    justify-content: flex-start !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    padding-bottom: 2px !important;
    -webkit-overflow-scrolling: touch;
  }

  #helpdesk-panel .helpdesk-command-bar .btn-primary,
  #helpdesk-panel .helpdesk-command-bar .btn-secondary,
  #helpdesk-panel .helpdesk-command-bar .compact-select,
  #helpdesk-panel .helpdesk-command-bar select,
  #helpdesk-panel .helpdesk-action-dropdown > summary {
    min-height: 40px !important;
    padding: 0 13px !important;
    border-radius: 14px !important;
    font-size: 0.94rem !important;
  }

  #helpdesk-panel .ticket-card {
    grid-template-columns: minmax(0, 1fr) !important;
    padding: 14px !important;
    gap: 12px !important;
  }

  #helpdesk-panel .ticket-checkbox {
    width: 36px !important;
    height: 36px !important;
    margin: 0 !important;
  }

  #helpdesk-panel .ticket-main {
    gap: 10px !important;
  }

  #helpdesk-panel .ticket-topline {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 10px !important;
  }

  #helpdesk-panel .ticket-status-stack {
    width: 100% !important;
    justify-content: flex-start !important;
  }

  #helpdesk-panel .ticket-title-row {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  #helpdesk-panel .ticket-title-stack {
    gap: 10px !important;
  }

  #helpdesk-panel .ticket-avatar-badge {
    width: 40px !important;
    height: 40px !important;
    flex-basis: 40px !important;
    border-radius: 14px !important;
  }

  #helpdesk-panel .ticket-details h4 {
    font-size: 1rem !important;
  }

  #helpdesk-panel .ticket-subtitle {
    font-size: 0.92rem !important;
    line-height: 1.45 !important;
  }

  #helpdesk-panel .ticket-severity-chip {
    justify-content: flex-start !important;
  }

  #helpdesk-panel .ticket-pill {
    min-height: 30px !important;
    font-size: 0.78rem !important;
  }

  #helpdesk-panel .ticket-preview {
    font-size: 0.95rem !important;
    line-height: 1.55 !important;
  }

  #helpdesk-panel .ticket-footer-row {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
  }

  #helpdesk-panel .ticket-expand {
    display: none !important;
  }

  .issue-detail-card.modal-open:not(.inline) {
    inset:
      calc(env(safe-area-inset-top, 0px) + 8px)
      8px
      calc(env(safe-area-inset-bottom, 0px) + 8px)
      8px !important;
    width: auto !important;
    height: auto !important;
    max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 16px) !important;
    border-radius: 28px !important;
    padding: 12px !important;
    overflow: hidden !important;
  }

  #issue-detail-panel #issue-detail-body {
    gap: 10px !important;
  }

  #issue-detail-panel .issue-detail-head.sticky {
    padding-bottom: 10px !important;
  }

  #issue-detail-panel .issue-detail-titles h3 {
    font-size: clamp(1.18rem, 7vw, 1.5rem) !important;
  }

  #issue-detail-panel #issue-view-meta {
    font-size: 0.96rem !important;
    line-height: 1.45 !important;
  }

  #issue-detail-panel .issue-detail-actions {
    gap: 8px !important;
    flex-wrap: nowrap !important;
    margin-left: auto;
  }

  #issue-detail-panel .watchers-summary,
  #issue-detail-panel #issue-detail-close {
    width: 52px !important;
    min-width: 52px !important;
    height: 52px !important;
    padding: 0 !important;
    border-radius: 16px !important;
  }

  #issue-detail-panel .watchers-popover {
    right: 0 !important;
    left: auto !important;
    min-width: min(280px, calc(100vw - 40px)) !important;
    max-width: calc(100vw - 40px) !important;
  }

  #issue-detail-panel .issue-detail-description {
    padding: 16px 16px 18px 18px !important;
  }

  #issue-detail-panel .issue-detail-description::before {
    left: 12px !important;
    top: 14px !important;
    bottom: 14px !important;
  }

  #issue-detail-panel .issue-detail-description .eyebrow,
  #issue-detail-panel .issue-detail-description #issue-view-description {
    margin-left: 14px !important;
  }

  #issue-detail-panel .detail-tabs {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    padding-bottom: 2px !important;
  }

  #issue-detail-panel .detail-tab-btn {
    flex: 0 0 auto !important;
  }

  #issue-detail-panel .mentions-helper {
    display: none !important;
  }

  #issue-detail-panel #issue-comments.issue-thread {
    padding: 12px !important;
    gap: 10px !important;
  }

  #issue-detail-panel #issue-comments.issue-thread .comment-entry .meta {
    padding: 0 2px !important;
    margin-bottom: 6px !important;
  }

  #issue-detail-panel #issue-comments.issue-thread .comment-entry .comment-body {
    padding: 12px 14px !important;
    border-radius: 16px !important;
  }

  #issue-detail-panel .comment-form textarea {
    min-height: 120px !important;
  }

  #issue-detail-panel .comment-actions {
    justify-content: stretch !important;
  }

  #issue-detail-panel .comment-actions .btn-primary {
    width: 100% !important;
  }
}

@media (max-width: 640px) {
  .sidebar-brand {
    padding: 10px 12px !important;
  }

  .sidebar-brand .brand-mark {
    width: 48px !important;
    height: 48px !important;
    flex-basis: 48px !important;
  }

  .brand-title {
    font-size: 0.92rem !important;
  }

  .brand-subtitle {
    font-size: 0.72rem !important;
  }

  .toolbar-meta {
    grid-template-columns: 1fr !important;
  }

  .theme-toggle-btn {
    width: 100% !important;
    min-width: 0 !important;
  }

  #helpdesk-panel .helpdesk-command-bar .command-actions {
    gap: 7px !important;
  }

  #helpdesk-panel .helpdesk-command-bar .btn-primary,
  #helpdesk-panel .helpdesk-command-bar .btn-secondary,
  #helpdesk-panel .helpdesk-command-bar .compact-select,
  #helpdesk-panel .helpdesk-command-bar select,
  #helpdesk-panel .helpdesk-action-dropdown > summary {
    min-height: 38px !important;
    padding: 0 12px !important;
    font-size: 0.9rem !important;
  }

  #helpdesk-panel .ticket-reference-row,
  #helpdesk-panel .ticket-pill-row {
    gap: 6px !important;
  }

  #helpdesk-panel .ticket-reference,
  #helpdesk-panel .ticket-pill,
  #helpdesk-panel .ticket-inline-hint {
    font-size: 0.74rem !important;
  }

  .issue-detail-card.modal-open:not(.inline) {
    inset:
      calc(env(safe-area-inset-top, 0px) + 6px)
      6px
      calc(env(safe-area-inset-bottom, 0px) + 6px)
      6px !important;
    border-radius: 24px !important;
    padding: 10px !important;
  }

  #issue-detail-panel .watchers-popover {
    min-width: calc(100vw - 32px) !important;
    max-width: calc(100vw - 32px) !important;
  }

  #issue-detail-panel .comment-form {
    padding: 14px !important;
  }

  #issue-detail-panel .comment-form input[type="file"] {
    width: 100% !important;
  }
}

/* OnlineServices mobile ticket detail compaction */
@media (max-width: 820px) {
  .issue-detail-card.modal-open:not(.inline) {
    display: flex !important;
    flex-direction: column !important;
  }

  #issue-detail-panel {
    border-radius: 24px !important;
  }

  #issue-detail-panel #issue-detail-body {
    gap: 8px !important;
    min-height: 0;
  }

  #issue-detail-panel .issue-detail-head.sticky {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: start !important;
    gap: 8px 10px !important;
    padding: 0 0 8px !important;
  }

  #issue-detail-panel .issue-detail-titles {
    min-width: 0;
    gap: 0.22rem !important;
  }

  #issue-detail-panel .issue-detail-titles h3 {
    line-height: 1.04 !important;
    font-size: clamp(1.04rem, 6.6vw, 1.34rem) !important;
  }

  #issue-detail-panel #issue-view-meta {
    font-size: 0.84rem !important;
    line-height: 1.34 !important;
    max-width: 30ch;
  }

  #issue-detail-panel .issue-detail-tags {
    gap: 6px !important;
  }

  #issue-detail-panel #issue-view-assignee-tag {
    min-height: 34px !important;
    padding: 0 12px !important;
    font-size: 0.86rem !important;
  }

  #issue-detail-panel .issue-detail-actions {
    align-self: start !important;
    justify-content: flex-end !important;
    gap: 8px !important;
    flex-wrap: nowrap !important;
    margin-left: 0 !important;
  }

  #issue-detail-panel .watchers-summary,
  #issue-detail-panel #issue-detail-close {
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    border-radius: 14px !important;
  }

  #issue-detail-panel .watchers-summary span {
    font-size: 0.9rem !important;
  }

  #issue-detail-panel .watchers-popover {
    top: calc(100% + 8px) !important;
    right: 0 !important;
    left: auto !important;
  }

  #issue-detail-panel .issue-detail-description {
    padding: 12px 14px 14px 16px !important;
    border-radius: 18px !important;
  }

  #issue-detail-panel .issue-detail-description::before {
    left: 10px !important;
    top: 12px !important;
    bottom: 12px !important;
    width: 5px !important;
  }

  #issue-detail-panel .issue-detail-description .eyebrow,
  #issue-detail-panel .issue-detail-description #issue-view-description {
    margin-left: 14px !important;
  }

  #issue-detail-panel .issue-detail-description .eyebrow {
    margin-bottom: 4px !important;
  }

  #issue-detail-panel .issue-detail-description #issue-view-description {
    font-size: 1rem !important;
    line-height: 1.56 !important;
  }

  #issue-detail-panel .detail-tabs {
    gap: 6px !important;
    padding: 6px !important;
    border-radius: 16px !important;
  }

  #issue-detail-panel .detail-tab-btn {
    min-height: 34px !important;
    padding: 0 12px !important;
    font-size: 0.88rem !important;
  }

  #issue-detail-panel .detail-pane,
  #issue-detail-panel .issue-comments,
  #issue-detail-panel .issue-history {
    padding: 12px !important;
    border-radius: 18px !important;
  }

  #issue-detail-panel .issue-timeline-header {
    grid-template-columns: 1fr !important;
    gap: 6px !important;
  }

  #issue-detail-panel .issue-timeline-header .eyebrow {
    margin-bottom: 2px !important;
  }

  #issue-detail-panel .issue-timeline-header .muted.small {
    font-size: 0.82rem !important;
    line-height: 1.35 !important;
  }

  #issue-detail-panel #issue-comments.issue-thread {
    padding: 10px !important;
    border-radius: 18px !important;
    gap: 8px !important;
  }

  #issue-detail-panel #issue-comments.issue-thread .comment-entry .meta {
    font-size: 0.72rem !important;
    line-height: 1.15 !important;
  }

  #issue-detail-panel #issue-comments.issue-thread .comment-entry .comment-body {
    padding: 12px !important;
    border-radius: 14px !important;
    font-size: 0.96rem !important;
    line-height: 1.48 !important;
  }

  #issue-detail-panel .comment-form {
    gap: 10px !important;
    padding: 12px !important;
    border-radius: 18px !important;
    margin-top: 2px !important;
  }

  #issue-detail-panel .comment-form textarea {
    min-height: 86px !important;
    border-radius: 16px !important;
  }

  #issue-detail-panel .comment-form .field.small {
    gap: 6px !important;
  }

  #issue-detail-panel .comment-form input[type="file"] {
    min-height: 46px !important;
    border-radius: 14px !important;
  }

  #issue-detail-panel .comment-actions .btn-primary {
    min-height: 48px !important;
    border-radius: 16px !important;
  }
}

@media (max-width: 520px) {
  .issue-detail-card.modal-open:not(.inline) {
    padding: 8px !important;
    border-radius: 20px !important;
  }

  #issue-detail-panel .issue-detail-head.sticky {
    gap: 6px 8px !important;
  }

  #issue-detail-panel .issue-detail-titles h3 {
    font-size: clamp(0.98rem, 6.2vw, 1.18rem) !important;
  }

  #issue-detail-panel #issue-view-meta {
    font-size: 0.8rem !important;
    line-height: 1.3 !important;
  }

  #issue-detail-panel #issue-view-assignee-tag {
    min-height: 32px !important;
    font-size: 0.82rem !important;
  }

  #issue-detail-panel .watchers-summary,
  #issue-detail-panel #issue-detail-close {
    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
  }

  #issue-detail-panel .issue-detail-description {
    padding: 10px 12px 12px 14px !important;
  }

  #issue-detail-panel .issue-detail-description #issue-view-description {
    font-size: 0.96rem !important;
  }

  #issue-detail-panel .detail-tab-btn {
    min-height: 32px !important;
    padding: 0 10px !important;
    font-size: 0.84rem !important;
  }

  #issue-detail-panel .comment-form textarea {
    min-height: 78px !important;
  }
}

/* OnlineServices mobile shell burger-menu restore */
@media (max-width: 1024px) {
  .app-shell {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: auto minmax(0, 1fr) !important;
  }

  .mobile-header {
    position: sticky !important;
    top: 0 !important;
    z-index: 40 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;
    padding: 12px 14px !important;
    border-bottom: 1px solid rgba(217, 93, 47, 0.14) !important;
    background:
      linear-gradient(180deg, rgba(255, 252, 247, 0.98), rgba(245, 237, 226, 0.94)),
      radial-gradient(circle at top left, rgba(227, 107, 56, 0.08), transparent 24%) !important;
    backdrop-filter: blur(24px) saturate(1.1) !important;
  }

  [data-theme="dark"] .mobile-header {
    background:
      linear-gradient(180deg, rgba(18, 21, 26, 0.96), rgba(24, 28, 33, 0.92)),
      radial-gradient(circle at top left, rgba(223, 107, 59, 0.12), transparent 26%) !important;
    border-bottom-color: rgba(255, 255, 255, 0.08) !important;
  }

  .sidebar-backdrop {
    display: block !important;
    z-index: 34 !important;
  }

  .sidebar-backdrop.hidden {
    display: none !important;
  }

  body.sidebar-open {
    overflow: hidden !important;
  }

  .sidebar,
  .sidebar.open {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 35 !important;
    width: min(86vw, 320px) !important;
    max-width: 320px !important;
    height: 100vh !important;
    height: 100dvh !important;
    transform: translateX(-108%) !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 14px !important;
    padding:
      calc(env(safe-area-inset-top, 0px) + 14px)
      14px
      calc(env(safe-area-inset-bottom, 0px) + 14px) !important;
    border-right: 1px solid rgba(217, 93, 47, 0.14) !important;
    border-bottom: 0 !important;
    border-radius: 0 24px 24px 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    box-shadow: 0 24px 48px rgba(52, 38, 24, 0.18) !important;
  }

  .sidebar.open {
    transform: translateX(0) !important;
  }

  .sidebar-brand {
    width: 100% !important;
    margin: 0 !important;
  }

  .sidebar-nav {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    gap: 8px !important;
    width: 100% !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  .sidebar-nav .nav-btn,
  .nav-btn {
    width: 100% !important;
    justify-content: flex-start !important;
    min-height: 46px !important;
    padding: 0 14px 0 12px !important;
    border-radius: 16px !important;
  }

  .sidebar-footer {
    display: block !important;
    width: 100% !important;
    margin-top: auto !important;
    padding-top: 0 !important;
    border-top: 0 !important;
  }

  .user-chip {
    width: 100% !important;
    max-width: none !important;
  }

  .main-panel {
    padding-top: 8px !important;
  }
}

/* OnlineServices responsive ticket-sheet compatibility */
@media (max-width: 980px) {
  .issue-detail-card.modal-open:not(.inline) {
    inset:
      calc(env(safe-area-inset-top, 0px) + 10px)
      10px
      calc(env(safe-area-inset-bottom, 0px) + 10px)
      10px !important;
    width: auto !important;
    height: auto !important;
    max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 20px) !important;
    padding: 10px !important;
    border-radius: 26px !important;
    overflow: hidden !important;
  }

  #issue-detail-panel {
    border-radius: 22px !important;
  }

  #issue-detail-panel #issue-detail-body {
    gap: 9px !important;
    min-height: 0 !important;
  }

  #issue-detail-panel .issue-detail-head.sticky {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: start !important;
    gap: 8px 10px !important;
    padding: 0 0 8px !important;
  }

  #issue-detail-panel .issue-detail-titles {
    min-width: 0 !important;
    gap: 0.2rem !important;
  }

  #issue-detail-panel .issue-detail-titles h3 {
    font-size: clamp(1.06rem, 3.2vw, 1.34rem) !important;
    line-height: 1.06 !important;
  }

  #issue-detail-panel #issue-view-meta {
    max-width: 42ch !important;
    font-size: 0.86rem !important;
    line-height: 1.36 !important;
  }

  #issue-detail-panel .issue-detail-tags {
    gap: 6px !important;
  }

  #issue-detail-panel #issue-view-assignee-tag {
    min-height: 34px !important;
    padding: 0 12px !important;
    font-size: 0.84rem !important;
  }

  #issue-detail-panel .issue-detail-actions {
    gap: 8px !important;
    flex-wrap: nowrap !important;
    align-self: start !important;
  }

  #issue-detail-panel .watchers-summary,
  #issue-detail-panel #issue-detail-close {
    width: 46px !important;
    min-width: 46px !important;
    height: 46px !important;
    border-radius: 14px !important;
  }

  #issue-detail-panel .watchers-popover {
    top: calc(100% + 8px) !important;
    right: 0 !important;
    left: auto !important;
    min-width: min(290px, calc(100vw - 40px)) !important;
    max-width: calc(100vw - 40px) !important;
  }

  #issue-detail-panel .issue-detail-description {
    padding: 12px 14px 14px 16px !important;
    border-radius: 18px !important;
  }

  #issue-detail-panel .issue-detail-description::before {
    left: 10px !important;
    top: 12px !important;
    bottom: 12px !important;
  }

  #issue-detail-panel .issue-detail-description .eyebrow,
  #issue-detail-panel .issue-detail-description #issue-view-description {
    margin-left: 14px !important;
  }

  #issue-detail-panel .issue-detail-description #issue-view-description {
    font-size: 1rem !important;
    line-height: 1.55 !important;
  }

  #issue-detail-panel .detail-tabs {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    gap: 6px !important;
    padding: 6px !important;
    border-radius: 16px !important;
  }

  #issue-detail-panel .detail-tab-btn {
    flex: 0 0 auto !important;
    min-height: 34px !important;
    padding: 0 12px !important;
    font-size: 0.88rem !important;
  }

  #issue-detail-panel .detail-pane,
  #issue-detail-panel .issue-comments,
  #issue-detail-panel .issue-history {
    padding: 12px !important;
    border-radius: 18px !important;
  }

  #issue-detail-panel .issue-timeline-header {
    grid-template-columns: 1fr !important;
    gap: 6px !important;
  }

  #issue-detail-panel .mentions-helper {
    display: none !important;
  }

  #issue-detail-panel #issue-comments.issue-thread {
    padding: 10px !important;
    gap: 8px !important;
    border-radius: 18px !important;
  }

  #issue-detail-panel #issue-comments.issue-thread .comment-entry .meta {
    margin-bottom: 6px !important;
    font-size: 0.72rem !important;
  }

  #issue-detail-panel #issue-comments.issue-thread .comment-entry .comment-body {
    padding: 12px !important;
    border-radius: 14px !important;
    font-size: 0.95rem !important;
    line-height: 1.48 !important;
  }

  #issue-detail-panel .comment-form {
    gap: 10px !important;
    padding: 12px !important;
    margin-top: 2px !important;
    border-radius: 18px !important;
  }

  #issue-detail-panel .comment-form textarea {
    min-height: 92px !important;
    border-radius: 16px !important;
  }

  #issue-detail-panel .comment-form input[type="file"] {
    width: 100% !important;
    min-height: 46px !important;
  }

  #issue-detail-panel .comment-actions {
    justify-content: stretch !important;
  }

  #issue-detail-panel .comment-actions .btn-primary {
    width: 100% !important;
    min-height: 48px !important;
  }
}

/* OnlineServices final responsive compatibility pass */
@media (max-width: 1180px) {
  .issue-detail-card.modal-open:not(.inline) {
    inset:
      calc(env(safe-area-inset-top, 0px) + 14px)
      clamp(12px, 3vw, 22px)
      calc(env(safe-area-inset-bottom, 0px) + 14px)
      clamp(12px, 3vw, 22px) !important;
    width: auto !important;
    max-width: min(820px, calc(100vw - 24px)) !important;
    margin: 0 auto !important;
    border-radius: 26px !important;
    padding: 10px !important;
  }

  #issue-detail-panel #issue-detail-body {
    gap: 10px !important;
  }

  #issue-detail-panel .issue-detail-head.sticky {
    gap: 10px 12px !important;
    padding-bottom: 10px !important;
  }

  #issue-detail-panel .issue-detail-titles h3 {
    font-size: clamp(1.08rem, 3vw, 1.42rem) !important;
    line-height: 1.08 !important;
  }

  #issue-detail-panel #issue-view-meta {
    max-width: 46ch !important;
    font-size: 0.9rem !important;
    line-height: 1.42 !important;
  }

  #issue-detail-panel .issue-detail-actions {
    gap: 8px !important;
  }

  #issue-detail-panel .watchers-summary,
  #issue-detail-panel #issue-detail-close {
    width: 46px !important;
    min-width: 46px !important;
    height: 46px !important;
  }

  #issue-detail-panel .issue-detail-description,
  #issue-detail-panel .detail-pane,
  #issue-detail-panel .comment-form {
    border-radius: 20px !important;
  }

  #issue-detail-panel .detail-tabs {
    gap: 6px !important;
    padding: 6px !important;
  }

  #issue-detail-panel .detail-tab-btn {
    min-height: 36px !important;
    padding: 0 12px !important;
    font-size: 0.88rem !important;
  }
}

@media (max-width: 900px) {
  .issue-detail-card.modal-open:not(.inline) {
    inset:
      calc(env(safe-area-inset-top, 0px) + 10px)
      10px
      calc(env(safe-area-inset-bottom, 0px) + 10px)
      10px !important;
    max-width: calc(100vw - 20px) !important;
    border-radius: 24px !important;
    padding: 8px !important;
  }

  #issue-detail-panel .issue-detail-head.sticky {
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: start !important;
  }

  #issue-detail-panel .issue-detail-titles {
    gap: 0.2rem !important;
  }

  #issue-detail-panel .issue-detail-titles h3 {
    font-size: clamp(1.04rem, 4.6vw, 1.3rem) !important;
  }

  #issue-detail-panel #issue-view-meta {
    max-width: 34ch !important;
    font-size: 0.84rem !important;
    line-height: 1.38 !important;
  }

  #issue-detail-panel .issue-detail-tags {
    gap: 6px !important;
  }

  #issue-detail-panel #issue-view-assignee-tag {
    min-height: 34px !important;
    padding: 0 12px !important;
    font-size: 0.84rem !important;
  }

  #issue-detail-panel .issue-detail-description {
    padding: 12px 14px 14px 16px !important;
  }

  #issue-detail-panel .issue-detail-description #issue-view-description {
    font-size: 0.98rem !important;
    line-height: 1.54 !important;
  }

  #issue-detail-panel .detail-tabs {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scrollbar-width: none !important;
  }

  #issue-detail-panel .detail-tabs::-webkit-scrollbar {
    display: none !important;
  }

  #issue-detail-panel .detail-pane,
  #issue-detail-panel .issue-comments,
  #issue-detail-panel .issue-history {
    padding: 12px !important;
  }

  #issue-detail-panel .issue-timeline-header {
    grid-template-columns: 1fr !important;
    gap: 6px !important;
  }

  #issue-detail-panel .mentions-helper {
    display: none !important;
  }

  #issue-detail-panel .issue-thread,
  #issue-detail-panel .issue-history-stream {
    border-radius: 18px !important;
  }

  #issue-detail-panel .issue-thread .comment-entry,
  #issue-detail-panel .issue-history-stream .history-entry {
    padding: 12px !important;
  }

  #issue-detail-panel .comment-form {
    gap: 10px !important;
    padding: 12px !important;
  }

  #issue-detail-panel .comment-form textarea {
    min-height: 96px !important;
  }
}

@media (max-width: 640px) {
  .issue-detail-card.modal-open:not(.inline) {
    inset:
      calc(env(safe-area-inset-top, 0px) + 6px)
      6px
      calc(env(safe-area-inset-bottom, 0px) + 6px)
      6px !important;
    max-width: calc(100vw - 12px) !important;
    border-radius: 22px !important;
    padding: 8px !important;
  }

  #issue-detail-panel {
    border-radius: 18px !important;
  }

  #issue-detail-panel #issue-detail-body {
    gap: 8px !important;
  }

  #issue-detail-panel .issue-detail-head.sticky {
    gap: 8px !important;
    padding-bottom: 8px !important;
  }

  #issue-detail-panel .issue-detail-titles h3 {
    font-size: clamp(0.98rem, 6vw, 1.18rem) !important;
    line-height: 1.04 !important;
  }

  #issue-detail-panel #issue-view-meta {
    max-width: none !important;
    font-size: 0.8rem !important;
    line-height: 1.34 !important;
  }

  #issue-detail-panel #issue-view-assignee-tag {
    min-height: 32px !important;
    font-size: 0.8rem !important;
  }

  #issue-detail-panel .issue-detail-actions {
    gap: 6px !important;
  }

  #issue-detail-panel .watchers-summary,
  #issue-detail-panel #issue-detail-close {
    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
    border-radius: 14px !important;
  }

  #issue-detail-panel .watchers-summary span {
    font-size: 0.84rem !important;
  }

  #issue-detail-panel .watchers-popover {
    min-width: calc(100vw - 36px) !important;
    max-width: calc(100vw - 36px) !important;
    right: -2px !important;
  }

  #issue-detail-panel .issue-detail-description {
    padding: 10px 12px 12px 14px !important;
    border-radius: 16px !important;
  }

  #issue-detail-panel .issue-detail-description::before {
    left: 9px !important;
    top: 10px !important;
    bottom: 10px !important;
    width: 4px !important;
  }

  #issue-detail-panel .issue-detail-description .eyebrow {
    margin-bottom: 4px !important;
    font-size: 0.66rem !important;
  }

  #issue-detail-panel .issue-detail-description #issue-view-description {
    font-size: 0.94rem !important;
    line-height: 1.5 !important;
  }

  #issue-detail-panel .detail-tabs {
    gap: 5px !important;
    padding: 5px !important;
    border-radius: 15px !important;
  }

  #issue-detail-panel .detail-tab-btn {
    min-height: 32px !important;
    padding: 0 10px !important;
    font-size: 0.8rem !important;
  }

  #issue-detail-panel .detail-pane,
  #issue-detail-panel .issue-comments,
  #issue-detail-panel .issue-history {
    padding: 10px !important;
    border-radius: 16px !important;
  }

  #issue-detail-panel .issue-timeline-header .eyebrow {
    margin-bottom: 2px !important;
    font-size: 0.68rem !important;
  }

  #issue-detail-panel .issue-timeline-header .muted.small {
    font-size: 0.78rem !important;
    line-height: 1.32 !important;
  }

  #issue-detail-panel .issue-thread,
  #issue-detail-panel .issue-history-stream {
    border-radius: 16px !important;
  }

  #issue-detail-panel .issue-thread .comment-entry,
  #issue-detail-panel .issue-history-stream .history-entry {
    padding: 10px !important;
  }

  #issue-detail-panel .issue-thread .comment-entry .meta,
  #issue-detail-panel .issue-history-stream .history-entry .meta {
    font-size: 0.68rem !important;
    line-height: 1.14 !important;
  }

  #issue-detail-panel .issue-thread .comment-entry .comment-body,
  #issue-detail-panel .issue-history-stream .history-entry .comment-body {
    font-size: 0.92rem !important;
    line-height: 1.44 !important;
    padding: 10px 12px !important;
    border-radius: 14px !important;
  }

  #issue-detail-panel .comment-form {
    gap: 8px !important;
    padding: 10px !important;
    border-radius: 16px !important;
  }

  #issue-detail-panel .comment-form textarea {
    min-height: 84px !important;
    border-radius: 14px !important;
  }

  #issue-detail-panel .comment-form .field.small {
    gap: 4px !important;
  }

  #issue-detail-panel .comment-form input[type="file"] {
    width: 100% !important;
    min-height: 44px !important;
    border-radius: 12px !important;
  }

  #issue-detail-panel .comment-actions .btn-primary {
    min-height: 46px !important;
    border-radius: 14px !important;
  }
}

/* Accounts visual refresh */
#customers-panel {
  gap: 16px;
}

#customers-panel > .panel-header {
  padding: 2px 4px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#customers-panel > .panel-header::before {
  display: none;
}

#customers-panel > .panel-header h1 {
  margin: 0 0 0.2rem;
  font-size: clamp(1.55rem, 1.9vw, 1.95rem);
  letter-spacing: -0.05em;
}

#customers-panel > .panel-header p {
  margin: 0;
  color: var(--os-helpdesk-muted);
}

#customers-panel .customer-command-bar,
#customers-panel .customer-filter-rail,
#customers-panel .customer-directory-card,
#customers-panel .customer-summary-card,
#customers-panel .quick-log-card,
#customers-panel .detail-card,
#customers-panel .history-card,
#customer-profile-modal .customer-profile-hero,
#customer-profile-modal .detail-card {
  border-color: var(--os-helpdesk-border);
  background: var(--os-helpdesk-shell);
  box-shadow: var(--os-helpdesk-shadow);
}

#customers-panel .customer-command-bar::before,
#customers-panel .customer-filter-rail::before,
#customers-panel .customer-directory-card::before,
#customers-panel .customer-summary-card::before,
#customers-panel .quick-log-card::before,
#customers-panel .detail-card::before,
#customers-panel .history-card::before,
#customer-profile-modal .customer-profile-hero::before,
#customer-profile-modal .detail-card::before {
  display: none;
}

#customers-panel .customer-command-bar {
  padding: 18px;
  border-radius: 28px;
}

#customers-panel .customer-command-bar .command-main {
  display: grid;
  grid-template-columns: minmax(340px, 1.2fr) auto;
  align-items: start;
  gap: 14px;
}

#customers-panel .customer-command-bar .command-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

#customers-panel .customer-command-bar .command-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
}

#customers-panel .customer-command-bar .search-box.large {
  min-height: 56px;
  padding: 0 12px 0 16px;
  border-radius: 18px;
  border: 1px solid var(--os-helpdesk-border);
  background: var(--os-helpdesk-panel);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

#customers-panel .customer-command-bar .search-box.large input {
  font-size: 1rem;
  color: var(--os-helpdesk-text);
}

#customers-panel .customer-command-bar .search-box.large i {
  color: #dd6d3d;
}

#customers-panel .customer-command-bar .btn-primary,
#customers-panel .customer-command-bar .btn-secondary,
#customers-panel .customer-command-bar .compact-select,
#customers-panel .customer-command-bar select,
#customers-panel .customer-command-bar .inline-field {
  min-height: 44px;
  border-radius: 14px;
}

#customers-panel #customer-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 12px;
  margin: 0;
}

#customers-panel #customer-stats:empty,
#customers-panel #customer-filter-chips:empty {
  display: none;
}

#customers-panel #customer-filter-chips {
  margin-bottom: 0;
  align-self: center;
  justify-content: flex-end;
}

#customers-panel .stat-pill {
  min-height: 84px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--os-helpdesk-border);
  background: var(--os-helpdesk-panel);
  box-shadow: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#customers-panel .stat-pill-accounts {
  min-width: min(100%, 360px);
}

#customers-panel .stat-pill .label {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--os-helpdesk-subtle);
}

#customers-panel .stat-pill-breakdown {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

#customers-panel .stat-pill-breakdown > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#customers-panel .stat-pill .sub-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--os-helpdesk-muted);
}

#customers-panel .stat-pill strong {
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  line-height: 1;
  color: var(--os-helpdesk-text);
}

#customers-panel .view-disclosure {
  width: min(100%, 480px);
  align-self: flex-end;
  margin-top: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

#customers-panel .view-disclosure summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 15px;
  border-radius: 14px;
  border: 1px solid var(--os-helpdesk-border);
  background: var(--os-helpdesk-panel);
  color: var(--os-helpdesk-muted);
  font-size: 0.92rem;
}

#customers-panel .view-disclosure summary::after {
  margin-left: auto;
  float: none;
}

#customers-panel .view-disclosure[open] {
  padding: 12px;
  border: 1px solid var(--os-helpdesk-border);
  border-radius: 18px;
  background: var(--os-helpdesk-panel);
}

#customers-panel .view-options {
  margin-top: 0.75rem;
  gap: 0.75rem;
}

#customers-panel .customer-layout {
  grid-template-columns: minmax(360px, 1.02fr) minmax(340px, 0.98fr);
  gap: 18px;
  align-items: start;
}

#customers-panel .customer-rail {
  gap: 16px;
}

#customers-panel .customer-filter-rail,
#customers-panel .customer-directory-card,
#customers-panel .customer-summary-card,
#customers-panel .quick-log-card,
#customers-panel .detail-card,
#customers-panel .history-card {
  border-radius: 28px;
}

#customers-panel .customer-filter-rail .card-header,
#customers-panel .customer-directory-card .card-header,
#customers-panel .quick-log-card .card-header,
#customers-panel .history-card .card-header {
  padding: 18px 18px 12px;
}

#customers-panel .customer-filter-rail .card-body,
#customers-panel .customer-directory-card .card-body {
  padding: 0 18px 18px;
}

#customers-panel .customer-filter-rail .basic-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 10px;
}

#customers-panel .filter-disclosure {
  margin-top: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

#customers-panel .filter-disclosure summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 15px;
  border-radius: 14px;
  border: 1px solid var(--os-helpdesk-border);
  background: var(--os-helpdesk-panel);
  color: var(--os-helpdesk-muted);
  font-size: 0.92rem;
}

#customers-panel .filter-disclosure summary::after {
  margin-left: auto;
  float: none;
}

#customers-panel .filter-disclosure[open] {
  padding-top: 10px;
}

#customers-panel .customer-filter-rail label,
#customers-panel .customer-filter-rail .toggle span {
  color: var(--os-helpdesk-muted);
}

#customers-panel .customer-filter-rail select,
#customers-panel .customer-filter-rail input {
  min-height: 44px;
  border-radius: 14px;
  border-color: var(--os-helpdesk-border);
  background: var(--os-helpdesk-panel-strong);
  color: var(--os-helpdesk-text);
}

#customers-panel .customer-directory-card .card-header {
  border-bottom: 0;
}

#customers-panel .customer-directory-card .data-table tbody {
  grid-template-columns: 1fr;
  gap: 14px;
}

#customers-panel .customer-directory-card .data-table tr {
  width: 100%;
  min-width: 0;
}

#customers-panel .customer-card-shell {
  padding: 18px 18px 18px 24px;
  gap: 12px;
  border-radius: 26px;
  border: 1px solid var(--os-helpdesk-border);
  background: var(--os-helpdesk-panel-strong);
  box-shadow: none;
}

#customers-panel .customer-card-shell::after {
  display: none;
}

#customers-panel .customer-card-shell::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18px;
  bottom: 18px;
  width: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, #68c8f7, #82ddb0);
}

#customers-panel .customer-card:hover .customer-card-shell {
  transform: translateY(-2px);
  border-color: rgba(223, 107, 59, 0.28);
  box-shadow: 0 16px 30px rgba(71, 53, 36, 0.1);
}

#customers-panel .customer-card.active .customer-card-shell {
  border-color: rgba(223, 107, 59, 0.38);
  box-shadow: 0 20px 36px rgba(71, 53, 36, 0.12);
}

#customers-panel .customer-card-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 14px;
}

#customers-panel .customer-card-identity {
  gap: 14px;
}

#customers-panel .customer-card-avatar {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: linear-gradient(135deg, #7dd6f9, #79d5b2);
  color: #fffdf9;
}

#customers-panel .customer-card-name {
  font-size: 1.16rem;
  line-height: 1.08;
  color: var(--os-helpdesk-text);
}

#customers-panel .customer-card-contact,
#customers-panel .customer-list-meta .muted,
#customers-panel .customer-card-last,
#customers-panel .customer-card-activity {
  color: var(--os-helpdesk-muted);
}

#customers-panel .customer-card-id,
#customers-panel .customer-hero-meta .meta-pill {
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--os-helpdesk-border);
  color: var(--os-helpdesk-muted);
}

#customers-panel .customer-card-metrics {
  gap: 8px;
  padding: 10px 12px;
  border-radius: 18px;
  border: 1px solid var(--os-helpdesk-border);
  background: rgba(255, 255, 255, 0.56);
}

[data-theme="dark"] #customers-panel .customer-card-id,
[data-theme="dark"] #customers-panel .customer-hero-meta .meta-pill {
  background: rgba(16, 21, 28, 0.78);
}

[data-theme="dark"] #customers-panel .customer-card-metrics {
  background: rgba(16, 21, 28, 0.88);
}

#customers-panel .customer-card-metric span {
  color: var(--os-helpdesk-subtle);
}

#customers-panel .customer-card-metric strong,
#customers-panel .customer-list-meta strong {
  color: var(--os-helpdesk-text);
}

#customers-panel .customer-card-footer {
  justify-content: flex-start;
}

#customers-panel .customer-card-chips {
  gap: 6px;
}

#customers-panel .customer-directory-card.list-view .table-container {
  overflow: auto;
  border-radius: 22px;
  border: 1px solid var(--os-helpdesk-border);
  background: var(--os-helpdesk-panel);
}

#customers-panel .customer-directory-card.list-view .data-table th,
#customers-panel .customer-directory-card.list-view .data-table td {
  border-bottom-color: var(--os-helpdesk-border);
  padding: 14px 16px;
}

#customers-panel .customer-directory-card.list-view .data-table th {
  background: transparent;
  color: var(--os-helpdesk-subtle);
}

#customers-panel .customer-directory-card.list-view .data-table tr:hover td {
  background: rgba(223, 107, 59, 0.04);
}

#customers-panel .customer-directory-card.list-view .data-table tr.customer-card.active td {
  background: rgba(223, 107, 59, 0.08);
}

#customers-panel .customer-detail-panel {
  gap: 16px;
}

#customers-panel .customer-hero-card {
  padding: 20px;
}

#customers-panel .customer-hero-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 16px;
}

#customers-panel .customer-identity {
  align-items: flex-start;
  gap: 16px;
}

#customers-panel .customer-identity-text h2 {
  margin: 0 0 0.3rem;
  font-size: clamp(1.38rem, 1.8vw, 1.9rem);
  line-height: 1.04;
  letter-spacing: -0.04em;
  color: var(--os-helpdesk-text);
}

#customers-panel .customer-identity-text .muted.small,
#customers-panel .customer-hero-meta,
#customers-panel .customer-hero-meta .meta-pill {
  color: var(--os-helpdesk-muted);
}

#customers-panel .customer-hero-actions {
  justify-content: flex-end;
  gap: 10px;
}

#customers-panel .customer-hero-actions .btn-primary,
#customers-panel .customer-hero-actions .btn-secondary,
#customers-panel .customer-action-bar .btn-secondary,
#customer-profile-modal .tab-btn {
  min-height: 42px;
  border-radius: 14px;
}

#customers-panel .customer-hero-actions .action-menu,
#customers-panel .customer-action-bar .action-menu {
  background: var(--os-helpdesk-panel-strong);
  border-color: var(--os-helpdesk-border);
  box-shadow: var(--os-helpdesk-shadow);
}

#customers-panel .customer-hero-metrics {
  gap: 10px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

#customers-panel .customer-hero-metrics .metric-chip,
#customer-profile-modal .customer-profile-metrics .metric-chip {
  min-height: 90px;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid var(--os-helpdesk-border);
  background: var(--os-helpdesk-panel);
  box-shadow: none;
}

#customers-panel .customer-action-bar {
  position: static;
  top: auto;
  z-index: auto;
  padding: 12px 14px;
  border-radius: 20px;
  border: 1px solid var(--os-helpdesk-border);
  background: var(--os-helpdesk-panel);
  box-shadow: none;
  backdrop-filter: none;
}

#customers-panel .detail-tabs,
#customer-profile-modal .customer-tab-nav {
  position: relative;
  z-index: 8;
  gap: 6px;
  padding: 6px;
  border-radius: 18px;
  border: 1px solid var(--os-helpdesk-border);
  background: var(--os-helpdesk-panel);
  box-shadow: none;
}

#customers-panel .detail-tab,
#customer-profile-modal .tab-btn {
  position: relative;
  z-index: 9;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  color: var(--os-helpdesk-muted);
  background: transparent;
  box-shadow: none;
  pointer-events: auto;
}

#customers-panel .detail-tab.active,
#customer-profile-modal .tab-btn.active {
  background: var(--os-helpdesk-panel-strong);
  border-color: rgba(223, 107, 59, 0.22);
  color: var(--os-helpdesk-text);
  box-shadow: 0 10px 22px rgba(71, 53, 36, 0.08);
}

#customers-panel .detail-grid {
  margin: 0;
  gap: 14px;
}

#customers-panel .detail-card,
#customer-profile-modal .detail-card {
  padding: 18px;
  border-radius: 24px;
  box-shadow: none;
}

#customers-panel .detail-card h4,
#customer-profile-modal .detail-card h4 {
  margin-bottom: 0.7rem;
  color: var(--os-helpdesk-subtle);
}

#customers-panel .quick-log-card form,
#customers-panel .visit-form,
#customers-panel .visit-list,
#customers-panel .conversation-list,
#customers-panel .timeline {
  padding-left: 18px;
  padding-right: 18px;
}

#customers-panel .quick-log-card form,
#customers-panel .timeline,
#customers-panel .visit-list,
#customers-panel .conversation-list {
  padding-bottom: 18px;
}

#customers-panel .timeline-item,
#customers-panel .visit-entry,
#customers-panel .appointment-item,
#customers-panel .conversation-entry,
#customer-profile-modal .timeline-item {
  border-radius: 18px;
  border: 1px solid var(--os-helpdesk-border);
  background: var(--os-helpdesk-panel-strong);
  box-shadow: none;
}

#customers-panel .conversation-entry {
  padding: 14px 16px;
  border-bottom: 0;
}

#customers-panel .timeline-search {
  max-width: none;
  border-radius: 14px;
  border-color: var(--os-helpdesk-border);
  background: var(--os-helpdesk-panel-strong);
}

#customer-profile-modal .drawer-header {
  background: var(--os-helpdesk-shell);
  border-bottom: 1px solid var(--os-helpdesk-border);
}

#customer-profile-modal .drawer-form {
  padding: 18px;
}

#customer-profile-modal .customer-profile-hero {
  border-radius: 26px;
  background: var(--os-helpdesk-shell);
}

#customer-profile-modal .customer-profile-hero-main .muted.small,
#customer-profile-modal .detail-card .muted.small {
  color: var(--os-helpdesk-muted);
}

#customer-profile-modal .customer-tab {
  gap: 14px;
}

#customer-profile-modal .quick-log-card.inline,
#customer-profile-modal .detail-card {
  background: var(--os-helpdesk-panel);
}

@media (max-width: 1200px) {
  #customers-panel .customer-command-bar .command-main {
    grid-template-columns: 1fr;
  }

  #customers-panel .customer-command-bar .command-actions {
    justify-content: flex-start;
  }

  #customers-panel .customer-command-bar .command-meta {
    grid-template-columns: 1fr;
  }

  #customers-panel .customer-layout {
    grid-template-columns: 1fr;
  }

  #customers-panel .customer-detail-panel {
    position: static;
    top: auto;
    max-height: none;
    overflow: visible;
  }

  #customers-panel .customer-hero-top {
    grid-template-columns: 1fr;
  }

  #customers-panel .customer-hero-actions {
    justify-content: flex-start;
  }

  #customers-panel .customer-hero-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  #customers-panel .customer-command-bar {
    padding: 14px;
    border-radius: 24px;
  }

  #customers-panel .customer-command-bar .command-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  #customers-panel .customer-command-bar .command-actions > * {
    width: 100%;
    min-width: 0;
  }

  #customers-panel .view-disclosure {
    width: 100%;
    align-self: stretch;
  }

  #customers-panel .customer-filter-rail .basic-filters,
  #customers-panel .detail-grid {
    grid-template-columns: 1fr;
  }

  #customers-panel .customer-card-header {
    grid-template-columns: 1fr;
  }

  #customers-panel .customer-card-activity {
    align-items: flex-start;
    text-align: left;
  }

  #customers-panel .customer-hero-metrics {
    grid-template-columns: 1fr 1fr;
  }

  #customer-profile-modal .customer-profile-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  #customer-profile-modal .customer-profile-metrics {
    width: 100%;
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  #customers-panel .customer-command-bar,
  #customers-panel .customer-filter-rail,
  #customers-panel .customer-directory-card,
  #customers-panel .customer-summary-card,
  #customers-panel .quick-log-card,
  #customers-panel .detail-card {
    border-radius: 22px;
  }

  #customers-panel .customer-command-bar {
    padding: 12px;
  }

  #customers-panel .customer-command-bar .command-actions {
    grid-template-columns: 1fr;
  }

  #customers-panel .customer-command-bar .search-box.large {
    min-height: 50px;
    padding: 0 10px 0 14px;
    border-radius: 16px;
  }

  #customers-panel #customer-stats {
    width: 100%;
  }

  #customers-panel .stat-pill {
    min-height: 72px;
    padding: 12px 14px;
    border-radius: 16px;
  }

  #customers-panel .stat-pill-accounts {
    min-width: 100%;
  }

  #customers-panel .customer-directory-card .card-header,
  #customers-panel .customer-filter-rail .card-header,
  #customers-panel .quick-log-card .card-header,
  #customers-panel .history-card .card-header {
    padding: 15px 15px 10px;
  }

  #customers-panel .customer-directory-card .card-body,
  #customers-panel .customer-filter-rail .card-body,
  #customers-panel .quick-log-card form,
  #customers-panel .timeline,
  #customers-panel .visit-list,
  #customers-panel .conversation-list,
  #customers-panel .visit-form {
    padding-left: 15px;
    padding-right: 15px;
  }

  #customers-panel .customer-card-shell {
    padding: 16px 16px 16px 18px;
    border-radius: 22px;
  }

  #customers-panel .customer-card-avatar {
    width: 48px;
    height: 48px;
    border-radius: 16px;
  }

  #customers-panel .customer-card-name {
    font-size: 1.04rem;
  }

  #customers-panel .customer-card-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #customers-panel .customer-hero-card {
    padding: 16px;
  }

  #customers-panel .customer-hero-metrics {
    grid-template-columns: 1fr;
  }

  #customers-panel .detail-tabs,
  #customer-profile-modal .customer-tab-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }

  #customers-panel .detail-tabs::-webkit-scrollbar,
  #customer-profile-modal .customer-tab-nav::-webkit-scrollbar {
    display: none;
  }

  #customers-panel .detail-tab,
  #customer-profile-modal .tab-btn {
    white-space: nowrap;
  }

  #customer-profile-modal.drawer-wide {
    width: min(100vw - 12px, 100%);
    height: min(96vh, 100%);
    border-radius: 22px;
  }

  #customer-profile-modal .drawer-form {
    padding: 14px;
  }
}

/* Accounts helpdesk parity */
#customers-panel {
  gap: 18px;
}

/* Mobile-friendly customer drawer */
@media (max-width: 640px) {
  #customer-drawer {
    width: 100%;
    height: 100%;
    max-height: 100vh;
    border-radius: 18px;
  }

  #customer-drawer .drawer-header {
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 2;
  }

  #customer-drawer .drawer-form {
    padding: 14px;
  }

  #customer-drawer .form-grid.two-col {
    grid-template-columns: 1fr;
  }

  #customer-drawer .drawer-actions {
    display: grid;
    gap: 10px;
  }

  #customer-drawer .drawer-actions .btn-primary,
  #customer-drawer .drawer-actions .btn-secondary {
    width: 100%;
  }
}

/* CRM customer profile redesign */
#customer-profile-modal .drawer-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

#customer-profile-modal .crm-profile-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 18px;
  border-radius: 20px;
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.96), rgba(253, 247, 240, 0.95));
  box-shadow: 0 24px 50px -32px rgba(24, 18, 8, 0.35);
  border: 1px solid rgba(217, 190, 165, 0.35);
}

#customer-profile-modal .crm-profile-title h2 {
  margin: 6px 0 6px;
  font-size: 1.55rem;
}

#customer-profile-modal .crm-profile-title .eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.7rem;
  color: var(--muted-text);
  margin: 0;
}

#customer-profile-modal .crm-profile-kpis {
  display: grid;
  gap: 10px;
  min-width: 220px;
}

#customer-profile-modal .crm-kpi {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(217, 190, 165, 0.3);
  background: rgba(255, 255, 255, 0.72);
  font-weight: 600;
}

#customer-profile-modal .crm-kpi span {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-text);
}

#customer-profile-modal .crm-profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

#customer-profile-modal .crm-card {
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(217, 190, 165, 0.25);
  box-shadow: 0 16px 30px -26px rgba(31, 20, 8, 0.4);
}

#customer-profile-modal .crm-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 14px 16px 6px;
}

#customer-profile-modal .crm-card-body {
  padding: 0 16px 16px;
}

#customer-profile-modal .crm-list {
  display: grid;
  gap: 10px;
}

#customer-profile-modal .crm-list-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(217, 190, 165, 0.2);
  background: rgba(255, 255, 255, 0.76);
}

#customer-profile-modal .contact-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(217, 190, 165, 0.2);
  background: rgba(255, 255, 255, 0.76);
}

#customer-profile-modal .contact-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

#customer-profile-modal .billing-item-row,
#customer-profile-modal .schedule-row {
  align-items: flex-start;
}

#customer-profile-modal .billing-item-actions,
#customer-profile-modal .schedule-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

#customer-profile-modal .schedule-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

#customer-profile-modal .weekday-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

#customer-profile-modal .weekday-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(217, 190, 165, 0.35);
  background: rgba(255, 255, 255, 0.75);
  color: var(--text);
  font-size: 0.82rem;
  padding: 0 10px;
}

#customer-profile-modal .weekday-chip input {
  width: 16px;
  height: 16px;
}

#customer-profile-modal .crm-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

#customer-profile-modal .crm-calendar {
  display: grid;
  gap: 12px;
}

#customer-profile-modal .crm-calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#customer-profile-modal .crm-calendar-title {
  font-weight: 600;
}

#customer-profile-modal .crm-calendar-actions {
  display: inline-flex;
  gap: 8px;
}

#customer-profile-modal .crm-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

#customer-profile-modal .crm-calendar-header {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted-text);
  text-align: center;
}

#customer-profile-modal .crm-calendar-cell {
  min-height: 90px;
  border-radius: 12px;
  padding: 8px;
  border: 1px solid rgba(217, 190, 165, 0.2);
  background: rgba(255, 255, 255, 0.8);
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 6px;
}

#customer-profile-modal .crm-calendar-cell.is-empty {
  background: transparent;
  border: 1px dashed rgba(217, 190, 165, 0.2);
}

#customer-profile-modal .crm-calendar-day {
  font-size: 0.85rem;
  font-weight: 600;
}

#customer-profile-modal .crm-calendar-events {
  display: grid;
  gap: 4px;
}

#customer-profile-modal .crm-calendar-event {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  font-size: 0.72rem;
  padding: 4px 6px;
  border-radius: 8px;
  background: rgba(242, 106, 61, 0.1);
  color: #6b3518;
}

#customer-profile-modal .crm-calendar-event.visit {
  background: rgba(46, 163, 106, 0.12);
  color: #115533;
}

#customer-profile-modal .crm-calendar-time {
  opacity: 0.8;
  white-space: nowrap;
}

#customer-profile-modal .crm-calendar-more {
  font-size: 0.7rem;
  color: var(--muted-text);
}

@media (max-width: 640px) {
  #customer-profile-modal .billing-item-row,
  #customer-profile-modal .schedule-row {
    flex-direction: column;
    align-items: flex-start;
  }

  #customer-profile-modal .billing-item-actions,
  #customer-profile-modal .schedule-actions {
    width: 100%;
    justify-content: space-between;
  }

  #customer-profile-modal .weekday-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #customer-profile-modal .crm-calendar-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #customer-profile-modal .crm-calendar-header {
    display: none;
  }
}

@media (max-width: 980px) {
  #customer-profile-modal .crm-profile-header {
    grid-template-columns: 1fr;
    text-align: left;
  }

  #customer-profile-modal .crm-profile-kpis {
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #customer-profile-modal .crm-profile-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  #customer-profile-modal .crm-profile-header {
    padding: 14px;
  }

  #customer-profile-modal .crm-profile-title h2 {
    font-size: 1.25rem;
  }

  #customer-profile-modal .crm-profile-kpis {
    grid-template-columns: 1fr;
  }

  #customer-profile-modal .crm-meta-grid {
    grid-template-columns: 1fr;
  }
}

#customers-panel .customer-filter-rail,
#customers-panel .customer-views-bar,
#customers-panel .customer-segments,
#customers-panel .customer-mobile-toggle {
  display: none !important;
}

#customers-panel .customer-command-bar {
  padding: 18px;
  border-radius: 30px;
  border: 1px solid var(--os-helpdesk-border);
  background: var(--os-helpdesk-shell);
  box-shadow: var(--os-helpdesk-shadow);
  gap: 14px;
}

#customers-panel .customer-command-bar .command-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 14px;
}

#customers-panel .customer-command-bar .command-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

#customers-panel .customer-command-bar .command-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
}

#customers-panel .customer-sort-inline,
#customers-panel .customer-command-bar .view-toggle.compact {
  flex: 0 0 auto;
}

#customers-panel .customer-command-bar .view-toggle.compact {
  display: inline-flex;
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

#customers-panel .customer-command-bar .view-toggle.compact .btn-secondary.small {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 14px;
}

#customers-panel .customer-command-bar .search-box.large {
  min-height: 56px;
  border-radius: 18px;
}

#customers-panel .account-filter-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  min-height: 40px;
}

#customers-panel .account-filter-row .customer-result-count {
  color: var(--os-helpdesk-muted);
}

#customers-panel .customer-view-dropdown {
  position: relative;
}

#customers-panel .customer-view-dropdown > summary {
  min-height: 44px;
  padding: 0 15px;
  border-radius: 14px;
}

#customers-panel .customer-view-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 40;
  width: min(92vw, 640px);
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 22px;
  border: 1px solid var(--os-helpdesk-border);
  background: var(--os-helpdesk-panel);
  box-shadow: 0 28px 60px rgba(39, 28, 16, 0.18);
}

#customers-panel .customer-view-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

#customers-panel .customer-view-toolbar .toggle.small {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--os-helpdesk-border);
  background: var(--os-helpdesk-panel-strong);
}

#customers-panel .customer-view-popover .basic-filters,
#customers-panel .customer-view-popover .form-grid {
  margin: 0;
}

#customers-panel .customer-view-popover .basic-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

#customers-panel .customer-view-popover label,
#customers-panel .customer-view-popover .toggle span {
  color: var(--os-helpdesk-muted);
}

#customers-panel .customer-view-popover select,
#customers-panel .customer-view-popover input {
  min-height: 44px;
  border-radius: 14px;
}

#customers-panel .customer-layout {
  grid-template-columns: minmax(420px, 1.06fr) minmax(360px, 0.94fr);
  gap: 18px;
  align-items: start;
}

#customers-panel .customer-directory-card,
#customers-panel .customer-summary-card,
#customers-panel .quick-log-card,
#customers-panel .detail-card,
#customers-panel .history-card {
  border-radius: 30px;
  border-color: var(--os-helpdesk-border);
  background: var(--os-helpdesk-shell);
  box-shadow: var(--os-helpdesk-shadow);
}

#customers-panel .customer-directory-card .card-header,
#customers-panel .customer-directory-card .card-body {
  padding-left: 18px;
  padding-right: 18px;
}

#customers-panel .customer-directory-card .card-header {
  padding-top: 18px;
  padding-bottom: 10px;
  border-bottom: 0;
}

#customers-panel .customer-directory-card .card-body {
  padding-bottom: 18px;
}

#customers-panel .customer-card-shell {
  position: relative;
  padding: 18px 18px 18px 24px;
  gap: 12px;
  border-radius: 28px;
  border: 1px solid var(--os-helpdesk-border);
  background: var(--os-helpdesk-panel-strong);
  box-shadow: none;
}

#customers-panel .customer-card-shell::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18px;
  bottom: 18px;
  width: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, #68c8f7, #82ddb0);
}

#customers-panel .customer-card.active .customer-card-shell {
  border-color: rgba(223, 107, 59, 0.38);
  box-shadow: 0 18px 34px rgba(71, 53, 36, 0.1);
}

#customers-panel .customer-card-topline,
#customers-panel .customer-card-header,
#customers-panel .customer-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

#customers-panel .customer-card-topline {
  align-items: flex-start;
}

#customers-panel .customer-card-topline-left,
#customers-panel .customer-card-topline-right {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

#customers-panel .customer-card-identity {
  display: flex;
  align-items: center;
  gap: 14px;
}

#customers-panel .customer-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

#customers-panel .customer-card-name {
  font-size: 1.18rem;
  line-height: 1.06;
  letter-spacing: -0.03em;
  color: var(--os-helpdesk-text);
}

#customers-panel .customer-card-contact,
#customers-panel .customer-card-last {
  color: var(--os-helpdesk-muted);
}

#customers-panel .customer-card-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 12px;
  border-radius: 18px;
  border: 1px solid var(--os-helpdesk-border);
  background: rgba(255, 255, 255, 0.56);
}

[data-theme="dark"] #customers-panel .customer-card-metrics {
  background: rgba(16, 21, 28, 0.88);
}

#customers-panel .customer-card-summary {
  margin: 0;
  color: var(--os-helpdesk-muted);
  line-height: 1.55;
}

#customers-panel .customer-card-footer {
  padding-top: 8px;
  border-top: 1px dashed rgba(197, 180, 156, 0.56);
}

#customers-panel .customer-card-link {
  color: #c45d2a;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#customers-panel .customer-detail-panel {
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#customers-panel .customer-summary-card,
#customers-panel .quick-log-card,
#customers-panel .history-card {
  border-radius: 28px;
}

#customers-panel .customer-hero-card {
  padding: 18px;
}

#customers-panel .customer-hero-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
}

#customers-panel .customer-hero-actions {
  justify-content: flex-end;
}

#customers-panel .customer-hero-metrics {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

#customers-panel .customer-hero-metrics .metric-chip {
  min-height: 84px;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid var(--os-helpdesk-border);
  background: var(--os-helpdesk-panel);
}

#customers-panel .customer-action-bar {
  padding: 12px 14px;
  border-radius: 20px;
  border: 1px solid var(--os-helpdesk-border);
  background: var(--os-helpdesk-panel);
}

#customers-panel .detail-tabs {
  position: static;
  gap: 6px;
  padding: 6px;
  border-radius: 18px;
  border: 1px solid var(--os-helpdesk-border);
  background: var(--os-helpdesk-panel);
  box-shadow: none;
}

#customers-panel .detail-tab {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  color: var(--os-helpdesk-muted);
}

#customers-panel .detail-tab.active {
  background: var(--os-helpdesk-panel-strong);
  border-color: rgba(223, 107, 59, 0.22);
  color: var(--os-helpdesk-text);
  box-shadow: 0 10px 22px rgba(71, 53, 36, 0.08);
}

#customers-panel .timeline-item,
#customers-panel .visit-entry,
#customers-panel .appointment-item,
#customers-panel .conversation-entry {
  border-radius: 20px;
  border: 1px solid var(--os-helpdesk-border);
  background: var(--os-helpdesk-panel-strong);
  box-shadow: none;
}

@media (max-width: 1200px) {
  #customers-panel .customer-command-bar .command-main,
  #customers-panel .customer-command-bar .command-meta,
  #customers-panel .customer-layout,
  #customers-panel .customer-hero-top {
    grid-template-columns: 1fr;
  }

  #customers-panel .customer-command-bar .command-actions,
  #customers-panel .customer-hero-actions {
    justify-content: flex-start;
  }

  #customers-panel .customer-detail-panel {
    position: static;
    top: auto;
  }

  #customers-panel .customer-hero-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  #customers-panel .customer-command-bar {
    padding: 14px;
    border-radius: 24px;
  }

  #customers-panel .customer-command-bar .command-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  #customers-panel .customer-command-bar .command-actions > * {
    width: 100%;
    min-width: 0;
  }

  #customers-panel .customer-view-dropdown {
    width: 100%;
  }

  #customers-panel .customer-view-dropdown .customer-view-popover {
    position: static;
    width: 100%;
    margin-top: 10px;
  }

  #customers-panel .customer-view-popover .basic-filters,
  #customers-panel .customer-view-popover .form-grid,
  #customers-panel .customer-hero-metrics,
  #customers-panel .customer-card-metrics {
    grid-template-columns: 1fr;
  }

  #customers-panel .customer-card-topline,
  #customers-panel .customer-card-header,
  #customers-panel .customer-card-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  #customers-panel .customer-card-actions {
    width: 100%;
  }

  #customers-panel .customer-card-actions .btn-secondary {
    width: 100%;
  }

  #customers-panel:not(.show-detail) .customer-detail-panel,
  #customers-panel.show-detail .customer-rail,
  #customers-panel.show-detail .customer-detail-panel {
    display: flex;
  }
}

@media (max-width: 640px) {
  #customers-panel .customer-command-bar,
  #customers-panel .customer-directory-card,
  #customers-panel .customer-summary-card,
  #customers-panel .quick-log-card,
  #customers-panel .detail-card,
  #customers-panel .history-card {
    border-radius: 22px;
  }

  #customers-panel .customer-command-bar {
    padding: 12px;
  }

  #customers-panel .customer-command-bar .command-actions {
    grid-template-columns: 1fr;
  }

  #customers-panel .customer-command-bar .view-toggle.compact {
    width: 100%;
    justify-content: stretch;
  }

  #customers-panel .customer-command-bar .view-toggle.compact .btn-secondary.small {
    flex: 1 1 0;
    min-width: 0;
  }

  #customers-panel .customer-view-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  #customers-panel .customer-card-shell {
    padding: 16px 16px 16px 18px;
    border-radius: 22px;
  }

  #customers-panel .customer-card-avatar {
    width: 48px;
    height: 48px;
    border-radius: 16px;
  }

  #customers-panel .customer-card-name {
    font-size: 1.04rem;
  }
}

/* OnlineServices helpdesk archive/delete/conversation pass */
#helpdesk-panel .ticket-action-cluster {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

#helpdesk-panel .ticket-delete-btn {
  width: 38px;
  min-width: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  color: #c1553d;
}

#helpdesk-panel .ticket-delete-btn:hover,
#helpdesk-panel .ticket-delete-btn:focus-visible {
  border-color: rgba(223, 107, 59, 0.28);
  background: rgba(223, 107, 59, 0.08);
  color: #a64623;
}

#helpdesk-panel .ticket-delete-btn i {
  pointer-events: none;
  font-size: 1rem;
}

#issue-detail-panel #issue-comments.issue-thread {
  display: flex !important;
  flex-direction: column;
  gap: 12px !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

#issue-detail-panel #issue-comments.issue-thread .thread-empty-state {
  display: grid;
  gap: 4px;
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px dashed var(--os-helpdesk-border);
  background: rgba(255, 255, 255, 0.48);
  color: var(--os-helpdesk-muted);
}

#issue-detail-panel #issue-comments.issue-thread .thread-empty-state strong {
  color: var(--os-helpdesk-text);
  font-size: 0.96rem;
}

#issue-detail-panel #issue-comments.issue-thread .comment-entry {
  display: flex;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

#issue-detail-panel #issue-comments.issue-thread .comment-entry.self {
  justify-content: flex-end;
}

#issue-detail-panel #issue-comments.issue-thread .comment-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  width: min(100%, 760px);
  min-width: 0;
}

#issue-detail-panel #issue-comments.issue-thread .comment-entry.self .comment-row {
  flex-direction: row-reverse;
}

#issue-detail-panel #issue-comments.issue-thread .comment-avatar {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(223, 107, 59, 0.12);
  color: #b45522;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

#issue-detail-panel #issue-comments.issue-thread .comment-entry.self .comment-avatar {
  background: rgba(75, 155, 255, 0.14);
  color: #275fb6;
}

#issue-detail-panel #issue-comments.issue-thread .comment-bubble {
  min-width: 0;
  max-width: min(100%, 680px);
  padding: 14px 16px;
  border-radius: 20px;
  border: 1px solid rgba(214, 221, 233, 0.92);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 22px rgba(41, 52, 73, 0.04);
}

#issue-detail-panel #issue-comments.issue-thread .comment-entry.self .comment-bubble {
  background: linear-gradient(135deg, rgba(75, 155, 255, 0.12), rgba(255, 255, 255, 0.94));
  border-color: rgba(75, 155, 255, 0.22);
}

#issue-detail-panel #issue-comments.issue-thread .comment-entry .meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 8px !important;
  padding: 0 !important;
  color: var(--os-helpdesk-muted) !important;
  font-size: 0.74rem !important;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#issue-detail-panel #issue-comments.issue-thread .comment-author {
  color: var(--os-helpdesk-text);
}

#issue-detail-panel #issue-comments.issue-thread .comment-separator {
  opacity: 0.42;
}

#issue-detail-panel #issue-comments.issue-thread .comment-time {
  letter-spacing: 0.04em;
}

#issue-detail-panel #issue-comments.issue-thread .comment-body {
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--os-helpdesk-text) !important;
  line-height: 1.66;
}

#issue-detail-panel #issue-comments.issue-thread .comment-body > div:first-child {
  margin: 0;
}

#issue-detail-panel #issue-comments.issue-thread .comment-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

@media (max-width: 980px) {
  #helpdesk-panel .ticket-action-cluster {
    width: 100%;
    justify-content: flex-start;
  }

  #issue-detail-panel #issue-comments.issue-thread .comment-row {
    width: 100%;
  }

  #issue-detail-panel #issue-comments.issue-thread .comment-bubble {
    max-width: 100%;
  }
}

@media (max-width: 640px) {
  #helpdesk-panel .ticket-delete-btn {
    width: 36px;
    min-width: 36px;
  }

  #issue-detail-panel #issue-comments.issue-thread {
    gap: 10px !important;
  }

  #issue-detail-panel #issue-comments.issue-thread .comment-avatar {
    flex-basis: 30px;
    width: 30px;
    height: 30px;
    border-radius: 10px;
    font-size: 0.72rem;
  }

  #issue-detail-panel #issue-comments.issue-thread .comment-bubble {
    padding: 12px 14px;
    border-radius: 18px;
  }

  #issue-detail-panel #issue-comments.issue-thread .comment-entry .meta {
    font-size: 0.68rem !important;
  }
}

/* OnlineServices accounts full-width list and row actions */
#customers-panel .customer-layout,
#customers-panel.show-detail .customer-layout {
  grid-template-columns: minmax(0, 1fr) !important;
}

#customers-panel .customer-rail {
  min-width: 0;
}

#customers-panel .customer-detail-panel,
#customers-panel:not(.show-detail) .customer-detail-panel,
#customers-panel.show-detail .customer-detail-panel {
  display: none !important;
}

#customers-panel .customer-directory-card {
  width: 100%;
}

#customers-panel .customer-directory-card.list-view .data-table {
  width: 100%;
}

#customers-panel .customer-directory-card.list-view .data-table td:last-child,
#customers-panel .customer-directory-card.list-view .data-table th:last-child {
  min-width: 300px;
}

#customers-panel .customer-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

#customers-panel .customer-row-actions--static {
  pointer-events: none;
}

#customers-panel .customer-row-action {
  justify-content: center;
  cursor: pointer;
  color: var(--os-helpdesk-text);
  border-color: var(--os-helpdesk-border);
  background: rgba(255, 255, 255, 0.7);
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
  font-size: 0.78rem;
  gap: 4px;
}

[data-theme="dark"] #customers-panel .customer-row-action {
  background: rgba(16, 21, 28, 0.88);
}

#customers-panel .customer-row-action:hover {
  transform: translateY(-1px);
}

#customers-panel .customer-row-action.is-on {
  border-color: rgba(93, 176, 120, 0.38);
  background: rgba(93, 176, 120, 0.12);
  color: #257a52;
}

#customers-panel .customer-row-action.is-off {
  color: var(--os-helpdesk-muted);
  opacity: 0.7;
}

#customers-panel .customer-row-action.is-off:hover {
  opacity: 1;
}

#customers-panel .customer-row-actions + .customer-tag-row {
  margin-top: 8px;
}

@media (max-width: 900px) {
  #customers-panel .customer-directory-card.list-view .data-table td:last-child,
  #customers-panel .customer-directory-card.list-view .data-table th:last-child {
    min-width: 240px;
  }
}

/* OnlineServices dashboard redesign */
#dashboard-panel .dashboard-shell {
  display: grid;
  gap: 16px;
}

#dashboard-panel .dashboard-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.7fr);
  align-items: center;
  gap: 16px;
  padding: 20px 22px;
  border-radius: 28px;
  border: 1px solid rgba(217, 93, 47, 0.18);
  background:
    radial-gradient(circle at 15% 12%, rgba(242, 106, 61, 0.2), transparent 42%),
    radial-gradient(circle at 85% 18%, rgba(83, 199, 241, 0.16), transparent 36%),
    var(--os-surface-light);
  box-shadow: var(--os-warm-shadow);
  overflow: hidden;
}

#dashboard-panel .dashboard-hero.dashboard-hero-actions-only {
  display: flex;
  justify-content: flex-end;
}

#dashboard-panel .dashboard-hero.dashboard-hero-actions-only .dashboard-hero-actions {
  width: min(100%, 640px);
}

[data-theme="dark"] #dashboard-panel .dashboard-hero {
  border-color: rgba(255, 255, 255, 0.1);
  background:
    radial-gradient(circle at 15% 12%, rgba(242, 106, 61, 0.22), transparent 42%),
    radial-gradient(circle at 85% 18%, rgba(83, 199, 241, 0.2), transparent 36%),
    var(--os-surface-dark);
}

#dashboard-panel .dashboard-hero-copy {
  position: relative;
  z-index: 1;
}

#dashboard-panel .dashboard-hero-copy h2 {
  margin: 0 0 8px;
  font-size: clamp(1.5rem, 2.2vw, 2.05rem);
  line-height: 1.08;
  letter-spacing: -0.04em;
  color: var(--os-helpdesk-text);
}

#dashboard-panel .dashboard-hero-copy .muted {
  max-width: 56ch;
  margin: 0;
  color: var(--os-helpdesk-muted);
}

#dashboard-panel .dashboard-hero-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

#dashboard-panel .dashboard-hero-actions .btn-primary,
#dashboard-panel .dashboard-hero-actions .btn-secondary {
  min-height: 46px;
  width: 100%;
  justify-content: center;
  gap: 8px;
}

#dashboard-panel .dashboard-kpi-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 0;
}

#dashboard-panel .dashboard-kpi-grid .stat-card {
  min-height: 132px;
  border-radius: 24px;
}

#dashboard-panel .dashboard-kpi-grid .stat-content h3 {
  margin-bottom: 8px;
}

#dashboard-panel .stat-revenue-toggle {
  margin-top: 8px;
  border: 1px solid rgba(217, 93, 47, 0.28);
  background: rgba(255, 255, 255, 0.76);
  color: var(--os-helpdesk-text);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 4px 12px;
  cursor: pointer;
}

#dashboard-panel .stat-revenue-toggle:hover,
#dashboard-panel .stat-revenue-toggle:focus-visible {
  border-color: rgba(217, 93, 47, 0.48);
}

[data-theme="dark"] #dashboard-panel .stat-revenue-toggle {
  background: rgba(16, 21, 28, 0.92);
  border-color: rgba(255, 255, 255, 0.18);
  color: #f4f6fb;
}

#dashboard-panel .dashboard-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.55fr);
  gap: 16px;
  align-items: start;
}

#dashboard-panel .dashboard-activity-card,
#dashboard-panel .dashboard-quick-card {
  border-radius: 28px;
}

#dashboard-panel .dashboard-activity-card .card-header,
#dashboard-panel .dashboard-quick-card .card-header {
  padding: 16px 18px 10px;
}

#dashboard-panel .dashboard-activity-card .card-body,
#dashboard-panel .dashboard-quick-card .card-body {
  padding: 0 18px 18px;
}

#dashboard-panel #activity-feed .activity-list {
  gap: 10px;
}

#dashboard-panel #activity-feed .activity-item {
  border-radius: 16px;
  padding: 12px 14px;
  border: 1px solid rgba(217, 93, 47, 0.18);
  background: rgba(255, 255, 255, 0.55);
}

[data-theme="dark"] #dashboard-panel #activity-feed .activity-item {
  border-color: rgba(255, 255, 255, 0.09);
  background: rgba(16, 21, 28, 0.88);
}

#dashboard-panel .dashboard-side-stack {
  display: grid;
  gap: 16px;
}

#dashboard-panel .quick-actions-grid {
  grid-template-columns: 1fr;
  gap: 10px;
}

#dashboard-panel .quick-action {
  position: relative;
  z-index: 2;
  pointer-events: auto;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  min-height: 68px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(217, 93, 47, 0.16);
  background: rgba(255, 255, 255, 0.7);
  gap: 10px;
  text-align: left;
  color: var(--os-helpdesk-text);
  cursor: pointer;
}

[data-theme="dark"] #dashboard-panel .quick-action {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(18, 24, 31, 0.9);
}

#dashboard-panel .quick-action:hover,
#dashboard-panel .quick-action:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(223, 107, 59, 0.46);
  box-shadow: 0 14px 24px rgba(111, 71, 38, 0.14);
  color: var(--os-helpdesk-text);
}

#dashboard-panel .quick-action i {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 1rem;
  background: rgba(223, 107, 59, 0.14);
  color: #cc6430;
}

#dashboard-panel .quick-action span {
  font-weight: 700;
  letter-spacing: -0.02em;
}

@media (max-width: 1200px) {
  #dashboard-panel .dashboard-hero,
  #dashboard-panel .dashboard-main-grid {
    grid-template-columns: 1fr;
  }

  #dashboard-panel .dashboard-hero-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #dashboard-panel .dashboard-hero.dashboard-hero-actions-only {
    display: block;
  }

  #dashboard-panel .dashboard-hero.dashboard-hero-actions-only .dashboard-hero-actions {
    width: 100%;
  }
}

@media (max-width: 900px) {
  #dashboard-panel .dashboard-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #dashboard-panel .dashboard-hero {
    border-radius: 24px;
    padding: 16px;
  }

  #dashboard-panel .dashboard-hero-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  #dashboard-panel .dashboard-kpi-grid {
    grid-template-columns: 1fr;
  }

  #dashboard-panel .dashboard-activity-card,
  #dashboard-panel .dashboard-quick-card {
    border-radius: 22px;
  }

  #dashboard-panel .dashboard-activity-card .card-header,
  #dashboard-panel .dashboard-quick-card .card-header {
    padding: 14px 14px 10px;
  }

  #dashboard-panel .dashboard-activity-card .card-body,
  #dashboard-panel .dashboard-quick-card .card-body {
    padding: 0 14px 14px;
  }
}

/* Helpdesk density + workflow improvements (items 1-6, 8-10) */
#helpdesk-panel .helpdesk-command-bar {
  position: sticky !important;
  top: 12px;
  z-index: 22;
  padding: 12px 14px !important;
  gap: 10px !important;
}

#helpdesk-panel .helpdesk-command-bar .command-main {
  gap: 10px !important;
}

#helpdesk-panel .helpdesk-command-bar .search-box.large input {
  min-height: 48px !important;
}

#helpdesk-panel .helpdesk-command-bar .btn-primary,
#helpdesk-panel .helpdesk-command-bar .btn-secondary,
#helpdesk-panel .helpdesk-command-bar .compact-select,
#helpdesk-panel .helpdesk-command-bar select,
#helpdesk-panel .helpdesk-action-dropdown > summary {
  min-height: 38px !important;
  border-radius: 13px !important;
  padding: 0 12px !important;
}

#helpdesk-panel .helpdesk-quick-views {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

#helpdesk-panel .quick-view-chip {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--os-helpdesk-border);
  background: var(--os-helpdesk-panel-strong);
  color: var(--os-helpdesk-muted);
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.01em;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}

#helpdesk-panel .quick-view-chip:hover,
#helpdesk-panel .quick-view-chip:focus-visible {
  border-color: rgba(223, 107, 59, 0.28);
  color: #b45522;
}

#helpdesk-panel .quick-view-chip.active {
  border-color: rgba(223, 107, 59, 0.3);
  background: rgba(223, 107, 59, 0.12);
  color: #b45522;
}

#helpdesk-panel .ticket-toolbar {
  position: sticky !important;
  top: 94px !important;
  z-index: 18;
  padding: 10px 12px !important;
  gap: 10px !important;
}

#helpdesk-panel .ticket-toolbar .toolbar-left {
  gap: 6px !important;
}

#helpdesk-panel .ticket-toolbar:not(.has-selection) .toolbar-left > button,
#helpdesk-panel .ticket-toolbar:not(.has-selection) .toolbar-left > .inline-field {
  display: none !important;
}

#helpdesk-panel .ticket-toolbar .toolbar-right {
  font-weight: 600;
}

#helpdesk-panel .ticket-list {
  gap: 10px !important;
}

#helpdesk-panel .ticket-card {
  padding: 12px 13px 12px 16px !important;
  gap: 10px !important;
  border-radius: 18px !important;
}

#helpdesk-panel .ticket-main {
  gap: 8px !important;
}

#helpdesk-panel .ticket-title-row {
  gap: 10px !important;
}

#helpdesk-panel .ticket-title-stack {
  gap: 9px !important;
}

#helpdesk-panel .ticket-avatar-badge {
  width: 36px !important;
  height: 36px !important;
  flex-basis: 36px !important;
  border-radius: 12px !important;
  font-size: 0.8rem !important;
}

#helpdesk-panel .ticket-details h4 {
  font-size: 0.97rem !important;
}

#helpdesk-panel .ticket-subtitle {
  margin-top: 2px !important;
  font-size: 0.88rem !important;
}

#helpdesk-panel .ticket-status-stack {
  gap: 6px !important;
  align-items: center !important;
}

#helpdesk-panel .ticket-reference-row {
  min-height: 26px;
}

#helpdesk-panel .ticket-reference {
  min-height: 24px !important;
  font-size: 0.67rem !important;
  padding: 0 8px !important;
}

#helpdesk-panel .ticket-pill-row {
  gap: 6px !important;
}

#helpdesk-panel .ticket-pill {
  min-height: 27px !important;
  font-size: 0.74rem !important;
  padding: 0 8px !important;
}

#helpdesk-panel .ticket-pill-severity {
  border-color: rgba(148, 163, 184, 0.28);
}

#helpdesk-panel .ticket-preview {
  font-size: 0.92rem !important;
  line-height: 1.5 !important;
}

#helpdesk-panel .ticket-footer-row {
  border-top-style: dotted !important;
  padding-top: 4px !important;
}

#helpdesk-panel .ticket-inline-hint {
  min-height: 22px !important;
  font-size: 0.64rem !important;
  padding: 0 8px !important;
}

#helpdesk-panel .ticket-actions-menu {
  position: relative;
}

#helpdesk-panel .ticket-actions-menu > summary {
  list-style: none;
}

#helpdesk-panel .ticket-actions-menu > summary::-webkit-details-marker {
  display: none;
}

#helpdesk-panel .ticket-actions-trigger {
  width: 34px;
  min-width: 34px;
  min-height: 34px !important;
  padding: 0 !important;
  border-radius: 11px !important;
}

#helpdesk-panel .ticket-actions-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 10;
  width: min(220px, calc(100vw - 40px));
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid var(--os-helpdesk-border);
  background: var(--os-helpdesk-panel);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.14);
}

#helpdesk-panel .ticket-menu-btn {
  justify-content: flex-start;
  min-height: 34px !important;
  border-radius: 10px !important;
  gap: 8px;
}

#helpdesk-panel .ticket-menu-btn.danger {
  border-color: rgba(223, 107, 59, 0.3);
  color: #b45522;
}

#helpdesk-panel .ticket-menu-field {
  display: grid;
  gap: 6px;
}

#helpdesk-panel .ticket-menu-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--os-helpdesk-muted);
}

#helpdesk-panel .ticket-menu-field .ticket-chip-select-wrap {
  width: 100%;
}

#helpdesk-panel .ticket-menu-field .ticket-chip-select {
  width: 100%;
  justify-content: flex-start;
  min-height: 34px;
}

#helpdesk-panel .helpdesk-grid {
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 12px !important;
}

#helpdesk-panel.split-view .helpdesk-grid {
  grid-template-columns: minmax(0, 1fr) auto !important;
}

#helpdesk-panel.split-view .ticket-detail-shelf {
  display: block !important;
  width: clamp(390px, 35vw, 520px);
  min-width: 380px;
  max-width: 58vw;
  overflow: auto;
  resize: horizontal;
}

#helpdesk-panel.split-view #issue-detail-panel.inline {
  position: sticky !important;
  top: 136px !important;
  max-height: calc(100vh - 150px) !important;
}

#issue-detail-panel .issue-comments {
  min-height: 0;
}

#issue-detail-panel #issue-comments.issue-thread {
  max-height: min(44vh, 420px);
  overflow-y: auto;
  padding-right: 2px;
}

#issue-detail-panel .comment-form {
  position: sticky;
  bottom: 0;
  z-index: 6;
  margin-top: 10px;
  border-top: 1px solid var(--os-helpdesk-border);
  background: var(--os-helpdesk-panel) !important;
  backdrop-filter: blur(5px);
}

@media (max-width: 1179px) {
  #helpdesk-panel .helpdesk-command-bar,
  #helpdesk-panel .ticket-toolbar {
    position: static !important;
    top: auto !important;
  }

  #helpdesk-panel.split-view .helpdesk-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  #helpdesk-panel .ticket-detail-shelf {
    display: none !important;
    resize: none;
  }

  #helpdesk-panel .ticket-actions-popover {
    left: 0;
    right: auto;
  }

  #issue-detail-panel #issue-comments.issue-thread {
    max-height: none;
  }
}

/* Helpdesk compact comment composer */
#issue-detail-panel .comment-form {
  gap: 8px !important;
}

#issue-detail-panel .comment-form textarea {
  min-height: 52px !important;
  max-height: 220px !important;
  height: 52px;
  resize: none !important;
  overflow-y: hidden;
  line-height: 1.45;
  padding-top: 0.72rem;
  padding-bottom: 0.72rem;
}

@media (max-width: 760px) {
  #issue-detail-panel .comment-form textarea {
    min-height: 48px !important;
    max-height: 200px !important;
    height: 48px;
  }
}

/* OnlineServices invoicing redesign */
#invoices-panel {
  gap: 16px;
}

#invoices-panel > .panel-header.invoice-page-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  margin: 0;
  padding: 16px 18px;
  border-radius: 26px;
  border: 1px solid rgba(217, 93, 47, 0.16);
  background:
    radial-gradient(circle at 10% -6%, rgba(242, 106, 61, 0.2), transparent 42%),
    radial-gradient(circle at 88% 5%, rgba(83, 199, 241, 0.14), transparent 34%),
    linear-gradient(100deg, rgba(255, 246, 241, 0.86), rgba(244, 248, 251, 0.92));
  box-shadow: 0 18px 36px rgba(38, 26, 15, 0.1);
}

[data-theme="dark"] #invoices-panel > .panel-header.invoice-page-header {
  border-color: rgba(148, 163, 184, 0.24);
  background:
    radial-gradient(circle at 12% -8%, rgba(249, 115, 70, 0.2), transparent 38%),
    radial-gradient(circle at 88% -4%, rgba(59, 130, 246, 0.18), transparent 33%),
    linear-gradient(120deg, rgba(15, 23, 42, 0.84), rgba(17, 24, 39, 0.9));
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.34);
}

#invoices-panel .invoice-header-copy .eyebrow {
  margin-bottom: 7px;
}

#invoices-panel .invoice-header-copy h1 {
  margin: 0;
  font-size: clamp(1.48rem, 2vw, 2.08rem);
  letter-spacing: -0.04em;
  color: var(--os-helpdesk-text);
}

#invoices-panel .invoice-header-copy p {
  margin: 6px 0 0;
  color: var(--os-helpdesk-muted);
}

#invoices-panel .invoice-actions-shell {
  border: 1px solid rgba(217, 93, 47, 0.14);
  border-radius: 16px;
  padding: 9px;
  background: rgba(255, 255, 255, 0.62);
}

[data-theme="dark"] #invoices-panel .invoice-actions-shell {
  border-color: rgba(148, 163, 184, 0.24);
  background: rgba(15, 23, 42, 0.52);
}

#invoices-panel .header-actions.invoice-top-actions {
  width: auto;
  justify-content: flex-end;
  gap: 8px;
}

#invoices-panel .header-actions.invoice-top-actions .btn-primary,
#invoices-panel .header-actions.invoice-top-actions .btn-secondary {
  min-height: 42px;
  padding-inline: 14px;
  border-radius: 12px;
}

#invoices-panel .invoice-kpi-grid {
  margin: 0;
  gap: 12px;
}

#invoices-panel .invoice-kpi-grid .stat-card {
  min-height: 118px;
  border-radius: 20px;
  padding: 14px 15px;
  border: 1px solid rgba(217, 93, 47, 0.14);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(252, 248, 241, 0.78));
  box-shadow: 0 10px 24px rgba(38, 26, 15, 0.08);
}

[data-theme="dark"] #invoices-panel .invoice-kpi-grid .stat-card {
  border-color: rgba(148, 163, 184, 0.24);
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.92), rgba(15, 23, 42, 0.88));
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.28);
}

#invoices-panel .invoice-kpi-grid .stat-content h3 {
  margin-bottom: 5px;
  font-size: clamp(1.5rem, 2vw, 2.05rem);
  letter-spacing: -0.03em;
}

#invoices-panel .invoice-kpi-grid .stat-content p {
  font-size: 0.84rem;
  color: var(--os-helpdesk-muted);
}

#invoices-panel .invoice-automation-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  grid-template-areas:
    "run pauses"
    "activity pauses";
  align-items: start;
}

#invoices-panel .invoice-run-card {
  grid-area: run;
}

#invoices-panel .invoice-history-log-card {
  grid-area: activity;
}

#invoices-panel #automation-pauses-card {
  grid-area: pauses;
}

#invoices-panel .invoice-automation-grid [data-report-card="invoices"][aria-hidden="true"] {
  display: none !important;
}

#invoices-panel .invoice-automation-grid .invoice-automation-card {
  border-radius: 22px;
  border: 1px solid rgba(217, 93, 47, 0.14);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(252, 247, 240, 0.74));
}

[data-theme="dark"] #invoices-panel .invoice-automation-grid .invoice-automation-card {
  border-color: rgba(148, 163, 184, 0.22);
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.9), rgba(17, 24, 39, 0.86));
}

#invoices-panel .invoice-automation-grid .invoice-automation-card .card-header {
  align-items: flex-start;
  padding-bottom: 8px;
}

#invoices-panel .invoice-automation-grid .invoice-automation-card .card-header h3 {
  margin: 0;
  font-size: 1.08rem;
  letter-spacing: -0.02em;
}

#invoices-panel .invoice-automation-grid .invoice-automation-card .card-body {
  padding-top: 0;
}

#invoices-panel .automation-form {
  gap: 12px;
}

#invoices-panel .automation-form .form-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

#invoices-panel .automation-form input[type="month"],
#invoices-panel .automation-form select {
  min-height: 42px;
  border-radius: 12px;
}

#invoices-panel .automation-form .btn-primary,
#invoices-panel .automation-form .btn-secondary {
  min-height: 42px;
}

#invoices-panel .invoice-run-card .automation-form .btn-primary {
  width: 100%;
}

#invoices-panel .invoice-history-log-card #automation-log {
  max-height: 312px;
  overflow: auto;
  padding-right: 4px;
}

#invoices-panel .automation-entry,
#invoices-panel .pause-entry {
  border-radius: 14px;
}

#invoices-panel .automation-entry {
  border: 1px solid rgba(217, 93, 47, 0.14);
  background: rgba(255, 255, 255, 0.58);
}

[data-theme="dark"] #invoices-panel .automation-entry {
  border-color: rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.52);
}

#invoices-panel .pause-entry {
  border-style: solid;
  border-color: rgba(217, 93, 47, 0.12);
  background: rgba(255, 255, 255, 0.56);
}

[data-theme="dark"] #invoices-panel .pause-entry {
  border-color: rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.5);
}

#invoices-panel .pause-list {
  max-height: 440px;
  overflow: auto;
  padding-right: 4px;
}

#invoices-panel .invoice-history-card {
  border-radius: 26px;
  border: 1px solid rgba(217, 93, 47, 0.14);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(252, 246, 238, 0.76));
}

[data-theme="dark"] #invoices-panel .invoice-history-card {
  border-color: rgba(148, 163, 184, 0.22);
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.86));
}

#invoices-panel .invoice-history-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
}

#invoices-panel .invoice-history-header h3 {
  margin: 2px 0 0;
}

#invoices-panel .invoice-history-filters {
  justify-content: flex-end;
  gap: 9px;
}

#invoices-panel .invoice-history-filters select {
  min-width: 170px;
  min-height: 40px;
  border-radius: 11px;
}

#invoices-panel .invoice-history-body {
  display: grid;
  gap: 12px;
}

#invoices-panel .invoice-history-toolbar {
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

#invoices-panel .invoice-history-toolbar .table-select {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(217, 93, 47, 0.16);
  background: rgba(255, 255, 255, 0.68);
}

[data-theme="dark"] #invoices-panel .invoice-history-toolbar .table-select {
  border-color: rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.5);
}

#invoices-panel .invoice-history-toolbar .toolbar-actions {
  margin-left: auto;
  justify-content: flex-end;
}

#invoices-panel .invoice-history-toolbar .toolbar-actions .btn-secondary,
#invoices-panel .invoice-history-toolbar .toolbar-actions .btn-danger {
  min-height: 40px;
  border-radius: 11px;
}

#invoices-panel .invoice-history-table {
  overflow: auto;
  border-radius: 18px;
  border: 1px solid rgba(217, 93, 47, 0.14);
  background: rgba(255, 255, 255, 0.62);
}

[data-theme="dark"] #invoices-panel .invoice-history-table {
  border-color: rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.42);
}

#invoices-panel .invoice-history-table .data-table {
  width: 100%;
  min-width: 1080px;
  border-collapse: separate;
  border-spacing: 0;
}

#invoices-panel .invoice-history-table .data-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 245, 239, 0.95));
}

[data-theme="dark"] #invoices-panel .invoice-history-table .data-table thead th {
  background: linear-gradient(180deg, rgba(23, 29, 38, 0.98), rgba(18, 22, 29, 0.96));
}

#invoices-panel .invoice-history-table .data-table th,
#invoices-panel .invoice-history-table .data-table td {
  padding: 12px 10px;
}

#invoices-panel .invoice-row td {
  vertical-align: middle;
  border-bottom: 1px solid rgba(217, 93, 47, 0.12);
}

[data-theme="dark"] #invoices-panel .invoice-row td {
  border-bottom-color: rgba(148, 163, 184, 0.16);
}

#invoices-panel .invoice-row:hover td {
  background: rgba(223, 107, 59, 0.05);
}

[data-theme="dark"] #invoices-panel .invoice-row:hover td {
  background: rgba(223, 107, 59, 0.08);
}

#invoices-panel .invoice-identity,
#invoices-panel .invoice-customer-meta,
#invoices-panel .invoice-date-meta {
  display: grid;
  gap: 2px;
}

#invoices-panel .invoice-row-amount {
  font-size: 1.04rem;
  letter-spacing: -0.01em;
}

#invoices-panel .invoice-actions-cell {
  width: 280px;
  min-width: 280px;
}

#invoices-panel .invoice-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 7px;
}

#invoices-panel .invoice-row-actions > .ghost-btn {
  min-height: 34px;
  border-radius: 10px;
  padding: 0.34rem 0.75rem;
  gap: 6px;
}

#invoices-panel .invoice-action-menu {
  position: relative;
}

#invoices-panel .invoice-action-menu > summary {
  list-style: none;
}

#invoices-panel .invoice-action-menu > summary::-webkit-details-marker {
  display: none;
}

#invoices-panel .invoice-action-menu > summary i {
  font-size: 0.73rem;
  transition: transform 0.16s ease;
}

#invoices-panel .invoice-action-menu[open] > summary i {
  transform: rotate(180deg);
}

#invoices-panel .invoice-action-menu-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 10;
  min-width: 208px;
  display: grid;
  gap: 5px;
  padding: 7px;
  border-radius: 12px;
  border: 1px solid rgba(217, 93, 47, 0.2);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 239, 228, 0.94));
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.14);
}

[data-theme="dark"] #invoices-panel .invoice-action-menu-popover {
  border-color: rgba(148, 163, 184, 0.22);
  background: linear-gradient(180deg, rgba(23, 29, 38, 0.98), rgba(18, 22, 29, 0.96));
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.36);
}

#invoices-panel .invoice-menu-item {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-height: 34px;
  padding: 0.42rem 0.62rem;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--os-helpdesk-text);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

#invoices-panel .invoice-menu-item:hover,
#invoices-panel .invoice-menu-item:focus-visible {
  border-color: rgba(217, 93, 47, 0.25);
  background: rgba(223, 107, 59, 0.1);
}

#invoices-panel .invoice-menu-item.danger {
  color: #b45522;
}

[data-theme="dark"] #invoices-panel .invoice-menu-item.danger {
  color: #ffb087;
}

#invoices-panel .invoice-empty-row td {
  padding: 30px 16px;
  text-align: center;
}

#invoices-panel #invoice-pagination {
  justify-content: flex-end;
  padding: 10px 4px 0;
}

#invoices-panel #invoice-pagination .btn-secondary.small {
  min-height: 34px;
  border-radius: 10px;
}

@media (max-width: 1220px) {
  #invoices-panel .invoice-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #invoices-panel .invoice-automation-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "run"
      "activity"
      "pauses";
  }

  #invoices-panel .pause-list {
    max-height: 320px;
  }
}

@media (max-width: 960px) {
  #invoices-panel > .panel-header.invoice-page-header {
    grid-template-columns: 1fr;
  }

  #invoices-panel .invoice-actions-shell {
    width: 100%;
  }

  #invoices-panel .header-actions.invoice-top-actions {
    width: 100%;
    justify-content: flex-start;
  }

  #invoices-panel .header-actions.invoice-top-actions > button {
    flex: 1 1 220px;
  }

  #invoices-panel .invoice-history-header {
    grid-template-columns: 1fr;
  }

  #invoices-panel .invoice-history-filters {
    width: 100%;
    justify-content: flex-start;
  }

  #invoices-panel .invoice-history-filters select {
    flex: 1 1 200px;
    min-width: 0;
  }

  #invoices-panel .invoice-history-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  #invoices-panel .invoice-history-toolbar .toolbar-actions {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }

  #invoices-panel .invoice-history-toolbar .toolbar-actions > button {
    flex: 1 1 180px;
  }
}

@media (max-width: 760px) {
  #invoices-panel .invoice-kpi-grid {
    grid-template-columns: 1fr;
  }

  #invoices-panel .header-actions.invoice-top-actions > button {
    flex: 1 1 calc(50% - 8px);
  }

  #invoices-panel .automation-form .form-row {
    grid-template-columns: 1fr;
  }

  #invoices-panel .invoice-history-table {
    overflow: visible;
    border: none;
    background: transparent;
  }

  #invoices-panel .invoice-history-table .data-table,
  #invoices-panel .invoice-history-table .data-table tbody,
  #invoices-panel .invoice-history-table .data-table tr,
  #invoices-panel .invoice-history-table .data-table td {
    display: block;
    width: 100%;
  }

  #invoices-panel .invoice-history-table .data-table {
    min-width: 0;
  }

  #invoices-panel .invoice-history-table .data-table thead {
    display: none;
  }

  #invoices-panel .invoice-history-table .data-table tr.invoice-row {
    margin-bottom: 10px;
    padding: 8px;
    border: 1px solid rgba(217, 93, 47, 0.16);
    border-radius: 16px;
    background: var(--os-helpdesk-panel);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  }

  [data-theme="dark"] #invoices-panel .invoice-history-table .data-table tr.invoice-row {
    border-color: rgba(148, 163, 184, 0.2);
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.26);
  }

  #invoices-panel .invoice-history-table .data-table td {
    border: 0;
    padding: 7px 8px;
    display: grid;
    grid-template-columns: 94px minmax(0, 1fr);
    gap: 9px;
    align-items: start;
  }

  #invoices-panel .invoice-history-table .data-table td::before {
    content: attr(data-label);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--os-helpdesk-muted);
    padding-top: 2px;
  }

  #invoices-panel .invoice-history-table .data-table td.checkbox-cell {
    grid-template-columns: auto 1fr;
  }

  #invoices-panel .invoice-history-table .data-table td.checkbox-cell::before {
    content: "";
  }

  #invoices-panel .invoice-actions-cell {
    width: auto;
    min-width: 0;
  }

  #invoices-panel .invoice-row-actions {
    justify-content: flex-start;
  }

  #invoices-panel .invoice-action-menu-popover {
    left: 0;
    right: auto;
    width: min(230px, 72vw);
  }

  #invoices-panel .invoice-history-table .data-table tr.invoice-empty-row {
    display: table-row;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
  }

  #invoices-panel .invoice-history-table .data-table tr.invoice-empty-row td {
    display: table-cell;
    padding: 20px 8px;
  }

  #invoices-panel .invoice-history-table .data-table tr.invoice-empty-row td::before {
    display: none;
  }
}

/* Reports / Insights redesign */
#reports-panel {
  gap: 14px;
}

#reports-panel > .panel-header.reports-page-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin: 0;
  padding: 14px 16px;
  border-radius: 26px;
  border: 1px solid rgba(217, 93, 47, 0.16);
  background:
    radial-gradient(circle at 8% 4%, rgba(242, 106, 61, 0.18), transparent 42%),
    radial-gradient(circle at 90% -2%, rgba(83, 199, 241, 0.14), transparent 32%),
    linear-gradient(104deg, rgba(255, 246, 239, 0.86), rgba(244, 248, 251, 0.9));
  box-shadow: 0 18px 36px rgba(38, 26, 15, 0.1);
}

[data-theme="dark"] #reports-panel > .panel-header.reports-page-header {
  border-color: rgba(148, 163, 184, 0.24);
  background:
    radial-gradient(circle at 10% -4%, rgba(249, 115, 70, 0.18), transparent 38%),
    radial-gradient(circle at 88% -8%, rgba(59, 130, 246, 0.16), transparent 34%),
    linear-gradient(118deg, rgba(15, 23, 42, 0.86), rgba(17, 24, 39, 0.92));
  box-shadow: 0 20px 42px rgba(0, 0, 0, 0.34);
}

#reports-panel .reports-header-copy .eyebrow {
  margin-bottom: 7px;
}

#reports-panel .reports-header-copy h1 {
  margin: 0;
  font-size: clamp(1.44rem, 1.9vw, 1.98rem);
  letter-spacing: -0.04em;
}

#reports-panel .reports-header-copy p {
  margin: 6px 0 0;
}

#reports-panel .reports-header-tools {
  display: grid;
  gap: 8px;
  justify-items: end;
}

#reports-panel .reports-range-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: flex-end;
}

#reports-panel .reports-range-picker .report-range-btn {
  min-height: 34px;
  border-radius: 999px;
  padding-inline: 11px;
}

#reports-panel .reports-range-picker .report-range-btn.active {
  border-color: rgba(223, 107, 59, 0.34);
  background: rgba(223, 107, 59, 0.14);
  color: #b45522;
}

[data-theme="dark"] #reports-panel .reports-range-picker .report-range-btn.active {
  border-color: rgba(148, 163, 184, 0.34);
  background: rgba(59, 130, 246, 0.22);
  color: #dbeafe;
}

#reports-panel .reports-header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

#reports-panel .reports-header-actions .btn-primary,
#reports-panel .reports-header-actions .btn-secondary {
  min-height: 40px;
  border-radius: 12px;
}

#reports-panel .reports-kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

#reports-panel .reports-kpi-card {
  position: relative;
  display: grid;
  gap: 4px;
  padding: 12px 13px;
  border-radius: 16px;
  border: 1px solid rgba(217, 93, 47, 0.14);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.85), rgba(252, 247, 240, 0.76));
  box-shadow: 0 10px 22px rgba(38, 26, 15, 0.08);
}

[data-theme="dark"] #reports-panel .reports-kpi-card {
  border-color: rgba(148, 163, 184, 0.24);
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.86));
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.28);
}

#reports-panel .reports-kpi-card::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 3px;
  border-radius: 16px 16px 0 0;
  background: linear-gradient(90deg, #df6b3b, #f2a46d);
  opacity: 0.95;
}

#reports-panel .reports-kpi-card span {
  font-size: 0.77rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--os-helpdesk-muted);
}

#reports-panel .reports-kpi-card strong {
  font-size: clamp(1.18rem, 1.5vw, 1.62rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
}

#reports-panel .reports-kpi-card.tone-helpdesk::before {
  background: linear-gradient(90deg, #4f46e5, #818cf8);
}

#reports-panel .reports-kpi-card.tone-sla::before {
  background: linear-gradient(90deg, #0ea5e9, #22d3ee);
}

#reports-panel .reports-kpi-card.tone-revenue::before {
  background: linear-gradient(90deg, #16a34a, #4ade80);
}

#reports-panel .reports-kpi-card.tone-mrr::before {
  background: linear-gradient(90deg, #d97706, #f59e0b);
}

#reports-panel .reports-grid.reports-grid-redesign {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  margin: 0;
  max-width: none;
  align-items: start;
}

#reports-panel .report-card {
  border-radius: 24px;
  border: 1px solid rgba(217, 93, 47, 0.13);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(252, 247, 240, 0.74));
}

[data-theme="dark"] #reports-panel .report-card {
  border-color: rgba(148, 163, 184, 0.2);
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.9), rgba(17, 24, 39, 0.85));
}

#reports-panel .report-card .card-header {
  border-bottom: 1px solid rgba(217, 93, 47, 0.12);
  padding-bottom: 10px;
}

[data-theme="dark"] #reports-panel .report-card .card-header {
  border-bottom-color: rgba(148, 163, 184, 0.16);
}

#reports-panel .report-health-grid {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

#reports-panel .report-health-grid .metric-block {
  margin: 0;
}

#reports-panel #sla-hit-rate.metric-value {
  font-size: clamp(2rem, 2.6vw, 2.6rem);
  letter-spacing: -0.04em;
}

#reports-panel #age-histogram.histogram {
  gap: 0.6rem;
}

#reports-panel #age-histogram .histogram-bar {
  border-radius: 12px;
  min-height: 8px;
  background: linear-gradient(180deg, rgba(223, 107, 59, 0.85), rgba(152, 170, 255, 0.62));
}

#reports-panel .report-export-block {
  margin: 0 0 12px;
  padding: 10px;
  border: 1px solid rgba(217, 93, 47, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.52);
}

[data-theme="dark"] #reports-panel .report-export-block {
  border-color: rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.46);
}

#reports-panel .report-form {
  margin-bottom: 10px;
}

#reports-panel .report-filters {
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: 0.65rem;
}

#reports-panel .report-filters.inline {
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
}

#reports-panel .report-filters label {
  gap: 0.3rem;
}

#reports-panel .report-filters input,
#reports-panel .report-filters select {
  min-height: 40px;
  border-radius: 12px;
}

#reports-panel .report-filters button.btn-primary,
#reports-panel .report-filters button.btn-secondary {
  min-height: 40px;
  border-radius: 12px;
}

#reports-panel .report-summary {
  margin-bottom: 10px;
  padding: 9px 10px;
  border: 1px solid rgba(217, 93, 47, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.46);
}

[data-theme="dark"] #reports-panel .report-summary {
  border-color: rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.48);
}

#reports-panel .report-summary .chip {
  margin: 4px 4px 0 0;
}

#reports-panel .report-table-shell {
  overflow: auto;
  border-radius: 14px;
  border: 1px solid rgba(217, 93, 47, 0.13);
  background: rgba(255, 255, 255, 0.58);
  max-height: 380px;
}

[data-theme="dark"] #reports-panel .report-table-shell {
  border-color: rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.46);
}

#reports-panel .report-data-table {
  width: 100%;
  min-width: 640px;
  border-collapse: separate;
  border-spacing: 0;
}

#reports-panel .report-data-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 245, 239, 0.95));
}

[data-theme="dark"] #reports-panel .report-data-table th {
  background: linear-gradient(180deg, rgba(23, 29, 38, 0.98), rgba(18, 22, 29, 0.96));
}

#reports-panel .report-data-table th,
#reports-panel .report-data-table td {
  padding: 10px 9px;
}

#reports-panel .report-data-table tbody tr td {
  border-bottom: 1px solid rgba(217, 93, 47, 0.12);
}

[data-theme="dark"] #reports-panel .report-data-table tbody tr td {
  border-bottom-color: rgba(148, 163, 184, 0.14);
}

#reports-panel .report-data-table tbody tr:hover td {
  background: rgba(223, 107, 59, 0.06);
}

[data-theme="dark"] #reports-panel .report-data-table tbody tr:hover td {
  background: rgba(59, 130, 246, 0.09);
}

@media (max-width: 1240px) {
  #reports-panel .reports-kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #reports-panel .reports-grid.reports-grid-redesign {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #reports-panel .report-helpdesk-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 980px) {
  #reports-panel > .panel-header.reports-page-header {
    grid-template-columns: 1fr;
  }

  #reports-panel .reports-header-tools {
    justify-items: stretch;
  }

  #reports-panel .reports-range-picker,
  #reports-panel .reports-header-actions {
    justify-content: flex-start;
  }

  #reports-panel .reports-header-actions .btn-primary,
  #reports-panel .reports-header-actions .btn-secondary {
    flex: 1 1 180px;
  }

  #reports-panel .reports-grid.reports-grid-redesign {
    grid-template-columns: 1fr;
  }

  #reports-panel .report-health-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  #reports-panel .reports-kpi-strip {
    grid-template-columns: 1fr;
  }

  #reports-panel .reports-range-picker .report-range-btn {
    flex: 1 1 calc(50% - 8px);
  }

  #reports-panel .report-table-shell {
    overflow: visible;
    border: none;
    background: transparent;
    max-height: none;
  }

  #reports-panel .report-data-table,
  #reports-panel .report-data-table tbody,
  #reports-panel .report-data-table tr,
  #reports-panel .report-data-table td {
    display: block;
    width: 100%;
  }

  #reports-panel .report-data-table {
    min-width: 0;
  }

  #reports-panel .report-data-table thead {
    display: none;
  }

  #reports-panel .report-data-table tbody tr {
    margin-bottom: 10px;
    padding: 8px;
    border: 1px solid rgba(217, 93, 47, 0.16);
    border-radius: 16px;
    background: var(--os-helpdesk-panel);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  }

  [data-theme="dark"] #reports-panel .report-data-table tbody tr {
    border-color: rgba(148, 163, 184, 0.2);
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.24);
  }

  #reports-panel .report-data-table td {
    border: 0;
    padding: 7px 8px;
    display: grid;
    grid-template-columns: 108px minmax(0, 1fr);
    gap: 8px;
    align-items: start;
  }

  #reports-panel .report-data-table td::before {
    content: attr(data-label);
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--os-helpdesk-muted);
    padding-top: 2px;
  }

  #reports-panel .report-data-table .report-empty td {
    display: block;
    padding: 16px 8px;
  }

  #reports-panel .report-data-table .report-empty td::before {
    display: none;
  }
}

/* Settings redesign */
#settings-panel {
  gap: 14px;
}

#settings-panel > .panel-header.settings-page-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin: 0;
  padding: 14px 16px;
  border-radius: 26px;
  border: 1px solid rgba(217, 93, 47, 0.15);
  background:
    radial-gradient(circle at 8% 2%, rgba(242, 106, 61, 0.17), transparent 40%),
    radial-gradient(circle at 91% -3%, rgba(83, 199, 241, 0.12), transparent 34%),
    linear-gradient(106deg, rgba(255, 247, 241, 0.86), rgba(244, 249, 252, 0.88));
  box-shadow: 0 18px 36px rgba(38, 26, 15, 0.1);
}

[data-theme="dark"] #settings-panel > .panel-header.settings-page-header {
  border-color: rgba(148, 163, 184, 0.24);
  background:
    radial-gradient(circle at 10% -5%, rgba(249, 115, 70, 0.16), transparent 38%),
    radial-gradient(circle at 88% -8%, rgba(59, 130, 246, 0.14), transparent 34%),
    linear-gradient(120deg, rgba(15, 23, 42, 0.86), rgba(17, 24, 39, 0.92));
  box-shadow: 0 22px 42px rgba(0, 0, 0, 0.34);
}

#settings-panel .settings-header-copy h1 {
  margin: 0;
  font-size: clamp(1.44rem, 1.9vw, 1.98rem);
  letter-spacing: -0.04em;
}

#settings-panel .settings-header-copy p {
  margin: 6px 0 0;
}

#settings-panel .settings-header-actions .btn-primary {
  min-height: 44px;
  border-radius: 14px;
  padding-inline: 16px;
}

#settings-panel .settings-tab-shell {
  display: grid;
  gap: 9px;
  padding: 10px 12px;
  border-radius: 24px;
  border: 1px solid rgba(217, 93, 47, 0.13);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 253, 249, 0.72));
}

[data-theme="dark"] #settings-panel .settings-tab-shell {
  border-color: rgba(148, 163, 184, 0.22);
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.84), rgba(15, 23, 42, 0.82));
}

#settings-panel .settings-tabs {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  gap: 0.55rem;
}

#settings-panel .settings-tab {
  min-height: 42px;
  border: 1px solid rgba(217, 93, 47, 0.12);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--os-helpdesk-muted);
  font-weight: 600;
  transition: border-color 0.16s ease, background-color 0.16s ease, color 0.16s ease;
}

[data-theme="dark"] #settings-panel .settings-tab {
  border-color: rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.52);
  color: #cbd5e1;
}

#settings-panel .settings-tab:hover {
  border-color: rgba(223, 107, 59, 0.36);
  color: var(--os-helpdesk-text);
}

[data-theme="dark"] #settings-panel .settings-tab:hover {
  border-color: rgba(96, 165, 250, 0.5);
  color: #e2e8f0;
}

#settings-panel .settings-tab.active {
  border-color: rgba(223, 107, 59, 0.4);
  background: linear-gradient(135deg, rgba(223, 107, 59, 0.22), rgba(246, 175, 128, 0.18));
  color: #6f280c;
  box-shadow: 0 10px 20px rgba(223, 107, 59, 0.2);
}

[data-theme="dark"] #settings-panel .settings-tab.active {
  border-color: rgba(96, 165, 250, 0.52);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.28), rgba(30, 64, 175, 0.2));
  color: #dbeafe;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.24);
}

#settings-panel .settings-tab-intro {
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(217, 93, 47, 0.1);
  background: rgba(255, 255, 255, 0.5);
}

[data-theme="dark"] #settings-panel .settings-tab-intro {
  border-color: rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.5);
}

#settings-panel .settings-tab-title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

#settings-panel .settings-tab-intro p {
  margin: 0;
}

#settings-panel .settings-section.active {
  display: grid;
  gap: 12px;
}

#settings-panel .settings-main-grid {
  grid-template-columns: 1fr;
  max-width: none;
  margin: 0;
  gap: 12px;
}

#settings-panel .settings-column {
  gap: 12px;
}

#settings-panel .settings-panel,
#settings-panel .settings-profile-card {
  border: 1px solid rgba(217, 93, 47, 0.13);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(252, 247, 240, 0.74));
  box-shadow: 0 12px 28px rgba(38, 26, 15, 0.08);
}

[data-theme="dark"] #settings-panel .settings-panel,
[data-theme="dark"] #settings-panel .settings-profile-card {
  border-color: rgba(148, 163, 184, 0.22);
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.9), rgba(17, 24, 39, 0.84));
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.3);
}

#settings-panel .settings-panel {
  padding: 1.05rem 1.15rem;
}

#settings-panel .settings-panel-header {
  margin-bottom: 0.8rem;
  gap: 0.75rem;
}

#settings-panel .settings-panel-header h3 {
  margin: 0;
  font-size: clamp(1.12rem, 1.45vw, 1.4rem);
}

#settings-panel .field-grid {
  gap: 0.72rem;
}

#settings-panel .field-grid.two-column {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

#settings-panel .field span,
#settings-panel .checkbox-row label,
#settings-panel .settings-panel label {
  font-size: 0.84rem;
}

#settings-panel .field input,
#settings-panel .field select,
#settings-panel .field textarea,
#settings-panel .settings-panel input:not([type="checkbox"]):not([type="color"]):not([type="radio"]),
#settings-panel .settings-panel select,
#settings-panel .settings-panel textarea {
  min-height: 43px;
  border-radius: 13px;
  border-color: rgba(217, 93, 47, 0.16);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.34);
}

[data-theme="dark"] #settings-panel .field input,
[data-theme="dark"] #settings-panel .field select,
[data-theme="dark"] #settings-panel .field textarea,
[data-theme="dark"] #settings-panel .settings-panel input:not([type="checkbox"]):not([type="color"]):not([type="radio"]),
[data-theme="dark"] #settings-panel .settings-panel select,
[data-theme="dark"] #settings-panel .settings-panel textarea {
  border-color: rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.64);
  box-shadow: inset 0 1px 0 rgba(148, 163, 184, 0.08);
}

#settings-panel .field textarea,
#settings-panel textarea {
  min-height: 88px;
}

#settings-panel .settings-panel input:focus,
#settings-panel .settings-panel select:focus,
#settings-panel .settings-panel textarea:focus,
#settings-panel .field input:focus,
#settings-panel .field select:focus,
#settings-panel .field textarea:focus {
  border-color: rgba(223, 107, 59, 0.55);
  box-shadow: 0 0 0 3px rgba(223, 107, 59, 0.16);
}

[data-theme="dark"] #settings-panel .settings-panel input:focus,
[data-theme="dark"] #settings-panel .settings-panel select:focus,
[data-theme="dark"] #settings-panel .settings-panel textarea:focus,
[data-theme="dark"] #settings-panel .field input:focus,
[data-theme="dark"] #settings-panel .field select:focus,
[data-theme="dark"] #settings-panel .field textarea:focus {
  border-color: rgba(96, 165, 250, 0.62);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

#settings-panel .form-actions,
#settings-panel .profile-actions {
  gap: 0.6rem;
}

#settings-panel .form-actions .btn-primary,
#settings-panel .form-actions .btn-secondary,
#settings-panel .profile-actions .btn-primary {
  min-height: 42px;
  border-radius: 12px;
}

#settings-panel .settings-section[data-settings-panel="business"] .settings-form-modern {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

#settings-panel .settings-section[data-settings-panel="business"] .settings-panel--invoice {
  grid-column: 1 / -1;
}

#settings-panel .settings-section[data-settings-panel="integrations"] .settings-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

#settings-panel .settings-section[data-settings-panel="integrations"] .settings-panel--health {
  grid-column: 1 / -1;
}

#settings-panel .settings-section[data-settings-panel="profile"] .settings-profile-card {
  padding: 1.2rem 1.25rem;
}

#settings-panel .settings-section[data-settings-panel="invoice-builder"] .settings-main-grid {
  gap: 0;
}

@media (max-width: 1200px) {
  #settings-panel .settings-section[data-settings-panel="business"] .settings-form-modern,
  #settings-panel .settings-section[data-settings-panel="integrations"] .settings-column {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  #settings-panel > .panel-header.settings-page-header {
    grid-template-columns: 1fr;
    padding: 12px 13px;
  }

  #settings-panel .settings-header-actions {
    width: 100%;
  }

  #settings-panel .settings-header-actions .btn-primary {
    width: 100%;
    justify-content: center;
  }

  #settings-panel .settings-tab-shell {
    padding: 10px;
  }

  #settings-panel .settings-tabs {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    overflow-x: auto;
    padding-bottom: 0.3rem;
    scrollbar-width: thin;
  }
}

@media (max-width: 760px) {
  #settings-panel .settings-tab {
    min-height: 40px;
    padding: 0.52rem 0.78rem;
  }

  #settings-panel .settings-panel,
  #settings-panel .settings-profile-card {
    border-radius: 20px;
  }

  #settings-panel .settings-panel {
    padding: 0.95rem;
  }

  #settings-panel .field-grid.two-column,
  #settings-panel .settings-section[data-settings-panel="profile"] .field-grid.two-column {
    grid-template-columns: 1fr;
  }

  #settings-panel .form-actions > button,
  #settings-panel .profile-actions > button {
    width: 100%;
    justify-content: center;
  }
}

/* Helpdesk ticket actions menu clipping + placement fix */
#helpdesk-panel .tickets-column,
#helpdesk-panel .ticket-list,
#helpdesk-panel .ticket-card-wrap,
#helpdesk-panel .ticket-card,
#helpdesk-panel .ticket-main,
#helpdesk-panel .ticket-title-row,
#helpdesk-panel .ticket-status-stack {
  overflow: visible !important;
}

#helpdesk-panel .ticket-card {
  isolation: isolate;
}

#helpdesk-panel .ticket-actions-menu {
  position: relative;
  z-index: 5;
}

#helpdesk-panel .ticket-actions-menu[open] {
  z-index: 34;
}

#helpdesk-panel .ticket-actions-trigger {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px !important;
  padding: 0 !important;
}

#helpdesk-panel .ticket-actions-popover {
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  width: min(240px, calc(100vw - 30px));
  max-height: min(58vh, 320px);
  overflow: auto;
  overscroll-behavior: contain;
}

#helpdesk-panel .ticket-actions-menu.open-up .ticket-actions-popover {
  top: auto;
  bottom: calc(100% + 8px);
}

@media (max-width: 980px) {
  #helpdesk-panel .ticket-actions-popover {
    top: auto;
    bottom: calc(100% + 8px);
    right: 0;
    left: auto;
    width: min(270px, calc(100vw - 24px));
    max-height: min(64vh, 360px);
  }

  #helpdesk-panel .ticket-actions-menu.open-up .ticket-actions-popover {
    top: auto;
    bottom: calc(100% + 8px);
  }
}

/* Accounts customer profile dark-mode corrections */
[data-theme="dark"] #customer-profile-modal .crm-profile-header {
  background: linear-gradient(140deg, rgba(24, 30, 39, 0.96), rgba(18, 23, 30, 0.95));
  border-color: rgba(148, 163, 184, 0.24);
  box-shadow: 0 24px 50px -34px rgba(0, 0, 0, 0.44);
}

[data-theme="dark"] #customer-profile-modal .crm-kpi,
[data-theme="dark"] #customer-profile-modal .crm-card,
[data-theme="dark"] #customer-profile-modal .crm-list-row,
[data-theme="dark"] #customer-profile-modal .contact-row,
[data-theme="dark"] #customer-profile-modal .crm-calendar-cell {
  background: linear-gradient(180deg, rgba(29, 35, 45, 0.98), rgba(22, 27, 35, 0.96));
  border-color: rgba(148, 163, 184, 0.2);
  box-shadow: none;
}

[data-theme="dark"] #customer-profile-modal .crm-calendar-cell.is-empty {
  background: transparent;
  border-color: rgba(148, 163, 184, 0.24);
}

[data-theme="dark"] #customer-profile-modal .crm-calendar-event {
  background: rgba(223, 107, 59, 0.2);
  color: #ffd9c2;
}

[data-theme="dark"] #customer-profile-modal .crm-calendar-event.visit {
  background: rgba(46, 163, 106, 0.2);
  color: #b7f7d7;
}

[data-theme="dark"] #customer-profile-modal .crm-profile-title .eyebrow,
[data-theme="dark"] #customer-profile-modal .crm-kpi span,
[data-theme="dark"] #customer-profile-modal .crm-calendar-header,
[data-theme="dark"] #customer-profile-modal .crm-calendar-more,
[data-theme="dark"] #customer-profile-modal .crm-card .muted.small,
[data-theme="dark"] #customer-profile-modal .crm-list-row .muted.small,
[data-theme="dark"] #customer-profile-modal .contact-row .muted.small {
  color: var(--os-helpdesk-muted);
}

[data-theme="dark"] #customer-profile-modal .crm-profile-title h2,
[data-theme="dark"] #customer-profile-modal .crm-kpi strong,
[data-theme="dark"] #customer-profile-modal .crm-card strong,
[data-theme="dark"] #customer-profile-modal .crm-list-row strong,
[data-theme="dark"] #customer-profile-modal .contact-row strong,
[data-theme="dark"] #customer-profile-modal .crm-calendar-day,
[data-theme="dark"] #customer-profile-modal .crm-card-header h4 {
  color: var(--os-helpdesk-text);
}

[data-theme="dark"] #customer-profile-modal .crm-card input,
[data-theme="dark"] #customer-profile-modal .crm-card select,
[data-theme="dark"] #customer-profile-modal .crm-card textarea {
  background: rgba(12, 16, 22, 0.7);
  border-color: rgba(148, 163, 184, 0.24);
  color: var(--os-helpdesk-text);
}

[data-theme="dark"] #customer-profile-modal .weekday-chip {
  background: rgba(18, 23, 32, 0.78);
  border-color: rgba(148, 163, 184, 0.32);
  color: var(--os-helpdesk-text);
}

.recycle-bin-body {
  gap: 1rem;
}

.recycle-bin-actions {
  display: flex;
  justify-content: flex-end;
}

.recycle-bin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.recycle-section {
  border: 1px solid rgba(219, 185, 158, 0.35);
  border-radius: 1rem;
  padding: 0.85rem;
  background: rgba(255, 255, 255, 0.28);
}

.recycle-section h4 {
  margin: 0 0 0.75rem 0;
}

.recycle-list {
  display: grid;
  gap: 0.6rem;
}

.recycle-item {
  border: 1px solid rgba(219, 185, 158, 0.35);
  border-radius: 0.85rem;
  padding: 0.7rem;
  display: grid;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.45);
}

.recycle-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.recycle-item-head strong {
  margin: 0;
}

.recycle-item-meta {
  font-size: 0.86rem;
  color: var(--muted);
}

.recycle-item-actions {
  display: flex;
  justify-content: flex-end;
}

.recycle-item-actions .btn-secondary.small {
  padding: 0.35rem 0.65rem;
}

@media (max-width: 960px) {
  .recycle-bin-grid {
    grid-template-columns: 1fr;
  }
}

/* Brand logo replacement */
.auth-brand-logo {
  display: block !important;
  width: min(100%, 98px) !important;
  max-height: 32px !important;
  height: auto !important;
  object-fit: contain !important;
  filter: none !important;
}

.sidebar-brand {
  justify-content: center !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  padding: 0 !important;
}

.sidebar-brand .brand-mark,
.sidebar-brand .brand-copy {
  display: none !important;
}

.sidebar-brand-logo {
  display: block !important;
  width: min(100%, 138px) !important;
  max-height: 44px !important;
  height: auto !important;
  object-fit: contain !important;
}

.mobile-brand {
  justify-content: center !important;
}

.mobile-brand-logo {
  display: block !important;
  width: auto !important;
  height: clamp(22px, 4.2vw, 30px) !important;
  max-width: min(42vw, 176px) !important;
  object-fit: contain !important;
}

/* Role/module-filtered nav visibility */
.sidebar-nav .nav-btn.nav-hidden,
.nav-btn.nav-hidden {
  display: none !important;
}

/* Login screen redesign */
#login-screen.auth-screen {
  min-height: 100svh !important;
  /* Let JS/utility classes control visibility (inline style + .hidden). */
  display: grid;
  place-items: center !important;
  padding: clamp(16px, 3.5vw, 40px) !important;
}

#login-screen .auth-shell {
  width: min(620px, 100%) !important;
  display: block !important;
}

#login-screen .auth-card {
  width: 100% !important;
  max-width: none !important;
  border-radius: 34px !important;
  border: 1px solid rgba(218, 188, 160, 0.62) !important;
  box-shadow:
    0 24px 54px rgba(43, 29, 18, 0.12),
    0 1px 0 rgba(255, 255, 255, 0.8) inset !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(252, 245, 236, 0.92)) !important;
  overflow: hidden !important;
}

[data-theme="dark"] #login-screen .auth-card {
  border-color: rgba(255, 255, 255, 0.12) !important;
  box-shadow:
    0 28px 60px rgba(0, 0, 0, 0.35),
    0 1px 0 rgba(255, 255, 255, 0.06) inset !important;
  background:
    linear-gradient(180deg, rgba(24, 28, 35, 0.98), rgba(17, 21, 27, 0.98)) !important;
}

#login-screen .auth-header {
  display: flex !important;
  align-items: center !important;
  gap: clamp(12px, 1.8vw, 18px) !important;
  padding: clamp(26px, 3.5vw, 34px) clamp(24px, 4.2vw, 42px) 14px !important;
  background: transparent !important;
  text-align: left !important;
}

#login-screen .auth-brand-logo {
  width: min(100%, 112px) !important;
  max-height: 36px !important;
  height: auto !important;
  flex: 0 0 auto !important;
}

#login-screen .auth-header h2 {
  margin: 0 !important;
  font-size: clamp(1.2rem, 2.1vw, 2rem) !important;
  font-weight: 700 !important;
  letter-spacing: -0.035em !important;
  line-height: 1.1 !important;
  color: #151c27 !important;
}

[data-theme="dark"] #login-screen .auth-header h2 {
  color: #f4f7fb !important;
}

#login-screen .auth-body {
  padding: 8px clamp(24px, 4.2vw, 42px) clamp(26px, 3.8vw, 36px) !important;
}

#login-screen .auth-subtitle {
  margin: 0 0 22px !important;
  color: #617185 !important;
  font-size: clamp(1rem, 2.2vw, 1.04rem) !important;
  line-height: 1.48 !important;
  max-width: 52ch !important;
}

[data-theme="dark"] #login-screen .auth-subtitle {
  color: #a9b5c2 !important;
}

#login-screen .auth-form {
  gap: 14px !important;
}

#login-screen .auth-form .muted.small {
  margin: 0 0 4px !important;
  font-size: 0.92rem !important;
  line-height: 1.45 !important;
}

#login-screen .mfa-setup-secret-wrap {
  display: grid;
  gap: 6px;
  margin-top: 4px;
}

#login-screen .mfa-setup-secret {
  display: inline-block;
  width: fit-content;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px dashed rgba(205, 182, 159, 0.8);
  background: rgba(255, 255, 255, 0.5);
  color: #1c2735;
  letter-spacing: 0.04em;
  font-weight: 700;
}

[data-theme="dark"] #login-screen .mfa-setup-secret {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
  color: #f0f4f9;
}

#login-screen .mfa-qr-wrap {
  display: grid;
  gap: 6px;
  margin-top: 4px;
}

.mfa-qr-image {
  width: 176px;
  height: 176px;
  max-width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(205, 182, 159, 0.8);
  background: #ffffff;
  padding: 8px;
}

[data-theme="dark"] .mfa-qr-image {
  border-color: rgba(255, 255, 255, 0.2);
}

#login-screen .mfa-recovery-wrap {
  margin-top: 8px;
}

.mfa-recovery-codes {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(10, 16, 25, 0.08);
  color: var(--text);
  font-family: "JetBrains Mono", "SFMono-Regular", ui-monospace, Menlo, monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

[data-theme="dark"] .mfa-recovery-codes {
  background: rgba(255, 255, 255, 0.04);
}

#login-screen .input-group {
  position: relative !important;
  min-height: 64px !important;
  padding-inline: 16px !important;
  border-radius: 22px !important;
  border: 1px solid rgba(205, 182, 159, 0.65) !important;
  background: rgba(255, 255, 255, 0.68) !important;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset !important;
}

[data-theme="dark"] #login-screen .input-group {
  border-color: rgba(255, 255, 255, 0.16) !important;
  background: rgba(255, 255, 255, 0.06) !important;
  box-shadow: none !important;
}

#login-screen .input-icon {
  left: 18px !important;
  color: #738294 !important;
  font-size: 1.2rem !important;
}

[data-theme="dark"] #login-screen .input-icon {
  color: #9aa8b9 !important;
}

#login-screen .input-group input {
  width: 100% !important;
  padding: 0.98rem 0.95rem 0.98rem 2.9rem !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  color: #17202c !important;
  font-size: 1.04rem !important;
  font-weight: 500 !important;
}

[data-theme="dark"] #login-screen .input-group input {
  color: #f0f4f9 !important;
}

#login-screen .input-group input::placeholder {
  color: #8794a5 !important;
}

#login-screen .input-group:focus-within {
  border-color: rgba(223, 107, 59, 0.65) !important;
  box-shadow: 0 0 0 4px rgba(223, 107, 59, 0.12) !important;
}

#login-screen .input-group input:-webkit-autofill,
#login-screen .input-group input:-webkit-autofill:hover,
#login-screen .input-group input:-webkit-autofill:focus {
  -webkit-text-fill-color: #17202c !important;
  box-shadow: 0 0 0 1000px rgba(232, 239, 253, 0.68) inset !important;
  transition: background-color 9999s ease-out 0s !important;
}

[data-theme="dark"] #login-screen .input-group input:-webkit-autofill,
[data-theme="dark"] #login-screen .input-group input:-webkit-autofill:hover,
[data-theme="dark"] #login-screen .input-group input:-webkit-autofill:focus {
  -webkit-text-fill-color: #f0f4f9 !important;
  box-shadow: 0 0 0 1000px rgba(25, 35, 49, 0.78) inset !important;
}

#login-screen .btn-primary.btn-full {
  min-height: 62px !important;
  border-radius: 20px !important;
  font-size: 1.08rem !important;
  font-weight: 700 !important;
  letter-spacing: -0.01em !important;
  border: 1px solid rgba(218, 96, 47, 0.34) !important;
  background: linear-gradient(135deg, #dc6939 0%, #f0a56b 100%) !important;
  color: #fff9f2 !important;
  box-shadow: 0 18px 30px rgba(223, 107, 59, 0.24) !important;
}

#login-screen .btn-primary.btn-full:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 22px 34px rgba(223, 107, 59, 0.3) !important;
}

#login-screen .auth-links {
  margin-top: 6px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-wrap: wrap !important;
  gap: 12px 22px !important;
}

#login-screen .link-btn {
  color: #2a3340 !important;
  opacity: 0.9 !important;
  font-weight: 650 !important;
  letter-spacing: -0.01em !important;
}

[data-theme="dark"] #login-screen .link-btn {
  color: #e6edf5 !important;
}

#login-screen .link-btn:hover {
  opacity: 1 !important;
}

@media (max-width: 720px) {
  #login-screen.auth-screen {
    padding: 14px !important;
  }

  #login-screen .auth-card {
    border-radius: 26px !important;
  }

  #login-screen .auth-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 10px !important;
    padding: 22px 20px 8px !important;
  }

  #login-screen .auth-brand-logo {
    width: min(100%, 98px) !important;
    max-height: 31px !important;
  }

  #login-screen .auth-header h2 {
    font-size: clamp(1.35rem, 6vw, 1.75rem) !important;
  }

  #login-screen .auth-body {
    padding: 6px 20px 22px !important;
  }

  #login-screen .input-group {
    min-height: 58px !important;
    border-radius: 18px !important;
  }

  #login-screen .btn-primary.btn-full {
    min-height: 56px !important;
    border-radius: 18px !important;
  }
}

.profile-mfa-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  display: grid;
  gap: 10px;
}

.profile-mfa-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.profile-mfa-head > span {
  font-weight: 700;
}

.profile-mfa-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-mfa-actions .btn-secondary,
.profile-mfa-actions .btn-danger {
  min-height: 40px;
  border-radius: 12px;
  font-size: 0.86rem;
  padding: 0.45rem 0.8rem;
}

.profile-mfa-secret-wrap,
.profile-mfa-codes-wrap {
  display: grid;
  gap: 6px;
}

/* Super-admin lead inbox */
#messages-panel .lead-inbox-card {
  overflow: hidden;
}

#messages-panel .lead-inbox-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#messages-panel .lead-inbox-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

#messages-panel .lead-inbox-filters input,
#messages-panel .lead-inbox-filters select,
#messages-panel .lead-status-control select,
#messages-panel .lead-reply-form textarea {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
}

#messages-panel .lead-inbox-filters input,
#messages-panel .lead-inbox-filters select {
  min-height: 40px;
  padding: 0 12px;
}

#messages-panel .lead-inbox-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 14px;
}

#messages-panel .lead-list {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 8px;
  max-height: 70vh;
  overflow: auto;
  display: grid;
  gap: 8px;
}

#messages-panel .lead-list-item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  padding: 10px;
  cursor: pointer;
  color: inherit;
}

#messages-panel .lead-list-item.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(94, 173, 255, 0.14);
}

#messages-panel .lead-list-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

#messages-panel .lead-list-item-meta {
  margin-top: 4px;
  font-size: 0.84rem;
  color: var(--muted);
}

#messages-panel .lead-list-item-preview {
  margin-top: 6px;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.35;
}

#messages-panel .lead-list-item-time {
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--muted);
}

#messages-panel .lead-detail {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 12px;
  display: grid;
  gap: 10px;
}

#messages-panel .lead-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

#messages-panel .lead-status-control {
  display: grid;
  gap: 4px;
  min-width: 130px;
}

#messages-panel .lead-status-control span {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

#messages-panel .lead-status-control select {
  min-height: 36px;
  padding: 0 10px;
}

#messages-panel .lead-message-thread {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  padding: 10px;
  max-height: 48vh;
  overflow: auto;
  display: grid;
  gap: 8px;
}

#messages-panel .lead-message {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.04);
}

#messages-panel .lead-message.is-outbound {
  border-color: rgba(15, 118, 110, 0.45);
  background: rgba(20, 184, 166, 0.08);
}

#messages-panel .lead-message-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

#messages-panel .lead-message p {
  margin: 0;
  white-space: pre-wrap;
}

#messages-panel .lead-message-delivery {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.75rem;
}

#messages-panel .lead-reply-form {
  display: grid;
  gap: 8px;
}

#messages-panel .lead-reply-form label {
  display: grid;
  gap: 6px;
}

#messages-panel .lead-reply-form span {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

#messages-panel .lead-reply-form textarea {
  width: 100%;
  padding: 10px;
  resize: vertical;
  min-height: 110px;
}

#messages-panel .lead-reply-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#messages-panel .chip.tone-new {
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.35);
}

#messages-panel .chip.tone-open {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.35);
}

#messages-panel .chip.tone-closed {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.35);
}

@media (max-width: 980px) {
  #messages-panel .lead-inbox-layout {
    grid-template-columns: 1fr;
  }

  #messages-panel .lead-list {
    max-height: 34vh;
  }

  #messages-panel .lead-message-thread {
    max-height: 38vh;
  }
}


/* Marketing homepage styles moved to marketing-home.css */

/* CMS visual editor */
#cms-panel .cms-editor-header {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(12, 22, 38, 0.86);
  background:
    radial-gradient(180% 180% at 90% -40%, rgba(13, 148, 136, 0.2), transparent 60%),
    radial-gradient(140% 160% at -30% 140%, rgba(249, 115, 22, 0.14), transparent 62%),
    rgba(12, 22, 38, 0.86);
  backdrop-filter: blur(6px);
}

#cms-panel .cms-editor-header h1 {
  margin-bottom: 6px;
}

#cms-panel .cms-studio-grid {
  margin-top: 14px;
  display: grid;
  gap: 14px;
  align-items: start;
  grid-template-columns: minmax(300px, 360px) minmax(560px, 1fr) minmax(290px, 340px);
}

#cms-panel .cms-studio-rail,
#cms-panel .cms-studio-canvas {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

#cms-panel .cms-content-rail,
#cms-panel .cms-inspector-rail {
  position: sticky;
  top: 96px;
  max-height: calc(100vh - 150px);
  overflow: auto;
  padding-right: 4px;
}

#cms-panel .cms-content-rail::-webkit-scrollbar,
#cms-panel .cms-inspector-rail::-webkit-scrollbar {
  width: 8px;
}

#cms-panel .cms-content-rail::-webkit-scrollbar-thumb,
#cms-panel .cms-inspector-rail::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: color-mix(in srgb, var(--border) 72%, var(--muted));
}

#cms-panel .cms-form-shell {
  gap: 12px;
}

#cms-panel .cms-form-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(10, 18, 30, 0.85);
}

#cms-panel .cms-form-tab {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(20, 31, 48, 0.9);
  color: var(--muted);
  font-weight: 700;
  font-size: 0.92rem;
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

#cms-panel .cms-form-tab:hover,
#cms-panel .cms-form-tab:focus-visible {
  border-color: rgba(255, 255, 255, 0.38);
  color: var(--text);
}

#cms-panel .cms-form-tab.active {
  color: #fff;
  border-color: color-mix(in srgb, var(--primary) 60%, #ffffff 20%);
  background: linear-gradient(135deg, rgba(19, 128, 170, 0.38), rgba(249, 115, 22, 0.26));
  box-shadow: 0 8px 18px rgba(8, 14, 28, 0.35);
}

#cms-panel .cms-tab-panel {
  display: none;
}

#cms-panel .cms-tab-panel.active {
  display: block;
}

#cms-panel .cms-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(21, 33, 52, 0.92), rgba(12, 20, 34, 0.95));
  box-shadow: 0 12px 34px rgba(4, 10, 24, 0.24);
}

#cms-panel .cms-card .settings-panel-header {
  margin-bottom: 14px;
}

#cms-panel .cms-card .field-grid {
  gap: 12px;
}

#cms-panel .cms-canvas-card {
  padding-bottom: 14px;
}

#cms-panel .cms-preview-shell {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  min-height: 700px;
  background: #0b1220;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.03),
    0 16px 36px rgba(2, 6, 23, 0.35);
}

#cms-panel #cms-live-preview {
  width: 100%;
  min-height: 700px;
  border: 0;
  background: #fff;
}

#cms-panel .cms-status-line {
  margin: 2px 2px 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(12, 20, 34, 0.78);
}

#cms-panel .cms-inspector-card .field-actions {
  display: flex;
  justify-content: flex-end;
}

#cms-panel #cms-live-selection-label {
  margin: 0 0 4px;
}

#cms-panel .cms-sort-list {
  display: grid;
  gap: 8px;
}

#cms-panel .cms-sort-item {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(17, 27, 43, 0.92);
  color: var(--text);
  padding: 10px 12px;
  cursor: grab;
  user-select: none;
}

#cms-panel .cms-sort-item i {
  color: var(--muted);
}

#cms-panel .cms-sort-item.dragging {
  opacity: 0.58;
}

#cms-panel .cms-sort-item.drag-over {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(94, 173, 255, 0.16);
}

@media (max-width: 1680px) {
  #cms-panel .cms-studio-grid {
    grid-template-columns: minmax(300px, 370px) minmax(560px, 1fr);
  }

  #cms-panel .cms-inspector-rail {
    position: static;
    max-height: none;
    overflow: visible;
    padding-right: 0;
    grid-column: 1 / -1;
  }
}

@media (max-width: 1220px) {
  #cms-panel .cms-studio-grid {
    grid-template-columns: 1fr;
  }

  #cms-panel .cms-content-rail,
  #cms-panel .cms-inspector-rail {
    position: static;
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  #cms-panel .cms-preview-shell,
  #cms-panel #cms-live-preview {
    min-height: 560px;
  }
}

/* Sidebar unread message counter */
.sidebar-nav .nav-btn .nav-unread-counter {
  margin-left: auto;
  min-width: 1.45rem;
  height: 1.45rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0;
  background: #df6b3b;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .sidebar-nav .nav-btn .nav-unread-counter {
  background: #ff8b5b;
  color: #1e0f07;
  border-color: rgba(255, 255, 255, 0.3);
}

.sidebar-nav .nav-btn.active .nav-unread-counter {
  background: rgba(255, 255, 255, 0.96);
  color: #c95a2c;
  border-color: rgba(255, 255, 255, 0.92);
}

/* Mobile + theme hardening overrides (final pass) */
:root {
  --text: var(--white);
  --panel: color-mix(in srgb, var(--surface) 90%, #ffffff 10%);
  color-scheme: dark;
}

[data-theme="light"] {
  --text: #0f172a;
  --panel: #ffffff;
  color-scheme: light;
}

[data-theme="dark"] {
  --text: #e8ecf5;
  --panel: #111827;
  color-scheme: dark;
}

body {
  overflow-x: hidden;
}

.main-panel,
.panel,
.card,
.panel-header,
.header-actions,
.field-grid,
.form-grid,
.table-container {
  min-width: 0;
}

.toolbar-meta {
  min-width: 0;
}

#settings-panel .settings-tab-shell,
#settings-panel .settings-tabs,
#cms-panel .cms-form-tabs {
  min-width: 0;
}

#settings-panel .settings-tab,
#cms-panel .cms-form-tab {
  min-width: max-content;
  white-space: nowrap;
}

#messages-panel .lead-inbox-card,
#messages-panel .lead-list,
#messages-panel .lead-detail,
#invoices-panel .invoice-history-card,
#invoices-panel .invoice-history-table {
  min-width: 0;
}

@media (max-width: 1024px) {
  .app-shell {
    grid-template-columns: 1fr !important;
  }

  .main-panel {
    padding: 12px !important;
    gap: 12px !important;
  }

  .mobile-header {
    position: sticky !important;
    top: 0;
    z-index: 40;
    padding: 10px 12px !important;
  }

  .mobile-header .btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
  }

  .mobile-brand {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: center !important;
  }

  .mobile-brand-logo {
    max-width: min(44vw, 158px) !important;
    height: 24px !important;
  }

  .panel-header {
    padding: 12px !important;
    gap: 10px !important;
  }

  .header-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: stretch;
  }

  .header-actions > * {
    flex: 1 1 220px;
    min-width: 0;
  }

  #settings-panel > .panel-header.settings-page-header,
  #cms-panel .cms-editor-header,
  #messages-panel > .panel-header,
  #invoices-panel > .panel-header.invoice-page-header {
    grid-template-columns: 1fr !important;
    align-items: stretch !important;
  }

  #settings-panel .settings-tab-shell {
    padding: 8px !important;
    overflow: hidden;
  }

  #settings-panel .settings-tabs {
    display: grid !important;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    gap: 8px !important;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
    scrollbar-width: thin;
  }

  #settings-panel .settings-main-grid,
  #settings-panel .settings-section[data-settings-panel="business"] .settings-form-modern,
  #settings-panel .settings-section[data-settings-panel="integrations"] .settings-column,
  #settings-panel .field-grid.two-column,
  #settings-panel .settings-section[data-settings-panel="profile"] .field-grid.two-column {
    grid-template-columns: 1fr !important;
  }

  #settings-panel .form-actions,
  #settings-panel .profile-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  #messages-panel .lead-inbox-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  #messages-panel .lead-inbox-filters {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  #messages-panel .lead-inbox-filters input,
  #messages-panel .lead-inbox-filters select,
  #messages-panel .lead-status-control select {
    width: 100%;
    min-width: 0;
  }

  #messages-panel .lead-inbox-layout {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }

  #messages-panel .lead-list {
    max-height: 35vh;
  }

  #messages-panel .lead-detail-head {
    flex-direction: column;
    align-items: stretch;
  }

  #messages-panel .lead-status-control {
    width: 100%;
    min-width: 0;
  }

  #messages-panel .lead-message-thread {
    max-height: 36vh;
  }

  #messages-panel .lead-reply-actions {
    flex-direction: column;
    align-items: stretch;
  }

  #messages-panel .lead-reply-actions > * {
    width: 100%;
  }

  #invoices-panel .invoice-actions-shell,
  #invoices-panel .header-actions.invoice-top-actions {
    width: 100%;
  }

  #invoices-panel .header-actions.invoice-top-actions {
    justify-content: stretch !important;
  }

  #invoices-panel .header-actions.invoice-top-actions > button {
    flex: 1 1 220px !important;
    min-width: 0;
  }

  #invoices-panel .invoice-history-header {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }

  #invoices-panel .invoice-history-filters {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  #invoices-panel .invoice-history-filters select {
    width: 100%;
    min-width: 0 !important;
  }

  #invoices-panel .invoice-history-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  #invoices-panel .invoice-history-toolbar .toolbar-actions {
    width: 100%;
    margin-left: 0;
  }

  #invoices-panel .invoice-history-toolbar .toolbar-actions > button {
    flex: 1 1 180px;
  }

  #cms-panel .cms-studio-grid {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }

  #cms-panel .cms-content-rail,
  #cms-panel .cms-inspector-rail {
    position: static !important;
    max-height: none !important;
    overflow: visible !important;
    padding-right: 0 !important;
  }

  #cms-panel .cms-form-tabs {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    grid-template-columns: unset;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }

  #cms-panel .cms-preview-shell,
  #cms-panel #cms-live-preview {
    min-height: 500px !important;
  }
}

@media (max-width: 640px) {
  .main-panel {
    padding: 10px !important;
    gap: 10px !important;
  }

  .panel-header {
    border-radius: 16px !important;
  }

  .card {
    border-radius: 16px !important;
    margin-bottom: 10px !important;
  }

  .header-actions > * {
    flex: 1 1 100%;
  }

  #settings-panel .settings-tab {
    min-height: 38px;
    padding: 0.48rem 0.7rem;
    font-size: 0.82rem;
  }

  #settings-panel .settings-panel,
  #settings-panel .settings-profile-card,
  #cms-panel .cms-card {
    padding: 0.9rem !important;
    border-radius: 16px !important;
  }

  #messages-panel .lead-list-item {
    padding: 9px;
  }

  #messages-panel .lead-list-item-head {
    align-items: flex-start;
    flex-direction: column;
  }

  #messages-panel .lead-list-item-meta,
  #messages-panel .lead-list-item-preview,
  #messages-panel .lead-list-item-time {
    font-size: 0.82rem;
  }

  #invoices-panel .header-actions.invoice-top-actions > button {
    flex: 1 1 100% !important;
  }

  #invoices-panel .invoice-history-table {
    overflow: visible !important;
    border: none !important;
    background: transparent !important;
  }

  #invoices-panel .invoice-history-table .data-table,
  #invoices-panel .invoice-history-table .data-table tbody,
  #invoices-panel .invoice-history-table .data-table tr,
  #invoices-panel .invoice-history-table .data-table td {
    display: block;
    width: 100%;
  }

  #invoices-panel .invoice-history-table .data-table {
    min-width: 0 !important;
  }

  #invoices-panel .invoice-history-table .data-table thead {
    display: none;
  }

  #invoices-panel .invoice-history-table .data-table td {
    padding: 8px 0;
  }

  #invoices-panel #invoice-pagination {
    justify-content: flex-start;
  }

  #cms-panel .cms-preview-shell,
  #cms-panel #cms-live-preview {
    min-height: 420px !important;
  }
}
