/* =========================================================
   Extra pages — detail, auth, dashboard
   ========================================================= */

.page-shell {
  width: min(100% - 2rem, var(--max));
  margin: 0 auto;
}

.detail-page {
  overflow-x: hidden;
}

.page-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.75rem 1rem;
  width: min(100% - 2rem, var(--max));
  margin: 0.9rem auto 0;
  padding: 0.55rem 0.7rem 0.55rem 0.75rem;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-pill);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
}

.page-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.page-back {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--ink-soft);
  white-space: nowrap;
  transition: color 0.2s ease;
}

.page-back:hover {
  color: var(--accent-deep);
}

.page-header-nav {
  display: flex;
  justify-content: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.page-header .nav-link {
  padding: 0.55rem 1rem;
}

.page-header-cta {
  display: inline-flex !important;
  padding: 0.65rem 1.1rem;
  white-space: nowrap;
}

.eyebrow {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.55rem;
}

/* ---------- Project detail ---------- */

.detail-hero {
  width: min(100% - 2rem, var(--max));
  margin: 1.5rem auto 0;
  position: relative;
  min-height: clamp(360px, 52vh, 560px);
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--ink);
  color: #fff;
}

.detail-hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.72;
  transform: scale(1);
  transition: transform 1s cubic-bezier(0.22, 1, 0.36, 1);
}

.detail-hero:hover img {
  transform: scale(1.06);
}

.detail-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(0, 0, 0, 0.82) 10%, rgba(0, 0, 0, 0.35) 70%);
  pointer-events: none;
}

.detail-zoom-btn {
  position: absolute;
  top: 1.1rem;
  right: 1.1rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: zoom-in;
  backdrop-filter: blur(10px);
  transition: background 0.25s ease, transform 0.25s ease;
}

.detail-zoom-btn:hover {
  background: rgba(47, 107, 255, 0.9);
  transform: translateY(-1px);
}

.detail-hero-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: inherit;
  padding: clamp(1.5rem, 4vw, 3rem);
  max-width: 820px;
}

.detail-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 4.5vw, 3.6rem);
  line-height: 1.08;
  letter-spacing: -0.04em;
  margin: 0.4rem 0 1rem;
  overflow-wrap: anywhere;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.95rem;
  font-weight: 600;
}

.detail-body {
  width: min(100% - 2rem, var(--max));
  margin: 2.5rem auto 0;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.8fr);
  gap: 2rem;
  align-items: start;
}

.detail-side-cta {
  width: 100%;
  margin-top: 1.25rem;
}

.detail-footer {
  margin-bottom: 2rem;
}

.detail-copy h2 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}

.detail-copy p {
  color: var(--ink-soft);
  font-size: 1.08rem;
  line-height: 1.7;
  margin-bottom: 1rem;
  white-space: pre-line;
}

.detail-side {
  position: sticky;
  top: 6rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1.4rem;
  box-shadow: var(--shadow-soft);
}

.detail-side dl {
  display: grid;
  gap: 1rem;
}

.detail-side dt {
  font-size: 0.8rem;
  color: var(--ink-mute);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.detail-side dd {
  font-weight: 700;
  margin-top: 0.2rem;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.35rem;
}

.tag {
  display: inline-flex;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 0.82rem;
  font-weight: 700;
}

.detail-gallery {
  width: min(100% - 2rem, var(--max));
  margin: 3rem auto 0;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 1rem;
}

.detail-gallery img {
  width: 100%;
  height: 100%;
  min-height: 240px;
  object-fit: cover;
  border-radius: var(--radius-md);
  background: #111;
  cursor: zoom-in;
  transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.35s ease;
}

.detail-gallery img:hover {
  transform: scale(1.02);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
}

.detail-gallery img:first-child {
  grid-row: span 2;
  min-height: 500px;
}

/* ---------- Lightbox ---------- */

body.is-lightbox-open {
  overflow: hidden;
}

.lightbox[hidden] {
  display: none !important;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 10, 16, 0.88);
  backdrop-filter: blur(8px);
}

.lightbox-stage {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 4.5rem 4rem 5.5rem;
}

.lightbox-frame {
  width: min(100%, 1100px);
  height: min(100%, 78vh);
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 18px;
}

.lightbox-frame.is-zoomed {
  cursor: grab;
}

.lightbox-frame.is-zoomed:active {
  cursor: grabbing;
}

.lightbox-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 12px;
  transform-origin: center center;
  transition: transform 0.15s ease-out;
  user-select: none;
  -webkit-user-drag: none;
}

.lightbox-close,
.lightbox-nav,
.lightbox-tool {
  appearance: none;
  border: 0;
  font: inherit;
  cursor: pointer;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  transition: background 0.2s ease, transform 0.2s ease;
}

.lightbox-close:hover,
.lightbox-nav:hover,
.lightbox-tool:hover {
  background: rgba(47, 107, 255, 0.95);
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.6rem;
  line-height: 1;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 1.8rem;
  line-height: 1;
}

.lightbox-prev {
  left: 1rem;
}

.lightbox-next {
  right: 1rem;
}

.lightbox-toolbar {
  position: absolute;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  display: inline-flex;
  gap: 0.45rem;
  padding: 0.35rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(10px);
}

.lightbox-tool {
  min-width: 44px;
  height: 40px;
  padding: 0 0.85rem;
  border-radius: 999px;
  font-weight: 700;
}

.detail-next {
  width: min(100% - 2rem, var(--max));
  margin: 3.5rem auto 3rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1.5rem 1.75rem;
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius-lg);
}

.detail-next p {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.detail-next strong {
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

/* ---------- Auth ---------- */

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
  background:
    radial-gradient(900px 500px at 85% 10%, rgba(47, 107, 255, 0.16), transparent 55%),
    radial-gradient(700px 400px at 10% 90%, rgba(47, 107, 255, 0.08), transparent 50%),
    var(--bg);
}

.auth-card {
  width: min(100%, 440px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(1.75rem, 4vw, 2.5rem);
  box-shadow: var(--shadow-soft);
}

.auth-card h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
}

.auth-sub {
  color: var(--ink-soft);
  margin-bottom: 1.5rem;
}

.auth-form {
  display: grid;
  gap: 1rem;
}

.auth-form label {
  display: grid;
  gap: 0.4rem;
}

.auth-form label span,
.form-grid label > span {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.auth-form input,
.form-grid input,
.form-grid textarea,
.form-grid select {
  width: 100%;
  padding: 0.9rem 1rem;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: #fafbfe;
  font: inherit;
  color: var(--ink);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-form input:focus,
.form-grid input:focus,
.form-grid textarea:focus,
.form-grid select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.auth-hint {
  margin: 1.25rem 0;
  color: var(--ink-mute);
  font-size: 0.9rem;
}

.alert {
  padding: 0.85rem 1rem;
  border-radius: 14px;
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 1rem;
}

.alert-error {
  background: #ffe8e8;
  color: #b42318;
}

.alert-success {
  background: #e8f8ef;
  color: #067647;
}

.alert-info {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

/* ---------- Dashboard ---------- */

.admin-body {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  background: var(--bg);
  overflow-x: hidden;
}

.admin-overlay {
  display: none;
}

.admin-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 1.25rem 1rem;
  background: var(--ink);
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
}

.admin-sidebar-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 0.4rem 0.75rem;
}

.admin-brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.admin-brand-sub {
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.78rem;
  font-weight: 600;
}

.admin-sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
}

.nav-group {
  margin: 0.85rem 0.6rem 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.35);
}

.admin-sidebar nav a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.72rem 0.85rem;
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.68);
  font-weight: 600;
  font-size: 0.92rem;
  transition: background 0.2s ease, color 0.2s ease;
}

.nav-ico {
  width: 1.1rem;
  text-align: center;
  opacity: 0.8;
}

.admin-sidebar nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.admin-sidebar nav a.is-active {
  background: var(--accent);
  color: #fff;
}

.admin-user {
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: grid;
  gap: 0.75rem;
}

.admin-user-meta {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.admin-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
  line-height: 1;
  flex-shrink: 0;
  overflow: hidden;
}

.admin-user-text {
  min-width: 0;
}

.admin-user-text strong {
  display: block;
  font-size: 0.9rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-user-email {
  display: block;
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-logout {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  font: inherit;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
}

.admin-logout:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.admin-main {
  padding: clamp(1.25rem, 3vw, 2.25rem);
  min-width: 0;
}

.admin-mobile-bar {
  display: none;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.admin-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.admin-top h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  letter-spacing: -0.03em;
}

.admin-lead {
  color: var(--ink-soft);
  margin-top: 0.35rem;
  max-width: 520px;
}

.admin-top-actions {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.quick-card {
  display: grid;
  gap: 0.35rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.03);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.quick-card:hover {
  transform: translateY(-3px);
  border-color: rgba(47, 107, 255, 0.35);
  box-shadow: 0 14px 30px rgba(47, 107, 255, 0.1);
}

.quick-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-weight: 800;
  margin-bottom: 0.35rem;
}

.quick-card strong {
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.quick-card p {
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.4;
}

.quick-go {
  margin-top: 0.45rem;
  color: var(--accent-deep);
  font-weight: 700;
  font-size: 0.88rem;
}

.admin-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.admin-section-head h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.recent-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.recent-card {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 0.9rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.recent-card img {
  width: 100%;
  height: 100%;
  min-height: 110px;
  object-fit: cover;
}

.recent-card-body {
  padding: 0.9rem 0.9rem 0.9rem 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.recent-cat {
  color: var(--ink-mute);
  font-size: 0.78rem;
  font-weight: 700;
}

.recent-card-body h3 {
  font-size: 0.98rem;
  line-height: 1.3;
  margin: 0.2rem 0 0.65rem;
}

.recent-actions {
  display: flex;
  gap: 0.75rem;
}

.recent-actions a,
.action-btn {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-deep);
}

.action-btn {
  display: inline-flex;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  background: var(--accent-soft);
}

.action-btn-edit {
  background: #eef2ff;
}

.action-btn-danger,
.admin-actions button.action-btn-danger {
  background: #ffe8e8;
  color: #b42318;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1.2rem 1.3rem;
}

.stat-card strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.8rem;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 0.35rem;
}

.stat-card span {
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 600;
}

.stat-card small {
  display: block;
  margin-top: 0.45rem;
  color: var(--ink-mute);
  font-size: 0.8rem;
  font-weight: 600;
}

.traffic-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.traffic-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.03);
  margin-bottom: 1.25rem;
  min-width: 0;
}

.traffic-card h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.traffic-bars {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.65rem;
  align-items: end;
  min-height: 160px;
}

.traffic-bar-item {
  display: grid;
  justify-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.traffic-bar-track {
  width: 100%;
  max-width: 42px;
  height: 120px;
  border-radius: 999px;
  background: #eef2ff;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.traffic-bar-fill {
  width: 100%;
  min-height: 6%;
  background: linear-gradient(180deg, #5b8cff, var(--accent));
  border-radius: 999px;
}

.traffic-bar-item strong {
  font-size: 0.85rem;
}

.traffic-bar-item span {
  font-size: 0.72rem;
  color: var(--ink-mute);
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.traffic-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}

.traffic-split > .traffic-card {
  margin-bottom: 0;
}

.traffic-card .admin-table-wrap {
  box-shadow: none;
  border: 0;
  border-radius: 0;
  max-width: 100%;
}

.traffic-card .admin-table {
  min-width: 0;
  table-layout: fixed;
}

.traffic-card .admin-table th,
.traffic-card .admin-table td {
  padding: 0.75rem 0.55rem;
}

.traffic-card .admin-table code,
.traffic-card .admin-table td {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.traffic-card .admin-table:not(.traffic-recent-table) th:last-child,
.traffic-card .admin-table:not(.traffic-recent-table) td:last-child {
  width: 4.5rem;
  white-space: nowrap;
}

.traffic-recent-table {
  min-width: 420px;
}

.traffic-recent-table th:nth-child(1),
.traffic-recent-table td:nth-child(1) {
  width: 6.5rem;
  white-space: nowrap;
}

.traffic-recent-table th:nth-child(3),
.traffic-recent-table td:nth-child(3) {
  width: 7.5rem;
  white-space: nowrap;
}

.admin-table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: var(--shadow-soft);
  max-width: 100%;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.admin-table th,
.admin-table td {
  padding: 1rem 1.1rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.admin-table th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-mute);
  background: #fafbfe;
}

.admin-table tr:last-child td {
  border-bottom: 0;
}

.admin-project-cell {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.admin-project-cell img {
  width: 56px;
  height: 42px;
  object-fit: cover;
  border-radius: 10px;
  background: #111;
}

.admin-project-cell strong {
  display: block;
  font-size: 0.95rem;
}

.admin-project-cell span {
  color: var(--ink-mute);
  font-size: 0.82rem;
}

.admin-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  white-space: nowrap;
}

.admin-actions a,
.admin-actions button {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent-deep);
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0;
}

.admin-actions button {
  color: #b42318;
}

.badge {
  display: inline-flex;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 700;
}

.badge-yes {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.badge-no {
  background: #f1f2f5;
  color: var(--ink-mute);
}

.empty-state {
  text-align: center;
  padding: 3.5rem 1.5rem;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
}

.empty-state h2 {
  font-family: var(--font-display);
  margin-bottom: 0.5rem;
}

.empty-state p {
  color: var(--ink-soft);
  margin-bottom: 1.25rem;
}

.form-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: clamp(1.25rem, 3vw, 2rem);
  box-shadow: var(--shadow-soft);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 1.15rem;
}

.form-grid label {
  display: grid;
  gap: 0.4rem;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.form-grid textarea {
  min-height: 140px;
  resize: vertical;
}

.form-check {
  display: flex !important;
  align-items: center;
  gap: 0.65rem;
  grid-template-columns: none !important;
}

.form-check input {
  width: auto;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.25rem;
}

.admin-mobile-toggle {
  display: none;
}

.upload-preview {
  background: #f7f8fb;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.85rem;
}

.upload-preview p {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 0.55rem;
}

.upload-preview img {
  max-width: 220px;
  max-height: 180px;
  object-fit: cover;
  border-radius: 12px;
}

.upload-preview-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.gallery-keep-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}

.gallery-keep-item {
  display: grid;
  gap: 0.45rem;
  background: #f7f8fb;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.55rem;
}

.gallery-keep-item img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  border-radius: 8px;
}

.gallery-keep-item span {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 700;
}

input[type="file"] {
  width: 100%;
  padding: 0.75rem;
  border: 1.5px dashed rgba(47, 107, 255, 0.35);
  border-radius: 14px;
  background: #f7f9ff;
  font: inherit;
}

@media (max-width: 980px) {
  .detail-body,
  .detail-gallery {
    grid-template-columns: 1fr;
  }

  .detail-gallery img:first-child {
    grid-row: auto;
    min-height: 280px;
  }

  .detail-side {
    position: static;
  }

  .page-header-nav {
    display: none;
  }

  .page-header {
    grid-template-columns: 1fr auto;
  }

  .admin-body {
    grid-template-columns: 1fr;
  }

  .admin-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 55;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  .admin-body.sidebar-open .admin-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  .admin-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(84vw, 300px);
    z-index: 60;
    transform: translateX(-105%);
    transition: transform 0.3s ease;
  }

  .admin-body.sidebar-open .admin-sidebar {
    transform: translateX(0);
  }

  .admin-mobile-bar,
  .admin-mobile-toggle {
    display: flex;
  }

  .admin-stats,
  .quick-grid,
  .recent-grid,
  .traffic-summary,
  .traffic-split {
    grid-template-columns: 1fr;
  }

  .traffic-bars {
    gap: 0.35rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
  }

  .traffic-bar-item span {
    font-size: 0.65rem;
  }

  .recent-card {
    grid-template-columns: 96px 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1200px) {
  .traffic-split {
    grid-template-columns: 1fr;
  }

  .traffic-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .traffic-summary .stat-card:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1100px) and (min-width: 981px) {
  .quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .traffic-summary {
    grid-template-columns: 1fr;
  }

  .traffic-summary .stat-card:last-child {
    grid-column: auto;
  }

  .admin-top {
    align-items: flex-start;
  }

  .traffic-card {
    padding: 1rem;
  }

  .admin-table {
    min-width: 560px;
  }

  .admin-table th,
  .admin-table td {
    padding: 0.75rem 0.8rem;
  }
}

@media (max-width: 760px) {
  .page-header {
    width: min(100% - 1.25rem, var(--max));
    margin-top: 0.75rem;
    padding: 0.5rem 0.55rem 0.5rem 0.6rem;
  }

  .page-back {
    font-size: 0.85rem;
  }

  .page-header-cta {
    padding: 0.55rem 0.9rem;
    font-size: 0.88rem;
  }

  .detail-hero {
    width: min(100% - 1.25rem, var(--max));
    margin-top: 1rem;
    min-height: 340px;
    border-radius: 28px;
  }

  .detail-hero-content {
    padding: 1.25rem;
  }

  .detail-zoom-btn {
    top: 0.85rem;
    right: 0.85rem;
    padding: 0.45rem 0.7rem;
    font-size: 0.8rem;
  }

  .lightbox-stage {
    padding: 4rem 0.75rem 5rem;
  }

  .lightbox-nav {
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
  }

  .lightbox-prev {
    left: 0.4rem;
  }

  .lightbox-next {
    right: 0.4rem;
  }

  .detail-body,
  .detail-gallery,
  .detail-next {
    width: min(100% - 1.25rem, var(--max));
  }

  .detail-next {
    flex-direction: column;
    align-items: flex-start;
  }
}
