:root {
  --ink: #172033;
  --muted: #7b8498;
  --line: #e8ebf1;
  --surface: #f5f6fa;
  --blue: #4969ed;
  --blue-soft: #edf1ff;
  --white: #fff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: "DM Sans", sans-serif;
  color: var(--ink);
  background: var(--surface);
}

button, input { font: inherit; }
button { cursor: pointer; }
.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 20px;
  background: #f5f6fa;
}
.auth-screen.hidden { display: none; }
.auth-card {
  width: min(390px, 100%);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
  background: white;
  box-shadow: 0 18px 50px rgba(32,42,67,.10);
}
.auth-brand { padding: 0 0 24px; }
.auth-heading h1 { margin: 0; font-family: "Manrope", sans-serif; font-size: 24px; }
.auth-heading p { margin: 7px 0 20px; color: var(--muted); font-size: 13px; }
.auth-card label { display: block; margin-top: 14px; }
.auth-card label span { display: block; margin-bottom: 7px; color: #697187; font-size: 12px; font-weight: 600; }
.auth-card input { width: 100%; height: 44px; border: 1px solid #dde2ec; border-radius: 8px; padding: 0 12px; outline: none; }
.auth-card input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.auth-error { min-height: 18px; margin: 8px 0 4px; color: #d84c5d; font-size: 12px; }
.auth-submit { width: 100%; height: 44px; border: 0; border-radius: 8px; color: white; background: var(--blue); font-weight: 700; }
.auth-switch { width: 100%; margin-top: 12px; border: 0; color: var(--blue); background: transparent; font-size: 12px; }
.app { min-height: 100vh; display: grid; grid-template-columns: 244px 1fr; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 244px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  padding: 24px 18px 18px;
  background: var(--white);
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 30px;
  color: var(--ink);
  text-decoration: none;
  font-family: "Manrope", sans-serif;
  font-size: 20px;
  font-weight: 800;
}
.brand-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: white;
  background: var(--blue);
}
.brand-icon svg { width: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.brand-icon circle { fill: var(--blue); stroke: white; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  height: 44px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 9px;
  padding: 0 12px;
  color: #697187;
  background: transparent;
  text-align: left;
  font-size: 14px;
  font-weight: 600;
}
.nav-item svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}
.nav-item.active { color: var(--blue); background: var(--blue-soft); }

.storage { margin: auto 8px 20px; }
.storage-row { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }
.storage-row strong { color: #586176; }
.storage-track { height: 5px; margin-top: 9px; overflow: hidden; border-radius: 5px; background: #edf0f5; }
.storage-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--blue); transition: width .25s; }

.profile {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-top: 1px solid var(--line);
  padding: 16px 8px 0;
  color: var(--ink);
  background: transparent;
  text-align: left;
}
.avatar {
  width: 36px;
  height: 36px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: #202a43;
  font-size: 13px;
  font-weight: 700;
}
.profile strong, .profile small { display: block; }
.profile strong { font-size: 12px; }
.profile small { margin-top: 3px; color: var(--muted); font-size: 10px; }

.main { grid-column: 2; min-width: 0; }
.topbar {
  height: 78px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 34px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.92);
}
.mobile-menu { display: none; }
.search {
  width: min(480px, 44vw);
  height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 14px;
  border: 1px solid #e5e8ef;
  border-radius: 9px;
  background: #f8f9fb;
}
.search svg { width: 17px; fill: none; stroke: #949bab; stroke-width: 1.8; }
.search input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 13px; }
.search input::placeholder { color: #a0a6b3; }
.upload-button {
  height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  color: white;
  background: var(--blue);
  box-shadow: 0 7px 18px rgba(73,105,237,.18);
  font-size: 13px;
  font-weight: 700;
}
.upload-button svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.content { padding: 30px 34px 40px; }
.content-header { display: flex; align-items: end; justify-content: space-between; margin-bottom: 22px; }
.eyebrow { margin: 0 0 5px; color: var(--muted); font-size: 11px; }
.content-header h1 { margin: 0; font-family: "Manrope", sans-serif; font-size: 25px; letter-spacing: -.5px; }
.sort-button {
  height: 36px;
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 10px;
  color: #697187;
  background: white;
  font-size: 11px;
}
.sort-button svg { width: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; }

.drop-zone {
  min-height: 98px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 20px;
  border: 1.5px dashed #d8deec;
  border-radius: 12px;
  color: #6d7588;
  background: rgba(255,255,255,.58);
  transition: .18s ease;
}
.drop-zone.dragging { border-color: var(--blue); background: var(--blue-soft); transform: scale(.995); }
.drop-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--blue);
  background: var(--blue-soft);
}
.drop-icon svg { width: 25px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.drop-zone strong { color: #50596d; font-size: 13px; }
.drop-zone p { margin: 4px 0 0; color: #9aa1af; font-size: 11px; }

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}
.photo-card {
  position: relative;
  aspect-ratio: 1 / .82;
  overflow: hidden;
  border-radius: 10px;
  background: #e7eaf0;
  box-shadow: 0 3px 12px rgba(35,45,70,.06);
  cursor: pointer;
}
.photo-card img { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .25s ease; }
.photo-card:hover img { transform: scale(1.035); }
.photo-actions {
  position: absolute;
  right: 8px;
  top: 8px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity .18s;
}
.photo-card:hover .photo-actions { opacity: 1; }
.photo-action {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #596176;
  background: rgba(255,255,255,.94);
  box-shadow: 0 3px 10px rgba(0,0,0,.12);
}
.photo-action.favorite.active { color: #e7586a; }
.photo-action svg { width: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.photo-action.favorite.active svg { fill: currentColor; }

.empty-state {
  grid-column: 1 / -1;
  min-height: 260px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
}
.empty-state strong { display: block; color: #626b7d; margin-bottom: 6px; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 54px;
  visibility: hidden;
  opacity: 0;
  background: rgba(13,20,35,.92);
  transition: .2s;
}
.lightbox.open { visibility: visible; opacity: 1; }
.lightbox img { max-width: 88vw; max-height: 82vh; border-radius: 8px; object-fit: contain; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.lightbox-close, .lightbox-action {
  position: absolute;
  top: 22px;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 50%;
  color: white;
  background: rgba(255,255,255,.08);
  font-size: 25px;
}
.lightbox-close { right: 24px; }
.lightbox-action { right: 76px; }
.lightbox-action svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.lightbox-meta { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; gap: 12px; color: white; text-align: center; font-size: 12px; }
.lightbox-meta span { color: #adb4c2; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 200;
  transform: translate(-50%, 30px);
  padding: 10px 15px;
  border-radius: 8px;
  color: white;
  background: #202a43;
  opacity: 0;
  font-size: 12px;
  transition: .25s;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { transform: translateX(-100%); transition: transform .22s; box-shadow: 10px 0 30px rgba(20,30,50,.12); }
  .sidebar.open { transform: translateX(0); }
  .main { grid-column: 1; }
  .topbar { height: 68px; padding: 0 16px; }
  .mobile-menu { display: grid; width: 38px; height: 38px; place-items: center; border: 0; background: transparent; color: var(--ink); font-size: 20px; }
  .search { width: auto; flex: 1; }
  .upload-button { width: 42px; justify-content: center; padding: 0; }
  .upload-button span { display: none; }
  .content { padding: 22px 16px 30px; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .drop-zone { min-height: 110px; padding: 14px; text-align: center; }
  .drop-zone .drop-icon { display: none; }
  .sort-button span { display: none; }
  .photo-actions { opacity: 1; }
  .lightbox { padding: 16px; }
}
