:root {
  color-scheme: dark;
  --font-base: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --max-width: 1200px;
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --shadow-soft: 0 30px 90px rgba(0, 0, 0, 0.35);
  --shadow-card: 0 18px 45px rgba(0, 0, 0, 0.35);
}

:root,
body.theme-dark {
  --background: #020409;
  --background-alt: #060a13;
  --surface: rgba(16, 22, 33, 0.82);
  --surface-strong: rgba(18, 26, 41, 0.95);
  --surface-soft: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.08);
  --text-primary: #f5f9ff;
  --text-secondary: rgba(225, 235, 255, 0.65);
  --accent: #2ad1ff;
  --accent-strong: #58ffb5;
  --alert: #ff7b89;
  --success: #49f6a1;
  --warning: #ffd166;
}

/* Smooth scrolling for better navigation experience */
html {
  scroll-behavior: smooth;
}

/* Highlight target section when scrolling */
.section:target {
  animation: highlightSection 2s ease-out;
}

@keyframes highlightSection {
  0% {
    background-color: var(--accent);
    opacity: 0.1;
  }
  100% {
    background-color: transparent;
    opacity: 1;
  }
}

body.theme-light {
  color-scheme: light;
  --background: #f5f8fc;
  --background-alt: #e8f1fb;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-strong: rgba(255, 255, 255, 0.98);
  --surface-soft: rgba(21, 33, 54, 0.05);
  --border: rgba(12, 22, 40, 0.12);
  --text-primary: #142237;
  --text-secondary: rgba(20, 34, 55, 0.68);
  --accent: #146ef5;
  --accent-strong: #12b76a;
  --alert: #eb5757;
  --success: #12b76a;
  --warning: #f2c94c;
  --shadow-soft: 0 24px 60px rgba(20, 34, 55, 0.16);
  --shadow-card: 0 18px 40px rgba(20, 34, 55, 0.14);
}

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

html,
body {
  height: 100%;
}

body {
  font-family: var(--font-base);
  background: var(--background);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background 0.4s ease, color 0.4s ease;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.login-body {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top right, rgba(42, 209, 255, 0.18), transparent 45%), var(--background);
}

.login-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, rgba(20, 34, 55, 0.9) 0%, rgba(2, 4, 9, 0.8) 100%);
  z-index: -1;
}

.login-container {
  width: min(1100px, 92vw);
  background: rgba(4, 8, 16, 0.65);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.login-panel {
  padding: 48px;
  background: rgba(12, 18, 30, 0.78);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.login-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.login-panel-header header {
  flex: 1;
}

.login-panel h1 {
  font-size: 2rem;
  margin-bottom: 12px;
}

.login-panel p { color: var(--text-secondary); }

.login-panel form {
  display: grid;
  gap: 16px;
}

.login-panel label { font-weight: 500; font-size: 0.95rem; }

.login-panel input[type="email"],
.login-panel input[type="password"] {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(6, 10, 20, 0.6);
  color: var(--text-primary);
}

body.theme-light .login-panel {
  background: rgba(255, 255, 255, 0.92);
  color: var(--text-primary);
}

body.theme-light .login-panel input[type="email"],
body.theme-light .login-panel input[type="password"] {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(20, 34, 55, 0.15);
  color: var(--text-primary);
}

body.theme-light .login-aside {
  background: linear-gradient(135deg, rgba(20, 110, 245, 0.12) 0%, rgba(18, 183, 106, 0.12) 100%);
}

body.theme-light .login-overlay {
  background: linear-gradient(135deg, rgba(245, 248, 252, 0.85) 0%, rgba(231, 238, 250, 0.65) 100%);
}

.marketing-background {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    radial-gradient(circle at 10% 10%, rgba(42, 209, 255, 0.25), transparent 55%),
    radial-gradient(circle at 80% 0%, rgba(18, 183, 106, 0.2), transparent 60%),
    linear-gradient(135deg, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.75));
}

.marketing-nav {
  background: rgba(2, 4, 9, 0.85);
}

body.theme-light .marketing-nav {
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid rgba(20, 34, 55, 0.1);
}

.marketing-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 120px 32px 80px;
  display: grid;
  gap: 80px;
}

.marketing-hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 48px;
  align-items: center;
}

.marketing-visual .visual-card {
  background: var(--surface-strong);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 32px;
  box-shadow: var(--shadow-card);
  display: grid;
  gap: 18px;
}

.marketing-visual ul {
  list-style: disc;
  padding-left: 20px;
  color: var(--text-secondary);
  display: grid;
  gap: 10px;
}

.marketing-metrics {
  margin-top: 32px;
}

.marketing-section {
  display: grid;
  gap: 32px;
}

.marketing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}

.marketing-card {
  background: var(--surface-strong);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 28px;
  box-shadow: var(--shadow-card);
  display: grid;
  gap: 16px;
  color: var(--text-secondary);
}

.marketing-card h3 {
  color: var(--text-primary);
}

.marketing-card ul {
  list-style: disc;
  padding-left: 18px;
  display: grid;
  gap: 8px;
}

/* Capabilities Showcase */
.capabilities-showcase {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 32px;
  margin-bottom: 48px;
}

.showcase-item {
  background: var(--surface-strong);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.showcase-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4);
}

.showcase-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-bottom: 1px solid var(--border);
}

.showcase-content {
  padding: 24px;
}

.showcase-content h4 {
  color: var(--text-primary);
  margin-bottom: 12px;
  font-size: 1.1rem;
  font-weight: 600;
}

.showcase-content p {
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

/* Image Modal Styles */
.image-modal-content {
  max-width: 90vw;
  max-height: 90vh;
  width: auto;
  height: auto;
}

.modal-image {
  max-width: 100%;
  max-height: 80vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}


.capabilities-grid,
.industries-grid,
.research-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
}

.capabilities-grid article,
.industries-grid article,
.research-grid article {
  background: var(--surface-strong);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 24px;
  box-shadow: var(--shadow-soft);
  color: var(--text-secondary);
}

.capabilities-grid h4,
.industries-grid h3,
.research-grid h3 {
  color: var(--text-primary);
  margin-bottom: 12px;
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 32px;
  align-items: start;
}

.contact-form {
  background: var(--surface-strong);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 28px;
  box-shadow: var(--shadow-card);
  display: grid;
  gap: 18px;
}

.contact-form .form-row {
  display: grid;
  gap: 8px;
}

.contact-form input,
.contact-form select,
.contact-form textarea {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(6, 10, 20, 0.6);
  color: var(--text-primary);
}

body.theme-light .contact-form input,
body.theme-light .contact-form select,
body.theme-light .contact-form textarea {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(20, 34, 55, 0.15);
}

.form-note {
  font-size: 0.85rem;
  color: var(--text-secondary);
  transition: color 0.2s ease;
}

.form-note.error {
  color: var(--error);
}

.form-note.success {
  color: var(--success);
}

.contact-form textarea {
  resize: vertical;
  min-height: 100px;
  max-height: 300px;
  overflow-y: auto;
}

.contact-form button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.contact-aside {
  display: grid;
  gap: 18px;
  color: var(--text-secondary);
}

.contact-aside h3 {
  color: var(--text-primary);
}

.contact-cards {
  display: grid;
  gap: 10px;
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 18px;
  border: 1px dashed var(--border);
}

.marketing-footer {
  margin-top: 40px;
}

.marketing-footer .footer-inner {
  align-items: center;
}

.marketing-footer .footer-inner > div:last-child {
  display: flex;
  align-items: center;
}

body.theme-light .marketing-background {
  background-image:
    radial-gradient(circle at 10% 10%, rgba(20, 110, 245, 0.18), transparent 55%),
    radial-gradient(circle at 80% 0%, rgba(18, 183, 106, 0.18), transparent 60%),
    linear-gradient(135deg, rgba(245, 248, 252, 0.95), rgba(231, 238, 250, 0.9));
}

body.theme-light .marketing-card,
body.theme-light .capabilities-grid article,
body.theme-light .industries-grid article,
body.theme-light .research-grid article,
body.theme-light .contact-form,
body.theme-light .showcase-item {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(20, 34, 55, 0.12);
}

.login-panel input:focus {
  outline: 2px solid rgba(42, 209, 255, 0.45);
  outline-offset: 2px;
}

.login-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
}

.remember {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.muted { color: rgba(225, 235, 255, 0.58); font-size: 0.9rem; }

.primary.full { width: 100%; }

.form-error {
  margin-top: 12px;
  color: var(--alert);
  font-weight: 500;
  font-size: 0.9rem;
}

.login-aside {
  padding: 48px;
  display: flex;
  align-items: center;
  background: linear-gradient(135deg, rgba(42, 209, 255, 0.15) 0%, rgba(88, 255, 181, 0.12) 100%);
}

.aside-content {
  display: grid;
  gap: 20px;
  color: var(--text-primary);
}

.aside-content h2 { font-size: 2rem; }

.aside-content ul { list-style: disc; padding-left: 20px; color: var(--text-secondary); display: grid; gap: 10px; }

.badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(42, 209, 255, 0.18);
  border: 1px solid rgba(42, 209, 255, 0.3);
  letter-spacing: 0.1em;
  font-size: 0.75rem;
  text-transform: uppercase;
}

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

a:hover,
button:hover {
  opacity: 0.9;
}

button {
  font-family: inherit;
  border: 0;
  background: none;
  cursor: pointer;
}

.background-grid {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(88, 255, 181, 0.12), transparent 45%),
    radial-gradient(circle at 80% 0%, rgba(42, 209, 255, 0.25), transparent 55%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.03), transparent 60%);
  filter: blur(6px);
}

.top-nav {
  position: sticky;
  top: 0;
  z-index: 12;
  backdrop-filter: blur(20px);
  background: rgba(2, 4, 9, 0.75);
  border-bottom: 1px solid var(--border);
}

body.theme-light .top-nav {
  background: rgba(245, 248, 252, 0.92);
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 20px 32px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  gap: 24px;
  color: var(--text-secondary);
  margin-left: auto;
}

.nav-links a { font-size: 0.95rem; }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-links a.active {
  color: var(--accent);
}

.user-pill {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.cta,
button.primary,
button.secondary {
  padding: 10px 20px;
  border-radius: 999px;
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.3s ease;
}

.cta,
button.primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #020409;
  box-shadow: 0 16px 45px rgba(42, 209, 255, 0.35);
}

body.theme-light .cta,
body.theme-light button.primary {
  color: #ffffff;
}

button.secondary {
  background: var(--surface-soft);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

button.primary:active,
button.secondary:active,
.cta:active {
  transform: scale(0.97);
}

.theme-toggle {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  max-width: 44px;
  max-height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
}

.theme-icon { font-size: 1rem; }

body.theme-light .theme-toggle {
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-secondary);
  border: 1px solid rgba(20, 34, 55, 0.1);
}

main { overflow: hidden; }

.hero {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 120px 32px 80px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 64px;
  align-items: center;
}

.hero-copy .label {
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 0.45em;
  font-size: 0.75rem;
  color: var(--accent-strong);
  margin-bottom: 20px;
}

.hero h1 {
  font-size: clamp(2.8rem, 3vw + 1.5rem, 4rem);
  line-height: 1.08;
  margin-bottom: 20px;
}

.hero p {
  font-size: 1.06rem;
  color: var(--text-secondary);
  max-width: 560px;
}

.hero-actions {
  margin: 32px 0 40px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.hero-actions .demo {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  color: white;
  text-decoration: none;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-weight: 500;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.hero-actions .demo:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* Demo-specific styles */
.demo-chart-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  background: var(--background);
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  text-align: center;
  color: var(--text-secondary);
}

.demo-chart-placeholder p {
  margin: 0.5rem 0;
  font-size: 1.1rem;
}

.demo-chart-placeholder small {
  font-size: 0.9rem;
  opacity: 0.7;
}

.demo-map-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 300px;
  background: var(--background);
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  text-align: center;
  color: var(--text-secondary);
}

.demo-map-placeholder p {
  margin: 0.5rem 0;
  font-size: 1.1rem;
}

.demo-map-placeholder small {
  font-size: 0.9rem;
  opacity: 0.7;
}

.photo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 150px;
  background: var(--background);
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
}

.photo-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.photo-material {
  font-weight: 600;
  text-transform: capitalize;
}

.photo-confidence {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.material-confidence-item {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.material-confidence-label {
  min-width: 80px;
  font-size: 0.9rem;
  font-weight: 500;
}

.material-confidence-bar {
  flex: 1;
  height: 8px;
  background: var(--background);
  border-radius: 4px;
  overflow: hidden;
}

.material-confidence-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.3s ease;
}

.material-confidence-value {
  min-width: 40px;
  text-align: right;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Demo chart styles */
.chart-card canvas {
  width: 100%;
  height: 240px;
  background: var(--background);
  border-radius: var(--radius-md);
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.hero-metrics > div {
  padding: 18px 20px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}

.metric-label {
  display: block;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.metric-value {
  display: block;
  font-size: 2.1rem;
  font-weight: 700;
  margin: 6px 0 2px;
}

.metric-subtext {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.feature-pills {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--text-secondary);
}

.feature-pills li {
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  font-size: 0.85rem;
}

.hero-visual { display: flex; justify-content: center; }

.status-card {
  width: 100%;
  max-width: 420px;
  padding: 28px;
  border-radius: var(--radius-xl);
  background: var(--surface-strong);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.status-card header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.status-heading { font-size: 1rem; font-weight: 600; }
.status-subheading { font-size: 0.85rem; color: var(--text-secondary); }

.status-badge {
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-body { display: grid; gap: 24px; }

.status-radar {
  position: relative;
  width: 100%;
  aspect-ratio: 1/1;
  border-radius: 24px;
  background: radial-gradient(circle at 50% 50%, rgba(42, 209, 255, 0.18), transparent 70%);
  border: 1px solid rgba(42, 209, 255, 0.25);
  overflow: hidden;
}

.ring {
  position: absolute;
  inset: 14%;
  border-radius: 50%;
  border: 1px dashed rgba(255, 255, 255, 0.1);
  animation: spin 24s linear infinite;
}

.ring-two { inset: 28%; animation-duration: 18s; }
.ring-three { inset: 42%; animation-duration: 12s; }

.blip {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-strong);
  box-shadow: 0 0 16px rgba(88, 255, 181, 0.6);
}

.blip-one { top: 18%; left: 60%; }
.blip-two { top: 55%; left: 28%; }
.blip-three { top: 74%; left: 72%; }

.status-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.status-metrics dt { font-size: 0.8rem; color: var(--text-secondary); letter-spacing: 0.1em; text-transform: uppercase; }
.status-metrics dd { font-size: 1.1rem; font-weight: 600; }

.status-card footer {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
}

.summary-grid { margin-top: 24px; }

.status-tile {
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 180px;
}

.status-tile-clickable {
  cursor: pointer;
  transition: all 0.2s ease;
}

.status-tile-clickable:hover {
  background: var(--surface);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 24px 60px rgba(42, 209, 255, 0.15);
}

.status-tile header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.tile-icon { font-size: 0.95rem; color: var(--accent-strong); }
.tile-value { font-size: 2rem; font-weight: 700; }
.tile-detail { font-size: 0.85rem; color: var(--text-secondary); }

.tile-progress {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-soft);
  overflow: hidden;
}

.tile-progress div {
  height: 100%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  width: 0%;
  transition: width 0.4s ease;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text-secondary);
}

.status-chip.status-active { color: #2ad1ff; border-color: rgba(42, 209, 255, 0.45); }
.status-chip.status-idle { color: #ffd166; border-color: rgba(255, 209, 102, 0.45); }
.status-chip.status-offline { color: #f87171; border-color: rgba(248, 113, 113, 0.35); }
.status-chip.status-unknown { color: var(--text-secondary); }

.time-range-wrapper {
  position: relative;
}

.time-range-panel {
  position: relative;
}

.time-range-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.75rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

.time-range-summary .time-range-label {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-primary);
}

.time-range-summary .time-range-sub {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.time-range-dropdown {
  position: absolute;
  top: 50%;
  right: calc(100% + 0.75rem);
  transform: translateY(-50%);
  width: 20rem;
  background: var(--surface-base);
  border-radius: 0.75rem;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.3);
  border: 1px solid rgba(148, 163, 184, 0.22);
  padding: 1rem;
  z-index: 24;
  backdrop-filter: blur(18px);
}

body.theme-light .time-range-dropdown {
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.15);
  border: 1px solid rgba(148, 163, 184, 0.3);
}

body.theme-dark .time-range-dropdown {
  background: rgba(15, 23, 42, 0.94);
}

.time-range-section + .time-range-section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
}

.time-range-section h4 {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.time-range-presets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.preset-btn {
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: transparent;
  color: var(--text-primary);
  padding: 0.45rem 0.5rem;
  border-radius: 0.55rem;
  font-size: 0.78rem;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.preset-btn:hover,
.preset-btn:focus {
  border-color: var(--brand-primary);
  background: rgba(37, 99, 235, 0.08);
  outline: none;
}

.time-range-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.75rem;
  font-size: 0.78rem;
}

.time-range-field span {
  color: var(--text-secondary);
}

.time-range-field input,
.time-range-field select {
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 0.55rem;
  padding: 0.45rem 0.55rem;
  background: var(--surface-soft);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
}

.time-range-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.time-range-actions .primary {
  background: var(--brand-primary);
  color: #fff;
  border: none;
  padding: 0.45rem 0.85rem;
  border-radius: 0.55rem;
  cursor: pointer;
  font-size: 0.78rem;
  transition: background 0.2s ease;
}

.time-range-actions .primary:hover,
.time-range-actions .primary:focus {
  background: #1d4ed8;
  outline: none;
}

.time-range-actions .secondary {
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: transparent;
  color: var(--text-primary);
  padding: 0.45rem 0.85rem;
  border-radius: 0.55rem;
  cursor: pointer;
  font-size: 0.78rem;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.time-range-actions .secondary:hover,
.time-range-actions .secondary:focus {
  border-color: var(--brand-primary);
  background: rgba(37, 99, 235, 0.06);
  outline: none;
}

.time-range-actions .secondary:focus-visible,
.preset-btn:focus-visible,
.time-range-toggle:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}

.overview-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
}

.overview-grid .table-shell {
  height: 100%;
}

.map-card {
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.detail-grid { margin-top: 24px; }

.device-meta { display: flex; align-items: center; gap: 16px; }

.error-box {
  padding: 24px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(248, 113, 113, 0.45);
  background: rgba(248, 113, 113, 0.08);
  color: #fca5a5;
}

.section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 80px 32px 25px 32px;
  overflow-x: hidden;
}

.section:first-of-type {
  padding-top: 80px;
}

.section:not(:first-of-type) {
  padding-top: 30px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 32px;
  margin-bottom: 32px;
}

.section-header h2 { font-size: 2.3rem; margin-bottom: 8px; }
.section-header p { color: var(--text-secondary); max-width: 560px; }

.section-meta { display: flex; gap: 12px; flex-wrap: wrap; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.tag-online { color: var(--success); }

.table-shell {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-strong);
  box-shadow: var(--shadow-soft);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

thead {
  background: rgba(255, 255, 255, 0.03);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
}

body.theme-light thead { background: rgba(12, 22, 40, 0.05); }

thead th {
  text-align: left;
  padding: 18px 22px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 18px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  font-size: 0.95rem;
}

body.theme-light tbody td { border-bottom: 1px solid rgba(12, 22, 40, 0.08); }

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

tbody tr:hover { background: var(--surface-soft); }

.skeleton td { text-align: center; color: rgba(255, 255, 255, 0.35); }
body.theme-light .skeleton td { color: rgba(20, 34, 55, 0.45); }

tbody tr[data-device] { cursor: pointer; transition: background 0.2s ease; }

.spatial-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 32px;
}

.geo-card,
.insights,
.chart-card,
.edge-card {
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-card);
}

.geo-card header h2 { font-size: 2rem; margin-bottom: 8px; }
.geo-card header p { color: var(--text-secondary); }

.map-frame {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  height: 340px;
  margin: 24px 0 20px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.map-canvas { position: absolute; inset: 0; }

.mapboxgl-canvas {
  border-radius: var(--radius-md);
}

.mapbox-marker {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
}

.map-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 4, 9, 0.68);
  color: var(--text-secondary);
  font-size: 1.05rem;
}

body.theme-light .map-overlay { background: rgba(245, 248, 252, 0.82); }

.legend {
  list-style: none;
  display: flex;
  gap: 18px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.legend .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}

.dot-primary { background: var(--accent); }
.dot-secondary { background: rgba(88, 255, 181, 0.45); }
.dot-muted { background: rgba(255, 255, 255, 0.25); }

/* Fill level legend dots */
.dot-fill-empty { background: #10b981; } /* Green for empty */
.dot-fill-low { background: #f59e0b; } /* Yellow for low */
.dot-fill-medium { background: #f97316; } /* Orange for medium */
.dot-fill-full { background: #ef4444; } /* Red for full */

body.theme-light .dot-secondary { background: rgba(20, 110, 245, 0.3); }
body.theme-light .dot-muted { background: rgba(12, 22, 40, 0.2); }

/* Map marker improvements */
.device-marker {
  z-index: 1000;
}

.leaflet-popup-content {
  font-family: var(--font-base);
  color: var(--text-primary);
}

.leaflet-popup-content-wrapper {
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.leaflet-popup-tip {
  background: var(--surface-strong);
  border: 1px solid var(--border);
}

/* Improve map loading performance */
.map-canvas {
  will-change: transform;
}

/* Better map frame sizing */
.map-frame {
  min-height: 400px;
  height: 50vh;
  max-height: 600px;
}

/* Mapbox marker styling */
.mapbox-marker {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #2ad1ff;
  border: 3px solid white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 14px;
  color: white;
  box-shadow: 0 3px 6px rgba(0,0,0,0.4);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.mapbox-marker:hover {
  transform: scale(1.1);
}

/* Mapbox popup styling */
.mapboxgl-popup-content {
  font-family: var(--font-base);
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  color: var(--text-primary);
}

.mapboxgl-popup-tip {
  border-top-color: var(--surface-strong);
}

/* Fix accessibility issue with popup close button */
.mapboxgl-popup-close-button {
  background: transparent !important;
  border: none !important;
  color: var(--text-secondary) !important;
  font-size: 18px !important;
  font-weight: bold !important;
  padding: 8px !important;
  cursor: pointer !important;
  outline: none !important;
  border-radius: 4px !important;
  transition: all 0.2s ease !important;
}

.mapboxgl-popup-close-button:hover {
  background: var(--surface-soft) !important;
  color: var(--text-primary) !important;
}

.mapboxgl-popup-close-button:focus {
  background: var(--surface-soft) !important;
  color: var(--text-primary) !important;
  box-shadow: 0 0 0 2px var(--accent) !important;
}

/* Photo preview tooltip */
.material-cell {
  position: relative;
  cursor: pointer;
}

.material-with-photo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.material-thumbnail {
  width: 32px;
  height: 24px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
}

.material-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.material-name {
  font-size: 0.9rem;
  color: var(--text-primary);
  font-weight: 500;
}

.photo-preview {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 8px;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  pointer-events: none;
  margin-bottom: 8px;
}

.material-cell:hover .photo-preview {
  opacity: 1;
  visibility: visible;
}

.photo-preview img {
  width: 200px;
  height: 150px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  display: block;
}

.photo-preview::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--surface-strong);
}

/* Photo Library Styles */
.photo-controls {
  display: flex;
  gap: 8px;
}

.photo-view-btn {
  padding: 8px 16px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.9rem;
}

.photo-view-btn:hover {
  background: var(--surface-strong);
  color: var(--text-primary);
}

.photo-view-btn.active {
  background: var(--accent);
  color: var(--background);
  border-color: var(--accent);
}

.photo-library {
  margin-top: 20px;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.photo-item {
  position: relative;
  background: var(--surface-soft);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid var(--border);
}

.photo-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
  border-color: var(--accent);
}

.photo-thumbnail {
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: block;
}

.photo-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.7) 100%);
  display: flex;
  align-items: flex-end;
  padding: 12px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.photo-item:hover .photo-overlay {
  opacity: 1;
}

.photo-info {
  color: white;
  font-size: 0.85rem;
}

.photo-date {
  font-weight: 500;
  margin-bottom: 4px;
}

.photo-material {
  opacity: 0.9;
  font-size: 0.8rem;
}

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

.photo-list-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--surface-soft);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s ease;
}

.photo-list-item:hover {
  background: var(--surface-strong);
  border-color: var(--accent);
}

.photo-list-thumbnail {
  width: 80px;
  height: 60px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.photo-list-info {
  flex: 1;
}

.photo-list-date {
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.photo-list-details {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.photo-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.photo-empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.photo-empty h3 {
  margin: 0 0 8px 0;
  color: var(--text-primary);
}

.photo-empty p {
  margin: 0;
  max-width: 400px;
  margin: 0 auto;
  line-height: 1.5;
}

/* Photo Modal */
.photo-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.photo-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
}

.photo-modal-content {
  position: relative;
  background: var(--surface-strong);
  border-radius: var(--radius-lg);
  max-width: 90vw;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border);
}

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

.photo-modal-header h3 {
  margin: 0;
  color: var(--text-primary);
}

.photo-modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.photo-modal-close:hover {
  background: var(--surface-soft);
  color: var(--text-primary);
}

.photo-modal-body {
  display: flex;
  flex-direction: column;
  max-height: 70vh;
}

.photo-modal-body img {
  max-width: 100%;
  max-height: 60vh;
  object-fit: contain;
  display: block;
}

.photo-modal-info {
  padding: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.photo-info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.photo-info-value {
  color: var(--text-primary);
}

/* Responsive design */
@media (max-width: 768px) {
  .photo-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
  }
  
  .photo-thumbnail {
    height: 120px;
  }
  
  .photo-list-item {
    padding: 12px;
  }
  
  .photo-list-thumbnail {
    width: 60px;
    height: 45px;
  }
  
  .photo-modal-content {
    max-width: 95vw;
    max-height: 95vh;
  }
  
  .photo-modal-body {
    max-height: 80vh;
  }
}

/* Device Layout Styles */
.device-layout {
  display: flex;
  min-height: calc(100vh - 80px); /* Subtract header height */
  position: relative;
}

.device-main-content {
  flex: 1;
  margin: 0 80px; /* Space for side panels */
  padding: 24px 0;
  overflow-y: auto;
}

/* Device Navigation Panel Styles */
.device-nav-panel {
  position: fixed;
  top: 80px; /* Below header */
  width: 80px;
  height: calc(100vh - 80px);
  background: var(--surface);
  z-index: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 0;
  backdrop-filter: blur(8px);
  background: rgba(var(--surface-rgb), 0.95);
}

.device-nav-left {
  left: 0;
  border-right: 1px solid var(--border);
}

.device-nav-right {
  right: 0;
  border-left: 1px solid var(--border);
  border-right: none;
}

.device-nav-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  height: 100%;
  justify-content: flex-start;
}

.device-nav-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
}

.device-nav-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.device-nav-status {
  font-size: 0.625rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.device-nav-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  flex: 1;
  justify-content: center;
  position: relative; /* Allow absolute positioning of dropdown */
}

.device-dropdown {
  position: absolute;
  top: 50%;
  left: calc(100% + 0.75rem);
  transform: translateY(-50%);
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  z-index: 1000;
  min-width: 250px;
  max-height: 400px;
  overflow-y: auto;
}

.device-dropdown[hidden] {
  display: none;
}

.device-dropdown-list {
  padding: 0.5rem;
}

.device-dropdown-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  font-size: 0.875rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.device-dropdown-item:hover {
  background: var(--surface-soft);
  color: var(--accent);
}

.device-dropdown-item.active {
  background: var(--accent);
  color: var(--background);
  font-weight: 600;
}
  transition: all 0.2s ease;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 12px;
  padding-right: 24px;
}

.device-select:hover {
  border-color: var(--accent);
  background: var(--surface);
}

.device-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.device-select option {
  background: var(--surface);
  color: var(--text-primary);
  padding: 8px;
  writing-mode: horizontal-tb;
  text-orientation: initial;
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 1.25rem;
}

.btn-icon:hover:not(:disabled) {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

.btn-icon .btn-icon {
  font-size: 1.25rem;
  font-weight: 600;
}

/* Responsive design for device navigation */
@media (max-width: 1024px) {
  .device-main-content {
    margin: 0 60px;
  }
  
  .device-nav-panel {
    width: 60px;
  }
  
  .device-select,
  .btn-icon {
    width: 50px;
    height: 50px;
  }
}

@media (max-width: 768px) {
  .device-layout {
    flex-direction: column;
  }
  
  .device-main-content {
    margin: 0;
    padding: 0;
  }
  
  .device-nav-panel {
    position: static;
    width: 100%;
    height: auto;
    flex-direction: row;
    padding: 16px 24px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  
  .device-nav-left {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  
  .device-nav-right {
    border-left: none;
    border-bottom: 1px solid var(--border);
  }
  
  .device-nav-content {
    flex-direction: row;
    justify-content: space-between;
    width: 100%;
  }
  
  .device-nav-info {
    writing-mode: horizontal-tb;
    text-orientation: initial;
    transform: none;
    flex-direction: row;
    gap: 16px;
  }
  
  .device-nav-controls {
    flex-direction: row;
    gap: 12px;
  }
  
  .device-select {
    width: 120px;
    height: 40px;
    max-width: 120px;
  }
  
  .btn-icon {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }
}

/* Table sorting styles */
.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  transition: background-color 0.2s ease;
}

.sortable:hover {
  background-color: var(--surface-soft);
}

.sortable::after {
  content: '↕';
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.8rem;
  color: var(--text-secondary);
  opacity: 0.5;
}

.sortable.sort-asc::after {
  content: '↑';
  opacity: 1;
  color: var(--accent);
}

.sortable.sort-desc::after {
  content: '↓';
  opacity: 1;
  color: var(--accent);
}

/* AI Analysis Section */
.ai-analysis-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-top: 20px;
}

.ai-photo-section {
  display: flex;
  flex-direction: column;
}

.ai-photo-container {
  position: relative;
  background: var(--surface-soft);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 400px;
}

.ai-photo {
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
  max-height: 400px;
}

.ai-no-photo {
  text-align: center;
  color: var(--text-secondary);
  padding: 40px 20px;
}

.ai-no-photo-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.ai-nav-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-primary);
}

.ai-nav-btn:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--text-tertiary);
}

.ai-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.ai-nav-indicator {
  font-size: 0.875rem;
  color: var(--text-secondary);
  min-width: 60px;
  text-align: center;
}

.ai-timestamp {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-top: 8px;
  padding: 8px;
}

.fallback-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 20px;
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: var(--radius-md);
  color: #fbbf24;
  font-size: 0.9rem;
}

.fallback-banner svg {
  flex-shrink: 0;
}

body.theme-light .fallback-banner {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.3);
  color: #d97706;
}

.ai-no-photo p {
  margin: 0;
  font-size: 1rem;
}

.ai-confidence-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.confidence-tables {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.confidence-table {
  background: var(--surface-soft);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 20px;
}

.confidence-table h3 {
  margin: 0 0 16px 0;
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: 600;
}

.confidence-item {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.confidence-item:last-child {
  margin-bottom: 0;
}

.confidence-label {
  min-width: 120px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.confidence-bar {
  flex: 1;
  height: 8px;
  background: var(--surface-strong);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.confidence-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-strong) 100%);
  border-radius: 4px;
  transition: width 0.3s ease;
  position: relative;
}

.confidence-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.2) 50%, transparent 100%);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.confidence-value {
  min-width: 40px;
  text-align: right;
  font-size: 0.9rem;
  color: var(--text-primary);
  font-weight: 600;
}

.material-confidence-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.material-confidence-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

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

.material-confidence-label {
  min-width: 140px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: capitalize;
}

.material-confidence-bar {
  flex: 1;
  height: 6px;
  background: var(--surface-strong);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.material-confidence-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-strong) 100%);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.material-confidence-value {
  min-width: 35px;
  text-align: right;
  font-size: 0.85rem;
  color: var(--text-primary);
  font-weight: 500;
}

/* Responsive design for AI analysis */
@media (max-width: 768px) {
  .ai-analysis-content {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .confidence-tables {
    gap: 16px;
  }
  
  .confidence-table {
    padding: 16px;
  }
  
  .confidence-label {
    min-width: 100px;
    font-size: 0.8rem;
  }
  
  .material-confidence-label {
    min-width: 120px;
    font-size: 0.8rem;
  }
}

.insights {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.insights h3 { font-size: 1.4rem; }

.insights ul {
  list-style: none;
  display: grid;
  gap: 14px;
  color: var(--text-secondary);
}

.callout {
  padding: 18px;
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  border: 1px dashed var(--accent);
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.analytics .chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 28px;
}

.chart-card header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.chart-card canvas {
  width: 100%;
  height: 240px;
  display: block;
}

.intelligence .section-header p {
  max-width: 520px;
}

.intel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 28px;
}

.intel-card {
  background: var(--surface-strong);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.intel-card.primary {
  background: linear-gradient(135deg, rgba(42, 209, 255, 0.12) 0%, rgba(88, 255, 181, 0.12) 100%);
  border-color: rgba(42, 209, 255, 0.35);
}

.intel-card header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.intel-badge {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.intel-highlight {
  font-size: 1.6rem;
  font-weight: 600;
}

.intel-metrics {
  display: grid;
  gap: 16px;
}

.intel-metrics dt {
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.intel-metrics dd {
  font-size: 1.1rem;
  font-weight: 600;
}

.intel-list {
  list-style: none;
  display: grid;
  gap: 14px;
  color: var(--text-secondary);
}

.intel-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  border: 1px solid var(--border);
}

.intel-list span {
  font-weight: 600;
  color: var(--text-primary);
}


.edge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 32px;
}

.edge-card h2 { font-size: 2rem; margin-bottom: 12px; }
.edge-card h3 { font-size: 1.3rem; margin-bottom: 12px; }

.edge-card p { color: var(--text-secondary); }

.edge-card ol {
  margin: 20px 0;
  padding-left: 18px;
  color: var(--text-secondary);
}

.edge-card li { margin-bottom: 12px; line-height: 1.6; }

.edge-card.secondary { background: var(--surface); }

pre {
  background: rgba(2, 4, 9, 0.8);
  border-radius: var(--radius-md);
  padding: 18px;
  overflow-x: auto;
  border: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--success);
}

body.theme-light pre { background: rgba(21, 33, 54, 0.08); color: #146ef5; }

code {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  background: var(--surface-soft);
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 0.85rem;
}

.footer {
  border-top: 1px solid var(--border);
  padding: 48px 32px 64px;
  background: var(--background-alt);
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px;
  color: var(--text-secondary);
}

.footer .brand { font-size: 1rem; letter-spacing: 0.1em; text-transform: uppercase; }
.footer-links a { color: var(--accent); display: block; }
.footer-note { display: block; margin-top: 12px; }

/* Progress bar styles */
.progress-bar {
  display: flex;
  gap: 2px;
  align-items: center;
  width: 100%;
  height: 20px;
}

.progress-bar-fill {
  flex: 1;
  height: 100%;
  border-radius: 3px;
  transition: all 0.3s ease;
  position: relative;
  background: #6b7280; /* Default gray background */
}

.progress-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 3px;
  background: linear-gradient(45deg, rgba(255,255,255,0.1) 0%, transparent 50%, rgba(255,255,255,0.1) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.progress-bar-fill:hover::after {
  opacity: 1;
}

/* Fill level colors (4 levels: empty to full) */
.fill-empty { background: #10b981; } /* Green for empty */
.fill-low { background: #f59e0b; } /* Yellow for low */
.fill-medium { background: #f97316; } /* Orange for medium */
.fill-full { background: #ef4444; } /* Red for full */
.fill-unknown { background: #6b7280; } /* Gray for unknown */

/* Battery level colors (5 levels) */
.battery-critical { background: #dc2626; } /* Red for critical */
.battery-low { background: #ea580c; } /* Orange for low */
.battery-medium { background: #d97706; } /* Amber for medium */
.battery-good { background: #16a34a; } /* Green for good */
.battery-excellent { background: #059669; } /* Dark green for excellent */
.battery-unknown { background: #6b7280; } /* Gray for unknown */

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

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

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
}

.modal-content {
  position: relative;
  z-index: 1001;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

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

.modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
}

.modal-close {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 1.25rem;
  width: 36px;
  height: 36px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: var(--surface);
  border-color: var(--alert);
  color: var(--alert);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.alerts-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.alert-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  transition: all 0.2s ease;
  cursor: pointer;
}

.alert-item:hover {
  background: var(--surface-soft);
  border-color: var(--accent);
}

.alert-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.alert-content {
  flex: 1;
}

.alert-device {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.alert-reasons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.alert-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.alert-badge.low-battery {
  background: rgba(239, 68, 68, 0.15);
  color: var(--alert);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.alert-badge.full-capacity {
  background: rgba(255, 209, 102, 0.15);
  color: var(--warning);
  border: 1px solid rgba(255, 209, 102, 0.3);
}

.alert-badge.no-gps {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-secondary);
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.alert-badge.offline {
  background: rgba(100, 116, 139, 0.15);
  color: var(--text-secondary);
  border: 1px solid rgba(100, 116, 139, 0.3);
}

.alerts-list-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
}

.alerts-list-empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

@media (max-width: 1024px) {
  .nav-inner { flex-wrap: wrap; }
  .nav-links { order: 3; width: 100%; justify-content: center; }
  .nav-actions { order: 2; }
  .hero { padding-top: 96px; }
  .spatial-grid { grid-template-columns: 1fr; }
  .overview-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .section { padding: 60px 16px 20px 16px; }
  .section:first-of-type { padding-top: 60px; }
  .section:not(:first-of-type) { padding-top: 20px; }
  .hero { padding: 96px 16px 60px; }
  .nav-inner { padding: 16px 16px; }
  .table-shell { overflow-x: auto; }
  .login-container { grid-template-columns: 1fr; }
  .login-panel, .login-aside { padding: 32px; }
  
  /* Fix navigation links wrapping */
  .nav-links {
    gap: 12px;
    font-size: 0.85rem;
    flex-wrap: wrap;
    padding: 8px 0;
  }
  
  .nav-links a {
    font-size: 0.85rem;
    white-space: nowrap;
  }
  
  /* Fix nav actions */
  .nav-actions {
    gap: 8px;
    flex-wrap: wrap;
  }
  
  .nav-actions a:not(.theme-toggle),
  .nav-actions button:not(.theme-toggle) {
    font-size: 0.85rem;
    padding: 8px 16px;
    white-space: nowrap;
  }
  
  /* Make showcase items stack properly */
  .showcase-item {
    max-width: 100%;
  }
  
  .showcase-image {
    height: 160px;
  }
  
  .showcase-content {
    padding: 16px;
  }
  
  .showcase-content h4 {
    font-size: 1rem;
  }
  
  .showcase-content p {
    font-size: 0.875rem;
  }
}

/* Extra small phones */
@media (max-width: 480px) {
  /* Make logo smaller */
  .nav-logo {
    font-size: 1.1rem;
  }
  
  /* Stack navigation completely */
  .nav-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  
  .nav-links {
    order: 3;
    width: 100%;
    justify-content: space-between;
    gap: 8px;
    margin-left: 0;
  }
  
  .nav-links a {
    font-size: 0.8rem;
    padding: 4px 0;
  }
  
  .nav-actions {
    order: 2;
    width: 100%;
    justify-content: center;
    gap: 8px;
  }
  
  .nav-actions a:not(.theme-toggle),
  .nav-actions button:not(.theme-toggle) {
    flex: 1;
    text-align: center;
    font-size: 0.8rem;
    padding: 8px 12px;
  }
  
  /* Adjust hero section */
  .hero {
    padding: 80px 16px 40px;
    grid-template-columns: 1fr;
    gap: 32px;
  }
  
  .hero h1 {
    font-size: 2rem;
    line-height: 1.2;
  }
  
  .hero p {
    font-size: 1rem;
  }
  
  /* Fix showcase items */
  .showcase-grid {
    gap: 16px;
  }
  
  .showcase-item {
    margin: 0;
  }
  
  /* Fix capabilities showcase on mobile */
  .capabilities-showcase {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  /* Fix buttons */
  .hero-actions {
    flex-direction: column;
    gap: 12px;
    width: 100%;
  }
  
  .hero-actions a,
  .hero-actions button {
    width: 100%;
    text-align: center;
    padding: 12px 20px;
  }
  
  /* Fix AI analysis navigation */
  .ai-nav-controls {
    gap: 8px;
  }
  
  .ai-nav-btn {
    width: 28px;
    height: 28px;
  }
  
  .ai-nav-indicator {
    font-size: 0.8rem;
    min-width: 50px;
  }
  
  /* Fix section headers */
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .section-header h2 {
    font-size: 1.5rem;
  }
  
  .section-header p {
    max-width: 100%;
  }
  
  /* Fix tiles grid */
  .tiles-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  /* Fix contact grid */
  .contact-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  
  /* Fix marketing grid */
  .marketing-grid {
    grid-template-columns: 1fr;
  }
  
  /* Fix device navigation panel on small screens */
  .device-nav-panel {
    padding: 12px 16px;
  }
  
  .device-nav-info {
    gap: 8px;
    flex-wrap: wrap;
  }
  
  .device-nav-label {
    font-size: 0.85rem;
  }
  
  .device-nav-status {
    font-size: 0.75rem;
  }
  
  .device-nav-controls {
    gap: 8px;
  }
  
  .btn-icon {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
  }
  
  .device-select {
    width: 100px;
    height: 36px;
    max-width: 100px;
    font-size: 0.85rem;
  }
}
