:root {
  --bg: #f7f6f2;
  --panel: #ffffff;
  --ink: #171717;
  --muted: #6d716f;
  --line: #dedbd3;
  --accent: #126a63;
  --accent-ink: #ffffff;
  --danger: #b3261e;
  --shadow: 0 18px 45px rgba(20, 27, 24, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2 {
  margin: 0 0 0.5rem;
  line-height: 1.1;
}

h1 {
  font-size: clamp(2rem, 4vw, 4.5rem);
  font-weight: 650;
}

h2 {
  font-size: 1.1rem;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid rgba(222, 219, 211, 0.8);
  background: rgba(247, 246, 242, 0.86);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  min-height: 3.25rem;
  font-weight: 700;
  letter-spacing: 0;
}

.brand img {
  display: block;
  width: auto;
  height: 3.2rem;
}

.nav {
  display: flex;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.94rem;
}

.page {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 4rem) 0;
}

body.client-page .page {
  padding-top: clamp(0.75rem, 2vw, 1.8rem);
}

.client-footer {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 0 0 2rem;
  color: var(--muted);
  font-size: 0.86rem;
  text-align: center;
}

.panel,
.empty,
.project-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: clamp(1rem, 3vw, 2rem);
  margin-bottom: 1.2rem;
}

.narrow {
  width: min(460px, 100%);
  margin: 6vh auto;
}

.empty {
  padding: 4rem 2rem;
  text-align: center;
}

.muted {
  color: var(--muted);
  margin: 0.25rem 0 0;
}

.eyebrow {
  margin: 0 0 0.5rem;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.heading-row,
.client-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.client-hero {
  min-height: 15vh;
  padding: 1rem 0 1.6rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.65rem;
  padding: 0.72rem 1rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.button:hover {
  border-color: var(--accent);
  background: rgba(18, 106, 99, 0.08);
}

.button.primary:hover {
  background: #0e5b55;
  border-color: #0e5b55;
}

.button.danger:hover {
  background: #fff0ed;
}

.nav a {
  transition: color 140ms ease;
}

.nav a:hover {
  color: var(--ink);
}

.language-switcher {
  gap: 0.35rem;
}

.language-switcher a {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.35rem 0.55rem;
}

.language-switcher a.active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.button.ghost {
  background: transparent;
}

.button.danger {
  border-color: var(--danger);
  color: var(--danger);
  background: transparent;
}

.form {
  display: grid;
  gap: 1rem;
}

.grid-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-form .span-2 {
  grid-column: 1 / -1;
}

.upload-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.upload-form .span-2 {
  grid-column: 1 / -1;
}

.upload-form .compact-field {
  max-width: 420px;
}

.permissions-box {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.permissions-box legend {
  margin-right: 0.4rem;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
}

.form-actions .button {
  width: auto;
}

label,
fieldset {
  display: grid;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.9rem;
}

fieldset {
  margin: 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
}

legend {
  padding: 0 0.4rem;
  color: var(--ink);
  font-weight: 650;
}

.check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--ink);
}

input,
select,
textarea {
  width: 100%;
  min-height: 2.75rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0.74rem 0.85rem;
  font: inherit;
}

input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  min-height: 0;
  padding: 0;
  flex: 0 0 auto;
}

input[type="file"] {
  min-height: auto;
  padding: 0.55rem 0;
}

textarea {
  resize: vertical;
}

.notice {
  padding: 0.8rem 1rem;
  border-radius: 6px;
}

.notice.error {
  background: #fff0ed;
  color: var(--danger);
}

.project-list {
  display: grid;
  gap: 0.8rem;
}

.project-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
}

.card-actions,
.download-menu,
.photo-download,
.time-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.card-actions form {
  margin: 0;
}

.copy-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.6rem;
  margin-top: 0.8rem;
}

.drop-zone {
  min-height: 9rem;
  align-content: start;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  padding: 1rem;
}

.drop-zone input {
  background: transparent;
}

.drop-zone span {
  color: var(--muted);
  font-size: 0.86rem;
}

.drop-zone.is-dragging {
  border-color: var(--accent);
  background: rgba(18, 106, 99, 0.08);
}

.download-menu,
.photo-download {
  position: relative;
}

.menu-popover {
  position: absolute;
  top: calc(100% + 0.45rem);
  right: 0;
  z-index: 20;
  display: grid;
  min-width: 210px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 0.35rem;
  box-shadow: var(--shadow);
}

.menu-popover[hidden] {
  display: none;
}

.menu-popover .button {
  justify-content: flex-start;
  width: 100%;
  border: 0;
}

.menu-popover .button:hover {
  background: var(--accent);
  color: var(--accent-ink);
}

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

.asset-tile {
  display: grid;
  gap: 0.25rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.asset-tile span {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.asset-tile form {
  margin-top: 0.45rem;
}

.asset-tile .button {
  min-height: 2.25rem;
  width: 100%;
}

.gallery-grid {
  columns: 3 250px;
  column-gap: 0.85rem;
}

.gallery-grid figure {
  position: relative;
  display: inline-block;
  width: 100%;
  margin: 0 0 0.85rem;
  background: var(--panel);
  border-radius: 8px;
  overflow: visible;
}

.gallery-grid figure > .preview-button {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 8px;
  overflow: hidden;
  padding: 0;
  background: transparent;
}

.gallery-grid img {
  display: block;
  width: 100%;
  height: auto;
}

.photo-download {
  position: absolute;
  right: 0.55rem;
  bottom: 0.55rem;
  z-index: 5;
}

.photo-download > button {
  position: relative;
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border: 0;
  background: transparent;
  color: white;
  padding: 0;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.55));
  transition: opacity 140ms ease, transform 140ms ease;
}

.download-icon {
  width: 2rem;
  height: 2rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.35;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.photo-download > button:hover {
  opacity: 0.78;
  transform: translateY(-1px);
}

.photo-download .menu-popover {
  top: auto;
  bottom: calc(100% + 0.45rem);
  min-width: 170px;
}

.video-stage {
  width: min(980px, 100%);
  margin: 0 auto 1.2rem;
}

.video-stage video {
  display: block;
  width: 100%;
  max-height: 72vh;
  border-radius: 8px;
  background: #0c0d0d;
}

.comment-panel {
  width: min(760px, 100%);
  margin-left: auto;
  margin-right: auto;
}

.comment-list {
  display: grid;
  gap: 0.8rem;
  margin-top: 1.2rem;
}

.comment {
  border-top: 1px solid var(--line);
  padding-top: 0.8rem;
}

.comment p {
  margin: 0.3rem 0 0;
}

.gallery-heading {
  margin-top: 2rem;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.78);
  padding: 4rem;
}

.lightbox[hidden] {
  display: none;
}

.lightbox-frame {
  margin: 0;
}

.lightbox img {
  display: block;
  max-width: min(100%, 1200px);
  max-height: 82vh;
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.4);
}

.lightbox figcaption {
  margin-top: 0.65rem;
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.95rem;
  text-align: left;
}

.lightbox-close,
.lightbox-nav {
  position: absolute;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.34);
  color: white;
}

.lightbox-close {
  top: 1rem;
  right: 1rem;
  width: 2.8rem;
  height: 2.8rem;
  font-size: 1.1rem;
}

.lightbox-nav {
  top: 50%;
  width: 3.2rem;
  height: 3.2rem;
  transform: translateY(-50%);
  font-size: 2.4rem;
}

.lightbox-nav.prev {
  left: 1rem;
}

.lightbox-nav.next {
  right: 1rem;
}

.danger-zone {
  display: flex;
  justify-content: flex-end;
  margin-top: 2rem;
}

@media (max-width: 720px) {
  .topbar,
  .heading-row,
  .client-hero,
  .project-card {
    align-items: stretch;
    flex-direction: column;
  }

  .grid-form,
  .upload-form {
    grid-template-columns: 1fr;
  }

  .copy-row {
    grid-template-columns: 1fr;
  }

  .button {
    width: 100%;
  }

  .form-actions {
    justify-content: stretch;
  }

  .form-actions .button {
    width: 100%;
  }

  .menu-popover {
    left: 0;
    right: auto;
  }

  .lightbox {
    padding: 4.5rem 1rem;
  }
}
