* {
  box-sizing: border-box;
}

html {
  overflow-y: scroll;
}

body {
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.05), transparent 28%),
    linear-gradient(180deg, #f8fbff 0%, #f4f7fb 45%, #eef4fb 100%);
  color: #0f172a;
}

body.no-scroll {
  overflow: hidden;
}

a {
  text-decoration: none;
}

.admin-body {
  display: flex;
  min-height: 100vh;
}

/* ======================
   SIDEBAR (PREMIUM)
====================== */

.sidebar {
  width: 272px;
  position: fixed;
  inset: 0 auto 0 0;
  height: 100%;
  padding: 18px 16px 20px;
  background:
    radial-gradient(circle at top left, rgba(59, 130, 246, 0.18), transparent 26%),
    linear-gradient(180deg, #071120 0%, #0b1730 48%, #0f172a 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 22px 0 60px rgba(2, 6, 23, 0.22);
  transition: width 0.28s ease, transform 0.28s ease, padding 0.28s ease;
  z-index: 1000;
  overflow-x: hidden;
}

.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(145deg, rgba(255,255,255,0.02), transparent 30%),
    radial-gradient(circle at bottom right, rgba(14, 165, 233, 0.10), transparent 24%);
  pointer-events: none;
}

.sidebar-top {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 26px;
}

.sidebar-logo-link {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  position: relative;
  min-height: 44px;
}

.sidebar-logo {
  display: block;
  height: auto;
  transition: opacity 0.22s ease, transform 0.22s ease, width 0.22s ease;
}

.sidebar-logo-full {
  width: 148px;
  opacity: 1;
  transform: scale(1);
}

.sidebar-logo-compact {
  width: 38px;
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%) scale(0.9);
  opacity: 0;
  pointer-events: none;
}

/* collapsed desktop */
body.collapsed .sidebar-logo-full {
  opacity: 0;
  transform: scale(0.92);
  pointer-events: none;
}

body.collapsed .sidebar-logo-compact {
  opacity: 1;
  transform: translateY(-50%) scale(1);
  pointer-events: auto;
}

.sidebar-close {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: #fff;
  border-radius: 12px;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  transition: 0.2s ease;
}

.sidebar-close:hover {
  background: rgba(255,255,255,0.12);
}

.sidebar-nav {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 16px;
  color: #cbd5e1;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition:
    background 0.22s ease,
    color 0.22s ease,
    transform 0.22s ease,
    border-color 0.22s ease,
    box-shadow 0.22s ease;
  border: 1px solid transparent;
}

.sidebar-nav a i {
  width: 20px;
  min-width: 20px;
  text-align: center;
  font-size: 15px;
  color: #dbe5f3;
  transition: transform 0.22s ease, color 0.22s ease;
}

.sidebar-nav a span {
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.sidebar-nav a:hover {
  background: rgba(255,255,255,0.07);
  color: #fff;
  transform: translateX(2px);
}

.sidebar-nav a:hover i {
  color: #fff;
  transform: scale(1.05);
}

.sidebar-nav a.active {
  background: linear-gradient(135deg, rgba(255,255,255,0.12), rgba(255,255,255,0.08));
  border-color: rgba(255,255,255,0.08);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

.sidebar-nav a.active::before {
  content: "";
  position: absolute;
  left: -4px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, #f97316, #fb923c);
  box-shadow: 0 0 14px rgba(249, 115, 22, 0.45);
}

.sidebar-nav a.active i {
  color: #fff;
}

/* ======================
   COLLAPSED (DESKTOP)
====================== */

body.collapsed .sidebar {
  width: 88px;
  padding-left: 12px;
  padding-right: 12px;
}

body.collapsed .sidebar-logo {
  width: 42px;
}

body.collapsed .sidebar-nav a {
  justify-content: center;
  padding-left: 12px;
  padding-right: 12px;
}

body.collapsed .sidebar-nav a span {
  opacity: 0;
  pointer-events: none;
  width: 0;
  overflow: hidden;
  transform: translateX(-4px);
}

body.collapsed .sidebar-nav a.active::before {
  left: 0;
}

/* TOOLTIP */

body.collapsed .sidebar-nav a::after {
  content: attr(data-label);
  position: absolute;
  left: 100%;
  margin-left: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: #0f172a;
  color: #fff;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 8px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.22);
  border: 1px solid rgba(255,255,255,0.08);
}

body.collapsed .sidebar-nav a:hover::after {
  opacity: 1;
}

/* ======================
   OVERLAY
====================== */

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.56);
  backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition: 0.25s ease;
  z-index: 999;
}

.sidebar-overlay.show {
  opacity: 1;
  visibility: visible;
}

/* ======================
   MAIN PANEL
====================== */

.main-panel {
  margin-left: 272px;
  width: calc(100% - 272px);
  transition: margin-left 0.28s ease, width 0.28s ease;
}

body.collapsed .main-panel {
  margin-left: 88px;
  width: calc(100% - 88px);
}

/* ======================
   TOPBAR
====================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  padding: 16px 28px;
  min-height: 74px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.menu-toggle {
  display: inline-flex;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255,255,255,0.9);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  transition: 0.2s ease;
}

.menu-toggle:hover {
  border-color: rgba(204,85,0,0.18);
  background: #fff;
}

.menu-toggle span {
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: #0f172a;
}

.topbar h3 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.topbar p {
  margin: 0;
  color: #64748b;
  font-size: 13px;
  font-weight: 500;
}

.topbar-user {
  text-align: right;
}

.topbar-user strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}

.topbar-user span {
  margin: 0;
  color: #64748b;
  font-size: 13px;
  font-weight: 500;
}

/* ======================
   CONTENT
====================== */

.content-wrap {
  padding: 24px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

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

.stat-card {
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  border: 1px solid #e5e7eb;
  border-radius: 22px;
  padding: 20px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.05);
}

.stat-card span {
  display: block;
  font-size: 13px;
  color: #64748b;
  margin-bottom: 10px;
}

.stat-card strong {
  font-size: 30px;
  letter-spacing: -0.03em;
}

.stat-card.success { border-color: rgba(22, 163, 74, 0.18); }
.stat-card.info { border-color: rgba(59, 130, 246, 0.18); }
.stat-card.purple { border-color: rgba(139, 92, 246, 0.18); }
.stat-card.danger { border-color: rgba(220, 38, 38, 0.18); }
.stat-card.dark { border-color: rgba(15, 23, 42, 0.14); }

.panel {
  background: rgba(255,255,255,0.96);
  border: 1px solid #e5e7eb;
  border-radius: 24px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.05);
  overflow: hidden;
}

.panel + .panel {
  margin-top: 20px;
}

.panel-head {
  padding: 16px 20px;
  border-bottom: 1px solid #eef2f7;
}

.panel-head.space-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.panel-head h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

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

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

.admin-table thead th {
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}

.admin-table th,
.admin-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #eef2f7;
  text-align: left;
  font-size: 13.5px;
}

.admin-table th {
  color: #64748b;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.table-link {
  color: #cc5500;
  font-weight: 700;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.badge.success { background: rgba(22, 163, 74, 0.10); color: #166534; }
.badge.warning { background: rgba(245, 158, 11, 0.12); color: #92400e; }
.badge.danger { background: rgba(220, 38, 38, 0.10); color: #991b1b; }
.badge.info { background: rgba(59, 130, 246, 0.10); color: #1d4ed8; }
.badge.purple { background: rgba(139, 92, 246, 0.10); color: #6d28d9; }
.badge.neutral { background: rgba(148, 163, 184, 0.12); color: #475569; }
.badge.dark { background: rgba(15, 23, 42, 0.10); color: #0f172a; }

.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.filters input,
.filters select {
  min-height: 42px;
  border: 1px solid #d7e0eb;
  background: #f8fafc;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13.5px;
}

.filters input {
  min-width: 240px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  font-size: 13.5px;
  padding: 0 16px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-weight: 700;
  transition: 0.2s ease;
}

.btn-primary {
  background: #cc5500;
  color: #fff;
}

.btn-primary:hover {
  background: #b84c00;
}

.full {
  width: 100%;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.detail-list {
  display: grid;
}

.detail-list > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  border-bottom: 1px solid #eef2f7;
}

.detail-list > div span {
  color: #64748b;
  font-size: 13px;
}

.detail-list > div strong {
  text-align: right;
  max-width: 55%;
  word-break: break-word;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(30, 58, 138, 0.88));
  padding: 24px;
}

.login-shell {
  width: 100%;
  max-width: 960px;
  display: grid;
  grid-template-columns: 1fr 420px;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 0 26px 70px rgba(15, 23, 42, 0.24);
}

.login-brand {
  padding: 42px;
  background: linear-gradient(135deg, #0f172a, #1e3a8a);
  color: #fff;
}

.login-brand h1 {
  margin: 0 0 10px;
  font-size: 40px;
}

.login-brand p {
  margin: 0;
  line-height: 1.8;
  color: #dbe3ee;
}

.login-card {
  padding: 42px;
  background: #fff;
}

.login-card h2 {
  margin: 0 0 16px;
  font-size: 28px;
}

.login-form {
  display: grid;
  gap: 10px;
}

.login-form label {
  font-size: 13px;
  font-weight: 700;
  color: #475569;
}

.login-form input {
  min-height: 42px;
  border: 1px solid #d7e0eb;
  background: #f8fafc;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13.5px;
}

.alert {
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 14px;
  font-size: 14px;
}

.alert.error {
  background: rgba(220, 38, 38, 0.10);
  color: #991b1b;
  border: 1px solid rgba(220, 38, 38, 0.14);
}

.alert.success {
  background: rgba(22, 163, 74, 0.10);
  color: #166534;
  border: 1px solid rgba(22, 163, 74, 0.14);
}

.form-panel {
  max-width: 760px;
}

.form-wrap {
  padding: 22px;
}

.admin-form {
  display: grid;
  gap: 10px;
}

.admin-form label {
  font-size: 13px;
  font-weight: 700;
  color: #475569;
}

.admin-form input,
.admin-form select {
  min-height: 46px;
  border: 1px solid #d7e0eb;
  background: #f8fafc;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.check-row input {
  min-height: auto;
}

.admin-textarea {
  width: 100%;
  border: 1px solid #d7e0eb;
  background: #f8fafc;
  border-radius: 12px;
  padding: 12px;
  font-size: 14px;
  resize: vertical;
}

.notes-list {
  padding: 20px;
  display: grid;
  gap: 14px;
}

.note-card {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 16px;
}

.note-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.note-meta strong {
  font-size: 14px;
}

.note-meta span {
  color: #64748b;
  font-size: 12px;
}

.note-card p {
  margin: 0;
  line-height: 1.7;
  color: #334155;
  font-size: 14px;
}

.empty-note {
  padding: 20px;
  color: #64748b;
  font-size: 14px;
}

.doc-grid {
  padding: 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.doc-card {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 16px;
}

.doc-card h5 {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}

.doc-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.doc-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #e5e7eb;
  color: #0f172a;
  font-weight: 600;
  font-size: 13.5px;
}

.doc-link:hover {
  border-color: rgba(204, 85, 0, 0.18);
  color: #cc5500;
}

.doc-link.secondary {
  background: #f8fafc;
}

.doc-empty {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  background: #fff;
  border: 1px dashed #d7e0eb;
  color: #64748b;
  font-size: 13px;
}

.quick-actions {
  padding: 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.action-btn {
  width: 100%;
  min-height: 42px;
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  color: #0f172a;
  transition: 0.2s ease;
}

.action-btn:hover {
  border-color: rgba(204, 85, 0, 0.18);
  color: #cc5500;
}

.action-btn.success {
  background: rgba(22, 163, 74, 0.08);
  color: #166534;
  border-color: rgba(22, 163, 74, 0.14);
}

.action-btn.warning {
  background: rgba(245, 158, 11, 0.08);
  color: #92400e;
  border-color: rgba(245, 158, 11, 0.14);
}

.action-btn.info {
  background: rgba(59, 130, 246, 0.08);
  color: #1d4ed8;
  border-color: rgba(59, 130, 246, 0.14);
}

.action-btn.purple {
  background: rgba(139, 92, 246, 0.08);
  color: #6d28d9;
  border-color: rgba(139, 92, 246, 0.14);
}

.action-btn.dark {
  background: rgba(15, 23, 42, 0.08);
  color: #0f172a;
  border-color: rgba(15, 23, 42, 0.14);
}

.empty-state {
  padding: 28px 20px;
  text-align: center;
  color: #64748b;
  font-size: 14px;
}

@media (max-width: 1400px) {
  .stats-grid.six {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 980px) {
  .menu-toggle {
    display: inline-flex;
  }

  .sidebar {
    transform: translateX(-100%);
    width: min(86vw, 320px);
    box-shadow: 20px 0 50px rgba(15, 23, 42, 0.28);
    overflow-y: auto;
  }

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

  .sidebar-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .main-panel {
    margin-left: 0;
    width: 100%;
  }

  .topbar {
    padding: 16px 18px;
    align-items: flex-start;
  }

  .topbar-user {
    min-width: max-content;
  }

  .content-wrap {
    padding: 18px;
  }

  .detail-grid,
  .login-shell,
  .stats-grid,
  .stats-grid.six,
  .doc-grid,
  .quick-actions {
    grid-template-columns: 1fr;
  }
}