/* ===== Asset Card ===== */
.asset-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: visible;  /* must be visible so lifecycle dropdown isn't clipped */
  animation: fadeIn .3s ease;
}

.asset-card.closing {
  animation: fadeOut .2s ease forwards;
}

@keyframes fadeOut {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(6px); }
}

.asset-card-header {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-mid) 100%);
  color: var(--white);
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;  /* replaces card overflow:hidden for top corners */
}

.asset-card-title-block { flex: 1; min-width: 0; }

.asset-card-close {
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: rgba(255,255,255,.65);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  line-height: 0;
  transition: color 0.15s, background 0.15s;
  align-self: flex-start;
  margin-top: -2px;
}
.asset-card-close:hover { color: var(--white); background: rgba(255,255,255,.15); }

.asset-name {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.asset-type-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.asset-type-badge {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 100px;
  padding: 2px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.asset-customer {
  font-size: 0.88rem;
  color: rgba(255,255,255,.7);
}

.asset-header-id {
  text-align: right;
  flex-shrink: 0;
}

.asset-id-label {
  font-size: 0.68rem;
  color: rgba(255,255,255,.5);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.asset-id-value {
  font-size: 1.1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: rgba(255,255,255,.9);
}

.open-syncro-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  font-size: 0.75rem;
  color: rgba(255,255,255,.6);
  text-decoration: none;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  transition: background .15s, color .15s;
}
.open-syncro-link:hover {
  background: rgba(255,255,255,.15);
  color: var(--white);
}

/* ===== Card Body ===== */
.asset-card-body {
  padding: 20px 24px;
  display: grid;
  gap: 20px;
}

/* ===== Status Section ===== */
.status-section {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.status-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.status-label {
  font-size: 0.68rem;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
}

.status-last-seen {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-700);
  padding: 3px 0;
}

/* ===== Badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 100px;
  padding: 4px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.badge-it-possession {
  background: var(--green-bg);
  color: var(--green);
  border-color: #86efac;
}

.badge-user-possession {
  background: var(--yellow-bg);
  color: var(--yellow);
  border-color: #fde047;
}

.badge-pre-deployment { background: #cffafe; color: #0e7490; border-color: #67e8f9; }
.badge-inventory    { background: var(--primary-50); color: var(--primary); border-color: #93c5fd; }
.badge-active       { background: var(--green-bg);   color: var(--green);   border-color: #86efac; }
.badge-for-repair   { background: var(--yellow-bg);  color: var(--yellow);  border-color: #fde047; }
.badge-for-upgrade  { background: var(--purple-bg);  color: var(--purple);  border-color: #c4b5fd; }
.badge-decommissioned { background: var(--red-bg);   color: var(--red);     border-color: #fca5a5; }
.badge-for-parts    { background: #fff3e0;           color: #b45309;         border-color: #fcd34d; }
.badge-disposed-of  { background: var(--gray-100);   color: var(--gray-700); border-color: var(--gray-400); }
.badge-unknown      { background: var(--gray-100);   color: var(--gray-600); border-color: var(--gray-300); }

/* ===== Info Grid ===== */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.info-item {}

.info-item-label {
  font-size: 0.68rem;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
  margin-bottom: 3px;
}

.info-item-value {
  font-size: 0.9rem;
  color: var(--gray-800);
  font-weight: 500;
}

.info-item-value.none { color: var(--gray-400); font-style: italic; font-weight: 400; }

.info-item-full { grid-column: 1 / -1; }

.asset-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 1px; }

.asset-tag-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: var(--gray-100);
  color: var(--gray-700);
  border: 1px solid var(--gray-200);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

/* ===== Action Buttons Row ===== */
.action-section { border-top: 1px solid var(--gray-100); padding-top: 18px; }

.action-section-title {
  font-size: 0.75rem;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
  margin-bottom: 12px;
}

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--gray-50);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  color: var(--gray-700);
  cursor: pointer;
  font-size: 0.84rem;
  font-family: var(--font);
  font-weight: 600;
  padding: 9px 14px;
  transition: all .15s;
  white-space: nowrap;
}

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

.action-btn:active { transform: scale(.97); }

.action-btn.accent {
  background: var(--accent-50);
  border-color: var(--accent);
  color: var(--accent-dark);
}
.action-btn.accent:hover { background: var(--accent); color: var(--white); }

.action-btn.action-btn-remove {
  border-color: var(--red-200, #fecaca);
  color: var(--red, #dc2626);
}
.action-btn.action-btn-remove:hover {
  background: var(--red-bg, #fef2f2);
  border-color: var(--red, #dc2626);
  color: var(--red, #dc2626);
}

.action-btn.loading {
  opacity: .65;
  pointer-events: none;
}

.action-btn svg { width: 15px; height: 15px; flex-shrink: 0; }

/* ===== Lifecycle Dropdown ===== */

/* Wrapper keeps the dropdown in-flow relative to the button */
.lc-wrap {
  position: relative;
  display: inline-flex;
}

/* Chevron inside the lifecycle button */
.lc-chevron {
  width: 13px;
  height: 13px;
  margin-left: auto;
  flex-shrink: 0;
  transition: transform .2s ease;
}

#action-lifecycle .lc-btn-label {
  flex: 1;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#action-lifecycle.open .lc-chevron {
  transform: rotate(180deg);
}

/* The dropdown panel */
.lifecycle-dropdown {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  z-index: 30;
  min-width: 170px;
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  opacity: 0;
  transform: translateY(-6px) scale(.97);
  transform-origin: top left;
  pointer-events: none;
  visibility: hidden;
  transition: opacity .15s ease, transform .15s ease, visibility 0s linear .15s;
}

.lifecycle-dropdown.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  visibility: visible;
  transition: opacity .15s ease, transform .15s ease, visibility 0s linear 0s;
}

.lifecycle-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.78rem;
  font-family: var(--font);
  color: var(--gray-700);
  transition: background .1s;
  text-align: left;
}

.lifecycle-option:hover { background: var(--gray-50); }

.lifecycle-option.current {
  font-weight: 700;
  color: var(--gray-900);
}

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

.lc-dot-pre-deployment { background: #0e7490; }
.lc-dot-inventory      { background: var(--primary); }
.lc-dot-active         { background: var(--green); }
.lc-dot-for-repair     { background: var(--yellow); }
.lc-dot-for-upgrade    { background: var(--purple); }
.lc-dot-for-parts      { background: #b45309; }
.lc-dot-decommissioned { background: var(--red); }
.lc-dot-disposed-of    { background: var(--gray-400); }

.lc-check {
  margin-left: auto;
  flex-shrink: 0;
  color: var(--primary);
}

/* ===== Contact Dropdown Panel ===== */
.contact-panel {
  display: none;
  margin-top: 12px;
  background: var(--gray-50);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 14px;
  animation: fadeIn .2s ease;
}

.contact-panel.visible { display: block; }

.contact-panel-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 10px;
}

.contact-search {
  width: 100%;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.88rem;
  font-family: var(--font);
  margin-bottom: 10px;
  outline: none;
  transition: border-color .15s;
}
.contact-search:focus { border-color: var(--primary); }

.contact-list {
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.contact-item {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background .12s;
}

.contact-item:hover { background: var(--primary-50); }

.contact-item-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--gray-800);
}

.contact-item-email {
  font-size: 0.75rem;
  color: var(--gray-500);
}

.contact-loading, .contact-empty {
  text-align: center;
  padding: 16px;
  color: var(--gray-500);
  font-size: 0.85rem;
}

/* ===== Infrastructure ===== */

.infra-option-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  margin-bottom: 6px;
  border: 1.5px dashed var(--gray-300);
  border-radius: var(--radius-sm);
  background: var(--gray-50);
  color: var(--gray-600);
  font-size: 0.84rem;
  font-family: var(--font);
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
  text-align: left;
}

.infra-option-btn:hover {
  border-color: var(--gray-500);
  background: var(--gray-100);
  color: var(--gray-800);
}

.infra-location-value {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--gray-700);
}

/* ===== Ticket History Panel ===== */
.ticket-section {
  border-top: 1px solid var(--gray-100);
}

.ticket-toggle {
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0 0;
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: .05em;
  transition: color .15s;
}

.ticket-toggle:hover { color: var(--primary); }

.ticket-toggle .chevron {
  transition: transform .2s;
  color: var(--gray-400);
}

.ticket-toggle.open .chevron { transform: rotate(180deg); }

.ticket-list {
  display: none;
  margin-top: 12px;
  flex-direction: column;
  gap: 8px;
  animation: fadeIn .25s ease;
}

.ticket-list.visible { display: flex; }

.ticket-item {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px;
  align-items: center;
}

.ticket-item.status-resolved { border-left-color: var(--green); }
.ticket-item.status-open      { border-left-color: var(--accent); }
.ticket-item.status-in-progress { border-left-color: var(--yellow); }

.ticket-subject {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--gray-800);
}

.ticket-meta {
  font-size: 0.75rem;
  color: var(--gray-500);
  margin-top: 2px;
}

.ticket-status {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 100px;
  text-align: right;
  white-space: nowrap;
}

.ticket-status.resolved    { background: var(--green-bg); color: var(--green); }
.ticket-status.open        { background: var(--accent-50); color: var(--accent-dark); }
.ticket-status.in-progress { background: var(--yellow-bg); color: var(--yellow); }
.ticket-status.default     { background: var(--gray-100);  color: var(--gray-600); }

/* ===== Last Scan / Action Metadata ===== */
.meta-section {
  background: var(--gray-50);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.meta-item {}

.meta-item-label {
  font-size: 0.65rem;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
}

.meta-item-value {
  font-size: 0.82rem;
  color: var(--gray-700);
  font-weight: 500;
}

/* ===== Asset History Timeline ===== */
.history-section { border-top: 1px solid var(--gray-100); }

.history-list {
  display: none;
  margin-top: 12px;
  padding-left: 4px;
  animation: fadeIn .25s ease;
}

.history-list.visible { display: flex; flex-direction: column; gap: 0; }

.history-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 0;
  border-left: 2px solid var(--gray-200);
  margin-left: 6px;
  padding-left: 14px;
  position: relative;
}

.history-dot {
  position: absolute;
  left: -5px;
  top: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--white);
  flex-shrink: 0;
}

.history-desc {
  font-size: 0.84rem;
  color: var(--gray-800);
  font-weight: 500;
  line-height: 1.4;
}

.history-time {
  font-size: 0.72rem;
  color: var(--gray-400);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

/* ===== Status Badge Dropdowns ===== */

.status-badge-wrap {
  position: relative;
  display: inline-block;
}

/* The badge itself becomes a button — inherits all .badge + .badge-* colors */
.status-badge-btn {
  cursor: pointer;
  font-family: var(--font);
  font-weight: 700;
  transition: filter .12s;
}

.status-badge-btn:hover { filter: brightness(0.93); }
.status-badge-btn:active { transform: scale(.97); }

.status-badge-chevron {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
  margin-left: 2px;
  transition: transform .15s ease;
}

.status-badge-btn.open .status-badge-chevron {
  transform: rotate(180deg);
}

/* Dropdown panel — mirrors .lifecycle-dropdown */
.status-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 40;
  min-width: 160px;
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  opacity: 0;
  transform: translateY(-6px) scale(.97);
  transform-origin: top left;
  pointer-events: none;
  visibility: hidden;
  transition: opacity .15s ease, transform .15s ease, visibility 0s linear .15s;
}

.status-dropdown.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  visibility: visible;
  transition: opacity .15s ease, transform .15s ease, visibility 0s linear 0s;
}

.status-dropdown-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.78rem;
  font-family: var(--font);
  color: var(--gray-700);
  transition: background .1s;
  text-align: left;
}

.status-dropdown-option:hover { background: var(--gray-50); }

.status-dropdown-option.current {
  font-weight: 700;
  color: var(--gray-900);
}
