:root {
  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-sans: "DM Sans", system-ui, sans-serif;
  --bg: #000;
  --bg-panel: #0a0a0a;
  --bg-panel-2: #171717;
  --bg-input: #171717;
  --text: #f5f5f5;
  --text-muted: #737373;
  --text-dim: #525252;
  --border: #262626;
  --border-light: #404040;
  --red: #f87171;
  --amber: #fbbf24;
  --emerald: #34d399;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; color-scheme: dark; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.font-display { font-family: var(--font-display); font-weight: 400; }
.label-xs {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--text-muted);
}
.input-dark {
  width: 100%;
  border: 1px solid var(--border-light);
  background: var(--bg-input);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
.input-dark:focus { border-color: #737373; }
.input-dark::placeholder { color: var(--text-muted); }
.btn-white {
  background: #fff;
  color: #000;
  border: none;
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  transition: background 0.15s;
}
.btn-white:hover { background: #e5e5e5; }
.btn-white:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-outline {
  border: 1px solid var(--border-light);
  background: transparent;
  color: var(--text);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  transition: all 0.15s;
}
.btn-outline:hover { background: #fff; color: #000; }
.btn-outline:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.btn-ghost:hover { color: #fff; border-color: #525252; }
.text-error { color: var(--red); font-size: 11px; margin-top: 4px; }
.app-main { flex: 1; display: flex; flex-direction: column; min-height: 0; background: var(--bg); }

/* Footer */
.site-footer {
  flex-shrink: 0;
  border-top: 1px solid #171717;
  background: var(--bg);
  padding: 1rem;
  text-align: center;
}
.site-footer p {
  margin: 0;
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

/* Home */
.home-page { flex: 1; display: flex; flex-direction: column; background: var(--bg); }
.home-bar {
  height: 20vh;
  min-height: 120px;
  max-height: 200px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel);
}
.home-bar-inner {
  height: 100%;
  max-width: 80rem;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: stretch;
  gap: 1rem;
}
.home-logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  padding-right: 1rem;
  border-right: 1px solid var(--border);
}
.home-form {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0.75rem 0;
}
.home-form .row { display: flex; gap: 0.5rem; margin-top: 0.375rem; }
.home-form .row .input-dark { flex: 1; min-width: 0; padding: 0.5rem 0.75rem; font-size: 0.875rem; }
.home-form .input-email { padding: 0.375rem 0.75rem; font-size: 0.75rem; }
.home-form .btn-white, .home-form .btn-outline { flex-shrink: 0; padding: 0.5rem 1rem; }
.home-form .code-input { text-align: center; letter-spacing: 0.25em; text-transform: uppercase; }
.home-divider { width: 1px; background: var(--border); flex-shrink: 0; margin: 1rem 0; }
.home-body { flex: 1; background: var(--bg); }

/* Center states */
.center-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2rem;
  text-align: center;
  background: var(--bg);
}
.center-page h1 { font-family: var(--font-display); font-size: 1.5rem; font-weight: 400; color: #d4d4d4; margin: 0; }
.center-page p { color: var(--text-muted); font-size: 0.875rem; max-width: 28rem; line-height: 1.6; margin: 0; }
.center-page a { color: var(--text-muted); font-size: 0.875rem; text-decoration: underline; }
.center-page a:hover { color: #fff; }

/* Gallery client */
.gallery-main { flex: 1; background: var(--bg); color: #fff; }
.gallery-sticky {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(0,0,0,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.gallery-sticky-inner {
  max-width: 80rem;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
@media (min-width: 640px) {
  .gallery-sticky-inner { flex-direction: row; align-items: center; justify-content: space-between; }
}
.gallery-sticky h1 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 300;
  margin: 0.5rem 0 0.25rem;
}
@media (min-width: 768px) { .gallery-sticky h1 { font-size: 1.875rem; } }
.gallery-sticky .client-name { font-size: 0.875rem; color: var(--text-muted); margin: 0; }
.gallery-days {
  font-size: 10px;
  color: rgba(251,191,36,0.9);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 0.5rem;
}
.gallery-download { align-self: flex-start; padding: 0.625rem 1.5rem; }
@media (min-width: 640px) { .gallery-download { align-self: auto; } }
.gallery-masonry {
  max-width: 80rem;
  margin: 0 auto;
  padding: 2rem 1rem;
  columns: 1;
  column-gap: 0.75rem;
}
@media (min-width: 640px) { .gallery-masonry { columns: 2; padding: 2rem 1.5rem; } }
@media (min-width: 1024px) { .gallery-masonry { columns: 3; } }
.gallery-masonry-item {
  break-inside: avoid;
  margin-bottom: 0.75rem;
  display: block;
  width: 100%;
  border: none;
  padding: 0;
  background: none;
  overflow: hidden;
  cursor: pointer;
}
.gallery-masonry-item img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.5s;
}
.gallery-masonry-item:hover img { transform: scale(1.02); }
.gallery-foot {
  padding: 3rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  border-bottom: 1px solid #171717;
}

/* Access modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0,0,0,0.8);
}
.modal-card {
  width: 100%;
  max-width: 28rem;
  background: var(--bg-panel);
  border: 1px solid var(--border-light);
  padding: 1.5rem;
  animation: fadeUp 0.7s ease forwards;
}
.modal-card h2 { font-family: var(--font-display); font-size: 1.5rem; color: #fff; margin: 0 0 0.75rem; }
.modal-card p { color: #d4d4d4; line-height: 1.6; margin: 0 0 0.5rem; }
.modal-card .modal-sub { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 1.5rem; }
.modal-card .modal-note { font-size: 0.75rem; color: var(--text-dim); margin-bottom: 1.5rem; }
.modal-card .btn-white { width: 100%; padding: 0.75rem; letter-spacing: 0.2em; }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0,0,0,0.95);
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox img { max-height: 90vh; max-width: 92vw; object-fit: contain; }
.lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.lightbox-close:hover { color: #fff; }
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 2rem;
  padding: 0 1rem;
}
.lightbox-nav:hover { color: #fff; }
.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }
.lightbox-dl {
  position: absolute;
  bottom: 2rem;
  background: none;
  border: 1px solid rgba(255,255,255,0.3);
  color: rgba(255,255,255,0.7);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.5rem 1.25rem;
}
.lightbox-dl:hover { color: #fff; }

/* Admin */
.admin-shell { flex: 1; display: flex; flex-direction: column; background: var(--bg); color: #fff; min-height: 0; }
.admin-top {
  height: 3.5rem;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel);
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.admin-top .staff-label {
  flex: 1;
  text-align: center;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-top-actions { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; }
.admin-top-actions button, .admin-top-actions .btn-ghost { padding: 0.375rem 0.75rem; }
.admin-top-actions .btn-logout {
  background: none;
  border: none;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}
.admin-top-actions .btn-logout:hover { color: #fff; }
.notif-badge {
  display: inline-block;
  background: #dc2626;
  color: #fff;
  font-size: 9px;
  padding: 0 0.35rem;
  border-radius: 999px;
  margin-left: 0.25rem;
}
.admin-split { flex: 1; display: flex; min-height: 0; }
.admin-sidebar {
  width: 100%;
  max-width: 300px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--bg-panel);
  display: flex;
  flex-direction: column;
}
.admin-sidebar-top { padding: 1rem; border-bottom: 1px solid var(--border); }
.admin-sidebar-top .btn-white { width: 100%; padding: 0.625rem; letter-spacing: 0.2em; }
.new-session-form {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-input);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.new-session-form .input-dark { padding: 0.5rem 0.75rem; font-size: 0.875rem; }
.new-session-form .upper { text-transform: uppercase; letter-spacing: 0.1em; }
.new-session-form .btn-outline { width: 100%; padding: 0.5rem; }
.admin-list-wrap { flex: 1; overflow-y: auto; padding: 0.5rem; }
.session-list { list-style: none; margin: 0; padding: 0; }
.session-row { display: flex; align-items: center; gap: 0.25rem; margin-bottom: 0.25rem; }
.session-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  text-align: left;
  padding: 0.625rem 0.5rem;
  border: none;
  background: transparent;
  color: inherit;
  border-radius: 2px;
  transition: background 0.15s;
}
.session-btn:hover, .session-btn.active { background: var(--bg-input); }
.session-cover {
  width: 2.5rem;
  height: 2.5rem;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--border);
}
.session-cover-empty { width: 2.5rem; height: 2.5rem; background: var(--border); flex-shrink: 0; }
.session-info { min-width: 0; flex: 1; }
.session-info .name-row { display: flex; align-items: center; gap: 0.5rem; }
.session-info .name { font-size: 0.875rem; font-weight: 500; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-info .meta { font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge-sm {
  flex-shrink: 0;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.125rem 0.375rem;
  border: 1px solid;
}
.badge-active { border-color: rgba(6,78,59,0.6); color: var(--emerald); }
.badge-expired { border-color: rgba(120,53,15,0.6); color: var(--amber); }
.badge-readonly { display: inline-block; margin-top: 2px; font-size: 9px; text-transform: uppercase; letter-spacing: 0.05em; padding: 0.125rem 0.375rem; border: 1px solid var(--border-light); color: #a3a3a3; }
.session-del {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  margin-right: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--red);
  border: 1px solid transparent;
  background: transparent;
  border-radius: 2px;
  opacity: 1;
}
@media (min-width: 640px) { .session-del { opacity: 0; } .session-row:hover .session-del { opacity: 1; } }
.session-del:hover { border-color: rgba(127,29,29,0.6); background: rgba(69,10,10,0.4); }

.admin-panel { flex: 1; min-width: 0; overflow-y: auto; background: var(--bg); }
.admin-empty {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
}
.admin-empty h2 { font-family: var(--font-display); font-size: 1.5rem; color: #a3a3a3; margin: 0 0 0.5rem; }
.admin-empty p { font-size: 0.875rem; color: var(--text-muted); max-width: 24rem; margin: 0 auto; }
.admin-detail { padding: 1.5rem; max-width: 64rem; animation: fadeUp 0.7s ease forwards; }
.admin-error {
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: var(--red);
  background: rgba(69,10,10,0.4);
  border: 1px solid rgba(127,29,29,0.5);
  padding: 0.5rem 1rem;
}
.admin-readonly {
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: #d4d4d4;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  padding: 0.5rem 1rem;
}
.detail-head { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.5rem; }
@media (min-width: 640px) { .detail-head { flex-direction: row; align-items: flex-start; justify-content: space-between; } }
.detail-head h2 { font-family: var(--font-display); font-size: 1.875rem; margin: 0; }
.detail-head .subtitle { color: var(--text-muted); margin: 0.25rem 0 0; }
.detail-head .code-line { font-size: 0.875rem; margin-top: 0.5rem; }
.detail-head .code-line strong { letter-spacing: 0.25em; }
.detail-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.5rem; }
.detail-meta .status-active { color: var(--emerald); }
.detail-meta .status-expired { color: var(--amber); }
.detail-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; flex-shrink: 0; }
.detail-actions .btn-outline, .detail-actions .btn-danger-outline { padding: 0.5rem 0.75rem; font-size: 10px; letter-spacing: 0.1em; }
.btn-danger-outline {
  border: 1px solid rgba(127,29,29,0.6);
  background: transparent;
  color: var(--red);
  text-transform: uppercase;
}
.btn-danger-outline:hover { background: rgba(69,10,10,0.5); }

.upload-zone {
  display: block;
  border: 2px dashed var(--border-light);
  background: var(--bg-input);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  margin-bottom: 1.5rem;
  transition: border-color 0.15s, background 0.15s;
}
.upload-zone:hover, .upload-zone.drag { border-color: #737373; background: var(--bg-panel); }
.upload-zone .title { font-family: var(--font-display); font-size: 1.25rem; margin: 0 0 0.25rem; }
.upload-zone .hint { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.1em; margin: 0; }
.upload-readonly {
  border: 1px dashed var(--border);
  background: rgba(23,23,23,0.5);
  padding: 1.5rem;
  text-align: center;
  margin-bottom: 1.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}
.photos-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.photos-head h3 { font-size: 10px; text-transform: uppercase; letter-spacing: 0.2em; color: var(--text-muted); margin: 0; }
.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}
@media (min-width: 640px) { .photo-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .photo-grid { grid-template-columns: repeat(4, 1fr); } }
.photo-card {
  position: relative;
  background: var(--bg-input);
  border: 1px solid var(--border);
  overflow: hidden;
}
.photo-card img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.photo-card .overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0);
  transition: background 0.15s;
}
.photo-card:hover .overlay { background: rgba(0,0,0,0.4); }
.photo-card .del {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  min-width: 1.75rem;
  height: 1.75rem;
  background: #dc2626;
  color: #fff;
  border: none;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
}
@media (min-width: 640px) { .photo-card .del { opacity: 0.8; } .photo-card:hover .del { opacity: 1; } }
.photo-card .fname {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.375rem 0.5rem;
  font-size: 10px;
  color: #fff;
  background: rgba(0,0,0,0.5);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.15s;
}
.photo-card:hover .fname { opacity: 1; }
.photos-empty {
  font-size: 0.875rem;
  color: var(--text-muted);
  border: 1px dashed var(--border-light);
  background: var(--bg-input);
  padding: 2rem;
  text-align: center;
}

/* Modals admin */
.panel-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0,0,0,0.8);
}
.panel {
  width: 100%;
  max-width: 32rem;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-panel);
  border: 1px solid var(--border-light);
  padding: 1.5rem;
}
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.panel h3 { font-family: var(--font-display); font-size: 1.25rem; margin: 0; }
.panel-close { background: none; border: none; color: var(--text-muted); font-size: 1.25rem; line-height: 1; }
.panel-close:hover { color: #fff; }
.panel form { display: flex; flex-direction: column; gap: 0.5rem; }
.panel .input-dark { padding: 0.5rem 0.75rem; font-size: 0.875rem; }
.panel-list { list-style: none; margin: 1rem 0 0; padding: 0; }
.panel-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}
.panel-actions { display: flex; gap: 0.5rem; margin-top: 1rem; flex-wrap: wrap; }
.panel-check { display: flex; align-items: flex-start; gap: 0.5rem; font-size: 0.875rem; color: #d4d4d4; line-height: 1.5; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.skeleton {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: linear-gradient(90deg, #1a1a1a 25%, #2a2a2a 50%, #1a1a1a 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@media (max-width: 768px) {
  .home-bar-inner { flex-direction: column; height: auto; min-height: 120px; padding: 1rem; }
  .home-logo { border-right: none; border-bottom: 1px solid var(--border); padding: 0 0 0.75rem; }
  .home-divider { display: none; }
  .admin-split { flex-direction: column; }
  .admin-sidebar { max-width: none; border-right: none; border-bottom: 1px solid var(--border); max-height: 45vh; }
}
