/* ==========================================================================
   NEW ELECTRON G. - Area Riservata (Portal Stylesheet)
   Executive Dark Theme with Glassmorphism & High Contrast
   ========================================================================== */

:root {
  --bg-dark: #070a13;
  --bg-surface: #0d1424;
  --bg-card: #121c33;
  --bg-card-hover: #172442;
  --bg-elevated: #1a2745;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-light: #ffffff;

  --accent-red: #e63946;
  --accent-red-hover: #c90025;
  --accent-blue: #2563eb;
  --accent-cyan: #38bdf8;
  --accent-gold: #f59e0b;
  --accent-green: #10b981;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.15);
  --border-focus: rgba(56, 189, 248, 0.5);

  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);

  --font-heading: 'Syne', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  --border-radius-sm: 6px;
  --border-radius-md: 12px;
  --border-radius-lg: 20px;
  --border-radius-full: 9999px;
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.container {
  width: 100%;
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

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

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.6rem 1.25rem;
  border-radius: var(--border-radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-red) 0%, var(--accent-red-hover) 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(230, 57, 70, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #ff4d5e 0%, var(--accent-red) 100%);
  box-shadow: 0 6px 20px rgba(230, 57, 70, 0.55);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
  color: var(--text-light);
  border-color: var(--text-light);
}

.btn-outline {
  background: transparent;
  color: var(--accent-cyan);
  border-color: rgba(56, 189, 248, 0.3);
}

.btn-outline:hover {
  background: rgba(56, 189, 248, 0.12);
  border-color: var(--accent-cyan);
}

.btn-sm {
  padding: 0.45rem 0.95rem;
  font-size: 0.8rem;
}

.btn-xs {
  padding: 0.3rem 0.65rem;
  font-size: 0.75rem;
  border-radius: var(--border-radius-sm);
}

.btn-block {
  width: 100%;
}

.btn-danger-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.3rem;
  font-size: 0.9rem;
  transition: color var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-danger-icon i, .btn-outline i, .btn i {
  pointer-events: none;
}


.btn-danger-icon:hover {
  color: #ff6b77;
}

/* ==========================================================================
   LOGIN PAGE
   ========================================================================== */
.login-body {
  background: radial-gradient(circle at 50% 20%, #15223f 0%, #070a13 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.login-container {
  width: 100%;
  max-width: 440px;
}

.login-card {
  background: rgba(18, 28, 51, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-medium);
  border-radius: var(--border-radius-lg);
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-red), var(--accent-cyan));
}

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

.login-logo-wrap {
  display: inline-flex;
  background: #ffffff;
  padding: 4px 12px;
  border-radius: var(--border-radius-md);
  margin-bottom: 1.25rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.login-logo-img {
  height: 48px;
  width: auto;
  object-fit: contain;
}

.login-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  margin-bottom: 0.35rem;
}

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

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

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

.form-group label {
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  background: rgba(7, 10, 19, 0.7);
  border: 1px solid var(--border-medium);
  border-radius: var(--border-radius-md);
  padding: 0.75rem 1rem;
  color: var(--text-light);
  font-family: var(--font-body);
  font-size: 0.9rem;
  transition: all var(--transition-fast);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
  background: rgba(7, 10, 19, 0.95);
}

.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrapper input {
  padding-right: 2.75rem;
}

.btn-toggle-pwd {
  position: absolute;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.25rem;
}

.btn-toggle-pwd:hover {
  color: var(--text-light);
}

.login-footer {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.back-link {
  color: var(--accent-cyan);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.back-link:hover {
  text-decoration: underline;
}

.sec-badge {
  font-family: var(--font-mono);
  font-size: 0.725rem;
}

/* Alerts */
.alert {
  padding: 0.85rem 1rem;
  border-radius: var(--border-radius-md);
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.alert-error {
  background: rgba(230, 57, 70, 0.15);
  border: 1px solid rgba(230, 57, 70, 0.4);
  color: #ff6b77;
}

.alert-success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
}

/* ==========================================================================
   PORTAL DASHBOARD HEADER
   ========================================================================== */
.portal-header {
  background-color: rgba(7, 10, 19, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-medium);
  position: sticky;
  top: 0;
  z-index: 500;
}

.portal-header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4.5rem;
  padding: 0 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
  gap: 1.5rem;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-logo-box {
  background: #ffffff;
  padding: 3px 8px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.portal-logo-img {
  height: 34px;
  width: auto;
  object-fit: contain;
}

.brand-titles {
  display: flex;
  flex-direction: column;
}

.portal-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-light);
  line-height: 1.1;
}

.portal-sub {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}

.portal-nav {
  display: flex;
  gap: 0.5rem;
}

.nav-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.6rem 1.1rem;
  border-radius: var(--border-radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all var(--transition-fast);
}

.nav-tab-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-light);
}

.nav-tab-btn.active {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.portal-user-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-info-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.user-name {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-light);
}

.user-role-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.1rem 0.5rem;
  border-radius: var(--border-radius-full);
}

.role-admin {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-gold);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.role-guest {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

/* ==========================================================================
   MAIN DASHBOARD TABS
   ========================================================================== */
.portal-main {
  padding: 2.5rem 1.5rem 4rem;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: tabFadeIn 0.3s ease-out;
}

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

/* ==========================================================================
   EXPLORER TOOLBAR & BREADCRUMBS
   ========================================================================== */
.explorer-toolbar {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--border-radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.breadcrumbs-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.crumb {
  color: var(--accent-cyan);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: opacity var(--transition-fast);
}

.crumb:hover {
  text-decoration: underline;
}

.crumb.active {
  color: var(--text-light);
  font-weight: 600;
  cursor: default;
  text-decoration: none;
}

.crumb-sep {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

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

.search-box i {
  position: absolute;
  left: 0.85rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.search-box input {
  background: rgba(7, 10, 19, 0.6);
  border: 1px solid var(--border-medium);
  border-radius: var(--border-radius-md);
  padding: 0.45rem 1rem 0.45rem 2.25rem;
  color: var(--text-light);
  font-size: 0.85rem;
  width: 240px;
  transition: all var(--transition-fast);
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent-cyan);
  width: 280px;
  background: rgba(7, 10, 19, 0.9);
}

.read-only-banner {
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 0.4rem 0.85rem;
  border-radius: var(--border-radius-md);
  font-size: 0.8rem;
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

/* Quick Drag & Dropzone */
.quick-dropzone {
  border: 2px dashed rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.03);
  border-radius: var(--border-radius-lg);
  padding: 2rem 1.5rem;
  text-align: center;
  margin-bottom: 2rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.quick-dropzone:hover,
.quick-dropzone.dragover {
  border-color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.08);
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.15);
}

.dropzone-icon {
  font-size: 2rem;
  color: var(--accent-cyan);
}

.dropzone-text strong {
  color: var(--text-light);
  display: block;
  font-size: 0.95rem;
}

.dropzone-text small {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

/* Sections & Grids */
.explorer-section {
  margin-bottom: 2.5rem;
}

.section-subheading {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  margin-bottom: 1rem;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

.folder-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-md);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.folder-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-medium);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.folder-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  overflow: hidden;
}

.folder-icon {
  font-size: 1.75rem;
  color: var(--accent-gold);
  flex-shrink: 0;
}

.folder-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.folder-name {
  font-weight: 600;
  font-size: 0.925rem;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.folder-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

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

.file-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  transition: all var(--transition-fast);
}

.file-card:hover {
  border-color: rgba(56, 189, 248, 0.4);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.file-header {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.file-icon-box {
  width: 42px;
  height: 42px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: var(--accent-cyan);
  flex-shrink: 0;
}

.file-meta-col {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-grow: 1;
}

.file-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.2rem;
}

.file-details-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

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

.file-actions-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.empty-placeholder {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--border-radius-md);
  border: 1px dashed var(--border-subtle);
}

/* ==========================================================================
   TAB 2: USER MANAGEMENT PANEL
   ========================================================================== */
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
}

.panel-title {
  font-family: var(--font-heading);
  font-size: 1.45rem;
  margin-bottom: 0.25rem;
}

.panel-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.users-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.u-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-md);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.u-stat-icon {
  font-size: 2rem;
  color: var(--text-primary);
}

.u-stat-icon.gold { color: var(--accent-gold); }
.u-stat-icon.cyan { color: var(--accent-cyan); }

.u-stat-num {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 800;
  display: block;
  line-height: 1;
  margin-bottom: 0.3rem;
}

.u-stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Portal Table */
.table-responsive {
  overflow-x: auto;
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--border-medium);
  box-shadow: var(--shadow-sm);
}

.portal-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}

.portal-table th, .portal-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
}

.portal-table th {
  background: rgba(0, 0, 0, 0.4);
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--text-light);
  font-size: 0.825rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.portal-table tbody tr {
  background: var(--bg-card);
  transition: background var(--transition-fast);
}

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

.badge-status {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.725rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--border-radius-sm);
  font-weight: 600;
}

.badge-status.active {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-status.disabled {
  background: rgba(230, 57, 70, 0.15);
  color: #ff6b77;
  border: 1px solid rgba(230, 57, 70, 0.3);
}

/* ==========================================================================
   TAB 3: PROFILE LAYOUT
   ========================================================================== */
.profile-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 2.5rem;
}

.profile-card-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--border-radius-lg);
  padding: 2.5rem 2rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.profile-avatar-box {
  width: 72px;
  height: 72px;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--accent-cyan);
  margin-bottom: 1.25rem;
}

.profile-company {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.profile-meta-list {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  text-align: left;
}

.meta-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
}

.meta-item .label { color: var(--text-muted); }
.meta-item .val { color: var(--text-light); font-weight: 600; font-family: var(--font-mono); }

.profile-form-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--border-radius-lg);
  padding: 2.5rem;
}

.panel-subheading {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.portal-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: 500px;
}

/* ==========================================================================
   MODAL DIALOGS
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 999999 !important;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-overlay.open {
  display: flex !important;
}

.modal-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--border-radius-lg);
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalIn 0.25s ease-out;
}

.modal-dialog-lg { max-width: 720px; }
.modal-dialog-xl { max-width: 960px; height: 85vh; display: flex; flex-direction: column; }

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

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

.modal-header h3 {
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.75rem;
  cursor: pointer;
  line-height: 1;
}

.modal-close-btn:hover {
  color: var(--accent-red);
}

.modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  overflow-y: auto;
}

.modal-preview-body {
  flex-grow: 1;
  padding: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-frame {
  width: 100%;
  height: 100%;
  border: none;
}

.preview-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

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

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.input-with-action {
  display: flex;
  gap: 0.5rem;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.progress-wrap {
  position: relative;
  height: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius-full);
  overflow: hidden;
  margin-top: 0.5rem;
}

.progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-blue));
  transition: width 0.2s ease;
}

.progress-text {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--accent-cyan);
  display: block;
  text-align: right;
  margin-top: 0.25rem;
}

/* ==========================================================================
   TOAST NOTIFICATIONS
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--border-radius-md);
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  animation: toastIn 0.3s ease-out;
  min-width: 280px;
}

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

.toast.success { border-color: var(--accent-green); color: #34d399; }
.toast.error { border-color: var(--accent-red); color: #ff6b77; }
.toast.info { border-color: var(--accent-cyan); color: var(--accent-cyan); }

/* ==========================================================================
   RESPONSIVE QUERIES
   ========================================================================== */
/* ==========================================================================
   TAB: AI PROJECT DASHBOARD & CHAT
   ========================================================================== */
.ai-dashboard-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 2rem;
  align-items: start;
}

.ai-toolbox-col {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--border-radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.ai-profile-header {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.ai-avatar-glow {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.2) 0%, rgba(37, 99, 235, 0.3) 100%);
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--accent-cyan);
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.25);
}

.ai-brand-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  color: var(--text-light);
  line-height: 1.1;
}

.ai-status-badge {
  font-family: var(--font-mono);
  font-size: 0.725rem;
  color: var(--accent-green);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.ai-status-badge i {
  font-size: 0.5rem;
  animation: pulseGreen 2s infinite;
}

@keyframes pulseGreen {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

.ai-bio {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.55;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 1.25rem;
}

.ai-tools-menu {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.ai-tools-heading {
  font-family: var(--font-heading);
  font-size: 0.775rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.25rem;
}

.ai-tool-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-md);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--text-primary);
}

.ai-tool-btn:hover {
  background: var(--bg-card-hover);
  border-color: rgba(56, 189, 248, 0.4);
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

.ai-tool-btn i {
  font-size: 1.15rem;
  margin-top: 0.15rem;
}

.tool-info strong {
  display: block;
  font-size: 0.875rem;
  color: var(--text-light);
  margin-bottom: 0.15rem;
}

.tool-info small {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* AI Console Column */
.ai-console-col {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 600px;
}

.ai-console-header {
  background: rgba(7, 10, 19, 0.6);
  border-bottom: 1px solid var(--border-subtle);
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.console-title-wrap {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Suggestion Pills */
.ai-suggestion-pills {
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.ai-suggestion-pills::-webkit-scrollbar {
  display: none;
}

.suggestion-chip {
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: var(--accent-cyan);
  padding: 0.35rem 0.85rem;
  border-radius: var(--border-radius-full);
  font-size: 0.775rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.suggestion-chip:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: var(--accent-cyan);
  color: #fff;
  transform: translateY(-1px);
}

/* Messages Area */
.ai-messages-container {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  height: 480px;
  overflow-y: auto;
}

.ai-msg {
  display: flex;
  gap: 1rem;
  max-width: 90%;
  animation: msgIn 0.25s ease-out;
}

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

.ai-msg.msg-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.ai-msg.msg-assistant {
  align-self: flex-start;
}

.msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--accent-cyan);
  flex-shrink: 0;
}

.msg-user .msg-avatar {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.3);
  color: var(--accent-gold);
}

.msg-bubble {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  box-shadow: var(--shadow-sm);
}

.msg-user .msg-bubble {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.3);
}

.msg-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  font-size: 0.8rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.35rem;
}

.msg-header strong {
  color: var(--text-light);
}

.msg-time {
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-size: 0.725rem;
}

.msg-content {
  font-size: 0.885rem;
  color: var(--text-primary);
  line-height: 1.65;
}

.msg-content h3 { font-size: 1.1rem; color: var(--text-light); margin-top: 0.75rem; margin-bottom: 0.35rem; }
.msg-content h4 { font-size: 0.95rem; color: var(--accent-cyan); margin-top: 0.5rem; margin-bottom: 0.25rem; }
.msg-content ul { padding-left: 1.25rem; margin: 0.5rem 0; }
.msg-content table { width: 100%; border-collapse: collapse; margin: 0.75rem 0; font-size: 0.825rem; }
.msg-content table th, .msg-content table td { border: 1px solid var(--border-medium); padding: 0.5rem 0.65rem; }
.msg-content table th { background: rgba(0, 0, 0, 0.3); color: var(--text-light); }
.msg-content blockquote { border-left: 3px solid var(--accent-cyan); padding-left: 0.75rem; margin: 0.5rem 0; color: var(--text-secondary); font-style: italic; }

.msg-footer-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-subtle);
}

/* Chat Input Bar */
.ai-input-bar {
  background: rgba(7, 10, 19, 0.7);
  border-top: 1px solid var(--border-subtle);
  padding: 1.25rem 1.5rem;
}

.ai-input-form {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.ai-input-form textarea {
  flex-grow: 1;
  background: rgba(18, 28, 51, 0.9);
  border: 1px solid var(--border-medium);
  border-radius: var(--border-radius-md);
  padding: 0.75rem 1rem;
  color: var(--text-light);
  font-family: var(--font-body);
  font-size: 0.9rem;
  resize: none;
  max-height: 120px;
}

.ai-input-form textarea:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.btn-send-ai {
  padding: 0.75rem 1.4rem;
  flex-shrink: 0;
}

/* ==========================================================================
   SECURITY RISK ASSESSMENT WIZARD MODAL (7 SECTIONS)
   ========================================================================== */
.wizard-modal-dialog {
  max-width: 980px;
  width: 95%;
}

.wizard-header-title {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.wizard-norm-badge {
  font-family: var(--font-mono);
  font-size: 0.725rem;
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 0.15rem 0.6rem;
  border-radius: var(--border-radius-full);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  width: fit-content;
}

/* Step Navigation Bar */
.wizard-steps-bar {
  display: flex;
  background: rgba(7, 10, 19, 0.9);
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
  scrollbar-width: none;
}

.wizard-steps-bar::-webkit-scrollbar {
  display: none;
}

.wizard-step-item {
  flex: 1;
  min-width: 105px;
  padding: 0.85rem 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.775rem;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.wizard-step-item .step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.725rem;
  font-weight: 700;
}

.wizard-step-item.active {
  color: var(--accent-cyan);
  border-bottom-color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.06);
}

.wizard-step-item.active .step-num {
  background: var(--accent-cyan);
  color: var(--bg-darker);
}

.wizard-step-item.completed {
  color: var(--accent-green);
}

.wizard-step-item.completed .step-num {
  background: var(--accent-green);
  color: var(--bg-darker);
}

/* Wizard Panes */
.wizard-modal-body {
  max-height: 65vh;
  overflow-y: auto;
  padding: 1.75rem;
}

.wizard-tab-pane {
  display: none;
}

.wizard-tab-pane.active {
  display: block;
  animation: paneFadeIn 0.25s ease-out;
}

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

.step-pane-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  color: var(--text-light);
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.step-pane-title i {
  color: var(--accent-cyan);
}

/* Risk Vectors in Step 6 */
.risk-vectors-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.risk-vector-row {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-md);
  padding: 0.85rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  transition: all var(--transition-fast);
}

.risk-vector-row:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-medium);
}

.vec-info {
  flex: 1;
  min-width: 250px;
}

.vec-info strong {
  display: block;
  font-size: 0.875rem;
  color: var(--text-light);
  margin-bottom: 0.15rem;
}

.vec-info small {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.vec-controls {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.vec-controls label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

.vec-select {
  background: rgba(18, 28, 51, 0.9);
  border: 1px solid var(--border-medium);
  border-radius: var(--border-radius-sm);
  color: var(--text-light);
  padding: 0.25rem 0.5rem;
  font-size: 0.825rem;
  font-weight: 700;
}

.vec-score {
  font-family: var(--font-mono);
  font-size: 0.775rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  min-width: 75px;
  text-align: center;
}

/* Report Preview Box & Executive Typography */
.report-preview-box {
  background: rgba(7, 10, 19, 0.95);
  border: 1px solid var(--border-medium);
  border-radius: var(--border-radius-md);
  padding: 2.25rem;
  font-size: 0.925rem;
  line-height: 1.75;
  color: var(--text-primary);
  max-height: 540px;
  overflow-y: auto;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
}

.report-preview-box h2 {
  font-size: 1.35rem;
  color: #fff;
  margin-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent-red);
  padding-bottom: 0.6rem;
  letter-spacing: -0.01em;
}

.report-preview-box h3 {
  font-size: 1.15rem;
  color: var(--accent-cyan);
  margin-top: 1.75rem;
  margin-bottom: 0.6rem;
}

.report-preview-box h4 {
  font-size: 1rem;
  color: var(--text-light);
  margin-top: 1.25rem;
  margin-bottom: 0.45rem;
}

.report-preview-box hr {
  border: 0;
  height: 1px;
  background: var(--border-medium);
  margin: 1.5rem 0;
}

.report-preview-box blockquote {
  background: rgba(56, 189, 248, 0.05);
  border-left: 4px solid var(--accent-cyan);
  padding: 0.75rem 1.25rem;
  margin: 1.25rem 0;
  border-radius: 0 var(--border-radius-md) var(--border-radius-md) 0;
  color: var(--text-light);
  font-size: 0.9rem;
}

.report-preview-box table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.85rem;
}

.report-preview-box table th,
.report-preview-box table td {
  border: 1px solid var(--border-medium);
  padding: 0.75rem 0.95rem;
}

.report-preview-box table th {
  background: rgba(18, 28, 51, 0.85);
  color: var(--text-light);
  font-weight: 700;
  text-align: left;
}

.report-preview-box table tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

.report-preview-box table tr:hover {
  background: rgba(56, 189, 248, 0.04);
}

/* ==========================================================================
   INTERACTIVE LIVE DOCUMENT EDITOR
   ========================================================================== */
.report-editor-box {
  background: rgba(7, 10, 19, 0.95);
  border: 1px solid var(--accent-cyan);
  border-radius: var(--border-radius-md);
  overflow: hidden;
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.15);
  display: flex;
  flex-direction: column;
}

.editor-toolbar {
  background: rgba(18, 28, 51, 0.95);
  border-bottom: 1px solid var(--border-medium);
  padding: 0.5rem 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.editor-tools-group {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.editor-tool-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-sm);
  color: var(--text-light);
  padding: 0.3rem 0.6rem;
  font-size: 0.775rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.editor-tool-btn:hover {
  background: var(--accent-cyan);
  color: var(--bg-darker);
  border-color: var(--accent-cyan);
}

.doc-markdown-textarea {
  width: 100%;
  min-height: 480px;
  max-height: 600px;
  background: rgba(5, 8, 16, 0.9);
  border: none;
  padding: 1.5rem;
  color: #e2e8f0;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.7;
  resize: vertical;
  outline: none;
}

.doc-markdown-textarea:focus {
  background: rgba(7, 11, 22, 0.95);
}

/* Print Styles */
@media print {
  body * {
    visibility: hidden;
  }
  .report-preview-box, .report-preview-box * {
    visibility: visible;
  }
  .report-preview-box {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    background: #fff !important;
    color: #111 !important;
    border: none;
    padding: 0;
    max-height: none;
    font-size: 11pt;
  }
  .report-preview-box h2,
  .report-preview-box h3,
  .report-preview-box h4 {
    color: #000 !important;
  }
  .report-preview-box table th {
    background: #f1f5f9 !important;
    color: #000 !important;
  }
  .report-preview-box table td,
  .report-preview-box table th {
    border-color: #cbd5e1 !important;
    color: #000 !important;
  }
}

@media (max-width: 1024px) {
  .profile-layout,
  .ai-dashboard-layout {
    grid-template-columns: 1fr;
  }
  .users-stats-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .portal-header-container {
    height: auto;
    padding: 1rem;
    flex-direction: column;
    align-items: stretch;
  }
  .portal-nav {
    overflow-x: auto;
    padding-bottom: 0.25rem;
  }
  .portal-user-meta {
    justify-content: space-between;
  }
  .explorer-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .toolbar-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .search-box input {
    width: 100%;
  }
  .form-grid-2 {
    grid-template-columns: 1fr;
  }
  .hide-mobile {
    display: none;
  }
}

/* ==========================================================================
   SECURITY CAD & PLANIMETRY STUDIO STYLES
   ========================================================================== */
.modal-cad-fullscreen {
  max-width: 96vw !important;
  width: 96vw !important;
  height: 92vh !important;
  max-height: 92vh !important;
  display: flex !important;
  flex-direction: column !important;
  padding: 0 !important;
  overflow: hidden !important;
  border: 1px solid var(--accent-cyan) !important;
  box-shadow: 0 0 35px rgba(56, 189, 248, 0.25) !important;
}

.cad-modal-header {
  background: rgba(13, 20, 36, 0.98);
  border-bottom: 1px solid var(--border-medium);
  padding: 0.75rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.cad-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.cad-title-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--border-radius-sm);
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
}

.cad-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cad-modal-body {
  display: grid;
  grid-template-columns: 250px 1fr 430px;
  flex: 1;
  overflow: hidden;
  position: relative;
  background: #030712;
}

/* Left: Tools & Device Palette */
.cad-tools-sidebar {
  background: rgba(10, 15, 29, 0.95);
  border-right: 1px solid var(--border-medium);
  padding: 0.85rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.cad-sidebar-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.cad-tool-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.cad-btn-auto-ai {
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.25) 0%, rgba(245, 158, 11, 0.2) 100%);
  border: 1.5px solid rgba(245, 158, 11, 0.6);
  border-radius: var(--border-radius-sm);
  color: #fef08a;
  padding: 0.55rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
  width: 100%;
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.25);
  margin-bottom: 0.35rem;
}

.cad-btn-auto-ai:hover {
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.4) 0%, rgba(245, 158, 11, 0.35) 100%);
  border-color: #fbbf24;
  color: #fff;
  box-shadow: 0 0 22px rgba(245, 158, 11, 0.5);
  transform: translateY(-1px);
}

.cad-btn-tool {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-sm);
  color: var(--text-light);
  padding: 0.45rem 0.65rem;
  font-size: 0.775rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
  width: 100%;
}

.cad-btn-tool:hover {
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.4);
  color: #fff;
}

.cad-btn-tool.active {
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.35) 0%, rgba(239, 68, 68, 0.22) 100%) !important;
  border: 1.5px solid #ef4444 !important;
  color: #fee2e2 !important;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.5), inset 0 0 8px rgba(239, 68, 68, 0.25) !important;
  font-weight: 700 !important;
}

.cad-btn-tool.active i {
  color: #ef4444 !important;
  text-shadow: 0 0 8px rgba(239, 68, 68, 0.8) !important;
}

.cad-device-palette {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

/* CAD Dynamic Palette Accordion Dropdowns */
/* Custom Drone (Quadcopter) Icon - FontAwesome compatible */
.fa-drone, .fa-solid.fa-drone, i.fa-drone {
  display: inline-block;
  width: 1.15em;
  height: 1.15em;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Ccircle cx='100' cy='100' r='58' fill='none' stroke='%23000' stroke-width='28'/%3E%3Ccircle cx='100' cy='100' r='20' fill='%23000'/%3E%3Ccircle cx='412' cy='100' r='58' fill='none' stroke='%23000' stroke-width='28'/%3E%3Ccircle cx='412' cy='100' r='20' fill='%23000'/%3E%3Ccircle cx='100' cy='412' r='58' fill='none' stroke='%23000' stroke-width='28'/%3E%3Ccircle cx='100' cy='412' r='20' fill='%23000'/%3E%3Ccircle cx='412' cy='412' r='58' fill='none' stroke='%23000' stroke-width='28'/%3E%3Ccircle cx='412' cy='412' r='20' fill='%23000'/%3E%3Cline x1='140' y1='140' x2='208' y2='208' stroke='%23000' stroke-width='38' stroke-linecap='round'/%3E%3Cline x1='372' y1='140' x2='304' y2='208' stroke='%23000' stroke-width='38' stroke-linecap='round'/%3E%3Cline x1='140' y1='372' x2='208' y2='304' stroke='%23000' stroke-width='38' stroke-linecap='round'/%3E%3Cline x1='372' y1='372' x2='304' y2='304' stroke='%23000' stroke-width='38' stroke-linecap='round'/%3E%3Crect x='192' y='192' width='128' height='128' rx='34' fill='%23000'/%3E%3Ccircle cx='256' cy='256' r='30' fill='%23fff'/%3E%3Ccircle cx='256' cy='256' r='16' fill='%23000'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Ccircle cx='100' cy='100' r='58' fill='none' stroke='%23000' stroke-width='28'/%3E%3Ccircle cx='100' cy='100' r='20' fill='%23000'/%3E%3Ccircle cx='412' cy='100' r='58' fill='none' stroke='%23000' stroke-width='28'/%3E%3Ccircle cx='412' cy='100' r='20' fill='%23000'/%3E%3Ccircle cx='100' cy='412' r='58' fill='none' stroke='%23000' stroke-width='28'/%3E%3Ccircle cx='100' cy='412' r='20' fill='%23000'/%3E%3Ccircle cx='412' cy='412' r='58' fill='none' stroke='%23000' stroke-width='28'/%3E%3Ccircle cx='412' cy='412' r='20' fill='%23000'/%3E%3Cline x1='140' y1='140' x2='208' y2='208' stroke='%23000' stroke-width='38' stroke-linecap='round'/%3E%3Cline x1='372' y1='140' x2='304' y2='208' stroke='%23000' stroke-width='38' stroke-linecap='round'/%3E%3Cline x1='140' y1='372' x2='208' y2='304' stroke='%23000' stroke-width='38' stroke-linecap='round'/%3E%3Cline x1='372' y1='372' x2='304' y2='304' stroke='%23000' stroke-width='38' stroke-linecap='round'/%3E%3Crect x='192' y='192' width='128' height='128' rx='34' fill='%23000'/%3E%3Ccircle cx='256' cy='256' r='30' fill='%23fff'/%3E%3Ccircle cx='256' cy='256' r='16' fill='%23000'/%3E%3C/svg%3E") no-repeat center / contain;
  vertical-align: -0.15em;
}

/* Custom Lattice Tower / Traliccio Icon */
.fa-traliccio, .fa-tower-traliccio, .fa-solid.fa-tower-observation, i.fa-tower-observation {
  display: inline-block;
  width: 1.15em;
  height: 1.15em;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Cline x1='256' y1='20' x2='256' y2='90' stroke='%23000' stroke-width='28' stroke-linecap='round'/%3E%3Ccircle cx='256' cy='20' r='14' fill='%23000'/%3E%3Cline x1='210' y1='90' x2='302' y2='90' stroke='%23000' stroke-width='28' stroke-linecap='round'/%3E%3Cline x1='220' y1='90' x2='100' y2='490' stroke='%23000' stroke-width='32' stroke-linecap='round'/%3E%3Cline x1='292' y1='90' x2='412' y2='490' stroke='%23000' stroke-width='32' stroke-linecap='round'/%3E%3Cline x1='195' y1='170' x2='317' y2='170' stroke='%23000' stroke-width='24'/%3E%3Cline x1='165' y1='270' x2='347' y2='270' stroke='%23000' stroke-width='24'/%3E%3Cline x1='135' y1='370' x2='377' y2='370' stroke='%23000' stroke-width='24'/%3E%3Cline x1='105' y1='470' x2='407' y2='470' stroke='%23000' stroke-width='28'/%3E%3Cline x1='220' y1='90' x2='317' y2='170' stroke='%23000' stroke-width='20'/%3E%3Cline x1='292' y1='90' x2='195' y2='170' stroke='%23000' stroke-width='20'/%3E%3Cline x1='195' y1='170' x2='347' y2='270' stroke='%23000' stroke-width='20'/%3E%3Cline x1='317' y1='170' x2='165' y2='270' stroke='%23000' stroke-width='20'/%3E%3Cline x1='165' y1='270' x2='377' y2='370' stroke='%23000' stroke-width='20'/%3E%3Cline x1='347' y1='270' x2='135' y2='370' stroke='%23000' stroke-width='20'/%3E%3Cline x1='135' y1='370' x2='407' y2='470' stroke='%23000' stroke-width='20'/%3E%3Cline x1='377' y1='370' x2='105' y2='470' stroke='%23000' stroke-width='20'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Cline x1='256' y1='20' x2='256' y2='90' stroke='%23000' stroke-width='28' stroke-linecap='round'/%3E%3Ccircle cx='256' cy='20' r='14' fill='%23000'/%3E%3Cline x1='210' y1='90' x2='302' y2='90' stroke='%23000' stroke-width='28' stroke-linecap='round'/%3E%3Cline x1='220' y1='90' x2='100' y2='490' stroke='%23000' stroke-width='32' stroke-linecap='round'/%3E%3Cline x1='292' y1='90' x2='412' y2='490' stroke='%23000' stroke-width='32' stroke-linecap='round'/%3E%3Cline x1='195' y1='170' x2='317' y2='170' stroke='%23000' stroke-width='24'/%3E%3Cline x1='165' y1='270' x2='347' y2='270' stroke='%23000' stroke-width='24'/%3E%3Cline x1='135' y1='370' x2='377' y2='370' stroke='%23000' stroke-width='24'/%3E%3Cline x1='105' y1='470' x2='407' y2='470' stroke='%23000' stroke-width='28'/%3E%3Cline x1='220' y1='90' x2='317' y2='170' stroke='%23000' stroke-width='20'/%3E%3Cline x1='292' y1='90' x2='195' y2='170' stroke='%23000' stroke-width='20'/%3E%3Cline x1='195' y1='170' x2='347' y2='270' stroke='%23000' stroke-width='20'/%3E%3Cline x1='317' y1='170' x2='165' y2='270' stroke='%23000' stroke-width='20'/%3E%3Cline x1='165' y1='270' x2='377' y2='370' stroke='%23000' stroke-width='20'/%3E%3Cline x1='347' y1='270' x2='135' y2='370' stroke='%23000' stroke-width='20'/%3E%3Cline x1='135' y1='370' x2='407' y2='470' stroke='%23000' stroke-width='20'/%3E%3Cline x1='377' y1='370' x2='105' y2='470' stroke='%23000' stroke-width='20'/%3E%3C/svg%3E") no-repeat center / contain;
  vertical-align: -0.15em;
}

.cad-category-accordion {
  background: rgba(11, 19, 41, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 0.35rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cad-category-accordion:hover {
  border-color: rgba(56, 189, 248, 0.3);
}

.cad-category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45rem 0.6rem;
  cursor: pointer;
  user-select: none;
  background: rgba(18, 28, 51, 0.85);
  transition: background 0.2s ease, color 0.2s ease;
}

.cad-category-header:hover {
  background: rgba(30, 41, 59, 0.95);
}

.cad-category-header.active {
  background: rgba(2, 132, 199, 0.18);
  border-bottom: 1px solid rgba(56, 189, 248, 0.2);
}

.cad-category-header .cad-accordion-arrow {
  transition: transform 0.25s ease;
}

.cad-category-body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.4rem 0.45rem;
  background: rgba(3, 7, 18, 0.4);
}

.cad-palette-item {
  background: rgba(18, 28, 51, 0.6);
  border: 1px solid var(--border-medium);
  border-radius: var(--border-radius-sm);
  padding: 0.4rem 0.55rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  cursor: grab;
  transition: all var(--transition-fast);
  user-select: none;
}

.cad-palette-item:hover {
  background: rgba(18, 28, 51, 0.95);
  border-color: var(--accent-cyan);
  transform: translateX(2px);
}

.cad-palette-item:active {
  cursor: grabbing;
}

.cad-item-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.cad-item-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cad-item-info strong {
  font-size: 0.775rem;
  color: var(--text-light);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.cad-item-info small {
  font-size: 0.675rem;
  color: var(--text-secondary);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

/* Center: Canvas Viewport */
.cad-canvas-viewport {
  position: relative;
  overflow: hidden;
  background-color: #050811;
  background-image: radial-gradient(rgba(56, 189, 248, 0.12) 1px, transparent 1px);
  background-size: 20px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#cadSatelliteMapLayer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

#securityCadCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  display: block;
  z-index: 2;
  image-rendering: -webkit-optimize-contrast;
}

.cad-empty-placeholder {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  background: rgba(13, 20, 36, 0.92);
  border: 1px dashed var(--accent-cyan);
  border-radius: var(--border-radius-md);
  padding: 2rem;
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  z-index: 10;
}

.cad-floating-controls {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  z-index: 20;
  background: rgba(10, 15, 29, 0.85);
  padding: 0.35rem 0.5rem;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-medium);
  backdrop-filter: blur(6px);
}

.cad-float-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-sm);
  color: var(--text-light);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.cad-float-btn:hover {
  background: var(--accent-cyan);
  color: var(--bg-darker);
}

.cad-scale-pill {
  font-size: 0.725rem;
  color: var(--text-secondary);
  padding-left: 0.4rem;
  font-family: var(--font-mono);
}

/* Device Inspector Tooltip Box */
.cad-device-inspector {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 260px;
  background: rgba(13, 20, 36, 0.95);
  border: 1px solid var(--accent-cyan);
  border-radius: var(--border-radius-sm);
  padding: 0.75rem;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.6);
  z-index: 30;
  backdrop-filter: blur(8px);
}

.inspector-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-medium);
  padding-bottom: 0.35rem;
  margin-bottom: 0.5rem;
}

.inspector-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
}

.inspector-close:hover {
  color: #fff;
}

.inspector-field {
  margin-bottom: 0.5rem;
}

.inspector-field label {
  display: block;
  color: var(--text-secondary);
  margin-bottom: 0.2rem;
}

/* Right: Computo Metrico Sidebar */
.cad-computo-sidebar {
  background: rgba(10, 15, 29, 0.95);
  border-left: 1px solid var(--border-medium);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

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

.computo-items-table-wrapper {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 0.75rem;
  border: 1px solid var(--border-medium);
  border-radius: var(--border-radius-sm);
  background: rgba(5, 8, 16, 0.7);
}

.cad-computo-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.775rem;
}

.cad-computo-table th {
  background: rgba(18, 28, 51, 0.9);
  color: var(--text-light);
  padding: 0.4rem 0.5rem;
  font-size: 0.7rem;
  border-bottom: 1px solid var(--border-medium);
  text-align: left;
}

.cad-computo-table td {
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: middle;
}

.cad-stepper-control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.cad-stepper-btn {
  width: 20px;
  height: 20px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-light);
  font-size: 0.7rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cad-stepper-btn:hover {
  background: var(--accent-cyan);
  color: var(--bg-darker);
}

.cad-qty-input {
  width: 32px;
  text-align: center;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  color: #fff;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 1px 0;
}

.cad-price-input {
  width: 62px;
  text-align: right;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  color: #e2e8f0;
  border-radius: 3px;
  font-size: 0.725rem;
  padding: 1px 3px;
}

.cad-totals-card {
  background: rgba(18, 28, 51, 0.8);
  border: 1px solid var(--border-medium);
  border-radius: var(--border-radius-sm);
  padding: 0.65rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.cad-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.775rem;
}

@media (max-width: 1100px) {
  .cad-modal-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto 350px auto;
  }
}

/* Step-by-Step Help & Guide Accordion Boxes */
.wizard-step-help-box {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--border-radius-sm);
  margin-bottom: 1.25rem;
  overflow: hidden;
  transition: all var(--transition-fast);
}

.step-help-header {
  padding: 0.65rem 1rem;
  background: rgba(56, 189, 248, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  font-size: 0.825rem;
  color: var(--text-light);
}

.step-help-header:hover {
  background: rgba(56, 189, 248, 0.15);
}

.step-help-header .toggle-icon {
  font-size: 0.75rem;
  color: var(--accent-cyan);
  transition: transform 0.2s ease;
}

.wizard-step-help-box.collapsed .toggle-icon {
  transform: rotate(-90deg);
}

.wizard-step-help-box.collapsed .step-help-content {
  display: none;
}

.step-help-content {
  padding: 0.85rem 1rem;
  border-top: 1px solid rgba(56, 189, 248, 0.15);
  line-height: 1.5;
}

/* Web Analytics & Access Tracker Styles */
.analytics-period-btn {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}

@media (max-width: 992px) {
  .analytics-charts-grid {
    grid-template-columns: 1fr !important;
  }
}



/* SATELLITE SITE PICKER MODAL STYLES */
#modalSatelliteSitePicker {
  position: fixed !important;
  inset: 0 !important;
  background: rgba(3, 7, 18, 0.85) !important;
  backdrop-filter: blur(8px) !important;
  display: none;
  align-items: center !important;
  justify-content: center !important;
  z-index: 99999 !important;
  padding: 1.5rem !important;
}

#modalSatelliteSitePicker.active,
#modalSatelliteSitePicker[style*="display: flex"] {
  display: flex !important;
}

.satellite-modal-body {
  display: grid !important;
  grid-template-columns: 340px 1fr !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: calc(92vh - 65px) !important;
  max-height: calc(92vh - 65px) !important;
  overflow: hidden !important;
  position: relative !important;
  background: #020617 !important;
}

#satelliteMapContainer {
  width: 100% !important;
  height: 100% !important;
  min-height: 100% !important;
  max-height: 100% !important;
  background: #0f172a !important;
  position: relative !important;
  z-index: 1 !important;
}

.satellite-sidebar {
  background: rgba(13, 20, 36, 0.98) !important;
  border-right: 1px solid var(--border-medium) !important;
  padding: 1.25rem !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 1.25rem !important;
  overflow-y: auto !important;
  height: 100% !important;
}
/* CAD Computo Category Headers & Subtotals */
.cad-computo-cat-header td {
  background: rgba(2, 132, 199, 0.15);
  border-top: 1px solid rgba(56, 189, 248, 0.3);
  border-bottom: 1px solid rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  font-weight: 700;
  font-size: 0.725rem;
  padding: 0.35rem 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cad-computo-cat-subtotal td {
  background: rgba(15, 23, 42, 0.75);
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
}
