/* ============================================
   Nivaar — Design System
   ============================================ */
:root {
  --color-primary: #1B2D5B;
  --color-secondary: #0D9488;
  --color-accent: #10B981;
  --color-neutral: #475569;
  --color-light: #F1F5F9;
  --color-bg: #FFFFFF;
  --color-surface: #F1F5F9;
  --color-text: #1B2D5B;
  --color-text-muted: #475569;
  --color-border: #CBD5E1;
  --color-error: #EF4444;
  --color-warning: #F59E0B;
  --color-success: #10B981;
  --shadow-sm: 0 1px 3px rgba(27,45,91,0.08);
  --shadow-md: 0 4px 12px rgba(27,45,91,0.1);
  --shadow-lg: 0 8px 24px rgba(27,45,91,0.12);
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --font-display: 'Rajdhani', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

[data-theme="dark"] {
  --color-bg: #0F172A;
  --color-surface: #1E293B;
  --color-text: #F1F5F9;
  --color-text-muted: #94A3B8;
  --color-border: #334155;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
}

/* ============================================
   Reset & Base
   ============================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  transition: background 0.3s, color 0.3s;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4 { font-family: var(--font-display); color: var(--color-text); }
h1 { font-weight: 700; font-size: 2.5rem; line-height: 1.2; }
h2 { font-weight: 600; font-size: 2rem; line-height: 1.25; margin-bottom: 1rem; }
h3 { font-weight: 600; font-size: 1.5rem; line-height: 1.3; margin-bottom: 0.75rem; }
h4 { font-weight: 600; font-size: 1.125rem; line-height: 1.4; }

a { color: var(--color-secondary); text-decoration: none; }
a:hover { text-decoration: underline; }

code, .mono { font-family: var(--font-mono); font-size: 0.875rem; }

/* ============================================
   Navigation
   ============================================ */
.nav {
  background: var(--color-primary);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.nav-logo img {
  height: 36px;
  width: auto;
}

.nav-logo-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  color: #fff;
  letter-spacing: 0.5px;
}

.nav-logo-text .teal { color: var(--color-secondary); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
}

.nav-links a, .nav-links button {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
  border: none;
  background: none;
  cursor: pointer;
  font-family: var(--font-body);
}

.nav-links a:hover, .nav-links button:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
  text-decoration: none;
}

.nav-links a.active {
  color: #fff;
  background: rgba(255,255,255,0.15);
}

.nav-cta {
  background: var(--color-accent) !important;
  color: #fff !important;
  font-weight: 600 !important;
  border-radius: var(--radius-md) !important;
}

.nav-cta:hover {
  background: #0ea573 !important;
}

.nav-user {
  color: rgba(255,255,255,0.7);
  font-size: 0.85rem;
  margin-right: 8px;
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px;
}

/* ============================================
   Layout
   ============================================ */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

.section {
  padding: 4rem 0;
}

.section-alt {
  background: var(--color-surface);
}

/* ============================================
   Hero Section
   ============================================ */
.hero {
  background: linear-gradient(135deg, var(--color-primary) 0%, #0F172A 100%);
  color: #fff;
  padding: 6rem 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 5 L55 30 L30 55 L5 30Z' fill='none' stroke='rgba(13,148,136,0.08)' stroke-width='1'/%3E%3C/svg%3E");
  pointer-events: none;
}

.hero h1 {
  color: #fff;
  font-size: 3rem;
  margin-bottom: 1rem;
  position: relative;
}

.hero p {
  font-size: 1.2rem;
  color: rgba(255,255,255,0.8);
  max-width: 600px;
  margin: 0 auto 2rem;
  position: relative;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 24px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  line-height: 1.4;
}

.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--color-secondary);
  color: #fff;
}
.btn-primary:hover { background: #0b8278; }

.btn-accent {
  background: var(--color-accent);
  color: #fff;
}
.btn-accent:hover { background: #0ea573; }

.btn-outline {
  background: transparent;
  color: var(--color-secondary);
  border: 2px solid var(--color-secondary);
}
.btn-outline:hover {
  background: var(--color-secondary);
  color: #fff;
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}
.btn-secondary:hover { background: var(--color-border); }

/* Email chip input (DataShare recipients / allowed emails) */
.ds-dropzone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  color: var(--color-text-muted);
  transition: border-color .15s, background .15s;
}
.ds-dropzone:hover { border-color: var(--color-accent); }
.ds-dropzone.drag {
  border-color: var(--color-accent);
  background: var(--color-surface);
}
.ds-dropzone-msg { pointer-events: none; }

.chip-input {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 6px 8px;
  min-height: 42px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}
.chip-input .chip-text {
  flex: 1;
  min-width: 140px;
  border: none;
  outline: none;
  background: transparent;
  color: var(--color-text);
  font: inherit;
  padding: 4px;
}
.share-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px 3px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
}
.share-chip.chip-ok { border-color: var(--color-accent); }
.share-chip.chip-pending { opacity: 0.65; }
.share-chip.chip-error { border-color: var(--color-error); color: var(--color-error); background: rgba(239, 68, 68, 0.08); }
.share-chip button {
  border: none;
  background: transparent;
  cursor: pointer;
  color: inherit;
  font-size: 1rem;
  line-height: 1;
  padding: 0 2px;
}

.btn-danger {
  background: var(--color-error);
  color: #fff;
}
.btn-danger:hover { background: #dc2626; }

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
}
.btn-ghost:hover { background: var(--color-surface); }

.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 14px 32px; font-size: 1rem; }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================
   Cards
   ============================================ */
.card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, transform 0.2s;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-clickable:hover {
  transform: translateY(-2px);
  cursor: pointer;
}

.card-header {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.25rem;
  color: var(--color-text);
  margin-bottom: 8px;
}

.card-desc {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.card-icon {
  width: 48px;
  height: 48px;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  font-size: 1.5rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

/* ============================================
   Forms
   ============================================ */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--color-text);
  margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--color-text);
  background: var(--color-bg);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--color-secondary);
  box-shadow: 0 0 0 3px rgba(13,148,136,0.15);
}

.form-textarea { resize: vertical; min-height: 80px; }

.form-hint {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}

.form-error {
  font-size: 0.8rem;
  color: var(--color-error);
  margin-top: 4px;
}

/* ============================================
   Tables
   ============================================ */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  background: var(--color-surface);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.9rem;
}

tr:last-child td { border-bottom: none; }

tr:hover td {
  background: rgba(13,148,136,0.03);
}

/* ============================================
   Tabs
   ============================================ */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--color-border);
  margin-bottom: 24px;
  overflow-x: auto;
}

.tab {
  padding: 10px 20px;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.tab:hover {
  color: var(--color-text);
  background: var(--color-surface);
}

.tab.active {
  color: var(--color-secondary);
  border-bottom-color: var(--color-secondary);
  font-weight: 600;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Sub-tabs (secondary level inside a parent tab) */
.subtabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  overflow-x: auto;
}

.subtab {
  padding: 6px 14px;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.subtab:hover {
  color: var(--color-text);
}

.subtab.active {
  color: #fff;
  background: var(--color-secondary);
  border-color: var(--color-secondary);
  font-weight: 600;
}

.subtab-content {
  display: none;
}

.subtab-content.active {
  display: block;
}

/* ============================================
   Badges & Status
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-error { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-neutral { background: var(--color-surface); color: var(--color-text-muted); }

/* ============================================
   Toast / Notifications
   ============================================ */
.toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease-out;
  max-width: 400px;
}

.toast-success { background: #065f46; color: #fff; }
.toast-error { background: var(--color-error); color: #fff; }
.toast-info { background: var(--color-primary); color: #fff; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ============================================
   Modal
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 { margin-bottom: 0; }

.modal-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 4px;
}

.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ============================================
   Progress Bar
   ============================================ */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--color-surface);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-secondary), var(--color-accent));
  border-radius: 4px;
  transition: width 0.3s;
}

/* ============================================
   Upload Drop Zone
   ============================================ */
.drop-zone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--color-surface);
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--color-secondary);
  background: rgba(13,148,136,0.05);
}

.drop-zone-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

.drop-zone-text {
  font-size: 1rem;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

.drop-zone-hint {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  opacity: 0.7;
}

/* ============================================
   Cost Estimate Panel
   ============================================ */
.cost-panel {
  background: linear-gradient(135deg, var(--color-primary) 0%, #162447 100%);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-top: 20px;
}

.cost-panel h4 {
  color: #fff;
  margin-bottom: 16px;
  font-size: 1.1rem;
}

.cost-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 0.9rem;
}

.cost-row-label { color: rgba(255,255,255,0.7); }
.cost-row-value { font-family: var(--font-mono); font-weight: 600; }

.cost-divider {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.2);
  margin: 12px 0;
}

.cost-total {
  font-size: 1.2rem;
  font-weight: 700;
}

.cost-total .cost-row-value {
  color: var(--color-accent);
}

/* ============================================
   Share Link Display
   ============================================ */
.share-link-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 8px 12px;
}

.share-link-box input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--color-text);
  outline: none;
}

/* ============================================
   Dashboard Sidebar / Sub-tabs
   ============================================ */
.dashboard-layout {
  display: flex;
  min-height: calc(100vh - 64px);
}

.dashboard-sidebar {
  width: 240px;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  padding: 24px 0;
  flex-shrink: 0;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s;
}

.sidebar-link:hover {
  color: var(--color-text);
  background: rgba(13,148,136,0.05);
  text-decoration: none;
}

.sidebar-link.active {
  color: var(--color-secondary);
  background: rgba(13,148,136,0.08);
  border-right: 3px solid var(--color-secondary);
  font-weight: 600;
}

.sidebar-section {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
  padding: 16px 24px 8px;
  font-weight: 600;
}

.dashboard-main {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* ============================================
   Map With Sidebar Layout (Right Sidebar)
   ============================================ */
.map-layout-wrapper {
  display: flex;
  flex: 1;
  gap: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  height: 600px;
  position: relative;
}

#dashboardMap {
  flex: 1;
  height: 100% !important;
  z-index: 1;
}

.map-sidebar {
  width: 320px;
  background: var(--color-bg);
  border-left: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  transition: margin-right 0.3s ease, transform 0.3s ease;
  z-index: 10;
  position: relative;
}

.map-sidebar.collapsed {
  margin-right: -320px;
}

/* External tools panel (between map and sidebar) */
.map-tools-panel {
  width: 60px;
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 4px;
  gap: 8px;
  z-index: 10;
  flex-shrink: 0;
}

.map-tool-btn {
  width: 48px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 7px 4px 5px;
  font-size: 17px;
  gap: 3px;
  transition: all 0.2s;
  color: var(--color-text);
}

.map-tool-btn span {
  font-size: 0.6rem;
  color: var(--color-text-muted);
  font-family: var(--font-body);
  line-height: 1;
}

.map-tool-btn:hover {
  background: rgba(13, 148, 136, 0.06);
  border-color: var(--color-secondary);
}

.map-tool-btn.active {
  background: #fef3c7;
  border-color: #d97706;
  color: #d97706;
}

.asset-zoom-btn {
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.45;
  font-size: 0.85rem;
  padding: 0 2px;
}

.asset-zoom-btn:hover {
  opacity: 1;
}

.sidebar-collapse-btn {
  position: absolute;
  top: 50%;
  left: -20px;
  transform: translateY(-50%);
  width: 20px;
  height: 40px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-right: none;
  border-radius: 4px 0 0 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  z-index: 20;
}

.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
}

.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--color-border);
}

.sidebar-tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--color-text-muted);
  transition: all 0.2s;
  border-bottom: 2px solid transparent;
}

.sidebar-tab:hover {
  background: rgba(13,148,136,0.05);
}

.sidebar-tab.active {
  color: var(--color-secondary);
  border-bottom-color: var(--color-secondary);
  background: var(--color-bg);
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.asset-table {
  width: 100%;
  font-size: 0.85rem;
}

.asset-table th {
  padding: 8px;
  text-align: left;
  background: none;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.75rem;
}

.asset-table td {
  padding: 8px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.asset-row:hover td {
  background: rgba(13,148,136,0.03);
}

.asset-toggle {
  width: 32px;
  text-align: center;
}

.asset-name {
  cursor: pointer;
  font-weight: 500;
}

.asset-name:hover {
  color: var(--color-secondary);
  text-decoration: underline;
}

.asset-actions {
  width: 48px;
  text-align: right;
}

.asset-delete-btn {
  background: none;
  border: none;
  color: var(--color-error);
  cursor: pointer;
  opacity: 0.6;
}

.asset-delete-btn:hover {
  opacity: 1;
}

.asset-search {
  width: 100%;
  padding: 8px 12px;
  margin-bottom: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

/* Custom Tool Icons */
.map-tool-icon {
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============================================
   File List
   ============================================ */
.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  background: var(--color-bg);
}

.file-item-name {
  flex: 1;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-item-size {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.file-item-remove {
  background: none;
  border: none;
  color: var(--color-error);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px;
}

/* ============================================
   Empty State
   ============================================ */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--color-text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state p {
  margin-bottom: 16px;
}

/* ============================================
   Spinner / Loading
   ============================================ */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-secondary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px;
  color: var(--color-text-muted);
}

/* ============================================
   Dark Mode Toggle
   ============================================ */
.theme-toggle {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.theme-toggle:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
}

/* ============================================
   Footer
   ============================================ */
.footer {
  background: var(--color-primary);
  color: rgba(255,255,255,0.7);
  padding: 0.6rem 1.5rem;
  text-align: center;
  font-size: 0.85rem;
  margin-top: auto;
  flex-shrink: 0;
}

.footer a { color: var(--color-secondary); }

/* ============================================
   Auth Pages (Login, Signup)
   ============================================ */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 64px);
  background: var(--color-surface);
  padding: 24px;
}

.auth-card {
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%;
  max-width: 440px;
}

.auth-card h2 {
  text-align: center;
  margin-bottom: 8px;
}

.auth-card .subtitle {
  text-align: center;
  color: var(--color-text-muted);
  margin-bottom: 32px;
  font-size: 0.9rem;
}

/* ============================================
   Viewer Page Overrides
   ============================================ */
.viewer-page {
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #000;
}

.viewer-controls {
  position: fixed;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 8px;
  z-index: 50;
}

.viewer-control-btn {
  background: rgba(27,45,91,0.85);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 8px 14px;
  font-size: 0.85rem;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: background 0.2s;
}

.viewer-control-btn:hover {
  background: rgba(27,45,91,0.95);
}

.viewer-title-bar {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(27,45,91,0.85);
  color: #fff;
  padding: 8px 24px;
  border-radius: var(--radius-lg);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  z-index: 50;
  backdrop-filter: blur(8px);
  white-space: nowrap;
}

.viewer-brand {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 50;
  opacity: 0.7;
}

.viewer-brand img {
  height: 28px;
  width: auto;
}

.viewer-access-prompt {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

/* ============================================
   Slider Controls
   ============================================ */
.slider-group {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
}

.slider-group label {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.7);
  min-width: 70px;
}

.slider-group input[type="range"] {
  flex: 1;
  height: 4px;
  accent-color: var(--color-secondary);
}

.slider-group .slider-value {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: rgba(255,255,255,0.6);
  min-width: 36px;
  text-align: right;
}

/* ============================================
   Cost Panel
   ============================================ */
.cost-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 16px 0;
}

.cost-panel h4 {
  margin-bottom: 12px;
  font-size: 1rem;
}

.cost-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 0.9rem;
}

.cost-row-label {
  color: var(--color-text-muted);
}

.cost-row-value {
  font-weight: 600;
  color: var(--color-secondary);
  font-family: var(--font-mono);
}

.cost-row.cost-total {
  font-weight: 700;
  padding-top: 12px;
  margin-top: 8px;
}

.cost-divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 8px 0;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
  .nav { padding: 0 1rem; }
  .nav-links { display: none; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--color-primary);
    padding: 16px;
    box-shadow: var(--shadow-lg);
  }
  .nav-toggle { display: block; }

  .hero { padding: 3rem 1rem; }
  .hero h1 { font-size: 2rem; }

  .container { padding: 0 1rem; }

  .dashboard-layout { flex-direction: column; }
  .dashboard-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--color-border);
    padding: 12px 0;
    display: flex;
    overflow-x: auto;
  }
  .sidebar-link { padding: 8px 16px; white-space: nowrap; }
  .sidebar-section { display: none; }
  .dashboard-main { padding: 16px; }

  .card-grid { grid-template-columns: 1fr; }

  h1 { font-size: 2rem; }
  h2 { font-size: 1.5rem; }

  .auth-card { padding: 24px; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 1.75rem; }
  .hero p { font-size: 1rem; }
  .btn-lg { padding: 12px 24px; }
}

/* ============================================
   Map Coordinate Bar
   ============================================ */
.map-coord-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 320px;
  z-index: 1000;
  background: rgba(27, 45, 91, 0.88);
  color: #fff;
  padding: 3px 12px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  display: flex;
  gap: 28px;
  pointer-events: none;
  user-select: none;
}

.map-layout-wrapper:has(.map-sidebar.collapsed) .map-coord-bar {
  right: 0;
}

/* ============================================
   Layer Tree (sidebar)
   ============================================ */
.layer-header-row td {
  background: var(--color-surface);
  padding: 6px 6px;
  font-size: 0.82rem;
  border-bottom: 1px solid var(--color-border);
}

.layer-item-row td {
  padding-left: 18px;
  font-size: 0.8rem;
}

.layer-color-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

/* ============================================================
   Coordinate Systems (Info tab) — survey-grade detail cards
   ============================================================ */

.crs-detail {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.5;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 14px 16px;
}
.crs-row {
  display: flex;
  gap: 12px;
  padding: 2px 0;
}
.crs-row-head {
  margin-top: 8px;
  border-top: 1px solid var(--color-border);
  padding-top: 8px;
  font-weight: 600;
}
.crs-row-head:first-child { margin-top: 0; border-top: none; padding-top: 0; }
.crs-indent { padding-left: 18px; }
.crs-label {
  flex: 0 0 240px;
  color: var(--color-text-muted);
}
.crs-value {
  flex: 1;
  color: var(--color-text);
  word-break: break-word;
}
.crs-epsg {
  display: inline-block;
  font-size: 0.72rem;
  background: rgba(13,148,136,0.12);
  color: var(--color-secondary);
  border-radius: 4px;
  padding: 0 6px;
  margin-left: 4px;
}
.crs-source {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--color-border);
  font-size: 0.76rem;
}
.crs-source .crs-muted { margin-left: 8px; }
.crs-muted { color: var(--color-text-muted); font-weight: 400; }
.crs-error { color: var(--color-error, #DC2626); }
.crs-loading { color: var(--color-text-muted); font-size: 0.85rem; padding: 8px 0; }

.crs-card {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 12px;
  background: var(--color-bg);
}
.crs-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-weight: 600;
  margin-bottom: 6px;
}
.crs-card-actions { display: inline-flex; gap: 4px; }
.crs-card .crs-detail { margin-top: 8px; }

.crs-search-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}
.crs-search-item {
  text-align: left;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--color-text);
}
.crs-search-item:hover { border-color: var(--color-secondary); }

.crs-catalog {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}
.crs-cat-item {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--color-surface);
}
.crs-cat-title { font-weight: 600; font-size: 0.9rem; }
.crs-cat-meta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--color-text-muted);
  margin: 4px 0;
}
.crs-cat-note { font-size: 0.82rem; line-height: 1.45; }
.crs-cat-src { display: inline-block; margin-top: 6px; font-size: 0.78rem; }

/* ---- Searchable CRS picker ---- */
.crs-picker { position: relative; }
.crs-picker-box { position: relative; }
.crs-picker-results {
  position: absolute;
  z-index: 50;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  max-height: 320px;
  overflow-y: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  padding: 4px;
}
.crs-picker-group {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  padding: 8px 10px 4px;
  font-weight: 600;
}
.crs-picker-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 7px 10px;
  cursor: pointer;
  color: var(--color-text);
}
.crs-picker-item:hover { background: var(--color-bg); }
.crs-picker-item-main { font-size: 0.88rem; }
.crs-picker-item-sub {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--color-text-muted);
}
.crs-picker-empty {
  padding: 10px;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}
.crs-picker-detail:not(:empty) { margin-top: 10px; }

/* ---- Builder mode radios ---- */
.crs-mode-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}
.crs-mode-opt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  cursor: pointer;
}
.crs-mode-opt input { margin: 0; }
