:root {
  --black: #111;
  --dark-gray: #333;
  --mid-gray: #777;
  --light-gray: #e4e4e4;
  --off-white: #f7f7f7;
  --white: #fff;
  --danger: #b00020;
  --success: #1c7a34;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  color: var(--black);
  background: var(--off-white);
}

a { color: inherit; }

.admin-footer {
  text-align: center;
  color: var(--mid-gray);
  font-size: 0.85rem;
  padding: 24px 16px;
}

.admin-topbar {
  background: var(--black);
  color: var(--white);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.admin-topbar .brand { font-weight: 700; letter-spacing: 1px; margin-right: auto; }
.admin-topbar a.logout { color: var(--white); text-decoration: none; font-size: 0.9rem; border: 1px solid rgba(255,255,255,0.4); padding: 6px 12px; border-radius: 4px; }
.admin-topbar a.logout:hover { background: rgba(255,255,255,0.1); }

.hamburger-btn {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
}

.hamburger-btn span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--white);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.hamburger-btn.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-btn.active span:nth-child(2) { opacity: 0; }
.hamburger-btn.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease;
  z-index: 35;
}

.nav-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.admin-nav {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 260px;
  max-width: 80vw;
  background: var(--white);
  border-right: 1px solid var(--light-gray);
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 12px;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  z-index: 40;
}

.admin-nav.open {
  transform: translateX(0);
}

.admin-nav a {
  display: block;
  padding: 12px 14px;
  text-decoration: none;
  font-size: 0.95rem;
  color: var(--dark-gray);
  border-left: 3px solid transparent;
  border-radius: 4px;
  white-space: nowrap;
}

.admin-nav a.active, .admin-nav a:hover {
  color: var(--black);
  background: var(--off-white);
  border-left-color: var(--black);
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 5px;
  border-radius: 999px;
  background: #ed4956;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  vertical-align: 2px;
}

.admin-container {
  max-width: 900px;
  margin: 32px auto;
  padding: 0 24px;
}

.card {
  background: var(--white);
  border: 1px solid var(--light-gray);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 24px;
}

.card h2 {
  margin-top: 0;
  font-size: 1.2rem;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--dark-gray);
}

input[type=text], input[type=email], input[type=password], input[type=number], textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--light-gray);
  border-radius: 6px;
  font-size: 0.95rem;
  margin-bottom: 16px;
  font-family: inherit;
}

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

input[type=file] { margin-bottom: 16px; }

.btn {
  display: inline-block;
  background: var(--black);
  color: var(--white);
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  text-decoration: none;
}

.btn:hover { opacity: 0.85; }
.btn.btn-danger { background: var(--danger); }
.btn.btn-secondary { background: var(--mid-gray); }
.btn.btn-small { padding: 6px 12px; font-size: 0.8rem; }

.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 200px; }

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

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 20px 12px;
  border: 1px solid var(--light-gray);
  border-radius: 8px;
  text-decoration: none;
  text-align: center;
  color: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.stat-item strong { font-size: 1.8rem; line-height: 1; }
.stat-item .muted { font-size: 0.8rem; margin: 0; }

.stat-item:hover {
  border-color: var(--black);
  background: var(--off-white);
}

.stat-item.stat-item-highlight strong { color: #ed4956; }
.stat-item.stat-item-highlight { border-color: #f3bfc8; }

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

table th, table td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--light-gray);
  font-size: 0.9rem;
  vertical-align: middle;
}

table th { color: var(--mid-gray); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; }

.actions-cell { white-space: nowrap; }
.actions-cell > a,
.actions-cell > form {
  display: inline-block;
  vertical-align: middle;
  margin-right: 8px;
}
.actions-cell > a:last-child,
.actions-cell > form:last-child { margin-right: 0; }
.actions-cell form button { vertical-align: middle; }

.flash {
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 20px;
  font-size: 0.9rem;
}

.flash.success { background: #e5f6ea; color: var(--success); border: 1px solid #b8e6c5; }
.flash.error { background: #fbe6e9; color: var(--danger); border: 1px solid #f3bfc8; }

.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-box {
  background: var(--white);
  border: 1px solid var(--light-gray);
  border-radius: 8px;
  padding: 40px;
  width: 100%;
  max-width: 360px;
}

.login-box h1 {
  text-align: center;
  font-size: 1.3rem;
  margin-top: 0;
  letter-spacing: 1px;
}

.thumb-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.thumb-item {
  position: relative;
  width: 110px;
}

.thumb-item img {
  width: 110px;
  height: 90px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--light-gray);
}

.thumb-item form {
  position: absolute;
  top: 4px;
  right: 4px;
}

.thumb-item button {
  background: rgba(176,0,32,0.9);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  cursor: pointer;
  font-size: 0.8rem;
  line-height: 1;
}

.current-photo {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 16px;
  border: 2px solid var(--light-gray);
}

.muted { color: var(--mid-gray); font-size: 0.85rem; }

.back-link {
  display: inline-block;
  color: var(--mid-gray);
  text-decoration: none;
  font-size: 0.85rem;
  margin-bottom: 18px;
}

.back-link:hover { color: var(--black); }

.message-detail-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
}

.message-avatar {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--black);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
}

.message-heading h2 {
  margin: 0 0 4px;
  font-size: 1.25rem;
}

.message-meta-line {
  color: var(--mid-gray);
  font-size: 0.88rem;
}

.message-meta-line .dot { margin: 0 6px; }

.message-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  padding: 16px;
  background: var(--off-white);
  border-radius: 8px;
  margin-bottom: 20px;
}

.message-meta-item { font-size: 0.9rem; }

.message-meta-item .meta-label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--mid-gray);
  margin-bottom: 3px;
}

.message-meta-item a { color: var(--black); text-decoration: none; }
.message-meta-item a:hover { text-decoration: underline; }

.message-body {
  border: 1px solid var(--light-gray);
  border-radius: 8px;
  padding: 20px;
  line-height: 1.6;
  font-size: 0.95rem;
  white-space: pre-wrap;
  margin-bottom: 20px;
}

.message-actions { border-top: 1px solid var(--light-gray); padding-top: 18px; }

@media (max-width: 600px) {
  .admin-topbar { padding: 12px 16px; }
  .admin-nav { width: 82vw; }
  .admin-container { padding: 0 16px; }
}
