/* Modern Dashboard Styles */
:root {
  --primary-color: #2563eb;
  --secondary-color: #1d4ed8;
  --success-color: #16a34a;
  --warning-color: #f59e0b;
  --danger-color: #dc2626;
  --info-color: #0ea5e9;
  --dark-color: #0f172a;
  --light-color: #f8fafc;
  --text-color: #111827;
  --text-light: #6b7280;
  --border-radius: 12px;
  --box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  --box-shadow-hover: 0 12px 40px rgba(0, 0, 0, 0.15);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

body.dashboard-layout {
  background: var(--bg, #f3f5f9);
  min-height: 100vh;
  color: var(--text-color);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* New light app shell matching mock */
body.app-shell {
  margin: 0;
  padding: 0;
  --bg: #f1f3f5;
  --card-bg: #ffffff;
  --muted: #64748b;
  --primary-600: #1e40af;
  --primary-500: #2563eb;
  --primary-100: #dbeafe;
  --green-600: #16a34a;
  --green-50: #ecfdf5;
  --blue-600: #1e40af;
  background: var(--bg);
  color: #0f172a;
  min-height: 100vh;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  margin: 0;
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}

.app {
  display: flex;
  min-height: 100vh;
  align-items: start;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  box-sizing: border-box;
}

.sidebar {
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border-right: 1px solid #334155;
  height: 100vh !important;
  max-height: 100vh !important;
  padding: 0 16px 24px;
  position: fixed;
  top: 0;
  left: 0;
  width: 240px;
  height: 100vh;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  align-self: start;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1000;
  flex-shrink: 0;
  box-sizing: border-box;
}
.sidebar .sidebar-logo {
  display:flex;
  align-items:center;
  justify-content:center;
  gap:12px;
  margin:0 0 20px 0;
  padding: 16px 12px;
  background: rgba(255, 255, 255, 1);
  border-radius: 0 0 16px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.sidebar .sidebar-logo img {
  display: block;
  margin: 0 auto;
  height: 40px;
  width: auto;
}

/* Dashboard - Larger logo */
body.app-shell.page-dashboard .sidebar .sidebar-logo {
  padding: 24px 16px !important;
  min-height: 80px;
}

body.app-shell.page-dashboard .sidebar .sidebar-logo img {
  height: 56px !important;
  max-width: 100%;
  width: auto !important;
}

/* Messages - Larger logo */
body.app-shell.page-messages .sidebar .sidebar-logo {
  padding: 24px 16px !important;
  min-height: 56px !important;
}

body.app-shell.page-messages .sidebar .sidebar-logo img {
  height: 56px !important;
  max-width: 100%;
  width: auto !important;
}

/* Profile - Logo */
body.app-shell.page-profile .sidebar .sidebar-logo {
  padding: 24px 16px !important;
  min-height: 56px !important;
}

body.app-shell.page-profile .sidebar .sidebar-logo img {
  height: 56px !important;
  max-width: 100%;
  width: auto !important;
}

/* Form Pages - Logo */
body.app-shell.page-form .sidebar .sidebar-logo {
  padding: 24px 16px !important;
  min-height: 80px !important;
}

body.app-shell.page-form .sidebar .sidebar-logo img {
  height: 56px !important;
  max-width: 100%;
  width: auto !important;
  display: block;
  margin: 0 auto;
}

/* Form Pages - Sidebar adjustments */
body.app-shell.page-form .sidebar {
  height: 100vh !important;
  max-height: 100vh !important;
  padding-bottom: 80px !important;
}

body.app-shell.page-form .sidebar .nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

body.app-shell.page-form .sidebar .logout {
  position: absolute !important;
  bottom: 24px !important;
  left: 16px !important;
  right: 16px !important;
  flex-shrink: 0 !important;
}

/* Form Pages - Mobile adjustments */
@media (max-width: 1024px) {
  body.app-shell.page-form .sidebar {
    height: auto !important;
    max-height: none !important;
    padding: 8px 12px !important;
    position: relative !important;
  }
  
  body.app-shell.page-form .sidebar .nav {
    flex: 1 !important;
    min-height: auto !important;
    overflow-y: hidden !important;
    overflow-x: auto !important;
  }
  
  body.app-shell.page-form .sidebar .logout {
    position: static !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    margin-left: auto !important;
  }
}

@media (max-width: 768px) {
  body.app-shell.page-form .sidebar {
    height: auto !important;
    max-height: none !important;
    padding: 6px 8px !important;
    position: relative !important;
  }
  
  body.app-shell.page-form .sidebar .nav {
    flex: 1 !important;
    min-height: auto !important;
    overflow-y: hidden !important;
    overflow-x: auto !important;
  }
  
  body.app-shell.page-form .sidebar .logout {
    position: static !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    margin-left: auto !important;
  }
}

.sidebar .nav { display:flex; flex-direction:column; gap:6px; flex: 1; }
.sidebar .nav a{ color:#e2e8f0; text-decoration:none; padding:12px 14px; border-radius:10px; font-weight:500; font-size:14px; transition: all 0.2s ease; border-left: 3px solid transparent; }
.sidebar .nav a:hover{ background: rgba(255, 255, 255, 0.08); color: #ffffff; border-left-color: rgba(255, 255, 255, 0.3); }
.sidebar .nav a.active{ background: rgba(37, 99, 235, 0.15); color: #ffffff; border-left-color: #2563eb; font-weight: 600; }
.sidebar .logout { position: absolute; bottom: 24px; left:16px; color:#94a3b8; font-size:14px; }
.sidebar .logout a{ color:inherit; text-decoration:none; font-weight:500; transition: color 0.2s ease; }
.sidebar .logout a:hover{ color:#ffffff; }

.main { padding: 0 28px 24px 28px; background: #f1f3f5; flex: 1; min-width: 0; overflow-x: hidden; box-sizing: border-box; margin-left: 240px; position: relative; }
.topbar { display:flex; justify-content:flex-end; align-items:center; gap:12px; margin-bottom: 0; padding-top: 16px; padding-bottom: 8px; background: transparent; position: relative; z-index: 1000; }
.message-icon-button { position: relative; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; background: #fff; border: 1px solid #e2e8f0; box-shadow: 0 2px 4px rgba(0,0,0,.08); color: #64748b; text-decoration: none; transition: all 0.2s ease; cursor: pointer; }
.message-icon-button:hover { background: #f8fafc; border-color: #2563eb; color: #2563eb; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15); }
.message-icon-button i { font-size: 18px; }
.message-icon-button .message-badge { position: absolute; top: -4px; right: -4px; display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; background: #ef4444; color: #ffffff; border-radius: 10px; font-size: 11px; font-weight: 700; border: 2px solid #fff; }
.message-dropdown { position: absolute; top: calc(100% + 8px); right: 0; width: 360px; background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,0.15); z-index: 10001; display: none; max-height: 500px; overflow: hidden; }
.message-dropdown.open { display: block; animation: slideDown 0.2s ease; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.message-dropdown-header { display: flex; justify-content: space-between; align-items: center; padding: 16px; border-bottom: 1px solid #e2e8f0; background: #f8fafc; }
.message-dropdown-header h3 { margin: 0; font-size: 1rem; font-weight: 600; color: #1e293b; }
.message-dropdown-header .close-dropdown { background: none; border: none; color: #64748b; font-size: 1.2rem; cursor: pointer; padding: 4px; border-radius: 4px; transition: all 0.2s; }
.message-dropdown-header .close-dropdown:hover { background: #e2e8f0; color: #1e293b; }
.message-dropdown-list { max-height: 400px; overflow-y: auto; }
.message-dropdown-list .empty-messages { padding: 24px; text-align: center; color: #64748b; font-size: 0.9rem; }
.message-dropdown-item { display: block; padding: 12px 16px; text-decoration: none; color: #1e293b; border-bottom: 1px solid #f1f5f9; transition: background 0.2s ease; cursor: pointer; }
.message-dropdown-item:hover { background: #f8fafc; }
.message-dropdown-item:last-child { border-bottom: none; }
.message-dropdown-item-subject { font-weight: 500; font-size: 0.9rem; margin-bottom: 4px; color: #1e293b; }
.message-dropdown-item-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.message-dropdown-item-count { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 6px; background: #2563eb; color: #ffffff; border-radius: 9px; font-size: 10px; font-weight: 700; }
.message-dropdown-item-date { font-size: 0.75rem; color: #64748b; }
.message-dropdown-item-name { font-size: 0.75rem; color: #64748b; font-weight: 500; }
.message-dropdown-footer { padding: 12px 16px; border-top: 1px solid #e2e8f0; background: #f8fafc; text-align: center; }
.message-dropdown-footer a { color: #2563eb; text-decoration: none; font-size: 0.85rem; font-weight: 500; }
.message-dropdown-footer a:hover { text-decoration: underline; }
.notification-toast { position: fixed; top: 20px; right: 20px; background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,0.15); padding: 16px 20px; z-index: 10001; display: none; min-width: 300px; animation: slideInRight 0.3s ease; }
.notification-toast.show { display: block; }
@keyframes slideInRight { from { opacity: 0; transform: translateX(100px); } to { opacity: 1; transform: translateX(0); } }
.notification-toast-header { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.notification-toast-icon { width: 40px; height: 40px; border-radius: 50%; background: #eff6ff; display: flex; align-items: center; justify-content: center; color: #2563eb; font-size: 1.2rem; }
.notification-toast-title { font-weight: 600; font-size: 0.95rem; color: #1e293b; }
.notification-toast-body { font-size: 0.85rem; color: #64748b; margin-left: 52px; }
.notification-toast-close { position: absolute; top: 12px; right: 12px; background: none; border: none; color: #64748b; font-size: 1.2rem; cursor: pointer; padding: 4px; border-radius: 4px; }
.notification-toast-close:hover { background: #f1f5f9; color: #1e293b; }
.user-chip { display:flex; align-items:center; gap:10px; background:#fff; border-radius:9999px; padding:8px 12px; box-shadow: 0 2px 4px rgba(0,0,0,.08); border: 1px solid #e2e8f0; }
.user-chip .avatar { width:32px; height:32px; border-radius:50%; background:linear-gradient(135deg, #2563eb 0%, #1e40af 100%); display:flex; align-items:center; justify-content:center; font-weight:700; color:#ffffff; }
.user-chip .meta { line-height:1.1; }
.user-chip .meta .name { font-size:14px; font-weight:600; color:#1e293b; }
.user-chip .meta .mail { font-size:12px; color:#64748b; }
.user-menu { position:relative; }
.user-chip-button { border:none; background:#fff; cursor:pointer; display:flex; align-items:center; gap:10px; padding:8px 14px; border-radius:999px; box-shadow:0 2px 4px rgba(0,0,0,.08); border: 1px solid #e2e8f0; transition: box-shadow .2s ease, transform .2s ease; }
.user-chip-button .caret { color:#64748b; font-size:12px; }
.user-chip-button:focus-visible { outline:2px solid var(--primary-500); outline-offset:3px; }
.user-chip-button[aria-expanded="true"] { box-shadow:0 4px 12px rgba(30, 64, 175, .15); transform: translateY(-1px); border-color: #2563eb; }
.user-dropdown { position:absolute; right:0; top:calc(100% + 8px); background:#fff; border:1px solid #e2e8f0; border-radius:12px; padding:6px 0; min-width:220px; box-shadow:0 8px 24px rgba(15,23,42,.12); opacity:0; pointer-events:none; transform:translateY(-6px); transition: all .2s ease; z-index:50; }
.user-dropdown.open { opacity:1; pointer-events:auto; transform:translateY(0); }
.user-dropdown a { display:flex; align-items:center; gap:10px; padding:10px 16px; color:#1e293b; text-decoration:none; font-weight:500; font-size:0.9rem; transition: background 0.2s ease; }
.user-dropdown a i { color:#2563eb; }
.user-dropdown a:hover { background:#f1f5f9; }

/* Message Badge */
.message-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; background: #ef4444; color: #ffffff; border-radius: 10px; font-size: 11px; font-weight: 700; margin-left: 8px; }

/* Dropdown Header */
.dropdown-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid #e2e8f0; }
.dropdown-header span { font-weight: 600; font-size: 0.9rem; color: #1e293b; }
.mark-all-read-btn { background: none; border: none; color: #2563eb; font-size: 0.75rem; font-weight: 500; cursor: pointer; padding: 4px 8px; border-radius: 6px; transition: background 0.2s ease; display: flex; align-items: center; gap: 4px; }
.mark-all-read-btn:hover { background: #f1f5f9; }
.mark-all-read-btn i { font-size: 0.7rem; }

/* Unread Messages List */
.unread-messages-list { max-height: 300px; overflow-y: auto; }
.unread-messages-list .empty-messages { padding: 16px; text-align: center; color: #64748b; font-size: 0.85rem; }
.unread-message-item { display: block; padding: 12px 16px; text-decoration: none; color: #1e293b; border-bottom: 1px solid #f1f5f9; transition: background 0.2s ease; }
.unread-message-item:hover { background: #f8fafc; }
.unread-message-item:last-child { border-bottom: none; }
.unread-message-subject { font-weight: 500; font-size: 0.9rem; margin-bottom: 4px; color: #1e293b; }
.unread-message-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.unread-count-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 6px; background: #2563eb; color: #ffffff; border-radius: 9px; font-size: 10px; font-weight: 700; }
.unread-date { font-size: 0.75rem; color: #64748b; }
.unread-member-name { font-size: 0.75rem; color: #64748b; font-weight: 500; }
.dropdown-divider { height: 1px; background: #e2e8f0; margin: 6px 0; }

.hero-card { background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%); border-radius: 12px; padding: 28px 32px; box-shadow: 0 2px 8px rgba(15,23,42,.08); border:1px solid #e2e8f0; margin-bottom: 24px; }
.form-page .hero-card { background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%); }
.dashboard-container > .section.card { background: #fff !important; border: 1px solid #e2e8f0 !important; border-radius: 12px !important; padding: 24px !important; box-shadow: 0 2px 8px rgba(15,23,42,.08) !important; margin-bottom: 20px !important; }
.hero-card h2 { font-size: 28px; margin: 6px 0 4px; }
.hero-card .subtitle { color: var(--muted); font-size:14px; }
.hero-card .hero-layout { display:flex; justify-content:space-between; align-items:flex-start; gap:24px; flex-wrap:wrap; }
.status-badge { color: var(--primary-600); font-weight:700; letter-spacing:.08em; text-transform:uppercase; font-size:12px; }
.hero-title { font-size:2rem; margin:0; color:#0f172a; }
.hero-subtitle { margin:8px 0 16px; color: var(--muted); font-size:1rem; }
.doc-link { display:inline-flex; align-items:center; gap:8px; margin-top:16px; font-weight:600; color: var(--primary-600); text-decoration:none; background:var(--primary-100); padding:10px 16px; border-radius:999px; }
.doc-link:hover { text-decoration:underline; }
.rings { display:flex; gap:28px; align-items:center; justify-content:center; flex-wrap: wrap; margin-bottom: 32px; }
.ring { width:72px; height:72px; border-radius:50%; background: conic-gradient(var(--ring-color, #8b5cf6) calc(var(--p, 0) * 1%), #e5e7eb 0); position:relative; flex-shrink: 0; }
.ring::after{ content:''; position:absolute; inset:8px; background:#fff; border-radius:50%; box-shadow: inset 0 0 0 1px #e5e7eb; }
.ring .label { position:absolute; width:100%; text-align:center; bottom:-22px; font-size:12px; color:#111827; font-weight:600; text-transform:none; }

.section { margin-top: 26px; }
.card { background:#fff !important; border:1px solid #e2e8f0 !important; border-radius:12px !important; padding:24px !important; box-shadow: 0 2px 8px rgba(15,23,42,.08) !important; display: block !important; margin-bottom: 20px !important; }
.section.card { margin-top: 20px; }
.dashboard-container .card { background:#fff !important; border:1px solid #e2e8f0 !important; border-radius:12px !important; padding:24px !important; box-shadow: 0 2px 8px rgba(15,23,42,.08) !important; margin-bottom: 20px !important; display: block !important; }
.dashboard-container > .card { background:#fff !important; border:1px solid #e2e8f0 !important; border-radius:12px !important; padding:24px !important; box-shadow: 0 2px 8px rgba(15,23,42,.08) !important; margin-bottom: 20px !important; display: block !important; }
.card h3 { margin:4px 0 12px; font-size:20px; }

.quick-grid{ display:grid; grid-template-columns: repeat(auto-fit, minmax(260px,1fr)); gap:16px; }
.quick { border:1px solid #e2e8f0; border-radius:12px; padding:20px; background:#ffffff; transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; display:block; color:inherit; text-decoration:none; box-shadow: 0 1px 3px rgba(15,23,42,.06); }
.quick:hover{ transform: translateY(-2px); box-shadow: 0 4px 12px rgba(30, 64, 175, .12); border-color: #2563eb; }
.quick.primary{ background:linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%); color:#1e40af; border-color: #93c5fd; }
.quick.green{ background:linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%); color:#065f46; border-color: #86efac; }
.quick .title{ font-weight:800; color: var(--blue-600); }
.quick .desc{ color:#64748b; font-size:14px; margin-top:6px; }
.quick .badge{ display:inline-block; background:#e0e7ff; color:#3730a3; padding:4px 8px; border-radius:999px; font-size:12px; font-weight:700; margin-bottom:8px; }

/* Modern login */
.login-surface { display:grid; place-items:center; min-height:100vh; background: var(--bg, #f3f5f9); }
.login-card { width:100%; max-width:420px; background:#fff; border:1px solid #eef2f7; border-radius:20px; padding:28px; box-shadow: 0 10px 30px rgba(15,23,42,.08); }
.login-card .brand{ display:flex; align-items:center; gap:12px; margin-bottom:10px; }
.login-card h1{ font-size:22px; margin: 12px 0 4px; }
.form-control-modern{ width:100%; border:1px solid #e5e7eb; border-radius:12px; padding:12px 14px; font-size:15px; }
.input-row{ display:flex; align-items:center; gap:10px; background:#f8fafc; border:1px solid #e5e7eb; border-radius:12px; padding:10px 12px; }
.input-row i{ color:#6b7280; }
.btn-primary-modern{ width:100%; padding:12px 14px; background: linear-gradient(90deg, var(--primary-600), var(--primary-500)); color:#fff; border:none; border-radius:12px; font-weight:700; cursor:pointer; }
.login-links{ display:flex; justify-content:space-between; margin-top:12px; font-size:13px; }
.login-links a{ color:#2563eb; text-decoration:none; }

/* Back-compat: style legacy bootstrap inputs inside login-card like modern */
.login-card .input-group{ display:flex; align-items:center; gap:10px; background:#f8fafc; border:1px solid #e5e7eb; border-radius:12px; padding:10px 12px; width:100%; }
.login-card .input-group .input-group-addon{ background:transparent; border:0; padding:0; }
.login-card .input-group .form-control{ border:0; background:transparent; box-shadow:none; outline:none; }
.login-card .btn-primary{ display:none; }

/* Dashboard Container */
.dashboard-container {
  padding: 0 2rem 2rem 2rem;
  max-width: 1400px;
  margin: 0 auto;
  background: transparent !important;
  width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}
.dashboard-container > .card {
  background: #fff !important;
  border: 1px solid #eef2f7 !important;
  border-radius: 18px !important;
  padding: 24px !important;
  box-shadow: 0 4px 18px rgba(15,23,42,.05) !important;
  margin-bottom: 20px !important;
  display: block !important;
}

/* Dashboard Header */
.dashboard-header {
  text-align: left;
  margin-bottom: 2.5rem;
  color: var(--text-color);
}

.dashboard-header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  text-shadow: none;
}

.dashboard-header p {
  font-size: 1rem;
  color: var(--text-light);
  font-weight: 400;
  max-width: 720px;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}

/* Modern Stat Cards */
.stat-card {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(16px);
  border-radius: var(--border-radius);
  padding: 2rem;
  box-shadow: var(--box-shadow);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

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

.stat-card-primary::before {
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

.stat-card-success::before {
  background: linear-gradient(90deg, var(--success-color), #66BB6A);
}

.stat-card-warning::before {
  background: linear-gradient(90deg, var(--warning-color), #FFB74D);
}

.stat-card-danger::before {
  background: linear-gradient(90deg, var(--danger-color), #EF5350);
}

.stat-card-info::before {
  background: linear-gradient(90deg, var(--info-color), #42A5F5);
}

.stat-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
  color: white;
  position: relative;
}

.stat-icon-primary {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.stat-icon-success {
  background: linear-gradient(135deg, var(--success-color), #66BB6A);
}

.stat-icon-warning {
  background: linear-gradient(135deg, var(--warning-color), #FFB74D);
}

.stat-icon-danger {
  background: linear-gradient(135deg, var(--danger-color), #EF5350);
}

.stat-icon-info {
  background: linear-gradient(135deg, var(--info-color), #42A5F5);
}

.stat-content h3 {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-color);
  margin-bottom: 0.5rem;
  line-height: 1;
}

.stat-content p {
  font-size: 1rem;
  color: var(--text-light);
  font-weight: 500;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Chart Cards */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.chart-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-radius: var(--border-radius);
  padding: 2rem;
  box-shadow: var(--box-shadow);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: var(--transition);
}

.chart-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--box-shadow-hover);
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.chart-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-color);
  margin: 0;
}

.chart-subtitle {
  font-size: 0.875rem;
  color: var(--text-light);
  margin: 0.25rem 0 0 0;
}

/* Activity Feed */
.activity-feed {
  max-height: 400px;
  overflow-y: auto;
}

.activity-item {
  display: flex;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

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

.activity-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 1rem;
  font-size: 0.875rem;
  color: white;
  flex-shrink: 0;
}

.activity-content {
  flex: 1;
}

.activity-title {
  font-weight: 500;
  color: var(--text-color);
  margin-bottom: 0.25rem;
}

.activity-time {
  font-size: 0.75rem;
  color: var(--text-light);
}

/* Buttons */
.btn-modern {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--border-radius);
  font-weight: 500;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 0.875rem;
}

.btn-modern-primary {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
}

.btn-modern-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
  color: white;
  text-decoration: none;
}

.btn-modern-success {
  background: linear-gradient(135deg, var(--success-color), #66BB6A);
  color: white;
}

.btn-modern-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(76, 175, 80, 0.4);
  color: white;
  text-decoration: none;
}

/* Progress Bars */
.progress-row { margin-bottom: 1.5rem; }
.progress-row:last-child { margin-bottom: 0; }
.progress-label { display:flex; justify-content:space-between; align-items:center; margin-bottom:0.5rem; font-weight:600; color: var(--text-color); }
.progress-label span { display:flex; align-items:center; gap:8px; }
.progress-value { font-size:0.875rem; color: var(--text-light); font-weight:600; }
.progress-hint { margin-top:0.35rem; font-size:0.8rem; color: var(--text-light); }

.progress-modern {
  width: 100%;
  height: 8px;
  background-color: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
  overflow: hidden;
  margin: 0.25rem 0 0;
}

.progress-bar-modern {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
}

.progress-bar-primary {
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

.progress-bar-success {
  background: linear-gradient(90deg, var(--success-color), #66BB6A);
}

.progress-bar-warning {
  background: linear-gradient(90deg, var(--warning-color), #FFB74D);
}

.system-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1.5rem; margin-top: 1.5rem; }
.system-tile { text-align:center; padding: 1.5rem; background: rgba(248, 250, 252, 0.8); border-radius: var(--border-radius); border:1px solid #e5e7eb; transition: var(--transition); }
.system-tile:hover { transform: translateY(-4px); box-shadow: var(--box-shadow); }
.system-icon { font-size: 2rem; margin-bottom: 0.75rem; }
.system-title { font-weight:600; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom:0.35rem; }
.system-value { font-size:1.75rem; font-weight:700; color: var(--text-color); }

/* Alerts */
.alert-inline { display:flex; align-items:center; gap:10px; padding:12px 16px; border-radius:12px; font-weight:600; font-size:0.95rem; margin-bottom:18px; border:1px solid transparent; }
.alert-inline i { font-size:1rem; }
.alert-success-modern { background:#ecfdf5; color:#047857; border-color:rgba(16,185,129,0.25); }
.alert-error-modern { background:#fef2f2; color:#b91c1c; border-color:rgba(248,113,113,0.3); }

.result-banner { display:flex; align-items:flex-start; gap:12px; padding:18px 20px; border-radius:16px; font-weight:600; font-size:0.95rem; margin-bottom:24px; border:1px solid transparent; line-height:1.5; }
.result-banner i { font-size:1.2rem; margin-top:2px; }
.result-banner.result-success { background:#ecfdf5; color:#047857; border-color:rgba(16,185,129,0.25); }
.result-banner.result-warning { background:#fef9c3; color:#92400e; border-color:rgba(217,119,6,0.3); }
.result-banner.result-danger { background:#fef2f2; color:#b91c1c; border-color:rgba(248,113,113,0.3); }
.result-banner.result-info { background:#eef2ff; color:#3730a3; border-color:rgba(99,102,241,0.25); }

.card.countdown-card { text-align:center; padding:32px; display:flex; flex-direction:column; gap:12px; align-items:center; }
.countdown-title { font-weight:700; text-transform:uppercase; letter-spacing:0.08em; color: var(--text-light); }
.countdown-value { font-size:2.8rem; font-weight:800; color: var(--text-color); letter-spacing:0.04em; }

.card.document-card { background: linear-gradient(135deg, var(--primary-600), var(--primary-500)); color:#fff; text-align:center; padding:26px 28px; display:flex; justify-content:center; align-items:center; }
.card.document-card a { color:inherit; font-weight:600; font-size:1rem; text-decoration:none; display:flex; align-items:center; gap:10px; }
.card.document-card a:hover { text-decoration:underline; }

.card.code-card { text-align:center; padding:32px; border-radius:20px; border:1px solid transparent; }
.card.code-card.success { background:#ecfdf5; border-color:rgba(16,185,129,0.25); color:#065f46; }
.card.code-card.warning { background:#fef3c7; border-color:rgba(217,119,6,0.25); color:#92400e; }
.code-text { font-size:2rem; font-weight:800; letter-spacing:0.08em; }

.overview-stack { display:flex; flex-direction:column; gap:20px; }
.quick-section { margin-top: 24px; }
.form-page { display:flex; flex-direction:column; gap:24px; }
.form-card-wide { background:#fff; border:1px solid #e2e8f0; border-radius:12px; padding:32px; box-shadow: 0 2px 8px rgba(15,23,42,.08); }
.legacy-form-card section { margin:0 0 20px; }
.legacy-form-card .card { box-shadow:none; border:0; background:transparent !important; padding:0 !important; }
.legacy-form-card .btn { border-radius:10px; font-weight:600; padding:12px 24px; transition: all 0.2s ease; border: none; }
.legacy-form-card .btn-primary { background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%); color: #fff; box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2); }
.legacy-form-card .btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3); }
.legacy-form-card .form-control { border-radius:10px; border: 1px solid #e2e8f0; transition: all 0.2s ease; font-size: 14px; color: #1e293b !important; background-color: #ffffff !important; }
.legacy-form-card input.form-control { padding: 12px 16px; }
.legacy-form-card textarea.form-control { padding: 12px 16px; }
.legacy-form-card select.form-control { padding: 0 16px; height: 44px; line-height: 44px; }
.legacy-form-card .form-control:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); outline: none; }
.legacy-form-card select.form-control { color: #1e293b !important; background-color: #ffffff !important; -webkit-appearance: none; -moz-appearance: none; appearance: none; }
.legacy-form-card select.form-control option { color: #1e293b !important; background-color: #ffffff !important; padding: 8px 12px; }
.legacy-form-card select.form-control option:checked { background-color: #2563eb !important; color: #ffffff !important; }
.legacy-form-card select.form-control option:hover { background-color: #f1f5f9 !important; }
.legacy-form-card .form-group { margin-bottom: 20px; }
.legacy-form-card .form-group label { font-weight: 600; color: #1e293b; margin-bottom: 8px; display: block; font-size: 14px; }
.legacy-form-card .card-default { background: transparent !important; border: none !important; box-shadow: none !important; padding: 0 !important; }
.legacy-form-card .content-header { margin-bottom: 24px; padding-bottom: 16px; border-bottom: 2px solid #e2e8f0; }
.legacy-form-card .content-header h1 { color: #1e293b; font-size: 24px; font-weight: 700; margin: 0; }
.legacy-form-card .bs-stepper { background: transparent; }
.legacy-form-card .bs-stepper-header { border-bottom: 1px solid #e2e8f0; margin-bottom: 24px; padding-bottom: 16px; }
.legacy-form-card .bs-stepper-content { padding: 0; }
.legacy-form-card .select2-container--default .select2-selection--single { border-radius: 10px; border: 1px solid #e2e8f0 !important; height: 44px; padding: 0 !important; background-color: #ffffff !important; }
.legacy-form-card .select2-container--default .select2-selection--single:focus { border-color: #2563eb !important; }
.legacy-form-card .select2-container--default .select2-selection--single .select2-selection__rendered { color: #1e293b !important; line-height: 44px !important; padding-left: 12px !important; padding-right: 12px !important; }
.legacy-form-card .select2-container--default .select2-selection--single .select2-selection__placeholder { color: #64748b !important; }
.legacy-form-card .select2-container--default .select2-selection--single .select2-selection__arrow { height: 42px !important; }
.legacy-form-card .select2-container--default .select2-selection--single .select2-selection__arrow b { border-color: #64748b transparent transparent transparent !important; }
.legacy-form-card .select2-dropdown { background-color: #ffffff !important; border: 1px solid #e2e8f0 !important; box-shadow: 0 4px 12px rgba(0,0,0,0.1) !important; }
.legacy-form-card .select2-container--default .select2-results__option { color: #1e293b !important; background-color: #ffffff !important; padding: 10px 12px !important; }
.legacy-form-card .select2-container--default .select2-results__option--highlighted[aria-selected] { background-color: #f1f5f9 !important; color: #1e293b !important; }
.legacy-form-card .select2-container--default .select2-results__option[aria-selected="true"] { background-color: #2563eb !important; color: #ffffff !important; }
.legacy-form-card .select2-container--default .select2-results__option[aria-selected="true"]:hover { background-color: #1e40af !important; color: #ffffff !important; }
.legacy-form-card .select2-results__option { color: #1e293b !important; }
.legacy-form-card .select2-search--dropdown .select2-search__field { border: 1px solid #e2e8f0 !important; border-radius: 8px !important; padding: 8px 12px !important; color: #1e293b !important; }

/* Global select and option styles for form pages */
body.app-shell.page-form select,
body.app-shell.page-form select.form-control,
body.app-shell.page-form .form-control select {
  color: #1e293b !important;
  background-color: #ffffff !important;
}

body.app-shell.page-form select option,
body.app-shell.page-form select.form-control option,
body.app-shell.page-form .form-control select option {
  color: #1e293b !important;
  background-color: #ffffff !important;
  padding: 8px 12px !important;
}

body.app-shell.page-form select option:checked {
  background-color: #2563eb !important;
  color: #ffffff !important;
}

/* Global select2 styles for form pages */
body.app-shell.page-form .select2-container--default .select2-selection--single .select2-selection__rendered {
  color: #1e293b !important;
}

body.app-shell.page-form .select2-container--default .select2-results__option {
  color: #1e293b !important;
  background-color: #ffffff !important;
}

body.app-shell.page-form .select2-dropdown {
  background-color: #ffffff !important;
}

.legacy-form-card table { border-collapse: separate; border-spacing: 0; }
.legacy-form-card table td { padding: 12px; border: 1px solid #e2e8f0; }
.legacy-form-card table thead td { background: #f8fafc; font-weight: 600; color: #1e293b; }
.legacy-form-card textarea.form-control { min-height: 120px; resize: vertical; }
.legacy-form-card input[type="checkbox"], .legacy-form-card input[type="radio"] { width: 18px; height: 18px; cursor: pointer; accent-color: #2563eb; }
.legacy-form-card input[type="date"], .legacy-form-card input[type="file"] { border-radius: 10px; border: 1px solid #e2e8f0; padding: 10px 14px; }
.legacy-form-card .input-group { border-radius: 10px; border: 1px solid #e2e8f0; overflow: hidden; }
.legacy-form-card .input-group-addon { background: #f8fafc; border: none; padding: 12px 16px; color: #64748b; }
.legacy-form-card .alert { border-radius: 10px; padding: 16px 20px; margin-bottom: 20px; border: none; }
.legacy-form-card .alert-success { background: #ecfdf5; color: #065f46; border-left: 4px solid #10b981; }
.legacy-form-card .alert-danger { background: #fef2f2; color: #991b1b; border-left: 4px solid #ef4444; }
.legacy-form-card .alert-warning { background: #fffbeb; color: #92400e; border-left: 4px solid #f59e0b; }
.legacy-form-card .alert-info { background: #eff6ff; color: #1e40af; border-left: 4px solid #2563eb; }
.legacy-form-card .well { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 16px; margin-bottom: 20px; }
.legacy-form-card .panel { border: 1px solid #e2e8f0; border-radius: 10px; margin-bottom: 20px; overflow: hidden; }
.legacy-form-card .panel-heading { background: #f8fafc; padding: 16px 20px; border-bottom: 1px solid #e2e8f0; font-weight: 600; color: #1e293b; }
.legacy-form-card .panel-body { padding: 20px; }
.legacy-form-card .row { margin-left: -10px; margin-right: -10px; }
.legacy-form-card .row > [class*="col-"] { padding-left: 10px; padding-right: 10px; }
.legacy-form-card .help-block { color: #64748b; font-size: 13px; margin-top: 6px; }
.legacy-form-card .required { color: #ef4444; }
.legacy-form-card .uploadfile-container { border-radius: 10px; border: 2px dashed #e2e8f0; padding: 24px; text-align: center; transition: all 0.2s ease; }
.legacy-form-card .uploadfile-container:hover { border-color: #2563eb; background: #f8fafc; }
.legacy-form-card .ajax-upload-dragdrop { border-radius: 10px !important; border: 2px dashed #e2e8f0 !important; padding: 24px !important; }
.legacy-form-card .ajax-upload-dragdrop:hover { border-color: #2563eb !important; background: #f8fafc !important; }

/* Modern Upload Component */
.modern-upload-area {
  width: 100%;
  margin-bottom: 20px;
}

.modern-upload-dropzone {
  border: 2px dashed #e2e8f0;
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.modern-upload-dropzone:hover {
  border-color: #2563eb;
  background: #eff6ff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
}

.modern-upload-dropzone.modern-upload-dragover {
  border-color: #2563eb;
  background: #dbeafe;
  transform: scale(1.02);
}

.modern-upload-icon {
  font-size: 48px;
  color: #64748b;
  margin-bottom: 16px;
  transition: all 0.3s ease;
}

.modern-upload-dropzone:hover .modern-upload-icon {
  color: #2563eb;
  transform: scale(1.1);
}

.modern-upload-text {
  color: #1e293b;
}

.modern-upload-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 8px 0;
  color: #1e293b;
}

.modern-upload-subtitle {
  font-size: 14px;
  color: #64748b;
  margin: 0 0 12px 0;
}

.modern-upload-link {
  color: #2563eb;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

.modern-upload-info,
.modern-upload-formats {
  font-size: 12px;
  color: #94a3b8;
  margin: 4px 0;
}

.modern-upload-preview {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  background: #ffffff;
}

.modern-upload-file {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.modern-upload-file-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #1e40af;
  flex-shrink: 0;
}

.modern-upload-file-icon .fa-file-pdf {
  color: #dc2626;
}

.modern-upload-file-icon .fa-file-image {
  color: #10b981;
}

.modern-upload-file-info {
  flex: 1;
  min-width: 0;
}

.modern-upload-file-name {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 4px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modern-upload-file-size {
  font-size: 12px;
  color: #64748b;
  margin: 0;
}

.modern-upload-file-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.modern-upload-delete {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: none;
  background: #fef2f2;
  color: #ef4444;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.modern-upload-delete:hover {
  background: #fee2e2;
  transform: scale(1.05);
}

.modern-upload-delete:active {
  transform: scale(0.95);
}

.modern-upload-view {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: none;
  background: #eff6ff;
  color: #2563eb;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
  text-decoration: none;
}

.modern-upload-view:hover {
  background: #dbeafe;
  transform: scale(1.05);
  color: #1e40af;
}

.modern-upload-view:active {
  transform: scale(0.95);
}

.modern-upload-replace {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: none;
  background: #f0f9ff;
  color: #0284c7;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.modern-upload-replace:hover {
  background: #e0f2fe;
  transform: scale(1.05);
  color: #0369a1;
}

.modern-upload-replace:active {
  transform: scale(0.95);
}

.modern-upload-progress {
  margin-top: 12px;
}

.modern-upload-progress-bar {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.modern-upload-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563eb 0%, #1e40af 100%);
  border-radius: 4px;
  transition: width 0.3s ease;
  width: 0%;
}

.modern-upload-progress-text {
  font-size: 12px;
  color: #64748b;
  font-weight: 600;
}

.modern-upload-error {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #fee2e2;
  color: #991b1b;
  padding: 12px 20px;
  border-radius: 10px;
  border-left: 4px solid #ef4444;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
  z-index: 10000;
  animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
.legacy-form-card .bs-stepper .step { padding: 12px 20px; }
.legacy-form-card .bs-stepper .step.active .step-trigger { color: #2563eb; font-weight: 600; }
.legacy-form-card .bs-stepper .step-trigger { color: #64748b; transition: color 0.2s ease; }
.legacy-form-card .bs-stepper .step-trigger:hover { color: #2563eb; }
.legacy-form-card .bs-stepper-line { background: #e2e8f0; }
.legacy-form-card .bs-stepper-header { display: flex; align-items: center; gap: 12px; }
.legacy-form-card .content { padding: 24px 0; }
.legacy-form-card .dstepper-block { padding: 0; }
.legacy-form-card .form-group[style*="border"] { border: 1px solid #e2e8f0 !important; border-radius: 10px; padding: 16px; background: #f8fafc; }
.legacy-form-card .breadcrumb { background: transparent; padding: 0; margin-bottom: 16px; }
.legacy-form-card .breadcrumb li { color: #64748b; }
.legacy-form-card .breadcrumb li.active { color: #1e293b; font-weight: 600; }
.legacy-form-card .card-body { padding: 0; }
.legacy-form-card .card-header { background: transparent; border: none; padding: 0 0 16px 0; margin-bottom: 20px; border-bottom: 2px solid #e2e8f0; }
.legacy-form-card .card-header h3 { color: #1e293b; font-size: 20px; font-weight: 700; margin: 0; }
.legacy-form-card .btn-group .btn { border-radius: 10px; margin-right: 8px; }
.legacy-form-card .btn-success { background: linear-gradient(135deg, #10b981 0%, #059669 100%); color: #fff; }
.legacy-form-card .btn-success:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(16, 163, 74, 0.3); }
.legacy-form-card .btn-danger { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); color: #fff; }
.legacy-form-card .btn-danger:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3); }
.legacy-form-card .btn-warning { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); color: #fff; }
.legacy-form-card .btn-warning:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3); }
.legacy-form-card .btn-info { background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%); color: #fff; }
.legacy-form-card .btn-info:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3); }
.legacy-form-card .btn-default { background: #f8fafc; color: #1e293b; border: 1px solid #e2e8f0; }
.legacy-form-card .btn-default:hover { background: #e2e8f0; border-color: #cbd5e1; }
.legacy-form-card .form-horizontal .control-label { text-align: left; font-weight: 600; color: #1e293b; }
.legacy-form-card .has-error .form-control { border-color: #ef4444; }
.legacy-form-card .has-error .help-block { color: #ef4444; }
.legacy-form-card .has-success .form-control { border-color: #10b981; }
.legacy-form-card .has-success .help-block { color: #10b981; }

/* Forms */
.form-card { max-width: 640px; margin-top: 1.5rem; }
.form-grid { display:grid; gap: 1.5rem; }
.form-field { display:flex; flex-direction:column; gap:0.5rem; }
.form-label { font-weight:600; color: var(--text-color); font-size:0.9rem; text-transform:none; letter-spacing:0; }
.form-input,
.form-textarea { width:100%; border:1px solid #d1d5db; border-radius:12px; padding:12px 14px; font-size:0.95rem; background:#fff; transition:border-color .2s ease, box-shadow .2s ease; }
.form-input:focus,
.form-textarea:focus { outline:none; border-color: var(--primary-500); box-shadow:0 0 0 3px rgba(99,102,241,0.15); }
.form-textarea { resize: vertical; min-height: 140px; }
.form-hint { font-size:0.75rem; color: var(--text-light); }
.form-actions { display:flex; justify-content:flex-end; gap:12px; margin-top:1.5rem; }

/* Messages */
.messages-layout { display:grid; grid-template-columns: 320px 1fr; gap:24px; align-items:start; }
.thread-panel { padding:24px; }
.thread-panel-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:12px; }
.thread-panel-header h3 { margin:0; font-size:1.05rem; }
.thread-count { font-size:0.8rem; color: var(--text-light); font-weight:600; }
.thread-list { display:flex; flex-direction:column; gap:12px; max-height:520px; overflow-y:auto; }
.thread-item { display:flex; flex-direction:column; gap:6px; padding:14px 16px; border-radius:14px; border:1px solid #e5e7eb; background:#f8fafc; color: var(--text-color); text-decoration:none; transition: var(--transition); }
.thread-item:hover { border-color:#c7d2fe; transform: translateY(-2px); }
.thread-item.active { background: var(--primary-100); border-color: var(--primary-500); color: var(--primary-600); box-shadow: 0 12px 24px rgba(99,102,241,0.14); }
.thread-subject { font-weight:600; font-size:0.95rem; line-height:1.3; }
.thread-meta { display:flex; justify-content:space-between; align-items:center; font-size:0.75rem; color: var(--text-light); }
.thread-badge { display:inline-flex; align-items:center; justify-content:center; min-width:22px; padding:2px 8px; border-radius:999px; background: var(--danger-color); color:#fff; font-weight:700; }

.conversation-panel { padding:0; display:flex; flex-direction:column; max-height: calc(100vh - 200px); }
.conversation-header { display:flex; justify-content:space-between; align-items:flex-start; gap:18px; padding:24px; border-bottom:1px solid #e5e7eb; flex-shrink: 0; }
.conversation-header h3 { margin:0; font-size:1.2rem; }
.conversation-header p { margin:6px 0 0; color: var(--text-light); font-size:0.85rem; }
.status-pill { display:inline-flex; align-items:center; gap:6px; padding:6px 14px; border-radius:999px; font-size:0.75rem; font-weight:700; text-transform:uppercase; letter-spacing:0.06em; }
.status-open { background:#ecfdf5; color:#047857; }
.status-closed { background:#fee2e2; color:#b91c1c; }

.conversation-body { flex:1; padding:24px; overflow-y:auto; display:flex; flex-direction:column; gap:16px; background: rgba(248,250,252,0.6); min-height: 0; max-height: calc(100vh - 360px); }
.message-form { padding:16px 24px; border-top:1px solid #e5e7eb; display:flex; flex-direction:column; gap:12px; flex-shrink: 0; }
.message-input-wrapper { display:flex; align-items:center; gap:12px; }
.message-textarea { flex:1; min-height:40px !important; max-height:100px !important; resize:vertical; padding:8px 12px !important; border:1px solid #d1d5db !important; border-radius:8px !important; font-size:0.95rem !important; background:#fff !important; transition:border-color .2s ease, box-shadow .2s ease; line-height:1.5 !important; width:auto !important; }
.message-textarea:focus { outline:none !important; border-color: var(--primary-500) !important; box-shadow:0 0 0 3px rgba(99,102,241,0.15) !important; }
.message-form-buttons { display:flex; gap:8px; align-items:center; flex-shrink:0; }
.message-attach-btn, .message-send-btn { height:40px; min-width:40px; padding:0 16px; display:flex; align-items:center; justify-content:center; white-space:nowrap; }
.message-form .attachment-preview { margin-top:8px; }
.message-row { display:flex; flex-direction:column; gap:6px; max-width:75%; }
.message-row.from-member { margin-left:auto; align-items:flex-end; }
.message-row.from-admin { align-items:flex-start; }
.message-author { font-size:0.75rem; font-weight:600; color: var(--text-light); text-transform:uppercase; letter-spacing:0.06em; }
.message-bubble { background:#fff; border-radius:18px; padding:14px 16px; border:1px solid #e5e7eb; box-shadow:0 8px 18px rgba(15,23,42,0.06); }
.message-row.from-member .message-bubble { background: var(--primary-100); border-color: rgba(99,102,241,0.4); color:#1e1b4b; }
.message-text { font-size:0.95rem; line-height:1.5; }
.message-time { margin-top:8px; font-size:0.75rem; color: var(--text-light); text-align:right; }

.conversation-empty { padding:48px; text-align:center; color: var(--text-light); }
.conversation-empty h3 { margin-bottom:8px; color: var(--text-color); font-size:1.25rem; }

.empty-state { padding:24px; text-align:center; border-radius:14px; border:1px dashed #d4d4d8; background:#f8fafc; color: var(--text-light); font-size:0.9rem; }
.empty-state p { margin:0; }

.new-thread-card { max-width:720px; }
.new-thread-card h3 { margin-bottom:0.5rem; }
.new-thread-card p { margin-top:0; margin-bottom:1.5rem; color: var(--text-light); font-size:0.9rem; }

/* Responsive Design */
@media (max-width: 1024px) {
  .app {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: none !important;
    grid-template-rows: none !important;
  }

  .sidebar {
    border-right: none !important;
    border-bottom: 1px solid #334155 !important;
    padding: 8px 12px !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 8px !important;
    min-height: auto !important;
    height: auto !important;
    position: relative !important;
    top: auto !important;
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box !important;
    grid-column: unset !important;
    grid-row: unset !important;
    order: 1 !important;
    align-self: stretch !important;
    box-shadow: none !important;
    flex-shrink: 0 !important;
  }
  
  .main {
    grid-column: unset !important;
    grid-row: unset !important;
    order: 2 !important;
    flex: 1 !important;
    min-width: 0 !important;
    margin-left: 0 !important;
  }

  .sidebar .sidebar-logo {
    margin-bottom: 0 !important;
    flex-shrink: 0 !important;
    padding: 8px !important;
    min-height: auto !important;
    height: auto !important;
    width: auto !important;
  }
  
  /* Responsive logo sizes */
  body.app-shell.page-dashboard .sidebar .sidebar-logo,
  body.app-shell.page-messages .sidebar .sidebar-logo,
  body.app-shell.page-profile .sidebar .sidebar-logo,
  body.app-shell.page-form .sidebar .sidebar-logo {
    padding: 8px !important;
    min-height: auto !important;
    height: auto !important;
  }
  
  body.app-shell.page-dashboard .sidebar .sidebar-logo img,
  body.app-shell.page-messages .sidebar .sidebar-logo img,
  body.app-shell.page-profile .sidebar .sidebar-logo img,
  body.app-shell.page-form .sidebar .sidebar-logo img {
    height: 36px !important;
    max-width: 100% !important;
    width: auto !important;
  }

  .sidebar .nav {
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 6px !important;
    flex: 1 !important;
    min-width: 0 !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
    padding: 0 !important;
    margin: 0 !important;
    align-items: center !important;
  }
  
  .sidebar .nav a {
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    padding: 6px 10px !important;
    font-size: 12px !important;
    display: inline-block !important;
    min-width: auto !important;
  }

  .sidebar .logout {
    position: static !important;
    margin-left: auto !important;
    flex-shrink: 0 !important;
    font-size: 11px !important;
    padding: 0 !important;
    white-space: nowrap !important;
  }

  .hero-card .hero-layout {
    align-items: flex-start;
  }

  .messages-layout {
    grid-template-columns: 1fr;
  }

  .thread-panel {
    order: 2;
  }

  .conversation-panel {
    order: 1;
  }
}

@media (max-width: 768px) {
  html, body {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100vw !important;
  }
  
  .app {
    display: flex !important;
    flex-direction: column !important;
  }
  
  .sidebar {
    padding: 6px 8px !important;
    gap: 6px !important;
    max-width: 100vw !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    flex-shrink: 0 !important;
    width: 100% !important;
  }
  
  .main {
    flex: 1 !important;
    min-width: 0 !important;
    width: 100% !important;
  }
  
  .sidebar .sidebar-logo {
    padding: 6px !important;
    flex-shrink: 0 !important;
  }
  
  .sidebar .sidebar-logo img {
    height: 28px !important;
    max-width: 100% !important;
  }
  
  .sidebar .nav {
    gap: 4px !important;
    flex: 1 !important;
    min-width: 0 !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
  }
  
  .sidebar .nav a {
    padding: 5px 8px !important;
    font-size: 11px !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }
  
  .sidebar .logout {
    font-size: 10px !important;
    padding: 0 !important;
    flex-shrink: 0 !important;
    white-space: nowrap !important;
  }
  
  .dashboard-container {
    padding: 1rem;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
  }
  
  .dashboard-header h1 {
    font-size: 2rem;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .chart-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .stat-card {
    padding: 1.5rem;
  }

  .stat-content h3 {
    font-size: 2rem;
  }

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

  .rings {
    width: 100% !important;
    justify-content: center !important;
    gap: 12px !important;
    flex-wrap: wrap !important;
    overflow-x: visible !important;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
    margin: 0 auto;
  }
  
  .ring {
    flex-shrink: 0 !important;
    width: 60px !important;
    height: 60px !important;
    margin: 0 !important;
  }
  
  .ring .label {
    font-size: 10px;
    bottom: -18px;
  }

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

  .thread-panel {
    padding: 18px;
  }

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

  .message-row {
    max-width: 100%;
  }

  .message-form {
    padding: 18px;
  }

  .new-thread-card {
    max-width: 100%;
  }
  
  .topbar {
    padding-top: 24px !important;
    padding-bottom: 8px !important;
    margin-top: 0;
    position: relative;
    z-index: 10;
  }
  
  .main {
    padding-top: 0 !important;
  }
  
  .user-chip,
  .user-chip-button {
    padding: 6px 10px;
    font-size: 12px;
  }
  
  .user-chip .avatar,
  .user-chip-button .avatar {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }
  
  .user-chip .meta .name,
  .user-chip-button .meta .name {
    font-size: 12px;
  }
  
  .user-chip .meta .mail,
  .user-chip-button .meta .mail {
    font-size: 10px;
  }
}

@media (max-width: 480px) {
  .dashboard-container {
    padding: 0.75rem;
  }
  
  .topbar {
    padding-top: 4px;
    padding-bottom: 4px;
  }
  
  .user-chip,
  .user-chip-button {
    padding: 4px 8px;
    font-size: 11px;
  }
  
  .user-chip .avatar,
  .user-chip-button .avatar {
    width: 24px;
    height: 24px;
    font-size: 11px;
  }
  
  .user-chip .meta .name,
  .user-chip-button .meta .name {
    font-size: 11px;
  }
  
  .user-chip .meta .mail,
  .user-chip-button .meta .mail {
    font-size: 9px;
  }
  
  .rings {
    gap: 8px !important;
    justify-content: center !important;
  }
  
  .ring {
    width: 50px !important;
    height: 50px !important;
  }
  
  .ring .label {
    font-size: 9px;
    bottom: -16px;
  }
  
  .main {
    padding: 0 16px 16px 16px;
  }
}

/* Custom Scrollbar */
.activity-feed::-webkit-scrollbar {
  width: 6px;
}

.activity-feed::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 3px;
}

.activity-feed::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  border-radius: 3px;
}

.activity-feed::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
}

/* Animation Classes */
.fade-in {
  animation: fadeIn 0.6s ease-out;
}

.slide-up {
  animation: slideUp 0.6s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

/* Loading Spinner */
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(102, 126, 234, 0.1);
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 2rem auto;
}

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

/* Flash Messages */
.flash-message {
  position: relative;
  margin-bottom: 16px;
  border-radius: 12px;
  padding: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  animation: slideInDown 0.3s ease-out;
  overflow: hidden;
}

.flash-message.flash-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-left: 4px solid #047857;
}

.flash-message.flash-warning {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  border-left: 4px solid #b45309;
}

.flash-message.flash-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  border-left: 4px solid #b91c1c;
}

.flash-content {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  color: #ffffff;
}

.flash-content i {
  font-size: 20px;
  flex-shrink: 0;
}

.flash-content span {
  flex: 1;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.5;
}

.flash-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 6px;
  color: #ffffff;
  cursor: pointer;
  padding: 6px 10px;
  font-size: 14px;
  transition: all 0.2s ease;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.flash-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

.flash-close:active {
  transform: scale(0.95);
}

.flash-message.flash-hiding {
  animation: slideOutUp 0.3s ease-out forwards !important;
  pointer-events: none;
}

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

@keyframes slideOutUp {
  from {
    opacity: 1;
    transform: translateY(0);
    max-height: 200px;
    margin-bottom: 16px;
  }
  to {
    opacity: 0;
    transform: translateY(-20px);
    max-height: 0;
    margin-bottom: 0;
    padding: 0;
  }
}
