/* Z-DCAM — Diseño de Integración de Cámaras */
:root {
  --bg-primary: #0f1117;
  --bg-secondary: #161922;
  --bg-tertiary: #1c2030;
  --bg-elevated: #222738;
  --border: #2a3045;
  --border-light: #353d56;
  --text-primary: #e8eaef;
  --text-secondary: #949bb3;
  --text-muted: #6b7289;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-muted: rgba(59, 130, 246, 0.15);
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --fov-color: rgba(59, 130, 246, 0.25);
  --fov-stroke: rgba(59, 130, 246, 0.6);
  --sidebar-width: 240px;
  --header-height: 64px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --transition: 0.2s ease;
  --font: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

html, body {
  height: 100%;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-primary);
  overflow: hidden;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 10000;
  padding: 0.75rem 1rem;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius);
  font-weight: 600;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

#app {
  display: flex;
  height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
}

.brand-icon {
  width: 40px;
  height: 40px;
  background: var(--accent-muted);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.brand-icon svg { width: 22px; height: 22px; }

.sidebar-brand h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.sidebar-brand span {
  font-size: 11px;
  color: var(--text-muted);
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  width: 100%;
}

.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.nav-item[hidden] {
  display: none !important;
}

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

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

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

.project-indicator {
  font-size: 12px;
  color: var(--text-muted);
  padding: 8px 10px;
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* App copyright — ZEMSOFT S.R.L. */
.app-copyright {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}

.app-copyright-logo {
  display: block;
  height: auto;
  max-height: 36px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  opacity: 0.92;
}

.app-copyright-legal {
  margin: 0;
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.35;
  letter-spacing: 0.01em;
}

.app-copyright-compact {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  gap: 4px;
}

.app-copyright-compact .app-copyright-logo {
  max-height: 26px;
}

.app-copyright-auth {
  position: absolute;
  bottom: 6px;
  left: 0;
  right: 0;
  z-index: 1;
  padding-bottom: 0;
  transform: scale(0.88);
  transform-origin: center bottom;
  pointer-events: none;
}

.app-copyright-auth .app-copyright-logo,
.app-copyright-auth .app-copyright-legal {
  pointer-events: auto;
}

.app-copyright-plans {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* Main content */
.main-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.view {
  display: none;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.view.active { display: flex; }

#view-dashboard.active {
  overflow-y: auto;
}

#view-dashboard .projects-grid {
  flex: 0 1 auto;
  overflow-y: visible;
}

#view-dashboard.dashboard-empty .projects-grid {
  display: none;
}

#view-dashboard.dashboard-has-projects .empty-state {
  display: none !important;
}

#view-dashboard.dashboard-empty .empty-state {
  display: flex;
}

.empty-state[hidden] {
  display: none !important;
}

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.view-header.compact { padding: 16px 20px; }

.view-header h2 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.view-header p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn svg { width: 16px; height: 16px; }

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

.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover { background: var(--bg-tertiary); border-color: var(--border-light); }

.btn-secondary[data-active="true"] {
  background: var(--accent-muted);
  border-color: var(--accent);
  color: var(--accent);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

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

.btn-sm { padding: 6px 12px; font-size: 12px; }

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

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius);
  line-height: 1;
}

.btn-icon:hover { background: var(--bg-tertiary); color: var(--text-primary); }

/* Projects grid */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  padding: 24px 28px;
  overflow-y: auto;
  flex: 1;
}

.project-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: var(--transition);
}

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

.project-card.active-project {
  border-color: var(--accent);
  background: var(--accent-muted);
}

.project-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}

.project-card p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  font-size: 12px;
  color: var(--text-muted);
}

.project-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.project-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.project-workspace {
  margin: 0 28px 24px;
  padding: 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.workspace-header {
  margin-bottom: 16px;
}

.workspace-header h3 {
  font-size: 18px;
  margin-bottom: 4px;
}

.workspace-header p {
  font-size: 13px;
  color: var(--text-secondary);
}

.workspace-panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.workspace-panel {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}

.workspace-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.workspace-panel-head h4 {
  font-size: 14px;
  font-weight: 600;
}

.asset-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.asset-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
}

.asset-info {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.asset-icon {
  font-size: 18px;
  line-height: 1.2;
}

.asset-name {
  display: block;
  font-size: 14px;
  margin-bottom: 2px;
}

.asset-meta {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
}

.asset-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.sheet-selector {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sheet-selector select {
  min-width: 160px;
}

.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  gap: 12px;
}

.empty-state svg { width: 64px; height: 64px; opacity: 0.4; }

.empty-state h3 { font-size: 18px; color: var(--text-secondary); }

/* Designer */
.designer-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.toolbar {
  width: 72px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 4px;
  gap: 4px;
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
}

.toolbar-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
}

.toolbar-label {
  font-size: 8px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  margin: 4px 0;
  user-select: none;
}

.toolbar-select {
  width: 58px;
  padding: 4px 2px;
  font-size: 9px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font);
  cursor: pointer;
}

.toolbar-color {
  width: 38px;
  height: 28px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-tertiary);
  cursor: pointer;
}

.tool-btn-sm {
  width: 32px;
  height: 32px;
}

.tool-btn-sm svg {
  width: 16px;
  height: 16px;
}

.tool-btn {
  width: 38px;
  height: 38px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.tool-btn svg { width: 18px; height: 18px; }

.tool-btn:hover { background: var(--bg-tertiary); color: var(--text-primary); }

.tool-btn.active {
  background: var(--accent-muted);
  color: var(--accent);
}

.toolbar-divider {
  width: 28px;
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.canvas-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #1a1d27;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 20px 20px;
}

#designCanvas {
  display: block;
  cursor: crosshair;
}

.canvas-info {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background: rgba(15, 17, 23, 0.85);
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  backdrop-filter: blur(8px);
  z-index: 2;
}

.canvas-overlays {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  z-index: 2;
  pointer-events: none;
}

.canvas-overlays > * {
  pointer-events: auto;
}

.canvas-dori-legend {
  background: rgba(15, 17, 23, 0.88);
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
  max-width: 220px;
}

.canvas-dori-toggles {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(15, 17, 23, 0.88);
  padding: 6px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
  min-width: 148px;
}

.canvas-dori-toggles-title {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.02em;
  margin-bottom: 2px;
}

.canvas-toggle-ir {
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

.canvas-toggle {
  font-size: 11px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.dori-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  font-size: 10px;
  color: var(--text-secondary);
}

.dori-legend-compact {
  gap: 4px 6px;
  margin-top: 6px;
}

.dori-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.dori-legend-item.dori-legend-hidden {
  opacity: 0.35;
  text-decoration: line-through;
}

.dori-legend-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.dori-legend-item[data-dori='detection'] .dori-legend-swatch { background: rgba(239, 68, 68, 0.55); }
.dori-legend-item[data-dori='observation'] .dori-legend-swatch { background: rgba(245, 158, 11, 0.6); }
.dori-legend-item[data-dori='recognition'] .dori-legend-swatch { background: rgba(59, 130, 246, 0.65); }
.dori-legend-item[data-dori='identification'] .dori-legend-swatch { background: rgba(34, 197, 94, 0.7); }
.dori-legend-item[data-dori='optical'] .dori-legend-swatch {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.5) 50%, transparent 50%);
}

.prop-dori-block {
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-tertiary);
}

.prop-dori-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.prop-dori-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 8px;
  font-size: 11px;
}

.prop-dori-grid span {
  display: block;
  color: var(--text-muted);
  font-size: 10px;
}

.prop-dori-grid strong {
  font-family: var(--font-mono);
  color: var(--text-primary);
  font-size: 12px;
}

.prop-dori-full {
  grid-column: 1 / -1;
  padding-top: 4px;
  border-top: 1px dashed var(--border);
}

.prop-dori-ir {
  margin-top: 8px;
  font-size: 11px;
  color: #fbbf24;
}

.map-dori-panel {
  margin: 12px 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-tertiary);
}

.map-dori-panel h3 {
  margin-top: 0 !important;
  margin-bottom: 8px !important;
}

.map-dori-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 8px;
  cursor: pointer;
}

.map-prop-dori {
  margin: 10px 0 12px;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
}

.map-prop-dori-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  padding: 3px 0;
}

.map-prop-dori-row span { color: var(--text-muted); }
.map-prop-dori-row strong {
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.map-prop-dori-optical {
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
}

.properties-panel {
  width: 260px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  padding: 16px;
  overflow-y: auto;
  flex-shrink: 0;
}

.design-layers {
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.layer-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.layer-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-primary);
  cursor: pointer;
  transition: var(--transition);
}

.layer-item:hover {
  border-color: var(--border-light);
}

.layer-item.active {
  border-color: var(--accent);
  background: var(--accent-muted);
}

.layer-item.layer-empty {
  cursor: default;
  flex-wrap: wrap;
}

.layer-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.layer-name {
  font-size: 12px;
  font-weight: 500;
  flex: 1;
  min-width: 0;
}

.layer-meta {
  display: none;
}

.layer-controls {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.layer-btn {
  border: none;
  background: var(--bg-tertiary);
  border-radius: 4px;
  width: 26px;
  height: 26px;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  padding: 0;
}

.layer-btn:hover {
  background: var(--bg-secondary);
}

.layer-import {
  margin-left: auto;
}

.prop-check label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  cursor: pointer;
}

.prop-check input {
  width: auto;
}

.prop-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin: 8px 0 12px;
  line-height: 1.4;
}

.prop-readonly {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.prop-field input[readonly] {
  opacity: 0.75;
  cursor: default;
}

#designPropertiesContent h3 {
  margin-top: 0;
}

.properties-panel h3 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.properties-empty {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  padding: 24px 0;
}

.scale-input {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.scale-input input {
  width: 60px;
  padding: 6px 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
}

/* Map */
.map-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.map-container {
  flex: 1;
  min-height: 400px;
  background: var(--bg-tertiary);
}

.map-sidebar {
  width: 300px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  padding: 16px;
  overflow-y: auto;
  flex-shrink: 0;
}

.map-sidebar h3 {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 16px 0 10px;
}

.map-sidebar h3:first-child { margin-top: 0; }

.map-search {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
  position: relative;
}

.map-search input {
  flex: 1;
  min-width: 120px;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 13px;
}

.map-suggestions {
  list-style: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 4px;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.map-suggestion-item {
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

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

.map-suggestion-item:hover {
  background: var(--accent-muted);
}

.map-suggestion-item strong {
  display: block;
  font-weight: 500;
}

.map-suggestion-item span {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.map-provider-badge {
  font-size: 10px;
  color: var(--accent);
  background: var(--accent-muted);
  padding: 4px 8px;
  border-radius: 20px;
  display: inline-block;
  margin-bottom: 12px;
  font-weight: 500;
  letter-spacing: 0.03em;
}

.camera-marker-icon {
  background: transparent !important;
  border: none !important;
}

.leaflet-container {
  background: #1a1d27;
  font-family: var(--font);
}

#googleMap.leaflet-container {
  height: 100%;
  width: 100%;
}

.map-camera-list {
  list-style: none;
}

.map-camera-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px;
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  margin-bottom: 6px;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
}

.map-camera-item:hover { border-color: var(--border-light); }

.map-camera-item.selected { border-color: var(--accent); background: var(--accent-muted); }

.map-camera-item .cam-info { flex: 1; }

.map-camera-item .cam-name {
  font-size: 13px;
  font-weight: 500;
}

.map-camera-item .cam-model {
  font-size: 11px;
  color: var(--text-muted);
}

.map-camera-item .cam-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}

.map-camera-item .cam-delete:hover { color: var(--danger); background: rgba(239,68,68,0.1); }

.map-camera-props {
  margin: 12px 0;
  padding: 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.map-camera-props h4 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}

.map-camera-props .cam-type {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.map-camera-props .rotation-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.map-camera-props .rotation-controls button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.map-camera-props .rotation-controls button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.map-rotate-hint {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 8px;
  line-height: 1.4;
}

.leaflet-rotate-handle {
  background: transparent !important;
  border: none !important;
}

.leaflet-rotate-handle div {
  width: 14px;
  height: 14px;
  background: #3b82f6;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
  cursor: grab;
}

.leaflet-rotate-handle div:active {
  cursor: grabbing;
}

.distance-item {
  padding: 8px 10px;
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  margin-bottom: 6px;
  font-size: 12px;
}

.distance-item strong {
  color: var(--accent);
  font-family: var(--font-mono);
}

.map-api-notice {
  position: absolute;
  bottom: 20px;
  left: calc(var(--sidebar-width) + 20px);
  right: 320px;
  z-index: 10;
}

.notice-content {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-lg);
  color: var(--warning);
}

.notice-content svg { width: 24px; height: 24px; flex-shrink: 0; }

.notice-content p { font-size: 13px; margin-top: 4px; color: var(--text-secondary); }

.notice-content code {
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
}

/* Preview */
.preview-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.preview-main {
  flex: 1;
  position: relative;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

#previewCanvas {
  max-width: 100%;
  max-height: 100%;
}

.preview-overlay-info {
  position: absolute;
  top: 16px;
  left: 16px;
  background: rgba(0, 0, 0, 0.7);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 12px;
  font-family: var(--font-mono);
  color: #aaa;
  backdrop-filter: blur(4px);
}

.preview-controls {
  width: 300px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  padding: 20px;
  overflow-y: auto;
}

.preview-controls h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 20px;
}

.preview-stats {
  margin-top: 20px;
  padding: 14px;
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  font-size: 12px;
}

.preview-stats .stat-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  color: var(--text-secondary);
}

.preview-stats .stat-row span:last-child {
  font-family: var(--font-mono);
  color: var(--text-primary);
}

/* Cameras catalog */
.cameras-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  padding: 24px 28px;
  overflow-y: auto;
  flex: 1;
}

.camera-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: var(--transition);
}

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

.camera-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.camera-card h3 {
  font-size: 15px;
  font-weight: 600;
}

.camera-card .brand {
  font-size: 11px;
  color: var(--accent);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.camera-card .type-badge {
  font-size: 10px;
  padding: 3px 8px;
  background: var(--bg-tertiary);
  border-radius: 20px;
  color: var(--text-muted);
}

.mp-badge {
  font-size: 10px;
  padding: 3px 8px;
  background: rgba(99, 102, 241, 0.15);
  border-radius: 20px;
  color: #a5b4fc;
  font-weight: 600;
}

.catalog-mp-preview {
  font-size: 14px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent);
  padding: 8px 10px;
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.form-group-full {
  grid-column: 1 / -1;
}

.camera-specs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.spec-item {
  font-size: 12px;
}

.spec-item label {
  display: block;
  color: var(--text-muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

.spec-item span {
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.camera-specs-dori {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.spec-section-title {
  grid-column: 1 / -1;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.spec-item-note label,
.spec-item-note span {
  font-size: 11px;
  color: var(--text-muted);
}

.spec-row-dori span:last-child {
  font-family: var(--font-mono);
}

.dori-compact {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
}

.dori-compact span {
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
}

.catalog-dori-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-secondary);
}

.catalog-dori-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
}

.catalog-dori-item span {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 10px;
}

.catalog-dori-item strong {
  font-family: var(--font-mono);
  color: var(--text-primary);
  font-size: 13px;
}

.catalog-search {
  min-width: 220px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 13px;
}

.catalog-header-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.catalog-empty {
  grid-column: 1 / -1;
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

.camera-card-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.catalog-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 500;
}

.catalog-badge.custom {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent);
}

.catalog-badge.edited {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.camera-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.catalog-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
}

.modal-wide {
  max-width: 640px;
  width: calc(100% - 32px);
}

@media (max-width: 640px) {
  .catalog-form-grid {
    grid-template-columns: 1fr;
  }
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 13px;
  transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

.form-group input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.range-value {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  margin-top: 4px;
}

.camera-specs-preview {
  padding: 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  font-size: 12px;
  margin-top: 8px;
}

.camera-specs-preview .spec-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  color: var(--text-secondary);
}

.camera-range-preview {
  margin-top: 12px;
  padding: 10px;
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  text-align: center;
}

.camera-range-preview-svg {
  width: 100%;
  max-width: 200px;
  height: auto;
}

.camera-range-legend {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 8px;
  font-size: 10px;
  color: var(--text-muted);
}

.camera-range-legend span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  display: inline-block;
}

.legend-dot.max { background: #3b82f6; }
.legend-dot.ir { background: #f59e0b; }

/* Modal */
.modal {
  border: none;
  border-radius: var(--radius-lg);
  padding: 0;
  background: var(--bg-secondary);
  color: var(--text-primary);
  box-shadow: var(--shadow);
  max-width: 480px;
  width: 90%;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

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

.modal-header h3 { font-size: 16px; font-weight: 600; }

.modal-body { padding: 24px; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  box-shadow: var(--shadow);
  animation: slideIn 0.3s ease;
}

.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Property panel fields */
.prop-field {
  margin-bottom: 12px;
}

.prop-field label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.prop-field input,
.prop-field select,
.prop-field textarea {
  width: 100%;
  padding: 7px 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 12px;
}

.prop-field textarea {
  resize: vertical;
  min-height: 72px;
  font-family: inherit;
  line-height: 1.4;
}

.prop-actions {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* Auth screen */
.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 16px 36px;
  overflow: hidden;
}

.auth-bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 20%, rgba(59, 130, 246, 0.18), transparent 50%),
    radial-gradient(ellipse 60% 50% at 85% 75%, rgba(99, 102, 241, 0.12), transparent 45%),
    var(--bg-primary);
  z-index: -1;
}

.auth-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: linear-gradient(to bottom, black 30%, transparent);
}

.auth-screen[hidden],
#app[hidden] {
  display: none !important;
}

.auth-shell {
  display: grid;
  grid-template-columns: 1fr 400px;
  width: 100%;
  max-width: 920px;
  flex-shrink: 0;
  background: rgba(22, 25, 34, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 18px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 24px 80px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(20px);
  animation: authShellIn 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes authShellIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.auth-aside {
  position: relative;
  padding: 28px 28px;
  background: linear-gradient(145deg, rgba(59, 130, 246, 0.12) 0%, transparent 55%),
    linear-gradient(220deg, rgba(99, 102, 241, 0.08) 0%, transparent 50%);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-aside-inner {
  position: relative;
  z-index: 1;
}

.auth-aside-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.auth-aside-icon {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
}

.auth-aside-brand h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.auth-aside-brand p {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

.auth-aside-title {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: 18px;
  max-width: 300px;
}

.auth-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-features li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.auth-feature-icon {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  font-size: 16px;
  flex-shrink: 0;
}

.auth-features strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 1px;
}

.auth-features span {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.35;
}

.auth-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 22px;
  background: var(--bg-secondary);
}

.auth-mobile-brand {
  display: none;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.auth-mobile-brand .brand-icon {
  width: 36px;
  height: 36px;
}

.auth-mobile-brand strong {
  font-size: 16px;
  letter-spacing: -0.02em;
}

.auth-mobile-brand span {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 400;
}

.auth-card {
  width: 100%;
  max-width: 360px;
}

.auth-card-header {
  margin-bottom: 12px;
}

.auth-card-header h2 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 2px;
}

.auth-card-header p {
  font-size: 12px;
  color: var(--text-muted);
}

.auth-tabs {
  display: flex;
  gap: 0;
  background: var(--bg-tertiary);
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
}

.auth-tab {
  flex: 1;
  padding: 7px 10px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.auth-tab:hover:not(.active) {
  color: var(--text-secondary);
}

.auth-tab.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.auth-panel {
  animation: authFadeIn 0.25s ease;
}

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

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.auth-field {
  margin-bottom: 8px;
}

.auth-field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}

.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input-icon {
  position: absolute;
  left: 11px;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
  transition: color 0.2s ease;
}

.auth-input-wrap input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 13px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.auth-input-wrap input::placeholder {
  color: var(--text-muted);
}

.auth-input-wrap input:hover {
  border-color: var(--border-light);
}

.auth-input-wrap input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.04);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

.auth-input-wrap:focus-within .auth-input-icon {
  color: var(--accent);
}

.auth-submit {
  width: 100%;
  margin-top: 4px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border: none;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.auth-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.auth-submit:active {
  transform: translateY(0);
}

.auth-submit-secondary {
  width: 100%;
  margin-top: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.auth-submit-secondary:hover {
  border-color: var(--border-light);
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.auth-trial-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  margin-bottom: 8px;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.25);
  border-radius: 8px;
  font-size: 11px;
  color: #86efac;
}

.auth-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  margin-bottom: 10px;
  line-height: 1.4;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0 8px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}

.auth-hint {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 16px;
}

.auth-hint code {
  background: var(--bg-tertiary);
  padding: 2px 5px;
  border-radius: 4px;
  font-family: var(--font-mono);
}

.captcha-wrap {
  display: flex;
  justify-content: center;
  min-height: 0;
  margin-bottom: 2px;
  transform: scale(0.92);
  transform-origin: center top;
}

.captcha-wrap-google {
  margin-bottom: 4px;
  transform: scale(0.9);
}

.google-auth-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.google-signin-btn {
  display: flex;
  justify-content: center;
  width: 100%;
}

@media (max-width: 820px) {
  .auth-shell {
    grid-template-columns: 1fr;
    max-width: 400px;
  }

  .auth-aside {
    display: none;
  }

  .auth-main {
    padding: 18px 20px;
  }

  .auth-mobile-brand {
    display: flex;
  }
}

@media (max-width: 480px) {
  .auth-screen {
    padding: 12px;
  }

  .auth-shell {
    border-radius: 14px;
  }

  .auth-main {
    padding: 16px 16px;
  }
}

.user-bar-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.user-license-badge {
  font-size: 10px;
  color: var(--text-muted);
}

.user-license-badge.status-trial { color: #f59e0b; }
.user-license-badge.status-activo { color: #22c55e; }
.user-license-badge.status-expirado { color: #ef4444; }
.user-license-badge.status-suspendido { color: #f97316; }

/* Plan selection screen */
.plans-screen {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: linear-gradient(160deg, #0a0c12 0%, #12182a 45%, #0f1117 100%);
  overflow-y: auto;
  padding: 32px 20px;
}

.plans-container {
  max-width: 980px;
  margin: 0 auto;
}

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

.plans-header h1 {
  margin: 0 0 6px;
  font-size: 28px;
}

.plans-header p {
  margin: 0;
  color: var(--text-secondary);
}

.plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

.plan-card {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.plan-card-featured {
  border-color: rgba(59, 130, 246, 0.55);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.15);
}

.plan-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 10px;
  font-weight: 600;
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  padding: 3px 8px;
  border-radius: 999px;
}

.plan-card h3 {
  margin: 0;
  font-size: 18px;
}

.plan-price {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.1;
}

.plan-price span {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
}

.plan-desc {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
  min-height: 36px;
}

.plan-features {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.plan-features li {
  padding: 4px 0;
  padding-left: 16px;
  position: relative;
}

.plan-features li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: #22c55e;
}

.plans-footnote {
  margin-top: 18px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

/* Admin panel */
#view-admin.active {
  overflow-y: auto;
}

.admin-page {
  padding: 24px 28px 32px;
  max-width: 1200px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.admin-stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.admin-stat-card-warn {
  border-color: rgba(245, 158, 11, 0.25);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08) 0%, var(--bg-secondary) 100%);
}

.admin-stat-card-success {
  border-color: rgba(34, 197, 94, 0.25);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.08) 0%, var(--bg-secondary) 100%);
}

.admin-stat-icon {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 18px;
  flex-shrink: 0;
}

.admin-stat-body strong {
  display: block;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 2px;
}

.admin-stat-body span {
  font-size: 12px;
  color: var(--text-muted);
}

.admin-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 10px 0;
  background: linear-gradient(to bottom, var(--bg-primary) 70%, transparent);
}

.admin-subnav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.admin-subnav-link:hover {
  color: var(--text-primary);
  border-color: var(--border-light);
  background: var(--bg-tertiary);
}

.admin-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  background: rgba(245, 158, 11, 0.2);
  color: #fcd34d;
}

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

.admin-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px 24px;
  scroll-margin-top: 72px;
}

.admin-card-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 18px;
}

.admin-card-head-row {
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.admin-card-head-main {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-width: 0;
}

.admin-card-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  font-size: 18px;
  flex-shrink: 0;
}

.admin-card-head h3 {
  margin: 0 0 2px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.admin-card-hint {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
}

.admin-result-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.admin-payment-config {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.admin-qr-dropzone {
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.admin-qr-dropzone:hover,
.admin-qr-dropzone:focus-visible {
  outline: none;
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.05);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

.admin-qr-dropzone.is-dragover {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.1);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

.admin-inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.admin-form-actions {
  margin-top: 4px;
}

.admin-toolbar {
  margin-bottom: 14px;
}

.admin-search-wrap {
  position: relative;
  max-width: 420px;
}

.admin-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.admin-search {
  width: 100%;
  padding: 10px 12px 10px 38px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 13px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.admin-search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-tertiary);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table th,
.admin-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

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

.admin-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.admin-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--bg-elevated);
  font-weight: 600;
}

.admin-user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.admin-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
  flex-shrink: 0;
}

.admin-user-name {
  font-weight: 600;
  color: var(--text-primary);
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.admin-id {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.admin-amount {
  font-weight: 600;
  white-space: nowrap;
}

.admin-ref {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}

.admin-report-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 16px;
}

.admin-report-filters .form-group {
  margin-bottom: 0;
  min-width: 140px;
}

.admin-report-filters input[type="date"] {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 13px;
}

.admin-report-kpis {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.admin-kpi-chip {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 10px;
  min-width: 120px;
}

.admin-kpi-chip strong {
  font-size: 16px;
  font-weight: 700;
}

.admin-kpi-chip span {
  font-size: 11px;
  color: var(--text-muted);
}

.admin-kpi-success {
  border-color: rgba(34, 197, 94, 0.25);
  background: rgba(34, 197, 94, 0.08);
}

.admin-kpi-warn {
  border-color: rgba(245, 158, 11, 0.25);
  background: rgba(245, 158, 11, 0.08);
}

.admin-kpi-accent {
  border-color: rgba(59, 130, 246, 0.25);
  background: rgba(59, 130, 246, 0.08);
}

.admin-report-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.admin-report-panel h4,
.admin-report-subtitle {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 600;
}

.admin-report-subtitle {
  margin-top: 4px;
}

.admin-table-compact th,
.admin-table-compact td {
  padding: 8px 10px;
  font-size: 12px;
}

.admin-log-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 520px;
  overflow-y: auto;
  padding-right: 4px;
}

.admin-log-item {
  padding: 12px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 10px;
  border-left: 3px solid var(--border-light);
}

.admin-log-item.admin-log-error {
  border-left-color: #ef4444;
  background: rgba(239, 68, 68, 0.06);
}

.admin-log-item.admin-log-warn {
  border-left-color: #f59e0b;
  background: rgba(245, 158, 11, 0.06);
}

.admin-log-item.admin-log-info {
  border-left-color: #3b82f6;
}

.admin-log-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.admin-log-head time {
  margin-left: auto;
  white-space: nowrap;
}

.admin-log-badge {
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 10px;
  background: rgba(255, 255, 255, 0.06);
}

.admin-log-badge-app {
  color: #93c5fd;
}

.admin-log-badge-mail {
  color: #fcd34d;
}

.admin-log-level {
  font-weight: 700;
  color: var(--text-secondary);
}

.admin-log-category {
  color: var(--text-muted);
}

.admin-log-message {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-primary);
}

.admin-log-context {
  margin: 8px 0 0;
  padding: 8px 10px;
  background: var(--bg-primary);
  border-radius: 8px;
  font-size: 11px;
  overflow-x: auto;
  color: var(--text-secondary);
}

@media (max-width: 900px) {
  .admin-report-grid {
    grid-template-columns: 1fr;
  }
}

/* Admin modals */
.admin-modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin-modal-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 16px;
  padding: 14px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.admin-modal-summary-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.admin-modal-summary-item.full {
  grid-column: 1 / -1;
}

.admin-modal-summary-item span {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.admin-modal-summary-item strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-word;
}

.admin-modal-proof label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.admin-modal-proof-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font);
  font-size: 13px;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.admin-modal-proof-btn:hover {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.05);
}

.admin-modal-proof-btn img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.admin-modal-alert {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.45;
}

.admin-modal-alert-success {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.25);
  color: #86efac;
}

.admin-modal-alert-warn {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: #fcd34d;
}

.admin-modal-hint {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
}

.admin-modal-body .form-group {
  margin-bottom: 0;
}

@media (max-width: 560px) {
  .admin-modal-summary {
    grid-template-columns: 1fr;
  }
}

.admin-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.modal-wide {
  max-width: 520px;
}

.payment-modal-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.payment-plan-summary {
  padding: 10px 12px;
  background: var(--surface-elevated);
  border-radius: 8px;
  font-size: 14px;
}

.payment-qr-block h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.payment-qr-wrap {
  display: flex;
  justify-content: center;
  padding: 12px;
  background: #fff;
  border-radius: 10px;
  min-height: 160px;
  align-items: center;
}

.payment-qr-wrap img {
  max-width: 200px;
  max-height: 200px;
}

.payment-qr-missing {
  color: #666;
  font-size: 13px;
  text-align: center;
  padding: 20px;
}

.payment-instructions {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.payment-proof-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.payment-proof-preview {
  max-width: 100%;
  max-height: 180px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.plans-renewal-banner {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fcd34d;
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 14px;
}

.app-restricted .project-indicator {
  opacity: 0.5;
}

.plans-status-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 16px;
}

.plans-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  font-size: 14px;
}

.plans-requests-list {
  margin-bottom: 16px;
}

.plans-request-items {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}

.plans-request-items li {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.admin-section {
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.admin-section:last-child {
  border-bottom: none;
}

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

.admin-section-header h3,
.admin-section > h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.admin-filter-select {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  font-family: var(--font);
  min-width: 140px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

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

.admin-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 12px 16px 16px;
}

.admin-pagination-info {
  font-size: 12px;
  color: var(--text-secondary);
}

.payment-qr-admin {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.admin-payment-config .payment-qr-preview-wrap {
  width: 180px;
  height: 180px;
}

.payment-qr-preview-wrap {
  width: 160px;
  height: 160px;
}

.payment-qr-admin-form {
  flex: 1;
  min-width: 240px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.badge-trial,
.badge-pendiente {
  /* alias */
}

.admin-meta {
  color: var(--text-muted);
  font-size: 11px;
}

.admin-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 32px 16px;
}

.admin-empty-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.admin-empty-icon {
  font-size: 24px;
  opacity: 0.7;
}

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-trial { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.badge-activo { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
.badge-expirado { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.badge-suspendido { background: rgba(249, 115, 22, 0.15); color: #fb923c; }

.user-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  padding: 6px 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius);
}

.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  cursor: pointer;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  padding: 7px 10px;
  border-radius: 8px;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.btn-logout-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn-logout-label {
  line-height: 1;
  white-space: nowrap;
}

.btn-logout:hover {
  color: #fff;
  background: rgba(239, 68, 68, 0.85);
  border-color: #ef4444;
  transform: translateY(-1px);
}

.btn-logout:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.35);
}

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

.pdf-download-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}

.pdf-download-dialog {
  width: min(420px, 100%);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-lg);
}

.pdf-download-dialog h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.pdf-download-dialog p {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.pdf-download-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
}

.pdf-download-list .pdf-download-item {
  width: 100%;
  text-align: left;
}

.pdf-download-or {
  margin: 14px 0 8px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

.pdf-download-primary {
  margin-bottom: 8px;
}

/* Profile */
#view-profile.active {
  overflow-y: auto;
}

.profile-page {
  padding: 24px 28px 32px;
  max-width: 1120px;
}

.profile-hero {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px 22px;
  margin-bottom: 22px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12) 0%, rgba(99, 102, 241, 0.06) 100%);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 16px;
}

.profile-hero-avatar {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
  background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.35);
  flex-shrink: 0;
}

.profile-hero-info h3 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 2px;
}

.profile-hero-info p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.profile-hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
}

.profile-badge-google {
  background: rgba(234, 67, 53, 0.12);
  border-color: rgba(234, 67, 53, 0.25);
  color: #fca5a5;
}

.profile-badge-plan {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.25);
  color: #86efac;
}

.profile-badge-plan.status-trial {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.25);
  color: #fcd34d;
}

.profile-badge-plan.status-expirado,
.profile-badge-plan.status-suspendido {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
}

.profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 1fr);
  gap: 20px;
  align-items: start;
}

.profile-main,
.profile-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.profile-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
}

.profile-card-accent {
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.06) 0%, var(--bg-secondary) 100%);
  border-color: rgba(59, 130, 246, 0.18);
}

.profile-card-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 20px;
}

.profile-card-head-compact {
  margin-bottom: 16px;
}

.profile-card-head h3 {
  margin: 0 0 2px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.profile-card-head p {
  margin: 0;
}

.profile-card-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  font-size: 18px;
  flex-shrink: 0;
}

.profile-form .form-group:last-of-type {
  margin-bottom: 0;
}

.profile-section-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  margin: 8px 0 22px;
}

.profile-section-hint {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
}

.profile-logo-upload {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 16px;
  align-items: center;
  margin-bottom: 20px;
}

.profile-logo-preview-wrap {
  width: 120px;
  height: 120px;
  border: 1px dashed var(--border-light);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--bg-tertiary);
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.profile-logo-dropzone {
  cursor: pointer;
}

.profile-logo-dropzone:hover,
.profile-logo-dropzone:focus-visible {
  outline: none;
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.05);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

.profile-logo-dropzone.is-dragover {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.1);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

.profile-logo-preview {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
}

.profile-logo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  padding: 10px;
  line-height: 1.35;
}

.profile-logo-placeholder-icon {
  font-size: 22px;
  margin-bottom: 2px;
}

.profile-logo-placeholder small {
  font-size: 10px;
  color: var(--text-muted);
  opacity: 0.85;
}

.profile-logo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-form-actions {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.profile-card .form-group input[disabled] {
  opacity: 0.65;
  cursor: not-allowed;
  background: var(--bg-primary);
}

.profile-card .form-group input,
.profile-card .form-group textarea {
  border-radius: 10px;
  padding: 10px 12px;
}

.profile-card .form-group input:focus,
.profile-card .form-group textarea:focus {
  background: rgba(59, 130, 246, 0.04);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 700px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

.auth-link-row {
  margin: -2px 0 6px;
  text-align: right;
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 12px;
  padding: 0;
  text-decoration: underline;
}

.btn-link:hover {
  color: var(--accent-hover, #60a5fa);
}

.auth-panel-intro {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

@media (max-width: 900px) {
  .profile-layout {
    grid-template-columns: 1fr;
  }

  .profile-page {
    padding: 20px 20px 28px;
  }

  .profile-logo-upload {
    grid-template-columns: 1fr;
  }

  .profile-logo-preview-wrap {
    width: 100%;
    max-width: 200px;
    margin: 0 auto;
  }

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

  .admin-page {
    padding: 20px 20px 28px;
  }

  .admin-payment-config {
    grid-template-columns: 1fr;
  }

  .admin-payment-config .payment-qr-preview-wrap {
    width: 100%;
    max-width: 200px;
    margin: 0 auto;
  }
}

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

  .admin-card-head-row {
    align-items: flex-start;
  }

  .admin-filter-select {
    width: 100%;
  }
}

/* User Guide */
#view-guide.active {
  overflow-y: auto;
}

.guide-page {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 28px;
  padding: 0 28px 40px;
  max-width: 1200px;
  align-items: start;
}

.guide-toc {
  position: sticky;
  top: 20px;
  padding: 18px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
}

.guide-toc h3 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.guide-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.guide-toc-list li {
  margin-bottom: 4px;
}

.guide-toc-list a {
  display: block;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  line-height: 1.35;
  transition: background 0.15s, color 0.15s;
}

.guide-toc-list a:hover {
  background: rgba(59, 130, 246, 0.12);
  color: var(--text-primary);
}

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

.guide-section {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  overflow: hidden;
  scroll-margin-top: 20px;
}

.guide-section-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 20px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, transparent 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.guide-section-icon {
  font-size: 28px;
  line-height: 1;
  flex-shrink: 0;
}

.guide-section-head h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.guide-section-body {
  padding: 18px 20px 22px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-secondary);
}

.guide-section-body h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 18px 0 8px;
}

.guide-section-body h4:first-child {
  margin-top: 0;
}

.guide-section-body p {
  margin-bottom: 10px;
}

.guide-section-body ul,
.guide-section-body ol {
  margin: 0 0 12px 1.2em;
}

.guide-section-body li {
  margin-bottom: 6px;
}

.guide-section-body code {
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: #93c5fd;
}

.guide-section-body kbd {
  display: inline-block;
  padding: 2px 6px;
  font-size: 11px;
  font-family: inherit;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
}

.guide-tip {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 10px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.22);
}

.guide-tip-warn {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.28);
}

.guide-tip strong {
  display: block;
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.guide-tip p {
  margin: 0;
  font-size: 13px;
}

@media (max-width: 900px) {
  .guide-page {
    grid-template-columns: 1fr;
    padding: 0 16px 32px;
  }

  .guide-toc {
    position: static;
  }
}

/* Responsive */
@media (max-width: 900px) {
  .sidebar { width: 60px; }
  .sidebar-brand div, .sidebar-brand span, .nav-item span, .project-indicator { display: none; }
  .nav-item { justify-content: center; padding: 12px; }
  .properties-panel, .map-sidebar, .preview-controls { width: 240px; }
  .user-bar {
    flex-direction: column;
    gap: 6px;
    padding: 8px 4px;
  }
  .user-bar-info {
    display: none;
  }
  .btn-logout {
    width: 100%;
    justify-content: center;
    padding: 8px;
  }
  .btn-logout-label {
    display: none;
  }
  .btn-logout-icon {
    width: 18px;
    height: 18px;
  }
  .app-copyright-compact {
    display: none;
  }
}
