* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font:
    15px/1.6 -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}
button,
input,
textarea,
select {
  font: inherit;
}
a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
button,
.button {
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 9px 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  line-height: 1.4;
}
button:hover,
.button:hover {
  border-color: var(--accent);
  text-decoration: none;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.danger {
  color: #ad3834;
}
.small {
  font-size: 13px;
  padding: 5px 10px;
}
header {
  min-height: 84px;
  height: auto;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 5vw;
  background: var(--surface);
}
header nav {
  display: flex;
  align-items: center;
  gap: 22px;
}
.brand {
  font-size: 24px;
  font-weight: 650;
  letter-spacing: -1px;
  display: flex;
  align-items: center;
  gap: 13px;
  color: var(--text);
}
.brand img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}
.mark {
  font-size: 31px;
}
.brand small {
  font:
    11px/1.4 -apple-system,
    sans-serif;
  display: block;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
}
main {
  max-width: 1440px;
  margin: auto;
  padding: 56px 5vw 90px;
}
h1 {
  font-size: 42px;
  letter-spacing: -1.6px;
  line-height: 1.15;
  font-weight: 550;
  margin: 0 0 14px;
}
h2 {
  font-size: 22px;
  font-weight: 550;
  letter-spacing: -0.5px;
  margin: 0 0 18px;
}
h3 {
  font-size: 17px;
  margin: 0 0 10px;
}
p {
  margin: 0 0 16px;
}
.muted,
small {
  color: var(--muted);
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 16px;
}
.intro {
  display: flex;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}
.intro p {
  max-width: 650px;
}
.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.card {
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 20px;
}
.cards .card {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.cards h2 {
  margin: 0;
}
.card footer {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  margin-top: auto;
}
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}
.stack {
  display: grid;
  gap: 24px;
}
.metrics {
  display: flex;
  gap: 40px;
  flex-wrap: wrap;
  margin: 26px 0;
}
.metrics strong {
  display: block;
  font-size: 27px;
  font-weight: 550;
  letter-spacing: -1px;
}
.metrics span {
  font-size: 12px;
  color: var(--muted);
}
label {
  display: grid;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 17px;
}
input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 7px;
  outline: none;
}
input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 12%, transparent);
}
input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
}
input[type="color"] {
  height: 43px;
  padding: 4px;
}
.check {
  display: flex;
  align-items: center;
  gap: 9px;
}
.row {
  display: flex;
  gap: 16px;
}
.row > label {
  flex: 1;
}
.badge {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 5px;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--muted);
}
.badge.good {
  color: var(--accent);
}
.login {
  max-width: 440px;
  margin: 5vh auto;
}
.login h1 {
  font-size: 34px;
}
.login .card {
  padding: 34px;
}
.login button {
  width: 100%;
}
.login .muted {
  font-size: 13px;
}
.empty {
  padding: 60px 24px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
}
.upload {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px dashed var(--accent);
  padding: 25px;
  background: var(--surface);
  border-radius: 12px;
  margin: 26px 0;
  gap: 20px;
}
.upload p {
  margin: 0;
}
.upload input {
  max-width: 320px;
  font-size: 13px;
}
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 18px;
  margin-top: 24px;
}
#photos .photo .image {
  aspect-ratio: auto;
}
#photos .photo img {
  height: auto;
}
#photos.masonry {
  display: block;
  position: relative;
}
#photos.masonry > * {
  position: absolute;
  margin: 0;
}
.photo {
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
}
.photo .image {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--bg);
  aspect-ratio: 4 / 3;
  height: auto;
}
.photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.photo footer {
  padding: 12px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}
.photo footer span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.photo label {
  margin: 0;
}
.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
  margin-top: 30px;
}
.table-wrap {
  overflow: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th,
td {
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
}
th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
td p {
  margin: 3px 0;
}
.break {
  overflow-wrap: anywhere;
}
.progress {
  width: 100%;
  height: 8px;
  accent-color: var(--accent);
  margin: 16px 0;
}
.notice {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 17px;
  background: var(--surface);
  font-size: 13px;
  margin: 15px 0;
}
#notice {
  position: fixed;
  right: 25px;
  bottom: 25px;
  max-width: min(480px, 90vw);
  z-index: 10;
}
#notice:not(:empty) {
  background: var(--text);
  color: var(--bg);
  padding: 16px 24px;
  border-radius: 10px;
  box-shadow: 0 5px 30px #0002;
}
dialog {
  max-width: min(1100px, 95vw);
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  color: var(--text);
  padding: 28px;
  max-height: 92vh;
  overflow: auto;
}
dialog::backdrop {
  background: #0009;
}
dialog .close {
  float: right;
}
dialog .view {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr);
  gap: 24px;
  clear: both;
  padding-top: 18px;
}
dialog .view img {
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  background: var(--bg);
  border-radius: 8px;
}
.comment {
  border-top: 1px solid var(--line);
  padding: 12px 0;
  font-size: 13px;
}
.comment p {
  white-space: pre-wrap;
  margin: 5px 0;
}
.gallery-description {
  white-space: pre-wrap;
}
.space {
  margin-top: 24px;
}
.pagination {
  margin-top: 24px;
}
.folder-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 10px 0 20px;
}
.hidden {
  display: none !important;
}
summary {
  cursor: pointer;
  font-weight: 600;
  margin: 12px 0;
}
details .card {
  margin-top: 15px;
}
code {
  font-size: 12px;
  word-break: break-all;
}
.credit {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin-top: 55px;
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
@media (max-width: 800px) {
  header {
    padding: 14px 5vw;
    min-height: 74px;
    height: auto;
  }
  header nav {
    gap: 12px;
    font-size: 13px;
  }
  .brand {
    font-size: 20px;
  }
  .brand small {
    font-size: 9px;
  }
  main {
    padding-top: 32px;
  }
  h1 {
    font-size: 34px;
  }
  .split {
    grid-template-columns: 1fr;
  }
  .intro {
    align-items: flex-start;
    flex-direction: column;
  }
  .row {
    flex-direction: column;
    gap: 0;
  }
  .upload {
    align-items: flex-start;
    flex-direction: column;
  }
  .photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  dialog .view {
    grid-template-columns: 1fr;
  }
  .toolbar {
    align-items: flex-start;
    flex-direction: column;
  }
  .metrics {
    gap: 25px;
  }
  header nav .workspace-name {
    display: none;
  }
}

@media (max-width: 600px) {
  header {
    height: auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    padding: 16px 5vw;
  }
  header nav {
    justify-content: space-between;
  }
  header nav:empty {
    display: none;
  }
  .brand span {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .brand small {
    white-space: nowrap;
  }
}

.language-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 12px;
  font-weight: 400;
}
.language-picker select {
  width: auto;
  max-width: 125px;
  font-size: 12px;
  padding: 6px 8px;
}
header nav {
  flex-wrap: wrap;
}
@media (min-width: 601px) and (max-width: 1000px) {
  header {
    flex-wrap: wrap;
    gap: 18px;
  }
}
@media (max-width: 600px) {
  .language-picker {
    margin-left: auto;
  }
}

.file-picker {
  position: relative;
  display: inline-flex;
  cursor: pointer;
  margin-bottom: 0;
}
.file-picker .button {
  pointer-events: none;
}
.file-picker:focus-within {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 8px;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.gallery-filters {
  display: grid;
  grid-template-columns: minmax(180px, 2fr) repeat(4, minmax(110px, 1fr));
  gap: 12px;
  margin-top: 24px;
}
.gallery-filters.without-marks {
  grid-template-columns: minmax(180px, 2fr) repeat(2, minmax(110px, 1fr));
}
.gallery-filters label {
  margin: 0;
}
.gallery-actions {
  margin: 18px 0 8px;
}
.day-heading {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-top: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}
.day-heading h2 {
  margin: 0;
  font-size: 19px;
}
.photo-marks {
  padding: 0 12px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.photo-labels {
  padding: 0 12px 12px;
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}
.heart.is-favorite {
  color: #ba4661;
}
.color-chip {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--line);
  display: inline-block;
}
.color-chip.red {
  background: #cc4756;
}
.color-chip.orange {
  background: #d89535;
}
.color-chip.green {
  background: #438a62;
}
.color-chip.blue {
  background: #438bc0;
}
.color-chip.purple {
  background: #8c62b3;
}
.color-chip.final {
  background: #343b44;
  border: 2px solid #b9c9d2;
}
.photo-navigation {
  clear: both;
  padding-top: 15px;
}
.photo-navigation span {
  font-size: 12px;
}
.zoom-photo {
  display: block;
  width: 100%;
  padding: 0;
  overflow: auto;
  cursor: zoom-in;
}
.zoom-photo.zoomed {
  max-height: 70vh;
  cursor: zoom-out;
}
dialog .view .zoomed img {
  width: auto;
  max-width: none;
  max-height: none;
}
.metadata {
  font-size: 12px;
  overflow-wrap: anywhere;
}
.metadata dt {
  font-weight: 700;
  color: var(--muted);
  margin-top: 8px;
}
.metadata dd {
  margin: 0;
  white-space: pre-wrap;
}
.comment .remove-comment {
  margin: 10px 0 0 12px;
}
dialog.slideshow {
  max-width: 100vw;
  width: 100vw;
  max-height: 100dvh;
  height: 100dvh;
  border: 0;
  border-radius: 0;
  margin: 0;
  padding: 18px 24px;
  background: #141518;
  color: #fff;
  overflow: hidden;
}
.slideshow .slide-brand {
  display: flex;
  gap: 12px;
  align-items: center;
  height: 46px;
  margin-right: 60px;
}
.slide-brand img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}
.slide-brand a {
  margin-left: auto;
  color: #ddd;
  font-size: 13px;
}
.slide-image {
  height: calc(100dvh - 165px);
  display: flex;
  justify-content: center;
  align-items: center;
}
.slide-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.slide-controls {
  justify-content: center;
  padding: 14px 0;
}
.slide-controls span {
  font-size: 12px;
}
.slideshow button[aria-pressed="true"] {
  color: #ba4661;
  border-color: #ba4661;
}
.gallery-cover {
  display: block;
  width: calc(100% + 52px);
  margin: -26px -26px 8px;
  aspect-ratio: 3 / 2;
  object-fit: contain;
  background: var(--bg);
  border-radius: 14px 14px 0 0;
}
.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.home-search {
  max-width: 500px;
  margin-bottom: 22px;
}
@media (max-width: 1000px) {
  .gallery-filters,
  .gallery-filters.without-marks {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .gallery-filters label:first-child {
    grid-column: 1 / -1;
  }
}
@media (max-width: 600px) {
  .slideshow .slide-image {
    height: calc(100dvh - 215px);
  }
  .slide-controls {
    gap: 7px;
  }
  .slide-controls button {
    font-size: 12px;
    padding: 6px 9px;
  }
  .slide-controls span {
    flex-basis: 100%;
    text-align: center;
  }
  .day-heading h2 {
    font-size: 16px;
  }
}


/* Reveal tools without changing masonry measurements; touch keeps all controls. */
@media (hover: hover) and (pointer: fine) {
  #photos .photo :is(.photo-select, .photo-marks) {
    opacity: 0;
    pointer-events: none;
  }
  #photos .photo:is(:hover, :focus-within) :is(.photo-select, .photo-marks) {
    opacity: 1;
    pointer-events: auto;
  }
}


/* Photo-only masonry cards; metadata is revealed without reserving blank rows. */
#photos.masonry .photo{border:0;background:transparent}
#photos.masonry .photo-details{position:absolute;left:0;right:0;bottom:0;padding-top:28px;background:linear-gradient(transparent,rgba(0,0,0,.8));color:#fff;pointer-events:none}
#photos.masonry .photo-details :is(button,input,a,label){pointer-events:auto}
#photos.masonry .photo-labels{color:#fff}
@media (hover: hover) and (pointer: fine){
 #photos.masonry .photo-details{opacity:0}
 #photos.masonry .photo:is(:hover,:focus-within) .photo-details{opacity:1}
 #photos.masonry .photo:not(:hover):not(:focus-within) .photo-details :is(button,input,a,label){pointer-events:none}
}

.dropbox-warning { border-color: #c8963d; border-left-width: 3px; }

/* Compact gallery controls, shared with the legacy mobile experience. */
#photos:not(.masonry) .photo {position:relative}
#photos .photo-details:empty {display:none}
#photos .photo-details {position:absolute;left:0;right:0;bottom:0;padding:12px 10px;background:linear-gradient(transparent,rgba(0,0,0,.35));color:#fff;pointer-events:none}
#photos.masonry .photo-details {padding:12px 10px;background:linear-gradient(transparent,rgba(0,0,0,.35))}
#photos .photo-marks {padding:0;gap:6px;font-size:9px}
#photos .photo-marks small {font-size:9px}
#photos .photo-labels {padding:4px 0 0;color:#fff;font-size:9px}
#photos .heart {position:absolute;z-index:3;top:0;right:0;display:inline-flex;align-items:center;justify-content:center;gap:3px;min-width:44px;min-height:44px;height:44px;padding:10px;border:0;border-radius:0;background:transparent;box-shadow:none;color:#282a2d;font-size:9px;isolation:isolate}
#photos .heart::before {content:"";position:absolute;inset:10px;background:#ffffffe0;border-radius:14px;z-index:-1}
#photos .heart:hover::before {background:#fff}
#photos .heart svg {width:14px;height:14px;flex:none}
#photos .heart.is-favorite svg {fill:currentColor}
#photos .heart-count[data-count="0"] {display:none}
#photos .photo-select-control {position:absolute;left:0;bottom:0;z-index:3;display:grid;place-items:center;width:44px;height:44px;cursor:pointer}
#photos .photo-select {position:static;margin:0;width:14px;height:14px;appearance:none;background:#ffffffe0;border:1px solid #fff9;border-radius:4px;box-shadow:0 1px 3px #0002;cursor:pointer;opacity:1}
#photos .photo-select:checked {background:#282a2d;border-color:#fff}
#photos .photo-select:checked::after {content:"";display:block;width:4px;height:7px;border:solid #fff;border-width:0 1.5px 1.5px 0;transform:translate(3.5px,1px) rotate(45deg)}
#photos .photo-select:focus-visible {outline:2px solid #fff;outline-offset:3px}
#photos .selected-photo {box-shadow:inset 0 0 0 3px var(--accent)}
#photos .selected-photo .image {outline:3px solid var(--accent);outline-offset:-3px}
.gallery-selection-controls {position:sticky;top:12px;z-index:12;display:flex;justify-content:flex-end;align-items:center;gap:8px;min-height:44px;margin:12px 0;pointer-events:none}
.gallery-selection-controls:empty {display:none}
.gallery-selection-controls>* {pointer-events:auto}
.gallery-selection-controls .selection-toggle {min-height:44px;padding:10px 18px;border:1px solid var(--line);border-radius:24px;background:var(--surface);color:var(--text);box-shadow:0 2px 10px #00000012}
.gallery-selection-controls .selection-toggle[aria-pressed="true"] {background:var(--accent);color:#fff}
#photo-selection-status:not(:empty) {padding:7px 12px;border-radius:20px;background:var(--surface);font-size:11px;box-shadow:0 2px 10px #0000000d}
#photos:not(.selection-mode) .photo-select-control,#photos:not(.selection-mode) .select-day,.toolbar:not(.selection-active) #select-all {display:none}
#photos.selection-mode .photo-select-control {opacity:1;pointer-events:auto}
#photos.selection-mode .open-photo {cursor:copy}
.floating-download {position:fixed;z-index:20;bottom:calc(16px + env(safe-area-inset-bottom));right:24px;display:flex;align-items:center;gap:6px;padding:6px;border:1px solid var(--line);border-radius:30px;background:var(--surface);box-shadow:0 4px 20px #0002}
.floating-download button {min-height:44px;min-width:44px;border-radius:24px}
#floating-download-count {font-size:11px;margin-left:5px}
@media (hover:hover) and (pointer:fine) {
 #photos .heart {opacity:0;pointer-events:none}
 #photos .photo:is(:hover,:focus-within) .heart {opacity:1;pointer-events:auto}
 #photos .photo-details {opacity:0}
 #photos .photo:is(:hover,:focus-within) .photo-details {opacity:1}
}
@media(max-width:700px) {
 #photos .heart {opacity:1;pointer-events:auto}
 .floating-download {right:12px;max-width:calc(100% - 24px)}
 #photos .photo-details {opacity:0}
 #photos .photo:focus-within .photo-details {opacity:1}
}
