:root {
  --primary: #ef5423;
  --primary-dark: #cc451c;
  --secondary: #0f3558;
  --bg: #f2f5f9;
  --white: #ffffff;
  --text: #1f2a3c;
  --muted: #6f7a85;
  --border: #dfe4ea;
  --success: #0d9b6a;
  --warning: #f5a524;
  --info: #3a86ff;
  --radius: 16px;
  --shadow: 0 18px 36px rgba(15, 53, 88, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Poppins", sans-serif;
  background: var(--bg);
  color: var(--text);
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

[hidden] {
  display: none !important;
}

.admin-guard {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, rgba(15, 53, 88, 0.92), rgba(15, 53, 88, 0.85));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  z-index: 999;
}

.guard-card {
  background: var(--white);
  border-radius: 24px;
  max-width: 420px;
  width: 100%;
  padding: 2.5rem 2.2rem;
  text-align: center;
  box-shadow: 0 28px 60px rgba(15, 53, 88, 0.25);
  display: grid;
  gap: 1.5rem;
}

.guard-card h1 {
  margin: 0;
  font-size: 1.8rem;
  color: var(--secondary);
}

.guard-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.sidebar {
  background: linear-gradient(180deg, #0f3558 0%, #09243d 100%);
  color: var(--white);
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 2.5rem 1.75rem;
  gap: 2.5rem;
  position: sticky;
  top: 0;
  height: 100vh;
  border-radius: 0 28px 28px 0;
  box-shadow: 12px 0 36px rgba(9, 24, 40, 0.25);
}

.brand {
  font-weight: 600;
  font-size: 1.45rem;
  letter-spacing: 0.04em;
}

.sidebar nav {
  display: grid;
  gap: 0.5rem;
}

.sidebar a {
  padding: 0.9rem 1.1rem;
  border-radius: 18px;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
  position: relative;
  transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.sidebar a::before {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: -1;
}

.sidebar a:hover,
.sidebar a:focus {
  color: var(--white);
  transform: translateX(4px);
}

.sidebar a:hover::before,
.sidebar a:focus::before {
  opacity: 1;
}

.sidebar a.active {
  color: var(--white);
  background: rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.sidebar a.active::before {
  opacity: 0;
}

.content {
  padding: 2.5rem;
  display: grid;
  gap: 2.5rem;
}

.content-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.content-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.4rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-family: inherit;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.btn.primary {
  background: var(--primary);
  color: var(--white);
  box-shadow: 0 14px 28px rgba(239, 84, 35, 0.25);
}

.btn.primary:hover,
.btn.primary:focus {
  transform: translateY(-2px);
  box-shadow: 0 18px 32px rgba(239, 84, 35, 0.35);
}

.btn.secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--white);
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.grid {
  display: grid;
  gap: 1.5rem;
}

.stats {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.8rem;
  display: grid;
  gap: 1rem;
}

.card h3 {
  margin: 0;
  font-size: 1.15rem;
  color: var(--muted);
}

.card strong {
  font-size: 2rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.form-grid {
  display: grid;
  gap: 1.2rem;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
}

.form-row {
  display: grid;
  gap: 0.5rem;
}

.form-row input,
.form-row textarea,
.form-row select {
  padding: 0.8rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-row input:focus,
.form-row textarea:focus,
.form-row select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(239, 84, 35, 0.15);
  outline: none;
}

.form-row small {
  color: var(--muted);
}

.table-responsive {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

thead {
  background: rgba(15, 53, 88, 0.06);
}

thead th {
  text-align: left;
  padding: 0.85rem 1rem;
  font-size: 0.95rem;
  color: var(--muted);
}

tbody td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--white);
}

.badge.success {
  background: var(--success);
}

.badge.warning {
  background: var(--warning);
}

.badge.info {
  background: var(--info);
}

.data-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 1rem;
}

.data-item {
  display: grid;
  gap: 0.75rem;
  border: 1px solid rgba(15, 53, 88, 0.08);
  border-radius: 14px;
  padding: 1.2rem;
  background: rgba(15, 53, 88, 0.02);
}

.item-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.item-meta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.9rem;
  color: var(--muted);
}

.item-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn.inline {
  padding: 0.5rem 1rem;
  border-radius: 10px;
  font-size: 0.85rem;
}

.btn.inline + .btn.inline {
  margin-left: 0.25rem;
}

.btn.inline.secondary {
  background: rgba(15, 53, 88, 0.1);
  color: var(--secondary);
  border: 1px solid rgba(15, 53, 88, 0.15);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--white);
}

.status-active {
  background: var(--success);
}

.status-scheduled {
  background: var(--info);
}

.status-paused {
  background: var(--warning);
  color: #3d2700;
}

.status-published {
  background: var(--secondary);
}

.status-draft {
  background: var(--muted);
  color: var(--white);
}

.list-empty {
  padding: 1.2rem;
  border-radius: 12px;
  background: rgba(15, 53, 88, 0.06);
  color: var(--muted);
  font-size: 0.95rem;
}

#exportTextarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-family: "Fira Code", "Consolas", monospace;
  font-size: 0.85rem;
  padding: 1rem;
  background: #0f1a2a;
  color: rgba(255, 255, 255, 0.9);
  min-height: 220px;
}

.note {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.campaign-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 1rem;
}

.campaign-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  padding: 1.2rem;
  background: rgba(239, 84, 35, 0.06);
  border-radius: 14px;
}

.campaign-list h3 {
  margin: 0;
}

.tips {
  list-style: disc;
  padding-left: 1.2rem;
  margin: 0;
  display: grid;
  gap: 0.7rem;
  color: var(--muted);
}

@media (max-width: 960px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    grid-template-rows: auto;
    grid-auto-flow: row;
    border-bottom-right-radius: var(--radius);
    border-bottom-left-radius: var(--radius);
  }
}

@media (max-width: 640px) {
  .content {
    padding: 1.5rem;
  }

  table {
    min-width: auto;
  }
}
