/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: #0d0b08;
  color: #e8e5dc;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ===== Auth ===== */
.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #0d0b08;
}

.auth-screen.visible {
  display: flex;
}

.auth-card {
  width: min(100%, 360px);
  background: #1a1714;
  border: 1px solid rgba(92, 182, 58, 0.25);
  border-radius: 8px;
  padding: 28px;
}

.auth-card h1 {
  color: #5cb63a;
  font-size: 18px;
  margin-bottom: 4px;
}

.auth-card p {
  color: #6b6660;
  font-size: 13px;
  margin-bottom: 18px;
}

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

/* ===== Sidebar ===== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 220px;
  height: 100vh;
  background: #1a1714;
  border-right: 1px solid rgba(92, 182, 58, 0.25);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.25s ease;
}

.sidebar-logo {
  padding: 16px;
  font-weight: 700;
  color: #5cb63a;
  font-size: 14px;
  letter-spacing: 0.05em;
  border-bottom: 1px solid rgba(92, 182, 58, 0.12);
}

.sidebar-nav {
  flex: 1;
  padding-top: 8px;
}

.nav-item {
  padding: 10px 16px;
  cursor: pointer;
  border-left: 3px solid transparent;
  color: #9ca3af;
  font-size: 13px;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-item:hover {
  background: rgba(92, 182, 58, 0.08);
  color: #e8e5dc;
}

.nav-item.active {
  border-left-color: #8B7020;
  background: rgba(92, 182, 58, 0.15);
  color: #5cb63a;
}

.nav-icon {
  font-size: 6px;
  opacity: 0.5;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(92, 182, 58, 0.12);
}

.site-selector-label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #6b6660;
  margin-bottom: 6px;
}

.site-selector {
  width: 100%;
  background: #0d0b08;
  border: 1px solid rgba(92, 182, 58, 0.2);
  color: #e8e5dc;
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 13px;
}

/* ===== Main ===== */
.main {
  margin-left: 220px;
  padding: 24px;
  min-height: 100vh;
}

.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.top-header h1 {
  font-size: 20px;
  font-weight: 600;
  color: #e8e5dc;
}

/* ===== Page Header ===== */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

/* ===== Panels ===== */
.panel {
  background: #1a1714;
  border: 1px solid rgba(92, 182, 58, 0.1);
  border-radius: 6px;
  margin-bottom: 16px;
}

.panel-header {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(92, 182, 58, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  color: #5cb63a;
}

.panel-body {
  padding: 18px;
}

/* ===== Stats ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.stat-card {
  background: #1a1714;
  border: 1px solid rgba(92, 182, 58, 0.1);
  border-radius: 6px;
  padding: 18px;
}

.stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #5cb63a;
}

.stat-value {
  font-size: 28px;
  font-weight: 300;
  color: #e8e5dc;
  margin: 6px 0;
}

.stat-sub {
  font-size: 11px;
  color: #6b6660;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  transition: opacity 0.15s;
  font-family: inherit;
}

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

.btn-primary {
  background: linear-gradient(135deg, #5cb63a, #8B7020);
  color: #fff;
}

.btn-gold {
  background: transparent;
  border: 1px solid #5cb63a;
  color: #5cb63a;
}

.btn-danger {
  background: #dc2626;
  color: white;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 11px;
}

/* ===== Inputs ===== */
input[type="text"],
input[type="url"],
input[type="search"],
input[type="number"],
input[type="password"],
textarea {
  background: #0d0b08;
  border: 1px solid rgba(92, 182, 58, 0.2);
  color: #e8e5dc;
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
  width: 100%;
  transition: border-color 0.15s;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: #5cb63a;
}

textarea {
  resize: vertical;
  min-height: 80px;
}

select {
  background: #0d0b08;
  border: 1px solid rgba(92, 182, 58, 0.2);
  color: #e8e5dc;
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
}

/* ===== Tables ===== */
table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: #5cb63a;
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid rgba(92, 182, 58, 0.12);
  font-weight: 600;
}

td {
  padding: 10px;
  border-bottom: 1px solid rgba(92, 182, 58, 0.05);
  font-size: 13px;
}

tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.015);
}

tr:hover {
  background: rgba(92, 182, 58, 0.06);
}

/* ===== Badges ===== */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.badge-ok {
  background: rgba(92, 182, 58, 0.3);
  color: #4ade80;
}

.badge-warn {
  background: rgba(92, 182, 58, 0.2);
  color: #5cb63a;
}

.badge-draft {
  background: rgba(100, 100, 100, 0.2);
  color: #9ca3af;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: #1a1714;
  border: 1px solid rgba(92, 182, 58, 0.25);
  border-radius: 8px;
  max-width: 640px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(92, 182, 58, 0.1);
}

.modal-header h3 {
  font-size: 15px;
  color: #5cb63a;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: #6b6660;
  font-size: 22px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.modal-close:hover { color: #e8e5dc; }

#modal-body {
  padding: 20px;
}

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

.toast {
  padding: 12px 20px;
  border-radius: 6px;
  color: white;
  font-size: 13px;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
  max-width: 360px;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-success {
  background: #8B7020;
}

.toast-error {
  background: #dc2626;
}

/* ===== Loading Spinner ===== */
.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 2px solid rgba(92, 182, 58, 0.2);
  border-top-color: #5cb63a;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.loading-container {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  gap: 12px;
  color: #6b6660;
  font-size: 13px;
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  color: #6b6660;
  padding: 40px;
  font-size: 13px;
}

/* ===== Utility ===== */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-12 { margin-bottom: 12px; }

.chip {
  display: inline-block;
  padding: 4px 10px;
  border: 1px solid rgba(92, 182, 58, 0.2);
  border-radius: 12px;
  font-size: 11px;
  cursor: pointer;
  margin: 3px;
  transition: all 0.15s;
}

.chip:hover {
  border-color: #5cb63a;
  background: rgba(92, 182, 58, 0.1);
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #5cb63a;
  margin-bottom: 6px;
}

/* ===== Hamburger ===== */
.hamburger {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 150;
  background: #1a1714;
  border: 1px solid rgba(92, 182, 58, 0.25);
  color: #5cb63a;
  font-size: 20px;
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main {
    margin-left: 0;
    padding: 16px;
    padding-top: 52px;
  }

  .hamburger {
    display: block;
  }

  .two-col {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
}
