/* --- CSS Design System --- */

:root {
  --bg-app: #070913;
  --bg-panel: rgba(13, 17, 33, 0.75);
  --bg-panel-hover: rgba(21, 27, 49, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-active: rgba(139, 92, 246, 0.4);
  
  --primary-color: #8b5cf6;
  --primary-glow: rgba(139, 92, 246, 0.25);
  --secondary-color: #3b82f6;
  --secondary-glow: rgba(59, 130, 246, 0.25);
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dimmed: #6b7280;
  
  --accent-green: #10b981;
  --accent-green-glow: rgba(16, 185, 129, 0.15);
  --accent-red: #ef4444;
  
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --glass-blur: blur(20px);
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.hidden {
  display: none !important;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-main);
  overflow-x: hidden;
  min-height: 100vh;
  position: relative;
  line-height: 1.5;
}

/* --- Ambient Glowing Effects --- */

.ambient-glow {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(120px);
  opacity: 0.12;
  z-index: 0;
}

.glow-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--primary-color) 0%, transparent 80%);
  top: -10%;
  right: -5%;
}

.glow-2 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--secondary-color) 0%, transparent 80%);
  bottom: 10%;
  left: -10%;
}

.glow-3 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #ec4899 0%, transparent 80%);
  top: 40%;
  right: 25%;
}

/* --- Layout Container --- */

.app-layout {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100vh;
  display: flex;
  overflow: hidden;
}

/* --- Sidebar --- */

.app-sidebar {
  width: 280px;
  background: rgba(13, 17, 33, 0.75);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 2rem 1.5rem;
  z-index: 10;
  box-shadow: 4px 0 24px rgba(0,0,0,0.2);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 3rem;
}

.logo-text {
  font-weight: 700;
  font-size: 1.1rem;
  line-height: 1.2;
  letter-spacing: 0.5px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-grow: 1;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  transition: var(--transition-smooth);
  width: 100%;
  text-align: left;
}

.sidebar-nav-item .nav-icon {
  width: 20px;
  height: 20px;
}

.sidebar-nav-item:hover, .sidebar-nav-item.active {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.sidebar-nav-item.active {
  border-left: 3px solid var(--primary-color);
  border-radius: 4px 8px 8px 4px;
}

.sidebar-premium {
  margin-top: auto;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(59, 130, 246, 0.15));
  border: 1px solid rgba(139, 92, 246, 0.3);
  padding: 1rem;
  border-radius: 12px;
}

.premium-label {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--primary-color);
  letter-spacing: 1px;
}

.sidebar-premium p {
  font-size: 0.85rem;
  margin-top: 0.5rem;
  color: var(--text-muted);
}

/* --- Main Layout --- */

.app-main {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* --- Header --- */

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2.5rem;
  border-bottom: 1px solid var(--border-color);
  background: rgba(7, 9, 19, 0.8);
  backdrop-filter: blur(24px);
  z-index: 5;
}

.header-titles h1 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.header-titles p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  gap: 1rem;
}

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

.header-actions button svg {
  width: 18px;
  height: 18px;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.6rem 1.25rem;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* --- Workspace Layout --- */
.workspace-content {
  flex-grow: 1;
  overflow-y: auto;
  padding: 2.5rem;
}

.app-view {
  width: 100%;
  max-width: 1300px;
  margin: 0 auto;
}

/* -- Search Hero Panel -- */
.search-hero-panel {
  text-align: center;
  padding: 2rem 0 4rem;
}

.search-hero-panel .eyebrow {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--primary-color);
  text-transform: uppercase;
}

.search-hero-panel h2 {
  font-size: 2.5rem;
  font-weight: 800;
  margin: 0.5rem 0 2rem;
}

.hero-search-form {
  display: flex;
  max-width: 700px;
  margin: 0 auto;
  gap: 1rem;
  align-items: center;
}

.hero-search-form .input-wrapper {
  flex: 1 1 auto;
  width: 100%;
  position: relative;
  display: flex;
  align-items: center;
}

.hero-search-form .search-icon {
  position: absolute;
  left: 1.2rem;
  width: 20px;
  height: 20px;
  color: var(--primary-color);
  z-index: 2;
}

.hero-search-form input {
  width: 100%;
  padding: 1.25rem 1.25rem 1.25rem 3.5rem;
  font-size: 1.15rem;
  font-weight: 500;
  background: rgba(139, 92, 246, 0.08);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 12px;
  color: #fff;
  transition: var(--transition-smooth);
}

.hero-search-form input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.hero-search-form input:focus {
  background: rgba(139, 92, 246, 0.12);
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px var(--primary-glow);
  outline: none;
}

.hero-search-form button {
  flex: 0 0 auto !important;
  width: auto !important;
  min-width: 160px;
  height: 100%;
  padding: 1.25rem 2rem;
  font-size: 1.1rem;
  font-weight: 600;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.4);
  color: #fff;
  transition: var(--transition-smooth);
  cursor: pointer;
}

.hero-search-form button:hover {
  background: rgba(139, 92, 246, 0.25);
  border-color: var(--primary-color);
}

.hero-search-form button svg {
  width: 20px; height: 20px;
}

/* -- Dashboard Stats Row -- */
.dashboard-stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr 2fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
}

.stat-icon-wrap {
  width: 48px;
  height: 48px;
  background: rgba(139, 92, 246, 0.1);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-color);
}
.stat-icon-wrap svg {
  width: 24px; height: 24px;
}

.action-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.action-card button {
  flex: 1;
  padding: 0.8rem;
  border-radius: 8px;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition-smooth);
}
.action-card button svg {
  width: 16px; height: 16px;
}

.btn-outline-action {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}
.btn-outline-action:hover {
  background: rgba(255, 255, 255, 0.05);
}

.btn-danger-action {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--accent-red);
}
.btn-danger-action:hover {
  background: rgba(239, 68, 68, 0.2);
}

/* -- Dashboard Properties Table -- */
.dashboard-properties-panel {
  padding: 2rem;
  background: rgba(255,255,255,0.02);
  margin-top: 2rem;
}

.panel-header-search {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.table-search {
  position: relative;
  width: 300px;
}
.table-search svg {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--text-muted);
}
.table-search input[type="text"] {
  padding: 0.6rem 1rem 0.6rem 2.5rem;
  width: 100%;
}

.dashboard-style-table {
  width: 100%;
  border-collapse: collapse;
}

.dashboard-style-table th {
  background: rgba(0,0,0,0.2);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.dashboard-style-table th svg {
  width: 14px; height: 14px;
  vertical-align: middle;
  margin-left: 4px;
  opacity: 0.5;
}

.dashboard-style-table td {
  padding: 1rem;
  font-size: 0.9rem;
  color: var(--text-main);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  white-space: nowrap;
}

.dashboard-style-table tr:last-child td {
  border-bottom: none;
}

.dashboard-style-table tr:hover td {
  background: rgba(255,255,255,0.03);
  cursor: pointer;
}

.dashboard-style-table tr.active td {
  background: rgba(139, 92, 246, 0.1);
}

.properties-source {
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  background: rgba(255,255,255,0.1);
}
.properties-source.excel {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
}
.properties-source.scraped {
  background: rgba(59, 130, 246, 0.2);
  color: #3b82f6;
}

/* --- UI Panels (Glassmorphism Cards) --- */

.panel {
  background: var(--bg-panel);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 1.5rem;
  transition: var(--transition-smooth);
}

.panel:hover {
  border-color: rgba(167, 139, 250, 0.25);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.panel-header h2, .panel-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.2px;
}

/* --- Input Area --- */

.input-panel {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.excel-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  scroll-margin-top: 1rem;
}

.mode-toggles {
  display: flex;
  background: rgba(0, 0, 0, 0.2);
  padding: 0.25rem;
  border-radius: 10px;
  border: 1px solid var(--border-color);
}

.mode-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--transition-smooth);
}

.mode-btn.active {
  background: var(--primary-color);
  color: white;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.input-group {
  margin-bottom: 1rem;
}

.input-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.input-wrapper {
  display: flex;
  gap: 0.75rem;
}

.input-wrapper input {
  flex-grow: 1;
}

input[type="url"], input[type="text"], textarea {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.8rem 1rem;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition-smooth);
  width: 100%;
}

input[type="url"]:focus, input[type="text"]:focus, textarea:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

input[type="file"] {
  width: 100%;
  background: rgba(0, 0, 0, 0.2);
  border: 1px dashed rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  padding: 0.8rem 1rem;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.92rem;
}

input[type="file"]::file-selector-button {
  border: 0;
  background: rgba(139, 92, 246, 0.18);
  color: var(--text-main);
  border-radius: 10px;
  padding: 0.55rem 0.85rem;
  margin-right: 0.9rem;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: var(--transition-smooth);
}

input[type="file"]::file-selector-button:hover {
  background: rgba(139, 92, 246, 0.28);
}

.highlight-focus {
  border-color: rgba(139, 92, 246, 0.75) !important;
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15) !important;
}

.input-help {
  font-size: 0.8rem;
  color: var(--text-dimmed);
  margin-top: 0.4rem;
}

.dashboard-info-card {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 1rem;
  border-radius: 16px;
  border: 1px solid rgba(139, 92, 246, 0.22);
  background: linear-gradient(180deg, rgba(139, 92, 246, 0.08), rgba(59, 130, 246, 0.04));
}

.dashboard-info-title {
  font-size: 0.8rem;
  font-weight: 800;
  color: #c4b5fd;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.dashboard-info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.dashboard-info-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.9rem;
  border-radius: 14px;
  background: rgba(8, 11, 24, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.dashboard-info-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dimmed);
}

.dashboard-info-item strong {
  font-size: 0.92rem;
  color: var(--text-main);
}

.dashboard-info-item p {
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text-muted);
}

@media (max-width: 1100px) {
  .dashboard-info-grid {
    grid-template-columns: 1fr;
  }
}

.excel-format-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1rem;
}

.excel-format-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
}

.excel-format-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.excel-format-chips span {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(139, 92, 246, 0.25);
  background: rgba(139, 92, 246, 0.12);
  color: #ddd6fe;
  font-size: 0.78rem;
  font-weight: 600;
}

.excel-table-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.excel-table-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.excel-table-head h3 {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.table-scroll {
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--border-color);
  border-radius: 14px;
}

.table-scroll::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}

.table-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

.excel-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.excel-table thead th {
  position: sticky;
  top: 0;
  background: rgba(13, 17, 33, 0.96);
  backdrop-filter: var(--glass-blur);
  z-index: 1;
  text-align: left;
  padding: 0.7rem 0.8rem;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--border-color);
}

.excel-table tbody td {
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  white-space: nowrap;
}

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

.empty-state-cell {
  text-align: center;
  color: var(--text-dimmed);
  padding: 1.25rem 1rem !important;
}

.upload-status {
  font-size: 0.8rem;
  color: var(--text-dimmed);
}

.upload-status.success {
  color: #34d399;
}

.upload-status.error {
  color: #fca5a5;
}

.excel-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0.9rem 0 0.4rem;
  flex-wrap: wrap;
}

/* --- Buttons --- */

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 0.9rem 1.5rem;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--primary-glow), 0 0 15px rgba(96, 165, 250, 0.4);
}

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

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.8rem 1.2rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-smooth);
}

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

.btn-text-only {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-text-only:hover {
  color: var(--accent-red);
}

.hidden {
  display: none !important;
}

/* --- Results Workspace Layout --- */

.results-grid {
  display: flex;
  justify-content: flex-start;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 900px) {
  .results-grid {
    flex-direction: column;
  }
}

.side-menu {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: min(100%, 360px);
  flex-shrink: 0;
}

/* --- Sidebar History --- */

.history-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 800px;
}

.badge {
  background: rgba(255, 255, 255, 0.08);
  padding: 0.15rem 0.5rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.history-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.history-controls input {
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
}

.history-table-wrap {
  max-height: 600px;
  overflow: auto;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.08);
}

.history-table-wrap::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.history-table-wrap::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.82rem;
}

.history-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(13, 17, 33, 0.96);
  backdrop-filter: var(--glass-blur);
  color: var(--text-muted);
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.8rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.history-table th:first-child,
.history-table td:first-child {
  width: 72px;
}

.history-table th:nth-child(3),
.history-table td:nth-child(3) {
  width: 110px;
}

.history-table th:nth-child(5),
.history-table td:nth-child(5) {
  width: 140px;
}

.history-row {
  cursor: pointer;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.history-row:hover {
  background: var(--bg-panel-hover);
}

.history-row.active {
  background: rgba(139, 92, 246, 0.08);
  box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.45);
}

.history-row td {
  padding: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  vertical-align: middle;
}

.history-thumb-cell {
  padding-right: 0.25rem;
}

.history-thumb {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  object-fit: cover;
  background: rgba(0, 0, 0, 0.3);
  display: block;
}

.history-thumb-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.history-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.2rem;
}

.history-subtext {
  color: var(--text-dimmed);
  font-size: 0.74rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-price {
  font-weight: 700;
  color: var(--primary-color);
  white-space: nowrap;
}

.history-location,
.history-reference {
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.empty-state-small {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-dimmed);
  font-size: 0.85rem;
  border: 1px dashed var(--border-color);
  border-radius: 12px;
}

/* --- All Properties View --- */

.properties-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.properties-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}

.properties-table-wrap {
  max-height: 680px;
  overflow: auto;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.08);
}

.properties-table-wrap::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.properties-table-wrap::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

.properties-table {
  width: 100%;
  min-width: 1200px;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.properties-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(13, 17, 33, 0.96);
  backdrop-filter: var(--glass-blur);
  color: var(--text-muted);
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.8rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}



.properties-row {
  cursor: pointer;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.properties-row:hover {
  background: var(--bg-panel-hover);
}

.properties-row.active {
  background: rgba(139, 92, 246, 0.08);
  box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.45);
}

.properties-row td {
  padding: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  vertical-align: middle;
  white-space: nowrap;
}

.properties-source {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.properties-source.scraped {
  color: #ddd6fe;
  background: rgba(139, 92, 246, 0.14);
  border-color: rgba(139, 92, 246, 0.28);
}

.properties-source.excel {
  color: #bfdbfe;
  background: rgba(59, 130, 246, 0.14);
  border-color: rgba(59, 130, 246, 0.28);
}

.properties-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.2rem;
}

.properties-subtext {
  color: var(--text-dimmed);
  font-size: 0.74rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.properties-location,
.properties-details,
.properties-added-at {
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Viewer Area --- */

.viewer-panel {
  min-height: 500px;
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  align-self: start;
}

/* Placeholders & Loaders */

.viewer-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 2rem;
  margin: auto;
  max-width: 500px;
}

.placeholder-art {
  width: 160px;
  height: 160px;
  margin-bottom: 1.5rem;
}

.scanner-line {
  animation: scan 3s ease-in-out infinite;
}

@keyframes scan {
  0%, 100% { transform: translateY(-50px); }
  50% { transform: translateY(50px); }
}

.viewer-placeholder h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.viewer-placeholder p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.viewer-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  margin: auto;
  padding: 4rem 2rem;
}

.loader-ripple {
  display: inline-block;
  position: relative;
  width: 80px;
  height: 80px;
  margin-bottom: 1.5rem;
}

.loader-ripple div {
  position: absolute;
  border: 4px solid var(--primary-color);
  opacity: 1;
  border-radius: 50%;
  animation: loader-ripple 1s cubic-bezier(0, 0.2, 0.8, 1) infinite;
}

.loader-ripple div:nth-child(2) {
  animation-delay: -0.5s;
  border-color: var(--secondary-color);
}

@keyframes loader-ripple {
  0% {
    top: 36px;
    left: 36px;
    width: 0;
    height: 0;
    opacity: 0;
  }
  4.9% {
    top: 36px;
    left: 36px;
    width: 0;
    height: 0;
    opacity: 0;
  }
  5% {
    top: 36px;
    left: 36px;
    width: 0;
    height: 0;
    opacity: 1;
  }
  100% {
    top: 0px;
    left: 0px;
    width: 72px;
    height: 72px;
    opacity: 0;
  }
}

.viewer-loading h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.viewer-loading p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* --- Viewer Content Layout --- */

.viewer-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  animation: fadeIn 0.4s ease-out;
}

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

/* Property Header */
.property-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1.25rem;
}

@media (max-width: 600px) {
  .property-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
}

.header-details {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.category-tag {
  align-self: flex-start;
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  border: 1px solid rgba(139, 92, 246, 0.2);
}

.header-details h2 {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #fff 0%, #d1d5db 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
}

.location-container {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.icon-location {
  width: 16px;
  height: 16px;
  color: var(--secondary-color);
}

.header-pricing {
  text-align: right;
  display: flex;
  flex-direction: column;
}

@media (max-width: 600px) {
  .header-pricing {
    text-align: left;
  }
}

.price-label {
  font-size: 0.75rem;
  color: var(--text-dimmed);
  text-transform: uppercase;
  font-weight: 600;
}

.price-val {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--primary-color);
}

/* Permit Banner */
.permit-banner {
  background: var(--accent-green-glow);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.05);
}

@media (max-width: 768px) {
  .permit-banner {
    flex-direction: column;
    align-items: stretch;
  }
}

.permit-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.permit-shield {
  width: 38px;
  height: 38px;
  background: rgba(16, 185, 129, 0.15);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-green);
  flex-shrink: 0;
}

.permit-shield svg {
  width: 20px;
  height: 20px;
}

.permit-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-green);
}

.permit-val {
  font-size: 0.95rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.2rem;
}

#prop-permit-no {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-family: monospace;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  border: 1px solid rgba(16, 185, 129, 0.4);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.25);
  display: inline-block;
}

.btn-verify {
  background: var(--accent-green);
  color: #05070f;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: var(--transition-smooth);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.btn-verify:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 15px rgba(16, 185, 129, 0.3);
  background: #0ea5e9; /* hover shift color */
  background: #34d399;
}

.btn-verify svg {
  width: 14px;
  height: 14px;
}

/* Excel match card */
.excel-match-panel {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.22);
  border-radius: 16px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.excel-match-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.excel-match-title {
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #93c5fd;
}

.excel-match-status {
  margin-top: 0.25rem;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.excel-match-table-wrap {
  overflow: auto;
  border: 1px solid rgba(59, 130, 246, 0.18);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.16);
}

.excel-match-table {
  width: 100%;
  border-collapse: collapse;
}

.excel-match-table th,
.excel-match-table td {
  padding: 0.7rem 0.85rem;
  text-align: left;
  font-size: 0.84rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.excel-match-table th {
  width: 170px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.02);
  font-weight: 700;
}

.excel-match-table tr:last-child th,
.excel-match-table tr:last-child td {
  border-bottom: none;
}

/* Gallery Slider */
.gallery-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.main-slide-container {
  position: relative;
  height: 320px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.main-slide-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease-in-out;
}

.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  font-size: 1.1rem;
  transition: var(--transition-smooth);
  z-index: 2;
}

.gallery-nav:hover {
  background: var(--primary-color);
  border-color: var(--primary-color);
  box-shadow: 0 0 10px var(--primary-glow);
}

.gallery-nav.prev { left: 1rem; }
.gallery-nav.next { right: 1rem; }

.gallery-actions {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 2;
  display: flex;
  gap: 0.5rem;
}

.btn-action-icon {
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-action-icon:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

.btn-action-icon svg {
  width: 16px;
  height: 16px;
}

.gallery-info-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.btn-text-link {
  color: var(--secondary-color);
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition-smooth);
}

.btn-text-link:hover {
  color: #60a5fa;
  text-decoration: underline;
}

.gallery-thumbnails {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  scroll-behavior: smooth;
}

.gallery-thumbnails::-webkit-scrollbar {
  height: 4px;
}

.gallery-thumbnails::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

.thumb-item {
  width: 70px;
  height: 50px;
  border-radius: 6px;
  object-fit: cover;
  opacity: 0.5;
  cursor: pointer;
  border: 2px solid transparent;
  flex-shrink: 0;
  transition: var(--transition-smooth);
}

.thumb-item:hover, .thumb-item.active {
  opacity: 1;
}

.thumb-item.active {
  border-color: var(--primary-color);
}

/* Specs Grid */
.specs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 1rem;
}

.spec-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.spec-icon {
  font-size: 1.5rem;
}

.spec-details {
  display: flex;
  flex-direction: column;
}

.spec-label {
  font-size: 0.75rem;
  color: var(--text-dimmed);
  font-weight: 500;
}

.spec-val {
  font-size: 0.95rem;
  font-weight: 700;
}

/* Tabs Panel */
.tabs-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.tab-headers {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  gap: 1.5rem;
  overflow-x: auto;
}

.tab-headers::-webkit-scrollbar {
  display: none;
}

.tab-header-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.6rem 0.1rem;
  cursor: pointer;
  position: relative;
  transition: var(--transition-smooth);
  white-space: nowrap;
}

.tab-header-btn:hover {
  color: var(--text-main);
}

.tab-header-btn.active {
  color: var(--primary-color);
}

.tab-header-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--primary-color);
  box-shadow: 0 -2px 10px var(--primary-glow);
}

.tab-content {
  display: none;
  min-height: 150px;
  animation: fadeInTab 0.3s ease-out;
}

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

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

/* Info Tab Details */
.info-details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.8rem;
  background: rgba(0, 0, 0, 0.1);
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  margin-bottom: 1rem;
}

.info-row {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.info-label {
  font-size: 0.75rem;
  color: var(--text-dimmed);
}

.info-val {
  font-size: 0.9rem;
  font-weight: 600;
}

.description-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.description-section h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-muted);
}

.description-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  white-space: pre-line;
  line-height: 1.6;
}

/* Amenities Tab */
.amenities-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.amenity-pill {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  transition: var(--transition-smooth);
}

.amenity-pill:hover {
  background: rgba(139, 92, 246, 0.05);
  border-color: var(--border-color-active);
  color: #a78bfa;
}

/* Agent/Broker Tab */
.agent-broker-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .agent-broker-container {
    grid-template-columns: 1fr;
  }
}

.agent-card, .broker-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.25rem;
}

.card-header-agent, .card-header-broker {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
}

.agent-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-color);
  background: rgba(0, 0, 0, 0.2);
}

.broker-logo {
  max-width: 100px;
  max-height: 60px;
  object-fit: contain;
}

.card-header-agent h4, .card-header-broker h4 {
  font-size: 0.95rem;
  font-weight: 700;
}

.card-sub {
  font-size: 0.75rem;
  color: var(--text-dimmed);
}

.license-info {
  font-size: 0.75rem;
  color: var(--secondary-color);
  font-weight: 600;
  margin-top: 0.15rem;
}

.contact-details {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border-top: 1px solid var(--border-color);
  padding-top: 0.75rem;
}

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

.contact-label {
  color: var(--text-dimmed);
}

.contact-val {
  color: var(--text-main);
  text-decoration: none;
  font-weight: 600;
}

.contact-val[href^="tel"], .contact-val[href^="mailto"] {
  color: var(--secondary-color);
  transition: var(--transition-smooth);
}

.contact-val[href^="tel"]:hover, .contact-val[href^="mailto"]:hover {
  color: #60a5fa;
  text-decoration: underline;
}

/* Raw Tab */
.raw-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.5rem;
}

.raw-json-viewer {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1rem;
  max-height: 400px;
  overflow-y: auto;
  font-family: monospace;
  font-size: 0.8rem;
  color: #34d399;
}

/* Export Panel */
.export-footer {
  display: flex;
  gap: 1rem;
  border-top: 1px solid var(--border-color);
  padding-top: 1.25rem;
}

.btn-export {
  flex: 1;
  border: none;
  border-radius: 10px;
  padding: 0.8rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: var(--transition-smooth);
}

.btn-export.csv {
  background: rgba(59, 130, 246, 0.1);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.btn-export.csv:hover {
  background: rgba(59, 130, 246, 0.2);
}

.btn-export.json {
  background: rgba(139, 92, 246, 0.1);
  color: #a78bfa;
  border: 1px solid rgba(139, 92, 246, 0.2);
}

.btn-export.json:hover {
  background: rgba(139, 92, 246, 0.2);
}

.icon-download {
  width: 16px;
  height: 16px;
}

/* --- Spinner --- */

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

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

/* --- Lightbox Modal --- */

.lightbox-modal {
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(5, 7, 15, 0.95);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.25s ease-out;
}

.lightbox-content {
  max-width: 90%;
  max-height: 80%;
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-color);
}

.lightbox-content img {
  max-width: 100%;
  max-height: 80vh;
  display: block;
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: 2rem;
  right: 2rem;
  color: var(--text-muted);
  font-size: 2.5rem;
  font-weight: 300;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.lightbox-close:hover {
  color: white;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 2rem;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  user-select: none;
  padding: 1rem;
  transition: var(--transition-smooth);
}

.lightbox-nav:hover {
  color: white;
  transform: translateY(-50%) scale(1.1);
}

.lightbox-prev { left: 2rem; }
.lightbox-next { right: 2rem; }

.lightbox-caption {
  position: absolute;
  bottom: 2rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* --- Viewer Modal Override --- */
.modal-backdrop { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.75); backdrop-filter: blur(4px); z-index: 999; display: none; }
.modal-backdrop.show { display: block; }
.modal-style-viewer { position: fixed !important; top: 50% !important; left: 50% !important; transform: translate(-50%, -50%) !important; width: 90% !important; max-width: 900px !important; max-height: 85vh !important; overflow-y: auto !important; z-index: 1000 !important; box-shadow: 0 10px 50px rgba(0,0,0,0.8) !important; background: var(--surface-light) !important; margin: 0 !important; }
.btn-close-viewer { position: absolute; top: 1rem; right: 1rem; background: rgba(0,0,0,0.3); border: none; color: #fff; width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 20; transition: var(--transition-smooth); }
.btn-close-viewer:hover { background: var(--primary-color); transform: scale(1.1); }


/* --- Pop-up Card New Layout --- */
.viewer-top-bar { margin-bottom: 1rem; }
.permit-simple { display: inline-block; background: rgba(59, 130, 246, 0.2); color: #60a5fa; padding: 0.5rem 1rem; border-radius: 20px; font-size: 0.9rem; border: 1px solid rgba(59, 130, 246, 0.4); }
.viewer-two-columns { display: grid; grid-template-columns: 40% 1fr; gap: 1.5rem; margin-bottom: 1.5rem; }
@media (max-width: 768px) { .viewer-two-columns { grid-template-columns: 1fr; } }
.viewer-col { display: flex; flex-direction: column; gap: 1rem; }
.viewer-col .excel-match-panel { margin: 0; height: 100%; }



/* --- Custom Dialog Modal --- */
.custom-dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.custom-dialog-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.custom-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  transform: translateY(0) scale(1);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  overflow: hidden;
}

.custom-dialog-overlay.hidden .custom-dialog {
  transform: translateY(20px) scale(0.95);
}

.custom-dialog-header {
  padding: 1.5rem 1.5rem 0.5rem;
}

.custom-dialog-header h3 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--text-color);
}

.custom-dialog-body {
  padding: 1rem 1.5rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.custom-dialog-footer {
  padding: 1rem 1.5rem;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
}

.custom-dialog-footer button {
  min-width: 80px;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}
