/* ============================================================
   Vendor Pulse — Shared Components
   ============================================================ */

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13.5px; font-weight: 500;
  padding: 9px 14px; border-radius: 8px;
  border: 1px solid var(--hair-2); background: transparent; color: var(--text);
  transition: background .15s, border-color .15s, transform .15s;
}
.btn:hover { background: var(--panel); border-color: var(--hair-2); }
.btn-primary {
  background: var(--lime); color: #0a0a0b; border-color: var(--lime);
  font-weight: 600;
  box-shadow: 0 0 0 1px rgba(255,255,255,.04) inset, 0 12px 40px -12px rgba(198,255,78,.5);
}
.btn-primary:hover { background: #d4ff6a; border-color: #d4ff6a; transform: translateY(-1px); }
.btn-ghost { border-color: transparent; }
.btn-ghost:hover { background: var(--panel); }
.btn-lg { padding: 13px 20px; font-size: 14.5px; border-radius: 10px; }
.btn-sm { padding: 5px 12px; font-size: 12.5px; border-radius: 6px; }

.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* Action buttons */
.btn-approve { background: rgba(69,215,138,.15); color: var(--ok); border-color: transparent; }
.btn-approve:hover:not(:disabled) { background: rgba(69,215,138,.25); }
.btn-dismiss { background: var(--panel-2); color: var(--dim); border-color: var(--hair); }
.btn-dismiss:hover:not(:disabled) { background: var(--hair); }
.btn-escalate { background: var(--high-soft); color: var(--high); border-color: transparent; }
.btn-escalate:hover:not(:disabled) { background: rgba(255,94,94,.2); }
.btn-edit { background: var(--accent-soft); color: var(--accent-2); border-color: transparent; }
.btn-edit:hover:not(:disabled) { background: rgba(139,92,246,.2); }
.btn-save { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-save:hover:not(:disabled) { background: var(--accent-2); }

/* ---- Cards ---- */
.card {
  background: var(--panel); border: 1px solid var(--hair);
  border-radius: 12px; overflow: hidden;
  transition: border-color .15s;
}
.card:hover { border-color: var(--hair-2); }
.card.decided { opacity: .65; }
.card.decided:hover { opacity: .8; }
.card.resolved { opacity: .7; }
.card.resolved:hover { opacity: .85; }

.card-summary {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; cursor: pointer; user-select: none;
}
.card-summary:hover { background: rgba(255,255,255,.015); }

.card-body {
  display: none;
  padding: 0 18px 18px;
  border-top: 1px solid var(--hair);
}
.card.open .card-body { display: block; }

.card-title { font-size: 14px; font-weight: 500; color: var(--text); flex: 1; line-height: 1.4; }
.card-meta-inline { font-size: 12px; color: var(--mute); white-space: nowrap; flex-shrink: 0; font-family: var(--mono); }
.expand-icon { color: var(--faint); font-size: 12px; flex-shrink: 0; transition: transform .2s; }
.card.open .expand-icon { transform: rotate(180deg); }

/* ---- Severity pills ---- */
.severity-pill {
  padding: 3px 10px; border-radius: 9999px;
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; white-space: nowrap; flex-shrink: 0;
  font-family: var(--mono);
}
.sev-breaking_high { background: var(--high-soft); color: var(--high); }
.sev-action_likely { background: var(--act-soft); color: var(--act); }
.sev-watch { background: var(--watch-soft); color: var(--watch); }
.sev-informational { background: var(--panel-2); color: var(--info); }
.sev-needs_review { background: var(--accent-soft); color: var(--accent-2); }

/* ---- Badges ---- */
.badge {
  font-size: 11px; padding: 2px 10px; border-radius: 999px;
  font-weight: 600; letter-spacing: .3px;
  display: inline-flex; align-items: center; gap: 4px;
}
.badge-dry  { background: var(--accent-soft); color: var(--accent-2); }
.badge-live { background: var(--lime-soft); color: var(--lime); }

/* ---- Stat chips ---- */
.stats-bar {
  display: flex; gap: 10px; flex-wrap: wrap;
  padding: 16px 32px;
  border-bottom: 1px solid var(--hair);
  background: var(--panel);
}
.stat-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: 8px;
  background: var(--bg-2); border: 1px solid var(--hair);
  font-size: 12px; cursor: pointer;
  transition: border-color .15s;
  min-height: 36px;
}
.stat-chip:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.stat-chip:hover { border-color: var(--hair-2); }
.stat-chip.active { border-color: var(--accent); }
.stat-count { font-weight: 700; font-size: 14px; color: var(--text); }
.stat-label { color: var(--mute); }
.stat-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-total { background: var(--dim); }
.dot-breaking_high { background: var(--high); }
.dot-action_likely { background: var(--act); }
.dot-watch { background: var(--watch); }
.dot-needs_review { background: var(--accent); }
.dot-informational { background: var(--info); }

/* ---- Filters ---- */
.filter-section {
  padding: 12px 32px;
  border-bottom: 1px solid var(--hair);
  display: flex; flex-direction: column; gap: 8px;
  background: var(--bg-2);
}
.filter-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.filter-label { font-size: 10.5px; font-weight: 600; color: var(--mute); text-transform: uppercase; letter-spacing: .08em; min-width: 52px; }
.filter-btn {
  padding: 6px 12px; border-radius: 6px;
  border: 1px solid var(--hair); background: transparent;
  color: var(--dim); cursor: pointer; font-size: 12px;
  transition: all .15s;
  min-height: 32px;
}
.filter-btn:hover { border-color: var(--hair-2); color: var(--text); }
.filter-btn.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-2); }
.filter-btn:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.filter-btn.active.sev-breaking_high { background: var(--high-soft); border-color: var(--high); color: var(--high); }
.filter-btn.active.sev-action_likely { background: var(--act-soft); border-color: var(--act); color: var(--act); }
.filter-btn.active.sev-watch { background: var(--watch-soft); border-color: var(--watch); color: var(--watch); }
.filter-btn.active.sev-informational { background: var(--panel-2); border-color: var(--info); color: var(--dim); }
.filter-btn.active.sev-needs_review { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-2); }

/* ---- Detail grid ---- */
.detail-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 14px; margin-top: 14px; margin-bottom: 14px;
}
@media (max-width: 640px) { .detail-grid { grid-template-columns: 1fr; } }

.detail-block { display: flex; flex-direction: column; gap: 3px; }
.detail-key { font-size: 10.5px; font-weight: 600; color: var(--mute); text-transform: uppercase; letter-spacing: .08em; }
.detail-val { font-size: 13px; color: var(--dim); }
.detail-val.mono { font-family: var(--mono); font-size: 12px; }

/* ---- Confidence bar ---- */
.confidence-bar {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px;
}
.bar-track { flex: 1; height: 4px; background: var(--hair); border-radius: 9999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 9999px; transition: width .3s; }
.bar-low { width: 33%; background: var(--mute); }
.bar-medium { width: 66%; background: var(--act); }
.bar-high { width: 100%; background: var(--ok); }
.bar-label { font-size: 11px; color: var(--mute); width: 48px; text-align: right; font-family: var(--mono); }

/* ---- Evidence section ---- */
.evidence-section {
  background: var(--bg-2); border-radius: 8px;
  padding: 12px; margin-bottom: 12px;
  font-size: 12px; font-family: var(--mono);
}
.evidence-label { color: var(--mute); margin-bottom: 6px; font-weight: 600; text-transform: uppercase; font-size: 10px; letter-spacing: .08em; }
.evidence-item { color: var(--dim); margin-bottom: 4px; padding-left: 14px; position: relative; }
.evidence-item::before { content: "\25B8"; position: absolute; left: 0; color: var(--faint); }

/* ---- Ticket preview ---- */
.ticket-preview {
  background: var(--bg-2); border-radius: 8px;
  padding: 12px; margin-bottom: 12px;
  font-size: 12px; line-height: 1.65;
  color: var(--dim); max-height: 180px; overflow-y: auto;
}
.ticket-preview-title { font-weight: 700; color: var(--text); margin-bottom: 6px; font-size: 13px; }

/* ---- Labels ---- */
.labels { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.label-chip {
  padding: 2px 8px; background: var(--accent-soft); color: var(--accent-2);
  border-radius: 9999px; font-size: 10.5px;
}

/* ---- Actions row ---- */
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

/* ---- Edit form ---- */
.edit-form { margin-top: 12px; display: none; }
.edit-form.open { display: block; }
.edit-form input, .edit-form textarea {
  width: 100%; background: var(--bg-2); border: 1px solid var(--hair);
  border-radius: 8px; color: var(--text); padding: 8px 12px;
  font-size: 13px; margin-bottom: 8px; font-family: inherit; resize: vertical;
}
.edit-form textarea { min-height: 120px; }

/* ---- Decided banner ---- */
.decided-banner {
  text-align: center; padding: 10px; border-radius: 8px;
  font-weight: 600; font-size: 12px; margin-top: 8px;
  text-transform: uppercase; letter-spacing: .5px;
}
.decided-approved { background: rgba(69,215,138,.1); color: var(--ok); }
.decided-dismissed { background: var(--panel-2); color: var(--mute); }
.decided-edited { background: var(--accent-soft); color: var(--accent-2); }
.decided-escalated { background: var(--high-soft); color: var(--high); }

/* ---- Empty / Loading / Error ---- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--faint); }
.empty-state h2 { font-size: 16px; margin-bottom: 8px; color: var(--mute); }
.loading { text-align: center; padding: 40px; color: var(--faint); }
.error-banner {
  background: var(--high-soft); color: var(--high);
  padding: 10px 16px; border-radius: 8px;
  margin: 16px 32px; font-size: 13px;
}

/* ---- Chips ---- */
.chip {
  font-size: 10.5px; padding: 3px 8px; border-radius: 6px;
  background: var(--panel-2); color: var(--dim); border: 1px solid var(--hair);
}

/* ---- Section ---- */
.section {
  background: var(--panel); border: 1px solid var(--hair);
  border-radius: 12px; padding: 24px; margin-bottom: 16px;
}
.section-title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.section-desc { font-size: 13px; color: var(--mute); margin-bottom: 20px; line-height: 1.5; }

/* ---- Form fields ---- */
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field-label {
  display: block; font-size: 11px; font-weight: 600;
  color: var(--mute); text-transform: uppercase; letter-spacing: .05em;
  margin-bottom: 6px;
}
.field-value {
  font-size: 13px; color: var(--dim); padding: 8px 12px;
  background: var(--bg-2); border: 1px solid var(--hair);
  border-radius: 8px;
}
.field-value.mono { font-family: var(--mono); font-size: 12px; }

.input-field {
  width: 100%; padding: 8px 12px;
  background: var(--bg-2); border: 1px solid var(--hair);
  border-radius: 8px; color: var(--text);
  font-size: 13px; font-family: inherit;
}
.input-field:focus { border-color: var(--accent); outline: none; }
.input-field::placeholder { color: var(--faint); }
.input-field.mono { font-family: var(--mono); font-size: 12px; }

.select-wrap { position: relative; }
.select-wrap select {
  width: 100%; padding: 8px 12px;
  background: var(--bg-2); border: 1px solid var(--hair);
  border-radius: 8px; color: var(--text);
  font-size: 13px; font-family: inherit;
  appearance: none; cursor: pointer;
}
.select-wrap::after {
  content: "\25BC"; position: absolute; right: 12px; top: 50%;
  transform: translateY(-50%); color: var(--faint);
  font-size: 10px; pointer-events: none;
}
.select-wrap select:focus { border-color: var(--accent); outline: none; }
.select-wrap select:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

/* ---- Toggle ---- */
.toggle {
  position: relative; width: 44px; height: 24px; flex-shrink: 0; margin-left: 16px;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .slider {
  position: absolute; inset: 0; background: var(--hair-2);
  border-radius: 9999px; cursor: pointer; transition: background .2s;
}
.toggle .slider::before {
  content: ""; position: absolute; width: 18px; height: 18px;
  left: 3px; top: 3px; background: var(--mute); border-radius: 50%;
  transition: transform .2s, background .2s;
}
.toggle input:checked + .slider { background: var(--accent); }
.toggle input:checked + .slider::before { transform: translateX(20px); background: #fff; }
.toggle input:disabled + .slider { cursor: not-allowed; opacity: .5; }

.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; border-bottom: 1px solid var(--hair);
}
.toggle-row:last-child { border-bottom: none; padding-bottom: 0; }
.toggle-row:first-child { padding-top: 0; }
.toggle-info { flex: 1; }
.toggle-title { font-size: 14px; font-weight: 500; color: var(--text); }
.toggle-desc { font-size: 12px; color: var(--mute); margin-top: 2px; }

/* ---- Toast ---- */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  padding: 12px 20px; border-radius: 8px;
  font-size: 13px; font-weight: 600; z-index: 100;
  animation: toastIn .3s ease, toastOut .3s ease 2.7s forwards;
}
.toast-ok { background: rgba(69,215,138,.15); color: var(--ok); }
.toast-err { background: var(--high-soft); color: var(--high); }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; } }

/* ---- Table ---- */
.data-table {
  width: 100%; border-collapse: collapse;
  background: var(--panel); border-radius: 12px; overflow: hidden;
}
.data-table th, .data-table td {
  padding: 12px 16px; text-align: left;
  border-bottom: 1px solid var(--hair);
}
.data-table th {
  background: var(--bg-2); font-size: 11px; font-weight: 600;
  color: var(--mute); text-transform: uppercase; letter-spacing: .05em;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover { background: rgba(255,255,255,.015); }

@media (max-width: 640px) {
  .data-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table { min-width: 640px; }
  .data-table th, .data-table td { padding: 10px 12px; font-size: 12px; }
}

/* ---- Pagination ---- */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; margin-top: 20px; padding: 16px;
}
.pagination-btn {
  padding: 8px 14px; border-radius: 6px;
  border: 1px solid var(--hair); background: transparent;
  color: var(--dim); cursor: pointer; font-size: 13px;
  transition: all .15s;
  min-height: 36px;
}
.pagination-btn:hover:not(:disabled) { border-color: var(--hair-2); color: var(--text); }
.pagination-btn:disabled { opacity: .4; cursor: not-allowed; }
.pagination-btn:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.pagination-info { font-size: 13px; color: var(--mute); }

/* ---- Status dots ---- */
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.status-dot.ok { background: var(--ok); box-shadow: 0 0 6px rgba(69,215,138,.5); }
.status-dot.warn { background: var(--act); box-shadow: 0 0 6px rgba(255,181,71,.5); }
.status-dot.err { background: var(--high); box-shadow: 0 0 6px rgba(255,94,94,.5); }
.status-dot.off { background: var(--hair-2); }

/* ---- Vendor / Type badges ---- */
.vendor-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; background: var(--watch-soft); color: var(--watch);
  border-radius: 4px; font-size: 11px; font-weight: 600; text-transform: uppercase;
}
.type-badge {
  display: inline-flex; padding: 2px 8px;
  background: var(--bg-2); color: var(--mute);
  border-radius: 4px; font-size: 11px; font-family: var(--mono);
}

/* ---- Action badges ---- */
.action-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 6px;
  font-size: 11px; font-weight: 600; text-transform: uppercase;
}
.action-approved { background: rgba(69,215,138,.15); color: var(--ok); }
.action-dismissed { background: var(--panel-2); color: var(--mute); }
.action-edited { background: var(--accent-soft); color: var(--accent-2); }
.action-escalated { background: var(--high-soft); color: var(--high); }

/* ---- Two col ---- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .two-col { grid-template-columns: 1fr; } }

/* ---- Secret mask ---- */
.secret-mask { color: var(--faint); letter-spacing: 2px; }

/* ---- Change summary ---- */
.change-summary {
  background: var(--bg-2); border-radius: 8px;
  padding: 12px; margin-bottom: 14px;
  font-size: 13px; line-height: 1.65; color: var(--dim);
}

/* ---- Modal ---- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.7);
  display: grid; place-items: center; z-index: 200;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--panel); border: 1px solid var(--hair);
  border-radius: 16px; width: 90%; max-width: 480px; overflow: hidden;
}
.modal-header {
  padding: 20px 24px; border-bottom: 1px solid var(--hair);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 18px; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--mute); cursor: pointer; font-size: 20px; padding: 4px; border-radius: 4px; }
.modal-close:hover { color: var(--text); }
.modal-close:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.modal-body { padding: 24px; }
.modal-actions {
  padding: 16px 24px; border-top: 1px solid var(--hair);
  display: flex; gap: 8px; justify-content: flex-end;
}

/* ---- Summary cards ---- */
.summary-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px; margin-bottom: 20px;
}
.summary-card {
  background: var(--panel); border: 1px solid var(--hair);
  border-radius: 10px; padding: 14px 16px;
}
.summary-value { font-size: 24px; font-weight: 700; color: var(--text); }
.summary-label { font-size: 11px; color: var(--mute); text-transform: uppercase; letter-spacing: .05em; }

/* ---- Dashboard stats ---- */
.dash-card {
  background: var(--panel); border: 1px solid var(--hair);
  border-radius: 12px; padding: 20px;
}
.dash-card-title { font-size: 12px; font-weight: 600; color: var(--mute); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; }
.dash-card-value { font-size: 32px; font-weight: 700; color: var(--text); }
.dash-card-sub { font-size: 13px; color: var(--mute); margin-top: 4px; }

.dash-section {
  background: var(--panel); border: 1px solid var(--hair);
  border-radius: 12px; padding: 20px; margin-bottom: 16px;
}
.dash-section-title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 16px; }
.dash-bar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.dash-bar-label { width: 120px; font-size: 13px; color: var(--dim); flex-shrink: 0; }
.dash-bar-track { flex: 1; height: 8px; background: var(--hair); border-radius: 4px; overflow: hidden; }
.dash-bar-fill { height: 100%; border-radius: 4px; transition: width .3s; }
.dash-bar-value { width: 40px; font-size: 13px; font-weight: 600; color: var(--dim); text-align: right; flex-shrink: 0; }

@media (max-width: 640px) {
  .dash-bar-row { gap: 8px; }
  .dash-bar-label { width: 100px; font-size: 12px; }
  .dash-bar-value { width: 32px; font-size: 12px; }
  .dash-card-value { font-size: 24px; }
}

/* ---- Tab nav ---- */
.tab-nav {
  display: flex; gap: 4px; padding: 12px 32px;
  border-bottom: 1px solid var(--hair); background: var(--bg-2);
  flex-wrap: wrap;
}
.tab-btn {
  padding: 8px 14px; border-radius: 6px;
  border: none; background: transparent; color: var(--mute);
  cursor: pointer; font-size: 13px; font-weight: 500;
  transition: all .15s;
  min-height: 36px;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { background: var(--accent-soft); color: var(--accent-2); }
.tab-btn:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* ---- Inbox header ---- */
.inbox-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px 32px;
  border-bottom: 1px solid var(--hair);
  background: var(--bg-2);
}
.inbox-header h2 { font-size: 18px; font-weight: 600; margin: 0; }

/* ---- Nav links ---- */
.nav-links { display: flex; gap: 20px; font-size: 13px; }
.nav-links a { color: var(--dim); text-decoration: none; }
.nav-links a:hover { color: var(--text); }
.nav-links a.active { color: var(--accent-2); font-weight: 600; }

/* ---- Page header ---- */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px 0;
}
.page-title { font-size: 24px; font-weight: 600; }
.page-sub { color: var(--dim); font-size: 14px; margin-top: 4px; }

/* ---- Header bar ---- */
header.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--hair);
  background: var(--bg-2);
}
.header-left { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), #6d40e2);
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700; color: #fff;
}
.brand-name { font-weight: 600; font-size: 15px; color: var(--text); }

/* ---- Responsive nav ---- */
@media (max-width: 768px) {
  header.app-header {
    flex-wrap: wrap;
    gap: 10px;
  }
  .nav-links {
    width: 100%;
    justify-content: center;
    gap: 12px;
  }
  .nav-links a {
    font-size: 12px;
  }
}

/* ---- Responsive padding adjustments ---- */
@media (max-width: 640px) {
  .stats-bar, .filter-section, .inbox-header { padding-left: 20px; padding-right: 20px; }
  .error-banner { margin-left: 20px; margin-right: 20px; }
  header.app-header { padding: 12px 16px; }
}
