/* ── Reset & Variables ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #0095d5;
  --primary-dark: #007ab5;
  --primary-light: #0fa9e1;
  --primary-lighter: #41b8ea;
  --primary-bg: #eff6ff;
  --white: #ffffff;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-400: #94a3b8;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --green: #22c55e;
  --green-bg: #f0fdf4;
  --green-dark: #166534;
  --yellow: #f59e0b;
  --yellow-bg: #fef3c7;
  --yellow-dark: #92400e;
  --red: #ef4444;
  --red-bg: #fef2f2;
  --purple: #8b5cf6;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 20px rgba(0,0,0,0.08);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--gray-50);
  color: var(--gray-700);
  line-height: 1.6;
  min-height: 100vh;
}

/* Accessibility helpers */
.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.skip-link:focus {
  left: 12px;
  top: 12px;
  width: auto;
  height: auto;
  padding: 8px 12px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  z-index: 1200;
  border-radius: 6px;
}
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

:focus {
  outline: none;
}
:focus-visible {
  outline: 3px solid rgba(0,149,213,0.18);
  outline-offset: 2px;
}

/* ── Typography ────────────────────────────────────────────────────── */
h1 { font-size: 1.75rem; font-weight: 700; color: var(--gray-800); }
h2 { font-size: 1.25rem; font-weight: 700; color: var(--gray-800); }
h3 { font-size: 1.05rem; font-weight: 600; color: var(--gray-800); }
p { color: var(--gray-600); }

/* ── Layout ────────────────────────────────────────────────────────── */
.container { max-width: 860px; margin: 0 auto; padding: 0 20px; }

/* ── Header ────────────────────────────────────────────────────────── */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.site-header .container {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-link { display: block; text-decoration: none; }

.logo-svg {
  height: 40px;
  width: auto;
  display: block;
}

.header-subtitle {
  font-size: 13px;
  color: var(--gray-400);
  border-left: 2px solid var(--gray-200);
  padding-left: 16px;
  margin-left: 4px;
}

/* ── Main Content ──────────────────────────────────────────────────── */
.main-content { padding: 40px 0 60px; }

/* ── Tab Navigation ────────────────────────────────────────────────── */
.tab-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  background: var(--white);
  padding: 6px;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  padding: 10px 20px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-600);
  cursor: pointer;
  transition: all 0.2s;
  justify-content: center;
}

.tab-btn svg { width: 16px; height: 16px; }

.tab-btn.active {
  background: var(--primary);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(0, 149, 213, 0.3);
}

.tab-btn:not(.active):hover { background: var(--gray-100); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Cards ─────────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.form-card .card-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  padding: 28px 32px;
  color: var(--white);
}

.form-card .card-header h2 { color: var(--white); font-size: 1.35rem; margin-bottom: 4px; }
.form-card .card-header p { color: rgba(255,255,255,0.85); font-size: 14px; }

/* ── Forms ─────────────────────────────────────────────────────────── */
.ticket-form, .track-form { padding: 28px 32px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}

label {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
}

input, select, textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--gray-800);
  background: var(--white);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  font-family: inherit;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 149, 213, 0.12);
}

input.error, select.error, textarea.error {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.field-error { font-size: 12px; color: var(--red); min-height: 16px; }

textarea { resize: vertical; min-height: 120px; }

select { cursor: pointer; }

.input-row { display: flex; gap: 10px; }
.input-row input { flex: 1; }

/* ── Buttons ────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
  font-family: inherit;
}

.btn svg { width: 15px; height: 15px; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: var(--white);
  box-shadow: 0 2px 8px rgba(0, 149, 213, 0.25);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  box-shadow: 0 4px 12px rgba(0, 149, 213, 0.35);
  transform: translateY(-1px);
}

.btn-outline {
  background: var(--white);
  color: var(--primary);
  border: 1.5px solid var(--primary);
}

.btn-outline:hover { background: var(--primary-bg); }

.btn-ghost {
  background: transparent;
  color: var(--gray-600);
  border: 1.5px solid var(--gray-200);
}

.btn-ghost:hover { background: var(--gray-100); }

.btn-danger { background: var(--red); color: var(--white); }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-lg { padding: 13px 28px; font-size: 15px; }

/* ── Dropzone & File Attachments ────────────────────────────────────── */
.dropzone {
  border: 2px dashed var(--gray-200);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--gray-50);
}

.dropzone:hover, .dropzone.drag-over {
  border-color: var(--primary);
  background: var(--primary-bg);
}

.dropzone svg { width: 36px; height: 36px; color: var(--gray-400); margin-bottom: 10px; }
.dropzone p { font-size: 14px; font-weight: 600; color: var(--gray-600); margin-bottom: 4px; }
.dropzone span { font-size: 12px; color: var(--gray-400); }

.file-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.file-card {
  position: relative;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--white);
  width: 110px;
}

.file-card img {
  width: 110px;
  height: 80px;
  object-fit: cover;
  display: block;
}

.file-card-icon {
  width: 110px;
  height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--gray-50);
  gap: 4px;
}

.file-card-icon svg { width: 28px; height: 28px; color: var(--primary); }
.file-card-icon span { font-size: 10px; font-weight: 700; color: var(--gray-600); text-transform: uppercase; }

.file-card-name {
  font-size: 11px;
  color: var(--gray-600);
  padding: 4px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-top: 1px solid var(--gray-100);
}

.file-card-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  border: none;
  color: white;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.file-card-remove:hover { background: var(--red); }

/* Attachments display in ticket/admin */
.attachments-section { margin-top: 16px; }
.attachments-section h4 { font-size: 13px; color: var(--gray-600); margin-bottom: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }

.attachments-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.attachment-item {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--white);
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.2s;
  display: block;
}

.attachment-item:hover { box-shadow: var(--shadow-sm); border-color: var(--primary); }

.attachment-item img {
  width: 120px;
  height: 90px;
  object-fit: cover;
  display: block;
}

.attachment-item-file {
  width: 120px;
  height: 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--gray-50);
  gap: 6px;
}

.attachment-item-file svg { width: 30px; height: 30px; color: var(--primary); }
.attachment-item-file span { font-size: 11px; font-weight: 700; color: var(--gray-500); text-transform: uppercase; }

.attachment-item-name {
  font-size: 11px;
  color: var(--gray-600);
  padding: 5px 7px;
  border-top: 1px solid var(--gray-100);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

/* ── FAQ Suggestions ────────────────────────────────────────────────── */
.faq-suggestions {
  background: var(--primary-bg);
  border: 1.5px solid #bfdbfe;
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 20px;
}

.faq-suggestions-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 12px;
}

.faq-suggestions-header svg { width: 16px; height: 16px; }

.faq-list { display: flex; flex-direction: column; gap: 8px; }

.faq-item {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  cursor: pointer;
  transition: all 0.2s;
}

.faq-item:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(0,149,213,0.1); }

.faq-item-question {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 4px;
}

.faq-item-category {
  font-size: 11px;
  color: var(--primary);
  background: var(--primary-bg);
  padding: 2px 8px;
  border-radius: 20px;
  display: inline-block;
}

/* ── Spinner ────────────────────────────────────────────────────────── */
.spin {
  animation: spin 0.8s linear infinite;
  width: 18px;
  height: 18px;
}

@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ── Modal ──────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  backdrop-filter: blur(3px);
}

.modal {
  background: var(--white);
  border-radius: 16px;
  padding: 40px;
  max-width: 480px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  animation: modalIn 0.25s ease;
}

.modal-faq { text-align: left; max-width: 560px; }
.modal-faq h3 { margin-bottom: 16px; }

@keyframes modalIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

.modal-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.modal-icon.success { background: var(--green-bg); color: var(--green); }
.modal-icon.info { background: var(--primary-bg); color: var(--primary); }
.modal-icon svg { width: 28px; height: 28px; }

.modal h3 { font-size: 1.3rem; margin-bottom: 10px; }
.modal p { font-size: 14px; color: var(--gray-600); margin-bottom: 12px; }

.ticket-number-display {
  background: var(--primary-bg);
  border: 2px solid #bfdbfe;
  border-radius: var(--radius-sm);
  padding: 16px;
  margin: 16px 0;
  font-size: 24px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 2px;
}

.modal-hint { font-size: 12px; color: var(--gray-400); margin-bottom: 20px; }

.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

.faq-answer-text {
  background: var(--gray-50);
  border-left: 4px solid var(--primary);
  padding: 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.7;
  color: var(--gray-700);
  margin-bottom: 8px;
}

/* ── Status Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; }

.badge-open { background: var(--yellow-bg); color: var(--yellow-dark); }
.badge-open::before { background: var(--yellow); }

.badge-in_progress { background: #eff6ff; color: #1d4ed8; }
.badge-in_progress::before { background: #3b82f6; }

.badge-resolved { background: var(--green-bg); color: var(--green-dark); }
.badge-resolved::before { background: var(--green); }

.badge-closed { background: var(--gray-100); color: var(--gray-600); }
.badge-closed::before { background: var(--gray-400); }

/* ── Ticket Tracking ────────────────────────────────────────────────── */
.ticket-track-result { padding: 24px 32px; border-top: 1px solid var(--gray-200); }

.ticket-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0;
}

.ticket-info-item { background: var(--gray-50); padding: 12px 16px; border-radius: var(--radius-sm); }
.ticket-info-item label { font-size: 11px; color: var(--gray-400); display: block; margin-bottom: 2px; text-transform: uppercase; letter-spacing: .5px; }
.ticket-info-item span { font-size: 14px; font-weight: 600; color: var(--gray-800); }

.responses-section { margin-top: 24px; }
.responses-section h3 { margin-bottom: 12px; font-size: 14px; color: var(--gray-600); text-transform: uppercase; letter-spacing: .5px; }

.response-item {
  background: var(--green-bg);
  border-left: 4px solid var(--green);
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}

.response-meta { font-size: 12px; color: var(--gray-400); margin-bottom: 6px; }
.response-text { font-size: 14px; color: var(--gray-700); line-height: 1.6; }

.no-responses { text-align: center; padding: 24px; color: var(--gray-400); font-size: 14px; }

/* ── Footer ─────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  padding: 20px 0;
  text-align: center;
  margin-top: auto;
}

.site-footer p { font-size: 13px; color: var(--gray-400); }

/* ── Admin ──────────────────────────────────────────────────────────── */
.admin-body { background: var(--gray-100); }

/* Login */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, #003f6b 0%, var(--primary) 50%, var(--primary-light) 100%);
}

.login-box {
  background: var(--white);
  border-radius: 16px;
  padding: 48px 40px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  text-align: center;
}

.login-logo { margin-bottom: 24px; }
.login-logo svg { height: 50px; width: auto; }

.login-box h2 { margin-bottom: 6px; }
.login-box > p { margin-bottom: 28px; font-size: 14px; }

.login-form { text-align: left; }

.error-msg {
  background: var(--red-bg);
  color: var(--red);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 14px;
}

/* Sidebar */
.sidebar {
  width: 240px;
  min-height: 100vh;
  background: linear-gradient(180deg, #003f6b 0%, var(--primary) 100%);
  position: fixed;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  z-index: 50;
}

.sidebar-logo {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo svg { height: 50px; width: auto; display: block; margin-bottom: 4px; margin-top: 35px; }
.sidebar-label { font-size: 11px; color: rgba(255,255,255,0.5); text-transform: uppercase; letter-spacing: 1px; }

.sidebar-nav { padding: 16px 12px; flex: 1; display: flex; flex-direction: column; gap: 4px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
}

.nav-item svg { width: 18px; height: 18px; }
.nav-item:hover { background: rgba(255,255,255,0.1); color: var(--white); }
.nav-item.active { background: rgba(255,255,255,0.15); color: var(--white); }

.nav-badge {
  margin-left: auto;
  background: var(--yellow);
  color: var(--gray-800);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 20px;
}

.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 24px;
  background: transparent;
  border: none;
  border-top: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.5);
  font-size: 13px;
  cursor: pointer;
  width: 100%;
  transition: color 0.2s;
}

.sidebar-logout svg { width: 16px; height: 16px; }
.sidebar-logout:hover { color: var(--white); }

/* Admin Main */
.admin-main {
  margin-left: 240px;
  min-height: 100vh;
  padding: 0;
}

.view { display: none; padding: 32px; }
.view.active { display: block; }

.view-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.view-header h1 { flex: 1; }

.header-controls { display: flex; gap: 10px; align-items: center; }

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
}

.search-box svg { width: 16px; height: 16px; color: var(--gray-400); flex-shrink: 0; }
.search-box input { border: none; outline: none; font-size: 14px; width: 220px; }

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.stat-icon svg { width: 20px; height: 20px; }
.stat-value { font-size: 2rem; font-weight: 800; color: var(--gray-800); line-height: 1; }
.stat-label { font-size: 13px; color: var(--gray-400); }

.stat-open .stat-icon { background: var(--yellow-bg); color: var(--yellow); }
.stat-inprogress .stat-icon { background: #eff6ff; color: #3b82f6; }
.stat-resolved .stat-icon { background: var(--green-bg); color: var(--green); }
.stat-today .stat-icon { background: #f5f3ff; color: var(--purple); }

/* Tickets List */
.filter-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: var(--white);
  padding: 5px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-200);
  width: fit-content;
}

.filter-btn {
  padding: 6px 14px;
  border: none;
  background: transparent;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-600);
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn.active { background: var(--primary); color: var(--white); }
.filter-btn:not(.active):hover { background: var(--gray-100); }

.tickets-list { display: flex; flex-direction: column; gap: 10px; }

.ticket-row {
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 16px;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s;
}

.ticket-row:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); transform: translateX(2px); }

.ticket-num {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-bg);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}

.ticket-info h4 { font-size: 14px; font-weight: 600; color: var(--gray-800); margin-bottom: 3px; }
.ticket-info p { font-size: 12px; color: var(--gray-400); }
.ticket-subject { font-size: 13px; color: var(--primary); font-weight: 500; }

.ticket-meta { text-align: right; }
.ticket-date { font-size: 12px; color: var(--gray-400); margin-top: 4px; }

.response-count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--gray-400);
  background: var(--gray-100);
  padding: 2px 8px;
  border-radius: 20px;
}

/* Ticket Detail */
.ticket-detail { display: grid; grid-template-columns: 1fr 380px; gap: 20px; }

.detail-main, .detail-sidebar { display: flex; flex-direction: column; gap: 16px; }

.detail-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
}

.detail-card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--gray-200);
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: .5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-card-header svg { width: 15px; height: 15px; }
.detail-card-body { padding: 20px; }

.info-table { width: 100%; border-collapse: collapse; }
.info-table tr td { padding: 8px 0; font-size: 14px; border-bottom: 1px solid var(--gray-100); }
.info-table tr:last-child td { border-bottom: none; }
.info-table td:first-child { color: var(--gray-400); font-size: 13px; width: 110px; }
.info-table td:last-child { font-weight: 600; color: var(--gray-800); }

.description-box {
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--gray-700);
  white-space: pre-wrap;
}

.conversation { display: flex; flex-direction: column; gap: 12px; }

.message-bubble {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.6;
}

.message-bubble.staff {
  background: var(--green-bg);
  border-left: 4px solid var(--green);
}

.message-bubble.client {
  background: var(--gray-50);
  border-left: 4px solid var(--gray-300);
}

.message-meta { font-size: 12px; color: var(--gray-400); margin-bottom: 6px; }

.reply-form textarea { min-height: 100px; margin-bottom: 12px; }

.status-select {
  padding: 7px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.back-btn svg { width: 18px; height: 18px; }

/* Recent tickets in dashboard */
.recent-section { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 24px; }
.recent-section h3 { margin-bottom: 16px; font-size: 15px; }

.recent-ticket {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  transition: opacity 0.2s;
}

.recent-ticket:last-child { border-bottom: none; }
.recent-ticket:hover { opacity: 0.7; }
.recent-ticket-info { flex: 1; }
.recent-ticket-info h4 { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.recent-ticket-info p { font-size: 12px; color: var(--gray-400); }

.loading-placeholder {
  text-align: center;
  padding: 40px;
  color: var(--gray-400);
  font-size: 14px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-400);
}

.empty-state svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: 0.4; }
.empty-state h3 { font-size: 15px; margin-bottom: 4px; color: var(--gray-500); }
.empty-state p { font-size: 13px; }

/* Dashboard bottom */
.dashboard-bottom { display: grid; grid-template-columns: 1fr; gap: 20px; }

/* ── Sidebar User ───────────────────────────────────────────────────── */
.sidebar-user {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
}

.nav-separator {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.35);
  padding: 10px 12px 4px;
}

/* ── Modal ──────────────────────────────────────────────────────────── */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-header h3 { font-size: 1.1rem; }

.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--gray-400);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.modal-close:hover { color: var(--gray-700); }

.modal-lg { max-width: 640px; }
.modal-xl { max-width: 780px; }

/* ── Tags ───────────────────────────────────────────────────────────── */
.tag {
  display: inline-block;
  padding: 2px 8px;
  background: var(--gray-100);
  color: var(--gray-600);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  margin: 1px;
}

.tag-admin {
  background: #fef3c7;
  color: #92400e;
}

/* ── Icon buttons ───────────────────────────────────────────────────── */
.btn-icon-sm {
  background: none;
  border: 1px solid var(--gray-200);
  color: var(--gray-500);
  border-radius: 4px;
  width: 24px;
  height: 24px;
  cursor: pointer;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
  transition: all 0.15s;
}

.btn-icon-sm:hover { background: var(--red-bg); color: var(--red); border-color: var(--red); }

/* ── Financial Module ───────────────────────────────────────────────── */
.fin-period-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--white);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-200);
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.fin-period-bar label { font-size: 13px; font-weight: 600; color: var(--gray-600); }
.fin-period-bar input[type="month"] { padding: 6px 10px; font-size: 13px; border: 1.5px solid var(--gray-200); border-radius: var(--radius-sm); }

.fin-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: var(--white);
  padding: 5px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-200);
  width: fit-content;
}

.fin-tab {
  padding: 7px 18px;
  border: none;
  background: transparent;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-600);
  cursor: pointer;
  transition: all 0.2s;
}

.fin-tab.active { background: var(--primary); color: var(--white); }
.fin-tab:not(.active):hover { background: var(--gray-100); }

.fin-panel { display: none; }
.fin-panel.active { display: block; }

.fin-summary-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.fin-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.fin-card-receita { border-top: 3px solid var(--green); }
.fin-card-lucro   { border-top: 3px solid var(--primary); }
.fin-card-resultado { border-top: 3px solid var(--purple); }
.fin-card-despesa { border-top: 3px solid var(--red); }

.fin-card-label { font-size: 12px; color: var(--gray-400); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.fin-card-value { font-size: 1.5rem; font-weight: 800; color: var(--gray-800); }
.fin-card-sub { font-size: 12px; color: var(--gray-400); margin-top: 4px; }

.fin-positive { color: #166534 !important; }
.fin-negative { color: #991b1b !important; }

.fin-table-wrap {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.fin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.fin-table thead th {
  background: var(--gray-50);
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 1px solid var(--gray-200);
}

.fin-table tbody td { padding: 9px 16px; border-bottom: 1px solid var(--gray-100); }

.fin-group-row td {
  font-weight: 700;
  background: var(--gray-50);
  color: var(--gray-700);
  padding: 10px 16px;
  border-top: 1px solid var(--gray-200);
}

.fin-detail-row td { color: var(--gray-600); }

.fin-subtotal-row td {
  font-weight: 700;
  color: var(--gray-700);
  background: #f0f9ff;
  border-top: 2px solid var(--gray-200);
  padding: 10px 16px;
}

.fin-total-row td {
  font-weight: 800;
  background: var(--primary-bg);
  color: var(--primary);
  border-top: 2px solid var(--primary);
  padding: 12px 16px;
  font-size: 14px;
}

.fin-amount { text-align: right !important; font-variant-numeric: tabular-nums; }
.fin-pct { text-align: right !important; color: var(--gray-400); font-size: 12px; min-width: 70px; }

.fin-warning {
  background: var(--yellow-bg);
  border: 1px solid var(--yellow);
  color: var(--yellow-dark);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-top: 12px;
}

.fin-ok {
  background: var(--green-bg);
  border: 1px solid var(--green);
  color: var(--green-dark);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-top: 12px;
}

/* ── Agenda Module ──────────────────────────────────────────────────── */
.agenda-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 20px;
}

.agenda-day {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  min-height: 90px;
  padding: 6px;
}

.agenda-day.weekend { background: var(--gray-50); }
.agenda-day.today { border-color: var(--primary); border-width: 2px; }

.agenda-day-num {
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-500);
  margin-bottom: 4px;
}

.agenda-day.today .agenda-day-num { color: var(--primary); }

.agenda-event {
  border-left: 3px solid var(--gray-400);
  background: var(--primary-bg);
  border-radius: 3px;
  padding: 3px 5px;
  margin-bottom: 3px;
  cursor: pointer;
  transition: opacity 0.2s;
  font-size: 11px;
}

.agenda-event:hover { opacity: 0.8; }

.ev-concluido { opacity: 0.5; text-decoration: line-through; }
.ev-cancelado { opacity: 0.4; }

.agenda-event-title { font-weight: 600; color: var(--gray-800); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agenda-event-type { color: var(--gray-500); font-size: 10px; }

.agenda-sidebar-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.agenda-list-section {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px;
}

.agenda-list-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--gray-500);
  margin-bottom: 10px;
}

.overdue-title { color: var(--red); }

.agenda-list-item {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-100);
  margin-bottom: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.agenda-list-item:hover { border-color: var(--primary); background: var(--primary-bg); }
.agenda-list-item.ev-concluido { opacity: 0.5; }

/* ── Receipts Module ────────────────────────────────────────────────── */
.recibos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.recibo-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}

.recibo-card:hover { box-shadow: var(--shadow); }

.recibo-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.recibo-number { font-size: 13px; font-weight: 700; color: var(--primary); background: var(--primary-bg); padding: 3px 10px; border-radius: 20px; }
.recibo-date { font-size: 12px; color: var(--gray-400); }
.recibo-client { font-size: 15px; font-weight: 700; color: var(--gray-800); margin-bottom: 4px; }
.recibo-total { font-size: 22px; font-weight: 800; color: var(--green-dark); margin-bottom: 4px; }
.recibo-payment { font-size: 12px; color: var(--gray-400); margin-bottom: 14px; }

.recibo-actions { display: flex; gap: 8px; }

/* Services section in receipt modal */
.services-section { margin-bottom: 16px; }

.services-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.services-header label { font-size: 13px; font-weight: 600; color: var(--gray-700); }

.services-table-header {
  display: grid;
  grid-template-columns: 1fr 80px 110px 110px 30px;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 0 0 6px;
  border-bottom: 1px solid var(--gray-200);
}

.service-line {
  display: grid;
  grid-template-columns: 1fr 80px 110px 110px 30px;
  gap: 8px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--gray-100);
}

.service-line input { margin: 0; padding: 7px 10px; font-size: 13px; }
.sl-total { font-size: 13px; font-weight: 600; color: var(--gray-700); text-align: right; }

.receipt-totals {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--gray-200);
}

.receipt-total-display { text-align: right; }
.total-line { display: flex; justify-content: space-between; gap: 40px; padding: 3px 0; font-size: 14px; color: var(--gray-600); }
.total-line.grand { font-size: 18px; font-weight: 800; color: var(--gray-800); border-top: 2px solid var(--gray-200); margin-top: 6px; padding-top: 8px; }

/* ── Users Module ───────────────────────────────────────────────────── */
.users-table-wrap {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.users-table thead th {
  background: var(--gray-50);
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 1px solid var(--gray-200);
  text-align: left;
}

.users-table tbody td { padding: 12px 16px; border-bottom: 1px solid var(--gray-100); }
.users-table tbody tr:last-child td { border-bottom: none; }
.users-table tbody tr:hover { background: var(--gray-50); }

.permissions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.perm-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-700);
  cursor: pointer;
}

.perm-item input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--primary); }

/* ══ MOBILE ══════════════════════════════════════════════════════════ */

/* Barra superior mobile (oculta no desktop) */
.m-topbar {
  display: none;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 16px;
  background: linear-gradient(90deg, #003f6b 0%, #0095d5 100%);
  position: sticky;
  top: 0;
  z-index: 60;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.m-hamburger {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none;
  color: #fff; cursor: pointer;
  border-radius: 8px;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.m-hamburger:active { background: rgba(255,255,255,0.15); }
.m-hamburger svg { width: 22px; height: 22px; }

/* Overlay escuro quando sidebar aberta */
.m-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 49;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.m-overlay.active { display: block; }

/* ── Tela de introdução (Tirar dúvidas pelo WhatsApp / Abrir chamado) ── */
.intro-gate {
  display: flex;
  justify-content: center;
  padding: 48px 0 24px;
}

.intro-card {
  width: 100%;
  max-width: 560px;
  text-align: center;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  padding: 44px 36px;
}

.intro-card h1 {
  font-size: 1.6rem;
  color: var(--gray-800);
  margin-bottom: 10px;
}

.intro-card p {
  font-size: 0.95rem;
  color: var(--gray-600);
  line-height: 1.6;
  margin-bottom: 30px;
}

.intro-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn-whatsapp {
  background: #25d366;
  color: var(--white);
  box-shadow: 0 2px 8px rgba(37, 211, 102, 0.3);
}
.btn-whatsapp:hover {
  background: #1fb959;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
  transform: translateY(-1px);
}

.intro-actions .btn-lg {
  justify-content: center;
  width: 100%;
}
.intro-actions .btn svg { width: 18px; height: 18px; }

.intro-track-link {
  display: inline-block;
  margin-top: 22px;
  font-size: 0.85rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}
.intro-track-link:hover { text-decoration: underline; }

@media (max-width: 768px) {
  .intro-gate { padding: 28px 0 16px; }
  .intro-card { padding: 32px 22px; }
  .intro-card h1 { font-size: 1.35rem; }
}

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Sidebar: oculta fora da tela por padrão, desliza ao abrir */
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 50;
  }
  .sidebar.open { transform: translateX(0); }

  /* Barra superior visível */
  .m-topbar { display: flex; }

  /* Conteúdo ocupa toda a largura */
  .admin-main { margin-left: 0; }
  .view { padding: 16px; }
  .view-header { margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
  .view-header h1 { font-size: 20px; }

  /* Cards */
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
  .stat-card { padding: 16px 14px; }
  .stat-value { font-size: 1.8rem; }

  /* Forms */
  .form-row { grid-template-columns: 1fr; }
  .ticket-form, .track-form { padding: 16px; }
  .form-card .card-header { padding: 16px; }

  /* Tickets */
  .ticket-detail { grid-template-columns: 1fr; }
  .ticket-row { grid-template-columns: 1fr; gap: 8px; }
  .filter-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Financeiro */
  .fin-period-bar { flex-wrap: wrap; gap: 6px; }
  .fin-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; gap: 4px; }
  .fin-tab { white-space: nowrap; font-size: 13px; padding: 8px 14px; }
  .fin-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .fin-summary-cards { grid-template-columns: 1fr; gap: 10px; }

  /* Modais sobem da base */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal {
    width: 100%; max-width: 100%;
    max-height: 92dvh;
    border-radius: 20px 20px 0 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .modal-header { padding: 16px 20px 12px; }
  .modal-body { padding: 16px 20px; }

  /* Outros */
  .recibos-grid { grid-template-columns: 1fr; }
  .search-box input { width: 130px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .tab-btn span { display: none; }
}
