:root {
  --bg: #030405;
  --panel: #0d0f13;
  --panel-2: #151820;
  --ink: #f7f7fb;
  --muted: #a7adbb;
  --line: #272b36;
  --accent: #2d8cff;
  --accent-2: #75c7ff;
  --approved: #3ee58f;
  --changes: #ff6b4a;
  --pending: #d8c36d;
  --soft: #171b25;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.58);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
}

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

button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  min-height: 38px;
  border-radius: 7px;
  padding: 0 12px;
  cursor: pointer;
}

button:hover,
button.active {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 1px rgba(125, 92, 255, 0.22), 0 0 18px rgba(125, 92, 255, 0.18);
}

.app-header {
  min-height: 96px;
  padding: 20px 28px 16px;
  background: #010203;
  color: white;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid #1f2230;
}

.brand-button {
  margin: 0;
  padding: 0;
  min-height: 0;
  border: 0;
  background: transparent;
  color: white;
  font-size: 32px;
  font-weight: 750;
  letter-spacing: 0;
  font-style: italic;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 14px;
  text-shadow: 0 0 22px rgba(255, 255, 255, 0.22);
}

.brand-button img {
  width: 58px;
  height: 58px;
  object-fit: contain;
  border-radius: 6px;
  filter: drop-shadow(0 0 12px rgba(45, 140, 255, 0.72));
}

.brand-button:hover {
  color: white;
  border-color: transparent;
  box-shadow: none;
}

.app-header p {
  margin: 5px 0 0;
  color: var(--muted);
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.header-actions button {
  background: #f6f6fb;
  color: #11131a;
  border-color: #f6f6fb;
}

.header-actions .primary-upload-action {
  min-height: 44px;
  padding: 0 18px;
  border-color: #ff3f36;
  background: linear-gradient(180deg, #ff5a50, #c91625);
  color: #ffffff;
  font-weight: 800;
  text-transform: uppercase;
  box-shadow: 0 0 0 1px rgba(255, 91, 80, 0.28), 0 12px 28px rgba(201, 22, 37, 0.28);
}

.header-actions .primary-upload-action:hover,
.header-actions .primary-upload-action:focus-visible {
  border-color: #ff8a82;
  color: #ffffff;
  box-shadow: 0 0 0 1px rgba(255, 138, 130, 0.36), 0 0 24px rgba(255, 63, 54, 0.34), 0 14px 32px rgba(201, 22, 37, 0.34);
}

.account-panel {
  min-height: 38px;
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.account-panel span {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-panel {
  width: min(720px, calc(100% - 32px));
  margin: 18px auto 0;
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(260px, 1.4fr);
  gap: 18px;
  align-items: center;
  border: 1px solid rgba(125, 92, 255, 0.36);
  border-radius: 7px;
  background: linear-gradient(135deg, rgba(13, 15, 19, 0.98), rgba(21, 24, 32, 0.95));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.auth-panel h2 {
  margin: 0 0 6px;
  font-size: 1.05rem;
  text-transform: uppercase;
}

.auth-panel p {
  margin: 0;
  color: var(--muted);
}

.auth-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
}

.auth-form input {
  min-width: 0;
}

.admin-link {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 12px;
  color: #11131a;
  background: #f6f6fb;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.app-shell {
  padding: 16px 24px 28px;
}

.legal-footer {
  margin: 0 auto;
  padding: 14px 24px 20px;
  max-width: 1480px;
  color: #858d9d;
  font-size: 11px;
  line-height: 1.45;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) repeat(5, minmax(132px, 1fr)) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #090b10;
  color: var(--ink);
  border-radius: 7px;
  min-height: 38px;
  padding: 8px 10px;
}

textarea {
  resize: vertical;
}

.toggle-row {
  display: flex;
  min-width: 420px;
}

.toggle-row button {
  border-radius: 0;
  flex: 1;
}

.toggle-row button:first-child {
  border-radius: 7px 0 0 7px;
}

.toggle-row button:last-child {
  border-radius: 0 7px 7px 0;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.stats div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 11px 14px;
}

.stats strong {
  display: block;
  font-size: 20px;
}

.stats span {
  color: var(--muted);
  font-size: 12px;
}

.panel {
  background: rgba(13, 15, 19, 0.9);
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
}

.hidden {
  display: none !important;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  padding: 12px;
}

.gallery.bucket-gallery {
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
}

.gallery.folder-gallery {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.render-card {
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  background: var(--panel);
  cursor: pointer;
  position: relative;
  display: grid;
  grid-template-rows: 210px auto auto auto auto;
  min-width: 0;
}

.render-card.bucket-card {
  grid-template-rows: 300px auto auto auto;
}

.render-card.status-approved {
  border-color: rgba(62, 229, 143, 0.48);
}

.render-card.status-denied,
.render-card.status-flagged {
  border-color: rgba(255, 107, 74, 0.58);
}

.render-card.status-archived {
  border-color: rgba(125, 92, 255, 0.5);
}

.thumb {
  background: #010203;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.thumb img,
.thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: white;
  background: #11131a;
  font-size: 22px;
  font-weight: 650;
}

.thumb-fallback.pdf {
  background: #25151f;
}

.card-bar,
.card-meta,
.card-title,
.comment-preview,
.card-actions {
  margin: 0 11px;
}

.card-bar {
  padding-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.card-title {
  padding-top: 7px;
  font-weight: 650;
  line-height: 1.25;
  min-height: 42px;
  overflow-wrap: anywhere;
}

.card-meta {
  color: var(--muted);
  font-size: 12px;
  padding-top: 5px;
}

.comment-preview {
  margin-top: 8px;
  padding: 8px;
  background: #1c1414;
  color: #ffb29d;
  border-radius: 7px;
  font-size: 12px;
  min-height: 32px;
  overflow-wrap: anywhere;
}

.card-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 11px 0 12px;
}

.card-menu-button {
  position: absolute;
  top: 10px;
  right: 10px;
  min-width: 38px;
  padding: 0;
  background: rgba(8, 9, 13, 0.92);
  color: var(--ink);
  font-weight: 700;
}

.card-menu {
  display: none;
  position: absolute;
  top: 52px;
  right: 10px;
  width: 190px;
  background: #0b0d12;
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 2;
}

.menu-open .card-menu {
  display: grid;
  gap: 6px;
}

.card-menu button {
  text-align: left;
  justify-content: start;
  width: 100%;
}

.card-menu-divider {
  display: block;
  height: 1px;
  background: var(--line);
  margin: 3px 0;
}

.card-menu .danger-menu-action {
  color: #ff8a82;
}

.card-menu .danger-menu-action:hover,
.card-menu .danger-menu-action:focus-visible {
  border-color: #ff5a50;
  color: #ffffff;
  background: rgba(255, 63, 54, 0.18);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  background: var(--soft);
  color: var(--pending);
  font-weight: 650;
}

.status-pill.approved {
  color: var(--approved);
  background: rgba(62, 229, 143, 0.13);
}

.status-pill.denied,
.status-pill.flagged {
  color: var(--changes);
  background: rgba(255, 107, 74, 0.13);
}

.status-pill.archived {
  color: var(--accent-2);
  background: rgba(125, 92, 255, 0.14);
}

.swipe-panel {
  display: grid;
  gap: 12px;
}

.swipe-card {
  min-height: calc(100vh - 290px);
  background: #010203;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  display: grid;
  grid-template-rows: 1fr auto;
}

.swipe-media {
  min-height: 420px;
  display: grid;
  place-items: center;
  background: #010203;
  cursor: zoom-in;
}

.swipe-media img,
.swipe-media video,
.swipe-media iframe {
  width: 100%;
  height: 100%;
  max-height: calc(100vh - 340px);
  object-fit: contain;
  border: 0;
  background: #010203;
}

.swipe-info {
  min-height: 64px;
  padding: 12px 14px;
  background: var(--panel);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.swipe-info strong {
  font-size: 16px;
}

.swipe-info span:last-child {
  color: var(--muted);
}

.swipe-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.swipe-actions button {
  min-height: 52px;
  font-weight: 650;
}

.approve-action {
  border-color: rgba(62, 229, 143, 0.45);
  color: var(--approved);
}

.deny-action,
.flag-action {
  border-color: rgba(185, 80, 45, 0.45);
  color: var(--changes);
}

.empty-state {
  min-height: 280px;
  display: grid;
  place-items: center;
  color: white;
}

.pager {
  min-height: 52px;
  padding: 8px 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  background: rgba(13, 15, 19, 0.9);
  border-top: 1px solid var(--line);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  padding: 12px;
}

.project-item {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0;
  background: var(--panel);
  display: grid;
  text-align: left;
  overflow: hidden;
  position: relative;
  min-height: 310px;
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.22);
}

.project-item:hover {
  transform: translateY(-1px);
}

.project-thumb {
  height: 190px;
  background: #010203;
  overflow: hidden;
}

.project-thumb .thumb {
  width: 100%;
  height: 100%;
}

.project-thumb img,
.project-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.project-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  min-width: 32px;
  height: 28px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #ff334f;
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.58), 0 0 18px rgba(255, 51, 79, 0.46);
  z-index: 1;
}

.project-badge.is-clear {
  background: rgba(62, 229, 143, 0.9);
  color: #04120b;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.5);
}

.bucket-folder-badge {
  background: #2d8cff;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.58), 0 0 18px rgba(45, 140, 255, 0.44);
}

.project-copy {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.project-item h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.project-item p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.project-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.project-status-row span {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 8px;
  background: var(--soft);
  color: var(--muted);
  font-size: 11px;
}

.project-empty {
  grid-column: 1 / -1;
  min-height: 240px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: var(--muted);
  background: #07090d;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.project-empty strong {
  color: var(--ink);
  font-size: 20px;
}

.upload-panel {
  padding: 0;
}

.upload-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
}

.upload-form > div:first-child,
.upload-file-field,
.upload-status {
  grid-column: 1 / -1;
}

.upload-form h2 {
  margin: 0 0 6px;
  font-size: 20px;
}

.upload-form p {
  margin: 0;
  color: var(--muted);
}

.upload-file-field input {
  min-height: 96px;
  padding: 28px 14px;
  border-style: dashed;
  background: #06080c;
}

.upload-form button {
  justify-self: start;
  min-width: 140px;
  background: #f6f6fb;
  color: #11131a;
  border-color: #f6f6fb;
}

.upload-status {
  font-size: 12px;
}

.admin-rows {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.admin-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px;
}

.admin-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.admin-row p {
  margin: 8px 0 0;
}

.detail-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(560px, 100vw);
  height: 100vh;
  background: var(--panel);
  box-shadow: var(--shadow);
  border-left: 1px solid var(--line);
  transform: translateX(105%);
  transition: transform 160ms ease;
  z-index: 10;
  padding: 18px;
  display: grid;
  grid-template-rows: auto auto minmax(120px, 1fr) auto auto auto;
  gap: 14px;
}

.detail-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  gap: 14px;
  justify-content: space-between;
  align-items: start;
}

.drawer-header p {
  margin: 0 0 5px;
  color: var(--accent-2);
  font-size: 12px;
  text-transform: uppercase;
}

.drawer-header h2 {
  margin: 0;
  font-size: 19px;
  overflow-wrap: anywhere;
}

.detail-preview {
  display: none;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  background: #010203;
  min-height: 80px;
  cursor: zoom-in;
}

.detail-preview.has-media {
  display: block;
}

.detail-preview img,
.detail-preview video,
.detail-preview iframe {
  display: block;
  width: 100%;
  max-height: 360px;
  border: 0;
  object-fit: contain;
  background: #111716;
}

.detail-preview .file-card {
  padding: 12px;
  display: grid;
  gap: 4px;
}

dl {
  margin: 0;
  overflow: auto;
}

dt {
  color: var(--muted);
  font-size: 12px;
  margin-top: 10px;
}

dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
}

.review-controls {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.rating-control {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.rating-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.rating-buttons {
  display: flex;
  gap: 6px;
}

.rating-buttons button {
  min-width: 38px;
  padding: 0;
  font-size: 20px;
  color: var(--pending);
}

.rating-buttons button.active {
  border-color: var(--pending);
  background: rgba(216, 195, 109, 0.16);
}

#confirmRating {
  min-height: 38px;
}

#confirmRating.pending-confirm {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(125, 92, 255, 0.14);
}

#markApproved.active {
  border-color: var(--approved);
  color: var(--approved);
}

#markChanges.active {
  border-color: var(--changes);
  color: var(--changes);
}

#markDenied.active {
  border-color: var(--changes);
  color: var(--changes);
}

#markArchived.active {
  border-color: var(--accent);
  color: var(--accent);
}

#markPending.active {
  border-color: var(--pending);
  color: var(--pending);
}

.note-field {
  font-size: 13px;
}

.drawer-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.drawer-actions button,
.drawer-actions a {
  min-height: 38px;
}

.drawer-actions a {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 12px;
  color: var(--accent);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.drawer-actions button:first-child {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translate(-50%, 90px);
  background: #17211f;
  color: white;
  border-radius: 7px;
  padding: 10px 14px;
  transition: transform 160ms ease;
  z-index: 20;
}

.toast.show {
  transform: translate(-50%, 0);
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(10, 14, 13, 0.94);
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
  padding: 14px;
}

.lightbox button {
  justify-self: end;
  background: #f6f6fb;
  color: #11131a;
}

.lightbox-media {
  min-height: 0;
  display: grid;
  place-items: center;
}

.lightbox-media img,
.lightbox-media video,
.lightbox-media iframe {
  width: 100%;
  height: 100%;
  max-height: calc(100vh - 78px);
  object-fit: contain;
  border: 0;
}

@media (max-width: 1180px) {
  .toolbar {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .toggle-row {
    min-width: 100%;
    flex-wrap: wrap;
  }

  .toggle-row button {
    min-width: 33.333%;
  }
}

@media (max-width: 720px) {
  .app-header {
    align-items: stretch;
    padding: 18px;
    flex-direction: column;
  }

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

  .account-panel {
    justify-content: stretch;
  }

  .account-panel button {
    width: 100%;
  }

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

  .app-shell {
    padding: 10px;
  }

  .toolbar,
  .stats {
    grid-template-columns: 1fr;
  }

  .gallery {
    grid-template-columns: 1fr;
    padding: 8px;
  }

  .gallery.bucket-gallery {
    grid-template-columns: 1fr;
  }

  .render-card {
    grid-template-rows: 260px auto auto auto auto;
  }

  .render-card.bucket-card {
    grid-template-rows: 340px auto auto auto;
  }

  .review-controls {
    grid-template-columns: 1fr;
  }

  .rating-control {
    grid-template-columns: 1fr;
  }

  .swipe-card {
    min-height: 58vh;
  }

  .swipe-media {
    min-height: 360px;
  }

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