@import "tailwindcss";

/* BellSystems Dark Theme - Custom Properties */
:root {
  --crm-customer-icon-lead: #7a6f5e;
  --crm-customer-icon-passive: #9fa6b4;
  --crm-customer-icon-info: #3dabff;
  --crm-customer-icon-positive: #36d346;
  --crm-customer-icon-payment: #e8c040;
  --crm-customer-icon-declined: #e07070;
  --crm-customer-icon-muted: #4f5258;

  --bg-primary: #111827;
  --bg-secondary: rgba(31, 41, 55, 0.959);
  --bg-card: #1f2937;
  --bg-card-hover: #2a3544;
  --bg-input: #111827;
  --bg-sidebar: #111827;
  --bg-header: #1f2937;
  --bg-row-alt: rgba(255, 255, 255, 0.03);

  --border-primary: #374151;
  --border-secondary: #2d3748;
  --border-input: #374151;

  --text-primary: #e3e5ea;
  --text-secondary: #9ca3af;
  --text-muted: #9ca3af;
  --text-more-muted: #818da1bb;
  --text-heading: #e3e5ea;
  --text-white: #ffffff;
  --text-link: #589cfa;

  --accent: #74b816;
  --accent-hover: #82c91e;

  --btn-primary: #74b816;
  --btn-primary-hover: #82c91e;
  --btn-neutral: #778ca8;
  --btn-neutral-hover: #8a9dba;
  --mail-filter-green: #2f9e44;
  --mail-filter-blue: #4dabf7;
  --mail-filter-yellow: #f08c00;
  --mail-filter-orange: #f76707;
  --mail-filter-red: #e03131;

  --danger: #f34b4b;
  --danger-hover: #e53e3e;
  --danger-btn: #f76707;
  --danger-btn-hover: #e55d06;
  --danger-bg: #3b1a1a;
  --danger-text: #f34b4b;

  --success: #74b816;
  --success-bg: #1a2e0a;
  --success-text: #a3d977;

  --badge-blue-bg: #1e3a5f;
  --badge-blue-text: #63b3ed;

  /* ── CRM status icon colours ── */
  --crm-status-warn: #f08c00;      /* yellow-orange — we sent last msg  */
  --crm-status-alert: #f76707;     /* orange        — client sent last  */
  --crm-status-danger: #f34b4b;    /* red           — issue, client sent */

  /* ── CRM relationship status ── */
  --crm-rel-lead-bg:       #2a2d35;
  --crm-rel-lead-text:     #9ca3af;
  --crm-rel-lead-border:   #4b5563;
  --crm-rel-prospect-bg:   #1e3a5f;
  --crm-rel-prospect-text: #63b3ed;
  --crm-rel-prospect-border: #2d5a8f;
  --crm-rel-active-bg:     #14351a;
  --crm-rel-active-text:   #6ee07a;
  --crm-rel-active-border: #1e5c28;
  --crm-rel-inactive-bg:   #3d2a00;
  --crm-rel-inactive-text: #fbbf24;
  --crm-rel-inactive-border: #6b4800;
  --crm-rel-churned-bg:    #3b1a1a;
  --crm-rel-churned-text:  #f87171;
  --crm-rel-churned-border: #6b2121;

  /* ── CRM order status ── */
  --crm-ord-negotiating-bg:       #1e3a5f;
  --crm-ord-negotiating-text:     #63b3ed;
  --crm-ord-awaiting_quotation-bg:       #2d1b5e;
  --crm-ord-awaiting_quotation-text:     #b794f4;
  --crm-ord-awaiting_customer_confirmation-bg:  #1e1b5e;
  --crm-ord-awaiting_customer_confirmation-text: #818cf8;
  --crm-ord-awaiting_fulfilment-bg:      #3d2a00;
  --crm-ord-awaiting_fulfilment-text:    #fbbf24;
  --crm-ord-awaiting_payment-bg:         #3d1f00;
  --crm-ord-awaiting_payment-text:       #fb923c;
  --crm-ord-manufacturing-bg:    #003d3d;
  --crm-ord-manufacturing-text:  #67e8f9;
  --crm-ord-shipped-bg:          #003d35;
  --crm-ord-shipped-text:        #2dd4bf;
  --crm-ord-installed-bg:        #14351a;
  --crm-ord-installed-text:      #6ee07a;
  --crm-ord-declined-bg:         #3b1a1a;
  --crm-ord-declined-text:       #f87171;
  --crm-ord-complete-bg:         #0044ff;
  --crm-ord-complete-text:       #9ca3af;

  /* ── CRM issue/support flags ── */
  --crm-issue-active-bg:    #3b1a1a;
  --crm-issue-active-text:  #f87171;
  --crm-support-active-bg:  #3d2a00;
  --crm-support-active-text: #fbbf24;
  --crm-resolved-bg:        #2a2d35;
  --crm-resolved-text:      #9ca3af;

  /* ── Spacing tokens ── */
  --section-padding: 2.25rem 2.5rem 2.25rem;
  --section-padding-compact: 1.25rem 1.5rem;
  --section-radius: 0.75rem;
  --section-gap: 1.5rem;

  /* ── Typography tokens ── */
  --section-title-size: 0.78rem;
  --section-title-weight: 700;
  --section-title-tracking: 0.07em;
  --font-size-label: 0.72rem;
  --font-size-value: 0.92rem;

  /* ── Section header title (larger, page-header style) ── */
  --section-header-title-size: 1.0rem;
  --section-header-title-weight: 600;
  --section-header-title-tracking: 0.01em;
  --section-header-title-color: var(--text-heading);

  /* ── Field / item labels (secondary titles within sections) ── */
  /* Display variant: small, uppercase, muted — used in <dt> / read-only views */
  --field-label-size: 0.72rem;
  --field-label-weight: 600;
  --field-label-tracking: 0.02em;
  --field-label-color: var(--text-more-muted);
  /* Form variant: slightly larger, no uppercase — used in <label> / form inputs */
  --form-label-size: 0.8rem;
  --form-label-weight: 500;
  --form-label-tracking: 0.01em;
  --form-label-color: var(--text-secondary);

  /* ── Product Lifecycle status colours (pastel-dark palette) ── */
  /* Manufactured — light blue */
  --lc-manufactured-bg:     #1a2e3f;
  --lc-manufactured-text:   #7ec8e3;
  --lc-manufactured-accent: #4da8c8;
  /* Flashed — yellow */
  --lc-flashed-bg:     #2e2800;
  --lc-flashed-text:   #e8cc6a;
  --lc-flashed-accent: #c9a83c;
  /* Provisioned — orange */
  --lc-provisioned-bg:     #2e1a00;
  --lc-provisioned-text:   #f0a04a;
  --lc-provisioned-accent: #c97a28;
  /* Sold — light green */
  --lc-sold-bg:     #0e2a1a;
  --lc-sold-text:   #6dd49a;
  --lc-sold-accent: #3daa6a;
  /* Claimed — green */
  --lc-claimed-bg:     #0a2416;
  --lc-claimed-text:   #4ade80;
  --lc-claimed-accent: #22c55e;
  /* Decommissioned — red */
  --lc-decommissioned-bg:     #2a0a0a;
  --lc-decommissioned-text:   #f87171;
  --lc-decommissioned-accent: #ef4444;
}

/* Remove number input spinners (arrows) in all browsers */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* Ensure all interactive elements show pointer cursor */
button,
[role="button"],
a,
select,
label[for],
input[type="checkbox"],
input[type="radio"],
input[type="file"],
input[type="color"],
summary {
  cursor: pointer;
}

/* Global dark background - lock to viewport, no page-level scroll */
html,
body {
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-primary);
  color: var(--text-primary);
}

#root {
  height: 100%;
  overflow: hidden;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--border-primary);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* Form input dark styling */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="url"],
textarea,
select {
  background-color: var(--bg-input) !important;
  border-color: var(--border-input) !important;
  color: var(--text-primary) !important;
  -webkit-appearance: none !important;
  appearance: none !important;
}

/* Only select elements get the dropdown arrow */
select {
  padding-right: 2rem !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 0.6rem center !important;
  background-size: 12px !important;
}
input::placeholder,
textarea::placeholder {
  color: var(--text-muted) !important;
  opacity: 0.6;
}
input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 2px rgba(116, 184, 22, 0.3) !important;
}

/* Checkbox dark styling */
input[type="checkbox"] {
  accent-color: var(--accent);
}

/* Range slider */
input[type="range"] {
  accent-color: var(--accent) !important;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 4px;
  background: var(--border-primary);
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--bg-primary);
}
input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 4px;
  background: var(--border-primary);
}
input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--bg-primary);
}

/* Device detail column layout */
.device-column {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.device-tabs-wrap {
  border-bottom: 1px solid var(--border-primary);
  padding: 0 0 0.6rem;
}

.device-tabs-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
}

.device-tab-item {
  display: inline-flex;
  align-items: center;
}

.device-tab-divider {
  width: 1px;
  height: 16px;
  background-color: var(--border-primary);
  margin: 0 0.3rem;
}

.device-tab-btn {
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 0.45rem;
  padding: 0.4rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: all 0.2s ease;
  position: relative;
  --tab-tone: rgba(116, 184, 22, 0.24);
  --tab-glow: rgba(116, 184, 22, 0.24);
}

.device-tab-btn:hover {
  color: var(--text-primary);
  background: color-mix(in srgb, var(--tab-tone) 42%, transparent);
}

.device-tab-btn--active {
  background-color: color-mix(in srgb, var(--tab-tone) 70%, transparent);
  color: var(--tab-text);
  box-shadow: 0 0 18px var(--tab-glow);
}

.device-tab-btn--dashboard {
  --tab-tone: rgba(136, 201, 94, 0.34);
  --tab-glow: rgba(136, 201, 94, 0.32);
  --tab-text: #baff53;
}

.device-tab-btn--general {
  --tab-tone: rgba(92, 158, 189, 0.34);
  --tab-glow: rgba(92, 161, 189, 0.32);
  --tab-text: #7dd6ff;
}

.device-tab-btn--bells {
  --tab-tone: rgba(210, 218, 226, 0.34);
  --tab-glow: rgba(230, 236, 243, 0.28);
  --tab-text: #f3f9ff;
}

.device-tab-btn--clock {
  --tab-tone: rgba(233, 199, 99, 0.34);
  --tab-glow: rgba(233, 199, 99, 0.3);
  --tab-text: #ffde4d;
}

.device-tab-btn--warranty {
  --tab-tone: rgba(177, 94, 194, 0.33);
  --tab-glow: rgba(182, 98, 185, 0.29);
  --tab-text: rgba(214, 131, 253, 0.99);
}

.device-tab-btn--control {
  --tab-tone: rgba(216, 106, 106, 0.34);
  --tab-glow: rgba(215, 105, 105, 0.28);
  --tab-text: #ff5353;
}

.device-tab-stack {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.device-tab-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 1rem;
}

.device-tab-grid--wide > * {
  grid-column: 1 / -1;
}

.device-dashboard-hero {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 1rem;
}

.device-dashboard-main-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 1.1rem 1.4rem;
}

.device-dashboard-subsection {
  padding-bottom: 0.2rem;
  border-bottom: 1px solid var(--border-secondary);
}

/* ── Dashboard Hero Card ──────────────────────────────────────────── */

/*
 * Layout strategy (desktop):
 *   Card is a flex row. Each section is a flex-column with
 *   justify-content: space-between and padding: 10px 0, so the 3 rows
 *   are evenly distributed top-to-bottom regardless of content height.
 *   The card itself has a fixed min-height so all columns are the same.
 *   Row alignment across columns is achieved by keeping the same
 *   flex rhythm — each section always has exactly 3 flex children.
 *   Sections with 2 logical items use a "grow" wrapper for the last one.
 */

/* ── Outer row: main card + notes card, same height ── */
.db-hero-row {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

@media (min-width: 1100px) {
  .db-hero-row {
    flex-direction: row;
    align-items: stretch;
    gap: 1.25rem;
  }
}

/* ── Main info card ── */
.db-hero-card {
  display: flex;
  flex-direction: column;
  background-color: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: 10px;
  padding: 1.75rem 1.5rem;
  gap: 0;
  flex: 1;
  min-width: 0;
}

@media (min-width: 1100px) {
  .db-hero-card {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: stretch;
    padding: 1.3rem 0;
    min-height: 320px;
    row-gap: 0.5rem;
  }
}

/* ── Notes sidebar card ── */
.db-notes-card {
  display: flex;
  flex-direction: column;
  background-color: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: 10px;
  padding: 3.30rem 2.5rem 2.5rem;
  flex-shrink: 0;
  width: 100%;
  gap: 1rem;
  overflow: hidden;
}

@media (min-width: 1100px) {
  .db-notes-card {
    width: 22%;
    min-width: 200px;
    max-width: 300px;
  }
}

/* Vertical/horizontal divider between columns */
.db-hero-divider {
  width: 100%;
  height: 1px;
  background: var(--border-primary);
  opacity: 0.6;
  margin: 1.25rem 0;
  flex-shrink: 0;
}

@media (min-width: 1100px) {
  .db-hero-divider {
    width: 1px;
    height: auto;
    margin: 1.9rem 0.8rem;
    align-self: stretch;
  }
}

/* ── Photo column ── */
.db-hero-photo {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 4.5rem;
  flex-shrink: 0;
}

@media (min-width: 1100px) {
  .db-hero-photo {
    padding: 0rem 2rem 0rem 3rem;
  }
}

/* Pulsing glow animations */
@keyframes glow-pulse-online {
  0%, 100% { opacity: 0.55; transform: translateX(-52%) scale(1); }
  50%       { opacity: 1;    transform: translateX(-52%) scale(1.12); }
}

@keyframes glow-pulse-offline {
  0%, 100% { opacity: 0.45; transform: translateX(-52%) scale(1); }
  50%       { opacity: 0.9;  transform: translateX(-52%) scale(1.1); }
}

/* Shared glow base */
.db-hero-photo--online::before,
.db-hero-photo--offline::before {
  content: "";
  position: absolute;
  width: 230px;
  height: 230px;
  border-radius: 50%;
  bottom: 10%;
  left: 53%;
  pointer-events: none;
}

/* Green pulsing glow when online */
.db-hero-photo--online::before {
  background: radial-gradient(ellipse at center, rgba(169, 247, 95, 0.7) 10%, transparent 55%);
  animation: glow-pulse-online 2.8s ease-in-out infinite;
}

/* Orange-red pulsing glow when offline */
.db-hero-photo--offline::before {
  background: radial-gradient(ellipse at center, rgba(255, 120, 50, 0.65) 10%, transparent 55%);
  animation: glow-pulse-offline 3.4s ease-in-out infinite;
}

.db-hero-photo__img {
  position: relative; /* sits above the ::before glow */
  max-width: 160px;
  max-height: 210px;
  object-fit: contain;
}

/* ── Info sections ── */
/*
 * Each section is a 3-row grid with fixed row height.
 * Every child lands in one row slot — identical height regardless of content
 * (text, progress bar, etc.) — so rows align perfectly across all sections.
 */
.db-hero-section {
  display: grid;
  grid-template-rows: repeat(3, var(--hero-row-h, 65px));
  align-items: center;       /* centers content within each row */
  align-content: space-between;     /* ← centers the whole row group vertically in the section */
  padding: 1rem 1rem;
  flex-shrink: 0;
  min-width: 0;
}

@media (min-width: 1100px) {
  .db-hero-section {
    padding: 1.5rem 3rem;
  }
}

/* Section 3 – Subscription: wide enough for both fields on one line */
.db-hero-section--sub {
  min-width: 400px;
  max-width: 560px;
  flex: 1 1 400px;
}

/* Section 4 – Uptime/Issue */
.db-hero-section--uptime {
  min-width: 240px;
  max-width: 340px;
  flex: 1 1 240px;
}

.db-uptime-issue {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

/* ── Row wrappers ── */
.db-row {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

/* Subscription row 1: Tier left, Warranty right */
.db-sub-header-row {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  white-space: nowrap;
}

/* Warranty column: pushed right by space-between, but its own content left-aligned */
.db-sub-header-row .db-info-field:last-child {
  text-align: left;
}

/* ── Info field (label + value pair) ── */
.db-info-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.db-info-label {
  font-weight: 600;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  opacity: 0.75;
  text-transform: uppercase;
  white-space: nowrap;
}

/* All values use identical styling — no special mono variant */
.db-info-value {
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text-heading);
}

/* ── Progress bars ── */
.db-progress-track {
  width: 100%;
  max-width: 100%;
  height: 12px;
  border-radius: 999px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-primary);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  margin-top: 0.3rem;
}

.db-progress-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.35s ease;
}

/* ── Issue text ── */
.db-issue-source {
  font-size: 0.88rem;
  font-weight: 500;
  color: #63B3ED;
  line-height: 1.35;
}

.db-issue-body {
  font-size: 0.82rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  line-clamp: 4;
  overflow: hidden;
}

/* ── Admin Notes ── */
.db-notes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.db-notes-edit-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  opacity: 0.85;
  line-height: 1;
}

.db-notes-edit-btn:hover {
  opacity: 1;
  color: orange;
}

.db-notes-body {
  font-size: 0.80rem;
  font-weight: 400;
  line-height: 1.5;
  cursor: pointer;
  text-align: left;
  padding: 0rem 0.5rem 0rem 0rem;
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  min-height: 0;   /* important — lets flex item shrink below content size */
}

.db-notes-body:hover {
  opacity: 0.6;
}

.db-notes-textarea {
  width: 100%;
  min-height: 0;
  padding: 0.3rem 0.65rem;
  border-radius: 0.375rem;
  font-size: 1rem;
  border: 1px solid var(--border-input);
  background-color: var(--bg-input);
  color: var(--text-primary);
  resize: vertical;
  text-align: left;
}

/* ── Universal section card — single source of truth for all pages ── */
.ui-section-card {
  border: 1px solid var(--border-primary);
  border-radius: var(--section-radius);
  background-color: var(--bg-card);
  padding: var(--section-padding);
}

.ui-section-card--compact {
  border: 1px solid var(--border-primary);
  border-radius: var(--section-radius);
  background-color: var(--bg-card);
  padding: var(--section-padding-compact);
}

.ui-section-card__title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-primary);
}

.ui-section-card__title {
  font-size: var(--section-title-size);
  font-weight: var(--section-title-weight);
  letter-spacing: var(--section-title-tracking);
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0;
}

/* Larger, white-ish section title for form/settings pages */
.ui-section-card__header-title {
  font-size: var(--section-header-title-size);
  font-weight: var(--section-header-title-weight);
  letter-spacing: var(--section-header-title-tracking);
  color: var(--section-header-title-color);
  margin: 0;
}

/* ── Field labels — secondary titles within section cards ── */

/* Display/read-only label (dt, small caps, muted) */
.ui-field-label {
  display: block;
  font-size: var(--field-label-size);
  font-weight: var(--field-label-weight);
  letter-spacing: var(--field-label-tracking);
  text-transform: uppercase;
  color: var(--field-label-color);
  margin: 0;
}

/* Form label (label element, slightly larger, no uppercase) */
.ui-form-label {
  display: block;
  font-size: var(--form-label-size);
  font-weight: var(--form-label-weight);
  letter-spacing: var(--form-label-tracking);
  color: var(--form-label-color);
  margin-bottom: 0.35rem;
}

/* ── Section cards (used in all tabs) — alias to ui-section-card ── */
.device-section-card {
  border: 1px solid var(--border-primary);
  border-radius: var(--section-radius);
  background-color: var(--bg-card);
  padding: var(--section-padding);
}

.device-section-card__title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-primary);
}

.device-section-card__title {
  font-size: var(--section-title-size);
  font-weight: var(--section-title-weight);
  letter-spacing: var(--section-title-tracking);
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

/* Pencil edit button on section card titles */
.section-edit-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem 0.4rem;
  border-radius: 0.3rem;
  transition: color 0.15s ease;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.section-edit-btn:hover {
  color: #ecc94b;
}

/* ── Toggle Switch ── */
.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.toggle-switch__track {
  position: relative;
  display: inline-block;
  width: 2.5rem;
  height: 1.35rem;
  border-radius: 9999px;
  background-color: #374151;
  transition: background-color 0.2s ease;
  flex-shrink: 0;
}
.toggle-switch__track[data-on="true"] {
  background-color: var(--accent);
}
.toggle-switch__thumb {
  position: absolute;
  top: 0.175rem;
  left: 0.175rem;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background-color: #fff;
  transition: transform 0.2s ease;
}
.toggle-switch__track[data-on="true"] .toggle-switch__thumb {
  transform: translateX(1.15rem);
}
.toggle-switch__label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}
.toggle-switch__label[data-on="true"] {
  color: var(--accent);
}

/* ── Leaflet map isolation — prevents map z-indices bleeding over modals ── */
.device-map-wrap {
  position: relative;
  isolation: isolate;
}

/* ── Bell master strip (between Overview and bell cards) ── */
.bell-master-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2.5rem;
  border-radius: 0.6rem;
  border: 1px solid var(--border-primary);
  background-color: var(--bg-card);
}
.bell-master-strip__left {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.bell-master-strip__right {
  display: flex;
  align-items: center;
}
.bell-master-strip__warning-badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0.2rem 0.5rem;
  border-radius: 0.3rem;
  background-color: rgba(99, 179, 237, 0.1);
  color: #63b3ed;
  border: 1px solid rgba(99, 179, 237, 0.3);
}

/* ── Status text warning tone (for voided warranty) ── */
.device-status-text--warning {
  color: #f59e0b;
}

.device-subtitle {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.65rem;
}

.device-hero-image-wrap {
  border: 1px solid var(--border-primary);
  border-radius: 0.75rem;
  background: radial-gradient(circle at 20% 20%, rgba(116, 184, 22, 0.18), rgba(17, 24, 39, 0.6));
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  margin-bottom: 0.8rem;
}

.device-hero-image-wrap--square {
  min-height: 280px;
  max-width: 400px;
  width: 100%;
  aspect-ratio: 1 / 1;
}

.device-hero-image {
  max-height: 280px;
  max-width: 100%;
  object-fit: contain;
}

.device-snapshot-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem 1.2rem;
  align-items: start;
}

.device-progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-primary);
  overflow: hidden;
}

.device-progress-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.35s ease;
}

.device-field-row {
  display: grid;
  gap: 0 1.1rem;        /* no vertical gap — row height handles spacing */
  margin-bottom: 0;
  align-items: start;
}

/* Each field is a fixed-height slot — same as --hero-row-h so tabs match the dashboard rhythm */
.device-field {
  height: var(--field-row-h, 75px);
  padding-right: 0.3rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.device-field-value {
  margin-top: 0.25rem;
  line-height: 1.5;
}

.device-value-secondary {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.device-status-text {
  font-weight: 600;
  letter-spacing: 0.01em;
}

.device-status-text--positive {
  color: var(--success-text);
  text-shadow: 0 0 14px rgba(116, 184, 22, 0.28);
}

.device-status-text--negative {
  color: #ff9e4a;
  text-shadow: 0 0 14px rgba(243, 75, 75, 0.25);
}

.device-status-text--info {
  color: var(--badge-blue-text);
  text-shadow: 0 0 16px rgba(99, 179, 237, 0.28);
}

.device-status-text--muted {
  color: var(--text-muted);
}

.device-empty-cell {
  height: var(--field-row-h, 65px);
}

.device-inline-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6rem;
  padding: 1rem 0px 0rem 0px;
}

.device-inline-facts > div {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  line-height: 1.1;
}

.device-inline-facts__label {
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1.1;
}

.device-inline-facts--overview .device-inline-facts__label::after {
  content: "|";
  color: var(--border-primary);
  opacity: 0.65;
  margin: 0 0.6rem;
  font-weight: 500;
}

.device-inline-facts--overview > div {
  gap: 0;
}

.device-location-grid {
  display: grid;
  grid-template-columns: 1fr;
}

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

.bell-mechanism-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(500px, 1fr));
  gap: 0.85rem;
}

.bell-mechanism-card {
  position: relative;
  border-radius: 10px;
  background: #1F2937;
  padding: 2.5rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px;
  gap: 0 2rem;
  overflow: hidden;
}

.bell-mechanism-card::before {
  content: '';
  position: absolute;
  left: -160px;
  top: 50%;
  transform: translateY(-50%);
  width: 330px;
  height: 330px;
  opacity: 0.02;
  pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M12 22c1.1 0 2-.9 2-2h-4c0 1.1.9 2 2 2zm6-6V11c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z'/%3E%3C/svg%3E") no-repeat center / contain;
}

/* Left column: title at top, info at bottom */
.bell-mechanism-card__left {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.bell-mechanism-card__left-top {
  display: flex;
  flex-direction: column;
}

.bell-mechanism-card__title {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 20px;
  line-height: 24px;
  color: #63B3ED;
  text-shadow: 5px 5px 8px rgba(0, 0, 0, 0.25);
  margin: 0 0 0.5rem 0;
  white-space: nowrap;
}

.bell-mechanism-card__divider {
  border: none;
  border-top: 1px solid #374151;
  opacity: 0.5;
  width: 179px;
  margin: 0 0 1rem 0;
}

.bell-mechanism-card__info {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.bell-mechanism-card__info p {
  margin: 0;
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  font-size: 15px;
  line-height: 18px;
  color: #9CA3AF;
  white-space: nowrap;
}

.bell-mechanism-card__highlight {
  font-weight: 700;
  color: #74B816;
}

.bell-mechanism-card__highlight--strikes {
  color: #F97316;
}

/* Right column: striker image at top, cert at bottom */
.bell-mechanism-card__right {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  position: relative;
  z-index: 1;
}

.bell-mechanism-card__right-top {
  display: flex;
  align-items: flex-start;
}

.bell-mechanism-card__striker-img {
  width: 150px;
  height: 110px;
  object-fit: contain;
  object-position: top right;
  pointer-events: none;
}

.bell-mechanism-card__cert {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: flex-end;
  opacity: 0.52;
}

.bell-mechanism-card__cert-text {
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  font-size: 13px;
  line-height: 16px;
  text-align: right;
  color: #9CA3AF;
}

.bell-mechanism-card__cert-brand {
  color: #63B3ED;
}

.bell-mechanism-card__cert-badge {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex-shrink: 0;
}

@media (min-width: 1024px) {
  .device-tab-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .device-dashboard-main-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .device-location-grid {
    grid-template-columns: 1.3fr 1fr;
    column-gap: 2.5rem;
  }

  .device-snapshot-grid {
    grid-template-columns: auto 1fr;
  }

  .dashboard-bottom-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

}


@media (min-width: 1500px) {
  .device-tab-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .device-dashboard-main-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .dashboard-bottom-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-bottom-grid__notes {
    grid-column: span 2;
  }

  .dashboard-bottom-grid__users {
    grid-column: span 1;
  }

}

/* ── Upload modal animations ── */
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* Quotation row — show delete button on row hover */
.quotation-row:hover .quotation-delete-btn {
  opacity: 1 !important;
}

/* File input */
input[type="file"]::file-selector-button {
  background-color: var(--bg-card) !important;
  color: var(--accent) !important;
  border: 1px solid var(--border-primary) !important;
}

/* ── CRM status icon breathe animation ── */
@keyframes crm-breathe {
  0%, 100% { opacity: 1;    transform: scale(1);    }
  50%       { opacity: 0.45; transform: scale(0.88); }
}
.crm-icon-breathe {
  animation: crm-breathe 2.2s ease-in-out infinite;
}
