/* 
  Softy Platforma — Stylesheet
  Enterprise Dashboard UI for Historical Public Procurement & CRM
*/

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --secondary: #475569;
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --border-color: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --success: #10b981;
  --success-bg: #ecfdf5;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --info: #0284c7;
  --info-bg: #f0f9ff;
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --radius: 8px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Top Navbar
   ========================================================================== */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 40;
}

.nav-left, .nav-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

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

.logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.3);
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-text .brand {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

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

.system-status {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--success-bg);
  border: 1px solid rgba(16, 185, 129, 0.2);
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  color: #065f46;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--success);
}

/* ==========================================================================
   Universal Search Header
   ========================================================================== */
.search-header {
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  padding: 1.25rem 1.5rem;
}

.search-box-container {
  max-width: 1000px;
  margin: 0 auto;
}

.search-input-group {
  display: flex;
  align-items: center;
  background: #f1f5f9;
  border: 2px solid transparent;
  border-radius: 10px;
  padding: 0.25rem 0.5rem;
  transition: all 0.2s ease;
}

.search-input-group:focus-within {
  background: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.search-icon {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  padding: 0 0.5rem;
}

.search-input-group input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text-main);
  padding: 0.5rem 0.25rem;
}

.btn-clear-search {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.3rem 0.5rem;
  font-size: 1rem;
}

.btn-search {
  border-radius: 6px;
  padding: 0.6rem 1.2rem;
  font-weight: 600;
}

.search-hints {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.hint-tag {
  background: #f1f5f9;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-main);
  border: 1px solid var(--border-color);
  transition: all 0.15s ease;
}

.hint-tag:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: #bfdbfe;
}

.syntax-info {
  margin-left: auto;
  cursor: help;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Layout: Sidebar + Main Content
   ========================================================================== */
.app-body {
  display: flex;
  padding: 1.25rem 1.5rem;
  gap: 1.5rem;
  align-items: flex-start;
}

.sidebar-filters {
  width: 320px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 75px;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
}

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

.sidebar-header h3 {
  font-size: 1rem;
  font-weight: 700;
}

.filter-group {
  margin-bottom: 1.25rem;
}

.filter-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.4rem;
}

.filter-sublabel {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 0.5rem;
  margin-bottom: 0.3rem;
}

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

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-main);
  cursor: pointer;
}

.checkbox-item input[type="checkbox"] {
  accent-color: var(--primary);
  width: 15px;
  height: 15px;
}

.quick-period-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.5rem;
}

.pill-btn {
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.pill-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.pill-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  font-weight: 600;
}

.date-range-inputs {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.input-date-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.input-date-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  width: 42px;
}

.price-range-inputs {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.range-divider {
  color: var(--text-muted);
}

.form-select, .form-input, .form-textarea {
  width: 100%;
  padding: 0.5rem 0.65rem;
  font-size: 0.85rem;
  font-family: inherit;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background-color: #fff;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.15s ease;
}

.form-select:focus, .form-input:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ==========================================================================
   Main Content Area
   ========================================================================== */
.main-content {
  flex: 1;
  min-width: 0;
}

/* Active filter pills */
.active-filters-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 0.6rem 0.8rem;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 6px;
}

.active-filters-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.active-filter-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.active-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid #bfdbfe;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.active-tag-remove {
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
  color: var(--primary);
}

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  box-shadow: var(--shadow-sm);
}

.kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kpi-icon.blue { background: #eff6ff; color: #2563eb; }
.kpi-icon.green { background: #ecfdf5; color: #10b981; }
.kpi-icon.purple { background: #f5f3ff; color: #8b5cf6; }
.kpi-icon.orange { background: #fff7ed; color: #ea580c; }

.kpi-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
}

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

/* Tab Headers */
.tab-header {
  display: flex;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 1rem;
  gap: 0.5rem;
}

.tab-btn {
  background: transparent;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.6rem 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s ease;
}

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

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

.tab-count {
  background: #f1f5f9;
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 0.1rem 0.45rem;
  border-radius: 9999px;
  font-weight: 500;
}

.tab-btn.active .tab-count {
  background: var(--primary-light);
  color: var(--primary);
}

/* View Panes & Data Table */
.view-pane {
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.view-pane.active {
  display: block;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  background: #f8fafc;
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.85rem;
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background-color: #f8fafc;
}

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

/* Highlighting in search results */
mark {
  background: #fef08a;
  color: #854d0e;
  padding: 0 0.2rem;
  border-radius: 2px;
  font-weight: 600;
}

/* Match Reason Badges (17.D) */
.badge-match {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  margin-top: 0.3rem;
}

.badge-product-match {
  background-color: var(--success-bg);
  color: #065f46;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-text-match {
  background-color: var(--info-bg);
  color: #0369a1;
  border: 1px solid rgba(2, 132, 199, 0.3);
}

/* Proof Status Badges (17.F) */
.proof-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.proof-verified {
  background: var(--success-bg);
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.proof-announced {
  background: var(--warning-bg);
  color: #92400e;
  border: 1px solid #fde68a;
}

/* Pagination Bar */
.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1rem;
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
}

.pagination-info {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.current-page-display {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  background: #f1f5f9;
  border-radius: 4px;
}

/* Empty State Card (17.E) */
.empty-state-card {
  text-align: center;
  padding: 3.5rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
}

.empty-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

.empty-state-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.4rem;
}

.empty-state-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto 1.25rem;
}

/* Loading State */
.loading-state {
  text-align: center;
  padding: 3rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e2e8f0;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 0.75rem;
}

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

/* ==========================================================================
   Modals
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-dialog {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalFadeIn 0.2s ease-out;
}

.modal-sm { width: 440px; }
.modal-md { width: 620px; }
.modal-lg { width: 880px; }

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

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

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.btn-close-modal {
  background: transparent;
  border: none;
  font-size: 1.2rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
}

.btn-close-modal:hover {
  background: #f1f5f9;
  color: var(--text-main);
}

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

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

/* Timeline Specifics (17.F) */
.company-quick-card {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
}

.company-contact-item {
  display: flex;
  flex-direction: column;
}

.contact-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.contact-val {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.action-strip {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

.section-heading {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-color);
}

.timeline-container {
  position: relative;
  margin-top: 1rem;
  padding-left: 1.5rem;
}

.timeline-container::before {
  content: '';
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 6px;
  width: 2px;
  background: #e2e8f0;
}

.timeline-event {
  position: relative;
  margin-bottom: 1.25rem;
}

.timeline-dot {
  position: absolute;
  left: -1.5rem;
  top: 6px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--primary);
}

.timeline-event.contracted .timeline-dot {
  border-color: var(--success);
}

.timeline-card {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.9rem 1.1rem;
  box-shadow: var(--shadow-sm);
}

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

.timeline-date {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.timeline-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.3rem;
}

.timeline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

/* Tasks list */
.tasks-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.task-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  font-size: 0.8rem;
}

.new-task-inputs {
  display: flex;
  gap: 0.5rem;
}

/* Grounded Proposal Warning Banner (17.G) */
.alert-grounded-warning {
  display: flex;
  gap: 0.75rem;
  background: var(--warning-bg);
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  color: #92400e;
}

.alert-sub {
  font-size: 0.75rem;
  margin-top: 0.2rem;
  color: #b45309;
}

.observed-products-box {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.6rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.observed-prod-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  border-bottom: 1px dashed var(--border-color);
  padding-bottom: 0.2rem;
}

/* Sources & Platform Cards (17.A, 17.H) */
.sources-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.source-card {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

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

.source-title {
  font-weight: 700;
  font-size: 0.95rem;
}

.source-domain {
  font-size: 0.8rem;
  color: var(--primary);
  text-decoration: none;
}

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

.source-stats {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  background: #f8fafc;
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--primary);
  color: #fff;
}
.btn-primary:hover { background-color: var(--primary-hover); }

.btn-success {
  background-color: #059669;
  color: #fff;
  border-color: #047857;
}
.btn-success:hover { background-color: #047857; }

.btn-danger {
  background-color: #dc2626;
  color: #fff;
  border-color: #b91c1c;
}
.btn-danger:hover { background-color: #b91c1c; }

.btn-secondary {
  background-color: #f1f5f9;
  color: var(--text-main);
  border-color: var(--border-color);
}
.btn-secondary:hover { background-color: #e2e8f0; }

.btn-outline {
  background-color: transparent;
  border-color: var(--border-color);
  color: var(--text-main);
}
.btn-outline:hover {
  background-color: #f8fafc;
  border-color: #cbd5e1;
}

.btn-link {
  background: transparent;
  border: none;
  color: var(--primary);
  cursor: pointer;
  padding: 0;
  font-weight: 500;
}
.btn-link:hover { text-decoration: underline; }

.btn-sm {
  padding: 0.25rem 0.55rem;
  font-size: 0.75rem;
}

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

.w-full { width: 100%; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.font-medium { font-weight: 500; }
.text-sm { font-size: 0.8rem; }

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: #1e293b;
  color: #fff;
  padding: 0.75rem 1.1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s ease-out;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toast.success { background: #065f46; }
.toast.error { background: #991b1b; }

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

/* ==========================================================================
   Authentication Gate (Login Overlay)
   ========================================================================== */
.auth-gate-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top, #1e293b 0%, #0f172a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 9999;
}

.auth-card {
  background: #ffffff;
  border-radius: 16px;
  width: 100%;
  max-width: 440px;
  padding: 2.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  animation: modalIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.auth-logo-icon {
  width: 40px;
  height: 40px;
  font-size: 1.3rem;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.4);
}

.auth-brand-text {
  text-align: left;
}

.auth-brand-text h2 {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0f172a;
  line-height: 1.1;
}

.auth-brand-text span {
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 500;
}

.auth-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0.35rem;
}

.auth-subtitle {
  font-size: 0.82rem;
  color: #64748b;
  line-height: 1.4;
}

.auth-alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

.auth-input-icon {
  position: absolute;
  left: 0.85rem;
  font-size: 1rem;
  opacity: 0.7;
  pointer-events: none;
}

.auth-input {
  padding-left: 2.5rem !important;
  height: 42px;
  font-size: 0.92rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  transition: all 0.15s ease;
}

.auth-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  outline: none;
}

.btn-auth-submit {
  height: 44px;
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.auth-options-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
}

.auth-standard-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin-top: 1rem;
}

.standard-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}

.standard-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #334155;
}

.btn-quick-autofill {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-quick-autofill:hover {
  background: #dbeafe;
  border-color: #93c5fd;
}

.standard-credentials-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.cred-item {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 0.35rem 0.6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
}

.cred-lbl {
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 600;
}

.cred-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 700;
  color: #0f172a;
  background: #f1f5f9;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.78rem;
}

.btn-copy-cred {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.1rem 0.25rem;
  border-radius: 4px;
  font-size: 0.8rem;
  opacity: 0.7;
  transition: all 0.15s ease;
}

.btn-copy-cred:hover {
  opacity: 1;
  background: #e2e8f0;
}

.auth-footer {
  margin-top: 1.25rem;
  text-align: center;
  border-top: 1px solid #f1f5f9;
  padding-top: 1rem;
}

.auth-ssl-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: #059669;
  background: #ecfdf5;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-weight: 500;
}

/* User Badge in Navbar */
.user-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: #f1f5f9;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  border: 1px solid #e2e8f0;
  font-size: 0.82rem;
  font-weight: 600;
  color: #334155;
}

.btn-logout {
  color: #ef4444 !important;
  border-color: #fee2e2 !important;
}

.btn-logout:hover {
  background: #fef2f2 !important;
  border-color: #fecaca !important;
}

/* ==========================================================================
   Admin Panel Modal & Tabs
   ========================================================================== */
.modal-dialog.modal-xl {
  max-width: 1080px;
  width: 95%;
}

.admin-nav-tabs {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 1.5rem 0 1.5rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
}

.admin-tab-btn {
  padding: 0.7rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #64748b;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.admin-tab-btn:hover {
  color: var(--primary);
}

.admin-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: #ffffff;
  border-radius: 6px 6px 0 0;
}

.admin-modal-body {
  padding: 1.5rem;
  max-height: 75vh;
  overflow-y: auto;
}

/* Admin KPI Grid */
.admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.admin-kpi-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
}

.kpi-icon {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.kpi-icon.blue { background: #eff6ff; color: #2563eb; }
.kpi-icon.green { background: #ecfdf5; color: #10b981; }
.kpi-icon.purple { background: #faf5ff; color: #9333ea; }
.kpi-icon.orange { background: #fff7ed; color: #ea580c; }

.kpi-data {
  display: flex;
  flex-direction: column;
}

.kpi-val {
  font-size: 1.35rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.2;
}

.kpi-lbl {
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 500;
  margin-top: 0.2rem;
}

.admin-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

@media (max-width: 768px) {
  .admin-grid-2col {
    grid-template-columns: 1fr;
  }
}

.admin-subpanel {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 1.25rem;
}

.subpanel-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 1rem;
}

/* Platform Stats Rows */
.platform-stats-table {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.platform-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.8rem;
  background: #f8fafc;
  border-radius: 8px;
  font-size: 0.85rem;
}

.platform-stat-row .badge {
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
}

.sync-action-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

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

.admin-table th {
  background: #f8fafc;
  padding: 0.75rem;
  text-align: left;
  font-weight: 600;
  color: #475569;
  border-bottom: 1px solid #e2e8f0;
}

.admin-table td {
  padding: 0.75rem;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
  vertical-align: middle;
}

.admin-table tr:hover td {
  background: #f8fafc;
}

.badge-count {
  background: #e2e8f0;
  color: #334155;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
}

/* Admin Staff Grid */
.admin-staff-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.admin-staff-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  gap: 1rem;
}

.staff-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #eff6ff;
  color: #2563eb;
  font-size: 1.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.staff-info h5 {
  font-size: 0.92rem;
  font-weight: 700;
  color: #0f172a;
}

.staff-info p {
  font-size: 0.78rem;
  color: #64748b;
  margin-top: 0.15rem;
}

/* Security Card */
.admin-security-card {
  max-width: 480px;
  margin: 0.5rem auto;
  padding: 2rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.status-badge-inline {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
}

.status-badge-inline.yangi { background: #dbeafe; color: #1e40af; }
.status-badge-inline.jarayonda { background: #fef3c7; color: #92400e; }
.status-badge-inline.bajarildi { background: #d1fae5; color: #065f46; }

