/* ==========================================================================
   VINH PHUC MEDIA CRM DESIGN SYSTEM & PALETTE
   ========================================================================== */

:root {
  /* Colors */
  --bg-base: #f5f6f4;
  --bg-surface: #ffffff;
  --bg-sidebar: #0a1c15; /* Deep rich forest green */
  --sidebar: var(--bg-sidebar);
  --border-color: #e5e7eb;
  
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;
  
  /* Brand Accents */
  --primary: #10b981; /* Emerald Green */
  --primary-hover: #059669;
  --primary-glow: rgba(16, 185, 129, 0.15);
  --secondary: #8b5cf6; /* Royal Purple */
  --secondary-hover: #7c3aed;
  --secondary-glow: rgba(139, 92, 246, 0.15);
  
  /* Status Colors */
  --success: #10b981;
  --success-bg: #e6f4ea;
  --warning: #f59e0b;
  --warning-bg: #fef7e0;
  --danger: #ef4444;
  --danger-bg: #fce8e6;
  --info: #3b82f6;
  --info-bg: #e8f0fe;

  /* Font Families */
  --font-header: 'Outfit', 'Inter', sans-serif;
  --font-body: 'Inter', sans-serif;

  /* Layout sizing */
  --sidebar-width: 260px;
  --header-height: 75px;
  
  /* Shadows & Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.03), 0 2px 4px -1px rgba(0,0,0,0.02);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.05);
}

/* Base resets */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Global hidden utility — used by JS to show/hide elements */
.hidden {
  display: none !important;
}

/* ==========================================================================
   DEMO ROLE SWITCHER — Fixed floating panel (bottom-left)
   ========================================================================== */
.demo-switcher {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 9000;
  font-family: var(--font-body);
}

.switcher-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(10, 28, 21, 0.9);
  backdrop-filter: blur(8px);
  color: #9bb8ad;
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.3px;
}

.switcher-toggle:hover {
  color: #ffffff;
  border-color: rgba(16, 185, 129, 0.5);
}

.switcher-toggle i {
  width: 13px;
  height: 13px;
}

/* Panel — hidden by default, shown when parent has .open */
.switcher-panel {
  display: none;
  position: absolute;
  bottom: 42px;
  left: 0;
  background: rgba(10, 28, 21, 0.96);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 10px;
  padding: 14px;
  min-width: 220px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.demo-switcher.open .switcher-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.switcher-title {
  font-size: 11px;
  font-weight: 700;
  color: #526c62;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.switcher-buttons {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.switcher-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.05);
  background: rgba(255,255,255,0.03);
  color: #9bb8ad;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  font-family: var(--font-body);
}

.switcher-btn:hover {
  background: rgba(16, 185, 129, 0.1);
  color: #ffffff;
  border-color: rgba(16, 185, 129, 0.3);
}

.switcher-btn.active {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.4);
  font-weight: 600;
}

.switcher-btn i {
  width: 14px;
  height: 14px;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-header);
  font-weight: 600;
  color: var(--text-primary);
}

button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
}

a {
  text-decoration: none;
  color: inherit;
}

/* ==========================================================================
   APP LAYOUT & SIDEBAR
   ========================================================================== */

.app-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 100;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-brand {
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.logo-icon {
  width: 32px;
  height: 32px;
  background-color: var(--primary);
  color: white;
  font-family: var(--font-header);
  font-weight: 800;
  font-size: 18px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

.brand-details {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-family: var(--font-header);
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.2px;
}

.brand-sub {
  font-size: 8px;
  color: #526c62;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-top: 1px;
}

/* Navigation items categories */
.sidebar-nav {
  padding: 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
  overflow-y: auto;
}

.nav-category-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-category-title {
  font-size: 9px;
  font-weight: 700;
  color: #526c62;
  letter-spacing: 0.5px;
  padding-left: 12px;
  margin-bottom: 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: #9bb8ad;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.nav-link:hover {
  background-color: rgba(255, 255, 255, 0.03);
  color: #ffffff;
}

.nav-link.active {
  background-color: #132c21;
  color: #ffffff;
  border-left: 3px solid var(--primary);
  padding-left: 9px;
  font-weight: 600;
}

.nav-link i {
  width: 15px;
  height: 15px;
}

.nav-badge {
  position: absolute;
  right: 12px;
  background-color: #1f4d3c;
  color: var(--primary);
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
}

/* Sidebar Footer User profile */
.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  background-color: rgba(0, 0, 0, 0.15);
}

.profile-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #047857);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: white;
}

.profile-info h4 {
  font-size: 12px;
  font-weight: 600;
  color: #ffffff;
}

.profile-role-sub {
  font-size: 9px;
  color: #526c62;
  font-weight: 500;
}

/* ==========================================================================
   TOP HEADER BAR
   ========================================================================== */

.main-wrapper {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  min-width: 0;
}

.top-header {
  height: var(--header-height);
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 90;
}

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

.header-titles {
  display: flex;
  flex-direction: column;
}

.page-subtitle {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
}

.page-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 1px;
}

#toggle-sidebar {
  display: none;
}

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

/* Role Selector dropdown */
.role-selector-wrapper {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.role-selector-label {
  font-size: 8px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.role-select-container {
  display: flex;
  align-items: center;
  background-color: #f3f4f6;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  gap: 6px;
}

.status-indicator-dot {
  width: 6px;
  height: 6px;
  background-color: var(--primary);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--primary);
}

.role-picker-select {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
}

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

.search-icon {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  width: 14px;
  height: 14px;
}

.header-search-input {
  background-color: #f3f4f6;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 6px 12px 6px 30px;
  font-size: 12px;
  width: 220px;
  transition: all 0.2s ease;
}

.header-search-input:focus {
  outline: none;
  background-color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

/* Bell button */
.notification-btn {
  position: relative;
  background-color: #f3f4f6;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  width: 32px;
  height: 32px;
}

.notification-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 6px;
  height: 6px;
  background-color: var(--danger);
  border-radius: 50%;
}

/* Notification dropdown container */
.notification-dropdown {
  position: absolute;
  top: 42px;
  right: 0;
  width: 340px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  max-height: 400px;
  overflow: hidden;
  animation: slideDown 0.2s ease;
}

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

.notification-dropdown.hidden {
  display: none !important;
}

.notification-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--bg-surface);
}

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

.notification-list {
  overflow-y: auto;
  flex-grow: 1;
}

.notification-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  gap: 10px;
  cursor: pointer;
  transition: background-color 0.2s;
  background-color: var(--bg-surface);
}

.notification-item:hover {
  background-color: rgba(16, 185, 129, 0.04);
}

.notification-item:last-child {
  border-bottom: none;
}

.notification-item-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
}

.notification-item-icon.ticket { background-color: rgba(59, 130, 246, 0.1); color: var(--info); }
.notification-item-icon.service { background-color: rgba(245, 158, 11, 0.1); color: var(--warning); }
.notification-item-icon.invoice { background-color: rgba(239, 68, 68, 0.1); color: var(--danger); }

.notification-item-content {
  flex-grow: 1;
  min-width: 0;
}

.notification-item-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
  line-height: 1.4;
  white-space: normal;
}

.notification-item-desc {
  font-size: 10px;
  color: var(--text-secondary);
  line-height: 1.4;
  white-space: normal;
}

.notification-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

/* Create button */
.btn-create-new {
  background-color: var(--primary);
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.2);
}

.btn-create-new:hover {
  background-color: var(--primary-hover);
}

.content-body {
  padding: 24px;
  max-width: 100%;
}

/* ==========================================================================
   CARDS & COMMON WIDGETS
   ========================================================================== */

.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

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

.panel-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-header);
}

.view-all-link {
  font-size: 11px;
  color: var(--primary);
  font-weight: 600;
}

.view-all-link:hover {
  text-decoration: underline;
}

/* ==========================================================================
   STATS GRID (4 CARD WIDGETS)
   ========================================================================== */

.stats-grid {
  margin-bottom: 24px;
}

.stat-widget {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
}

.widget-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.widget-icon i {
  width: 18px;
  height: 18px;
}

.icon-green { background-color: var(--success-bg); color: var(--success); }
.icon-orange { background-color: var(--warning-bg); color: #b06000; }
.icon-red { background-color: var(--danger-bg); color: var(--danger); }
.icon-blue { background-color: var(--info-bg); color: var(--info); }

.widget-info {
  display: flex;
  flex-direction: column;
}

.widget-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.2px;
}

.widget-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  font-family: var(--font-header);
  line-height: 1.2;
  margin-top: 2px;
}

.widget-trend {
  font-size: 10px;
  font-weight: 600;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 2px;
}

.trend-up { color: var(--success); }
.trend-up i { width: 10px; height: 10px; }

.widget-subtext {
  font-size: 10px;
  font-weight: 600;
  margin-top: 4px;
}

.text-danger { color: var(--danger); }
.text-dark-red { color: #b91c1c; }

/* ==========================================================================
   RENEWALS TABLE & RENDER LAYOUT
   ========================================================================== */

.grid-table-card {
  padding: 24px;
}

.renewals-table-custom {
  width: 100%;
  border-collapse: collapse;
}

.renewals-table-custom th {
  padding: 10px 12px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-color);
  letter-spacing: 0.5px;
}

.renewals-table-custom td {
  padding: 12px;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-color);
  font-size: 12px;
}

/* Client initials circle avatars */
.client-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.client-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}

.avatar-blue { background-color: #e8f0fe; color: #1a73e8; }
.avatar-orange { background-color: #fef7e0; color: #b06000; }
.avatar-magenta { background-color: #fce4ec; color: #c2185b; }
.avatar-purple { background-color: #f3e5f5; color: #7b1fa2; }
.avatar-slate { background-color: #f1f3f4; color: #5f6368; }
.avatar-teal { background-color: #e0f2f1; color: #00695c; }

.client-name-bold {
  font-weight: 600;
  color: var(--text-primary);
}

/* Service cells */
.service-type-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  margin-bottom: 3px;
  text-transform: uppercase;
}

.srv-type-domain { background-color: #f3f4f6; color: #374151; }
.srv-type-hosting { background-color: #e0f2f1; color: #00695c; }
.srv-type-email { background-color: #e8f0fe; color: #1a73e8; }
.srv-type-maintenance { background-color: #f3e5f5; color: #7b1fa2; }

.service-name-sub {
  font-size: 10px;
  color: var(--text-secondary);
}

.expiry-date-text {
  font-weight: 500;
  color: var(--text-secondary);
}

/* Expired status badges */
.day-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid transparent;
}

.day-badge.expired {
  background-color: var(--danger-bg);
  color: var(--danger);
  border-color: #fca5a5;
}

.day-badge.warning {
  background-color: var(--warning-bg);
  color: #d97706;
  border-color: #fcd34d;
}

.day-badge.info {
  background-color: var(--info-bg);
  color: var(--info);
  border-color: #93c5fd;
}

.day-badge.success {
  background-color: var(--success-bg);
  color: var(--success);
  border-color: #a7f3d0;
}

.fee-text {
  font-weight: 700;
  color: var(--text-primary);
}

.btn-renew-action {
  background-color: #ffffff;
  border: 1px solid #10b981;
  color: #10b981;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-renew-action:hover {
  background-color: #10b981;
  color: #ffffff;
}

/* ==========================================================================
   CASH FLOW & TICKETS RIGHT PANEL WIDGETS
   ========================================================================== */

.cash-flow-widget {
  padding: 20px;
}

.cash-flow-progress-group {
  display: flex;
  flex-direction: column;
}

.flow-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 6px;
}

.flow-label {
  color: var(--text-secondary);
  font-weight: 500;
}

.flow-val {
  font-weight: 700;
  color: var(--text-primary);
}

.flow-bar-container {
  width: 100%;
  height: 8px;
  background-color: #f3f4f6;
  border-radius: 4px;
  overflow: hidden;
}

.flow-bar-fill {
  height: 100%;
  border-radius: 4px;
}

.flow-bar-fill.income-fill { background-color: var(--success); }
.flow-bar-fill.expense-fill { background-color: var(--danger); }

.cash-flow-net-profit {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px dashed var(--border-color);
  padding-top: 14px;
}

.net-profit-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
}

.net-profit-value {
  font-size: 16px;
  font-weight: 800;
  color: var(--danger);
  font-family: var(--font-header);
}

/* Tickets Widget */
.recent-tickets-widget {
  padding: 20px;
}

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

.ticket-row-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background-color: #f9fafb;
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.2s ease;
}

.ticket-row-item:hover {
  background-color: #f3f4f6;
  transform: translateY(-1px);
}

.ticket-row-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
  flex-shrink: 0;
}

.ticket-row-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.ticket-row-subject {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ticket-row-meta {
  font-size: 9px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.tkt-badge {
  display: inline-block;
  font-size: 8px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  white-space: nowrap;
}

.tkt-badge.status-new { background-color: var(--info-bg); color: var(--info); }
.tkt-badge.status-processing { background-color: var(--warning-bg); color: #d97706; }
.tkt-badge.status-waiting { background-color: #f3f4f6; color: #4b5563; }
.tkt-badge.status-resolved { background-color: var(--success-bg); color: var(--success); }

/* ==========================================================================
   ADDITIONAL VIEWS POLISHES
   ========================================================================== */

/* Grid utility helpers */
.grid-1 { display: grid; grid-template-columns: 1fr; gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.grid-sidebar { display: grid; grid-template-columns: 1fr 300px; gap: 20px; }

/* Responsive adjustments */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-sidebar { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 0px;
  }
  .sidebar {
    position: fixed;
    transform: translateX(-100%);
    width: 260px;
    height: 100vh;
  }
  .sidebar.active {
    transform: translateX(0);
    width: 260px;
  }
  #toggle-sidebar {
    display: inline-flex;
  }
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }
  .top-header {
    padding: 0 16px;
  }
}

/* ==========================================================================
   MISSING UI COMPONENTS: BUTTONS, FORMS, MODALS, KANBAN, CHAT, DOCUMENTS
   ========================================================================== */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  border: 1px solid transparent;
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.2);
}

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

.btn-secondary {
  background-color: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.btn-secondary:hover {
  background-color: #f3f4f6;
  color: var(--text-primary);
}

.btn-service-renew:hover {
  background-color: var(--secondary-hover) !important;
  border-color: var(--secondary-hover) !important;
}

/* Form controls */
.form-group {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: left;
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  font-size: 13px;
  background-color: #f9fafb;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  outline: none;
  transition: all 0.2s ease;
  color: var(--text-primary);
}

.form-control:focus {
  background-color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%234b5563'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px;
  padding-right: 36px;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(10, 28, 21, 0.5); /* Semi-transparent forest green */
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 1;
  transition: opacity 0.3s ease;
}

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

.modal-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 650px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  position: relative;
  animation: modalScaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 24px;
  font-weight: 300;
  color: var(--text-muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
  border: none;
  background: none;
}

.modal-close:hover {
  background-color: #f3f4f6;
  color: var(--text-primary);
}

.modal-body {
  margin-top: 8px;
  text-align: left;
}

.modal-body h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
}

/* Kanban Board */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}

.kanban-column {
  background-color: rgba(255, 255, 255, 0.4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 550px;
}

.kanban-column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 6px;
  margin-bottom: 4px;
}

.kanban-column-header span {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}

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

.kanban-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

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

/* Support Tickets Chat Hub */
.chat-box {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background-color: #f9fafb;
  min-height: 250px;
}

.chat-msg {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.4;
  position: relative;
  word-break: break-word;
  text-align: left;
}

.chat-msg.client {
  align-self: flex-start;
  background-color: var(--bg-sidebar);
  color: #ffffff;
  border-bottom-left-radius: 2px;
}

.chat-msg.staff {
  align-self: flex-end;
  background-color: #e6f4ea;
  color: var(--text-primary);
  border-bottom-right-radius: 2px;
  border: 1px solid #c2e7cd;
}

.chat-msg-time {
  font-size: 9px;
  opacity: 0.6;
  margin-top: 4px;
  text-align: right;
}

.chat-input-area {
  display: flex;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-surface);
  align-items: center;
}

/* Email Simulator Preview */
.sim-email-container {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: #f9fafb;
  overflow: hidden;
  margin-top: 12px;
  text-align: left;
}

.sim-email-header {
  background-color: #eaeaea;
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
  font-size: 11px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sim-email-header div {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sim-email-body {
  padding: 16px;
  font-size: 12px;
  white-space: pre-wrap;
  font-family: monospace;
  color: var(--text-primary);
  line-height: 1.6;
  background-color: #ffffff;
  min-height: 200px;
}

/* Electronic Signature Pad */
.signature-pad-container {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: #f9fafb;
  margin-bottom: 16px;
  overflow: hidden;
  height: 150px;
}

.signature-canvas {
  width: 100%;
  height: 100%;
  cursor: crosshair;
  background-color: #ffffff;
  display: block;
}

/* Badge statuses */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
}

.badge-success {
  background-color: var(--success-bg);
  color: var(--success);
}

.badge-danger {
  background-color: var(--danger-bg);
  color: var(--danger);
}

.badge-warning {
  background-color: var(--warning-bg);
  color: #b06000;
}

.badge-info {
  background-color: var(--info-bg);
  color: var(--info);
}

/* Credentials Row */
.credential-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px;
  background-color: #ffffff;
  transition: all 0.2s ease;
  text-align: left;
}

.credential-row:hover {
  border-color: var(--primary);
  background-color: #f9fafb;
}

.cred-value-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cred-value {
  font-family: monospace;
  background-color: #f3f4f6;
  padding: 2px 6px;
  border-radius: 4px;
}

/* Document Preview & A4 Print styling */
.document-preview-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
}

.doc-action-bar {
  display: flex;
  justify-content: flex-end;
  width: 100%;
  max-width: 800px;
  padding: 0 10px;
}

.a4-page {
  background-color: #ffffff;
  border: 1px solid #d1d5db;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 800px;
  min-height: 1130px; /* A4 Ratio */
  padding: 40px;
  display: flex;
  flex-direction: column;
  color: #1f2937;
  font-family: var(--font-body);
  text-align: left;
}

.doc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid var(--primary);
  padding-bottom: 20px;
  margin-bottom: 24px;
}

.doc-logo h2 {
  color: var(--primary);
  font-family: var(--font-header);
  font-weight: 800;
  font-size: 24px;
  margin: 0;
}

.doc-logo h2 span {
  color: var(--text-primary);
}

.doc-info {
  text-align: right;
  font-size: 13px;
  line-height: 1.5;
}

.doc-title {
  font-family: var(--font-header);
  font-weight: 800;
  font-size: 18px;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.doc-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  margin-bottom: 30px;
  font-size: 13px;
  line-height: 1.6;
}

.doc-party h4 {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 4px;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 0;
}

.doc-party p {
  margin-bottom: 4px;
}

.doc-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 30px;
  font-size: 13px;
}

.doc-table th {
  background-color: #f9fafb;
  border-bottom: 2px solid var(--border-color);
  color: var(--text-secondary);
  font-weight: 700;
  padding: 10px 12px;
  text-align: left;
}

.doc-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.doc-table-total {
  align-self: flex-end;
  width: 320px;
  margin-left: auto;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 40px;
}

.total-row {
  display: flex;
  justify-content: space-between;
}

.total-row.grand-total {
  border-top: 1px solid var(--border-color);
  padding-top: 8px;
  font-size: 15px;
  font-weight: 800;
  color: var(--text-primary);
}

.doc-signature-block {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  margin-top: auto;
  padding-top: 40px;
  font-size: 13px;
}

.signature-space {
  border-bottom: 1px dashed var(--text-muted);
  height: 100px;
  position: relative;
  margin: 10px 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.signature-image {
  max-height: 80px;
  max-width: 200px;
  object-fit: contain;
}

.doc-footer {
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
  margin-top: 40px;
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Print Overrides */
@media print {
  body * {
    visibility: hidden;
  }
  .a4-page, .a4-page * {
    visibility: visible;
  }
  .a4-page {
    position: absolute;
    left: 0;
    top: 0;
    border: none;
    box-shadow: none;
    padding: 0;
  }
}

/* Icon buttons styling */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  background-color: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
}

.icon-btn:hover {
  background-color: #f3f4f6;
  color: var(--text-primary);
}

.icon-btn i {
  width: 16px;
  height: 16px;
}

/* ==========================================================================
   PREMIUM LOGIN PAGE STYLING
   ========================================================================== */

.login-layout {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(135deg, #020806 0%, #061f14 50%, #0c3321 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  overflow-y: auto;
  padding: 20px;
}

.login-container {
  width: 100%;
  max-width: 460px;
  animation: loginFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

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

@keyframes loginShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.login-card {
  background: rgba(10, 28, 21, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 40px rgba(16, 185, 129, 0.08);
}

.login-header {
  text-align: center;
  margin-bottom: 30px;
}

.login-logo {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--primary) 0%, #059669 100%);
  color: white;
  font-family: var(--font-header);
  font-weight: 800;
  font-size: 28px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
}

.login-header h2 {
  font-size: 24px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 6px;
}

.login-header p {
  font-size: 13px;
  color: #9bb8ad;
}

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

.login-card .form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #9bb8ad;
  margin-bottom: 8px;
}

.login-card .label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.forgot-link {
  font-size: 12px;
  color: var(--primary);
  font-weight: 500;
  transition: color 0.2s;
}

.forgot-link:hover {
  color: #34d399;
  text-decoration: underline;
}

.input-with-icon {
  position: relative;
}

.input-with-icon i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: #526c62;
  pointer-events: none;
}

.input-with-icon .form-control {
  width: 100%;
  background: rgba(2, 8, 6, 0.4);
  border: 1px solid rgba(16, 185, 129, 0.15);
  color: #ffffff;
  padding: 12px 16px 12px 42px;
  border-radius: var(--radius-md);
  font-size: 14px;
  transition: all 0.2s ease;
}

.input-with-icon .form-control:focus {
  border-color: var(--primary);
  background: rgba(2, 8, 6, 0.6);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
  outline: none;
}

.password-input-wrapper .form-control {
  padding-right: 42px;
}

.pwd-toggle-btn {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #526c62;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pwd-toggle-btn:hover {
  color: var(--primary);
}

.pwd-toggle-btn i {
  width: 18px;
  height: 18px;
  pointer-events: auto;
}

.btn-login {
  width: 100%;
  background: linear-gradient(135deg, var(--primary) 0%, #059669 100%);
  color: white;
  font-weight: 600;
  padding: 12px;
  border-radius: var(--radius-md);
  margin-top: 10px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-login:hover {
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.35);
  transform: translateY(-1px);
}

.panel-title {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 8px;
  text-align: center;
}

.panel-subtitle {
  font-size: 13px;
  color: #9bb8ad;
  text-align: center;
  margin-bottom: 20px;
  line-height: 1.4;
}

.recovery-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-top: 10px;
}

.back-link {
  font-size: 13px;
  color: #9bb8ad;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s;
}

.back-link:hover {
  color: #ffffff;
}

.back-link i {
  width: 14px;
  height: 14px;
}

/* Demo accounts helper */
.demo-accounts-box {
  margin-top: 30px;
  border-top: 1px solid rgba(16, 185, 129, 0.15);
  padding-top: 20px;
}

.demo-acc-title {
  font-size: 12px;
  font-weight: 700;
  color: #9bb8ad;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}

.demo-acc-title i {
  width: 14px;
  height: 14px;
  color: var(--primary);
}

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

.demo-acc-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(16, 185, 129, 0.1);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.demo-acc-item:hover {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.3);
}

.role-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  min-width: 50px;
  text-align: center;
}

.role-badge.admin {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

.role-badge.tech {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.role-badge.sales {
  background: rgba(167, 139, 250, 0.15);
  color: #c084fc;
}

.role-badge.billing {
  background: rgba(45, 212, 191, 0.15);
  color: #2dd4bf;
}

.role-badge.client {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.acc-email {
  font-size: 11px;
  color: #9bb8ad;
  font-family: monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.demo-acc-item:hover .acc-email {
  color: #ffffff;
}

.btn-toggle-pwd, .btn-toggle-client-pwd {
  transition: color 0.2s;
}
.btn-toggle-pwd:hover, .btn-toggle-client-pwd:hover {
  color: var(--primary-hover) !important;
}

/* Client Portal Grids */
.grid-client-services {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 20px;
}
.grid-client-projects {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 20px;
}
@media (max-width: 1024px) {
  .grid-client-services, .grid-client-projects {
    grid-template-columns: 1fr;
  }
}

.renewals-table-custom tbody tr {
  transition: background-color 0.2s ease;
}
.renewals-table-custom tbody tr:hover {
  background-color: #f9fafb;
}



/* ============================================================
   PHP VERSION - Login Page Styles
   ============================================================ */
.login-page-body {
  background: linear-gradient(135deg, #0a0f1e 0%, #0d1f3c 50%, #0a1628 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.login-page-body::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 60% 60% at 20% 50%, rgba(16,185,129,0.08) 0%, transparent 60%),
              radial-gradient(ellipse 50% 50% at 80% 50%, rgba(99,102,241,0.06) 0%, transparent 60%);
}
.login-layout {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  max-width: 960px;
  width: 100%;
  min-height: 520px;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 32px 120px rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.08);
}
.login-branding {
  background: linear-gradient(135deg, rgba(16,185,129,0.12), rgba(5,150,105,0.08));
  border-right: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  padding: 48px 40px;
}
.login-brand-logo {
  font-size: 32px; font-weight: 900; margin-bottom: 20px;
}
.logo-primary { color: #10b981; }
.logo-accent  { color: #f9fafb; }
.login-brand-title { font-size: 20px; color: #f9fafb; font-weight: 700; margin-bottom: 12px; }
.login-brand-desc  { font-size: 13px; color: rgba(255,255,255,0.5); line-height: 1.6; margin-bottom: 28px; }
.login-features    { display: flex; flex-direction: column; gap: 12px; }
.feature-item {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: rgba(255,255,255,0.7);
}
.feature-item svg { width:16px; height:16px; color: #10b981; flex-shrink:0; }
.login-form-side {
  background: rgba(255,255,255,0.03);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.login-card {
  width: 100%;
  max-width: 360px;
}
.login-card-header { margin-bottom: 28px; }
.login-card-header h3 { font-size: 22px; color: #f9fafb; font-weight: 800; margin-bottom: 6px; }
.login-card-header p  { font-size: 13px; color: rgba(255,255,255,0.5); }
.login-error {
  background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3);
  border-radius: 8px; padding: 10px 14px; color: #fca5a5; font-size: 13px;
  margin-bottom: 16px;
}
.input-icon-wrapper { position: relative; }
.input-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--text-muted); pointer-events: none;
}
.input-with-icon { padding-left: 40px !important; }

@keyframes loginShake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-8px); }
  40%       { transform: translateX(8px); }
  60%       { transform: translateX(-6px); }
  80%       { transform: translateX(6px); }
}

@media (max-width: 768px) {
  .login-layout { grid-template-columns: 1fr; }
  .login-branding { display: none; }
}

.role-switcher-wrapper {
  display: flex; align-items: center;
}
.role-picker-select {
  padding: 6px 10px; border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface); color: var(--text-primary);
  font-size: 12px; cursor: pointer;
}
