/* ==========================================================================
   THREE VISTAS - CLIENT TICKET PORTAL STYLESHEET
   Brand Colors:
   Primary: #000000 | Accent: #E1FF05 | Background: #F7F7F5
   White: #FFFFFF   | Text: #111111   | Secondary Text: #666666
   ========================================================================== */

:root {
  --color-primary: #000000;
  --color-accent: #E1FF05;
  --color-bg: #F7F7F5;
  --color-white: #FFFFFF;
  --color-text: #111111;
  --color-text-muted: #666666;
  --color-border: #E5E5E5;
  --color-border-dark: #111111;
  --color-hover-bg: #f0f0eb;

  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12);
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* RESET & BASE */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* UTILITY CLASSES */
.hidden {
  display: none !important;
}

/* Zero-Flash Auth Session Handling (Eliminates login flicker on refresh) */
html.auth-session-active #loginView,
html.auth-session-active #adminLoginView {
  display: none !important;
}

html.auth-session-active #dashboardView:not(.hidden) {
  display: flex !important;
}

html.auth-session-active #adminDashboardView:not(.hidden) {
  display: block !important;
}

.text-right {
  text-align: right;
}

/* ==========================================================================
   1. AUTHENTICATION / LOGIN SCREEN
   ========================================================================== */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-primary);
  padding: 24px;
}

.auth-card {
  background-color: var(--color-white);
  width: 100%;
  max-width: 450px;
  padding: 40px 32px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-logo-container {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
  background-color: var(--color-primary);
  padding: 16px;
  border-radius: var(--radius-md);
}

.auth-logo {
  height: 36px;
  width: auto;
  object-fit: contain;
}

.auth-header {
  text-align: center;
  margin-bottom: 28px;
}

.auth-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 6px;
}

.auth-header p {
  font-size: 14px;
  color: var(--color-text-muted);
}

.auth-form .form-group {
  margin-bottom: 20px;
}

.form-group label,
.step-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.step-label-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.step-label-header .step-label {
  margin-bottom: 0;
}

.btn-add-site-trigger {
  background-color: #F4F4F0;
  border: 1px solid var(--color-border);
  color: var(--color-primary);
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.btn-add-site-trigger:hover {
  background-color: var(--color-accent);
  border-color: var(--color-primary);
  transform: translateY(-1px);
}

.form-group input,
.select-wrapper select,
textarea {
  width: 100%;
  padding: 12px 14px;
  font-family: var(--font-family);
  font-size: 14px;
  color: var(--color-text);
  background-color: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.form-group input:focus,
.select-wrapper select:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
}

.form-group input:disabled,
.select-wrapper select:disabled,
textarea:disabled {
  background-color: #F3F4F6;
  color: #6B7280;
  cursor: not-allowed;
  opacity: 0.7;
}

/* ALERTS */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  margin-bottom: 20px;
  font-weight: 500;
  text-align: center;
}

.alert-error {
  background-color: #FEE2E2;
  color: #991B1B;
  border: 1px solid #FCA5A5;
}

/* ==========================================================================
   2. SLIM BLACK HEADER
   ========================================================================== */
.dashboard-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-header {
  background-color: var(--color-primary);
  color: var(--color-white);
  height: 64px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-left {
  display: flex;
  align-items: center;
}

.header-logo {
  height: 28px;
  width: auto;
  object-fit: contain;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.client-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--color-accent);
  color: var(--color-primary);
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.5px;
}

.client-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-white);
}

.btn-logout {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--color-white);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.btn-logout:hover {
  background-color: var(--color-accent);
  color: var(--color-primary);
  border-color: var(--color-accent);
}

/* ==========================================================================
   3. MAIN CONTENT LAYOUT
   ========================================================================== */
.main-content {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 64px;
  flex: 1;
}

/* WELCOME SECTION */
.welcome-section {
  margin-bottom: 24px;
}

.welcome-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 4px;
  letter-spacing: -0.3px;
}

.welcome-subtitle {
  font-size: 15px;
  color: var(--color-text-muted);
}

/* NOTIFICATION BANNER */
.notification-banner {
  background-color: var(--color-primary);
  color: var(--color-white);
  border-left: 4px solid var(--color-accent);
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.notification-content {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

.notification-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background-color: var(--color-accent);
  color: var(--color-primary);
  font-weight: 800;
  font-size: 12px;
}

.btn-close-notif {
  background: none;
  border: none;
  color: var(--color-white);
  font-size: 20px;
  cursor: pointer;
  opacity: 0.7;
}

.btn-close-notif:hover {
  opacity: 1;
  color: var(--color-accent);
}

/* PORTAL GRID */
.portal-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 28px;
  align-items: start;
  margin-bottom: 40px;
}

/* CARDS */
.card {
  background-color: var(--color-white);
  border-radius: var(--radius-md);
  padding: 32px;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

.card-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--color-border);
}

/* REQUEST FORM STYLING */
.request-form .form-step {
  margin-bottom: 28px;
}

.step-number {
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 700;
  margin-right: 6px;
}

.select-wrapper {
  position: relative;
}

.select-wrapper::after {
  content: '▼';
  font-size: 10px;
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--color-text-muted);
}

.select-wrapper select {
  appearance: none;
  cursor: pointer;
  padding-right: 36px;
}

/* URGENCY CARDS GRID */
.urgency-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.urgency-card {
  position: relative;
  border: 1px solid var(--color-border);
  background-color: var(--color-white);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.urgency-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.urgency-content {
  display: flex;
  flex-direction: column;
}

.urgency-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.urgency-desc {
  font-size: 12px;
  color: var(--color-text-muted);
  line-height: 1.3;
}

/* SELECTED STATE FOR URGENCY CARD (MATCHING REQUIREMENTS EXPLICITLY) */
.urgency-card.selected {
  background-color: var(--color-accent) !important;
  border-color: var(--color-primary) !important;
  box-shadow: 0 0 0 1px var(--color-primary);
}

.urgency-card.selected .urgency-title,
.urgency-card.selected .urgency-desc {
  color: var(--color-primary) !important;
}

.urgency-card:hover:not(.selected) {
  border-color: var(--color-primary);
  background-color: var(--color-hover-bg);
}

/* FILE DROPZONE */
.file-dropzone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-sm);
  padding: 24px;
  text-align: center;
  background-color: #FAFAFA;
  cursor: pointer;
  transition: var(--transition);
}

.file-dropzone:hover,
.file-dropzone.dragover {
  border-color: var(--color-primary);
  background-color: #F4F4F0;
}

.file-input-hidden {
  display: none;
}

.dropzone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--color-text-muted);
  font-size: 13px;
}

.dropzone-content svg {
  color: var(--color-text);
}

.browse-link {
  color: var(--color-primary);
  text-decoration: underline;
}

.file-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
}

.btn-remove-file {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--color-text-muted);
}

.btn-remove-file:hover {
  color: #DC2626;
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 600;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

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

.btn-primary:hover {
  background-color: #222222;
}

.btn-accent {
  background-color: var(--color-accent);
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}

.btn-accent:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-secondary {
  background-color: #F4F4F0;
  color: var(--color-primary);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  background-color: var(--color-border);
}

.btn-block {
  width: 100%;
}

.btn-large {
  width: 100%;
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}

.btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* HOW IT WORKS CARD */
.how-it-works-card {
  padding: 24px;
  border: 1px solid var(--color-border);
}

.how-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
}

.steps-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.how-step {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.how-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: var(--color-primary);
  color: var(--color-accent);
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.how-step-body strong {
  display: block;
  font-size: 14px;
  color: var(--color-text);
  margin-bottom: 2px;
}

.how-step-body p {
  font-size: 13px;
  color: var(--color-text-muted);
  line-height: 1.4;
}

/* ==========================================================================
   4. RECENT REQUESTS SECTION
   ========================================================================== */
.recent-requests-section {
  margin-top: 12px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.section-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text);
}

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

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

.search-box-wrapper svg {
  position: absolute;
  left: 10px;
  color: var(--color-text-muted);
  pointer-events: none;
}

.search-box-wrapper input {
  padding: 7px 12px 7px 32px;
  font-size: 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  width: 200px;
  transition: var(--transition);
  background-color: var(--color-white);
}

.search-box-wrapper input:focus {
  width: 240px;
  border-color: var(--color-primary);
  outline: none;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.06);
}

.status-filter-select {
  padding: 7px 12px;
  font-size: 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background-color: var(--color-white);
  color: var(--color-text);
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: var(--transition);
}

.status-filter-select:focus,
.status-filter-select:hover {
  border-color: var(--color-primary);
}

.btn-refresh {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.btn-refresh:hover {
  background-color: var(--color-hover-bg);
  border-color: var(--color-primary);
}

.table-card-container {
  background-color: var(--color-white);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

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

.tickets-table th {
  background-color: #FAFAFA;
  padding: 14px 20px;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--color-border);
}

.tickets-table td {
  padding: 16px 20px;
  font-size: 14px;
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.tickets-table tr:last-child td {
  border-bottom: none;
}

.tickets-table tr:hover td {
  background-color: #FCFCFA;
}

.ticket-id-cell {
  font-weight: 700;
  font-family: monospace;
}

.req-cell {
  max-width: 320px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.req-category-tag {
  display: inline-block;
  background-color: #F1F5F9;
  color: #0F172A;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  margin-right: 6px;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border: 1px solid #CBD5E1;
}

.req-text-body {
  vertical-align: middle;
}

/* BADGES */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

/* STATUS BADGES */
.badge-status-new {
  background-color: #E0F2FE;
  color: #0369A1;
}

.badge-status-in-progress {
  background-color: #FEF3C7;
  color: #92400E;
}

.badge-status-in-qa {
  background-color: #E0E7FF;
  color: #3730A3;
}

.badge-status-waiting-for-client {
  background-color: #FEE2E2;
  color: #991B1B;
}

.badge-status-completed {
  background-color: #DCFCE7;
  color: #166534;
}

.badge-status-closed {
  background-color: #F3F4F6;
  color: #4B5563;
}

/* URGENCY BADGES */
.urgency-subtle {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
}

.urgency-subtle-high,
.urgency-subtle-critical {
  color: #B91C1C;
  font-weight: 700;
}

.btn-view-ticket {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  color: var(--color-primary);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-view-ticket:hover {
  background-color: var(--color-accent);
  border-color: var(--color-primary);
}

/* MOBILE RESPONSIVE CARDS (GRID/CONTAINER) */
.mobile-tickets-grid {
  display: none;
  padding: 16px;
  flex-direction: column;
  gap: 16px;
}

.ticket-card-mobile {
  background-color: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mobile-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mobile-ticket-id {
  font-family: monospace;
  font-weight: 700;
  font-size: 15px;
}

.mobile-card-body p {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
}

.mobile-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--color-text-muted);
}

.mobile-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid var(--color-border);
}

/* EMPTY & LOADING STATES */
.empty-state,
.tickets-loading {
  padding: 48px 24px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 14px;
}

.spinner-dark {
  width: 24px;
  height: 24px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}

/* ==========================================================================
   5. TICKET DETAIL MODAL
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-card {
  background-color: var(--color-white);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalScale 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-card-sm {
  max-width: 440px;
}

@keyframes modalScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-header {
  background-color: var(--color-primary);
  color: var(--color-white);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-ticket-id {
  font-size: 18px;
  font-weight: 700;
  font-family: monospace;
}

.btn-modal-close {
  background: none;
  border: none;
  color: var(--color-white);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
  opacity: 0.8;
}

.btn-modal-close:hover {
  opacity: 1;
  color: var(--color-accent);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.ticket-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  background-color: var(--color-bg);
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

.meta-item {
  display: flex;
  flex-direction: column;
}

.meta-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.meta-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
}

.modal-section h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.description-box {
  background-color: #FAFAFA;
  border: 1px solid var(--color-border);
  padding: 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: #F4F4F0;
  border: 1px solid var(--color-border);
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-primary);
  text-decoration: none;
  transition: var(--transition);
}

a.attachment-chip:hover {
  background-color: var(--color-accent);
  border-color: var(--color-primary);
  color: var(--color-primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.outbound-icon {
  margin-left: 4px;
  opacity: 0.7;
}

a.attachment-chip:hover .outbound-icon {
  opacity: 1;
}

/* COMMENTS THREAD */
.comments-section {
  border-top: 1px solid var(--color-border);
  padding-top: 20px;
}

.comments-stream {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 4px;
}

/* MODERN CHAT TIMELINE STREAM */
.detail-comments-stream {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-height: 520px;
  overflow-y: auto;
  padding: 8px 12px 12px 4px;
  margin-bottom: 24px;
}

.comment-item {
  display: flex;
  gap: 12px;
  width: 100%;
  align-items: flex-start;
}

.comment-item.admin-msg {
  flex-direction: row;
}

.comment-item.client-msg {
  flex-direction: row-reverse;
}

/* AVATARS */
.comment-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  flex-shrink: 0;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
  user-select: none;
}

.admin-msg .comment-avatar {
  background: #000000;
  color: #E1FF05;
  border: 1.5px solid #000000;
}

.client-msg .comment-avatar {
  background: #F1F5F9;
  color: #0F172A;
  border: 1.5px solid #CBD5E1;
}

/* CONTENT WRAPPER */
.comment-content-wrapper {
  max-width: 80%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-msg .comment-content-wrapper {
  align-items: flex-start;
}

.client-msg .comment-content-wrapper {
  align-items: flex-end;
}

/* HEADER & SENDER INFO */
.comment-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.client-msg .comment-header {
  flex-direction: row-reverse;
}

.sender-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.client-msg .sender-info {
  flex-direction: row-reverse;
}

.sender-name {
  font-weight: 700;
  color: #0F172A;
  font-size: 13px;
}

.role-pill {
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 12px;
  letter-spacing: 0.5px;
}

.role-pill.pill-admin {
  background: #000000;
  color: #E1FF05;
}

.role-pill.pill-client {
  background: #E2E8F0;
  color: #475569;
}

.comment-time {
  color: #94A3B8;
  font-size: 11.5px;
  font-weight: 500;
}

/* BUBBLE BODY CARD */
.comment-body-card {
  padding: 13px 16px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.admin-msg .comment-body-card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-top-left-radius: 4px;
  color: #1E293B;
  border-left: 4px solid #000000;
}

.client-msg .comment-body-card {
  background: #18181B;
  color: #FFFFFF;
  border-top-right-radius: 4px;
  border: 1px solid #27272A;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.add-comment-form {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.add-comment-form textarea {
  flex: 1;
  resize: none;
}

/* ==========================================================================
   6. RESPONSIVE BREAKPOINTS
   ========================================================================== */

/* TABLET (max-width: 900px) */
@media (max-width: 900px) {
  .portal-grid {
    grid-template-columns: 1fr;
  }

  .how-it-works-card {
    order: 2;
  }
}

/* MOBILE (max-width: 640px) */
@media (max-width: 640px) {
  .main-header {
    height: 56px;
  }

  .header-container {
    padding: 0 16px;
  }

  .client-name {
    display: none;
  }

  .main-content {
    padding: 20px 16px 40px;
  }

  .welcome-title {
    font-size: 20px;
  }

  .card {
    padding: 20px 16px;
  }

  .urgency-grid {
    grid-template-columns: 1fr;
  }

  /* Transform Recent Requests table into responsive cards */
  .tickets-table {
    display: none;
  }

  .mobile-tickets-grid {
    display: flex;
  }

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

  .modal-backdrop {
    padding: 12px;
  }

  .modal-card {
    max-height: 95vh;
  }

  .modal-body {
    padding: 16px;
  }

  .comment-bubble.admin,
  .comment-bubble.client {
    width: 100%;
  }
}

/* ==========================================================================
   DEDICATED TICKET DETAIL & MESSAGING VIEW STYLES
   ========================================================================== */

.btn-back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-back-link:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.4);
  color: var(--color-accent);
}

.ticket-detail-header {
  margin-bottom: 24px;
}

.ticket-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

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

.simple-back-link {
  color: var(--color-text-muted);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.2s ease;
  white-space: nowrap;
}

.simple-back-link:hover {
  color: #000000;
  text-decoration: underline;
}

.ticket-id-badge-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.ticket-id-large {
  font-size: 26px;
  font-weight: 800;
  color: var(--color-text);
  letter-spacing: -0.5px;
}

.ticket-header-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--color-text-muted);
}

.meta-dot {
  color: var(--color-border);
}

/* EMAIL SYNC BANNER */
.email-sync-banner {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-left: 4px solid #000000;
  border-radius: 8px;
  padding: 14px 18px;
}

.sync-banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: #334155;
  line-height: 1.5;
}

.sync-banner-content svg {
  flex-shrink: 0;
  color: #0F172A;
}

/* DUAL PANEL GRID */
.ticket-detail-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: start;
}

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

.card-title-sm {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text);
  margin: 0;
}

.activity-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-muted);
  background: var(--color-background);
  padding: 4px 10px;
  border-radius: 20px;
}

.btn-sync-emails {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #F1F5F9;
  border: 1px solid #CBD5E1;
  color: #0F172A;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-sync-emails:hover {
  background: #000000;
  color: #E1FF05;
  border-color: #000000;
}

.btn-sync-emails.spinning svg {
  animation: spinSync 1s linear infinite;
}

@keyframes spinSync {
  100% {
    transform: rotate(360deg);
  }
}

/* DETAIL COMMENTS STREAM */
.detail-comments-stream {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 480px;
  overflow-y: auto;
  padding-right: 8px;
  margin-bottom: 24px;
}

.detail-comment-form .composer-wrapper {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #FAFAFA;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 16px;
}

.detail-comment-form textarea {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  background: #FFFFFF;
}

.detail-comment-form textarea:focus {
  outline: none;
  border-color: #000000;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.composer-hint {
  font-size: 12px;
  color: var(--color-text-muted);
}

/* SIDEBAR CARDS */
.sidebar-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sidebar-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
}

.info-group {
  margin-bottom: 18px;
}

.info-group:last-child {
  margin-bottom: 0;
}

.info-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.info-value-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.category-badge {
  background: #000000;
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 4px;
}

.subtype-badge {
  background: var(--color-background);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
}

.description-body-box {
  background: #FAFAFA;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 14px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--color-text);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 300px;
  overflow-y: auto;
}

.attachment-chip-large {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #FAFAFA;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  text-decoration: none;
  color: var(--color-text);
  transition: all 0.2s ease;
}

.attachment-chip-large:hover {
  background: #000000;
  color: #FFFFFF;
  border-color: #000000;
}

.attachment-chip-large:hover .attachment-subtext {
  color: var(--color-accent);
}

.attachment-filename {
  display: block;
  font-size: 13px;
  font-weight: 700;
  word-break: break-all;
}

.attachment-subtext {
  display: block;
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

@media (max-width: 900px) {
  .ticket-detail-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   SUPERADMIN DASHBOARD DESIGN SYSTEM
   ========================================================================== */
.admin-header-bg {
  background-color: #000000;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 16px 24px;
}

.admin-logo-box {
  background-color: #ffffff;
  padding: 6px 14px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.admin-logo-box img {
  height: 26px;
  width: auto;
}

.admin-tab-nav {
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  padding: 0 1.5rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.admin-tab-btn {
  background: transparent;
  border: none;
  font-size: 0.9rem;
  font-weight: 700;
  color: #64748B;
  padding: 1rem 1.25rem;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.admin-tab-btn:hover {
  color: #0F172A;
}

.admin-tab-btn.active {
  color: #000000;
  border-bottom-color: #E1FF05;
}

.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.admin-stat-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.03), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.admin-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.06);
}

.admin-stat-card .stat-label {
  font-size: 0.75rem;
  color: #64748B;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.admin-stat-card .stat-value {
  font-size: 2.25rem;
  font-weight: 800;
  color: #0F172A;
  margin-top: 0.4rem;
  letter-spacing: -0.02em;
}

.admin-card-container {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 1.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.03);
}

.admin-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 0.5rem;
}

.admin-table th {
  background: #F8FAFC;
  color: #475569;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 2px solid #E2E8F0;
  white-space: nowrap;
}

.admin-table th:first-child {
  border-top-left-radius: 8px;
}

.admin-table th:last-child {
  border-top-right-radius: 8px;
}

.admin-table td {
  padding: 14px 16px;
  vertical-align: middle;
  border-bottom: 1px solid #F1F5F9;
  font-size: 0.85rem;
  white-space: nowrap;
}

.admin-table tr:hover td {
  background-color: #F8FAFC;
}

.admin-input {
  background-color: #ffffff;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 0.9rem;
  font-family: inherit;
  color: #0F172A;
  transition: all 0.2s ease;
}

.admin-input:focus {
  outline: none;
  border-color: #000000;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

.admin-select {
  background-color: #ffffff;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 0.9rem;
  font-family: inherit;
  color: #0F172A;
  cursor: pointer;
  transition: all 0.2s ease;
}

.admin-select:focus {
  outline: none;
  border-color: #000000;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

.admin-btn-action {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.admin-btn-edit {
  background: #0F172A;
  color: #FFFFFF;
  border-color: #0F172A;
}

.admin-btn-edit:hover {
  background: #1E293B;
  color: #FFFFFF;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.admin-btn-deactivate {
  background: #DC2626;
  color: #FFFFFF;
  border-color: #DC2626;
}

.admin-btn-deactivate:hover {
  background: #B91C1C;
  color: #FFFFFF;
  box-shadow: 0 2px 4px rgba(220, 38, 38, 0.25);
}

.admin-btn-activate {
  background: #059669;
  color: #FFFFFF;
  border-color: #059669;
}

.admin-btn-activate:hover {
  background: #047857;
  color: #FFFFFF;
  box-shadow: 0 2px 4px rgba(5, 150, 105, 0.25);
}

.status-badge-active {
  background: #DEF7EC;
  color: #03543F;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 9999px;
  display: inline-block;
}

.status-badge-inactive {
  background: #F3F4F6;
  color: #4B5563;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 9999px;
  display: inline-block;
}

/* ==========================================================================
   PASSWORD HIDE / SHOW TOGGLE ICON
   ========================================================================== */
.password-input-container {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.password-input-container input {
  padding-right: 2.4rem !important;
  width: 100%;
}

.password-toggle-btn {
  position: absolute;
  right: 0.4rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: #64748B;
  padding: 0.25rem 0.45rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.15s ease;
  user-select: none;
  z-index: 5;
}

.password-toggle-btn:hover {
  color: #0F172A;
  background: rgba(0, 0, 0, 0.06);
}

.btn-ticket-count-pill:hover {
  background: #1D4ED8 !important;
  color: #FFFFFF !important;
  border-color: #1E40AF !important;
  box-shadow: 0 2px 5px rgba(37, 99, 235, 0.3);
}

/* ==========================================================================
   STATUS & URGENCY BADGE COLOR STYLES
   ========================================================================== */
.badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
  font-size: 0.63rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.2;
}

/* Status Badges */
.badge-new {
  background-color: #EFF6FF !important;
  color: #1D4ED8 !important;
  border: 1px solid #BFDBFE !important;
}

.badge-progress {
  background-color: #F0FDF4 !important;
  color: #15803D !important;
  border: 1px solid #BBF7D0 !important;
}

.badge-qa {
  background-color: #FEF3C7 !important;
  color: #B45309 !important;
  border: 1px solid #FDE68A !important;
}

.badge-approval {
  background-color: #FFF7ED !important;
  color: #C2410C !important;
  border: 1px solid #FFEDD5 !important;
}

.badge-completed {
  background-color: #DCFCE7 !important;
  color: #166534 !important;
  border: 1px solid #86EFAC !important;
}

.badge-closed {
  background-color: #F1F5F9 !important;
  color: #475569 !important;
  border: 1px solid #CBD5E1 !important;
}

/* Urgency Badges */
.urgency-badge-high {
  background-color: #FEF2F2 !important;
  color: #B91C1C !important;
  border: 1px solid #FCA5A5 !important;
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
  font-size: 0.63rem;
  font-weight: 700;
}

.urgency-badge-normal {
  background-color: #F8FAFC !important;
  color: #475569 !important;
  border: 1px solid #E2E8F0 !important;
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
  font-size: 0.63rem;
  font-weight: 700;
}

/* ==========================================================================
   MODAL OVERLAY & DIALOG POPUP DESIGN
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1.5rem;
  overflow-y: auto;
}

.modal-overlay.hidden {
  display: none !important;
}

.modal-card {
  background-color: #ffffff;
  border-radius: 16px;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  border: 1px solid #E2E8F0;
  overflow: hidden;
  animation: modalPopIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  margin: auto;
  padding: 0;
}

@keyframes modalPopIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(12px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  background-color: #000000;
  color: #ffffff;
  padding: 1.1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0;
}

.modal-close {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.25rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: #E1FF05;
  color: #000000;
}

.modal-card form {
  padding: 1.25rem 1.5rem 1.5rem 1.5rem;
  overflow-y: auto;
  flex: 1;
}