/*
Theme Name: DigiMark Corp
Theme URI: https://digimarkcorp.com
Author: DigiMark Corp
Author URI: https://digimarkcorp.com
Description: A comprehensive client management WordPress theme featuring client onboarding, project management, support tickets, file sharing, instant messaging, and WaveApps invoice integration.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.5
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: digimark-corp
Tags: client-management, dashboard, project-management, support, invoicing
*/

/* ============================================================
   CSS CUSTOM PROPERTIES
   ============================================================ */
:root {
  --primary: #2563EB;
  --primary-dark: #1D4ED8;
  --primary-light: #EFF6FF;
  --secondary: #0F172A;
  --accent: #06B6D4;
  --accent-dark: #0891B2;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;

  --bg-primary: #F8FAFC;
  --bg-secondary: #FFFFFF;
  --bg-sidebar: #0F172A;
  --bg-card: #FFFFFF;

  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  --text-white: #FFFFFF;

  --border: #E2E8F0;
  --border-dark: #CBD5E1;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --sidebar-width: 260px;
  --header-height: 64px;
  --transition: all 0.2s ease;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

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

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

a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dark); }

img { max-width: 100%; height: auto; display: block; }

ul, ol { list-style: none; }

input, textarea, select, button {
  font-family: var(--font-sans);
  font-size: 1rem;
  outline: none;
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
}
h1 { font-size: 2.25rem; }
h2 { font-size: 1.875rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p { color: var(--text-secondary); margin-bottom: 1rem; }

/* ============================================================
   LAYOUT
   ============================================================ */
.dm-wrapper {
  display: flex;
  min-height: 100vh;
}

.dm-main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s ease;
}

.dm-page-content {
  flex: 1;
  padding: 2rem;
  margin-top: var(--header-height);
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.dm-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
}

.dm-sidebar::-webkit-scrollbar { width: 4px; }
.dm-sidebar::-webkit-scrollbar-track { background: transparent; }
.dm-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.dm-sidebar-logo {
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.dm-sidebar-logo .logo-icon {
  width: 40px;
  height: 40px;
  background: var(--primary);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
}

.dm-sidebar-logo .logo-text {
  display: flex;
  flex-direction: column;
}

.dm-sidebar-logo .logo-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: white;
  line-height: 1.2;
}

.dm-sidebar-logo .logo-tagline {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dm-sidebar-user {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.dm-sidebar-user .user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
}

.dm-sidebar-user .user-info { flex: 1; min-width: 0; }
.dm-sidebar-user .user-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dm-sidebar-user .user-role {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dm-sidebar-nav { padding: 1rem 0; flex: 1; }

.dm-nav-section { margin-bottom: 0.5rem; }

.dm-nav-section-title {
  padding: 0.5rem 1.5rem;
  font-size: 0.65rem;
  font-weight: 600;
  color: rgba(255,255,255,0.3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.dm-nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1.5rem;
  color: rgba(255,255,255,0.6);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  border-radius: 0;
  text-decoration: none;
}

.dm-nav-item:hover {
  color: white;
  background: rgba(255,255,255,0.06);
}

.dm-nav-item.active {
  color: white;
  background: rgba(37,99,235,0.3);
}

.dm-nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
}

.dm-nav-item .nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
}

.dm-nav-item .nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-full);
  min-width: 18px;
  text-align: center;
}

.dm-sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}

/* ============================================================
   TOP HEADER
   ============================================================ */
.dm-header {
  height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  z-index: 99;
  display: flex;
  align-items: center;
  padding: 0 2rem;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
}

.dm-header-title {
  flex: 1;
}

.dm-header-title h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.dm-header-title p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
}

.dm-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.dm-header-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 1rem;
  transition: var(--transition);
  position: relative;
}

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

.dm-header-btn .badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 16px;
  height: 16px;
  background: var(--danger);
  color: white;
  font-size: 0.6rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============================================================
   CARDS
   ============================================================ */
.dm-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.dm-card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.dm-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.dm-card-body { padding: 1.5rem; }

.dm-card-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--bg-primary);
}

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

.dm-stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.dm-stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.dm-stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.dm-stat-icon.blue { background: #EFF6FF; color: var(--primary); }
.dm-stat-icon.green { background: #ECFDF5; color: var(--success); }
.dm-stat-icon.yellow { background: #FFFBEB; color: var(--warning); }
.dm-stat-icon.red { background: #FEF2F2; color: var(--danger); }
.dm-stat-icon.cyan { background: #ECFEFF; color: var(--accent); }
.dm-stat-icon.purple { background: #F5F3FF; color: #7C3AED; }

.dm-stat-info { flex: 1; }
.dm-stat-value {
  font-size: 1.875rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 0.25rem;
}
.dm-stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}
.dm-stat-change {
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 0.5rem;
}
.dm-stat-change.up { color: var(--success); }
.dm-stat-change.down { color: var(--danger); }

/* ============================================================
   BUTTONS
   ============================================================ */
.dm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  white-space: nowrap;
  text-decoration: none;
}

.dm-btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.dm-btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37,99,235,0.3);
}

.dm-btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--border);
}
.dm-btn-secondary:hover {
  background: var(--bg-primary);
  border-color: var(--border-dark);
  color: var(--text-primary);
}

.dm-btn-success {
  background: var(--success);
  color: white;
  border-color: var(--success);
}
.dm-btn-success:hover {
  background: #059669;
  color: white;
}

.dm-btn-danger {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}
.dm-btn-danger:hover {
  background: #DC2626;
  color: white;
}

.dm-btn-outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}
.dm-btn-outline:hover {
  background: var(--primary);
  color: white;
}

.dm-btn-sm {
  padding: 0.375rem 0.875rem;
  font-size: 0.8rem;
}

.dm-btn-lg {
  padding: 0.875rem 1.75rem;
  font-size: 1rem;
}

.dm-btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius);
}

.dm-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ============================================================
   FORMS
   ============================================================ */
.dm-form-group { margin-bottom: 1.25rem; }

.dm-form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.dm-form-label span.required { color: var(--danger); margin-left: 2px; }

.dm-form-control {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: var(--transition);
}

.dm-form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.dm-form-control::placeholder { color: var(--text-muted); }

textarea.dm-form-control {
  resize: vertical;
  min-height: 100px;
}

.dm-form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394A3B8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.875rem center;
  padding-right: 2.5rem;
}

.dm-form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.375rem;
}

.dm-form-error {
  font-size: 0.75rem;
  color: var(--danger);
  margin-top: 0.375rem;
}

.dm-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.dm-form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
}

/* ============================================================
   TABLES
   ============================================================ */
.dm-table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.dm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.dm-table thead {
  background: var(--bg-primary);
}

.dm-table th {
  padding: 0.875rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.dm-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}

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

.dm-table tbody tr:hover { background: var(--bg-primary); }

/* ============================================================
   BADGES & STATUS
   ============================================================ */
.dm-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dm-badge-primary { background: #EFF6FF; color: var(--primary); }
.dm-badge-success { background: #ECFDF5; color: var(--success); }
.dm-badge-warning { background: #FFFBEB; color: var(--warning); }
.dm-badge-danger { background: #FEF2F2; color: var(--danger); }
.dm-badge-info { background: #EFF6FF; color: var(--info); }
.dm-badge-muted { background: #F1F5F9; color: var(--text-muted); }
.dm-badge-purple { background: #F5F3FF; color: #7C3AED; }

/* ============================================================
   MODALS
   ============================================================ */
.dm-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.dm-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.dm-modal {
  background: var(--bg-secondary);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(20px);
  transition: var(--transition);
}

.dm-modal-overlay.active .dm-modal {
  transform: scale(1) translateY(0);
}

.dm-modal-lg { max-width: 800px; }
.dm-modal-xl { max-width: 1000px; }

.dm-modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dm-modal-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
}

.dm-modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  border: none;
  background: var(--bg-primary);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  transition: var(--transition);
}

.dm-modal-close:hover {
  background: var(--danger);
  color: white;
}

.dm-modal-body { padding: 1.5rem; }

.dm-modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* ============================================================
   TABS
   ============================================================ */
.dm-tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.5rem;
}

.dm-tab {
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.dm-tab:hover { color: var(--primary); }

.dm-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

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

/* ============================================================
   ALERTS
   ============================================================ */
.dm-alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.dm-alert-success { background: #ECFDF5; border-color: #A7F3D0; color: #065F46; }
.dm-alert-warning { background: #FFFBEB; border-color: #FDE68A; color: #92400E; }
.dm-alert-danger { background: #FEF2F2; border-color: #FECACA; color: #991B1B; }
.dm-alert-info { background: #EFF6FF; border-color: #BFDBFE; color: #1E40AF; }

/* ============================================================
   PROGRESS BARS
   ============================================================ */
.dm-progress {
  height: 8px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.dm-progress-bar {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--primary);
  transition: width 0.5s ease;
}

.dm-progress-bar.success { background: var(--success); }
.dm-progress-bar.warning { background: var(--warning); }
.dm-progress-bar.danger { background: var(--danger); }

/* ============================================================
   AVATARS
   ============================================================ */
.dm-avatar {
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  background: var(--primary);
}

.dm-avatar-sm { width: 32px; height: 32px; font-size: 0.75rem; }
.dm-avatar-md { width: 40px; height: 40px; font-size: 0.875rem; }
.dm-avatar-lg { width: 52px; height: 52px; font-size: 1rem; }
.dm-avatar-xl { width: 72px; height: 72px; font-size: 1.5rem; }

/* ============================================================
   SEARCH
   ============================================================ */
.dm-search {
  position: relative;
  display: flex;
  align-items: center;
}

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

.dm-search input {
  padding: 0.625rem 0.875rem 0.625rem 2.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.875rem;
  width: 280px;
  transition: var(--transition);
}

.dm-search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
  width: 320px;
}

/* ============================================================
   DROPDOWNS
   ============================================================ */
.dm-dropdown {
  position: relative;
  display: inline-block;
}

.dm-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: var(--transition);
}

.dm-dropdown.open .dm-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dm-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.dm-dropdown-item:hover {
  background: var(--bg-primary);
  color: var(--text-primary);
}

.dm-dropdown-item.danger:hover {
  background: #FEF2F2;
  color: var(--danger);
}

.dm-dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 0.25rem 0;
}

/* ============================================================
   FILE UPLOAD
   ============================================================ */
.dm-file-upload {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-primary);
}

.dm-file-upload:hover,
.dm-file-upload.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.dm-file-upload-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  color: var(--text-muted);
}

.dm-file-upload p {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0;
}

.dm-file-upload strong { color: var(--primary); }

/* ============================================================
   MESSAGING
   ============================================================ */
.dm-chat-container {
  display: flex;
  height: calc(100vh - var(--header-height) - 4rem);
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
}

.dm-chat-sidebar {
  width: 300px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.dm-chat-sidebar-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 1rem;
}

.dm-chat-list {
  flex: 1;
  overflow-y: auto;
}

.dm-chat-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  cursor: pointer;
  transition: var(--transition);
  border-bottom: 1px solid var(--border);
}

.dm-chat-item:hover,
.dm-chat-item.active {
  background: var(--primary-light);
}

.dm-chat-item-info { flex: 1; min-width: 0; }
.dm-chat-item-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dm-chat-item-preview {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dm-chat-item-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
}
.dm-chat-item-time {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.dm-chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.dm-chat-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.dm-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dm-message {
  display: flex;
  gap: 0.75rem;
  max-width: 70%;
}

.dm-message.sent {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.dm-message-bubble {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  line-height: 1.5;
  max-width: 100%;
}

.dm-message.received .dm-message-bubble {
  background: var(--bg-primary);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.dm-message.sent .dm-message-bubble {
  background: var(--primary);
  color: white;
  border-bottom-right-radius: 4px;
}

.dm-message-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  text-align: right;
}

.dm-message.sent .dm-message-time { text-align: left; }

.dm-chat-input {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
}

.dm-chat-input textarea {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  resize: none;
  font-size: 0.875rem;
  max-height: 120px;
  transition: var(--transition);
}

.dm-chat-input textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

/* ============================================================
   ONBOARDING WIZARD
   ============================================================ */
.dm-wizard {
  max-width: 700px;
  margin: 0 auto;
}

.dm-wizard-steps {
  display: flex;
  align-items: center;
  margin-bottom: 2rem;
  position: relative;
}

.dm-wizard-steps::before {
  content: '';
  position: absolute;
  top: 20px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border);
  z-index: 0;
}

.dm-wizard-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  position: relative;
  z-index: 1;
}

.dm-wizard-step-num {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: var(--transition);
}

.dm-wizard-step.active .dm-wizard-step-num {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.dm-wizard-step.completed .dm-wizard-step-num {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.dm-wizard-step-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
}

.dm-wizard-step.active .dm-wizard-step-label { color: var(--primary); }
.dm-wizard-step.completed .dm-wizard-step-label { color: var(--success); }

/* ============================================================
   INVOICE
   ============================================================ */
.dm-invoice-preview {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 2.5rem;
  max-width: 800px;
  margin: 0 auto;
}

.dm-invoice-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 2px solid var(--border);
}

.dm-invoice-logo {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
}

.dm-invoice-meta {
  text-align: right;
}

.dm-invoice-number {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
}

.dm-invoice-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}

.dm-invoice-table th {
  background: var(--bg-primary);
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dm-invoice-table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.dm-invoice-totals {
  margin-left: auto;
  width: 280px;
}

.dm-invoice-total-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

.dm-invoice-total-row.grand-total {
  font-size: 1.125rem;
  font-weight: 800;
  color: var(--text-primary);
  border-bottom: none;
  padding-top: 0.75rem;
}

/* ============================================================
   NOTIFICATIONS PANEL
   ============================================================ */
.dm-notifications-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 360px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 300;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: var(--transition);
}

.dm-notifications-panel.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dm-notification-item {
  display: flex;
  gap: 0.75rem;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
}

.dm-notification-item:hover { background: var(--bg-primary); }
.dm-notification-item.unread { background: var(--primary-light); }

.dm-notification-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.dm-notification-content { flex: 1; }
.dm-notification-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}
.dm-notification-text {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.dm-notification-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.dm-login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0F172A 0%, #1E3A5F 50%, #0F172A 100%);
  position: relative;
  overflow: hidden;
}

.dm-login-page::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37,99,235,0.15) 0%, transparent 70%);
  top: -200px;
  right: -200px;
}

.dm-login-page::after {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(6,182,212,0.1) 0%, transparent 70%);
  bottom: -100px;
  left: -100px;
}

.dm-login-card {
  background: white;
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
}

.dm-login-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.dm-login-logo .logo-icon {
  width: 60px;
  height: 60px;
  background: var(--primary);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  font-weight: 800;
  color: white;
  margin: 0 auto 1rem;
}

.dm-login-logo h2 {
  font-size: 1.5rem;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.dm-login-logo p {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0;
}

/* ============================================================
   EMPTY STATES
   ============================================================ */
.dm-empty-state {
  text-align: center;
  padding: 3rem 2rem;
}

.dm-empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.4;
}

.dm-empty-state h3 {
  font-size: 1.125rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.dm-empty-state p {
  font-size: 0.875rem;
  color: var(--text-muted);
  max-width: 300px;
  margin: 0 auto 1.5rem;
}

/* ============================================================
   TOOLTIPS
   ============================================================ */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--secondary);
  color: white;
  font-size: 0.75rem;
  padding: 0.375rem 0.625rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  pointer-events: none;
  z-index: 500;
}

[data-tooltip]:hover::after {
  opacity: 1;
  visibility: visible;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .dm-sidebar {
    transform: translateX(-100%);
  }
  .dm-sidebar.open {
    transform: translateX(0);
  }
  .dm-main-content {
    margin-left: 0;
  }
  .dm-header {
    left: 0;
  }
  .dm-form-row { grid-template-columns: 1fr; }
  .dm-form-row-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .dm-page-content { padding: 1rem; }
  .dm-stats-grid { grid-template-columns: 1fr 1fr; }
  .dm-chat-sidebar { display: none; }
  .dm-chat-sidebar.open { display: flex; position: absolute; z-index: 10; width: 100%; height: 100%; }
  .dm-form-row-3 { grid-template-columns: 1fr; }
  .dm-invoice-header { flex-direction: column; gap: 1rem; }
  .dm-invoice-meta { text-align: left; }
}

@media (max-width: 480px) {
  .dm-stats-grid { grid-template-columns: 1fr; }
  .dm-login-card { padding: 1.5rem; }
}

/* ============================================================
   UTILITIES
   ============================================================ */
.d-flex { display: flex; }
.d-grid { display: grid; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }