:root {
  color-scheme: light;
  --ink: #18211f;
  --muted: #66706d;
  --line: #d9e0dc;
  --panel: #ffffff;
  --canvas: #f4f7f2;
  --wash: #eef4f1;
  --teal: #0b6b68;
  --teal-dark: #084946;
  --gold: #d79032;
  --rose: #a43d4c;
  --shadow: 0 18px 50px rgba(20, 31, 28, 0.16);
  --radius: 8px;
  --topbar: 72px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
}

body.is-lightbox-open {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

.icon-sprite {
  display: none;
}

.icon {
  width: 1.1rem;
  height: 1.1rem;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  fill: none;
  flex: 0 0 auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--topbar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 2rem;
  color: #fff;
  background: rgba(12, 24, 21, 0.9);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.brand-button,
.nav-button,
.icon-button,
.primary-action,
.secondary-action,
.album-card,
.photo-tool {
  border: 0;
}

.brand-button {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  font-weight: 750;
  letter-spacing: 0;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  background: #f6f0e3;
  color: #17211f;
  font-size: 0.8rem;
  font-weight: 850;
}

.main-nav {
  display: inline-flex;
  flex: 0 1 auto;
  gap: 0.35rem;
  overflow-x: auto;
  padding: 0.25rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  scrollbar-width: none;
}

.main-nav::-webkit-scrollbar {
  display: none;
}

.nav-button {
  min-height: 38px;
  padding: 0 1rem;
  color: rgba(255, 255, 255, 0.75);
  background: transparent;
  border-radius: 999px;
}

.nav-button.is-active {
  color: #18211f;
  background: #fff;
}

.auth-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex: 0 0 auto;
}

.signin-button {
  min-height: 38px;
  padding: 0 1rem;
  color: #18211f;
  background: #fff;
  border: 0;
  border-radius: 999px;
  font-weight: 800;
}

.auth-admin-button {
  color: rgba(255, 255, 255, 0.78);
}

.clerk-user-button {
  min-width: 38px;
  min-height: 38px;
  display: grid;
  place-items: center;
}

.auth-gate {
  min-height: calc(100svh - var(--topbar));
  display: grid;
  place-items: center;
  padding: clamp(1rem, 4vw, 3rem);
  background:
    linear-gradient(135deg, rgba(11, 107, 104, 0.08), rgba(215, 144, 50, 0.12)),
    var(--canvas);
}

.auth-gate[hidden] {
  display: none;
}

.auth-card {
  width: min(520px, 100%);
  display: grid;
  gap: 1rem;
  padding: clamp(1.1rem, 3vw, 1.7rem);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.auth-card h1,
.auth-card p {
  margin: 0;
}

.auth-card h1 {
  font-size: clamp(2rem, 6vw, 3.2rem);
  line-height: 1;
}

.auth-card > p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.5;
}

.clerk-signin-mount:empty {
  display: none;
}

.view {
  min-height: calc(100svh - var(--topbar));
}

.view[hidden] {
  display: none;
}

.hero {
  position: relative;
  min-height: min(760px, calc(100svh - 30px));
  display: grid;
  align-items: center;
  overflow: hidden;
  isolation: isolate;
}

.hero-image,
.hero-shade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero-image {
  object-fit: cover;
  object-position: center;
  z-index: -2;
}

.hero-shade {
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(6, 19, 17, 0.82), rgba(6, 19, 17, 0.46) 42%, rgba(6, 19, 17, 0.1) 78%),
    linear-gradient(180deg, rgba(6, 19, 17, 0.16), rgba(6, 19, 17, 0.7));
}

.hero-content {
  width: min(680px, calc(100% - 3rem));
  margin-left: clamp(1.5rem, 8vw, 7rem);
  color: #fff;
}

.eyebrow {
  margin: 0 0 0.55rem;
  color: var(--gold);
  font-size: 0.79rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0;
}

.hero h1 {
  max-width: 11ch;
  margin: 0;
  font-family: ui-serif, Georgia, "Times New Roman", serif;
  font-size: clamp(4rem, 11vw, 9.5rem);
  line-height: 0.9;
  letter-spacing: 0;
}

.hero-copy {
  max-width: 560px;
  margin: 1.35rem 0 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

.primary-action,
.secondary-action,
.icon-button,
.photo-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  border-radius: var(--radius);
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease, color 160ms ease;
}

.primary-action {
  padding: 0 1.15rem;
  color: #fff;
  background: var(--teal);
  box-shadow: 0 16px 34px rgba(5, 60, 58, 0.28);
  font-weight: 750;
}

.primary-action:hover,
.secondary-action:hover,
.icon-button:hover,
.photo-tool:hover {
  transform: translateY(-1px);
}

.primary-action:hover {
  background: var(--teal-dark);
}

.secondary-action {
  padding: 0 1rem;
  color: var(--ink);
  background: #fff;
  font-weight: 750;
}

.secondary-action.compact {
  min-height: 40px;
  color: #fff;
  background: var(--ink);
}

.secondary-action.compact.danger {
  background: var(--rose);
}

.primary-action.compact {
  min-height: 40px;
  padding: 0 0.95rem;
}

.landing-overview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  width: min(980px, calc(100% - 2rem));
  margin: -44px auto 3rem;
  position: relative;
  z-index: 4;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--line);
  box-shadow: var(--shadow);
}

.landing-overview > div {
  min-height: 104px;
  display: grid;
  align-content: center;
  gap: 0.25rem;
  padding: 1.2rem;
  background: #fff;
}

.overview-number {
  font-size: clamp(2rem, 5vw, 3.1rem);
  font-weight: 850;
  line-height: 1;
  color: var(--teal-dark);
}

.overview-label {
  color: var(--muted);
  font-weight: 700;
}

.map-shell {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto 4rem;
}

.section-heading {
  margin-bottom: 1rem;
}

.section-heading h1,
.section-heading h2 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1;
}

.albums-shell {
  display: grid;
  grid-template-columns: minmax(270px, 330px) minmax(0, 1fr);
  min-height: calc(100svh - var(--topbar));
}

.albums-shell.is-picker {
  display: block;
}

.albums-shell.is-picker .albums-rail {
  display: none;
}

.albums-rail {
  padding: 1.3rem;
  background: #fff;
  border-right: 1px solid var(--line);
}

.rail-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.rail-heading h2,
.empty-state h2 {
  margin: 0;
}

.icon-button {
  width: 40px;
  height: 40px;
  color: var(--ink);
  background: var(--wash);
}

.icon-button.is-solid {
  color: #fff;
  background: var(--teal);
}

.icon-button.danger {
  color: var(--rose);
  background: #fae9eb;
}

.album-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  gap: 0.5rem;
  margin-bottom: 1.2rem;
}

.album-form input,
.album-title-input,
.album-description-input,
.album-meta-grid input,
.library-filter-grid input,
.library-filter-grid select,
.photo-caption,
.photo-note {
  width: 100%;
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
  border-radius: var(--radius);
  outline: none;
}

.album-form input {
  min-height: 40px;
  padding: 0 0.75rem;
}

.album-form input:focus,
.album-title-input:focus,
.album-description-input:focus,
.library-filter-grid input:focus,
.library-filter-grid select:focus,
.photo-caption:focus,
.photo-note:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(11, 107, 104, 0.14);
}

.album-list {
  display: grid;
  gap: 0.55rem;
}

.rail-empty {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.album-card {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 0.75rem;
  width: 100%;
  min-height: 72px;
  padding: 0.55rem;
  text-align: left;
  color: var(--ink);
  background: transparent;
  border-radius: var(--radius);
}

.album-card:hover,
.album-card.is-active {
  background: var(--wash);
}

.album-thumb {
  width: 54px;
  height: 54px;
  border-radius: 6px;
  object-fit: cover;
  background:
    linear-gradient(135deg, rgba(11, 107, 104, 0.26), rgba(215, 144, 50, 0.32)),
    #eef4f1;
}

.album-card strong,
.photo-card strong {
  display: block;
  overflow-wrap: anywhere;
}

.album-card span {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.album-stage {
  min-width: 0;
  padding: clamp(1rem, 3vw, 2.2rem);
}

.album-picker {
  display: grid;
  gap: 1.5rem;
}

.album-picker[hidden] {
  display: none;
}

.album-picker-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
}

.album-picker-header h1 {
  margin: 0;
  font-size: clamp(2.5rem, 7vw, 5.5rem);
  line-height: 0.94;
  letter-spacing: 0;
}

.album-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: clamp(1rem, 2.5vw, 1.6rem);
}

.album-tile {
  display: grid;
  gap: 0.75rem;
  min-width: 0;
  padding: 0;
  color: var(--ink);
  text-align: left;
  background: transparent;
  border: 0;
}

.album-tile-cover {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(11, 107, 104, 0.28), rgba(215, 144, 50, 0.34)),
    #eef4f1;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(20, 31, 28, 0.08);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.album-tile:hover .album-tile-cover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(20, 31, 28, 0.14);
}

.album-tile strong {
  display: block;
  padding: 0 0.15rem;
  font-size: 1.05rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.album-picker-empty {
  display: grid;
  gap: 0.35rem;
  min-height: 260px;
  place-items: center;
  align-content: center;
  padding: 2rem;
  color: var(--muted);
  text-align: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.album-picker-empty h2,
.album-picker-empty p {
  margin: 0;
}

.empty-state {
  min-height: calc(100svh - var(--topbar) - 4rem);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 1rem;
  text-align: center;
}

.empty-state[hidden] {
  display: none;
}

.empty-state p {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.empty-icon {
  width: 74px;
  height: 74px;
  color: var(--teal);
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
  fill: none;
}

.album-viewer,
.album-editor {
  display: grid;
  gap: 1.2rem;
}

.album-viewer[hidden],
.album-editor[hidden] {
  display: none;
}

.viewer-header {
  display: grid;
  gap: 1rem;
  align-items: start;
}

.viewer-title-block {
  min-width: 0;
}

.viewer-title-block h1 {
  margin: 0;
  font-size: clamp(2.4rem, 7vw, 5.5rem);
  line-height: 0.94;
  letter-spacing: 0;
}

.viewer-title-block > p:not(.eyebrow) {
  max-width: 760px;
  margin: 0.85rem 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.55;
}

.viewer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1rem;
}

.viewer-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 0.65rem;
  color: var(--teal-dark);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
}

.viewer-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 1rem;
  align-items: start;
}

.viewer-photo-grid.is-size-small {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr));
  gap: 0.75rem;
}

.viewer-photo-grid.is-size-medium {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
}

.viewer-photo-grid.is-size-large {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr));
  gap: 1.25rem;
}

.viewer-photo-card {
  display: grid;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(20, 31, 28, 0.08);
}

.viewer-photo-frame {
  position: relative;
  height: clamp(240px, 28vw, 380px);
  overflow: hidden;
  background: #dfe7e2;
  cursor: zoom-in;
}

.viewer-photo-grid.is-size-small .viewer-photo-frame {
  height: clamp(160px, 20vw, 250px);
}

.viewer-photo-grid.is-size-medium .viewer-photo-frame {
  height: clamp(240px, 28vw, 380px);
}

.viewer-photo-grid.is-size-large .viewer-photo-frame {
  height: clamp(300px, 36vw, 540px);
}

.viewer-photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 180ms ease;
}

.viewer-photo-frame:hover img {
  transform: scale(1.015);
}

.viewer-photo-body {
  display: grid;
  gap: 0.35rem;
  padding: 0.85rem;
}

.viewer-photo-body h2,
.viewer-photo-body p {
  margin: 0;
}

.viewer-photo-body h2,
.viewer-photo-body > p:first-child {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.viewer-photo-body > p:not(:first-child),
.viewer-photo-note {
  color: var(--muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.viewer-photo-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.viewer-empty {
  min-height: 320px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0.5rem;
  grid-column: 1 / -1;
  color: var(--muted);
  text-align: center;
}

.viewer-empty h2,
.viewer-empty p {
  margin: 0;
}

.album-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: start;
}

.album-title-block {
  display: grid;
  gap: 0.55rem;
}

.album-title-input {
  min-height: 54px;
  padding: 0.2rem 0.7rem;
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: 850;
  letter-spacing: 0;
}

.album-description-input {
  min-height: 58px;
  resize: vertical;
  padding: 0.7rem;
  line-height: 1.45;
}

.album-meta-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(130px, 0.5fr) minmax(130px, 0.5fr);
  gap: 0.6rem;
}

.album-meta-grid label {
  display: grid;
  gap: 0.3rem;
}

.album-meta-grid span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.album-meta-grid input {
  min-height: 42px;
  padding: 0 0.7rem;
}

.album-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.viewer-actions {
  display: grid;
  width: 100%;
  grid-template-columns: auto minmax(260px, 360px) minmax(118px, 150px) auto auto;
  align-items: flex-end;
  column-gap: 0.7rem;
  row-gap: 0.55rem;
  justify-content: end;
}

.viewer-actions .compact-field {
  min-width: 0;
}

.viewer-actions .compact-field:first-of-type {
  min-width: 0;
}

.viewer-actions .compact-field select {
  width: 100%;
  max-width: none;
}

.viewer-actions .primary-action.compact,
.viewer-actions .secondary-action.compact {
  min-height: 42px;
  white-space: nowrap;
}

.compact-field {
  display: grid;
  gap: 0.25rem;
}

.compact-field span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.compact-field select {
  min-height: 40px;
  max-width: min(240px, 100%);
  padding: 0 0.65rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
}

.compact-field select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(11, 107, 104, 0.14);
}

.drop-zone {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-height: 112px;
  padding: 1rem;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(11, 107, 104, 0.08), rgba(215, 144, 50, 0.1)),
    #fff;
  border: 1px dashed rgba(11, 107, 104, 0.5);
  border-radius: var(--radius);
}

.drop-zone.is-dragging {
  background: #e6f3ef;
  border-color: var(--teal);
}

.drop-zone strong,
.drop-zone span {
  display: block;
}

.drop-zone span {
  margin-top: 0.25rem;
  color: var(--muted);
}

.drop-icon {
  width: 42px;
  height: 42px;
  color: var(--teal);
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
  fill: none;
}

.upload-status {
  display: grid;
  gap: 0.45rem;
  padding: 0.85rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.upload-status[hidden] {
  display: none;
}

.upload-status-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
}

.upload-status-top strong {
  color: var(--ink);
}

.upload-meter {
  height: 10px;
  overflow: hidden;
  background: var(--wash);
  border-radius: 999px;
}

.upload-meter span {
  display: block;
  width: 0%;
  height: 100%;
  background: var(--teal);
  border-radius: inherit;
  transition: width 160ms ease;
}

.library-tools {
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(20, 31, 28, 0.08);
}

.library-tools[hidden] {
  display: none;
}

.library-tools-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.library-tools-top h3,
.library-tools-top p {
  margin: 0;
}

.library-tools-top h3 {
  font-size: 1.15rem;
}

.library-tool-actions,
.batch-action-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  column-gap: 0.9rem;
  row-gap: 0.6rem;
}

.library-filter-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(170px, 0.8fr) minmax(190px, 0.9fr) minmax(135px, 0.5fr) minmax(135px, 0.5fr);
  gap: 0.6rem;
}

.library-filter-grid label {
  display: grid;
  gap: 0.3rem;
}

.library-filter-grid span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.library-filter-grid input,
.library-filter-grid select {
  min-height: 42px;
  padding: 0 0.7rem;
}

.batch-toolbar {
  display: grid;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--wash);
  border: 1px solid rgba(11, 107, 104, 0.14);
  border-radius: var(--radius);
}

.batch-summary {
  display: grid;
  gap: 0.2rem;
}

.batch-summary strong {
  color: var(--teal-dark);
  font-size: 0.96rem;
}

.batch-summary span {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.batch-actions {
  display: grid;
  gap: 0.55rem;
}

.batch-actions[hidden] {
  display: none;
}

.batch-action-group {
  padding-top: 0.55rem;
  border-top: 1px solid rgba(11, 107, 104, 0.12);
}

.batch-target {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: min(320px, 100%);
  margin-right: 0.2rem;
}

.batch-target span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.batch-toolbar select {
  min-height: 40px;
  min-width: min(220px, 100%);
  padding: 0 0.7rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.batch-toolbar select:disabled {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.64);
  cursor: not-allowed;
}

.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.6rem;
}

.health-card {
  display: grid;
  gap: 0.45rem;
  min-height: 96px;
  padding: 0.75rem;
  background: var(--wash);
  border: 1px solid rgba(11, 107, 104, 0.12);
  border-radius: var(--radius);
}

.health-card.has-issue {
  background: #fff7ec;
  border-color: rgba(215, 144, 50, 0.45);
}

.health-card strong,
.health-card span {
  overflow-wrap: anywhere;
}

.health-card strong {
  color: var(--ink);
  font-size: 0.9rem;
}

.health-card > span {
  color: var(--teal-dark);
  font-size: 1.5rem;
  font-weight: 850;
  line-height: 1;
}

.health-card .secondary-action {
  justify-self: start;
  min-height: 34px;
  padding: 0 0.65rem;
}

.duplicate-panel {
  display: grid;
  gap: 0.65rem;
}

.duplicate-empty,
.duplicate-group {
  padding: 0.75rem;
  background: var(--wash);
  border: 1px solid rgba(11, 107, 104, 0.12);
  border-radius: var(--radius);
}

.duplicate-empty {
  color: var(--muted);
  font-weight: 750;
}

.duplicate-group {
  display: grid;
  gap: 0.65rem;
}

.duplicate-group-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.duplicate-group-header strong {
  font-size: 0.96rem;
}

.duplicate-group-header span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 750;
  margin-right: auto;
}

.duplicate-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 0.55rem;
}

.duplicate-thumb {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  text-align: left;
}

.duplicate-thumb img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #dfe7e2;
  border-radius: 6px;
}

.duplicate-thumb span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.75rem;
  font-weight: 750;
}

.ai-location-panel {
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(20, 31, 28, 0.08);
}

.ai-location-panel[hidden] {
  display: none;
}

.ai-location-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.ai-location-top h3,
.ai-location-top p {
  margin: 0;
}

.ai-location-top h3 {
  font-size: 1.15rem;
}

.ai-location-top #aiLocationStatus {
  margin-top: 0.25rem;
  color: var(--muted);
  line-height: 1.45;
}

.ai-suggestion-list {
  display: grid;
  gap: 0.65rem;
}

.ai-suggestion-empty {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.ai-suggestion-card {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 0.85rem;
  align-items: stretch;
  padding: 0.65rem;
  background: var(--wash);
  border: 1px solid rgba(11, 107, 104, 0.16);
  border-radius: var(--radius);
}

.ai-suggestion-card img {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 6px;
  background: #dfe7e2;
}

.ai-suggestion-body {
  min-width: 0;
  display: grid;
  gap: 0.35rem;
}

.ai-suggestion-body strong,
.ai-suggestion-body span,
.ai-suggestion-body p {
  overflow-wrap: anywhere;
}

.ai-suggestion-body span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 750;
}

.ai-suggestion-body p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.ai-suggestion-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.15rem;
}

.gallery-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 28px;
}

.gallery-heading p,
.gallery-tools p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.gallery-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.secondary-action.compact[aria-pressed="true"] {
  color: #fff;
  background: var(--teal);
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 420px));
  justify-content: start;
  gap: 1.4rem;
  align-items: start;
}

.photo-card {
  display: grid;
  grid-template-rows: auto auto;
  min-width: 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(20, 31, 28, 0.08);
}

.photo-card.is-selected {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(11, 107, 104, 0.16), 0 10px 28px rgba(20, 31, 28, 0.08);
}

.photo-card.is-dragging {
  opacity: 0.5;
}

.photo-card.is-drop-before {
  box-shadow: -6px 0 0 var(--gold), 0 10px 28px rgba(20, 31, 28, 0.08);
}

.photo-card.is-drop-after {
  box-shadow: 6px 0 0 var(--gold), 0 10px 28px rgba(20, 31, 28, 0.08);
}

.photo-card.is-hidden {
  display: none;
}

.photo-frame {
  position: relative;
  height: clamp(220px, 27vw, 340px);
  background: #dfe7e2;
  cursor: zoom-in;
  overflow: hidden;
}

.photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 180ms ease;
}

.photo-frame:hover img {
  transform: scale(1.015);
}

.photo-fallback {
  height: 100%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0.35rem;
  padding: 1.2rem;
  color: var(--muted);
  text-align: center;
  overflow-wrap: anywhere;
}

.photo-fallback strong {
  color: var(--ink);
  font-size: 0.98rem;
}

.photo-fallback span {
  max-width: 100%;
  font-size: 0.84rem;
  line-height: 1.35;
}

.photo-fallback small {
  color: var(--muted);
  font-size: 0.78rem;
}

.caption-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.85rem;
  color: #fff;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.72));
  font-weight: 750;
  overflow-wrap: anywhere;
}

.photo-select {
  position: absolute;
  top: 0.55rem;
  left: 0.55rem;
  z-index: 3;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: #fff;
  background: rgba(13, 25, 22, 0.78);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  cursor: pointer;
}

.photo-select input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.photo-select span {
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-radius: 5px;
}

.photo-select input:checked + span {
  background: currentColor;
  box-shadow: inset 0 0 0 4px var(--teal);
}

.photo-actions {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  display: flex;
  max-width: calc(100% - 4.65rem);
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem;
}

.photo-tool {
  width: 36px;
  height: 36px;
  color: #fff;
  background: rgba(13, 25, 22, 0.78);
  backdrop-filter: blur(10px);
}

.photo-tool.is-active {
  color: #17211f;
  background: #fff;
}

.photo-badge {
  position: absolute;
  left: 0.55rem;
  top: 0.55rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  min-height: 28px;
  padding: 0 0.5rem;
  color: #17211f;
  background: rgba(255, 255, 255, 0.86);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 850;
  backdrop-filter: blur(8px);
}

.photo-frame .photo-badge {
  top: 3rem;
}

.viewer-photo-frame .photo-badge {
  top: 0.55rem;
}

.media-kind-badge {
  position: absolute;
  right: 0.55rem;
  bottom: 0.55rem;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 28px;
  max-width: calc(100% - 1.1rem);
  padding: 0 0.55rem;
  color: #17211f;
  background: rgba(255, 255, 255, 0.88);
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 850;
  backdrop-filter: blur(8px);
}

.media-kind-badge .icon {
  width: 0.9rem;
  height: 0.9rem;
}

.photo-body {
  display: grid;
  gap: 0.65rem;
  padding: 0.9rem;
}

.photo-caption {
  min-height: 42px;
  padding: 0 0.75rem;
  font-size: 0.96rem;
  font-weight: 700;
}

.photo-note {
  min-height: 88px;
  resize: vertical;
  padding: 0.75rem;
  font-size: 0.95rem;
  line-height: 1.45;
}

.photo-organization {
  display: grid;
  grid-template-columns: minmax(96px, 0.55fr) minmax(0, 1fr);
  align-items: end;
  gap: 0.55rem;
}

.photo-org-field {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
}

.photo-org-field span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.photo-org-field input,
.photo-org-field select {
  min-height: 38px;
  width: 100%;
  padding: 0 0.65rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
}

.photo-org-field:nth-child(3) {
  grid-column: 2;
}

.photo-org-field input:focus,
.photo-org-field select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(11, 107, 104, 0.14);
}

.photo-caption::placeholder,
.photo-note::placeholder {
  color: #7b8581;
  opacity: 1;
}

.photo-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.photo-meta span {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.photo-meta span:last-child {
  white-space: nowrap;
}

.photo-details {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  min-width: 0;
}

.photo-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  max-width: 100%;
  min-height: 26px;
  padding: 0 0.5rem;
  color: var(--muted);
  background: var(--wash);
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 750;
  line-height: 1.25;
  overflow-wrap: anywhere;
  white-space: normal;
}

.photo-pill .icon {
  flex: 0 0 auto;
  width: 0.9rem;
  height: 0.9rem;
}

.photo-pill span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.photo-edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.location-correct-button {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 32px;
  padding: 0 0.65rem;
  color: var(--teal-dark);
  background: var(--wash);
  border: 1px solid rgba(11, 107, 104, 0.14);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 850;
}

.location-correct-button .icon {
  width: 0.95rem;
  height: 0.95rem;
}

.location-correct-button:disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.58;
}

.preview-edit-panel {
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.preview-edit-panel > summary {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 38px;
  padding: 0 0.7rem;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 850;
  cursor: pointer;
  list-style: none;
}

.preview-edit-panel > summary::-webkit-details-marker {
  display: none;
}

.preview-edit-panel > summary .icon {
  width: 0.95rem;
  height: 0.95rem;
  color: var(--teal);
}

.preview-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
  padding: 0.7rem;
  border-top: 1px solid var(--line);
}

.preview-edit-field {
  display: grid;
  min-width: 0;
  gap: 0.25rem;
}

.preview-edit-field > span,
.preview-edit-label-row {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.preview-edit-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.preview-edit-label-row output {
  color: var(--teal-dark);
  font: inherit;
  text-transform: none;
}

.preview-edit-field select {
  min-height: 36px;
  width: 100%;
  padding: 0 0.6rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.preview-edit-field input[type="range"] {
  width: 100%;
  accent-color: var(--teal);
}

.preview-edit-footer {
  display: flex;
  grid-column: 1 / -1;
  justify-content: flex-end;
}

.preview-reset-button {
  min-width: 0;
}

.share-panel {
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(20, 31, 28, 0.08);
}

.share-panel-top,
.share-link-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.share-panel-top h3,
.share-panel-top p,
.share-status {
  margin: 0;
}

.share-panel-top h3 {
  font-size: 1.15rem;
}

.share-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(150px, 0.45fr) minmax(220px, 0.7fr);
  gap: 0.65rem;
}

.share-grid label,
.share-link-row label,
.share-password-row {
  display: grid;
  gap: 0.3rem;
  min-width: 0;
}

.share-grid label > span,
.share-link-row label > span,
.share-password-row > span,
.share-people-title {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.share-grid input,
.share-grid select,
.share-link-row input,
.share-password-row input {
  min-height: 42px;
  padding: 0 0.7rem;
}

.share-check {
  align-self: end;
  display: flex !important;
  grid-auto-flow: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.45rem !important;
  min-height: 42px;
  padding: 0 0.7rem;
  color: var(--teal-dark);
  background: var(--wash);
  border: 1px solid rgba(11, 107, 104, 0.14);
  border-radius: var(--radius);
  font-weight: 850;
}

.share-check input {
  min-height: 0;
}

.share-link-row label {
  flex: 1 1 auto;
}

.share-people {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.share-people-title {
  flex: 0 0 100%;
}

.share-people label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 32px;
  padding: 0 0.65rem;
  color: var(--teal-dark);
  background: var(--wash);
  border: 1px solid rgba(11, 107, 104, 0.14);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 850;
}

.share-status {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.map-shell {
  padding-top: clamp(1rem, 3vw, 2.2rem);
}

.map-canvas {
  position: relative;
  height: min(56vw, 540px);
  min-height: 360px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #dfe7e2;
  box-shadow: var(--shadow);
}

.map-canvas .leaflet-container,
.map-canvas .leaflet-pane,
.map-canvas .leaflet-top,
.map-canvas .leaflet-bottom {
  font: inherit;
}

.map-canvas .leaflet-popup-content-wrapper,
.map-canvas .leaflet-popup-tip {
  border-radius: var(--radius);
}

.map-canvas .leaflet-control-zoom a {
  color: var(--ink);
}

.map-empty {
  position: absolute;
  inset: 0;
  z-index: 500;
  display: grid;
  place-items: center;
  padding: 2rem;
  color: var(--muted);
  background: rgba(244, 247, 242, 0.74);
  text-align: center;
  line-height: 1.5;
  pointer-events: none;
}

.map-groups {
  display: block;
  margin-top: 1rem;
}

.map-selection-panel {
  display: grid;
  gap: 1rem;
  padding: clamp(1rem, 2.5vw, 1.35rem);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(20, 31, 28, 0.08);
}

.map-selection-panel header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.map-selection-panel h2,
.map-selection-panel p {
  margin: 0;
}

.map-selection-panel h2 {
  font-size: clamp(1.4rem, 3vw, 2.2rem);
  line-height: 1.05;
}

.map-selection-panel p {
  color: var(--muted);
  line-height: 1.45;
}

.map-selection-panel a {
  flex: 0 0 auto;
  color: var(--teal-dark);
  font-weight: 800;
  text-decoration: none;
}

.map-selection-panel.is-empty {
  min-height: 120px;
  place-items: center;
  text-align: center;
}

.map-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
}

.map-photo-button {
  display: grid;
  gap: 0;
  overflow: hidden;
  padding: 0;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: left;
  box-shadow: 0 8px 20px rgba(20, 31, 28, 0.08);
}

.map-photo-button img,
.map-photo-button .photo-fallback {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.map-photo-body {
  display: grid;
  gap: 0.25rem;
  padding: 0.7rem;
}

.map-photo-body strong {
  font-size: 0.9rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.map-photo-body span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  line-height: 1.35;
}

.timeline-shell {
  display: grid;
  gap: 1.2rem;
  padding: clamp(1rem, 3vw, 2.2rem);
}

.timeline-shell h1 {
  margin: 0;
  font-size: clamp(2.8rem, 8vw, 5.8rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.timeline-list {
  display: grid;
  gap: 1.2rem;
}

.timeline-empty {
  min-height: 320px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.timeline-group {
  display: grid;
  gap: 0.75rem;
}

.timeline-group header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.timeline-group h2,
.timeline-group p {
  margin: 0;
}

.timeline-group h2 {
  color: var(--ink);
  font-size: clamp(1.5rem, 3vw, 2.4rem);
  line-height: 1;
}

.timeline-group p {
  color: var(--muted);
  font-weight: 750;
}

.timeline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
  gap: 0.85rem;
}

.timeline-item {
  display: grid;
  grid-template-rows: 170px auto;
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(20, 31, 28, 0.08);
}

.timeline-item img,
.timeline-item .photo-fallback {
  width: 100%;
  height: 100%;
}

.timeline-item img {
  object-fit: cover;
}

.timeline-item-body {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
  padding: 0.75rem;
}

.timeline-item-body strong,
.timeline-item-body span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.timeline-item-body strong {
  font-size: 0.96rem;
  line-height: 1.25;
}

.timeline-item-body span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.35;
}

.collections-shell {
  display: grid;
  gap: 1.2rem;
  padding: clamp(1rem, 3vw, 2.2rem);
}

.collections-shell h1 {
  margin: 0;
  font-size: clamp(2.8rem, 8vw, 5.8rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.collections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 0.85rem;
}

.collection-empty {
  min-height: 220px;
  display: grid;
  place-items: center;
  grid-column: 1 / -1;
  padding: 1rem;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: center;
}

.collection-card {
  display: grid;
  gap: 0.55rem;
  min-width: 0;
  padding: 0.85rem;
  color: var(--ink);
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(20, 31, 28, 0.08);
}

.collection-card.is-active {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(11, 107, 104, 0.14), 0 10px 28px rgba(20, 31, 28, 0.08);
}

.collection-card:disabled {
  opacity: 0.52;
  cursor: not-allowed;
}

.collection-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.collection-card-title {
  color: var(--ink);
  font-size: 1.1rem;
  font-weight: 850;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.collection-card-description {
  min-height: 2.4em;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.35;
}

.collection-card-previews {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.25rem;
  min-height: 48px;
}

.collection-card-previews img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #dfe7e2;
  border-radius: 5px;
}

.collection-detail {
  display: grid;
  gap: 0.85rem;
}

.collection-detail header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.collection-detail h2,
.collection-detail p {
  margin: 0;
}

.collection-detail h2 {
  color: var(--ink);
  font-size: clamp(1.5rem, 3vw, 2.4rem);
  line-height: 1;
}

.collection-detail p {
  color: var(--muted);
  font-weight: 750;
}

.collection-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
  gap: 0.85rem;
}

.collection-photo {
  display: grid;
  grid-template-rows: 170px auto;
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(20, 31, 28, 0.08);
}

.collection-photo img,
.collection-photo .photo-fallback {
  width: 100%;
  height: 100%;
}

.collection-photo img {
  object-fit: cover;
}

.collection-photo-body {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
  padding: 0.75rem;
}

.collection-photo-body strong,
.collection-photo-body span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.collection-photo-body strong {
  font-size: 0.96rem;
  line-height: 1.25;
}

.collection-photo-body span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.35;
}

.admin-shell {
  display: grid;
  gap: 1rem;
  width: min(1040px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2.2rem) 0 4rem;
}

.admin-layout {
  grid-template-columns: 180px minmax(0, 1fr);
  align-items: start;
}

.admin-nav {
  position: sticky;
  top: calc(var(--topbar-height, 72px) + 1rem);
  display: grid;
  gap: 0.45rem;
}

.admin-nav-button {
  min-height: 44px;
  padding: 0 0.9rem;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 850;
  text-align: left;
}

.admin-nav-button.is-active {
  color: #fff;
  background: var(--ink);
  border-color: var(--ink);
}

.admin-content {
  min-width: 0;
}

.admin-shell .section-heading p:not(.eyebrow) {
  margin: 0.55rem 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.admin-user-list {
  display: grid;
  gap: 0.75rem;
}

.admin-share-list {
  display: grid;
  gap: 0.75rem;
}

.admin-user-card,
.admin-share-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(20, 31, 28, 0.08);
}

.admin-user-card h2,
.admin-user-card p,
.admin-share-card h2,
.admin-share-card p {
  margin: 0;
}

.admin-user-card h2,
.admin-share-card h2 {
  font-size: 1.05rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.admin-user-card p,
.admin-share-card p {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.admin-page-access {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin-top: 0.75rem;
}

.admin-page-access > span {
  flex: 0 0 100%;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.admin-page-access label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 32px;
  padding: 0 0.65rem;
  color: var(--teal-dark);
  background: var(--wash);
  border: 1px solid rgba(11, 107, 104, 0.14);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 850;
}

.admin-page-access input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--teal);
}

.admin-user-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}

.admin-share-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  min-width: min(420px, 46vw);
}

.admin-share-actions input {
  min-width: 0;
  width: min(360px, 36vw);
  min-height: 38px;
  padding: 0 0.7rem;
  color: var(--muted);
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-weight: 750;
}

.admin-user-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 0.6rem;
  color: var(--teal-dark);
  background: var(--wash);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: capitalize;
}

.admin-empty {
  min-height: 220px;
  display: grid;
  place-items: center;
  padding: 1rem;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: center;
  font-weight: 750;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: block;
  padding: 0;
  overflow: hidden;
  background: rgba(8, 16, 14, 0.92);
}

.lightbox[hidden] {
  display: none;
}

.lightbox-figure {
  position: fixed;
  inset: clamp(1rem, 3vw, 2.25rem) clamp(7rem, 10vw, 8rem) clamp(1rem, 3vw, 2.25rem);
  width: auto;
  height: auto;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0.8rem;
  margin: 0;
  pointer-events: none;
}

.lightbox-figure img,
.lightbox-figure video {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
  pointer-events: auto;
}

.lightbox-figure video {
  background: #000;
}

.lightbox-figure figcaption {
  min-height: 1.5rem;
  color: rgba(255, 255, 255, 0.86);
  text-align: center;
  overflow-wrap: anywhere;
  pointer-events: auto;
}

.lightbox-toolbar {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 72;
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.lightbox-tool {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  text-decoration: none;
}

.lightbox-tool.is-active {
  color: #17211f;
  background: #fff;
}

.lightbox-arrow {
  position: fixed;
  top: 50%;
  z-index: 71;
  width: clamp(48px, 5vw, 64px);
  height: clamp(48px, 5vw, 64px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  transform: translateY(-50%);
  transition: background 180ms ease, color 180ms ease, transform 180ms ease, border-color 180ms ease;
}

.lightbox-arrow.is-prev {
  left: clamp(0.75rem, 3vw, 2rem);
}

.lightbox-arrow.is-next {
  right: clamp(0.75rem, 3vw, 2rem);
}

.lightbox-arrow .icon {
  width: 1.55rem;
  height: 1.55rem;
}

.lightbox-arrow:not(:disabled):hover {
  background: rgba(255, 255, 255, 0.24);
  transform: translateY(-50%) scale(1.03);
}

.lightbox-arrow:disabled {
  color: rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.1);
  cursor: not-allowed;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  z-index: 50;
  transform: translate(-50%, 1rem);
  max-width: min(460px, calc(100% - 2rem));
  padding: 0.75rem 0.9rem;
  color: #fff;
  background: rgba(12, 24, 21, 0.94);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 820px) {
  :root {
    --topbar: 64px;
  }

  .topbar {
    padding: 0 1rem;
  }

  .auth-actions {
    gap: 0.35rem;
  }

  .signin-button,
  .auth-admin-button {
    padding: 0 0.75rem;
  }

  .brand-button span:last-child {
    max-width: 11rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .nav-button {
    min-height: 36px;
    padding: 0 0.72rem;
  }

  .hero {
    min-height: 76svh;
  }

  .hero-content {
    width: min(620px, calc(100% - 2rem));
    margin: 0 auto;
  }

  .landing-overview {
    grid-template-columns: 1fr;
    margin-top: 0;
    box-shadow: none;
  }

  .albums-shell {
    grid-template-columns: 1fr;
  }

  .albums-rail {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .album-list {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }

  .album-picker-header {
    align-items: stretch;
    flex-direction: column;
  }

  .viewer-header,
  .album-header {
    grid-template-columns: 1fr;
  }

  .album-meta-grid {
    grid-template-columns: 1fr;
  }

  .library-tools-top {
    align-items: stretch;
    flex-direction: column;
  }

  .library-filter-grid {
    grid-template-columns: 1fr 1fr;
  }

  .share-grid {
    grid-template-columns: 1fr;
  }

  .share-panel-top,
  .share-link-row {
    align-items: stretch;
    flex-direction: column;
  }

  .album-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .viewer-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
  }

  .viewer-actions .primary-action.compact,
  .viewer-actions .secondary-action.compact {
    width: 100%;
  }

  .ai-location-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .preview-edit-grid {
    grid-template-columns: 1fr;
  }

  .admin-layout {
    grid-template-columns: 1fr;
  }

  .admin-nav {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-nav-button {
    text-align: center;
  }

  .admin-user-card,
  .admin-share-card {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .admin-user-actions,
  .admin-share-actions {
    justify-content: flex-start;
  }

  .admin-share-actions {
    min-width: 0;
  }

  .admin-share-actions input {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .topbar {
    gap: 0.5rem;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .brand-button span:last-child {
    display: none;
  }

  .main-nav {
    flex: 1 1 auto;
    justify-content: flex-end;
  }

  .auth-actions {
    flex: 0 0 auto;
  }

  .signin-button,
  .auth-admin-button {
    min-height: 34px;
    padding: 0 0.65rem;
  }

  .hero h1 {
    max-width: 100%;
    font-size: clamp(3.2rem, 15vw, 4.6rem);
  }

  .hero-actions,
  .album-actions,
  .library-tool-actions,
  .batch-action-group,
  .gallery-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .viewer-actions {
    grid-template-columns: 1fr;
  }

  .photo-organization {
    grid-template-columns: 1fr;
  }

  .photo-org-field.is-rating {
    grid-row: auto;
  }

  .library-filter-grid {
    grid-template-columns: 1fr;
  }

  .library-tool-actions .secondary-action,
  .batch-toolbar .secondary-action,
  .batch-target,
  .batch-toolbar select,
  .compact-field,
  .compact-field select {
    width: 100%;
    max-width: 100%;
  }

  .batch-target {
    align-items: stretch;
    flex-direction: column;
    gap: 0.25rem;
  }

  .gallery-tools {
    justify-content: stretch;
  }

  .ai-suggestion-card {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .ai-suggestion-card img {
    width: 72px;
    height: 72px;
  }

  .ai-suggestion-actions .primary-action,
  .ai-suggestion-actions .secondary-action {
    width: 100%;
  }

  .gallery-tools .secondary-action {
    width: 100%;
  }

  .primary-action,
  .secondary-action.compact {
    width: 100%;
  }

  .drop-zone {
    align-items: flex-start;
  }

  .photo-grid {
    grid-template-columns: 1fr;
  }

  .photo-frame {
    height: clamp(230px, 72vw, 360px);
  }

  .viewer-photo-frame {
    height: clamp(240px, 76vw, 380px);
  }

  .lightbox {
    padding: 0;
  }

  .lightbox-toolbar {
    top: 0.75rem;
    right: 0.75rem;
  }

  .lightbox-arrow {
    top: auto;
    bottom: 5.25rem;
    width: 44px;
    height: 44px;
    transform: none;
  }

  .lightbox-arrow.is-prev {
    left: 0.75rem;
  }

  .lightbox-arrow.is-next {
    right: 0.75rem;
  }

  .lightbox-arrow:not(:disabled):hover {
    transform: scale(1.03);
  }

  .lightbox-figure {
    inset: 4.75rem 0.75rem 1rem;
  }
}
