/* ============================================================
   USIMABE TI — DESIGN SYSTEM
   Brand: Navy #1B3A5C | Blue #2563EB
   ============================================================ */

:root {
  --brand-navy: #1B3A5C;
  --brand-navy-light: #244870;
  --brand-navy-dark: #0f2438;
  --brand-blue: #2563EB;
  --brand-blue-light: #3b82f6;
  --brand-blue-dark: #1d4ed8;
  --brand-orange: #F26B21;

  /* Dark Mode (Default) */
  --bg-page: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --bg-sidebar: #0f172a;
  --bg-input: #1e293b;
  --bg-topbar: #1e293b;

  --border: #334155;
  --border-focus: rgba(37,99,235,0.5);

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-muted-strong: #a3bffa;

  --status-open: #3b82f6;
  --status-progress: #f59e0b;
  --status-waiting: #8b5cf6;
  --status-resolved: #10b981;
  --status-closed: #6b7280;

  --prio-low: #10b981;
  --prio-medium: #f59e0b;
  --prio-high: #ef4444;
  --prio-critical: #dc2626;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.5);
  --transition: 220ms ease;

  --sidebar-width: 280px;
  --topbar-height: 72px;

  --space-1: 8px;
  --space-2: 12px;
  --space-3: 16px;
  --space-4: 20px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 40px;
  --space-8: 48px;
  --space-9: 56px;

  --font-size-base: 15px;
  --font-size-lg: 16px;
  --font-size-xl: 18px;
  --font-size-xxl: 22px;
  --line-height-base: 1.65;
}

/* Light Mode */
[data-theme="light"] {
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-sidebar: #ffffff;
  --bg-input: #f8fafc;
  --bg-topbar: #ffffff;

  --border: #e2e8f0;
  --border-focus: var(--brand-blue);

  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
}

/* ---- RESET ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: var(--line-height-base);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  touch-action: manipulation;
}
a { color: var(--brand-blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }

h1, h2, h3, h4, h5, h6 { margin: 0; color: var(--text-primary); }
p { color: var(--text-secondary); margin: 0 0 var(--space-4) 0; }
small { color: var(--text-muted); }

.page-header h2 { font-size: var(--font-size-xxl); line-height: 1.1; }
.page-header p { font-size: 15px; color: var(--text-muted); }

.card { box-shadow: var(--shadow-sm); }
input::placeholder, textarea::placeholder { color: var(--text-muted); }
img { max-width: 100%; height: auto; }

/* Performance optimizations */
.will-change-transform { will-change: transform; }
.gpu-accelerated { transform: translateZ(0); backface-visibility: hidden; }

/* ---- UTILITIES ---- */
.hidden { display: none !important; }
.page { min-height: 100vh; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 10px; }
.gap-3 { gap: 16px; }
.gap-4 { gap: 20px; }
.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 18px; }
.mt-4 { margin-top: 24px; }
.mb-2 { margin-bottom: 12px; }
.mb-3 { margin-bottom: 18px; }
.mb-4 { margin-bottom: 24px; }
.text-sm { font-size: 14px; }
.text-xs { font-size: 12px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 20px; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-orange { color: var(--brand-orange); }
.text-right { text-align: right; }
.w-full { width: 100%; }

/* ---- PRELOADER ---- */
#preloader {
  position: fixed; inset: 0; background: var(--bg-page);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}
.preloader-content { text-align: center; }
.preloader-logo { width: 140px; margin-bottom: 24px; background: #ffffff; padding: 12px 18px; border-radius: var(--radius-md); box-shadow: 0 4px 20px rgba(0,0,0,0.3); }
.preloader-content p { color: var(--text-muted); margin-top: 16px; font-size: 14px; }
.spinner {
  width: 36px; height: 36px; border: 3px solid var(--border);
  border-top-color: var(--brand-blue); border-radius: 50%;
  animation: spin 0.8s linear infinite; margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInRight { from { transform: translateX(12px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ---- LOGIN ---- */
.login-bg {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: radial-gradient(ellipse at 20% 50%, rgba(27,58,92,0.5) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 20%, rgba(242,107,33,0.15) 0%, transparent 50%),
              var(--bg-page);
}
.login-card {
  width: 100%; max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(27,58,92,0.3);
  animation: fadeInUp 0.5s ease;
}
@keyframes fadeInUp { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:translateY(0); } }
.login-header { text-align: center; margin-bottom: 32px; }
.login-logo { width: 180px; margin-bottom: 20px; background: #ffffff; padding: 10px 16px; border-radius: var(--radius-md); box-shadow: 0 4px 16px rgba(0,0,0,0.25); }
.login-header h1 { font-size: 22px; font-weight: 700; color: var(--text-primary); }
.login-header p { color: var(--text-secondary); font-size: 14px; margin-top: 4px; }
.login-footer { text-align: center; margin-top: 20px; font-size: 13px; color: var(--text-muted); }

/* ---- FORMS ---- */
.form-group { margin-bottom: var(--space-5); }
.form-group label { display: block; font-size: 14px; font-weight: 600; color: var(--text-secondary); margin-bottom: 10px; letter-spacing: 0.01em; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.input-icon { position: relative; }
.input-icon .icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); font-size: 16px; pointer-events: none; }
.input-icon input { padding-left: 44px !important; }
.input-icon .toggle-pass { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: none; border: none; font-size: 16px; color: var(--text-muted); }
input[type="text"], input[type="email"], input[type="password"], input[type="tel"], select, textarea {
  width: 100%; padding: 14px 18px;
  min-height: 46px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-md); color: var(--text-primary);
  font-size: var(--font-size-base); transition: border-color var(--transition), box-shadow var(--transition);
  outline: none; letter-spacing: 0.01em; line-height: var(--line-height-base);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 44px; padding: 0 18px; border-radius: var(--radius-lg);
  font-size: var(--font-size-base); font-weight: 600; border: none;
  transition: transform var(--transition), box-shadow var(--transition), background-color var(--transition), border-color var(--transition);
  cursor: pointer; white-space: nowrap; position: relative; overflow: hidden;
}
.btn::after { content: ''; position: absolute; inset: 0; background: radial-gradient(circle, rgba(255,255,255,0.18), transparent 65%); transform: scale(0.7); opacity: 0; transition: transform 220ms ease, opacity 220ms ease; }
.btn:hover::after { transform: scale(1.25); opacity: 1; }
.btn:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.btn-full { width: 100%; min-height: 48px; padding: 0 18px; }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: 13px; }
.btn-primary { background: var(--brand-blue); color: white; box-shadow: 0 5px 16px rgba(37,99,235,0.18); }
.btn-primary:hover { background: var(--brand-blue-dark); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(37,99,235,0.24); }
.btn-secondary { background: var(--bg-input); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-card-hover); border-color: var(--brand-blue); }
.btn-navy { background: var(--brand-navy); color: white; }
.btn-navy:hover { background: var(--brand-navy-light); }
.btn-danger { background: #ef4444; color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text-primary); border-color: var(--brand-blue); background: rgba(37,99,235,0.08); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }
.btn-loading::after { content: ''; width: 14px; height: 14px; border: 2px solid transparent; border-top-color: white; border-radius: 50%; animation: spin 0.6s linear infinite; }
select option { background: var(--bg-card); color: var(--text-primary); }
textarea { resize: vertical; min-height: 130px; line-height: 1.6; }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 12px 24px; border-radius: var(--radius-md);
  font-size: 15px; font-weight: 600; border: none;
  transition: all var(--transition); cursor: pointer; white-space: nowrap;
  letter-spacing: 0.01em;
}
.btn-full { width: 100%; padding: 14px; }
.btn-sm { padding: 8px 16px; font-size: 14px; }
.btn-primary {
  background: var(--brand-blue); color: white;
  box-shadow: 0 2px 8px rgba(37,99,235,0.25);
}
.btn-primary:hover { background: var(--brand-blue-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37,99,235,0.35); }
.btn-secondary { background: var(--bg-input); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-card-hover); border-color: var(--brand-blue); }
.btn-navy { background: var(--brand-navy); color: white; }
.btn-navy:hover { background: var(--brand-navy-light); }
.btn-danger { background: #ef4444; color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text-primary); border-color: var(--brand-blue); background: rgba(37,99,235,0.08); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }
.btn-loading::after { content: ''; width: 14px; height: 14px; border: 2px solid transparent; border-top-color: white; border-radius: 50%; animation: spin 0.6s linear infinite; }

/* ---- ALERTS ---- */
.alert { padding: 12px 16px; border-radius: var(--radius-md); font-size: 14px; margin-bottom: 16px; border: 1px solid transparent; }
.alert-error { background: rgba(239,68,68,0.12); border-color: rgba(239,68,68,0.3); color: #fca5a5; }
.alert-success { background: rgba(16,185,129,0.12); border-color: rgba(16,185,129,0.3); color: #6ee7b7; }
.alert-info { background: rgba(59,130,246,0.12); border-color: rgba(59,130,246,0.3); color: #93c5fd; }
.alert-warning { background: rgba(245,158,11,0.12); border-color: rgba(245,158,11,0.3); color: #fcd34d; }

/* ---- SIDEBAR ---- */
.sidebar {
  position: fixed; top: 0; left: 0; height: 100vh; width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; z-index: 100;
  transition: transform var(--transition), width var(--transition);
  will-change: transform;
}
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
  z-index: 18;
  touch-action: none;
}
.sidebar-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}
body.sidebar-open { overflow: hidden; }
.sidebar-header {
  padding: 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.sidebar-logo { height: 44px; background: #ffffff; padding: 8px 14px; border-radius: var(--radius-sm); object-fit: contain; }
.sidebar-close { display: none; background: none; border: none; color: var(--text-muted); font-size: 20px; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 16px 0; }
.nav-section { padding: 18px 22px 8px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-muted); }
.nav-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 22px; font-size: 15px; font-weight: 500;
  color: var(--text-secondary); cursor: pointer;
  transition: background var(--transition), color var(--transition);
  border-radius: var(--radius-lg);
  border: none; background: none; width: 100%; text-align: left;
  position: relative;
}
.nav-item:hover { color: var(--text-primary); background: rgba(255,255,255,0.06); }
.nav-item.active { color: var(--brand-blue); background: rgba(37,99,235,0.14); }
.nav-item .nav-icon { font-size: 18px; width: 26px; text-align: center; }
.nav-badge { margin-left: auto; background: var(--brand-blue); color: white; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 20px; }
.sidebar-footer { padding: 20px; border-top: 1px solid var(--border); }
.user-card { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.user-avatar { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; color: white; flex-shrink: 0; }
.user-card-info { flex: 1; min-width: 0; }
.user-card-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card-role { font-size: 12px; color: var(--text-muted); }
.btn-logout { width: 100%; background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.2); color: #fca5a5; border-radius: var(--radius-md); padding: 10px 18px; font-size: 14px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 8px; transition: all var(--transition); }
.btn-logout:hover { background: rgba(239,68,68,0.2); }

/* ---- MAIN LAYOUT ---- */
.main-wrapper { margin-left: var(--sidebar-width); min-height: 100vh; display: flex; flex-direction: column; transition: margin-left var(--transition); }
.sidebar.collapsed { width: 0; overflow: hidden; }
.main-wrapper.sidebar-collapsed { margin-left: 0; }
.topbar {
  height: var(--topbar-height); background: var(--bg-topbar);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; position: sticky; top: 0; z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 18px; }
.menu-toggle {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text-primary);
  font-size: 22px;
  display: none;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition), background var(--transition), border-color var(--transition);
}
.menu-toggle:hover { transform: translateY(-1px); background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.2); }
.menu-toggle:focus-visible { outline: 2px solid rgba(37,99,235,0.35); outline-offset: 2px; }
.breadcrumb { font-size: 15px; font-weight: 600; color: var(--text-secondary); display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.breadcrumb .breadcrumb-separator { color: var(--text-muted); }
.breadcrumb-link { background: none; border: none; color: var(--text-secondary); font: inherit; cursor: pointer; padding: 0; transition: color var(--transition); }
.breadcrumb-link:hover, .breadcrumb-link:focus { color: var(--text-primary); text-decoration: underline; outline: none; }
.breadcrumb-link[aria-current="page"] { color: var(--text-primary); font-weight: 700; cursor: default; }
.topbar-right { display: flex; align-items: center; gap: 18px; }
.notif-btn { position: relative; background: none; border: none; font-size: 22px; color: var(--text-secondary); transition: color var(--transition); padding: 8px; }
.notif-btn:hover { color: var(--brand-blue); }
.badge { position: absolute; top: 0; right: 0; min-width: 18px; height: 18px; background: var(--brand-blue); color: white; font-size: 11px; font-weight: 700; border-radius: 9px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.theme-toggle { background: none; border: none; color: var(--text-secondary); font-size: 20px; padding: 8px; cursor: pointer; transition: color var(--transition); }
.theme-toggle:hover { color: var(--brand-blue); }
.topbar-user { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; color: var(--text-secondary); }
.content { flex: 1; padding: 32px 32px; }

/* ---- CARDS ---- */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 28px; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-5); }
.card-header h3 { font-size: var(--font-size-xl); font-weight: 700; letter-spacing: 0.01em; margin: 0; }
.card-title { font-size: var(--font-size-xl); font-weight: 700; letter-spacing: 0.01em; }
.card-subtitle { font-size: 14px; color: var(--text-muted); margin-top: 4px; }

/* ---- QUICK ACTIONS ---- */
.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--space-3); margin-bottom: var(--space-6); }
.quick-action {
  display: flex; align-items: center; gap: 14px; padding: 18px; border: 1px solid var(--border);
  border-radius: var(--radius-lg); background: var(--bg-card);
  color: var(--text-primary); transition: all var(--transition);
}
.quick-action:hover { border-color: rgba(37,99,235,0.25); transform: translateY(-1px); }
.qa-icon { font-size: 22px; width: 46px; height: 46px; display: flex; align-items: center; justify-content: center; background: rgba(37,99,235,0.12); border-radius: 14px; }
.qa-label { display: block; font-size: 15px; font-weight: 700; }

.search-bar { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-5); }
.search-input-wrapper { position: relative; flex: 1; min-width: 220px; }
.search-input-wrapper .search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.search-input { width: 100%; padding: 12px 16px 12px 42px; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-md); color: var(--text-primary); font-size: 14px; }

.ticket-list { display: flex; flex-direction: column; gap: 14px; }
.ticket-row {
  width: 100%; border: 1px solid var(--border); background: var(--bg-card);
  border-radius: var(--radius-xl); padding: 18px 20px;
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: var(--space-4);
  text-align: left; transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}
.ticket-row:hover { border-color: rgba(37,99,235,0.23); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.ticket-row-left { display: flex; align-items: flex-start; gap: 14px; min-width: 0; }
.ticket-row-priority { width: 46px; min-width: 46px; height: 46px; border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.ticket-row-main { min-width: 0; }
.ticket-row-header { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 6px; }
.ticket-row-code { font-size: 12px; font-weight: 700; color: var(--text-secondary); background: rgba(255,255,255,0.05); padding: 5px 9px; border-radius: 12px; }
.ticket-row-title { font-size: 16px; font-weight: 700; color: var(--text-primary); margin: 0 0 6px; line-height: 1.35; }
.ticket-row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--text-muted); font-size: 13px; }
.ticket-row-avatar { width: 42px; height: 42px; border-radius: 50%; overflow: hidden; }
.ticket-row-right { display: flex; align-items: center; gap: 14px; justify-content: flex-end; }
.ticket-row-actions { display: flex; align-items: center; justify-content: center; color: var(--text-muted); }
.ticket-row-actions .btn-icon { font-size: 18px; }
.ticket-row[data-status="open"] .ticket-row-priority { background: rgba(59,130,246,0.15); color: #60a5fa; }
.ticket-row[data-status="in_progress"] .ticket-row-priority { background: rgba(245,158,11,0.15); color: #fbbf24; }
.ticket-row[data-status="resolved"] .ticket-row-priority { background: rgba(16,185,129,0.15); color: #34d399; }
.ticket-row[data-status="closed"] .ticket-row-priority { background: rgba(107,114,128,0.15); color: #9ca3af; }

/* ---- STAT CARDS ---- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 28px; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 24px; transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  position: relative; overflow: hidden;
}
.stat-card::after { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--card-color, var(--brand-blue)); }
.stat-card:hover { border-color: var(--card-color, var(--brand-blue)); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon { font-size: 32px; margin-bottom: 16px; }
.stat-number { font-size: 36px; font-weight: 800; color: var(--text-primary); line-height: 1; }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 8px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; }

/* Status colors for stat cards */
:root {
  --status-open: #3b82f6;
  --status-progress: #f59e0b;
  --status-resolved: #10b981;
}

/* ---- TABLE ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th { padding: 14px 20px; text-align: left; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody td { padding: 16px 20px; border-bottom: 1px solid var(--border); font-size: 15px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,0.02); }
tbody tr { cursor: pointer; transition: background var(--transition); }

/* ---- STATUS & PRIORITY BADGES ---- */
.badge-status, .badge-priority {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 20px; font-size: 13px; font-weight: 600; white-space: nowrap;
}
.s-open { background: rgba(59,130,246,0.15); color: #60a5fa; }
.s-in_progress { background: rgba(245,158,11,0.15); color: #fbbf24; }
.s-waiting { background: rgba(139,92,246,0.15); color: #a78bfa; }
.s-resolved { background: rgba(16,185,129,0.15); color: #34d399; }
.s-closed { background: rgba(107,114,128,0.15); color: #9ca3af; }
.p-low { background: rgba(16,185,129,0.15); color: #34d399; }
.p-medium { background: rgba(245,158,11,0.15); color: #fbbf24; }
.p-high { background: rgba(239,68,68,0.15); color: #f87171; }
.p-critical { background: rgba(220,38,38,0.15); color: #fc8181; border: 1px solid rgba(220,38,38,0.3); animation: pulse-border 2s infinite; }
@keyframes pulse-border { 0%,100%{box-shadow:0 0 0 0 rgba(220,38,38,0.3)} 50%{box-shadow:0 0 0 4px rgba(220,38,38,0)} }

/* ---- PAGE HEADERS ---- */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 32px; flex-wrap: wrap; gap: 16px; }
.page-header h2 { font-size: 26px; font-weight: 800; letter-spacing: 0.01em; }
.page-header p { color: var(--text-muted); font-size: 15px; margin-top: 6px; }

/* ---- FILTERS BAR ---- */
.filters-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 24px; }
.filter-btn { padding: 9px 18px; border-radius: 20px; font-size: 14px; font-weight: 500; border: 1px solid var(--border); background: transparent; color: var(--text-secondary); transition: all var(--transition); letter-spacing: 0.01em; }
.filter-btn:hover, .filter-btn.active { border-color: var(--brand-blue); color: var(--brand-blue); background: rgba(37,99,235,0.08); }
.search-input { padding: 10px 16px 10px 40px; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-md); color: var(--text-primary); font-size: 14px; width: 260px; letter-spacing: 0.01em; }
.search-wrap { position: relative; display: flex; align-items: center; }
.search-wrap .search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); display: flex; align-items: center; pointer-events: none; }

/* ---- TICKET DETAIL ---- */
.ticket-header-card {
  background: linear-gradient(135deg, var(--brand-navy-dark), #162234);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 32px; margin-bottom: 28px;
}
.ticket-meta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 16px; }
.ticket-meta-item { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-secondary); background: rgba(255,255,255,0.05); padding: 6px 14px; border-radius: 20px; }

/* ---- CHAT ---- */
.chat-box { display: flex; flex-direction: column; gap: 0; }
.chat-messages { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 20px; max-height: 520px; min-height: 240px; }
.chat-msg { display: flex; gap: 12px; animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from{opacity:0;transform:translateY(5px)} to{opacity:1;transform:translateY(0)} }
.chat-msg.me { flex-direction: row-reverse; }
.msg-avatar { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: white; flex-shrink: 0; margin-top: 2px; }
.msg-body { max-width: 72%; }
.msg-bubble { padding: 14px 18px; border-radius: 18px; font-size: 15px; line-height: 1.6; word-break: break-word; }
.chat-msg:not(.me) .msg-bubble { background: var(--bg-card-hover); border-radius: 6px 18px 18px 18px; }
.chat-msg.me .msg-bubble { background: linear-gradient(135deg, var(--brand-navy), var(--brand-navy-light)); border-radius: 18px 6px 18px 18px; }
.chat-msg.admin-msg:not(.me) .msg-bubble { background: linear-gradient(135deg, rgba(242,107,33,0.15), rgba(242,107,33,0.08)); border: 1px solid rgba(242,107,33,0.2); }
.msg-meta { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.chat-msg.me .msg-meta { text-align: right; }
.chat-input-area { padding: 20px 24px; border-top: 1px solid var(--border); background: var(--bg-card); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.chat-input-row { display: flex; gap: 12px; }
.chat-input { flex: 1; padding: 12px 18px; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-lg); color: var(--text-primary); font-size: 15px; resize: none; max-height: 120px; min-height: 48px; transition: border-color var(--transition); letter-spacing: 0.01em; }
.chat-input:focus { outline: none; border-color: var(--brand-blue); }
.chat-send-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  min-width: 110px;
  height: 48px;
  border-radius: 999px;
  background: var(--brand-blue);
  border: none;
  color: white;
  font-size: 15px;
  font-weight: 600;
  transition: all var(--transition);
  flex-shrink: 0;
}
.chat-send-btn:hover {
  background: var(--brand-blue-dark);
  transform: translateY(-1px);
}

/* ---- NEW TICKET FORM ---- */
.wizard-card { max-width: 1000px; margin: 0 auto; }
.wizard-content { padding: 28px 0; }
.wizard-content h3 { font-size: 24px; font-weight: 700; margin-bottom: 10px; color: var(--text-primary); }
.wizard-content > p.text-muted { font-size: 15px; margin-bottom: 24px; color: var(--text-secondary); max-width: 720px; line-height: 1.75; }

.category-selection {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.category-option {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  padding: 24px;
  min-height: 170px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  cursor: pointer;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.category-option:hover,
.category-option:focus-visible {
  border-color: var(--brand-blue);
  background: var(--bg-card-hover);
  box-shadow: 0 18px 35px rgba(15,23,42,0.12);
  transform: translateY(-2px);
}

.category-option.selected {
  border-color: rgba(37,99,235,0.75);
  background: rgba(37,99,235,0.12);
  box-shadow: 0 22px 50px rgba(37,99,235,0.14);
}

.category-option-icon {
  font-size: 28px;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.08);
  border-radius: 18px;
}

.category-option-info {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.category-option-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.category-option-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.75;
}

.category-option-check {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--brand-blue);
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease, background 0.25s ease;
}

.category-option.selected .category-option-check {
  opacity: 1;
  transform: scale(1.05);
  background: var(--brand-blue);
  color: white;
}

.priority-selection {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.priority-option {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  cursor: pointer;
  transition: all var(--transition);
}

.priority-option:hover {
  border-color: var(--brand-blue);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.priority-option.selected {
  border-color: var(--brand-blue);
  background: rgba(37,99,235,0.08);
  box-shadow: 0 0 0 1px var(--brand-blue);
}

.priority-option-icon {
  font-size: 28px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card-hover);
  border-radius: var(--radius-md);
}

.priority-option-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.priority-option-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.priority-option-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

.priority-option-check {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--text-secondary);
  opacity: 0;
  transition: all var(--transition);
}

.priority-option.selected .priority-option-check {
  opacity: 1;
  background: var(--brand-blue);
  color: white;
}

.char-count {
  text-align: right;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.quick-templates {
  margin-top: 24px;
  padding: 20px;
  background: var(--bg-card-hover);
  border-radius: var(--radius-md);
}

.quick-templates label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  display: block;
}

.template-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.template-buttons .btn {
  min-width: 0;
}

.wizard-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 18px;
}

.wizard-steps {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-bottom: 32px;
  padding: 20px 0;
}

.wizard-step {
  display: flex;
  align-items: center;
  gap: 12px;
  opacity: 0.4;
  transition: all var(--transition);
}

.wizard-step.active {
  opacity: 1;
}

.wizard-step.completed {
  opacity: 0.6;
}

.step-number {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.wizard-step.active .step-number {
  background: var(--brand-blue);
  color: white;
  box-shadow: 0 0 0 4px rgba(37,99,235,0.2);
}

.wizard-step.completed .step-number {
  background: #10b981;
  color: white;
}

.step-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.wizard-step.active .step-label {
  color: var(--text-primary);
}

.wizard-card {
  max-width: 700px;
  margin: 0 auto;
}

.wizard-content {
  animation: fadeIn 0.3s ease;
}

.wizard-content h3 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.wizard-content > p.text-muted {
  font-size: 15px;
  margin-bottom: 24px;
  color: var(--text-secondary);
  max-width: 720px;
  line-height: 1.75;
}

/* Category Selection */
.category-selection {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  grid-auto-rows: minmax(150px, auto);
  gap: 18px;
  margin-bottom: 24px;
}

.category-option {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 24px 30px 24px 22px;
  min-height: 150px;
  border: 2px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  cursor: pointer;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
  text-align: left;
}

.category-option:hover,
.category-option:focus-visible {
  border-color: var(--brand-blue);
  background: var(--bg-card-hover);
  box-shadow: 0 18px 35px rgba(15,23,42,0.12);
  transform: translateY(-1px);
}

.category-option.selected {
  border-color: rgba(37,99,235,0.75);
  background: rgba(37,99,235,0.12);
  box-shadow: 0 22px 50px rgba(37,99,235,0.14);
  transform: translateY(-2px);
}

.category-option:focus-visible {
  outline: 3px solid rgba(37,99,235,0.22);
  outline-offset: 4px;
}

.category-option-icon {
  font-size: 28px;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.08);
  border-radius: 18px;
  flex-shrink: 0;
}

.category-option.selected .category-option-icon {
  background: rgba(37,99,235,0.12);
}

.category-option-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.category-option-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.category-option-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 100%;
}

.category-option-check {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--brand-blue);
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease, background 0.25s ease;
}

.category-option.selected .category-option-check {
  opacity: 1;
  transform: scale(1.05);
  background: var(--brand-blue);
  color: white;
}

.category-option.selected .category-option-icon {
  background: rgba(37,99,235,0.12);
}

/* Priority Selection */
.priority-selection {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.priority-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  cursor: pointer;
  transition: all var(--transition);
}

.priority-option:hover {
  border-color: var(--brand-blue);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.priority-option.selected {
  border-color: var(--brand-blue);
  background: rgba(37,99,235,0.05);
  box-shadow: 0 0 0 1px var(--brand-blue);
}

.priority-option-icon {
  font-size: 28px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card-hover);
  border-radius: var(--radius-md);
}

.priority-option-info {
  flex: 1;
}

.priority-option-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.priority-option-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}

.priority-option-check {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--text-secondary);
  opacity: 0;
  transition: all var(--transition);
}

.priority-option.selected .priority-option-check {
  opacity: 1;
  background: var(--brand-blue);
  color: white;
}

/* Character Count */
.char-count {
  text-align: right;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.char-count span {
  font-weight: 600;
  color: var(--text-secondary);
}

/* Quick Templates */
.quick-templates {
  margin-top: 24px;
  padding: 20px;
  background: var(--bg-card-hover);
  border-radius: var(--radius-md);
}

.quick-templates label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  display: block;
}

.template-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.template-buttons .btn {
  flex: 1;
  min-width: 140px;
}

/* Wizard Navigation */
.wizard-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.wizard-nav .btn {
  min-width: 120px;
}

/* ---- TICKET LIST ---- */
.quick-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.quick-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.quick-filter:hover {
  border-color: var(--brand-blue);
  background: var(--bg-card-hover);
}

.quick-filter.active {
  border-color: var(--brand-blue);
  background: rgba(37,99,235,0.1);
  color: var(--brand-blue);
}

.qf-icon {
  font-size: 16px;
}

.qf-label {
  font-weight: 500;
}

.qf-count {
  background: var(--bg-card-hover);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.quick-filter.active .qf-count {
  background: var(--brand-blue);
  color: white;
}

.search-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.search-input-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 16px;
  font-size: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input-wrapper .search-input {
  padding-left: 44px;
  width: 100%;
}

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

.ticket-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
}

.ticket-row:hover {
  border-color: var(--brand-blue);
  background: var(--bg-card-hover);
  transform: translateX(4px);
}

.ticket-row-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
}

.ticket-row-priority {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-card-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.ticket-row-main {
  flex: 1;
  min-width: 0;
}

.ticket-row-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.ticket-row-code {
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-blue);
  font-family: monospace;
}

.ticket-row-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 6px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ticket-row-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.ticket-row-separator {
  opacity: 0.5;
}

.ticket-row-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.ticket-row-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
}

.ticket-row-actions {
  display: flex;
  gap: 4px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.btn-icon:hover {
  border-color: var(--brand-blue);
  color: var(--brand-blue);
  background: var(--bg-card-hover);
}

/* ---- DASHBOARD ---- */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.quick-action {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
}

.quick-action:hover {
  border-color: var(--brand-blue);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.qa-icon {
  font-size: 24px;
}

.qa-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.stat-card {
  cursor: pointer;
}

.stat-arrow {
  position: absolute;
  bottom: 16px;
  right: 16px;
  font-size: 20px;
  color: var(--text-muted);
  opacity: 0;
  transition: all var(--transition);
}

.stat-card:hover .stat-arrow {
  opacity: 1;
  transform: translateX(4px);
}

.empty-state-mini {
  text-align: center;
  padding: 40px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.empty-icon-mini {
  font-size: 48px;
  margin-bottom: 14px;
  opacity: 0.45;
}

.empty-state,
.error-state {
  text-align: center;
  padding: 44px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.empty-state h3,
.error-state h3 { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.empty-state p,
.error-state p { color: var(--text-muted); font-size: 14px; margin-top: 10px; }
.empty-state .btn,
.error-state .btn { margin-top: 22px; }

/* ---- TICKET DETAIL ---- */
.ticket-detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.ticket-detail-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--brand-blue);
  font-family: monospace;
  margin: 0;
}

.ticket-detail-title {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 8px 0;
  line-height: 1.3;
}

.ticket-detail-meta {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
}

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

.ticket-info-card {
  margin-bottom: 24px;
}

.ticket-info-section h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.ticket-description-text {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.ticket-pc-info {
  padding: 12px 16px;
  background: var(--bg-card-hover);
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--text-secondary);
}

.ticket-pc-info code {
  background: var(--bg-input);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: monospace;
  color: var(--brand-blue);
}

/* ---- CHAT ---- */
.chat-card {
  display: flex;
  flex-direction: column;
  max-height: 700px;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.chat-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.chat-count {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: var(--bg-card-hover);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  min-height: 300px;
  max-height: 400px;
}

.chat-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.chat-empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.4;
}

.chat-message {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  animation: fadeIn 0.3s ease;
}

.chat-message.own {
  flex-direction: row-reverse;
}

.chat-message.internal {
  opacity: 0.7;
}

.chat-message-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
}

.chat-message-content {
  flex: 1;
  max-width: 70%;
}

.chat-message-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.chat-message-author {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.chat-message-internal {
  font-size: 11px;
  padding: 2px 8px;
  background: var(--prio-critical);
  color: white;
  border-radius: 10px;
  font-weight: 600;
}

.chat-message-time {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: auto;
}

.chat-message-text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  padding: 12px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.chat-message.own .chat-message-text {
  background: var(--brand-blue);
  color: white;
  border-color: var(--brand-blue);
}

.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.quick-reply {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.quick-reply:hover {
  border-color: var(--brand-blue);
  color: var(--brand-blue);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

.chat-input-area {
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.chat-input-wrapper {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.chat-input-wrapper textarea {
  flex: 1;
  resize: none;
  min-height: 60px;
  max-height: 150px;
}

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

.chat-send-btn {
  min-width: auto;
}

.send-icon {
  font-size: 18px;
}

.chat-input-hint {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.hint-text {
  font-style: italic;
}

.char-counter {
  font-weight: 600;
}

/* ---- KEYBOARD SHORTCUTS ---- */
.shortcuts-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.shortcut-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-card-hover);
  border-radius: var(--radius-md);
}

.shortcut-keys {
  display: flex;
  gap: 4px;
  align-items: center;
}

.shortcut-keys kbd {
  padding: 4px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  box-shadow: 0 2px 0 var(--border);
}

.shortcut-desc {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ---- USERS ADMIN ---- */
.user-filters-bar {
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.filter-pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.filter-pill {
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition);
}
.filter-pill.active,
.filter-pill:hover {
  background: rgba(37,99,235,0.12);
  border-color: var(--brand-blue);
  color: var(--brand-blue);
}
.select-input {
  min-width: 220px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  transition: border-color var(--transition);
}
.select-input:focus {
  outline: none;
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
.users-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.user-profile-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}
.user-profile-card:hover {
  border-color: rgba(59,130,246,0.3);
  transform: translateY(-3px);
  box-shadow: 0 18px 42px rgba(0,0,0,0.08);
}
.user-profile-card.inactive { opacity: 0.78; }
.user-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.user-card-title {
  display: flex;
  align-items: center;
  gap: 14px;
}
.user-card-title h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}
.user-card-position {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}
.user-status {
  align-self: flex-start;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.status-active { background: rgba(16,185,129,0.14); color: var(--prio-low); }
.status-inactive { background: rgba(248,113,113,0.14); color: #f87171; }
.user-card-body {
  display: grid;
  gap: 12px;
}
.user-card-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  font-size: 14px;
  color: var(--text-secondary);
}
.user-card-meta span {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-card-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.users-footer {
  margin-top: 16px;
  text-align: center;
}
.user-card .btn {
  min-width: 120px;
}

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fadeOverlay 0.2s ease;
}
@keyframes fadeOverlay { from{opacity:0} to{opacity:1} }
.modal {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-xl);
  padding: 28px; width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg); animation: fadeInUp 0.3s ease;
}
.modal-lg { max-width: 640px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.modal-title { font-size: 18px; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 20px; padding: 4px; transition: color var(--transition); }
.modal-close:hover { color: var(--text-primary); }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }

/* ---- NOTIFICATIONS ---- */
.notif-list { display: flex; flex-direction: column; gap: 1px; }
.notif-item { padding: 14px 20px; display: flex; gap: 12px; align-items: flex-start; transition: background var(--transition); }
.notif-item:hover { background: var(--bg-card-hover); }
.notif-item.unread { border-left: 3px solid var(--brand-blue); }
.notif-item.read { border-left: 3px solid transparent; }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand-blue); margin-top: 5px; flex-shrink: 0; }
.notif-dot.read { background: var(--text-muted); }
.notif-content { flex: 1; }
.notif-title { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.notif-msg { font-size: 13px; color: var(--text-secondary); }
.notif-time { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ---- EMPTY STATE ---- */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-icon { font-size: 56px; margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 { font-size: 18px; font-weight: 600; color: var(--text-secondary); }
.empty-state p { color: var(--text-muted); font-size: 14px; margin-top: 6px; }
.empty-state .btn { margin-top: 20px; }

/* ---- ERROR STATE ---- */
.error-state { text-align: center; padding: 60px 20px; }
.error-icon { font-size: 56px; margin-bottom: 16px; opacity: 0.6; }
.error-state h3 { font-size: 18px; font-weight: 600; color: var(--text-secondary); }
.error-state p { color: var(--text-muted); font-size: 14px; margin-top: 6px; }
.error-state .btn { margin-top: 20px; }

/* ---- LOADING STATE ---- */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 16px;
}
.loading-state p {
  color: var(--text-secondary);
  font-size: 14px;
}

/* ---- TOAST ---- */
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  min-width: 280px; max-width: 380px; padding: 14px 18px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px;
  animation: slideInRight 0.3s ease;
  font-size: 14px; font-weight: 500;
  pointer-events: all;
}
@keyframes slideInRight { from{opacity:0;transform:translateX(20px)} to{opacity:1;transform:translateX(0)} }
.toast-success { border-left: 3px solid #10b981; }
.toast-error { border-left: 3px solid #ef4444; }
.toast-info { border-left: 3px solid var(--brand-orange); }

/* ---- SETUP PAGE ---- */
.setup-card { max-width: 460px; margin: 80px auto; }
.setup-card h2 { font-size: 24px; font-weight: 800; margin-bottom: 8px; }
.setup-card p { color: var(--text-muted); margin-bottom: 24px; }

/* ---- TICKET STATUS CONTROL (admin) ---- */
.status-control { display: flex; gap: 8px; flex-wrap: wrap; }
.status-btn { padding: 7px 14px; border-radius: 20px; border: 1px solid var(--border); background: transparent; color: var(--text-secondary); font-size: 13px; font-weight: 500; cursor: pointer; transition: all var(--transition); }
.status-btn:hover { border-color: var(--brand-orange); color: var(--brand-orange); }
.status-btn.current { background: rgba(242,107,33,0.1); border-color: var(--brand-orange); color: var(--brand-orange); }

/* ---- KB BLOG DESIGN ---- */
.kb-hero {
  background: linear-gradient(135deg, var(--brand-navy-dark) 0%, #162234 60%, rgba(242,107,33,0.08) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px 32px;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
.kb-hero h2 { font-size: 26px; font-weight: 800; margin-bottom: 6px; }
.kb-hero p  { color: var(--text-secondary); font-size: 15px; margin-bottom: 20px; }
.kb-search-bar {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-lg);
  padding: 12px 18px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.kb-search-bar:focus-within {
  border-color: var(--brand-orange);
  box-shadow: 0 0 0 3px rgba(242,107,33,0.15);
}
.kb-search-bar span { font-size: 18px; opacity: 0.6; }
.kb-search-bar input {
  background: none; border: none; outline: none;
  color: var(--text-primary); font-size: 15px; flex: 1;
  padding: 0;
}
.kb-search-bar input::placeholder { color: var(--text-muted); }

.kb-cats-bar {
  display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 24px; align-items: center;
}
.kb-cat-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 24px;
  border: 1px solid var(--border);
  background: transparent; color: var(--text-secondary);
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: all var(--transition);
}
.kb-cat-chip:hover { border-color: var(--brand-orange); color: var(--brand-orange); background: rgba(242,107,33,0.06); }
.kb-cat-chip.active { border-color: var(--brand-orange); color: var(--brand-orange); background: rgba(242,107,33,0.12); font-weight: 700; }
.kb-cat-chip .chip-count {
  background: rgba(255,255,255,0.1); color: var(--text-muted);
  font-size: 11px; font-weight: 700; padding: 1px 6px;
  border-radius: 10px; margin-left: 2px;
}
.kb-cat-chip.active .chip-count { background: rgba(242,107,33,0.2); color: var(--brand-orange); }

.kb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.kb-article-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  cursor: pointer;
  transition: all 0.22s ease;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  min-height: 160px;
}
.kb-article-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--brand-orange);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}
.kb-article-card:hover {
  border-color: rgba(242,107,33,0.35);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.12);
  background: var(--bg-card-hover);
}
.kb-article-card:hover::after {
  transform: scaleX(1);
}
.kb-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.kb-card-cat-icon {
  width: 36px; height: 36px; border-radius: var(--radius-md);
  background: rgba(242,107,33,0.12);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.kb-card-cat-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--brand-orange); opacity: 0.85;
}
.kb-card-title {
  font-size: 15px; font-weight: 700; line-height: 1.35;
  color: var(--text-primary); margin-bottom: 8px;
}
.kb-card-excerpt {
  font-size: 13px; color: var(--text-secondary); line-height: 1.55;
  flex: 1; display: -webkit-box; -webkit-line-clamp: 3;
  -webkit-box-orient: vertical; overflow: hidden;
}
.kb-card-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--border);
}
.kb-card-read-btn {
  display: flex; align-items: center; gap: 6px;
  color: var(--brand-orange); font-size: 13px; font-weight: 600;
  transition: gap 0.2s ease;
}
.kb-article-card:hover .kb-card-read-btn { gap: 8px; }
.kb-card-date { font-size: 11px; color: var(--text-muted); }

.kb-no-results {
  grid-column: 1 / -1;
  text-align: center; padding: 60px 20px;
}
.kb-no-results .empty-icon { font-size: 52px; opacity: 0.3; margin-bottom: 16px; }
.kb-no-results h3 { font-size: 18px; color: var(--text-secondary); font-weight: 600; }
.kb-no-results p { color: var(--text-muted); font-size: 14px; margin-top: 6px; }

/* KB Article Modal */
.kb-article-modal { max-width: 720px; }
.kb-article-hero {
  background: linear-gradient(135deg, rgba(27,58,92,0.5), rgba(242,107,33,0.06));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 24px;
  display: flex; align-items: center; gap: 16px;
}
.kb-article-hero-icon {
  width: 54px; height: 54px; border-radius: var(--radius-md);
  background: rgba(242,107,33,0.12);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; flex-shrink: 0;
}
.kb-article-hero-meta { flex: 1; }
.kb-article-hero-cat {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--brand-orange); margin-bottom: 4px;
}
.kb-article-hero-title { font-size: 20px; font-weight: 800; line-height: 1.3; }
.kb-article-content { font-size: 14px; line-height: 1.85; color: var(--text-secondary); }
.kb-article-content h2 {
  font-size: 16px; font-weight: 700; color: var(--text-primary);
  margin: 24px 0 10px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.kb-article-content h3 {
  font-size: 14px; font-weight: 700; color: var(--brand-orange);
  margin: 16px 0 8px; display: flex; align-items: center; gap: 6px;
}
.kb-article-content p { margin-bottom: 14px; }
.kb-article-content hr {
  border: none; border-top: 1px solid var(--border); margin: 26px 0;
}
.kb-article-content ul, .kb-article-content ol {
  padding-left: 22px; margin-bottom: 16px;
}
.kb-article-content li { margin-bottom: 10px; }
.kb-article-content strong { color: var(--text-primary); font-weight: 700; }
.kb-article-content code {
  background: rgba(148,163,184,0.12);
  color: var(--text-primary);
  padding: 3px 8px; border-radius: 6px; font-family: 'Courier New', monospace;
  font-size: 13px; border: 1px solid rgba(148,163,184,0.2);
}
.kb-article-content pre {
  background: rgba(15,23,42,0.95); border: 1px solid rgba(148,163,184,0.22);
  border-radius: var(--radius-lg); padding: 18px;
  overflow-x: auto; margin: 18px 0;
}
.kb-article-content pre code {
  background: none; border: none; padding: 0; color: #e2e8f0; font-size: 13px;
}
.kb-tip-box {
  background: rgba(59,130,246,0.08);
  border: 1px solid rgba(59,130,246,0.2);
  border-left: 4px solid var(--brand-blue);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin: 16px 0;
  font-size: 13px;
  color: var(--text-secondary);
}
.kb-tip-box strong { color: var(--brand-orange); }
.kb-warn-box {
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.25);
  border-left: 4px solid #ef4444;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin: 16px 0;
  font-size: 13px;
  color: var(--text-secondary);
}
.kb-step {
  display: flex; gap: 14px; align-items: flex-start; margin-bottom: 14px;
}
.kb-step-num {
  min-width: 28px; height: 28px; border-radius: 50%;
  background: var(--brand-orange); color: white;
  font-size: 13px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 1px;
}
.kb-step-body { flex: 1; font-size: 14px; color: var(--text-secondary); line-height: 1.6; }
.kb-step-body strong { color: var(--text-primary); }
.kb-featured-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(242,107,33,0.15); color: var(--brand-orange);
  font-size: 11px; font-weight: 700; padding: 3px 10px;
  border-radius: 20px; border: 1px solid rgba(242,107,33,0.3);
  margin-bottom: 20px;
}

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ---- KB GRID ---- */
.kb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.kb-category-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all 0.3s ease;
  display: grid;
  min-height: 320px;
}

.kb-category-card:hover {
  border-color: var(--brand-blue);
  transform: translateY(-2px);
}

.kb-category-header {
  padding: 20px;
  background: linear-gradient(135deg, var(--bg-card-hover), var(--bg-card));
  display: flex;
  align-items: center;
  gap: 15px;
  border-bottom: 1px solid var(--border);
}

.kb-category-icon {
  font-size: 32px;
}

.kb-category-header h3 {
  margin: 0;
  font-size: 18px;
  color: var(--text-primary);
}

.kb-category-header p {
  margin: 4px 0 0 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.kb-category-articles {
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kb-article-card {
  padding: 15px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.kb-article-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--brand-blue);
}

.kb-article-title {
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.4;
}

.kb-article-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-secondary);
}

.kb-article-date {
  opacity: 0.8;
}

.kb-article-featured {
  background: var(--brand-blue);
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}

.kb-article-views {
  opacity: 0.7;
  font-size: 11px;
}

.kb-article-summary {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 4px 0 8px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kb-article-add-btn {
  width: 100%;
  padding: 8px 15px;
  text-align: left;
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.kb-article-add-btn:hover {
  border-color: var(--brand-orange);
  color: var(--brand-orange);
  background: rgba(242,107,33,0.04);
}

/* Featured Section */
.kb-featured-section {
  margin: 16px 0 0;
}
.kb-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 12px;
}
.kb-featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.kb-featured-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  background: linear-gradient(135deg, var(--bg-card), var(--bg-card-hover));
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand-orange);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  width: 100%;
}
.kb-featured-card:hover {
  border-left-color: var(--brand-blue);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.kb-featured-icon { font-size: 24px; flex-shrink: 0; }
.kb-featured-body { flex: 1; min-width: 0; }
.kb-featured-cat { font-size: 10px; font-weight: 700; color: var(--brand-orange); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 2px; }
.kb-featured-title { font-size: 14px; font-weight: 600; color: var(--text-primary); line-height: 1.3; }
.kb-featured-summary { font-size: 12px; color: var(--text-secondary); margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kb-featured-arrow { color: var(--text-muted); font-size: 16px; flex-shrink: 0; }

/* KB Article Detail — Feedback & Summary */
.kb-article-summary-box {
  background: linear-gradient(135deg, rgba(59,130,246,0.08), rgba(99,102,241,0.08));
  border: 1px solid rgba(59,130,246,0.2);
  border-left: 3px solid var(--brand-blue);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-size: 14px;
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: 24px;
}

.kb-article-feedback {
  margin: 32px 0 20px;
  padding: 20px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-align: center;
}
.kb-article-feedback p {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0 0 12px;
  font-weight: 600;
}
.kb-feedback-buttons {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
.feedback-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.2);
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 6px;
}

.kb-article-footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  text-align: center;
}
.badge-warning {
  background: rgba(217,119,6,0.15);
  color: #d97706;
  border: 1px solid rgba(217,119,6,0.3);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.badge-error {
  background: rgba(239,68,68,0.12);
  color: #ef4444;
  border: 1px solid rgba(239,68,68,0.3);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.kb-article-detail {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px;
  margin-top: 20px;
  box-shadow: 0 18px 35px rgba(0,0,0,0.06);
}

.kb-article-header {
  margin-bottom: 28px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}

.kb-article-category {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(148,163,184,0.12);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.kb-article-header h1 {
  margin: 8px 0 12px;
  font-size: 30px;
  line-height: 1.15;
  color: var(--text-primary);
}

.kb-article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 13px;
  color: var(--text-secondary);
}

.kb-article-content {
  line-height: 1.85;
  color: var(--text-primary);
  font-size: 15px;
}

.kb-article-content h3,
.kb-article-content h4 {
  margin: 28px 0 14px;
  color: var(--text-primary);
  line-height: 1.3;
}

.kb-article-content h3 {
  font-size: 20px;
}

.kb-article-content h4 {
  font-size: 17px;
}

.kb-article-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 26px 0;
}

/* ---- TICKET GRID ---- */
.ticket-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.ticket-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.ticket-card:hover {
  border-color: var(--brand-blue);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.ticket-card-header {
  padding: 15px 20px;
  background: linear-gradient(135deg, var(--bg-card-hover), var(--bg-card));
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.ticket-code {
  font-weight: 600;
  color: var(--brand-blue);
  font-size: 14px;
}

.ticket-card-body {
  padding: 20px;
}

.ticket-title {
  margin: 0 0 15px 0;
  font-size: 16px;
  color: var(--text-primary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ticket-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.ticket-time {
  opacity: 0.8;
}

.ticket-category {
  opacity: 0.9;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); width: min(280px, 100%); max-width: 100%; box-shadow: 10px 0 40px rgba(0,0,0,0.24); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: block; }
  .main-wrapper { margin-left: 0; }
  .menu-toggle { display: flex; }
  .content { padding: 16px; }
  .form-row { grid-template-columns: 1fr; }
  .search-input-wrapper { min-width: 0; }
  .search-input { width: 100%; }
  input, textarea, select, button { font-size: 16px; }
  .topbar { padding: 0 12px; }
  .topbar-left, .topbar-right { align-items: center; }
  .breadcrumb { min-width: 0; word-break: break-word; }
  .menu-toggle { width: 46px; height: 46px; border-radius: 12px; }
  .sidebar-nav { max-height: calc(100vh - 180px); overflow-y: auto; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .modal { max-width: 100%; padding: 20px; margin: 16px; }
  .users-grid { grid-template-columns: 1fr; }
  .kb-grid { grid-template-columns: 1fr; }
  .ticket-grid { grid-template-columns: 1fr; }
  .kb-article-detail { padding: 20px; }
  .kb-article-header h1 { font-size: 22px; }
  
  .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .page-header h2 { font-size: 22px; }
  .filters-bar { flex-direction: column; }
  .search-input { width: 100%; }
  .filter-btn { width: 100%; text-align: center; }
  
  .card { padding: 20px; }
  .stat-card { padding: 20px; }
  .stat-icon { font-size: 28px; }
  .stat-number { font-size: 32px; }
  
  .ticket-card-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .ticket-card-body { padding: 16px; }
  .ticket-title { font-size: 15px; }
  
  .chat-messages { padding: 16px; gap: 16px; }
  .msg-avatar { width: 32px; height: 32px; }
  .msg-bubble { padding: 12px 14px; font-size: 14px; }
  .chat-input-area { padding: 16px; }
  .chat-input { padding: 10px 14px; font-size: 14px; }
  
  .category-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .category-btn { padding: 12px 8px; font-size: 13px; }
  .category-btn .cat-icon { font-size: 22px; }
  
  .links-grid { grid-template-columns: 1fr; }
  .links-list { flex-direction: column; }
  
  .topbar { padding: 0 16px; }
  .topbar-right { gap: 8px; }
  .notif-btn span { display: none; }
  .theme-toggle { padding: 6px; font-size: 18px; }
  
  .user-item { flex-direction: column; align-items: flex-start; gap: 12px; }
  .user-list-actions { width: 100%; flex-wrap: wrap; }
  .user-list-actions button { flex: 1; min-width: 120px; }
  
  .content { position: relative; z-index: 1; }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .sidebar { width: 240px; }
  .sidebar.collapsed { width: 0; }
  .main-wrapper { margin-left: 240px; }
  .main-wrapper.sidebar-collapsed { margin-left: 0; }
  .content { padding: 24px; }
  
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .users-grid { grid-template-columns: repeat(2, 1fr); }
  .kb-grid { grid-template-columns: repeat(2, 1fr); }
  .ticket-grid { grid-template-columns: repeat(2, 1fr); }
  
  .page-header h2 { font-size: 24px; }
  .card { padding: 24px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .stat-card { padding: 16px; }
  .stat-icon { font-size: 24px; }
  .stat-number { font-size: 28px; }
  
  .page-header h2 { font-size: 20px; }
  .page-header p { font-size: 14px; }
  .page-header { flex-direction: column; align-items: flex-start; }
  
  .filters-bar { gap: 8px; }
  .filter-btn { padding: 8px 14px; font-size: 13px; }
  
  .card { padding: 16px; }
  .card-header { margin-bottom: 16px; }
  
  .btn { padding: 10px 16px; font-size: 14px; }
  .btn-sm { padding: 6px 12px; font-size: 12px; }
  
  .category-grid { grid-template-columns: 1fr; }
  
  .modal { padding: 16px; margin: 12px; }
  .modal-header { margin-bottom: 16px; }
  .modal-footer { flex-direction: column; }
  .modal-footer button { width: 100%; }
  
  .login-card { padding: 28px 20px; }
  .kb-category-header { padding: 15px; }
  .kb-category-icon { font-size: 24px; }
  .ticket-card-header { padding: 12px 15px; }
  .ticket-card-body { padding: 15px; }
}

/* ---- UX/UI ENHANCEMENTS ---- */
:root {
  --surface-elevated: rgba(255,255,255,0.04);
  --surface-strong: rgba(255,255,255,0.08);
  --focus-ring: rgba(37,99,235,0.22);
  --shadow-card: 0 18px 45px rgba(2, 8, 23, 0.22);
}

body {
  background:
    radial-gradient(ellipse at top left, rgba(37,99,235,0.15), transparent 28%),
    radial-gradient(ellipse at bottom right, rgba(242,107,33,0.12), transparent 26%),
    var(--bg-page);
  transition: background-color var(--transition), color var(--transition);
}

#app { min-height: 100vh; }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-5);
  border-bottom: 1px solid var(--border);
}

.page-header-intro { display: flex; flex-direction: column; gap: 6px; }
.page-header h2 {
  font-size: clamp(1.35rem, 2vw, 1.8rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.page-header p {
  margin: 0;
  font-size: 0.96rem;
  color: var(--text-muted);
}
.page-header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.card {
  animation: fadeInUp 0.3s ease both;
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.015));
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}

.section-card,
.surface-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}

.content { max-width: 1480px; margin: 0 auto; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
[data-theme="light"] .topbar { background: rgba(248, 250, 252, 0.9); }

.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}
.quick-action {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 18px;
  min-height: 104px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, rgba(37,99,235,0.12), rgba(255,255,255,0.03));
  color: var(--text-primary);
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.quick-action:hover {
  transform: translateY(-2px);
  border-color: rgba(37,99,235,0.25);
  box-shadow: var(--shadow-sm);
}
.quick-action:active {
  transform: translateY(0);
}
.qa-icon {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: rgba(255,255,255,0.08);
  font-size: 20px;
}
.qa-label { font-size: 0.95rem; font-weight: 700; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}
.stat-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 20px 22px;
  background: linear-gradient(135deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  min-height: 132px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(37,99,235,0.2);
  box-shadow: var(--shadow-md);
}
.stat-number {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.stat-label {
  color: var(--text-secondary);
  font-size: 0.94rem;
}
.stat-arrow { font-size: 1rem; color: var(--text-muted); align-self: flex-end; }

.ticket-row,
.kb-article-card,
.user-list-card,
.link-card,
.download-item,
.notif-item,
.announcement-item {
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.ticket-row:hover,
.kb-article-card:hover,
.user-list-card:hover,
.link-card:hover,
.download-item:hover,
.notif-item:hover,
.announcement-item:hover {
  transform: translateY(-1px);
  border-color: rgba(37,99,235,0.2);
  box-shadow: var(--shadow-sm);
}

.links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}
.link-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 22px;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.link-card:hover {
  transform: translateY(-2px);
  border-color: rgba(37,99,235,0.25);
  box-shadow: 0 16px 34px rgba(0,0,0,0.06);
}
.link-card-link {
  display: grid;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}
.link-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: rgba(37,99,235,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}
.link-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}
.link-category {
  font-size: 13px;
  color: var(--text-secondary);
}
.link-card-link {
  min-height: 170px;
  display: grid;
  gap: 12px;
}
.link-card .link-delete {
  justify-self: start;
  padding: 10px 14px;
}
.downloads-list {
  display: grid;
  gap: 16px;
}
.download-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  min-height: 96px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 18px 20px;
}
.download-info {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.download-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}
.download-meta {
  color: var(--text-secondary);
  font-size: 13px;
}
.download-item .btn-secondary {
  white-space: nowrap;
}
.announcement-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 22px;
  display: grid;
  gap: 16px;
  border-left-width: 4px;
}
.announcement-item.low { border-left-color: var(--prio-low); }
.announcement-item.medium { border-left-color: var(--prio-medium); }
.announcement-item.high { border-left-color: var(--prio-high); }
.announcement-item.critical { border-left-color: var(--prio-critical); }
.announcement-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.announcement-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}
.announcement-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.announcement-body {
  color: var(--text-secondary);
  line-height: 1.75;
  white-space: pre-wrap;
}
.announcement-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-muted);
}

.search-bar,
.filters-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}
.search-input-wrapper,
.search-wrap {
  flex: 1 1 240px;
  position: relative;
}
.search-input {
  width: 100%;
  min-height: 46px;
  padding-left: 46px;
  border-radius: 999px;
}
.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.quick-filter,
.filter-btn {
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  padding: 9px 14px;
  border-radius: 999px;
  font-weight: 600;
}
.quick-filter.active,
.filter-btn.active {
  background: rgba(37,99,235,0.14);
  color: var(--text-primary);
  border-color: rgba(37,99,235,0.25);
}

.empty-state,
.error-state,
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 280px;
  text-align: center;
  padding: var(--space-6);
  border: 1px dashed var(--border);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.02));
}
.empty-icon,
.error-icon,
.loading-icon {
  width: 56px;
  height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: rgba(37,99,235,0.14);
  font-size: 24px;
}
.empty-state h3,
.error-state h3,
.loading-state h3 { font-size: 1.1rem; }
.empty-state p,
.error-state p,
.loading-state p { margin: 0; color: var(--text-muted); max-width: 460px; }

.modal-overlay {
  background: rgba(2,8,23,0.7);
  backdrop-filter: blur(10px);
}
.modal {
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  background: var(--bg-card);
  max-width: 560px;
  animation: fadeInUp 0.24s ease both;
}
.modal-body { display: flex; flex-direction: column; gap: 12px; }
.modal .form-group { margin-bottom: 14px; }
.modal .form-group label { margin-bottom: 8px; }
.modal .form-row { gap: 12px; }
.modal .modal-footer { gap: 10px; }
.modal-header { margin-bottom: var(--space-4); }
.modal-title { font-size: 1.05rem; font-weight: 700; }
.modal-footer { margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--border); }

.toast-container { z-index: 9999; }
.toast {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  background: var(--bg-card);
  color: var(--text-primary);
  animation: slideInRight 0.24s ease both;
}
.toast-success { border-left: 4px solid var(--status-resolved); }
.toast-error { border-left: 4px solid var(--prio-high); }
.toast-info { border-left: 4px solid var(--brand-blue); }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.summary-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.03);
}
.summary-label {
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.summary-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}
.chat-card {
  padding: 0;
  overflow: hidden;
}
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.025);
}
.chat-messages {
  max-height: 560px;
  overflow: auto;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,0.018), transparent);
}
.chat-message {
  display: flex;
  gap: 10px;
  animation: fadeInUp 0.24s ease both;
}
.chat-message.own {
  justify-content: flex-end;
}
.chat-message.own .chat-message-content {
  background: rgba(37,99,235,0.14);
  border-color: rgba(37,99,235,0.26);
}
.chat-message-content {
  max-width: min(82%, 720px);
  padding: 12px 14px;
  border-radius: 16px 16px 16px 8px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
}
.chat-message.own .chat-message-content {
  border-radius: 16px 16px 8px 16px;
}
.chat-message-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.chat-message-author {
  font-weight: 700;
  color: var(--text-primary);
}
.chat-message-time {
  color: var(--text-muted);
  font-size: 0.74rem;
}
.chat-input-area {
  border-top: 1px solid var(--border);
  padding: 16px 20px 20px;
  background: rgba(255,255,255,0.025);
}
.chat-input-wrapper {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.chat-input-wrapper textarea {
  min-height: 96px;
  border-radius: var(--radius-lg);
}
.chat-send-btn { min-width: 118px; }
.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 20px 16px;
}
.quick-reply {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255,255,255,0.03);
  color: var(--text-secondary);
  padding: 8px 12px;
  transition: border-color var(--transition), color var(--transition), transform var(--transition);
}
.quick-reply:hover {
  border-color: rgba(37,99,235,0.25);
  color: var(--text-primary);
  transform: translateY(-1px);
}
.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition), border-color var(--transition), background-color var(--transition);
}
.btn-icon:hover {
  transform: translateY(-1px);
  border-color: rgba(37,99,235,0.25);
  background: rgba(37,99,235,0.12);
}
.badge,
.status-pill,
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(37,99,235,0.12);
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 700;
}

@media (max-width: 1024px) {
  .content { padding: 24px; }
  .page-header { flex-direction: column; }
  .page-header-actions { width: 100%; }
}

@media (max-width: 768px) {
  .content { padding: 16px; }
  .page-header { gap: 12px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .quick-actions { grid-template-columns: 1fr 1fr; }
  .card { padding: 18px; }
}

@media (max-width: 480px) {
  .stats-grid,
  .quick-actions { grid-template-columns: 1fr; }
  .page-header h2 { font-size: 1.2rem; }
  .card { padding: 16px; }
  .btn { width: 100%; }
  .page-header-actions { width: 100%; }
  .page-header-actions .btn { width: auto; }
}

/* ============================================================
   DOCUMENTOS & SGQ (ISO 9001) STYLES
   ============================================================ */

.doc-areas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.doc-area-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-primary);
}

.doc-area-card:hover,
.doc-area-card.active {
  border-color: var(--brand-blue);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.doc-area-icon {
  font-size: 2rem;
  background: rgba(37, 99, 235, 0.12);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  flex-shrink: 0;
}

.doc-area-info h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.doc-area-info p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  line-height: 1.3;
}

.doc-area-count {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--brand-blue-light);
}

.doc-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.doc-table th {
  padding: 12px 16px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.doc-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.9rem;
  vertical-align: middle;
}

.doc-table-row:hover {
  background: rgba(255, 255, 255, 0.02);
}

.doc-badge-code {
  font-family: monospace;
  font-weight: 700;
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  color: var(--text-primary);
}

.doc-badge-code-lg {
  font-family: monospace;
  font-weight: 700;
  font-size: 0.95rem;
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid var(--brand-blue);
  color: var(--brand-blue-light);
  padding: 4px 10px;
  border-radius: 8px;
}

.badge-revision {
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(242, 107, 33, 0.15);
  color: var(--brand-orange);
  padding: 3px 8px;
  border-radius: 6px;
}

.doc-type-tag {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
}

.doc-type-tag.type-pdf { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.doc-type-tag.type-text { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.doc-type-tag.type-link { background: rgba(16, 185, 129, 0.15); color: #34d399; }

.badge-ack-ok {
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
}

.badge-ack-pending {
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
}

.doc-link-title {
  background: none;
  border: none;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.95rem;
  text-align: left;
  cursor: pointer;
  padding: 0;
}

.doc-link-title:hover {
  color: var(--brand-blue-light);
  text-decoration: underline;
}

.doc-desc-preview {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  max-width: 380px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-viewer-card {
  margin-top: 16px;
  padding: 0;
  overflow: hidden;
}

.doc-viewer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
}

.doc-viewer-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.doc-viewer-security-tag {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--brand-orange);
  background: rgba(242, 107, 33, 0.1);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(242, 107, 33, 0.3);
}

.doc-viewer-body {
  padding: 24px;
  min-height: 480px;
}

.doc-text-content {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-primary);
  max-width: 800px;
}

.doc-text-content h1,
.doc-text-content h2,
.doc-text-content h3 {
  margin-top: 18px;
  margin-bottom: 10px;
}

.doc-link-box {
  display: flex;
  align-items: center;
  gap: 20px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.doc-link-icon {
  font-size: 3rem;
}

.doc-pdf-wrapper {
  position: relative;
  width: 100%;
  height: 750px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #1e1e1e;
}

.doc-watermark-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-30deg);
  font-size: 1.1rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.08);
  pointer-events: none;
  user-select: none;
  z-index: 10;
  text-align: center;
  width: 100%;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.doc-pdf-frame {
  width: 100%;
  height: 100%;
  border: none;
}

.doc-acknowledgement-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: rgba(37, 99, 235, 0.08);
  border-top: 1px solid var(--border);
}

.doc-type-selector {
  display: flex;
  gap: 12px;
  margin-top: 6px;
}

.radio-card {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 500;
}

.radio-card input {
  cursor: pointer;
}

/* SVG Icons Standardization */
.svg-icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  transition: transform var(--transition), color var(--transition);
}

.icon .svg-icon {
  color: var(--text-muted);
}

.input-icon .svg-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.nav-item .svg-icon {
  margin-right: 10px;
  color: var(--text-secondary);
}

.nav-item.active .svg-icon {
  color: var(--brand-blue);
}

.btn .svg-icon {
  margin-right: 6px;
}

.btn-icon .svg-icon {
  margin-right: 0;
}

/* Documentos & SGQ 4-Areas Grid (Responsive 4 -> 2 -> 1) */
.doc-areas-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 1080px) {
  .doc-areas-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .doc-areas-grid {
    grid-template-columns: 1fr;
  }
}

.doc-area-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 155px;
  padding: 18px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.doc-area-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--brand-blue);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.doc-area-card.active {
  background: rgba(37, 99, 235, 0.08);
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
}

.doc-area-card-top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 12px;
}

.doc-area-icon {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: var(--radius-md);
  background: rgba(37, 99, 235, 0.12);
  color: var(--brand-blue);
  display: flex;
  align-items: center;
  justify-content: center;
}

.doc-area-info h3 {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-primary);
  margin: 0 0 4px 0;
  word-break: normal;
  overflow-wrap: break-word;
}

.doc-area-info p {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin: 0;
}

.doc-area-count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--brand-blue);
  margin-top: auto;
  padding-top: 8px;
}

/* Multi-Step Wizard Modal */
.wizard-steps {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  gap: 8px;
  overflow-x: auto;
}

.wizard-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.wizard-step.active {
  color: var(--brand-blue);
}

.wizard-step.completed {
  color: var(--success);
}

.wizard-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--border);
  color: var(--text-primary);
  font-size: 0.75rem;
  font-weight: 700;
}

.wizard-step.active .wizard-step-num {
  background: var(--brand-blue);
  color: #ffffff;
}

.wizard-step.completed .wizard-step-num {
  background: var(--success);
  color: #ffffff;
}

.wizard-pane {
  padding: 20px;
  display: none;
}

.wizard-pane.active {
  display: block;
  animation: fadeIn 0.2s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.wizard-nav-btns {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}

/* Print Security Protection for ISO 9001 Controlled Documents */
@media print {
  body * {
    visibility: hidden !important;
  }
  body::before {
    content: "DOCUMENTO CONTROLADO - IMPRESSÃO NÃO AUTORIZADA PELO SISTEMA SGQ USIMABE.";
    visibility: visible !important;
    display: block !important;
    font-size: 1.5rem !important;
    color: red !important;
    text-align: center !important;
    margin-top: 100px !important;
  }
}


