/* ============================================
   WorkDesk – Light Theme
   BG: #FFFFFF | Nav: #524B48 | Btn: #00B5AD
   Full Mobile Responsive
   ============================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #F4F6F8;       /* page background */
  --bg-white:  #FFFFFF;       /* card / panel white */
  --nav:       #524B48;       /* sidebar & topbar */
  --nav-dark:  #3D3835;       /* sidebar hover / active */
  --nav-text:  #E8E3E0;       /* sidebar text */
  --nav-muted: #A89F9B;       /* sidebar muted */
  --primary:   #00B5AD;       /* teal – main accent */
  --primary-d: #009990;       /* teal dark – hover */
  --primary-lt:#E6F7F7;       /* teal light – bg tint */
  --border:    #DDE1E7;       /* card border */
  --text:      #1A1A2E;       /* main text */
  --text2:     #4A5568;       /* secondary text */
  --text3:     #718096;       /* muted text */
  --green:     #27AE60;
  --orange:    #E67E22;
  --red:       #E53E3E;
  --purple:    #7B2D8B;
  --yellow:    #D4A017;
  --sidebar-w: 250px;
  --topbar-h:  58px;
  --radius:    10px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow:    0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.14);
}

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--nav);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 300;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  overflow: hidden;
  box-shadow: 2px 0 12px rgba(0,0,0,0.15);
}

.sidebar-header {
  padding: 0 16px;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--nav-dark);
  flex-shrink: 0;
}

.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo-icon {
  width: 36px; height: 36px; flex-shrink: 0;
  background: var(--primary);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  box-shadow: 0 2px 8px rgba(0,181,173,0.4);
}
.logo-name { font-size: 15px; font-weight: 800; color: #fff; display: block; letter-spacing: -0.3px; }
.logo-sub  { font-size: 9.5px; color: var(--nav-muted); display: block; text-transform: uppercase; letter-spacing: 1px; }

.sidebar-close {
  display: none;
  background: none; border: none; color: var(--nav-muted);
  cursor: pointer; font-size: 20px; padding: 4px;
  border-radius: 4px; line-height: 1;
}
.sidebar-close:hover { color: #fff; background: rgba(255,255,255,0.1); }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

.nav-section-label {
  font-size: 9px; font-weight: 800; letter-spacing: 1.8px;
  text-transform: uppercase; color: var(--nav-muted);
  padding: 14px 8px 5px;
}

.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 8px;
  color: var(--nav-text); text-decoration: none;
  font-size: 13.5px; font-weight: 500;
  transition: all 0.18s; margin-bottom: 2px;
  position: relative;
}
.nav-item:hover { background: rgba(255,255,255,0.1); color: #fff; }
.nav-item.active {
  background: var(--primary);
  color: #fff; font-weight: 700;
  box-shadow: 0 2px 8px rgba(0,181,173,0.4);
}
.nav-item.active .nav-icon { color: #fff; }
.nav-icon { font-size: 16px; width: 22px; text-align: center; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--red); color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 10px;
}

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.user-pill {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px;
  background: rgba(255,255,255,0.07);
  text-decoration: none;
  transition: background 0.2s;
}
.user-pill:hover { background: rgba(255,255,255,0.12); }
.user-avatar {
  width: 34px; height: 34px; flex-shrink: 0;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; color: #fff;
  border: 2px solid rgba(255,255,255,0.2);
}
.user-name { font-size: 13px; font-weight: 700; color: #fff; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: 10px; color: var(--nav-muted); display: block; }
.user-info { flex: 1; min-width: 0; }

.logout-link {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; border-radius: 8px; margin-top: 4px;
  color: var(--nav-muted); text-decoration: none;
  font-size: 13px; font-weight: 500;
  transition: all 0.18s;
}
.logout-link:hover { background: rgba(229,62,62,0.15); color: #ff8a8a; }

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

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex; flex-direction: column;
  min-height: 100vh; min-width: 0;
  transition: margin-left 0.3s cubic-bezier(0.4,0,0.2,1);
}

/* ============================================
   TOPBAR
   ============================================ */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  height: var(--topbar-h);
  background: var(--nav);
  gap: 12px; flex-shrink: 0;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.topbar-left  { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.mobile-toggle {
  display: none;
  background: rgba(255,255,255,0.1); border: none;
  border-radius: 7px; color: #fff;
  cursor: pointer; font-size: 18px;
  padding: 7px 9px; line-height: 1; flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}
.mobile-toggle:hover { background: rgba(255,255,255,0.2); }

.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--nav-muted); overflow: hidden; }
.bc-sep { color: rgba(255,255,255,0.2); flex-shrink: 0; }
.bc-current { color: #fff; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.topbar-search {
  display: flex; align-items: center; gap: 0;
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px; padding: 0 12px; height: 36px;
  transition: background 0.2s;
}
.topbar-search:focus-within { background: rgba(255,255,255,0.18); border-color: var(--primary); }
.topbar-search input {
  background: none; border: none; outline: none;
  color: #fff; font-size: 13px; width: 180px;
  font-family: inherit;
}
.topbar-search input::placeholder { color: var(--nav-muted); }
.topbar-search span { color: var(--nav-muted); font-size: 14px; }

/* Notification bell */
.notif-wrapper { position: relative; }
.notif-btn {
  position: relative; background: rgba(255,255,255,0.1);
  border: none; border-radius: 8px;
  color: #fff; cursor: pointer; padding: 8px 10px;
  font-size: 16px; transition: background 0.15s; line-height: 1;
  -webkit-tap-highlight-color: transparent;
}
.notif-btn:hover { background: rgba(255,255,255,0.2); }
.notif-badge {
  position: absolute; top: -3px; right: -3px;
  background: var(--red); color: #fff;
  font-size: 9px; font-weight: 800;
  min-width: 16px; height: 16px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px; border: 2px solid var(--nav);
}

.topbar-avatar {
  width: 34px; height: 34px; flex-shrink: 0;
  background: var(--primary); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 800;
  text-decoration: none; border: 2px solid rgba(255,255,255,0.25);
  transition: transform 0.2s, border-color 0.2s;
}
.topbar-avatar:hover { transform: scale(1.08); border-color: var(--primary); }

/* Notif dropdown */
.notif-dropdown {
  position: absolute; top: calc(100% + 10px); right: 0;
  width: 340px; max-width: calc(100vw - 20px);
  background: var(--bg-white); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-lg);
  display: none; z-index: 400; overflow: hidden;
}
.notif-dropdown.open { display: block; animation: dropIn 0.18s ease; }
@keyframes dropIn { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:translateY(0); } }
.notif-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  font-size: 13.5px; font-weight: 700; color: var(--text);
}
.notif-header a { color: var(--primary); text-decoration: none; font-weight: 500; font-size: 12px; }
.notif-list { max-height: 320px; overflow-y: auto; }
.notif-item {
  display: flex; gap: 10px; padding: 12px 16px;
  border-bottom: 1px solid var(--border); cursor: pointer;
  transition: background 0.15s; text-decoration: none;
}
.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: var(--primary-lt); }
.notif-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.notif-msg  { font-size: 12.5px; color: var(--text); line-height: 1.45; font-weight: 500; }
.notif-time { font-size: 11px; color: var(--text3); margin-top: 3px; }
.notif-empty { padding: 28px; text-align: center; color: var(--text3); font-size: 13px; }

/* ============================================
   PAGE BODY
   ============================================ */
.page-body { padding: 24px; flex: 1; min-width: 0; }

.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 24px; gap: 12px; flex-wrap: wrap;
}
.page-title    { font-size: 22px; font-weight: 800; color: var(--text); margin-bottom: 3px; letter-spacing: -0.3px; }
.page-subtitle { font-size: 13px; color: var(--text3); }
.page-actions  { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ============================================
   STAT CARDS
   ============================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-white);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; position: relative; overflow: hidden;
  transition: transform 0.18s, box-shadow 0.18s;
  box-shadow: var(--shadow-sm);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card::after {
  content: ''; position: absolute;
  top: 0; left: 0; right: 0; height: 3px; border-radius: var(--radius) var(--radius) 0 0;
}
.stat-card.teal::after   { background: var(--primary); }
.stat-card.green::after  { background: var(--green); }
.stat-card.orange::after { background: var(--orange); }
.stat-card.red::after    { background: var(--red); }
.stat-card.purple::after { background: var(--purple); }

.stat-icon-wrap {
  width: 42px; height: 42px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; margin-bottom: 14px;
}
.stat-card.teal   .stat-icon-wrap { background: var(--primary-lt); }
.stat-card.green  .stat-icon-wrap { background: rgba(39,174,96,0.1); }
.stat-card.orange .stat-icon-wrap { background: rgba(230,126,34,0.1); }
.stat-card.red    .stat-icon-wrap { background: rgba(229,62,62,0.1); }
.stat-card.purple .stat-icon-wrap { background: rgba(123,45,139,0.1); }

.stat-value { font-size: 32px; font-weight: 800; color: var(--text); line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: 12px; color: var(--text3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px; }
.stat-sub   { font-size: 11px; color: var(--text3); margin-top: 6px; }

/* ============================================
   CARDS
   ============================================ */
.card {
  background: var(--bg-white); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-sm); margin-bottom: 16px;
}
.card:last-child { margin-bottom: 0; }
.card-header {
  padding: 15px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 14px; font-weight: 700; color: var(--text);
  flex-wrap: wrap; gap: 8px; background: var(--bg-white);
}
.card-body { padding: 20px; }

/* ============================================
   MOBILE TICKET CARDS (key feature)
   ============================================ */
.ticket-card-mobile {
  background: var(--bg-white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  margin-bottom: 10px; box-shadow: var(--shadow-sm);
  display: none; /* shown only on mobile via media query */
  text-decoration: none; color: inherit;
  transition: box-shadow 0.18s, transform 0.15s;
  border-left: 4px solid var(--border);
}
.ticket-card-mobile:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.ticket-card-mobile.priority-critical { border-left-color: var(--red); }
.ticket-card-mobile.priority-high     { border-left-color: var(--orange); }
.ticket-card-mobile.priority-medium   { border-left-color: var(--yellow); }
.ticket-card-mobile.priority-low      { border-left-color: var(--green); }
.ticket-card-mobile.is-overdue        { background: rgba(229,62,62,0.04); }

.tcm-top    { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.tcm-no     { font-size: 11px; font-weight: 700; color: var(--primary); font-family: monospace; }
.tcm-title  { font-size: 14px; font-weight: 700; color: var(--text); line-height: 1.35; margin-bottom: 6px; }
.tcm-meta   { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.tcm-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.tcm-assignee { font-size: 12px; color: var(--text3); display: flex; align-items: center; gap: 5px; }
.tcm-due    { font-size: 12px; color: var(--text3); }
.tcm-due.overdue  { color: var(--red); font-weight: 700; }
.tcm-due.due-soon { color: var(--orange); font-weight: 700; }

/* ============================================
   DATA TABLE
   ============================================ */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  padding: 11px 14px; text-align: left;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--text3);
  background: #F8FAFC; border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); color: var(--text2); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg); }
.data-table td a { color: var(--text); text-decoration: none; font-weight: 600; }
.data-table td a:hover { color: var(--primary); }

/* ============================================
   BADGES
   ============================================ */
.badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.4px; white-space: nowrap;
}
.badge-low      { background: rgba(39,174,96,0.12);  color: var(--green); }
.badge-medium   { background: rgba(212,160,23,0.12); color: var(--yellow); }
.badge-high     { background: rgba(230,126,34,0.14); color: var(--orange); }
.badge-critical { background: rgba(229,62,62,0.14);  color: var(--red); border: 1px solid rgba(229,62,62,0.3); animation: pulse-badge 2s infinite; }

@keyframes pulse-badge {
  0%,100% { box-shadow: 0 0 0 0 rgba(229,62,62,0.3); }
  50%      { box-shadow: 0 0 0 4px rgba(229,62,62,0); }
}

.status-badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.4px; white-space: nowrap;
}
.status-open     { background: rgba(0,181,173,0.12); color: var(--primary); }
.status-progress { background: rgba(123,45,139,0.12); color: var(--purple); }
.status-hold     { background: rgba(230,126,34,0.12); color: var(--orange); }
.status-resolved { background: rgba(39,174,96,0.12);  color: var(--green); }
.status-closed   { background: rgba(113,128,150,0.12); color: var(--text3); }

/* ============================================
   FORMS
   ============================================ */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--text2); margin-bottom: 6px;
}
.form-control {
  width: 100%; padding: 10px 13px;
  background: var(--bg-white); border: 1.5px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 13.5px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none; -webkit-appearance: none; appearance: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,181,173,0.12); }
.form-control::placeholder { color: #A0AEC0; }
textarea.form-control { min-height: 110px; resize: vertical; }
select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23718096'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 32px; cursor: pointer;
}
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-hint  { font-size: 11.5px; color: var(--text3); margin-top: 5px; }
.form-check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13.5px; color: var(--text2); padding: 4px 0; }
.form-check input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--primary); cursor: pointer; }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: 8px;
  font-size: 13.5px; font-weight: 700; cursor: pointer;
  border: 1.5px solid transparent; text-decoration: none;
  transition: all 0.18s; white-space: nowrap;
  font-family: 'Plus Jakarta Sans', sans-serif; line-height: 1.2;
  -webkit-tap-highlight-color: transparent;
  letter-spacing: 0.1px;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--primary); color: #fff; border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(0,181,173,0.35);
}
.btn-primary:hover { background: var(--primary-d); border-color: var(--primary-d); box-shadow: 0 4px 12px rgba(0,181,173,0.45); }

.btn-outline { background: var(--bg-white); color: var(--text2); border-color: var(--border); }
.btn-outline:hover { background: var(--bg); border-color: var(--text3); color: var(--text); }

.btn-danger  { background: var(--bg-white); color: var(--red); border-color: rgba(229,62,62,0.3); }
.btn-danger:hover  { background: rgba(229,62,62,0.06); border-color: var(--red); }

.btn-success { background: var(--bg-white); color: var(--green); border-color: rgba(39,174,96,0.3); }
.btn-success:hover { background: rgba(39,174,96,0.06); border-color: var(--green); }

.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 6px; }
.btn-lg { padding: 12px 24px; font-size: 15px; border-radius: 10px; }
.btn-block { width: 100%; justify-content: center; }

/* ============================================
   FILTER BAR
   ============================================ */
.filter-bar {
  background: var(--bg-white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  display: flex; gap: 10px; flex-wrap: wrap;
  align-items: center; margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.filter-bar .form-control { width: auto; min-width: 0; flex: 1; min-width: 130px; }
.search-input { min-width: 200px; flex: 2; }

/* ============================================
   TICKET DETAIL
   ============================================ */
.ticket-detail-grid { display: grid; grid-template-columns: 1fr 310px; gap: 20px; align-items: start; }
.ticket-meta-grid   { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.meta-item label { display: block; color: var(--text3); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 4px; }
.meta-item .meta-val { color: var(--text); font-weight: 600; font-size: 13.5px; }

.comment-thread { display: flex; flex-direction: column; gap: 14px; }
.comment-item   { display: flex; gap: 11px; }
.comment-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800;
}
.comment-body {
  flex: 1; min-width: 0; background: #F8FAFC;
  border: 1px solid var(--border); border-radius: 0 10px 10px 10px; padding: 12px 14px;
}
.comment-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.comment-author { font-weight: 700; font-size: 13px; color: var(--text); }
.comment-time   { font-size: 11px; color: var(--text3); }
.comment-internal { font-size: 10.5px; color: var(--orange); background: rgba(230,126,34,0.1); padding: 1px 7px; border-radius: 10px; font-weight: 700; }
.comment-text   { font-size: 13.5px; color: var(--text2); line-height: 1.65; white-space: pre-wrap; word-break: break-word; }

.history-list { display: flex; flex-direction: column; }
.history-item { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 12px; color: var(--text3); }
.history-item:last-child { border-bottom: none; }
.history-dot  { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); flex-shrink: 0; margin-top: 3px; }
.history-text { flex: 1; min-width: 0; word-break: break-word; color: var(--text2); }
.history-time { white-space: nowrap; flex-shrink: 0; }

/* ============================================
   ALERTS
   ============================================ */
.alert { padding: 13px 16px; border-radius: 8px; font-size: 13.5px; margin-bottom: 16px; border: 1px solid; display: flex; align-items: flex-start; gap: 10px; }
.alert-success { background: rgba(39,174,96,0.08);  border-color: rgba(39,174,96,0.25);  color: #1E7A40; }
.alert-error   { background: rgba(229,62,62,0.08);  border-color: rgba(229,62,62,0.25);  color: #C53030; }
.alert-info    { background: rgba(0,181,173,0.08);  border-color: rgba(0,181,173,0.25);  color: #087F8C; }
.alert-warning { background: rgba(230,126,34,0.08); border-color: rgba(230,126,34,0.25); color: #C05621; }

/* ============================================
   PAGINATION
   ============================================ */
.pagination { display: flex; gap: 4px; align-items: center; margin-top: 20px; flex-wrap: wrap; }
.pagination a, .pagination span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 36px; height: 36px; padding: 0 8px;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 13px; text-decoration: none; color: var(--text2);
  background: var(--bg-white); transition: all 0.15s;
}
.pagination a:hover { background: var(--primary-lt); border-color: var(--primary); color: var(--primary); }
.pagination .active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 700; }

/* ============================================
   OVERDUE / DUE-SOON
   ============================================ */
.row-overdue td { background: rgba(229,62,62,0.04) !important; }
.row-overdue td a { color: var(--red) !important; }
.text-overdue { color: var(--red) !important; font-weight: 700; }
.text-due-soon { color: var(--orange) !important; font-weight: 700; }

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-page {
  min-height: 100vh; display: flex; align-items: center;
  justify-content: center; padding: 20px; width: 100%;
  background: linear-gradient(135deg, var(--nav) 0%, #6B6460 100%);
}
.login-card {
  background: var(--bg-white); border-radius: 16px;
  padding: 40px 36px; width: 100%; max-width: 420px;
  box-shadow: var(--shadow-lg);
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo .logo-icon { width: 56px; height: 56px; font-size: 26px; border-radius: 14px; margin: 0 auto 14px; box-shadow: 0 4px 16px rgba(0,181,173,0.4); }
.login-logo h1 { font-size: 24px; font-weight: 800; color: var(--text); }
.login-logo p  { color: var(--text3); font-size: 13.5px; margin-top: 4px; }
.login-demo {
  text-align: center; margin-top: 20px; padding: 12px;
  background: var(--bg); border-radius: 8px; border: 1px solid var(--border);
  font-size: 12px; color: var(--text3); line-height: 1.8;
}

/* ============================================
   CHARTS
   ============================================ */
.chart-container {
  position: relative; height: 200px;
  display: flex; align-items: flex-end;
  gap: 8px; padding: 20px 0 30px;
}
.chart-bar {
  flex: 1; background: rgba(0,181,173,0.15);
  border-radius: 4px 4px 0 0; border: 1px solid rgba(0,181,173,0.3);
  position: relative; transition: background 0.2s; cursor: pointer; min-width: 30px;
}
.chart-bar:hover { background: rgba(0,181,173,0.3); }
.chart-bar-label { position: absolute; bottom: -24px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--text3); white-space: nowrap; }
.chart-bar-value { position: absolute; top: -20px; left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 700; color: var(--primary); }

/* ============================================
   UTILITIES
   ============================================ */
.text-muted { color: var(--text3); }
.text-sm    { font-size: 12px; }
.fw-700     { font-weight: 700; }
.ticket-no  { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--primary); font-weight: 700; }
.d-flex     { display: flex; align-items: center; gap: 8px; }
.mb-4       { margin-bottom: 16px; }
.tag {
  display: inline-block; padding: 3px 9px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 20px; font-size: 11.5px; color: var(--text3); font-weight: 500;
}
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.empty-state {
  text-align: center; padding: 48px 24px; color: var(--text3);
}
.empty-state .es-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.empty-state .es-title { font-size: 16px; font-weight: 700; color: var(--text2); margin-bottom: 8px; }
.empty-state .es-msg { font-size: 13.5px; line-height: 1.6; }

/* Role banner */
.role-banner {
  background: var(--primary-lt); border: 1px solid rgba(0,181,173,0.25);
  border-radius: 8px; padding: 10px 14px;
  font-size: 12.5px; color: #087F8C; font-weight: 600;
  margin-bottom: 16px; display: flex; align-items: center; gap: 8px;
}

/* Progress bar */
.progress { height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 3px; background: var(--primary); transition: width 0.5s ease; }

/* ============================================
   TABLET (≤ 1024px)
   ============================================ */
@media (max-width: 1024px) {
  :root { --sidebar-w: 220px; }
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .ticket-detail-grid { grid-template-columns: 1fr 270px; }
  .page-body { padding: 18px; }
}

/* ============================================
   MOBILE (≤ 768px) — Full Single-Column UX
   ============================================ */
@media (max-width: 768px) {

  /* --- Layout --- */
  .sidebar { transform: translateX(-100%); width: min(280px, 80vw); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: flex; }
  .main-content { margin-left: 0 !important; }
  .mobile-toggle { display: flex; }

  /* --- Topbar --- */
  .topbar { padding: 0 14px; height: 52px; }
  .topbar-search { display: none; } /* hidden on mobile, use filter instead */

  /* --- Page --- */
  .page-body { padding: 14px 12px; }
  .page-header { flex-direction: column; align-items: stretch; gap: 10px; margin-bottom: 14px; }
  .page-title  { font-size: 18px; }
  .page-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
  .page-actions .btn { justify-content: center; font-size: 13px; padding: 10px 8px; }

  /* --- Stats: 2 col on mobile --- */
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
  .stat-card  { padding: 14px 12px; }
  .stat-icon-wrap { width: 36px; height: 36px; font-size: 17px; margin-bottom: 10px; }
  .stat-value { font-size: 26px; }
  .stat-label { font-size: 10.5px; }
  .stat-sub   { display: none; }

  /* --- TICKETS: hide table, show cards on mobile --- */
  .data-table-wrap { display: none; }
  .ticket-card-mobile { display: block; }

  /* --- Filter bar stacks --- */
  .filter-bar { flex-direction: column; align-items: stretch; padding: 12px; gap: 8px; }
  .filter-bar .form-control { width: 100%; min-width: 0; flex: none; }
  .search-input { min-width: 0; width: 100%; flex: none; }
  .filter-bar .btn { width: 100%; justify-content: center; }

  /* --- Forms --- */
  .form-row, .form-row-3 { grid-template-columns: 1fr; gap: 12px; }

  /* --- Cards --- */
  .card-header { padding: 13px 14px; font-size: 13px; }
  .card-body   { padding: 14px; }

  /* --- Ticket detail stacks --- */
  .ticket-detail-grid { grid-template-columns: 1fr; gap: 14px; }
  .ticket-meta-grid   { grid-template-columns: 1fr 1fr; gap: 10px; }

  /* --- Comment avatars smaller --- */
  .comment-avatar { width: 28px; height: 28px; font-size: 11px; }
  .comment-body   { padding: 10px 12px; }
  .comment-text   { font-size: 13px; }

  /* --- Login --- */
  .login-card { padding: 28px 20px; }

  /* --- Notif dropdown --- */
  .notif-dropdown { right: -10px; width: 300px; }

  /* --- Table still visible in admin pages --- */
  .admin-table .table-wrap { overflow-x: auto; }
  .admin-table .data-table { min-width: 480px; }
}

/* ============================================
   SMALL PHONES (≤ 480px)
   ============================================ */
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card  { padding: 12px 10px; }
  .stat-value { font-size: 22px; }
  .stat-icon-wrap { width: 30px; height: 30px; font-size: 14px; margin-bottom: 8px; }

  .page-body  { padding: 10px; }
  .page-title { font-size: 16px; }

  .topbar { padding: 0 10px; }
  .breadcrumb { display: none; }

  .login-card { padding: 22px 16px; }
  .login-logo h1 { font-size: 20px; }

  .notif-dropdown { right: -60px; max-width: 95vw; }

  .ticket-meta-grid { grid-template-columns: 1fr; }

  .tcm-title { font-size: 13.5px; }

  .page-actions { grid-template-columns: 1fr; }

  .card-header { flex-direction: column; align-items: flex-start; }
}
