/* ──────────────────────────────────────────────────────────────────────
   TicketDesk Dashboard — Phase 2a additions
   APPEND this file's contents to the END of the existing dashboard.css.
   (Or replace the marker section if you re-deploy.)
   ──────────────────────────────────────────────────────────────────── */

/* ── Tag Picker (multi-select with searchable dropdown) ──────────── */
.tag-picker {
  position: relative;
  width: 100%;
}
.tp-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 7px 8px;
  background: var(--bg-2);
  border: 1px solid var(--border-h);
  border-radius: 8px;
  min-height: 38px;
  align-items: center;
}
.tp-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px 3px 9px;
  background: var(--bg-3);
  border: 1px solid var(--border-h);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--t);
}
.tp-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--acc);
  flex-shrink: 0;
}
.tp-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--t-d);
  cursor: pointer;
  padding: 0;
}
.tp-x:hover {
  background: var(--red-dim);
  color: var(--red);
}
.tp-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  background: transparent;
  border: 1px dashed var(--border-h);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--t-m);
  cursor: pointer;
  transition: all .12s;
}
.tp-add:hover:not(:disabled) {
  border-color: var(--acc);
  color: var(--acc-l);
  background: var(--acc-dim);
}
.tp-add:disabled {
  opacity: .35;
  cursor: not-allowed;
}
.tp-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-2);
  border: 1px solid var(--border-h);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
  z-index: 60;
  padding: 6px;
  max-height: 280px;
  display: flex;
  flex-direction: column;
}
.tp-search {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  color: var(--t);
  font-family: inherit;
  margin-bottom: 6px;
  outline: none;
}
.tp-search:focus { border-color: var(--acc); }
.tp-list {
  overflow-y: auto;
  max-height: 220px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.tp-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: transparent;
  border: none;
  border-radius: 5px;
  font-size: 13px;
  color: var(--t);
  text-align: left;
  cursor: pointer;
  width: 100%;
  font-family: inherit;
}
.tp-opt:hover { background: var(--bg-3); }
.tp-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-desc {
  font-size: 11px;
  color: var(--t-d);
  margin-left: 6px;
}
.tp-empty {
  padding: 16px;
  text-align: center;
  color: var(--t-d);
  font-size: 12px;
}

/* ── Modal (used by TD.confirm) ──────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 20px;
  animation: overlayIn .15s ease-out;
}
@keyframes overlayIn { from { opacity: 0 } to { opacity: 1 } }
.modal {
  background: var(--bg-1);
  border: 1px solid var(--border-h);
  border-radius: 12px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  animation: modalIn .2s ease-out;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(8px) scale(.98) }
  to   { opacity: 1; transform: translateY(0) scale(1) }
}
.modal-header {
  padding: 18px 20px 8px;
}
.modal-header h3 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.005em;
}
.modal-body {
  padding: 4px 20px 18px;
  color: var(--t-m);
  font-size: 13.5px;
  line-height: 1.55;
}
.modal-footer {
  padding: 12px 20px 18px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ── Button — danger variant ─────────────────────────────────────── */
.btn-danger {
  background: var(--red);
  color: #fff;
  box-shadow: 0 1px 6px rgba(242,92,92,.25);
}
.btn-danger:hover {
  background: #ff7373;
  box-shadow: 0 2px 14px rgba(242,92,92,.35);
}
.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

/* ── Form controls ──────────────────────────────────────────────── */
.form-group {
  margin-bottom: 16px;
}
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--t);
}
.form-help {
  font-size: 11.5px;
  color: var(--t-m);
  margin-top: 4px;
  margin-bottom: 6px;
  line-height: 1.4;
}
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border-h);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--t);
  font-family: inherit;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.form-textarea {
  resize: vertical;
  min-height: 80px;
  font-family: var(--sans);
  line-height: 1.5;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--acc);
  box-shadow: 0 0 0 3px var(--acc-dim);
}
.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--t-d);
}

/* ── Card / panel ────────────────────────────────────────────────── */
.card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.card-title {
  font-size: 14px;
  font-weight: 600;
}
.card-section + .card-section {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

/* ── Badge ──────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 10.5px;
  font-weight: 600;
  font-family: var(--mono);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.badge-acc    { background: var(--acc-dim); color: var(--acc-l); }
.badge-green  { background: var(--green-dim); color: var(--green); }
.badge-amber  { background: var(--amber-dim); color: var(--amber); }
.badge-red    { background: var(--red-dim); color: var(--red); }
.badge-muted  { background: var(--bg-3); color: var(--t-d); }

/* ── Stat tile (for Overview) ────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.stat {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
}
.stat-label {
  font-size: 11px;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--t-d);
  margin-bottom: 8px;
}
.stat-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--t);
}
.stat-sub {
  font-size: 12px;
  color: var(--t-m);
  margin-top: 4px;
}

/* ── Table ──────────────────────────────────────────────────────── */
.tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.tbl th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--t-d);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  background: var(--bg-1);
}
.tbl td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.tbl tbody tr:hover {
  background: var(--bg-1);
}
.tbl tbody tr:last-child td {
  border-bottom: none;
}
.tbl-row-clickable {
  cursor: pointer;
}

/* ── User chip (for ticket lists, audit logs) ────────────────────── */
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
}
.user-chip-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-3);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}
.user-chip-name { font-weight: 500; }
.user-chip-id   { color: var(--t-d); font-family: var(--mono); font-size: 10.5px; }

/* ── Empty / loading inline ──────────────────────────────────────── */
.inline-loader {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--t-m);
  padding: 8px 0;
}
.inline-loader .spinner {
  width: 14px;
  height: 14px;
  border-width: 1.5px;
}

/* ── Code / monospace inline ────────────────────────────────────── */
code {
  font-family: var(--mono);
  font-size: 11.5px;
  background: var(--bg-3);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--t);
}

/* ── Section label (small uppercase header used inside pages) ───── */
.section-label {
  font-size: 11px;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--t-d);
  font-weight: 600;
  margin-bottom: 10px;
}
