/* ── Reset & base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f5f6f8;
  color: #333;
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Header ──────────────────────────────────────────────────── */
header {
  background: #1a1a2e;
  color: white;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-left { display: flex; align-items: baseline; gap: 10px; }
h1 { font-size: 1.2em; font-weight: 700; }
.subtitle { font-size: 0.85em; color: #8888aa; }
nav { display: flex; gap: 4px; margin-left: auto; }
.nav-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: #ccc;
  padding: 6px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85em;
  transition: all 0.2s;
}
.nav-btn:hover { background: rgba(255,255,255,0.1); color: white; }
.nav-btn.active { background: rgba(255,255,255,0.15); color: white; border-color: rgba(255,255,255,0.4); }
.header-right { font-size: 0.8em; color: #8888aa; }
#stats-badge { white-space: nowrap; }

/* ── Views ───────────────────────────────────────────────────── */
.view { display: none; padding: 20px 24px; max-width: 1100px; margin: 0 auto; }
.view.active { display: block; }

/* ── Search view ─────────────────────────────────────────────── */
.search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
#search-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.95em;
  outline: none;
  transition: border-color 0.2s;
}
#search-input:focus { border-color: #4a5aba; }
#search-btn, #semantic-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9em;
  font-weight: 600;
  transition: background 0.2s;
}
#search-btn { background: #4a5aba; color: white; }
#search-btn:hover { background: #3a4aaa; }
#semantic-btn { background: #e8e0f0; color: #6b4fa0; }
#semantic-btn:hover { background: #d8d0e0; }

/* ── Source toggle ────────────────────────────────────────────── */
.source-toggle {
  display: flex;
  gap: 0;
  margin-bottom: 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  width: fit-content;
}
.source-radio {
  cursor: pointer;
}
.source-radio input { display: none; }
.source-radio span {
  display: block;
  padding: 6px 16px;
  font-size: 0.85em;
  font-weight: 600;
  color: #666;
  background: white;
  border-right: 1px solid #ddd;
  transition: all 0.2s;
}
.source-radio:last-child span { border-right: none; }
.source-radio input:checked + span {
  background: #4a5aba;
  color: white;
}
.source-radio:hover span { background: #f0f0f0; }
.source-radio input:checked + span:hover { background: #3a4aaa; }

.filters {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.filters select {
  padding: 6px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.82em;
  background: white;
  cursor: pointer;
}
.filter-label {
  font-size: 0.82em;
  color: #666;
  align-self: center;
  margin-left: 8px;
}

#search-info {
  font-size: 0.85em;
  color: #888;
  margin-bottom: 12px;
}

/* ── Ticket cards ────────────────────────────────────────────── */
.ticket-card {
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  margin-bottom: 12px;
  padding: 16px 20px;
  cursor: pointer;
  transition: box-shadow 0.2s;
  border-left: 3px solid transparent;
}
.ticket-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.12); }
.ticket-card.resolved { border-left-color: #22c55e; }
.ticket-card.open { border-left-color: #f59e0b; }
.ticket-card.waiting { border-left-color: #8b5cf6; }
.ticket-card.archived { border-left-color: #9ca3af; opacity: 0.6; }
.badge-archived { background: #e5e7eb; color: #6b7280; }
.badge-sumit { background: #dbeafe; color: #1e40af; }
a.badge-sumit { text-decoration: none; }
a.badge-sumit:hover { background: #bfdbfe; }

.ticket-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.ticket-id { font-size: 0.82em; color: #888; font-weight: 600; }
.ticket-summary { font-weight: 600; flex: 1; font-size: 0.95em; }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.72em;
  font-weight: 600;
  white-space: nowrap;
}
.badge-resolved { background: #dcfce7; color: #166534; }
.badge-open { background: #fef9c3; color: #854d0e; }
.badge-waiting { background: #ede9fe; color: #5b21b6; }
.badge-default { background: #f3f4f6; color: #6b7280; }

.ticket-card-meta {
  display: flex;
  gap: 16px;
  font-size: 0.78em;
  color: #888;
  flex-wrap: wrap;
}
.ticket-card-meta span { display: flex; gap: 4px; }
.meta-label { font-weight: 600; }

.score-bar {
  display: inline-block;
  height: 4px;
  border-radius: 2px;
  background: #4a5aba;
  margin-left: 6px;
  vertical-align: middle;
}

/* ── Pagination ──────────────────────────────────────────────── */
#pagination {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-top: 20px;
}
.page-btn {
  padding: 6px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: white;
  cursor: pointer;
  font-size: 0.85em;
}
.page-btn:hover { background: #f0f0f0; }
.page-btn.active { background: #4a5aba; color: white; border-color: #4a5aba; }
.page-btn:disabled { opacity: 0.5; cursor: default; }

/* ── Ticket detail overlay ───────────────────────────────────── */
.detail-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
}
.detail-overlay.hidden { display: none; }
.detail-content {
  background: white;
  border-radius: 12px;
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 30px rgba(0,0,0,0.2);
  position: relative;
}
.detail-close {
  position: sticky;
  top: 12px;
  float: right;
  margin: 12px;
  background: #f3f4f6;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 16px;
  font-size: 1.2em;
  cursor: pointer;
  z-index: 10;
}
.detail-close:hover { background: #e5e7eb; }

.detail-header { padding: 20px 24px 12px; border-bottom: 1px solid #eee; }
.detail-header h2 { font-size: 1.1em; margin-bottom: 8px; }
.btn-archive {
  padding: 5px 14px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: white;
  cursor: pointer;
  font-size: 0.82em;
  transition: all 0.2s;
}
.btn-archive:hover { background: #f3f4f6; }
.btn-archive.archived { background: #e5e7eb; color: #6b7280; border-color: #9ca3af; }

/* ── Highlight passages ─────────────────────────────────────── */
.detail-content mark {
  background: linear-gradient(180deg, transparent 60%, rgba(250, 204, 21, 0.35) 60%);
  color: inherit;
  padding: 0 2px;
  border-radius: 0;
}
.highlight-banner {
  background: #fef9c3;
  color: #854d0e;
  padding: 10px 16px;
  border-radius: 8px;
  border-left: 4px solid #facc15;
  margin-bottom: 16px;
  font-size: 0.9em;
}
/* ── Ticket detail topbar ─────────────────────────────────── */
.detail-topbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0 14px;
  padding: 12px 16px;
  background: #f8f9fb;
  border-radius: 10px;
  border: 1px solid #e8eaef;
}
.detail-project {
  font-weight: 700;
  font-size: 0.95em;
  color: #fff;
  background: #4a5aba;
  padding: 4px 14px;
  border-radius: 6px;
  letter-spacing: 0.02em;
}
.detail-dates {
  display: flex;
  gap: 16px;
  margin-left: auto;
}
.detail-date {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85em;
  color: #555;
}
.detail-date .meta-label {
  font-weight: 600;
  color: #999;
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.date-day {
  font-weight: 700;
  color: #1a1a2e;
}
.date-time {
  color: #888;
  margin-left: 2px;
}
.detail-topbar .btn-archive {
  margin-left: 8px;
}
.btn-share {
  padding: 5px 14px;
  border: 1px solid #4a5aba;
  background: transparent;
  color: #4a5aba;
  border-radius: 6px;
  font-size: 0.85em;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-share:hover { background: #4a5aba; color: #fff; }

/* ── Ticket detail secondary meta ────────────────────────── */
.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  font-size: 0.82em;
  color: #666;
  padding: 0 4px;
}
.detail-meta .meta-item { display: flex; gap: 4px; }
.detail-meta .meta-label { font-weight: 600; color: #999; }

.detail-section { padding: 16px 24px; border-bottom: 1px solid #f0f0f0; }
.detail-section h3 { font-size: 0.9em; color: #888; margin-bottom: 8px; }
.detail-section .text { font-size: 0.9em; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }

.note-item { padding: 12px 0; border-bottom: 1px solid #f5f5f5; }
.note-item:last-child { border-bottom: none; }
.note-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 0.85em; }
.note-author { font-weight: 600; }
.note-date { color: #999; }
.role-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.7em;
  font-weight: 700;
}
.role-ga { background: #dbeafe; color: #1e40af; }
.role-dev { background: #fef3c7; color: #92400e; }
.note-text { font-size: 0.88em; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }

.att-item { margin-bottom: 6px; }
.att-item a { color: #4a5aba; text-decoration: none; font-size: 0.88em; }
.att-item a:hover { text-decoration: underline; }

/* ── Chat view ───────────────────────────────────────────────── */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 100px);
}
#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
}
.chat-welcome {
  text-align: center;
  padding: 60px 20px;
  color: #888;
}
.chat-welcome h2 { font-size: 1.3em; color: #333; margin-bottom: 8px; }
.chat-welcome p { margin-bottom: 20px; }
.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.suggestion {
  padding: 8px 16px;
  border: 1px solid #ddd;
  border-radius: 20px;
  background: white;
  cursor: pointer;
  font-size: 0.85em;
  transition: all 0.2s;
}
.suggestion:hover { border-color: #4a5aba; color: #4a5aba; }

.chat-msg {
  margin-bottom: 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.chat-msg.user { justify-content: flex-end; }
.chat-msg.user .chat-bubble { background: #4a5aba; color: white; }
.chat-bubble {
  background: white;
  border-radius: 12px;
  padding: 12px 16px;
  max-width: 80%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  font-size: 0.9em;
  line-height: 1.6;
}
.chat-bubble p { margin: 0 0 8px; }
.chat-bubble p:last-child { margin-bottom: 0; }
.chat-bubble strong { font-weight: 600; }
.chat-bubble .list-num { font-weight: 600; color: #4a5aba; margin-right: 2px; }
.chat-bubble .list-bullet { color: #4a5aba; margin-right: 4px; }
.chat-bubble a { color: #93c5fd; }
.chat-msg.assistant .chat-bubble a { color: #4a5aba; }
.chat-bubble .ticket-ref {
  display: inline-block;
  background: rgba(74,90,186,0.1);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.85em;
  cursor: pointer;
  color: #4a5aba;
}
.chat-bubble .ticket-ref:hover { background: rgba(74,90,186,0.2); }
.chat-sources {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(0,0,0,0.08);
  font-size: 0.8em;
  color: #888;
}
.chat-sources span { cursor: pointer; color: #4a5aba; }
.chat-sources span:hover { text-decoration: underline; }
.chat-loading {
  display: flex;
  gap: 4px;
  padding: 8px;
}
.chat-loading span {
  width: 8px; height: 8px; border-radius: 50%; background: #ccc;
  animation: bounce 1.4s infinite ease-in-out both;
}
.chat-loading span:nth-child(1) { animation-delay: -0.32s; }
.chat-loading span:nth-child(2) { animation-delay: -0.16s; }
@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

.chat-input-area {
  display: flex;
  gap: 8px;
  padding: 12px 0;
  border-top: 1px solid #eee;
}
#chat-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.95em;
  outline: none;
}
#chat-input:focus { border-color: #4a5aba; }
#chat-send {
  padding: 10px 20px;
  background: #4a5aba;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}
#chat-send:hover { background: #3a4aaa; }
#chat-send:disabled { opacity: 0.5; cursor: default; }

/* ── Knowledge view ──────────────────────────────────────────── */
.knowledge-loading { text-align: center; padding: 40px; color: #888; }

.knowledge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.knowledge-card {
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  cursor: pointer;
  transition: box-shadow 0.2s;
}
.knowledge-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.12); }
.knowledge-card h3 { font-size: 0.95em; margin-bottom: 8px; color: #1a1a2e; }
.knowledge-card p { font-size: 0.82em; color: #888; margin-bottom: 12px; line-height: 1.5; }
.knowledge-card .counts {
  display: flex;
  gap: 12px;
  font-size: 0.75em;
  color: #aaa;
}
.knowledge-card .counts span { display: flex; align-items: center; gap: 3px; }

.knowledge-detail { background: white; border-radius: 8px; padding: 24px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.knowledge-detail h2 { font-size: 1.1em; margin-bottom: 4px; }
.knowledge-detail .summary { font-size: 0.9em; color: #666; margin-bottom: 20px; line-height: 1.6; }
.knowledge-detail .back-btn {
  display: inline-block;
  margin-bottom: 16px;
  color: #4a5aba;
  cursor: pointer;
  font-size: 0.85em;
}
.knowledge-detail .back-btn:hover { text-decoration: underline; }

.knowledge-section { margin-bottom: 24px; }
.knowledge-section h3 { font-size: 0.9em; color: #4a5aba; margin-bottom: 10px; padding-bottom: 4px; border-bottom: 1px solid #eee; }

.rule-item, .procedure-item, .error-item, .evolution-item {
  padding: 10px 12px;
  margin-bottom: 8px;
  background: #f9fafb;
  border-radius: 6px;
  font-size: 0.88em;
  line-height: 1.5;
}
.rule-item .importance {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.72em;
  font-weight: 700;
  margin-left: 6px;
}
.importance-high { background: #fef2f2; color: #991b1b; }
.importance-medium { background: #fef9c3; color: #854d0e; }
.importance-low { background: #f0fdf4; color: #166534; }
.rule-item .details, .error-item .solution { color: #666; margin-top: 4px; }
.procedure-item .steps { padding-left: 20px; margin-top: 6px; }
.procedure-item .steps li { margin-bottom: 4px; }
.error-item strong { color: #991b1b; }
.evolution-item .period { font-weight: 600; color: #4a5aba; }
.source-tickets { font-size: 0.75em; color: #aaa; margin-top: 4px; }
.source-tickets span { cursor: pointer; color: #4a5aba; }

/* ── Login page ──────────────────────────────────────────────── */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #f5f6f8;
}
.login-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  text-align: center;
}
.login-card h1 { color: #1a1a2e; font-size: 1.5em; margin-bottom: 4px; }
.login-subtitle { color: #8888aa; font-size: 0.9em; margin-bottom: 28px; }
.login-card form { display: flex; flex-direction: column; gap: 12px; }
.login-card input {
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.95em;
  outline: none;
  transition: border-color 0.2s;
}
.login-card input:focus { border-color: #4a5aba; }
.login-card button {
  padding: 10px;
  background: #4a5aba;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.95em;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.login-card button:hover { background: #3a4aaa; }
.form-error { color: #dc2626; font-size: 0.85em; min-height: 1.2em; }
.invite-info { color: #666; font-size: 0.9em; margin-bottom: 4px; }

/* ── Logout button ──────────────────────────────────────────── */
.logout-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: #ccc;
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.78em;
  margin-left: 8px;
  transition: all 0.2s;
}
.logout-btn:hover { background: rgba(255,255,255,0.1); color: white; }
#user-info { font-size: 0.82em; color: #aaa; margin-left: 12px; }

/* ── Admin view ─────────────────────────────────────────────── */
#view-admin h2 { font-size: 1.1em; margin-bottom: 20px; }
.admin-section {
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  margin-bottom: 20px;
}
.admin-section h3 { font-size: 0.95em; color: #1a1a2e; margin-bottom: 12px; }
.admin-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.admin-form input, .admin-form select {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.88em;
  outline: none;
}
.admin-form input:focus { border-color: #4a5aba; }
.admin-form button {
  padding: 8px 16px;
  background: #4a5aba;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.88em;
  font-weight: 600;
  cursor: pointer;
}
.admin-form button:hover { background: #3a4aaa; }

.invite-link-box {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.invite-link-box input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.85em;
  background: #f9fafb;
}
.invite-link-box button {
  padding: 8px 16px;
  background: #22c55e;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.85em;
  cursor: pointer;
}
.invite-link-box button:hover { background: #16a34a; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85em;
}
.admin-table th {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 2px solid #eee;
  color: #888;
  font-weight: 600;
  font-size: 0.9em;
}
.admin-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #f0f0f0;
}
.admin-table tr.used { opacity: 0.5; }
.badge-role-admin { background: #fef2f2; color: #991b1b; }
.badge-role-team { background: #dbeafe; color: #1e40af; }
.badge-role-editor { background: #fef9c3; color: #854d0e; }
.btn-delete {
  background: transparent;
  border: 1px solid #fca5a5;
  color: #dc2626;
  padding: 3px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.82em;
}
.btn-delete:hover { background: #fef2f2; }
.invite-code-link {
  font-size: 0.78em;
  color: #4a5aba;
  cursor: pointer;
  word-break: break-all;
}
.invite-code-link:hover { text-decoration: underline; }

/* ── Chat feedback ──────────────────────────────────────────── */
.chat-feedback {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(0,0,0,0.06);
  flex-wrap: wrap;
}
.fb-btn {
  background: transparent;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 2px 10px;
  cursor: pointer;
  font-size: 0.85em;
  transition: all 0.2s;
}
.fb-btn:hover { background: #f3f4f6; }
.fb-comment-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 6px;
}
.fb-comment {
  width: 100%;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.85em;
  font-family: inherit;
  resize: vertical;
}
.fb-send {
  align-self: flex-end;
  padding: 4px 14px;
  background: #4a5aba;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.82em;
  cursor: pointer;
}
.fb-done { font-size: 0.82em; color: #888; font-style: italic; }

/* ── Admin feedback list ────────────────────────────────────── */
.feedback-item {
  padding: 12px;
  border-bottom: 1px solid #f0f0f0;
}
.feedback-item.not_useful { border-left: 3px solid #f59e0b; }
.feedback-item.useful { border-left: 3px solid #22c55e; }
.feedback-header {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
  font-size: 0.85em;
}
.feedback-user { font-weight: 600; }
.feedback-date { color: #999; }
.feedback-question { font-size: 0.88em; margin-bottom: 4px; }
.feedback-comment {
  font-size: 0.88em;
  background: #fef9c3;
  padding: 6px 10px;
  border-radius: 6px;
  margin-top: 4px;
}
.feedback-answer { font-size: 0.82em; color: #666; margin-top: 6px; }
.feedback-item details summary { font-size: 0.82em; color: #888; cursor: pointer; }

/* ── Utilities ───────────────────────────────────────────────── */
.empty { text-align: center; color: #999; padding: 40px; }
.hidden { display: none !important; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 700px) {
  header { flex-wrap: wrap; padding: 10px 16px; }
  nav { order: 3; width: 100%; }
  .view { padding: 12px 16px; }
  .search-bar { flex-wrap: wrap; }
  #search-input { min-width: 100%; }
  .filters { flex-direction: column; }
  .ticket-card-header { flex-wrap: wrap; }
  .detail-content { max-height: 95vh; }
  .knowledge-grid { grid-template-columns: 1fr; }
  .login-card { margin: 20px; }
  .admin-form { flex-direction: column; }
  .admin-form input, .admin-form select { width: 100%; }
}

/* ── Scroll arrows in ticket detail ──────────────────────────── */
.scroll-arrow {
  position: sticky;
  z-index: 10;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(57, 108, 198, 0.9);
  color: white;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  transition: opacity 0.2s;
}
.scroll-arrow:hover { background: rgba(45, 90, 170, 0.95); }
.scroll-arrow.hidden { display: none; }
.scroll-down { top: calc(100% - 48px); }
.scroll-up { top: 12px; }

/* ── Notification badge ──────────────────────────────────────── */
.notif-badge {
  background: #dc2626;
  color: white;
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 4px;
  vertical-align: middle;
}
.notif-badge.hidden { display: none; }
.notif-desc { color: #666; margin-bottom: 16px; font-size: 14px; }
#notif-list .ticket-card { cursor: pointer; }
#notif-empty { color: #999; text-align: center; padding: 40px; font-size: 15px; }

/* ── Filter checkboxes ───────────────────────────────────────── */
.filter-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.filter-check input { cursor: pointer; }

/* ── Follow button ───────────────────────────────────────────── */
.btn-follow {
  background: #eef3fb;
  color: #396cc6;
  border: 1px solid #396cc6;
  border-radius: 6px;
  padding: 4px 12px;
  cursor: pointer;
  font-size: 13px;
}
.btn-follow:hover { background: #dce6f5; }
.btn-follow.followed {
  background: #396cc6;
  color: white;
}

/* ── Undo toast ──────────────────────────────────────────────── */
.undo-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a2e;
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  z-index: 2000;
  font-size: 14px;
  animation: slideUp 0.3s ease;
}
@keyframes slideUp {
  from { transform: translateX(-50%) translateY(20px); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}
.undo-btn {
  background: transparent;
  color: #4fc3f7;
  border: 1px solid #4fc3f7;
  border-radius: 4px;
  padding: 4px 12px;
  cursor: pointer;
  font-size: 13px;
}
.undo-btn:hover { background: rgba(79,195,247,0.15); }

/* ── Sort direction button ───────────────────────────────────── */
.sort-dir-btn {
  background: white;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  vertical-align: middle;
}
.sort-dir-btn:hover { background: #eee; }

/* ── Sync button & modal ────────────────────────────────────── */
.sync-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.sync-btn:hover { background: rgba(255,255,255,0.1); }

.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal.hidden { display: none; }
.modal-content {
  background: white;
  border-radius: 12px;
  padding: 28px 32px;
  max-width: 480px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.modal-content h3 { margin-bottom: 12px; color: #1a1a2e; }
.modal-content p { margin-bottom: 12px; color: #555; font-size: 14px; }
.prompt-box {
  background: #1a1a2e;
  color: #4fc3f7;
  padding: 14px 18px;
  border-radius: 8px;
  font-family: monospace;
  font-size: 15px;
  margin-bottom: 20px;
  cursor: pointer;
  user-select: all;
}
.prompt-box:hover { background: #252545; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.btn-primary {
  background: #396cc6;
  color: white;
  border: none;
  padding: 8px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}
.btn-primary:hover { background: #2d5aaa; }
.btn-secondary {
  background: #e5e7eb;
  color: #333;
  border: none;
  padding: 8px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}
.btn-secondary:hover { background: #d1d5db; }
