@import url('https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:           #F4F6F9;
  --bg-card:      #FFFFFF;
  --border:       #E2E8F0;
  --border-light: #F1F5F9;

  --text-primary:   #0F172A;
  --text-secondary: #475569;
  --text-muted:     #94A3B8;

  --primary:       #1B3A6B;
  --primary-hover: #152D54;
  --primary-fg:    #FFFFFF;

  --accent:       #2563EB;
  --accent-hover: #1D4ED8;
  --accent-light: #EFF6FF;

  --danger:       #DC2626;
  --danger-hover: #B91C1C;
  --danger-bg:    #FEF2F2;

  --success:      #16A34A;
  --success-bg:   #F0FDF4;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.06),0 1px 2px rgba(0,0,0,.04);
  --shadow:    0 4px 6px -1px rgba(0,0,0,.07),0 2px 4px -1px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.08),0 4px 6px -2px rgba(0,0,0,.04);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,.10),0 10px 10px -5px rgba(0,0,0,.04);

  --radius:    8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
}

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── LAYOUT ─────────────────────────────────────────────────── */
.app-wrapper { min-height: 100vh; display: flex; flex-direction: column; }

.main-content {
  flex: 1;
  padding: 32px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

/* ── HEADER ─────────────────────────────────────────────────── */
.app-header {
  background: var(--primary);
  color: #fff;
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

.header-left  { display: flex; align-items: center; gap: 16px; }
.header-right { display: flex; align-items: center; gap: 12px; }

.logo { display: flex; align-items: center; text-decoration: none; color: #fff; }

.header-page-title { font-size: 16px; font-weight: 700; letter-spacing: -.3px; }

.user-info    { display: flex; flex-direction: column; align-items: flex-end; }
.user-name    { font-size: 13px; font-weight: 600; line-height: 1.2; }
.user-uid     { font-size: 11px; opacity: .6; font-variant-numeric: tabular-nums; }

.header-avatar {
  width: 36px; height: 36px;
  background: rgba(255,255,255,.15);
  border: 1.5px solid rgba(255,255,255,.25);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}

.btn-icon {
  width: 36px; height: 36px;
  border-radius: 50%; border: none;
  background: rgba(255,255,255,.1);
  color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  transition: background .15s;
  position: relative;
}
.btn-icon:hover { background: rgba(255,255,255,.18); }

.notif-dot {
  position: absolute; top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: #F59E0B;
  border-radius: 50%;
  border: 1.5px solid var(--primary);
}

.btn-logout {
  padding: 7px 16px;
  border-radius: 6px;
  border: 1.5px solid rgba(255,255,255,.3);
  background: transparent; color: #fff;
  font-size: 13px; font-weight: 500;
  cursor: pointer; font-family: inherit;
  transition: all .15s;
}
.btn-logout:hover { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.5); }

/* ── CARDS ──────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between;
}

.card-title    { font-size: 15px; font-weight: 600; letter-spacing: -.2px; }
.card-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.card-body     { padding: 24px; }

/* ── STAT CARDS ─────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  border-left: 3px solid transparent;
}

.stat-label {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .5px;
  color: var(--text-muted); margin-bottom: 8px;
}

.stat-value {
  font-size: 30px; font-weight: 700;
  color: var(--text-primary);
  line-height: 1; letter-spacing: -1.5px;
  margin-bottom: 4px;
}

.stat-desc { font-size: 12px; color: var(--text-muted); }

.stat-amber  { border-left-color: #F59E0B; }
.stat-blue   { border-left-color: var(--accent); }
.stat-red    { border-left-color: var(--danger); }
.stat-green  { border-left-color: var(--success); }
.stat-purple { border-left-color: #7C3AED; }

/* ── BUTTONS ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px; font-weight: 500;
  cursor: pointer; border: none;
  font-family: inherit;
  transition: all .15s;
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary   { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary { background: var(--bg); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border-light); }

.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }

.btn-success   { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803D; }

.btn-ghost     { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg); }

.btn-dark      { background: var(--primary); color: #fff; }
.btn-dark:hover { background: var(--primary-hover); }

.btn-sm   { padding: 6px 12px; font-size: 12px; }
.btn-lg   { padding: 11px 24px; font-size: 14px; border-radius: var(--radius-lg); }
.btn-full { width: 100%; justify-content: center; }

/* ── FORM ───────────────────────────────────────────────────── */
.form-group   { margin-bottom: 20px; }

.form-label {
  display: block;
  font-size: 13px; font-weight: 500;
  color: var(--text-primary); margin-bottom: 6px;
}

.form-input, .form-textarea, .form-select {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px; font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-card);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,.10);
}

.form-textarea { resize: vertical; min-height: 140px; line-height: 1.65; }

.input-wrapper { position: relative; }

.input-suffix {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  cursor: pointer; color: var(--text-muted);
  font-size: 16px; user-select: none;
  background: none; border: none; padding: 2px;
}

/* ── FORM UTILITIES ─────────────────────────────────────────── */
.req  { color: var(--danger); }

.form-error {
  color: var(--danger); font-size: 12px;
  margin-top: 4px; display: none;
}

.mb-0 { margin-bottom: 0; }

.form-input.has-suffix { padding-right: 42px; }

.card-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  background: var(--bg);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  display: flex; justify-content: flex-end;
}

/* ── TABLES ─────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }

thead th {
  text-align: left; padding: 10px 16px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .5px;
  color: var(--text-muted);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody tr { border-bottom: 1px solid var(--border-light); transition: background .1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #F8FAFC; }

tbody td { padding: 14px 16px; color: var(--text-primary); vertical-align: middle; }

.td-id      { font-weight: 600; font-size: 12px; color: var(--primary); letter-spacing: .3px; }
.td-muted   { color: var(--text-secondary); }
.td-mono    { font-variant-numeric: tabular-nums; font-size: 12px; color: var(--text-secondary); }
.td-truncate { max-width: 240px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── BADGES ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px; font-weight: 600;
  white-space: nowrap; letter-spacing: .2px;
}

.badge-amber  { background: #FEF3C7; color: #92400E; }
.badge-red    { background: #FEE2E2; color: #991B1B; }
.badge-blue   { background: #DBEAFE; color: #1E40AF; }
.badge-purple { background: #EDE9FE; color: #5B21B6; }
.badge-green  { background: #DCFCE7; color: #15803D; }
.badge-gray   { background: #F1F5F9; color: #475569; }

/* ── MODALS ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.52);
  backdrop-filter: blur(3px);
  z-index: 1000;
  display: none;
  align-items: center; justify-content: center;
  padding: 24px;
  overflow-y: auto;
}

.modal-overlay.active { display: flex; }

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%; max-width: 640px;
  max-height: 90vh;
  display: flex; flex-direction: column;
  position: relative;
  overflow: hidden;
  animation: modalIn .2s cubic-bezier(.16,1,.3,1);
}

.modal-lg { max-width: 720px; }

.modal-sm { max-width: 420px; }

@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-shrink: 0;
}

.modal-title   { font-size: 16px; font-weight: 600; letter-spacing: -.3px; }
.modal-sub     { font-size: 12px; color: var(--text-muted); margin-top: 2px; font-variant-numeric: tabular-nums; }

.modal-close {
  width: 32px; height: 32px;
  border-radius: 6px; border: none;
  background: var(--bg); color: var(--text-secondary);
  cursor: pointer; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background .15s;
}
.modal-close:hover { background: var(--border); }

.modal-body {
  padding: 24px;
  overflow-y: auto; flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: flex-end;
  gap: 10px; flex-shrink: 0;
  background: var(--bg);
}

/* ── MODAL DETAIL ROWS ──────────────────────────────────────── */
.detail-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 16px; margin-bottom: 20px;
}

.detail-row  { display: flex; flex-direction: column; gap: 4px; }

.detail-label {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .5px;
  color: var(--text-muted);
}

.detail-value {
  font-size: 14px; color: var(--text-primary);
  font-weight: 500;
}

.detail-value.mono {
  font-variant-numeric: tabular-nums;
  font-size: 13px; color: var(--primary);
  font-weight: 700; letter-spacing: .3px;
}

.detail-section {
  padding: 16px;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  margin-bottom: 16px;
}

.detail-section-title {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .5px;
  color: var(--text-muted); margin-bottom: 8px;
}

.description-text { font-size: 14px; color: var(--text-primary); line-height: 1.65; }

/* ── ATTACHMENTS ────────────────────────────────────────────── */
.attachment-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
}

.attachment-icon {
  width: 32px; height: 32px;
  background: #EFF6FF; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 14px;
}

.attachment-name { font-size: 13px; font-weight: 500; flex: 1; }

.attachment-remove {
  color: var(--text-muted); cursor: pointer; font-size: 16px;
  border: none; background: none; padding: 2px;
  transition: color .15s; line-height: 1;
}
.attachment-remove:hover { color: var(--danger); }

.no-attachments { font-size: 13px; color: var(--text-muted); font-style: italic; }

/* ── DROPZONE ───────────────────────────────────────────────── */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 24px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: var(--bg);
  margin-bottom: 12px;
}

.dropzone:hover, .dropzone.drag-over {
  border-color: var(--accent);
  background: var(--accent-light);
}

.dropzone-icon { font-size: 36px; margin-bottom: 10px; display: block; }
.dropzone-text { font-size: 14px; color: var(--text-secondary); margin-bottom: 4px; }
.dropzone-hint { font-size: 12px; color: var(--text-muted); }
.dropzone-link { color: var(--accent); font-weight: 500; cursor: pointer; }

/* ── CONFIRM MODAL BODY ─────────────────────────────────────── */
.confirm-body { padding: 28px; }

.confirm-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; margin-bottom: 18px;
}

.confirm-icon.warn    { background: #FEF3C7; }
.confirm-icon.danger  { background: #FEE2E2; }
.confirm-icon.success { background: #DCFCE7; }

.confirm-title { font-size: 17px; font-weight: 700; margin-bottom: 8px; letter-spacing: -.3px; }
.confirm-msg   { font-size: 14px; color: var(--text-secondary); line-height: 1.6; }

/* ── TOAST ──────────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px;
  background: #0F172A; color: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  font-size: 13px; font-weight: 500;
  opacity: 0; transform: translateY(8px);
  transition: all .3s cubic-bezier(.16,1,.3,1);
  max-width: 360px;
  pointer-events: auto;
}

.toast.show { opacity: 1; transform: translateY(0); }
.toast-success .toast-icon { color: #4ADE80; }
.toast-error   .toast-icon { color: #F87171; }
.toast-info    .toast-icon { color: #60A5FA; }
.toast-icon { font-size: 16px; flex-shrink: 0; }

/* ── EMPTY STATE ────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 64px 32px;
  color: var(--text-muted);
}

.empty-icon  { font-size: 40px; margin-bottom: 16px; display: block; }
.empty-title { font-size: 15px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.empty-desc  { font-size: 13px; }

/* ── ACCESS DENIED ──────────────────────────────────────────── */
.denied-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 32px;
}

.denied-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 56px 48px;
  max-width: 440px; width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.denied-icon  { font-size: 52px; margin-bottom: 20px; display: block; }
.denied-title { font-size: 22px; font-weight: 700; margin-bottom: 10px; letter-spacing: -.5px; }
.denied-msg   { font-size: 14px; color: var(--text-secondary); line-height: 1.65; margin-bottom: 28px; }

/* ── LOGIN PAGE ─────────────────────────────────────────────── */
.login-error {
  color: var(--danger); font-size: 13px;
  padding: 10px 14px;
  background: var(--danger-bg);
  border: 1px solid #FCA5A5;
  border-radius: var(--radius);
  margin-bottom: 16px; display: none;
}

.login-error.show { display: block; }

/* ── PAGE SECTIONS ──────────────────────────────────────────── */
.page-section { margin-bottom: 28px; }

.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}

.section-title { font-size: 16px; font-weight: 600; letter-spacing: -.2px; }
.section-sub   { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ── DIVIDER ────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border-light); margin: 20px 0; }

/* ── DEVELOPER UNASSIGNED CHIP ──────────────────────────────── */
.unassigned-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-muted);
  font-style: italic;
}

/* ── ASSIGNED INFO BLOCK ────────────────────────────────────── */
.assigned-block {
  background: var(--accent-light);
  border: 1px solid #BFDBFE;
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px;
}

.assigned-block-icon { font-size: 22px; flex-shrink: 0; }

.assigned-block-text .label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--accent); margin-bottom: 2px; }
.assigned-block-text .value { font-size: 14px; font-weight: 700; color: var(--primary); }

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .stats-grid       { grid-template-columns: repeat(2,1fr); }
  .main-content     { padding: 24px 20px; }
}

@media (max-width: 768px) {
  .detail-grid      { grid-template-columns: 1fr; }
  .app-header       { padding: 0 20px; }
  .user-uid { display: none; }
}

@media (max-width: 480px) {
  .stats-grid       { grid-template-columns: 1fr; }
}

/* ── CHAT WIDGET (floating, Messenger-style) ────────────────── */
.chat-fab {
  position: fixed; right: 24px; bottom: 24px; z-index: 70;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--primary); color: #fff; border: none;
  font-size: 22px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 18px rgba(15,23,42,.3);
  transition: transform .15s;
}
.chat-fab:hover { transform: scale(1.06); }

.chat-fab-badge {
  position: absolute; top: -3px; right: -3px;
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700;
  min-width: 20px; height: 20px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 5px; border: 2px solid #fff;
}

.chat-panel {
  position: fixed; right: 24px; bottom: 88px; z-index: 70;
  width: 360px; height: 480px; max-height: calc(100vh - 120px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 14px 40px rgba(15,23,42,.22);
  display: flex; flex-direction: column; overflow: hidden;
}

.chat-panel-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  background: var(--primary); color: #fff;
}
.chat-panel-title { flex: 1; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-back, .chat-close {
  background: none; border: none; color: #fff;
  font-size: 15px; cursor: pointer; padding: 2px 6px; opacity: .8;
}
.chat-back:hover, .chat-close:hover { opacity: 1; }

.chat-panel-body {
  flex: 1; overflow-y: auto;
  background: var(--bg);
  padding: 10px;
  display: flex; flex-direction: column; gap: 8px;
}

.chat-input-row {
  display: flex; gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}
.chat-input-row .form-input { min-height: 0; padding: 8px 12px; font-size: 13px; }

.chat-attach {
  background: none; border: none; cursor: pointer;
  font-size: 17px; padding: 0 4px; color: var(--text-secondary);
}
.chat-attach:hover:not(:disabled) { color: var(--text-primary); }
.chat-attach:disabled { opacity: .4; cursor: default; }

.chat-pending {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.chat-pending-img {
  width: 36px; height: 36px; object-fit: cover;
  border-radius: 6px; border: 1px solid var(--border);
}
.chat-pending-name {
  flex: 1; font-size: 12px; color: var(--text-secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-pending-x {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 13px; padding: 2px 6px;
}
.chat-pending-x:hover { color: var(--danger); }

.bubble-img {
  display: block; max-width: 220px; max-height: 220px;
  border-radius: 8px; cursor: zoom-in;
  margin-bottom: 4px;
}
.bubble .bubble-img:last-of-type { margin-bottom: 0; }

.chat-contact {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 12px 16px;
  background: none; border: none; border-bottom: 1px solid var(--border-light);
  cursor: pointer; text-align: left; font-family: inherit;
  transition: background .12s;
}
.chat-contact:hover  { background: var(--bg); }
.chat-contact.active { background: var(--accent-light); }

.chat-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}

.chat-contact-info { flex: 1; min-width: 0; }
.chat-contact-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-contact-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; display: flex; gap: 4px; align-items: center; }

.chat-unread {
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 5px;
}

.chat-none { padding: 24px 16px; font-size: 13px; color: var(--text-muted); text-align: center; }

.bubble-row { display: flex; }
.bubble-row.mine { justify-content: flex-end; }

.bubble {
  max-width: 70%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px; line-height: 1.5;
}

.bubble-them {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.bubble-me {
  background: var(--primary); color: #fff;
  border-bottom-right-radius: 4px;
}

.bubble-text { white-space: pre-wrap; word-break: break-word; }
.bubble-time { font-size: 10px; opacity: .6; margin-top: 4px; }
.bubble-me .bubble-time { text-align: right; }

/* ── SCROLLBAR ──────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── UTILS ──────────────────────────────────────────────────── */
.badge-teal { background: #CCFBF1; color: #0F766E; }

.assign-cell { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.assign-cell .form-select { min-height: 0; padding: 6px 10px; font-size: 13px; width: auto; min-width: 100px; }
.assign-cell .form-input  { min-height: 0; padding: 6px 10px; font-size: 13px; width: auto; min-width: 140px; }
.assign-cell .dl-input    { min-width: 0; width: 90px; }

/* ── ATTACHMENT IMAGE PREVIEW + LIGHTBOX ────────────────────── */
.attachment-thumb {
  width: 52px; height: 52px; object-fit: cover;
  border-radius: 8px; flex-shrink: 0; border: 1px solid var(--border);
}
.attachment-image { cursor: zoom-in; }
.attachment-image:hover .attachment-name { text-decoration: underline; }

.img-viewer {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(2, 6, 23, .88);
  display: flex; align-items: center; justify-content: center;
  cursor: zoom-out; padding: 40px;
}
.img-viewer img {
  max-width: 92vw; max-height: 86vh;
  border-radius: 10px; box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.img-viewer-close {
  position: absolute; top: 18px; right: 26px;
  color: #fff; font-size: 26px; cursor: pointer; opacity: .8;
}
.img-viewer-close:hover { opacity: 1; }
.img-viewer-cap {
  position: absolute; bottom: 18px; left: 0; right: 0;
  text-align: center; color: rgba(255,255,255,.75); font-size: 13px;
}

.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-sm    { font-size: 13px; }
.font-semibold { font-weight: 600; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.flex  { display: flex; }
.items-center { align-items: center; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }

/* ── BOT — ticketing robot mascot (pure CSS) ──────────────────
   180x230 container; every part is its own element. */
.bot {
  position: relative;
  width: 180px;
  height: 230px;
  margin: -4px auto 4px;
  animation: bot-hover 3.6s ease-in-out infinite;
}

/* antenna — glowing tip pulses */
.bot-antenna {
  position: absolute; top: 2px; left: 50%;
  transform: translateX(-50%);
  width: 4px; height: 18px;
  background: var(--primary);
  border-radius: 3px;
}
.bot-antenna i {
  position: absolute; top: -9px; left: 50%;
  transform: translateX(-50%);
  width: 14px; height: 14px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 8px 2px rgba(37,99,235,.45);
  animation: bot-pulse 1.1s ease-in-out infinite;
}

/* head — navy shell, pale face screen */
.bot-head {
  position: absolute; top: 26px; left: 50%;
  transform: translateX(-50%);
  width: 108px; height: 76px;
  background: linear-gradient(160deg, #EFF6FF 0 62%, #DBEAFE 62% 100%);
  border: 4px solid var(--primary);
  border-radius: 26px;
  z-index: 3;
  box-shadow: inset 0 -6px 0 rgba(27,58,107,.08);
}

.bot-eye {
  position: absolute; top: 24px;
  width: 13px; height: 19px;
  background: var(--primary);
  border-radius: 8px;
}
.bot-eye.left  { left: 27px; }
.bot-eye.right { right: 27px; }
.bot-eye i {                          /* glint */
  position: absolute; top: 3px; left: 3px;
  width: 4px; height: 4px;
  background: #fff; border-radius: 50%;
}
.bot-eye {
  transform-origin: center;
  animation: bot-blink 4.2s ease-in-out infinite;
}

.bot-smile {
  position: absolute; bottom: 12px; left: 50%;
  transform: translateX(-50%);
  width: 26px; height: 12px;
  border: 3px solid var(--primary);
  border-top: none;
  border-left-color: transparent;
  border-right-color: transparent;
  border-radius: 0 0 20px 20px;
}

/* body — navy chassis with a chest ticket */
.bot-body {
  position: absolute; top: 106px; left: 50%;
  transform: translateX(-50%);
  width: 92px; height: 74px;
  background: var(--primary);
  border-radius: 24px 24px 18px 18px;
  z-index: 2;
  box-shadow: inset 0 -8px 0 rgba(0,0,0,.18);
}

/* the ticket badge on the chest */
.bot-ticket {
  position: absolute; top: 24px; left: 50%;
  transform: translateX(-50%) rotate(-6deg);
  width: 48px; height: 26px;
  background: #fff;
  border-radius: 5px;
}
.bot-ticket::before,
.bot-ticket::after {                   /* perforation notches */
  content: '';
  position: absolute; top: 50%;
  width: 10px; height: 10px;
  background: var(--primary);
  border-radius: 50%;
  transform: translateY(-50%);
}
.bot-ticket::before { left: -5px; }
.bot-ticket::after  { right: -5px; }

/* arms — capsule with mitt; the right one waves */
.bot-arm {
  position: absolute; top: 116px;
  width: 17px; height: 50px;
  background: var(--primary);
  border-radius: 10px;
  transform-origin: 50% 8px;
  z-index: 2;
}
.bot-arm::after {                      /* hand */
  content: '';
  position: absolute; bottom: -7px; left: 50%;
  transform: translateX(-50%);
  width: 20px; height: 20px;
  background: var(--accent);
  border-radius: 50%;
}
.bot-arm.left  { left: 28px; transform: rotate(16deg); }
.bot-arm.right { right: 28px; transform: rotate(-16deg);
                 animation: bot-wave 2.4s ease-in-out infinite; }

/* legs + feet */
.bot-leg {
  position: absolute; top: 176px;
  width: 20px; height: 30px;
  background: var(--primary);
  border-radius: 0 0 8px 8px;
  z-index: 1;
}
.bot-leg::after {                      /* foot */
  content: '';
  position: absolute; bottom: -6px; left: 50%;
  transform: translateX(-50%);
  width: 30px; height: 12px;
  background: var(--accent);
  border-radius: 8px;
}
.bot-leg.left  { left: 66px; }
.bot-leg.right { right: 66px; }

/* ground shadow */
.bot-shadow {
  position: absolute; bottom: 4px; left: 50%;
  transform: translateX(-50%);
  width: 92px; height: 12px;
  background: rgba(15,23,42,.13);
  border-radius: 50%;
}

/* ── animations ── */
@keyframes bot-wave {
  0%, 100% { transform: rotate(-16deg); }
  15%      { transform: rotate(-140deg); }   /* arm up */
  30%      { transform: rotate(-112deg); }
  45%      { transform: rotate(-145deg); }
  60%      { transform: rotate(-115deg); }
  75%      { transform: rotate(-140deg); }
}

@keyframes bot-blink {
  0%, 91%, 100% { transform: scaleY(1); }
  95%           { transform: scaleY(.12); }
}

@keyframes bot-pulse {
  0%, 45%   { background: var(--accent);
              box-shadow: 0 0 12px 4px rgba(37,99,235,.7); }
  50%, 95%  { background: #EF4444;
              box-shadow: 0 0 12px 4px rgba(239,68,68,.7); }
  100%      { background: var(--accent);
              box-shadow: 0 0 12px 4px rgba(37,99,235,.7); }
}

@keyframes bot-hover {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-5px); }
}

/* ── TOUR — first-login robot guide ─────────────────────────── */
.tour-wrap {
  position: fixed; left: 18px; bottom: 18px;
  display: flex; align-items: flex-end; gap: 12px;
  z-index: 950;
}
.tour-bot { width: 92px; flex: none; }
.tour-bot .bot { transform: scale(.5); transform-origin: bottom left; margin: 0; }

.tour-bubble {
  position: relative;
  width: 300px;
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 14px;
  padding: 13px 15px;
  box-shadow: 0 12px 32px rgba(15,23,42,.18);
}
.tour-bubble::before {              /* tail pointing at the bot */
  content: '';
  position: absolute; left: -7px; bottom: 24px;
  width: 14px; height: 14px;
  background: #fff;
  border-left: 1px solid #E5E7EB;
  border-bottom: 1px solid #E5E7EB;
  transform: rotate(45deg);
}
.tour-title { font-weight: 700; font-size: 13px; color: var(--primary); margin-bottom: 3px; }
.tour-text  { font-size: 13px; line-height: 1.5; color: #475569; }

.tour-nav { display: flex; align-items: center; gap: 8px; margin-top: 11px; }
.tour-count { font-size: 11px; color: #94A3B8; margin-right: auto; }
.tour-nav button {
  padding: 6px 12px; border-radius: 8px;
  border: 1px solid #E2E8F0; background: #fff;
  font-size: 12px; font-weight: 600; color: #334155;
  cursor: pointer;
}
.tour-nav button.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.tour-nav button.ghost { border: none; color: #94A3B8; }

/* highlight ring on the element being explained */
.tour-hl {
  outline: 3px solid var(--accent) !important;
  outline-offset: 3px;
  border-radius: 10px;
}

/* tour extra life — hop + confetti + typewriter cursor */
.tour-hop { animation: tour-hop .45s ease; }
@keyframes tour-hop {
  0%, 100% { transform: translateY(0) scale(.5); }
  40%      { transform: translateY(-14px) scale(.5); }
  70%      { transform: translateY(-4px) scale(.5); }
}
.confetti {
  position: absolute; bottom: 70px;
  width: 8px; height: 8px; border-radius: 2px;
  pointer-events: none;
  animation: confetti-pop 1.3s ease-out forwards;
}
@keyframes confetti-pop {
  0%   { transform: translate(0, 0) rotate(0); opacity: 1; }
  100% { transform: translate(var(--dx), -130px) rotate(540deg); opacity: 0; }
}
.tour-text { cursor: pointer; min-height: 40px; }
