/* ================================
   CaptainSurvey — Complete Styles
   Dark Mode Maritime Design
   ================================ */

:root {
  --navy-900: #0f172a;
  --navy-800: #1e293b;
  --navy-700: #334155;
  --navy-600: #475569;
  --navy-500: #64748b;
  --navy-400: #94a3b8;
  --navy-300: #cbd5e1;
  --navy-200: #e2e8f0;
  --navy-100: #f1f5f9;

  --cyan-500: #06b6d4;
  --cyan-400: #22d3ee;
  --cyan-300: #67e8f9;
  --cyan-600: #0891b2;
  --cyan-700: #0e7490;

  --accent-warn: #f59e0b;
  --accent-success: #10b981;
  --accent-danger: #ef4444;
  --accent-info: #3b82f6;

  --glass-bg: rgba(30, 41, 59, 0.7);
  --glass-bg-solid: rgba(30, 41, 59, 0.95);
  --glass-border: rgba(100, 116, 139, 0.3);
  --glass-border-light: rgba(100, 116, 139, 0.15);

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4), 0 2px 4px -2px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.5), 0 4px 6px -4px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 20px rgba(6, 182, 212, 0.15);

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

  --header-height: 60px;
  --sidebar-width: 260px;
  --sidebar-collapsed: 60px;
  --mobile-nav-height: 64px;
  --comm-panel-height: 280px;

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.4s ease;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--navy-900);
  color: var(--navy-200);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ================================
   LOADING SCREEN
   ================================ */
.loading-screen {
  position: fixed;
  inset: 0;
  background: var(--navy-900);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity var(--transition-slow), visibility var(--transition-slow);
}

.loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
}

.loading-content {
  text-align: center;
  animation: fadeInUp 0.6s ease;
}

.ship-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

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

.loading-content h1 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--cyan-400);
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.loading-content p {
  color: var(--navy-400);
  font-size: 0.95rem;
}

.loading-bar {
  width: 200px;
  height: 3px;
  background: var(--navy-700);
  border-radius: 3px;
  margin: 1.5rem auto 0;
  overflow: hidden;
}

.loading-progress {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--cyan-600), var(--cyan-400));
  border-radius: 3px;
  animation: loadingPulse 2s ease-in-out infinite;
}

@keyframes loadingPulse {
  0% { width: 0%; opacity: 0.5; }
  50% { width: 80%; opacity: 1; }
  100% { width: 100%; opacity: 0; }
}

/* ================================
   LOGIN SCREEN
   ================================ */
.login-screen {
  position: fixed;
  inset: 0;
  background: var(--navy-900);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000;
}

.login-screen.hidden {
  display: none;
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 2.5rem;
  border-radius: var(--radius-lg);
  animation: fadeInUp 0.5s ease;
}

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

.ship-icon-large {
  font-size: 3.5rem;
  margin-bottom: 0.5rem;
  display: block;
}

.login-header h1 {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--cyan-400);
  margin-bottom: 0.25rem;
}

.login-header p {
  color: var(--navy-400);
  font-size: 0.9rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--navy-300);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 0.75rem 1rem;
  background: var(--navy-800);
  border: 1.5px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--navy-200);
  font-size: 0.95rem;
  transition: all var(--transition-fast);
  width: 100%;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--cyan-500);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
}

.form-group input::placeholder {
  color: var(--navy-500);
}

.form-group input:invalid:not(:placeholder-shown) {
  border-color: var(--accent-warn);
}

.form-group input:valid:not(:placeholder-shown) {
  border-color: var(--accent-success);
}

.validation-hint {
  font-size: 0.75rem;
  color: var(--navy-500);
  min-height: 1.2em;
}

.password-input {
  position: relative;
}

.password-input input {
  padding-right: 2.5rem;
}

.toggle-password {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--navy-400);
  cursor: pointer;
  padding: 0.25rem;
}

.error-message {
  padding: 0.75rem 1rem;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-md);
  color: var(--accent-danger);
  font-size: 0.85rem;
}

.error-message.hidden {
  display: none;
}

.login-footer {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--glass-border);
  text-align: center;
}

.login-footer p {
  font-size: 0.8rem;
  color: var(--navy-500);
  margin-bottom: 0.5rem;
}

.demo-accounts {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.demo-badge {
  font-size: 0.75rem;
  color: var(--navy-400);
  background: var(--navy-800);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
}

/* ================================
   GLASSMORPHISM
   ================================ */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
}

.glass-strong {
  background: var(--glass-bg-solid);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid var(--glass-border);
}

/* ================================
   APP LAYOUT
   ================================ */
.app {
  display: flex;
  min-height: 100vh;
  padding-top: var(--header-height);
  padding-bottom: var(--comm-panel-height);
}

.app.comm-collapsed {
  padding-bottom: 44px;
}

.app.no-comm {
  padding-bottom: 0;
}

/* ================================
   TOP NAVIGATION
   ================================ */
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--glass-bg-solid);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  z-index: 100;
  gap: 1rem;
}

.nav-left,
.nav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--navy-300);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.menu-toggle:hover {
  background: var(--navy-700);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--cyan-400);
}

.ship-icon-small {
  font-size: 1.3rem;
}

.nav-center {
  flex: 1;
  max-width: 500px;
}

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

.search-bar i {
  position: absolute;
  left: 0.75rem;
  color: var(--navy-500);
  font-size: 0.9rem;
}

.search-bar input {
  width: 100%;
  padding: 0.6rem 2.5rem 0.6rem 2.25rem;
  background: var(--navy-800);
  border: 1.5px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--navy-200);
  font-size: 0.9rem;
  transition: all var(--transition-fast);
}

.search-bar input:focus {
  outline: none;
  border-color: var(--cyan-500);
  background: var(--navy-700);
}

.search-shortcut {
  position: absolute;
  right: 0.75rem;
  font-size: 0.7rem;
  color: var(--navy-500);
  background: var(--navy-700);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

.search-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  right: 0;
  background: var(--glass-bg-solid);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  max-height: 400px;
  overflow-y: auto;
  z-index: 200;
  box-shadow: var(--shadow-lg);
}

.search-dropdown.hidden {
  display: none;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background var(--transition-fast);
  border-bottom: 1px solid var(--glass-border-light);
}

.search-result-item:hover {
  background: var(--navy-700);
}

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

.search-result-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--navy-700);
  color: var(--cyan-400);
  font-size: 0.9rem;
}

.search-result-info {
  flex: 1;
}

.search-result-name {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--navy-200);
}

.search-result-meta {
  font-size: 0.8rem;
  color: var(--navy-500);
}

.search-result-type {
  font-size: 0.75rem;
  color: var(--cyan-400);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.notifications {
  position: relative;
}

.notification-btn {
  background: none;
  border: none;
  color: var(--navy-400);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.notification-btn:hover {
  color: var(--cyan-400);
  background: var(--navy-700);
}

.notification-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  background: var(--accent-danger);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.notification-badge.hidden {
  display: none;
}

.user-menu {
  position: relative;
}

.user-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: none;
  color: var(--navy-300);
  cursor: pointer;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
}

.user-btn:hover {
  background: var(--navy-700);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--navy-600);
}

.user-name {
  font-size: 0.85rem;
  font-weight: 500;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  background: var(--glass-bg-solid);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  min-width: 180px;
  z-index: 200;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.user-dropdown.hidden {
  display: none;
}

.user-dropdown a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1rem;
  color: var(--navy-300);
  text-decoration: none;
  font-size: 0.9rem;
  transition: background var(--transition-fast);
}

.user-dropdown a:hover {
  background: var(--navy-700);
  color: var(--cyan-400);
}

.user-dropdown hr {
  border: none;
  border-top: 1px solid var(--glass-border);
  margin: 0.25rem 0;
}

/* ================================
   SIDEBAR
   ================================ */
.sidebar {
  position: fixed;
  left: 0;
  top: var(--header-height);
  bottom: var(--comm-panel-height);
  width: var(--sidebar-width);
  background: var(--glass-bg-solid);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--glass-border);
  z-index: 90;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform var(--transition-normal), width var(--transition-normal);
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-badge {
  display: none;
}

.sidebar-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--glass-border);
}

.nav-section {
  padding: 0.75rem 0.75rem;
}

.nav-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--navy-500);
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  color: var(--navy-400);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  font-size: 0.9rem;
  position: relative;
}

.nav-item i {
  width: 24px;
  text-align: center;
  font-size: 1rem;
}

.nav-item:hover {
  background: var(--navy-700);
  color: var(--navy-200);
}

.nav-item.active {
  background: rgba(6, 182, 212, 0.1);
  color: var(--cyan-400);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--cyan-500);
  border-radius: 0 3px 3px 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--accent-warn);
  color: var(--navy-900);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.nav-badge.hidden {
  display: none;
}

/* ================================
   MAIN CONTENT
   ================================ */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 1.5rem;
  overflow-y: auto;
  min-height: calc(100vh - var(--header-height) - var(--comm-panel-height));
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--navy-100);
}

.page-subtitle {
  color: var(--navy-500);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

.page-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ================================
   BUTTONS
   ================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-primary {
  background: var(--cyan-600);
  color: white;
}

.btn-primary:hover {
  background: var(--cyan-500);
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.3);
}

.btn-secondary {
  background: var(--navy-700);
  color: var(--navy-300);
  border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
  background: var(--navy-600);
  color: var(--navy-200);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-danger);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

.btn-success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-success);
}

.btn-success:hover {
  background: rgba(16, 185, 129, 0.25);
}

.btn-ghost {
  background: transparent;
  color: var(--navy-400);
}

.btn-ghost:hover {
  background: var(--navy-700);
  color: var(--navy-200);
}

.btn-large {
  padding: 0.85rem 1.5rem;
  font-size: 1rem;
}

.btn-small {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ================================
   CARDS
   ================================ */
.card {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  transition: all var(--transition-fast);
}

.card:hover {
  border-color: var(--glass-border-light);
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--navy-200);
}

.card-subtitle {
  font-size: 0.8rem;
  color: var(--navy-500);
  margin-top: 0.15rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.card-grid-2 {
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
}

/* ================================
   STATS / DASHBOARD WIDGETS
   ================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  transition: all var(--transition-fast);
}

.stat-card:hover {
  border-color: var(--cyan-500);
  box-shadow: var(--shadow-glow);
}

.stat-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: rgba(6, 182, 212, 0.1);
  color: var(--cyan-400);
  font-size: 1.1rem;
  flex-shrink: 0;
}

.stat-info {
  flex: 1;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--navy-100);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--navy-500);
  margin-top: 0.2rem;
}

.stat-change {
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 0.3rem;
}

.stat-change.positive {
  color: var(--accent-success);
}

.stat-change.negative {
  color: var(--accent-danger);
}

/* ================================
   TABLE
   ================================ */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

thead {
  background: var(--navy-800);
}

th {
  padding: 0.8rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--navy-400);
  border-bottom: 1px solid var(--glass-border);
  white-space: nowrap;
}

td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--glass-border-light);
  color: var(--navy-300);
}

tr:hover td {
  background: rgba(30, 41, 59, 0.5);
}

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

/* ================================
   STATUS BADGES
   ================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.badge-status-active,
.badge-status-scheduled {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-success);
}

.badge-status-planning {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-info);
}

.badge-status-completed {
  background: rgba(100, 116, 139, 0.2);
  color: var(--navy-400);
}

.badge-status-cancelled,
.badge-status-inactive {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-danger);
}

.badge-status-on_hold {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-warn);
}

.badge-priority-urgent {
  background: rgba(239, 68, 68, 0.2);
  color: var(--accent-danger);
}

.badge-priority-high {
  background: rgba(245, 158, 11, 0.2);
  color: var(--accent-warn);
}

.badge-priority-normal {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-info);
}

.badge-priority-low {
  background: rgba(100, 116, 139, 0.2);
  color: var(--navy-400);
}

/* ================================
   TIMELINE
   ================================ */
.timeline-container {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 1rem 0;
  margin-bottom: 1rem;
}

.timeline-day {
  min-width: 80px;
  text-align: center;
  padding: 0.75rem 0.5rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}

.timeline-day:hover {
  background: var(--navy-700);
}

.timeline-day.active {
  background: rgba(6, 182, 212, 0.1);
  border-color: var(--cyan-500);
}

.timeline-day.past {
  opacity: 0.5;
}

.timeline-day.today {
  background: rgba(6, 182, 212, 0.15);
  border-color: var(--cyan-600);
}

.timeline-day-number {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--navy-200);
}

.timeline-day-weekday {
  font-size: 0.7rem;
  color: var(--navy-500);
  text-transform: uppercase;
}

.timeline-day-events {
  display: flex;
  gap: 2px;
  justify-content: center;
  margin-top: 0.4rem;
}

.timeline-event-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan-500);
}

.timeline-event-dot.survey { background: var(--cyan-500); }
.timeline-event-dot.inspection { background: var(--accent-warn); }
.timeline-event-dot.milestone { background: var(--accent-success); }
.timeline-event-dot.meeting { background: var(--accent-info); }

/* ================================
   MAP
   ================================ */
.map-container {
  height: 400px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--glass-border);
}

.map-container .leaflet-container {
  background: var(--navy-800);
}

/* ================================
   PROGRESS BAR
   ================================ */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--navy-700);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan-600), var(--cyan-400));
  border-radius: 3px;
  transition: width 0.5s ease;
}

/* ================================
   COMMUNICATIONS PANEL
   ================================ */
.comm-panel {
  position: fixed;
  left: var(--sidebar-width);
  right: 0;
  bottom: 0;
  height: var(--comm-panel-height);
  background: var(--glass-bg-solid);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--glass-border);
  z-index: 80;
  display: flex;
  flex-direction: column;
  transition: height var(--transition-normal);
}

.comm-panel.collapsed {
  height: 44px;
}

.comm-panel.collapsed .comm-body {
  display: none;
}

.comm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0;
}

.comm-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--navy-300);
}

.comm-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.comm-select {
  padding: 0.35rem 0.75rem;
  background: var(--navy-800);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--navy-300);
  font-size: 0.85rem;
}

.comm-toggle {
  background: none;
  border: none;
  color: var(--navy-400);
  cursor: pointer;
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.comm-toggle:hover {
  background: var(--navy-700);
}

.comm-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.comm-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.comm-placeholder {
  text-align: center;
  color: var(--navy-500);
  padding: 2rem;
}

.message {
  max-width: 75%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  animation: messageIn 0.3s ease;
}

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

.message.own {
  align-self: flex-end;
  background: var(--cyan-600);
  color: white;
}

.message.other {
  align-self: flex-start;
  background: var(--navy-700);
  color: var(--navy-300);
}

.message.system {
  align-self: center;
  background: var(--navy-800);
  color: var(--navy-500);
  font-size: 0.8rem;
  font-style: italic;
  max-width: 90%;
}

.message-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.message-time {
  font-size: 0.7rem;
  opacity: 0.7;
  font-weight: 400;
}

.message-content {
  font-size: 0.9rem;
  line-height: 1.4;
}

.comm-input-area {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--glass-border);
}

.comm-input-area input {
  flex: 1;
  padding: 0.6rem 1rem;
  background: var(--navy-800);
  border: 1.5px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--navy-200);
  font-size: 0.9rem;
}

.comm-input-area input:focus {
  outline: none;
  border-color: var(--cyan-500);
}

.comm-input-area input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.comm-input-area button {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cyan-600);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.comm-input-area button:hover:not(:disabled) {
  background: var(--cyan-500);
}

.comm-input-area button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ================================
   MOBILE NAV
   ================================ */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--mobile-nav-height);
  background: var(--glass-bg-solid);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--glass-border);
  z-index: 100;
  justify-content: space-around;
  align-items: center;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  color: var(--navy-500);
  text-decoration: none;
  font-size: 0.7rem;
  padding: 0.5rem;
  transition: color var(--transition-fast);
}

.mobile-nav-item i {
  font-size: 1.25rem;
}

.mobile-nav-item.active {
  color: var(--cyan-400);
}

/* ================================
   TOAST NOTIFICATIONS
   ================================ */
.toast-container {
  position: fixed;
  top: calc(var(--header-height) + 1rem);
  right: 1rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  color: white;
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 4s forwards;
  box-shadow: var(--shadow-lg);
  min-width: 280px;
}

.toast.success { background: var(--accent-success); }
.toast.error { background: var(--accent-danger); }
.toast.warning { background: var(--accent-warn); }
.toast.info { background: var(--accent-info); }

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

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

/* ================================
   MODAL
   ================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

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

.modal-content {
  background: var(--glass-bg-solid);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: fadeInUp 0.3s ease;
}

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

.modal-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--navy-400);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.modal-close:hover {
  color: var(--accent-danger);
  background: rgba(239, 68, 68, 0.1);
}

.modal-body {
  padding: 1.25rem;
}

.modal-footer {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--glass-border);
}

/* ================================
   FORM ELEMENTS
   ================================ */
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

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

select option {
  background: var(--navy-800);
  color: var(--navy-200);
}

/* ================================
   FILTERS
   ================================ */
.filters-bar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  align-items: center;
}

.filters-bar input,
.filters-bar select {
  padding: 0.5rem 0.75rem;
  background: var(--navy-800);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--navy-300);
  font-size: 0.85rem;
}

/* ================================
   PAGINATION
   ================================ */
.pagination {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  justify-content: center;
}

.pagination button {
  padding: 0.4rem 0.8rem;
  background: var(--navy-800);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--navy-400);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.pagination button:hover:not(:disabled) {
  background: var(--navy-700);
  color: var(--navy-200);
}

.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination button.active {
  background: var(--cyan-600);
  color: white;
  border-color: var(--cyan-600);
}

.pagination-info {
  font-size: 0.85rem;
  color: var(--navy-500);
}

/* ================================
   EMPTY STATE
   ================================ */
.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--navy-500);
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 1.1rem;
  color: var(--navy-400);
  margin-bottom: 0.5rem;
}

.empty-state p {
  font-size: 0.9rem;
}

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

.tab {
  padding: 0.6rem 1rem;
  background: none;
  border: none;
  color: var(--navy-500);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
  font-family: inherit;
}

.tab:hover {
  color: var(--navy-300);
}

.tab.active {
  color: var(--cyan-400);
  border-bottom-color: var(--cyan-500);
}

.tab-content {
  display: none;
}

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

/* ================================
   DETAIL VIEW
   ================================ */
.detail-layout {
  display: grid;
  grid-template-columns: 1fr 350px;
  gap: 1.5rem;
}

.detail-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.detail-section {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.detail-section h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--navy-200);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.detail-field {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--glass-border-light);
}

.detail-field:last-child {
  border-bottom: none;
}

.detail-field-label {
  font-size: 0.85rem;
  color: var(--navy-500);
}

.detail-field-value {
  font-size: 0.85rem;
  color: var(--navy-300);
  font-weight: 500;
}

/* ================================
   ANIMATIONS
   ================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

.animate-fade {
  animation: fadeIn 0.4s ease;
}

.animate-slide {
  animation: slideIn 0.4s ease;
}

/* ================================
   SCROLLBAR
   ================================ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--navy-600);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--navy-500);
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ================================
   RESPONSIVE
   ================================ */
@media (max-width: 1024px) {
  .detail-layout {
    grid-template-columns: 1fr;
  }
  .card-grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 0;
  }

  .menu-toggle {
    display: block;
  }

  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width-mobile, 280px);
    z-index: 95;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar .logo-text {
    display: inline;
  }

  .sidebar .nav-label,
  .sidebar .nav-item span,
  .sidebar .nav-badge {
    display: inline;
  }

  .main-content {
    margin-left: 0;
    padding: 1rem;
  }

  .comm-panel {
    left: 0;
  }

  .mobile-nav {
    display: flex;
  }

  .app {
    padding-bottom: calc(var(--mobile-nav-height) + var(--comm-panel-height));
  }

  .app.comm-collapsed {
    padding-bottom: calc(var(--mobile-nav-height) + 44px);
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .search-shortcut {
    display: none;
  }

  .user-name {
    display: none;
  }

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

  .nav-center {
    max-width: none;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .login-card {
    padding: 1.5rem;
  }

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

  .timeline-container {
    gap: 0.25rem;
  }

  .timeline-day {
    min-width: 60px;
    padding: 0.5rem 0.35rem;
  }

  .table-container {
    font-size: 0.85rem;
  }

  th, td {
    padding: 0.6rem 0.75rem;
  }
}
