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

:root {
  --bg-primary: #01030f;
  --bg-secondary: #080b18;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-solid: #0f1225;
  --bg-card-hover: rgba(255, 255, 255, 0.07);
  --bg-input: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.10);
  --border-hover: rgba(255, 255, 255, 0.18);
  --border-focus: #0081ff;
  --text-primary: #f0f1f5;
  --text-secondary: #a0a6c0;
  --text-muted: #6b7194;
  --accent: #0081ff;
  --accent-light: #45a5ff;
  --accent-hover: #5ab0ff;
  --accent-soft: rgba(0, 129, 255, 0.06);
  --accent-glow: rgba(0, 129, 255, 0.10);
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;
  --info: #818cf8;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 7px;
  --shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.3);
  --sidebar-width: 250px;
  --transition: 0.3s cubic-bezier(0.215, 0.61, 0.355, 1);
  --transition-fast: 0.15s ease;
  --transition-slow: 0.5s cubic-bezier(0.215, 0.61, 0.355, 1);
  --glass: blur(18px) saturate(1.3);
  --glass-heavy: blur(24px) saturate(1.5);
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* Ambient background effects */
body::before {
  content: '';
  position: fixed;
  top: -30%;
  left: -10%;
  width: 60%;
  height: 60%;
  background: radial-gradient(ellipse, rgba(0, 129, 255, 0.04) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  animation: ambientDrift 20s ease-in-out infinite alternate;
}

body::after {
  content: '';
  position: fixed;
  bottom: -30%;
  right: -10%;
  width: 50%;
  height: 50%;
  background: radial-gradient(ellipse, rgba(69, 165, 255, 0.025) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  animation: ambientDrift 25s ease-in-out infinite alternate-reverse;
}

@keyframes ambientDrift {
  0% { transform: translate(0, 0); }
  100% { transform: translate(30px, -20px); }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.06); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.12); }

/* ===== Utilities ===== */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); text-align: center; padding: 2rem; }

/* ===== Animations ===== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

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

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

@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

@keyframes breathe {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 129, 255, 0); }
  50% { box-shadow: 0 0 30px 4px rgba(0, 129, 255, 0.06); }
}

.page.active {
  animation: fadeInUp 0.4s var(--transition) both;
}

/* ===== Login Screen ===== */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg-primary);
  position: relative;
  overflow: hidden;
}

.login-screen::before {
  content: '';
  position: absolute;
  width: 700px;
  height: 700px;
  background: conic-gradient(from 90deg, rgba(0, 77, 153, 0) 75%, rgba(0, 129, 255, 0.3) 75%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.15;
  filter: blur(80px);
  animation: radarSpin 8s linear infinite;
}

@keyframes radarSpin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.login-card {
  background: rgba(11, 14, 28, 0.8);
  backdrop-filter: var(--glass-heavy);
  -webkit-backdrop-filter: var(--glass-heavy);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2.5rem;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow);
  position: relative;
  z-index: 1;
  animation: fadeInUp 0.6s ease both;
}

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

.login-logo i {
  font-size: 2rem;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 16px rgba(0, 129, 255, 0.4));
}

.login-logo h1 {
  font-size: 1.6rem;
  font-weight: 600;
  margin-top: 0.75rem;
  letter-spacing: -0.03em;
  background: linear-gradient(90deg, #5ab0ff 0%, #ffffff 50%, #5ab0ff 100%);
  background-size: 300% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 6s linear infinite;
}

.login-logo p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: 0.3rem;
}

/* ===== Forms ===== */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  transition: all var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(0, 129, 255, 0.03);
  box-shadow: 0 0 0 3px var(--accent-soft), 0 0 20px rgba(0, 129, 255, 0.05);
}

.form-compact { max-width: 400px; }
.error-message { color: var(--danger); font-size: 0.8rem; padding: 0.4rem 0; }
.success-message { color: var(--success); font-size: 0.8rem; padding: 0.4rem 0; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border: none;
  border-radius: var(--radius-xs);
  font-size: 0.85rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 1px rgba(0, 129, 255, 0.3);
}

.btn-primary:hover {
  background: var(--accent-light);
  box-shadow: 0 4px 24px rgba(0, 129, 255, 0.3), 0 0 0 1px rgba(69, 165, 255, 0.4);
  transform: translateY(-1px);
}

.btn-primary:active { transform: translateY(0); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.15);
}

.btn-danger:hover {
  background: rgba(248, 113, 113, 0.06);
  border-color: rgba(248, 113, 113, 0.3);
}

.btn-ghost {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: rgba(0, 0, 0, 0.1);
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.btn-full { width: 100%; justify-content: center; }

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.35rem;
  border-radius: var(--radius-xs);
  transition: all var(--transition-fast);
}

.btn-icon:hover { color: var(--text-primary); background: var(--bg-card-hover); }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.78rem; }

/* ===== App Layout ===== */
.app {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-width);
  background: rgba(8, 11, 24, 0.7);
  backdrop-filter: var(--glass-heavy);
  -webkit-backdrop-filter: var(--glass-heavy);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

/* Sidebar entrance animation - desktop only */
@media (min-width: 1025px) {
  .sidebar {
    animation: slideInLeft 0.5s ease both;
  }
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 1.15rem 1.1rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  border-bottom: 1px solid var(--border);
  transition: all var(--transition);
}

.sidebar-header:hover {
  background: var(--bg-card-hover);
}

.sidebar-header i {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 8px rgba(0, 129, 255, 0.4));
}

.sidebar-nav {
  flex: 1;
  padding: 0.65rem 0.45rem;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 450;
  font-size: 0.88rem;
  transition: all var(--transition);
  position: relative;
}

.nav-item:hover {
  color: var(--text-secondary);
  background: var(--bg-card-hover);
}

.nav-item.active {
  color: var(--accent-light);
  background: var(--accent-soft);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: -0.45rem;
  width: 3px;
  height: 18px;
  background: linear-gradient(180deg, var(--accent), var(--accent-light));
  border-radius: 0 3px 3px 0;
  box-shadow: 0 0 12px rgba(0, 129, 255, 0.5);
}

.sidebar-footer {
  padding: 0.6rem;
  border-top: 1px solid var(--border);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-xs);
  transition: all var(--transition);
}

.user-info:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

/* ===== User Menu ===== */
.user-menu {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: rgba(11, 14, 28, 0.95);
  backdrop-filter: var(--glass-heavy);
  -webkit-backdrop-filter: var(--glass-heavy);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-sm);
  margin-bottom: 0.4rem;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: fadeInUp 0.2s ease both;
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.85rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  transition: all var(--transition-fast);
}

.user-menu-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.user-menu-danger:hover { color: var(--danger); }

/* ===== Content ===== */
.content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 1.75rem 2rem;
  max-width: 1200px;
  position: relative;
  z-index: 1;
}

.page { display: none; position: relative; }
.page.active { display: block; }

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

.page-header h2 {
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}

/* ===== Jarvis Dashboard ===== */

/* Header layout */
.jarvis-header-left {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.jarvis-header-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.jarvis-title {
  background: linear-gradient(90deg, #00c3ff 0%, #fff 40%, #00c3ff 80%);
  background-size: 300% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 6s linear infinite;
  font-size: 1.5rem;
  letter-spacing: 0.15em;
  font-weight: 700;
}

.jarvis-subtitle {
  font-size: 0.62rem;
  letter-spacing: 0.25em;
  color: rgba(0, 195, 255, 0.5);
  font-weight: 500;
  text-transform: uppercase;
}

.jarvis-clock {
  font-family: 'Inter', monospace;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: rgba(0, 195, 255, 0.7);
  text-shadow: 0 0 10px rgba(0, 195, 255, 0.3);
  padding: 0.3rem 0.65rem;
  border: 1px solid rgba(0, 195, 255, 0.12);
  border-radius: var(--radius-xs);
  background: rgba(0, 195, 255, 0.03);
}

.jarvis-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.jarvis-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #00ffa3;
  box-shadow: 0 0 8px #00ffa3, 0 0 20px rgba(0, 255, 163, 0.4), 0 0 40px rgba(0, 255, 163, 0.1);
  animation: breathe 2s ease-in-out infinite;
}

.jarvis-status-text {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: #00ffa3;
  text-transform: uppercase;
  text-shadow: 0 0 10px rgba(0, 255, 163, 0.3);
}

/* Jarvis stat cards */
.jarvis-stat {
  position: relative;
  overflow: hidden;
}

.jarvis-stat::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 195, 255, 0.4), transparent);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.jarvis-stat:hover::before {
  opacity: 1;
}

.jarvis-stat::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 30px;
  height: 30px;
  border-top: 1px solid rgba(0, 195, 255, 0.15);
  border-right: 1px solid rgba(0, 195, 255, 0.15);
  border-radius: 0 var(--radius) 0 0;
  pointer-events: none;
}

.jarvis-number {
  font-family: 'Inter', monospace;
  letter-spacing: 0.03em;
  text-shadow: 0 0 20px rgba(0, 195, 255, 0.15);
}

/* Holographic card effect */
.jarvis-holo-card {
  position: relative;
  overflow: hidden;
}

.jarvis-holo-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(from 0deg, transparent 0%, rgba(0, 195, 255, 0.03) 25%, transparent 50%, rgba(0, 195, 255, 0.03) 75%, transparent 100%);
  animation: holoRotate 8s linear infinite;
  pointer-events: none;
}

@keyframes holoRotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Jarvis section styling */
.jarvis-section {
  position: relative;
}

.jarvis-section::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, rgba(0, 195, 255, 0.4), rgba(0, 195, 255, 0.05));
  border-radius: 2px;
}

/* Detail title */
.jarvis-detail-title {
  letter-spacing: 0.05em;
  text-shadow: 0 0 20px rgba(0, 195, 255, 0.2);
}

/* Projects Grid */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

.project-card {
  background: rgba(5, 10, 25, 0.6);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  border: 1px solid rgba(0, 195, 255, 0.08);
  border-radius: var(--radius);
  padding: 1.25rem;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  animation: fadeInUp 0.5s ease both;
}

.project-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(0, 195, 255, 0.6), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.project-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 195, 255, 0.15), transparent);
}

.project-card:hover {
  border-color: rgba(0, 195, 255, 0.25);
  background: rgba(0, 195, 255, 0.04);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 0 40px rgba(0, 195, 255, 0.08), inset 0 1px 0 rgba(0, 195, 255, 0.1);
}

.project-card:hover::before {
  opacity: 1;
}

.project-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.project-card-name {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  flex: 1;
  min-width: 0;
}

.project-card-lang {
  font-size: 0.68rem;
  padding: 0.1rem 0.5rem;
  border-radius: 99px;
  background: rgba(129, 140, 248, 0.08);
  color: var(--info);
  border: 1px solid rgba(129, 140, 248, 0.12);
  white-space: nowrap;
  font-weight: 500;
}

.project-card-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Circular Progress */
.project-progress-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.progress-ring-container {
  position: relative;
  width: 56px;
  height: 56px;
  flex-shrink: 0;
}

.progress-ring {
  width: 56px;
  height: 56px;
  transform: rotate(-90deg);
}

.progress-ring .ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.04);
  stroke-width: 5;
}

.progress-ring .ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 5;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s cubic-bezier(0.4, 0, 0.2, 1), stroke 0.3s ease;
  filter: drop-shadow(0 0 8px rgba(0, 195, 255, 0.5)) drop-shadow(0 0 20px rgba(0, 195, 255, 0.2));
}

.ring-pct {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.project-progress-info {
  flex: 1;
  min-width: 0;
}

.project-progress-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.25rem;
}

.project-progress-bar-wrap {
  height: 4px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 99px;
  overflow: hidden;
}

.project-progress-bar {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), #00c3ff);
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 10px rgba(0, 195, 255, 0.4), 0 0 20px rgba(0, 195, 255, 0.1);
  position: relative;
}

.project-progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 20px;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4));
  border-radius: 99px;
  animation: barPulse 2s ease-in-out infinite;
}

@keyframes barPulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.8; }
}

.project-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.85rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
}

.project-card-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.project-card-status {
  font-size: 0.68rem;
  padding: 0.12rem 0.55rem;
  border-radius: 99px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.project-card-status.status-active {
  background: rgba(0, 195, 255, 0.08);
  color: #00c3ff;
  border: 1px solid rgba(0, 195, 255, 0.2);
  text-shadow: 0 0 8px rgba(0, 195, 255, 0.3);
}

.project-card-status.status-complete {
  background: rgba(0, 255, 163, 0.08);
  color: #00ffa3;
  border: 1px solid rgba(0, 255, 163, 0.2);
  text-shadow: 0 0 8px rgba(0, 255, 163, 0.3);
}

.project-card-status.status-no-data {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* Progress color states */
.ring-danger { stroke: var(--danger) !important; filter: drop-shadow(0 0 8px rgba(248, 113, 113, 0.5)) drop-shadow(0 0 20px rgba(248, 113, 113, 0.2)) !important; }
.ring-warning { stroke: var(--warning) !important; filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.5)) drop-shadow(0 0 20px rgba(251, 191, 36, 0.2)) !important; }
.ring-success { stroke: #00ffa3 !important; filter: drop-shadow(0 0 8px rgba(0, 255, 163, 0.5)) drop-shadow(0 0 20px rgba(0, 255, 163, 0.2)) !important; }
.bar-danger { background: linear-gradient(90deg, var(--danger), #fca5a5) !important; box-shadow: 0 0 12px rgba(248, 113, 113, 0.4) !important; }
.bar-warning { background: linear-gradient(90deg, var(--warning), #fde68a) !important; box-shadow: 0 0 12px rgba(251, 191, 36, 0.4) !important; }
.bar-success { background: linear-gradient(90deg, #00ffa3, #6ee7b7) !important; box-shadow: 0 0 12px rgba(0, 255, 163, 0.4) !important; }

/* Project Detail */
.project-detail {
  animation: fadeInUp 0.4s ease both;
}

.project-detail-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.project-detail-header h3 {
  flex: 1;
  font-size: 1.2rem;
  font-weight: 600;
}

.project-detail-body {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 1.5rem;
}

.detail-progress-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  background: rgba(5, 10, 25, 0.7);
  backdrop-filter: var(--glass);
  border: 1px solid rgba(0, 195, 255, 0.1);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.detail-progress-ring-wrap {
  position: relative;
  width: 120px;
  height: 120px;
}

.detail-progress-ring {
  width: 120px;
  height: 120px;
  transform: rotate(-90deg);
}

.detail-progress-ring .ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.04);
  stroke-width: 6;
}

.detail-progress-ring .ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s cubic-bezier(0.4, 0, 0.2, 1);
  filter: drop-shadow(0 0 12px rgba(0, 195, 255, 0.6)) drop-shadow(0 0 30px rgba(0, 195, 255, 0.2));
}

.detail-ring-pct {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
}

.detail-goal {
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

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

.detail-section {
  background: var(--bg-card);
  backdrop-filter: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
}

.detail-section h4 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(0, 195, 255, 0.7);
  margin-bottom: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-shadow: 0 0 10px rgba(0, 195, 255, 0.15);
}

.detail-section h4 i {
  font-size: 0.9rem;
}

.detail-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.detail-list-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
  padding: 0.35rem 0;
}

.detail-list-item::before {
  content: '//';
  color: rgba(0, 195, 255, 0.5);
  font-weight: 600;
  font-size: 0.7rem;
  flex-shrink: 0;
  font-family: monospace;
}

.project-no-summary {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* projects/detail responsive - see consolidated responsive section below */

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

.stat-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  transition: all var(--transition);
  animation: fadeInUp 0.5s ease both;
}

.stat-card:nth-child(1) { animation-delay: 0s; }
.stat-card:nth-child(2) { animation-delay: 0.06s; }
.stat-card:nth-child(3) { animation-delay: 0.12s; }
.stat-card:nth-child(4) { animation-delay: 0.18s; }

.stat-card:hover {
  border-color: rgba(0, 129, 255, 0.15);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 129, 255, 0.08);
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-xs);
  background: var(--accent-soft);
  border: 1px solid rgba(0, 129, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--accent-light);
  transition: all var(--transition);
}

.stat-card:hover .stat-icon {
  box-shadow: 0 0 20px rgba(0, 129, 255, 0.15);
  border-color: rgba(0, 129, 255, 0.2);
}

.stat-value {
  display: block;
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.stat-label {
  display: block;
  font-size: 0.73rem;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

/* ===== Cards ===== */
.card {
  background: var(--bg-card);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1.15rem;
  transition: all var(--transition);
  animation: fadeInUp 0.4s ease both;
}

.card:hover {
  border-color: var(--border-hover);
}

.card-header {
  padding: 0.9rem 1.15rem;
  border-bottom: 1px solid var(--border);
}

.card-header h3 {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: -0.01em;
}

.card-body { padding: 1.15rem; }

/* ===== IPAM Grid ===== */
.ipam-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}

.ipam-cell:hover {
  transform: scale(1.4);
  z-index: 1;
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(0, 129, 255, 0.25);
}

.ipam-cell.free {
  background: rgba(255, 255, 255, 0.012);
  color: var(--text-muted);
  border-color: rgba(255, 255, 255, 0.025);
}

.ipam-cell.assigned {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 0 4px rgba(0, 129, 255, 0.2);
}

.ipam-cell.reserved {
  background: var(--text-muted);
  color: var(--bg-primary);
  font-weight: 600;
}

.btn-ghost.active-tab {
  background: var(--accent-soft);
  color: var(--accent-light);
  border-color: rgba(0, 129, 255, 0.2);
}

/* ===== Activity List ===== */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid transparent;
  transition: all var(--transition);
}

.activity-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--border);
}

.activity-item .activity-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1px solid rgba(0, 129, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-light);
  font-size: 0.85rem;
}

.activity-item .activity-info { flex: 1; font-size: 0.85rem; }
.activity-item .activity-info strong { font-weight: 500; }
.activity-item .activity-time { font-size: 0.73rem; color: var(--text-muted); }

/* ===== Tools Grid ===== */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 0.85rem;
}

.tool-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem;
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
}

.tool-card:hover {
  border-color: rgba(0, 129, 255, 0.12);
  background: var(--bg-card-hover);
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(0, 129, 255, 0.06);
}

.tool-card-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}

.tool-card-header i { font-size: 1.15rem; color: var(--accent-light); }
.tool-card-header h4 { font-size: 0.95rem; font-weight: 500; }

.tool-card p {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.tool-card .tool-category {
  display: inline-block;
  margin-top: 0.6rem;
  padding: 0.15rem 0.55rem;
  font-size: 0.68rem;
  background: var(--accent-soft);
  color: var(--accent-light);
  border: 1px solid rgba(0, 129, 255, 0.08);
  border-radius: 99px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.tool-card-actions {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  display: flex;
  gap: 0.2rem;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.tool-card:hover .tool-card-actions { opacity: 1; }

/* ===== Table ===== */
.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 0.65rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.table th {
  font-weight: 500;
  color: var(--text-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.table tbody tr {
  transition: all var(--transition-fast);
}

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

/* Status badges */
.status {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.12rem 0.55rem;
  border-radius: 99px;
  font-size: 0.73rem;
  font-weight: 500;
}

.status::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

.status-online { color: var(--success); background: rgba(52, 211, 153, 0.06); }
.status-online::before { background: var(--success); animation: breathe 2s ease-in-out infinite; }
.status-offline { color: var(--danger); background: rgba(248, 113, 113, 0.06); }
.status-offline::before { background: var(--danger); }
.status-unknown { color: var(--text-muted); background: rgba(61, 66, 96, 0.15); }
.status-unknown::before { background: var(--text-muted); }

/* ===== Modal ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(1, 3, 15, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.modal-content {
  position: relative;
  background: rgba(11, 14, 28, 0.95);
  backdrop-filter: var(--glass-heavy);
  -webkit-backdrop-filter: var(--glass-heavy);
  border: 1px solid var(--border-hover);
  border-radius: 16px;
  width: 100%;
  max-width: 460px;
  box-shadow: var(--shadow), 0 0 80px rgba(0, 129, 255, 0.03);
  animation: modalIn 0.3s cubic-bezier(0.215, 0.61, 0.355, 1) both;
}

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

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

.modal-header h3 { font-size: 1rem; font-weight: 500; }
.modal-body { padding: 1.15rem; }
.modal-content.modal-wide { max-width: 900px; }

/* Email-to-Chat styles */
.e2c-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; min-height: 400px; }
/* e2c responsive - see consolidated responsive section below */
.e2c-textarea { width:100%; min-height:350px; background:var(--bg-input); border:1px solid var(--border); border-radius:var(--radius-xs); padding:0.85rem; color:var(--text-primary); font-family:'Inter',monospace; font-size:0.8rem; line-height:1.6; resize:vertical; }
.e2c-textarea:focus { outline:none; border-color:var(--accent); }
.e2c-chat { background:rgba(0,0,0,0.2); border:1px solid var(--border); border-radius:var(--radius-sm); display:flex; flex-direction:column; min-height:350px; max-height:60vh; overflow:hidden; }
.e2c-chat-header { padding:0.75rem 1rem; border-bottom:1px solid var(--border); font-weight:500; font-size:0.85rem; color:var(--text-secondary); }
.e2c-chat-body { flex:1; overflow-y:auto; padding:1rem; display:flex; flex-direction:column; gap:0.6rem; }
.e2c-empty { flex:1; display:flex; align-items:center; justify-content:center; color:var(--text-muted); font-size:0.85rem; }
.e2c-msg { display:flex; flex-direction:column; gap:0.15rem; max-width:80%; }
.e2c-msg.out { align-self:flex-end; align-items:flex-end; }
.e2c-msg.in { align-self:flex-start; align-items:flex-start; }
.e2c-meta { display:flex; align-items:center; gap:0.4rem; font-size:0.72rem; }
.e2c-msg.out .e2c-meta { flex-direction:row-reverse; }
.e2c-avatar { width:24px; height:24px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:0.55rem; font-weight:700; color:#fff; flex-shrink:0; }
.e2c-sender { font-weight:600; font-size:0.75rem; }
.e2c-time { color:var(--text-muted); font-size:0.68rem; }
.e2c-bubble { padding:0.6rem 0.85rem; border-radius:14px; font-size:0.82rem; line-height:1.55; white-space:pre-wrap; word-break:break-word; }
.e2c-msg.in .e2c-bubble { background:rgba(255,255,255,0.04); border:1px solid var(--border); border-top-left-radius:4px; }
.e2c-msg.out .e2c-bubble { background:var(--accent); color:#fff; border-top-right-radius:4px; }
.e2c-divider { display:flex; align-items:center; gap:0.5rem; color:var(--text-muted); font-size:0.7rem; font-weight:500; align-self:stretch; }
.e2c-divider::before,.e2c-divider::after { content:''; flex:1; height:1px; background:var(--border); }

/* Subnet calc responsive - see consolidated responsive section below */

/* ===== Settings Modal ===== */
.settings-modal-content {
  max-width: 720px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.settings-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.settings-nav {
  width: 180px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.75rem;
  border-right: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
}

.settings-nav-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  border: none;
  border-radius: var(--radius-xs);
  background: none;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 450;
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
}

.settings-nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.settings-nav-item.active {
  background: var(--accent-soft);
  color: var(--accent-light);
}

.settings-panel {
  flex: 1;
  padding: 1.15rem;
  overflow-y: auto;
  min-height: 0;
}

.settings-tab {
  display: none;
}

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

.settings-tab .card + .card {
  margin-top: 1rem;
}

/* ===== PDF Tool ===== */
.pdf-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.015);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.pdf-dropzone:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* Page thumbnail grid */
.pdf-pages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.65rem;
  margin-top: 1rem;
  max-height: 50vh;
  overflow-y: auto;
  padding: 2px;
}

.pdf-thumb {
  position: relative;
  background: rgba(255, 255, 255, 0.03);
  border: 2px solid transparent;
  border-radius: var(--radius-xs);
  padding: 0.35rem;
  cursor: grab;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.pdf-thumb:hover {
  border-color: var(--border-hover);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.pdf-thumb-selected {
  border-color: var(--accent) !important;
  background: var(--accent-soft);
  box-shadow: 0 0 0 2px rgba(0, 129, 255, 0.2), 0 4px 16px rgba(0,0,0,0.2);
}

.pdf-thumb img {
  width: 100%;
  height: auto;
  border-radius: 3px;
  display: block;
  pointer-events: none;
}

.pdf-thumb-label {
  position: absolute;
  top: 0.25rem;
  left: 0.25rem;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  line-height: 1.3;
}

.pdf-thumb-src {
  display: block;
  font-size: 0.62rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pdf-thumb-group {
  position: absolute;
  bottom: 0.25rem;
  left: 0.25rem;
  right: 0.25rem;
  text-align: center;
  font-size: 0.6rem;
  font-weight: 600;
  color: #fff;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pdf-thumb-remove {
  position: absolute;
  top: 0.2rem;
  right: 0.2rem;
  background: rgba(0, 0, 0, 0.6);
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}

.pdf-thumb:hover .pdf-thumb-remove { opacity: 1; }
.pdf-thumb-remove:hover { color: var(--danger); }

/* Drag states */
.pdf-thumb-dragging {
  position: fixed;
  z-index: 10000;
  pointer-events: none;
  opacity: 0.9;
  transform: rotate(3deg) scale(1.05);
  box-shadow: 0 12px 40px rgba(0,0,0,0.5), 0 0 0 2px var(--accent);
  border-radius: var(--radius-xs);
}

.pdf-thumb-drop-before { box-shadow: -3px 0 0 0 var(--accent); }
.pdf-thumb-drop-after { box-shadow: 3px 0 0 0 var(--accent); }

/* Split groups */
.pdf-split-groups { margin-top: 0.5rem; }

.pdf-group-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.65rem;
}

.pdf-group-tag {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.5rem;
  border: 1px solid;
  border-radius: 99px;
  font-size: 0.78rem;
  background: rgba(255, 255, 255, 0.03);
}

.pdf-group-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pdf-actions { }

/* Touch: always show remove button */
@media (hover: none) and (pointer: coarse) {
  .pdf-thumb-remove { opacity: 0.7; }
  .pdf-thumb { cursor: default; }
}

@media (max-width: 480px) {
  .pdf-pages-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 0.4rem; }
}

/* ===== IPAM Grid (base) ===== */
.ipam-grid {
  display: grid;
  grid-template-columns: repeat(32, 1fr);
  gap: 2px;
}

/* ===== Mobile Header ===== */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: rgba(8, 11, 24, 0.92);
  backdrop-filter: var(--glass-heavy);
  -webkit-backdrop-filter: var(--glass-heavy);
  border-bottom: 1px solid var(--border);
  z-index: 99;
  align-items: center;
  padding: 0 1rem;
  gap: 0.75rem;
}

.mobile-header-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.mobile-header-title i {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 8px rgba(0, 129, 255, 0.4));
}

/* Hamburger button */
.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 8px;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-xs);
  transition: background var(--transition-fast);
}

.hamburger:hover { background: var(--bg-card-hover); }

.hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text-secondary);
  border-radius: 2px;
  transition: all 0.3s ease;
  transform-origin: center;
}

.hamburger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Sidebar overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(1, 3, 15, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.sidebar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* ===== Table Responsive Wrapper ===== */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ===== Responsive: Tablet (769px - 1024px) ===== */
@media (max-width: 1024px) {
  .mobile-header { display: flex; }
  .sidebar-overlay { display: block; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition-slow);
    will-change: transform;
    pointer-events: none;
    visibility: hidden;
  }

  .sidebar.open {
    transform: translateX(0);
    pointer-events: auto;
    visibility: visible;
  }

  .content {
    margin-left: 0;
    padding: 56px 1.25rem 1.25rem 1.25rem;
    padding-top: calc(56px + 1.25rem);
  }

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

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

  .tools-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }

  .ipam-grid {
    grid-template-columns: repeat(16, 1fr);
    gap: 3px;
  }

  .project-detail-body {
    grid-template-columns: 220px 1fr;
  }

  /* Settings modal */
  .settings-modal-content { max-height: 90vh; max-width: 90vw; }

  /* Modal */
  .modal-content { max-width: 90vw; margin: 1rem; }
  .modal-content.modal-wide { max-width: 95vw; }

  /* E2C */
  .e2c-wrap { grid-template-columns: 1fr; }
}

/* ===== Responsive: Phone (max 768px) ===== */
@media (max-width: 768px) {
  html { font-size: 13.5px; }

  .content {
    padding: 56px 0.85rem 1rem 0.85rem;
    padding-top: calc(56px + 1rem);
    max-width: 100%;
  }

  /* Page header */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
  }

  .jarvis-header-right {
    flex-wrap: wrap;
    gap: 0.5rem;
    width: 100%;
  }

  .jarvis-title { font-size: 1.25rem; letter-spacing: 0.1em; }
  .jarvis-subtitle { font-size: 0.58rem; }

  /* Stats grid */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
  }

  .stat-card {
    padding: 0.85rem;
    gap: 0.6rem;
  }

  .stat-icon { width: 34px; height: 34px; font-size: 0.95rem; }
  .stat-value { font-size: 1.15rem; }
  .stat-label { font-size: 0.68rem; }

  /* Projects */
  .projects-grid { grid-template-columns: 1fr; gap: 0.75rem; }
  .project-card { padding: 1rem; }
  .project-card:hover { transform: none; }

  /* Project detail */
  .project-detail-body { grid-template-columns: 1fr; }

  .detail-progress-section {
    flex-direction: row;
    padding: 1rem;
    gap: 1rem;
  }

  .detail-progress-ring-wrap { width: 90px; height: 90px; }
  .detail-progress-ring { width: 90px; height: 90px; }
  .detail-ring-pct { font-size: 1.15rem; }

  .detail-section { padding: 0.85rem; }

  /* Tools */
  .tools-grid { grid-template-columns: 1fr; gap: 0.65rem; }
  .tool-card { padding: 1rem; }
  .tool-card:hover { transform: none; }
  .tool-card-actions { opacity: 1; }

  /* IPAM grid */
  .ipam-grid {
    grid-template-columns: repeat(16, 1fr);
    gap: 2px;
  }

  .ipam-cell { font-size: 0; }
  .ipam-cell:hover { transform: scale(1.2); }

  /* Tables */
  .table th, .table td {
    padding: 0.55rem 0.65rem;
    font-size: 0.78rem;
    white-space: nowrap;
  }

  .table th { font-size: 0.65rem; }

  /* Card header flex layout fix for mobile */
  .card-header {
    padding: 0.75rem 0.85rem;
  }

  .card-header[style*="display:flex"] {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .card-body { padding: 0.85rem; }

  /* Modals */
  .modal-content {
    max-width: calc(100vw - 1.5rem);
    max-height: 92vh;
    margin: 0.75rem;
    border-radius: var(--radius);
  }

  .modal-content.modal-wide {
    max-width: calc(100vw - 1rem);
  }

  /* Settings */
  .settings-modal-content {
    max-height: 92vh;
    max-width: calc(100vw - 1rem);
  }

  .settings-layout { flex-direction: column; }

  .settings-nav {
    width: 100%;
    flex-direction: row;
    border-right: none;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    padding: 0.5rem;
    gap: 0.25rem;
  }

  .settings-nav-item {
    white-space: nowrap;
    font-size: 0.78rem;
    padding: 0.45rem 0.65rem;
  }

  .settings-panel { padding: 0.85rem; }

  /* E2C */
  .e2c-wrap { grid-template-columns: 1fr; min-height: auto; }
  .e2c-textarea { min-height: 200px; }
  .e2c-chat { min-height: 250px; }

  /* Subnet calc */
  #subnet-result > div { grid-template-columns: 1fr !important; }

  /* Login card */
  .login-card { padding: 2rem 1.5rem; margin: 1rem; }

  /* Disable hover transforms on touch */
  .stat-card:hover { transform: none; }

  /* IP overview legend */
  .card-header > div[style*="gap:0.75rem"] {
    flex-wrap: wrap;
  }

  /* Crypto page header */
  #page-trader .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ===== Responsive: Small phones (max 480px) ===== */
@media (max-width: 480px) {
  html { font-size: 13px; }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .stat-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem;
  }

  .stat-icon { width: 30px; height: 30px; font-size: 0.85rem; }
  .stat-value { font-size: 1rem; }

  .jarvis-title { font-size: 1.1rem; }

  .jarvis-clock { font-size: 0.7rem; padding: 0.2rem 0.5rem; }
  .jarvis-status-text { font-size: 0.6rem; }

  .project-card-name { font-size: 0.9rem; }
  .project-card-desc { font-size: 0.75rem; }

  .progress-ring-container,
  .progress-ring { width: 48px; height: 48px; }
  .ring-pct { font-size: 0.7rem; }

  /* IPAM grid even more compact */
  .ipam-grid {
    grid-template-columns: repeat(16, 1fr);
  }

  .detail-progress-section { flex-direction: column; }

  .modal-content { margin: 0.5rem; border-radius: var(--radius-sm); }
  .modal-header { padding: 0.85rem; }
  .modal-body { padding: 0.85rem; }

  .mobile-header { padding: 0 0.75rem; }
}

/* ===== Touch device optimizations ===== */
@media (hover: none) and (pointer: coarse) {
  .nav-item { padding: 0.75rem 0.9rem; }

  .btn { min-height: 44px; }
  .btn-sm { min-height: 36px; }
  .btn-icon { min-width: 44px; min-height: 44px; }

  .tool-card:hover { transform: none; }
  .project-card:hover { transform: none; }
  .stat-card:hover { transform: none; }

  .tool-card-actions { opacity: 1; }
}
