:root {
  --bg: #f3efe9;
  --bg-strong: #efe7df;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-strong: #ffffff;
  --surface-soft: #f7f3f0;
  --ink: #1b1a18;
  --muted: #5d5a56;
  --brand: #a3262d;
  --brand-strong: #7b1f24;
  --brand-soft: rgba(163, 38, 45, 0.1);
  --success: #1f8b61;
  --warning: #a96a1d;
  --border: rgba(27, 26, 24, 0.08);
  --shadow: 0 24px 60px rgba(40, 31, 24, 0.12);
  --shadow-soft: 0 12px 28px rgba(40, 31, 24, 0.08);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(163, 38, 45, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(35, 95, 133, 0.08), transparent 25%),
    linear-gradient(180deg, #f8f5f1 0%, var(--bg) 100%);
}

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

button, input, select {
  font: inherit;
}

button {
  border: none;
  border-radius: 999px;
  padding: 11px 18px;
  background: linear-gradient(135deg, var(--brand) 0%, #c84e4d 100%);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

button:hover {
  transform: translateY(-1px);
  filter: saturate(1.04);
}

.secondary-btn {
  background: linear-gradient(180deg, #f8f3ee 0%, #f1e8e2 100%);
  color: var(--ink);
  border: 1px solid rgba(27, 26, 24, 0.08);
  box-shadow: none;
}

a.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ready-btn {
  background: linear-gradient(135deg, #1e7a59 0%, #2ea06f 100%);
}

.ready-btn.is-pending {
  background: linear-gradient(135deg, #b86d29 0%, #d79947 100%);
}

.page-shell {
  max-width: 1380px;
  margin: 0 auto;
  padding: 24px 20px 52px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 22px 26px;
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(96, 19, 21, 0.98) 0%, rgba(148, 31, 36, 0.94) 100%);
  color: #fff;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-badge {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-weight: 800;
}

.topbar h1,
.panel h2,
.panel h3,
.panel h4 {
  margin: 0;
}

.topbar p {
  margin: 4px 0 0;
  opacity: 0.9;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-pill {
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.flash-stack {
  margin: 18px 0 0;
  display: grid;
  gap: 10px;
}

.flash {
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow-soft);
  font-weight: 600;
}

.notifications-panel {
  margin: 18px 0 0;
}

.notifications-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.notification-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
}

.notification-item {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-soft);
}

.notification-item.notification-alert {
  border-left: 4px solid #ce7b18;
}

.notification-item.notification-warning {
  border-left: 4px solid #a93d3d;
}

.notification-item.notification-success {
  border-left: 4px solid #1d8e66;
}

.notification-title {
  font-weight: 700;
  margin-bottom: 6px;
}

.notification-message {
  color: var(--muted);
  line-height: 1.5;
}

.notification-time {
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--muted);
}

.flash-success {
  border-color: rgba(29, 142, 102, 0.16);
  background: rgba(29, 142, 102, 0.06);
}

.flash-error {
  border-color: rgba(163, 38, 45, 0.18);
  background: rgba(163, 38, 45, 0.05);
}

.content-grid,
.workspace {
  display: grid;
  gap: 20px;
}

.login-grid {
  max-width: 520px;
  margin: 36px auto 0;
}

.panel {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 26px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.panel-hero,
.section-heading {
  display: grid;
  gap: 10px;
}

.panel-subtitle,
.item-meta,
.photo-meta,
.muted {
  color: var(--muted);
}

.form-stack,
.composer,
.stage-edit-grid,
.upload-form {
  display: grid;
  gap: 10px;
}

input,
select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(35, 31, 31, 0.12);
  border-radius: 14px;
  background: #fff;
}

.password-field {
  position: relative;
  display: grid;
}

.password-field input {
  padding-right: 108px;
}

.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  padding: 7px 10px;
  border-radius: 10px;
  background: rgba(27, 26, 24, 0.04);
  border: 1px solid rgba(27, 26, 24, 0.08);
  color: var(--ink);
  box-shadow: none;
  font-size: 0.8rem;
  font-weight: 600;
}

.password-toggle:hover {
  background: rgba(27, 26, 24, 0.08);
  transform: translateY(-50%);
}

input:focus,
select:focus {
  outline: none;
  border-color: rgba(168, 36, 36, 0.42);
  box-shadow: 0 0 0 4px rgba(168, 36, 36, 0.08);
}

.action-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.dashboard-hero {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border-radius: 26px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.82) 0%, rgba(247, 240, 236, 0.96) 100%);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}

.dashboard-copy {
  display: grid;
  gap: 10px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  min-width: 320px;
}

.metric-card {
  background: linear-gradient(180deg, #ffffff 0%, #f8f4f2 100%);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 16px 18px;
  display: grid;
  gap: 6px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.72);
}

.metric-label,
.eyebrow,
.kicker {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(168, 36, 36, 0.08);
  color: var(--brand);
  border: 1px solid rgba(168, 36, 36, 0.12);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.metric-card strong {
  font-size: 1.4rem;
}

.workspace {
  grid-template-columns: 340px 1fr;
  align-items: start;
}

.sidebar .panel,
.main-column > .panel,
.stage-card {
  margin-bottom: 16px;
}

.project-list {
  display: grid;
  gap: 10px;
}

.project-search-form {
  display: grid;
  gap: 10px;
  margin: 12px 0 14px;
}

.project-item {
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.project-item:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

.users-panel {
  margin-top: 18px;
  display: grid;
  gap: 12px;
}

.admin-links {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.archive-heading {
  margin-top: 18px;
}

.admin-link-btn {
  width: 100%;
}

.user-list {
  display: grid;
  gap: 12px;
}

.user-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}

.user-form {
  display: grid;
  gap: 10px;
}

.project-picklist {
  display: grid;
  gap: 8px;
  max-height: 180px;
  overflow: auto;
  padding: 8px 0;
}

.user-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  color: var(--ink);
}

.checkbox-row input {
  width: auto;
  margin: 0;
}

.project-item,
.stage-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,0.96) 0%, rgba(249,245,241,0.96) 100%);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}

.stage-card.is-ready,
.substage-card.is-ready {
  border-color: rgba(29, 142, 102, 0.2);
  box-shadow: 0 18px 36px rgba(29, 142, 102, 0.06);
}

.stage-card.is-ready {
  background: linear-gradient(180deg, rgba(243, 255, 249, 0.98) 0%, rgba(255, 255, 255, 0.98) 100%);
}

.substage-card.is-ready {
  background: rgba(243, 255, 249, 0.9);
}

.stage-card.is-pending,
.substage-card.is-pending {
  opacity: 0.98;
}

.stage-card,
.substage-card {
  overflow: clip;
}

.stage-summary,
.substage-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  list-style: none;
}

.stage-summary::-webkit-details-marker,
.substage-summary::-webkit-details-marker {
  display: none;
}

.stage-summary-copy,
.substage-summary > div:first-child {
  display: grid;
  gap: 8px;
}

.stage-summary p,
.substage-summary p {
  margin: 0;
}

.stage-summary-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.summary-pill {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(35, 31, 31, 0.05);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.status-pill.is-ready {
  background: rgba(21, 124, 42, 0.1);
  color: #157c2a;
  border-color: rgba(21, 124, 42, 0.14);
}

.status-pill.is-pending {
  background: rgba(35, 31, 31, 0.05);
  color: var(--muted);
  border-color: rgba(35, 31, 31, 0.08);
}

.status-icon {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  font-size: 0.8rem;
  line-height: 1;
}

.status-pill.is-ready .status-icon {
  background: rgba(21, 124, 42, 0.14);
}

.status-pill.is-pending .status-icon {
  background: rgba(35, 31, 31, 0.08);
}

.summary-chevron {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(168, 36, 36, 0.08);
  color: var(--brand);
  transition: transform 0.18s ease;
}

.stage-card[open] .summary-chevron,
.substage-card[open] .summary-chevron {
  transform: rotate(180deg);
}

.stage-body,
.substage-body {
  display: grid;
  gap: 12px;
  padding-top: 16px;
}

.substage-body {
  padding: 16px 0 4px;
}

.project-item.is-active {
  border-color: rgba(168, 36, 36, 0.34);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(249, 243, 241, 0.98) 100%);
}

.project-item.is-archived {
  opacity: 0.82;
}

.item-title-row,
.stage-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.item-title {
  font-weight: 700;
}

.item-badge {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(168, 36, 36, 0.08);
  color: var(--brand);
  font-size: 0.8rem;
  font-weight: 700;
}

.project-progress {
  display: flex;
  justify-content: flex-start;
}

.main-column {
  display: grid;
  gap: 16px;
}

.project-header {
  display: grid;
  gap: 16px;
}

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

.create-panel {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.72);
}

.create-panel-toggle {
  list-style: none;
  cursor: pointer;
  font-weight: 700;
  color: var(--brand);
}

.create-panel-toggle::-webkit-details-marker {
  display: none;
}

.create-panel .composer {
  margin-top: 10px;
}

.template-actions {
  margin-top: 10px;
  display: grid;
  gap: 10px;
}

.template-list {
  display: grid;
  gap: 10px;
}

.template-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.72);
}

.template-item form {
  margin: 0;
}

.archived-note {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(35, 31, 31, 0.05);
  color: var(--muted);
}

.substage-block {
  display: grid;
  gap: 12px;
  padding-top: 4px;
}

.substage-list {
  display: grid;
  gap: 12px;
}

.substage-card {
  padding: 14px;
  border-radius: 16px;
  background: rgba(246, 242, 238, 0.85);
  border: 1px solid var(--border);
}

.substage-card > summary {
  padding: 2px 0;
}

.stage-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

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

.file-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.file-filter-chip {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(35, 31, 31, 0.12);
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  box-shadow: none;
}

.file-filter-chip.is-active {
  background: linear-gradient(135deg, #8f1e1e 0%, #c13d3d 100%);
  color: #fff;
  border-color: transparent;
}

.photo-card {
  padding: 10px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--border);
  scroll-margin-top: 100px;
}

.photo-card img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 12px;
}

.completion-video {
  width: 100%;
  height: 150px;
  border-radius: 12px;
  background: #120f0f;
}

.photo-open-btn {
  border: none;
  padding: 0;
  margin: 0;
  background: transparent;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: none;
}

.photo-open-btn img {
  display: block;
}

.file-card-link {
  min-height: 150px;
  display: grid;
  place-items: center;
  gap: 10px;
  text-align: center;
  padding: 16px;
  border-radius: 12px;
  background: rgba(246, 242, 238, 0.85);
  color: var(--text);
  text-decoration: none;
  border: 1px dashed rgba(35, 31, 31, 0.16);
}

.file-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 14px;
  background: rgba(168, 36, 36, 0.1);
  color: #8f1e1e;
  font-size: 1.5rem;
  font-weight: 700;
}

.file-card-name {
  word-break: break-word;
}

.file-meta-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.file-meta-head strong {
  display: none;
}

.inline-file-icon {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(168, 36, 36, 0.08);
  flex-shrink: 0;
}

.file-type-label {
  color: var(--muted);
}

.photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
}

.photo-lightbox[hidden] {
  display: none !important;
}

.photo-lightbox-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  background: rgba(20, 16, 16, 0.82);
  box-shadow: none;
  border-radius: 0;
  padding: 0;
}

.photo-lightbox-content {
  position: relative;
  z-index: 1;
  width: min(96vw, 1200px);
  max-height: 92vh;
  display: grid;
  place-items: center;
}

.photo-lightbox-content img {
  width: 100%;
  max-height: 88vh;
  object-fit: contain;
  border-radius: 14px;
  background: #111;
}

.photo-lightbox-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
}

.confirm-modal,
.review-modal {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: grid;
  place-items: center;
}

.confirm-modal[hidden],
.review-modal[hidden] {
  display: none !important;
}

.confirm-backdrop,
.review-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  border-radius: 0;
  background: rgba(20, 16, 16, 0.64);
  padding: 0;
  box-shadow: none;
}

.confirm-card,
.review-card {
  position: relative;
  z-index: 1;
  width: min(92vw, 420px);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
}

.review-card {
  width: min(92vw, 520px);
  gap: 16px;
}

.review-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.review-kicker {
  margin-bottom: 4px;
}

.review-card-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.review-comment-form {
  display: grid;
  gap: 14px;
}

.review-comment-form textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(35, 31, 31, 0.12);
  background: #fff;
  font: inherit;
  color: var(--ink);
}

.review-comment-form textarea:focus {
  outline: none;
  border-color: rgba(168, 36, 36, 0.42);
  box-shadow: 0 0 0 4px rgba(168, 36, 36, 0.08);
}

.review-action-row {
  justify-content: flex-end;
}

.icon-close-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  padding: 0;
  background: rgba(35, 31, 31, 0.04);
  color: var(--ink);
  box-shadow: none;
}

.confirm-card h3,
.confirm-card p {
  margin: 0;
}

.danger-btn {
  background: linear-gradient(135deg, #a82424 0%, #d04343 100%);
}

.photo-meta {
  margin-top: 8px;
  font-size: 0.9rem;
}

.empty-state,
.empty-inline {
  padding: 20px;
  border-radius: 18px;
  border: 1px dashed rgba(35, 31, 31, 0.14);
  background: rgba(255, 255, 255, 0.6);
  color: var(--muted);
}

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

  .file-filter-bar {
    gap: 6px;
  }

  .template-item {
    flex-direction: column;
    align-items: stretch;
  }

  .dashboard-hero {
    flex-direction: column;
  }

  .metric-grid {
    min-width: 0;
  }
}

@media (max-width: 720px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

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