.admin-body {
  background:
    radial-gradient(ellipse 80% 50% at 100% 0%, rgba(159, 217, 200, 0.35), transparent 50%),
    linear-gradient(165deg, #e8eef5 0%, #f4f7fb 50%, #eef3f8 100%);
}

.admin-body::before { opacity: 0.2; }

.admin-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.admin-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1rem;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-right: 1px solid rgba(18, 32, 46, 0.08);
  z-index: 30;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 0.5rem 1.25rem;
}

.admin-brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  color: #fff;
  background: linear-gradient(145deg, #12b89f, var(--accent-deep));
  box-shadow: 0 10px 24px rgba(13, 159, 138, 0.28);
}

.admin-brand strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.admin-brand small {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
  overflow-y: auto;
}

.admin-nav-label {
  margin: 1rem 0.65rem 0.35rem;
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.admin-nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.72rem 0.85rem;
  border-radius: 12px;
  text-decoration: none;
  color: var(--ink-soft);
  font-weight: 650;
  font-size: 0.92rem;
  transition: background 0.2s, color 0.2s;
}

.admin-nav-link:hover {
  background: rgba(13, 159, 138, 0.08);
  color: var(--accent-deep);
}

.admin-nav-link.active {
  background: linear-gradient(135deg, rgba(13, 159, 138, 0.16), rgba(13, 159, 138, 0.06));
  color: var(--accent-deep);
  box-shadow: inset 0 0 0 1px rgba(13, 159, 138, 0.2);
}

.nav-ico {
  width: 1.4rem;
  text-align: center;
  opacity: 0.85;
}

.admin-sidebar-foot {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.admin-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem;
  margin-bottom: 0.5rem;
}

.admin-user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-weight: 800;
  font-family: var(--font-display);
}

.admin-user strong {
  display: block;
  font-size: 0.88rem;
  line-height: 1.2;
}

.admin-user small {
  color: var(--muted);
  font-size: 0.75rem;
}

.admin-logout {
  display: block;
  text-align: center;
  padding: 0.65rem;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.88rem;
  color: #991b1b;
  background: rgba(220, 38, 38, 0.06);
}

.admin-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.admin-topbar {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(244, 247, 251, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(18, 32, 46, 0.06);
}

.admin-menu-btn {
  display: none;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  width: 42px;
  height: 42px;
  font-size: 1.1rem;
  cursor: pointer;
}

.admin-topbar-title {
  flex: 1;
  min-width: 0;
}

.admin-topbar-title h1 {
  margin: 0;
  font-size: 1.25rem;
  font-family: var(--font-display);
  font-weight: 750;
  letter-spacing: -0.02em;
}

.admin-topbar-meta {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.admin-content {
  padding: 1.35rem 1.5rem 2.5rem;
  animation: rise 0.45s ease both;
}

/* Dashboard cards */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.35rem;
}

.dash-card {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 18px;
  padding: 1.15rem 1.2rem;
  box-shadow: 0 10px 30px rgba(18, 32, 46, 0.06);
  position: relative;
  overflow: hidden;
}

.dash-card-btn {
  display: block;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: transform 0.15s ease, box-shadow 0.2s, border-color 0.2s;
}

.dash-card-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 36px rgba(18, 32, 46, 0.1);
  border-color: rgba(13, 159, 138, 0.35);
}

.dash-card-btn:active {
  transform: translateY(0);
}

.dash-card-btn.is-active {
  border-color: rgba(13, 159, 138, 0.55);
  box-shadow: 0 0 0 3px rgba(13, 159, 138, 0.15), 0 14px 36px rgba(18, 32, 46, 0.08);
}

.dash-detail {
  margin-bottom: 1.35rem;
  animation: rise 0.35s ease both;
}

.dash-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.dash-modal[hidden] {
  display: none !important;
}

.dash-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 16, 24, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.dash-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(480px, 100%);
  max-height: min(78vh, 640px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 24px 60px rgba(18, 32, 46, 0.22);
  padding: 1.15rem 1.2rem 1.25rem;
  animation: rise 0.3s ease both;
}

.dash-modal-body {
  overflow-y: auto;
  min-height: 0;
  margin-top: 0.25rem;
  padding-right: 0.15rem;
}

body.modal-open {
  overflow: hidden;
}

.dash-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

.dash-detail-head h2 {
  margin: 0;
}

.dash-detail-sub {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.dash-detail-close {
  border: 1px solid var(--line);
  background: #fff;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1rem;
  color: var(--ink-soft);
}

.dash-detail-close:hover {
  border-color: rgba(13, 159, 138, 0.4);
  color: var(--accent-deep);
}

.detail-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.dash-card::after {
  content: "";
  position: absolute;
  right: -20px;
  top: -20px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: rgba(13, 159, 138, 0.08);
}

.dash-card.tone-warn::after { background: rgba(217, 119, 6, 0.1); }
.dash-card.tone-good::after { background: rgba(22, 163, 74, 0.1); }
.dash-card.tone-ink::after { background: rgba(18, 32, 46, 0.06); }

.dash-card-label {
  position: relative;
  font-size: 0.78rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.45rem;
}

.dash-card-value {
  position: relative;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--ink);
}

.dash-card-hint {
  position: relative;
  margin-top: 0.45rem;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}

.dash-panels {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 1rem;
}

.dash-panel {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 18px;
  padding: 1.15rem 1.2rem;
  box-shadow: 0 10px 30px rgba(18, 32, 46, 0.06);
}

.dash-panel h2 {
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.dash-actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.dash-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  text-decoration: none;
  color: var(--ink);
  background: rgba(18, 32, 46, 0.03);
  border: 1px solid var(--line);
  font-weight: 700;
  transition: border-color 0.2s, transform 0.15s;
}

.dash-action:hover {
  border-color: rgba(13, 159, 138, 0.4);
  transform: translateY(-1px);
}

.dash-action span {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
}

.recent-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.recent-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.recent-photo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(18, 32, 46, 0.06);
  flex-shrink: 0;
}

.recent-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.recent-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font-weight: 800;
  color: var(--accent-deep);
  font-family: var(--font-display);
}

.recent-name {
  font-weight: 700;
  font-size: 0.92rem;
}

.recent-meta {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
}

.admin-empty {
  color: var(--muted);
  font-size: 0.92rem;
  padding: 0.5rem 0;
}

/* Content width helpers inside admin */
.admin-content .page {
  width: 100%;
  max-width: 720px;
  margin: 0;
  padding: 0;
}

.admin-content .records-page {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

.admin-backdrop {
  display: none;
}

@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-panels { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .admin-shell { grid-template-columns: 1fr; }

  .admin-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(280px, 86vw);
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    box-shadow: 20px 0 50px rgba(18, 32, 46, 0.15);
  }

  .admin-shell.nav-open .admin-sidebar {
    transform: translateX(0);
  }

  .admin-menu-btn { display: inline-grid; place-items: center; }

  .admin-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(10, 16, 24, 0.35);
    z-index: 25;
  }

  .admin-backdrop[hidden] { display: none !important; }

  .admin-content { padding: 1rem 1rem 2rem; }
  .admin-topbar { padding: 0.85rem 1rem; }
  .dash-grid { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
}

@media (max-width: 480px) {
  .dash-grid { grid-template-columns: 1fr; }
  .admin-topbar-meta { display: none; }
}
