:root {
  --bg: #07111f;
  --panel: rgba(11, 22, 38, 0.88);
  --panel-2: rgba(17, 30, 51, 0.95);
  --card: rgba(15, 24, 40, 0.95);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(79, 209, 255, 0.28);
  --text: #f5f7fb;
  --muted: #9aa8bf;
  --cyan: #44d9ff;
  --cyan-2: #22b8ff;
  --violet: #7c5cff;
  --success: #33d17a;
  --warning: #ffb84d;
  --danger: #ff6b81;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  padding: 0;
  font-family: Inter, Arial, Helvetica, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(68, 217, 255, 0.12), transparent 28%),
    radial-gradient(circle at top right, rgba(124, 92, 255, 0.12), transparent 26%),
    linear-gradient(180deg, #06101b 0%, #07111f 50%, #050c16 100%);
  color: var(--text);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.admin-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--border);
  background: rgba(4, 10, 18, 0.75);
  backdrop-filter: blur(18px);
  padding: 28px 18px;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.03);
}

.sidebar__brand h2 { margin: 0; font-size: 1rem; }
.sidebar__brand p { margin: 4px 0 0; color: var(--muted); font-size: 0.9rem; }

.sidebar__logo {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  color: #04111d;
  font-weight: 800;
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar__link {
  padding: 14px 16px;
  border-radius: 14px;
  color: var(--muted);
  border: 1px solid transparent;
  transition: 0.25s ease;
}

.sidebar__link:hover {
  color: var(--text);
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.sidebar__link.active {
  color: var(--text);
  background: rgba(68, 217, 255, 0.1);
  border-color: var(--border-strong);
}

.sidebar__note {
  margin-top: 24px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.sidebar__note-label {
  margin: 0 0 10px;
  color: var(--cyan);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 700;
}

.sidebar__note p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
  font-size: 0.92rem;
}

.main-content { padding: 32px; min-width: 0; }

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.eyebrow,
.panel-label {
  margin: 0 0 10px;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.75rem;
  font-weight: 700;
}

.page-header h1 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 1.05;
}

.page-description {
  margin: 14px 0 0;
  max-width: 820px;
  color: var(--muted);
  line-height: 1.7;
}

.header-actions,
.toolbar-actions,
.modal__actions,
.card-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 12px 18px;
  border-radius: 14px;
  font-weight: 700;
  border: 1px solid transparent;
  transition: 0.25s ease;
  cursor: pointer;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--cyan), var(--cyan-2));
  color: #04101d;
  box-shadow: 0 12px 35px rgba(34, 184, 255, 0.22);
}

.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.04); }

.btn-secondary,
.btn-danger,
.btn-small {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover,
.btn-small:hover { background: rgba(255, 255, 255, 0.08); }

.btn-danger { color: #ff9aac; border-color: rgba(255, 107, 129, 0.2); }
.btn-danger:hover { background: rgba(255, 107, 129, 0.12); }

.btn-small {
  min-height: 34px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 0.84rem;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.search-box { flex: 1; min-width: 240px; }

.search-box input,
.toolbar select,
.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 46px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  outline: none;
  padding: 0 14px;
}

.field textarea {
  padding: 12px 14px;
  min-height: auto;
  resize: vertical;
  line-height: 1.55;
}

.field small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.4;
}

.search-box input::placeholder,
.field input::placeholder,
.field textarea::placeholder { color: #7e8ca3; }

.toolbar-actions { min-width: 380px; }
.toolbar-actions select { min-width: 170px; flex: 1; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.stat-card {
  padding: 22px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--panel-2);
  box-shadow: var(--shadow);
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 10px;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
}

.panel {
  padding: 24px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.section-head h2 { margin: 0; font-size: 1.35rem; }
.section-head p { margin: 0; color: var(--muted); }

.resources-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.resource-card {
  display: flex;
  flex-direction: column;
  min-height: 260px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--card);
  transition: 0.25s ease;
  overflow: hidden;
}

.resource-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

.resource-card__body {
  padding: 20px;
  flex: 1;
}

.resource-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.resource-card h3 {
  margin: 0 0 10px;
  font-size: 1.1rem;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  padding: 8px 11px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

.badge--active {
  background: rgba(51, 209, 122, 0.14);
  color: #74f0aa;
}

.badge--inactive {
  background: rgba(255, 184, 77, 0.14);
  color: #ffd18b;
}

.resource-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 6px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.resource-card__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 16px 20px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.empty-state {
  margin-top: 16px;
  padding: 40px 20px;
  border: 1px dashed var(--border);
  border-radius: 20px;
  text-align: center;
  background: rgba(255, 255, 255, 0.02);
}

.empty-state h3 { margin: 0 0 10px; }
.empty-state p { margin: 0; color: var(--muted); }

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(8px);
}

.modal__panel {
  position: relative;
  width: min(920px, 100%);
  max-height: min(88vh, 900px);
  overflow: auto;
  padding: 24px;
  border-radius: 24px;
  border: 1px solid var(--border-strong);
  background: #0b1626;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.55);
}

.modal__panel--wide { width: min(1040px, 100%); }

.modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.modal__head h2 { margin: 0; }

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 1.3rem;
  cursor: pointer;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field--full { grid-column: 1 / -1; }
.field label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.9rem;
}

.modal__actions {
  justify-content: flex-end;
  margin-top: 20px;
}

.form-message {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
}

.form-message.error {
  color: #ffbac5;
  border-color: rgba(255, 107, 129, 0.25);
  background: rgba(255, 107, 129, 0.08);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #101d31;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: 0.25s ease;
}

.toast.show { opacity: 1; transform: translateY(0); }
.hidden { display: none !important; }

@media (max-width: 1200px) {
  .resources-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar,
  .section-head,
  .page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-actions {
    min-width: auto;
    width: 100%;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .admin-layout { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--border); }
}

@media (max-width: 680px) {
  .main-content { padding: 18px; }
  .resources-grid,
  .stats-grid,
  .form-grid { grid-template-columns: 1fr; }
  .toolbar-actions { flex-direction: column; }
}
