:root {
  --hub-sidebar: 330px;
  --hub-maroon: #651d32;
  --hub-maroon-dark: #3d0f1d;
  --hub-gold: #d7b56d;
  --hub-surface: #ffffff;
  --hub-canvas: #f4f2ef;
  --hub-line: #d9dee3;
  --hub-muted: #67717a;
  --hub-green: #1e6b45;
  --hub-red: #9a2e2e;
}

body.hub-auth-pending > :not(.access-blocker) {
  visibility: hidden;
}

.access-blocker {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(145deg, #2d0b16, #651d32 58%, #8c3852);
}

.access-card {
  width: min(440px, 100%);
  padding: 36px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(0, 0, 0, .28);
  text-align: center;
}

.access-card h1 { margin: 7px 0 12px; font-family: Georgia, serif; color: var(--hub-maroon); }
.access-card p:not(.eyebrow) { margin: 0 0 22px; color: var(--hub-muted); }
.access-logo {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  margin: 0 auto 17px;
  border-radius: 20px;
  background: var(--hub-maroon);
  color: #fff;
  font: 800 25px/1 Georgia, serif;
}

.hamburger {
  width: 48px;
  height: 48px;
  display: grid;
  align-content: center;
  gap: 5px;
  flex: 0 0 auto;
  padding: 0 13px;
  border: 1px solid rgba(255,255,255,.38);
  border-radius: 13px;
  background: rgba(255,255,255,.10);
  color: #fff;
}

.hamburger span { display: block; height: 2px; border-radius: 2px; background: currentColor; }
.hamburger:hover { background: rgba(255,255,255,.18); }

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 800;
  background: rgba(19, 15, 17, .56);
  backdrop-filter: blur(2px);
}

.project-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 900;
  width: min(var(--hub-sidebar), 90vw);
  display: grid;
  grid-template-rows: auto 1fr auto;
  color: #fff;
  background: #24171c;
  box-shadow: 20px 0 70px rgba(0,0,0,.35);
  transform: translateX(-105%);
  transition: transform .22s ease;
}

.project-sidebar.is-open { transform: translateX(0); }

.sidebar-heading {
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 18px 16px 22px;
  border-bottom: 1px solid rgba(255,255,255,.12);
  background: linear-gradient(135deg, var(--hub-maroon-dark), var(--hub-maroon));
}

.sidebar-heading div { display: grid; }
.sidebar-heading span { color: #e5cdda; font-size: 11px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.sidebar-heading strong { font: 700 26px/1.2 Georgia, serif; }

.icon-button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--hub-line);
  border-radius: 12px;
  background: #fff;
  color: #3e3538;
  font-size: 24px;
}

.sidebar-close { border-color: rgba(255,255,255,.25); background: rgba(255,255,255,.08); color: #fff; }
.sidebar-scroll { overflow-y: auto; padding: 16px 12px 24px; }

.sidebar-home,
.project-nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #f5eef1;
  text-align: left;
  font-weight: 700;
}

.sidebar-home:hover,
.project-nav-item:hover,
.sidebar-home.is-current,
.project-nav-item.is-current { background: rgba(255,255,255,.11); }
.nav-icon { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 8px; background: rgba(255,255,255,.1); }
.sidebar-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 22px 8px 8px;
  color: #c9b9bf;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.mini-add { width: 27px; height: 27px; padding: 0; border: 0; border-radius: 8px; background: var(--hub-gold); color: #2d1820; font-size: 20px; line-height: 1; }
.project-nav-item { position: relative; padding-left: 14px; color: #f1e9ec; font-weight: 620; }
.project-nav-item::before { content: ''; width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: #5cb887; }
.project-nav-item[data-status="inactive"] { color: #b9adb1; }
.project-nav-item[data-status="inactive"]::before { background: #7c7175; }
.sidebar-empty { margin: 8px 12px; color: #9d9095; font-size: 13px; }
.admin-link { margin-top: 26px; border-top: 1px solid rgba(255,255,255,.09); border-radius: 0 0 10px 10px; }

.sidebar-user {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 15px;
  border-top: 1px solid rgba(255,255,255,.12);
  background: #1a1115;
}
.sidebar-user > div:nth-child(2) { min-width: 0; display: grid; }
.sidebar-user strong,
.sidebar-user span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user span { color: #aa9ca1; font-size: 11px; }
.sidebar-user a { color: #dbc4cd; font-size: 11px; }
.user-avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: var(--hub-maroon); font-weight: 800; }

.app-view[hidden] { display: none !important; }
body main.app-view { width: min(1120px, calc(100% - 32px)); margin: 28px auto 54px; }

.project-hero,
.admin-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 26px 28px;
  border: 1px solid var(--hub-line);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 14px 38px rgba(30,25,27,.08);
}

.project-hero h2,
.admin-heading h2 { margin: 3px 0 4px; color: var(--hub-maroon); font: 700 clamp(25px, 4vw, 38px)/1.08 Georgia, serif; }
.project-hero p,
.admin-heading p { margin: 0; color: var(--hub-muted); }
.project-hero-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 999px; background: #e9f6ef; color: var(--hub-green); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.status-pill::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status-pill.is-inactive { background: #efedef; color: #70666a; }

.project-tabs {
  display: flex;
  gap: 6px;
  margin: 18px 0;
  padding: 6px;
  overflow-x: auto;
  border: 1px solid var(--hub-line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(30,25,27,.05);
}
.project-tabs button { display: flex; align-items: center; gap: 7px; min-width: max-content; padding: 10px 16px; border: 0; border-radius: 10px; background: transparent; color: #5f5659; font-weight: 750; }
.project-tabs button.is-current { background: var(--hub-maroon); color: #fff; }
.project-tabs span { min-width: 22px; padding: 2px 6px; border-radius: 999px; background: rgba(0,0,0,.08); font-size: 11px; text-align: center; }
.project-tabs button.is-current span { background: rgba(255,255,255,.18); }

.project-tab-panel,
.admin-card {
  padding: 24px;
  border: 1px solid var(--hub-line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 14px 38px rgba(30,25,27,.07);
}
.section-toolbar,
.admin-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 19px; }
.section-toolbar h3,
.admin-card h3 { margin: 0; color: var(--hub-maroon); font: 700 22px/1.2 Georgia, serif; }
.section-toolbar p,
.admin-card-heading p { margin: 4px 0 0; color: var(--hub-muted); font-size: 13px; }
.upload-button { position: relative; overflow: hidden; }
.upload-button input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.upload-progress { margin-bottom: 16px; padding: 12px 14px; border-radius: 10px; background: #fff5dc; color: #7b530c; font-size: 13px; font-weight: 700; }

.project-photo-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.project-photo-card { position: relative; overflow: hidden; min-height: 190px; border-radius: 14px; background: #e8e4e5; }
.project-photo-card img { width: 100%; height: 190px; display: block; object-fit: cover; transition: transform .2s ease; }
.project-photo-card:hover img { transform: scale(1.025); }
.project-photo-card a { color: inherit; text-decoration: none; }
.photo-card-info { position: absolute; inset: auto 0 0; padding: 32px 11px 10px; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.78)); font-size: 11px; }
.photo-card-info strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.photo-source-badge { position: absolute; top: 9px; left: 9px; padding: 4px 7px; border-radius: 999px; background: rgba(101,29,50,.9); color: #fff; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.asset-delete { position: absolute; top: 8px; right: 8px; z-index: 2; width: 30px; height: 30px; border: 0; border-radius: 9px; background: rgba(29,20,23,.82); color: #fff; }
.load-more { display: block; margin: 18px auto 0; }

.record-list { display: grid; gap: 10px; }
.record-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  padding: 13px 14px;
  border: 1px solid #e3dfe0;
  border-radius: 13px;
  background: #fbfaf9;
}
.record-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: #f5eaee; color: var(--hub-maroon); font-size: 12px; font-weight: 900; }
.record-copy { min-width: 0; }
.record-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.record-copy span { display: block; margin-top: 2px; color: var(--hub-muted); font-size: 12px; }
.record-actions { display: flex; gap: 7px; }
.record-actions a,
.record-actions button { padding: 7px 10px; border: 1px solid #d8d1d4; border-radius: 8px; background: #fff; color: var(--hub-maroon); font-size: 12px; font-weight: 750; text-decoration: none; }
.empty-state { grid-column: 1 / -1; padding: 34px 18px; border: 1px dashed #d5cdd0; border-radius: 14px; color: var(--hub-muted); text-align: center; }
.empty-state strong { display: block; margin-bottom: 4px; color: #4c4245; }

.admin-heading { margin-bottom: 18px; }
.admin-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(340px, .95fr); gap: 18px; align-items: start; }
.admin-project-list,
.team-list { display: grid; gap: 9px; }
.admin-project-row,
.team-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px; border: 1px solid #e3dfe0; border-radius: 12px; }
.admin-project-row strong,
.team-row strong { display: block; }
.admin-project-row span,
.team-row span { color: var(--hub-muted); font-size: 12px; }
.admin-row-actions { display: flex; align-items: center; gap: 7px; }
.small-button { padding: 7px 9px; border: 1px solid #d7cfd2; border-radius: 8px; background: #fff; color: var(--hub-maroon); font-size: 11px; font-weight: 800; }
.small-button.is-danger { color: var(--hub-red); }
.invite-form { display: grid; grid-template-columns: 1fr 1.3fr auto; gap: 9px; align-items: end; margin-bottom: 18px; }
.invite-form label { display: grid; gap: 5px; color: #544a4e; font-size: 11px; font-weight: 800; }
.invite-form input { width: 100%; min-height: 42px; padding: 8px 10px; border: 1px solid #cfd4d9; border-radius: 9px; }

.app-dialog { width: min(520px, calc(100% - 28px)); padding: 0; border: 0; border-radius: 20px; box-shadow: 0 30px 90px rgba(0,0,0,.32); }
.app-dialog::backdrop { background: rgba(18,13,15,.62); backdrop-filter: blur(2px); }
.app-dialog form { padding: 24px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.dialog-heading h2 { margin: 2px 0 0; color: var(--hub-maroon); font: 700 28px/1.1 Georgia, serif; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }

select[data-project] { border-color: #b98a99; background: #fffdfd; }
select[data-project]:invalid { color: #776c70; }

@media (max-width: 900px) {
  .project-photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .admin-grid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .header-inner { width: calc(100% - 22px); padding: 14px 0; gap: 10px; }
  .hamburger { width: 44px; height: 44px; border-radius: 12px; }
  .brand { gap: 10px; }
  .brand-mark { width: 45px; height: 45px; border-radius: 12px; font-size: 18px; }
  .brand-copy p { font-size: 9px; letter-spacing: .1em; }
  .brand-copy h1 { font-size: 24px; }
  .header-note { display: none; }
  body main.app-view { width: calc(100% - 20px); margin: 14px auto 32px; }
  .project-hero,
  .admin-heading { align-items: flex-start; flex-direction: column; padding: 20px; border-radius: 16px; }
  .project-hero-actions { width: 100%; justify-content: flex-start; }
  .project-hero-actions .button { flex: 1 1 auto; }
  .project-tab-panel,
  .admin-card { padding: 16px; border-radius: 15px; }
  .section-toolbar { align-items: flex-start; flex-direction: column; gap: 13px; }
  .section-toolbar .button,
  .section-toolbar .upload-button { width: 100%; justify-content: center; text-align: center; }
  .project-photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .project-photo-card,
  .project-photo-card img { min-height: 145px; height: 145px; }
  .record-row { grid-template-columns: auto minmax(0, 1fr); }
  .record-actions { grid-column: 1 / -1; }
  .record-actions a,
  .record-actions button { flex: 1; text-align: center; }
  .invite-form { grid-template-columns: 1fr; }
  .admin-project-row,
  .team-row { grid-template-columns: 1fr; }
  .admin-row-actions { justify-content: flex-start; }
  .app-dialog form { padding: 20px; }
}

@media (max-width: 390px) {
  .brand-mark { display: none; }
  .project-photo-grid { grid-template-columns: 1fr; }
  .project-photo-card,
  .project-photo-card img { height: 220px; }
}

@media print {
  .hamburger,
  .project-sidebar,
  .sidebar-backdrop,
  .access-blocker,
  #projectView,
  #adminView { display: none !important; }
}
