:root {
  --bg: #f4f7fb;
  --bg-alt: #eef3f9;
  --surface: #ffffff;
  --surface-border: #e5eaf1;
  --text: #0f172a;
  --text-muted: #5b6678;
  --accent: #0f5bd8;
  --accent-strong: #0b47ab;
  --danger: #c62828;
  --success-bg: #eaf6ef;
  --success-text: #156d3a;
  --radius: 8px;
  --shadow-soft: 0 8px 26px rgba(15, 23, 42, 0.07);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Inter", "Avenir Next", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-alt) 100%);
  line-height: 1.45;
}

body.compact-page {
  background: linear-gradient(180deg, #f7f9fd 0%, #eef3f9 100%);
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(8px);
  background: rgba(248, 251, 255, 0.9);
  border-bottom: 1px solid var(--surface-border);
}

.site-header-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0.85rem 1.2rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  justify-self: start;
}

.brand-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 8px;
}

.brand-name {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.nav-links {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.25rem;
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 0.46rem 0.9rem;
  font-weight: 600;
  font-size: 0.92rem;
  color: #1b2a44;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-link:hover {
  background: #edf3ff;
  color: #0e49b5;
}

.header-actions {
  justify-self: end;
}

.header-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--surface-border);
  background: var(--surface);
  padding: 0.48rem 0.84rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.header-action:hover {
  border-color: #cfd8e6;
  background: #f8fbff;
}

.container {
  max-width: 1240px;
  margin: 1.6rem auto;
  padding: 0 1.1rem 2rem;
  display: grid;
  gap: 1rem;
}

.compact-container {
  margin-top: 0.8rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 1.1rem 1.2rem;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0.2px;
}

h2 {
  font-size: 1.1rem;
}

p {
  margin: 0.45rem 0;
}

.hint {
  color: var(--text-muted);
}

.error {
  color: var(--danger);
  font-weight: 650;
}

.stack {
  display: grid;
  gap: 0.55rem;
}

label {
  font-size: 0.88rem;
  font-weight: 600;
  color: #25324a;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #d7dfec;
  border-radius: 8px;
  padding: 0.58rem 0.68rem;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: #ffffff;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: #9ab6ea;
  box-shadow: 0 0 0 3px rgba(31, 99, 223, 0.14);
}

button {
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  padding: 0.56rem 0.95rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 650;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.08s ease;
}

button:hover {
  background: var(--accent-strong);
}

button:disabled,
input:disabled,
textarea:disabled,
select:disabled {
  cursor: wait;
  opacity: 0.72;
}

button:active {
  transform: translateY(1px);
}

.stack > button {
  margin-top: 0.18rem;
  width: fit-content;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.93rem;
}

thead th {
  text-transform: uppercase;
  font-size: 0.76rem;
  letter-spacing: 0.5px;
  color: #6d7a8e;
  background: #f7f9fd;
  border-top: 1px solid var(--surface-border);
}

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--surface-border);
  padding: 0.68rem 0.56rem;
  vertical-align: middle;
}

tbody tr:hover {
  background: #f9fbff;
}

tbody tr td:first-child,
thead tr th:first-child {
  border-left: 1px solid var(--surface-border);
}

tbody tr td:last-child,
thead tr th:last-child {
  border-right: 1px solid var(--surface-border);
}

thead tr th:first-child {
  border-top-left-radius: 8px;
}

thead tr th:last-child {
  border-top-right-radius: 8px;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  font-size: 0.84rem;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.7rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.9rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 700;
}

.tag.active {
  background: var(--success-bg);
  color: var(--success-text);
}

.tag.archived {
  background: #eceff4;
  color: #5d6777;
}

.actions-cell {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.actions-cell a,
.button-link,
.ghost-link,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid #d7dfec;
  background: #ffffff;
  padding: 0.35rem 0.58rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #223149;
}

.button-link:hover,
.ghost-link:hover,
.ghost-button:hover,
.actions-cell a:hover {
  border-color: #9fb3d4;
  background: #f3f7ff;
}

.button-link:focus-visible,
.ghost-link:focus-visible,
.ghost-button:focus-visible,
.actions-cell a:focus-visible,
.gallery-card:focus-visible {
  outline: 3px solid rgba(31, 99, 223, 0.24);
  outline-offset: 2px;
}

.disabled-link {
  color: #7b8798;
  cursor: not-allowed;
  opacity: 0.75;
}

.inline-action-form {
  margin: 0;
}

.ghost-button {
  margin: 0;
}

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

.danger-button:hover {
  background: #a11f1f;
}

.danger-link {
  color: #9b1c1c;
  border-color: #efc1c1;
  background: #fff7f7;
}

.inline-actions {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  align-items: center;
}

.clickable-row {
  cursor: pointer;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.9rem;
  margin-top: 0.9rem;
}

.gallery-card {
  min-height: 168px;
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  background: #ffffff;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.62rem;
  cursor: default;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.08s ease;
}

.gallery-card[data-href],
.gallery-card[data-floating-detail] {
  cursor: pointer;
}

.gallery-card:hover {
  border-color: #b8c7df;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.11);
  transform: translateY(-1px);
}

.gallery-card h3 {
  font-size: 1.02rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.gallery-card-header,
.card-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.gallery-card-header {
  justify-content: space-between;
}

.eyebrow,
.meta-line {
  margin: 0;
}

.eyebrow {
  color: #465670;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.35px;
  text-transform: uppercase;
}

.meta-line {
  color: var(--text-muted);
  font-size: 0.86rem;
}

.card-actions {
  margin-top: auto;
}

.document-card {
  min-height: 142px;
}

.document-card.status-submitted {
  background: #fff9df;
  border-color: #f1dd89;
}

.document-card.status-approved {
  background: #edf8f0;
  border-color: #aad8b8;
}

.document-card.status-rejected {
  background: #fff0f0;
  border-color: #efb5b5;
}

.project-registry-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 1rem;
  align-items: start;
}

.template-search-strip {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  margin-bottom: 1rem;
  padding: 0.35rem 0.4rem 0.35rem 0.9rem;
  border: 1px solid var(--surface-border);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.template-search-strip input[type="search"] {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0.45rem 0.1rem;
  box-shadow: none;
}

.template-search-strip input[type="search"]:focus {
  box-shadow: none;
}

.template-search-button {
  width: 2.3rem;
  height: 2.3rem;
  padding: 0;
  border-radius: 999px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.template-search-button svg {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
}

.template-search-actions {
  display: inline-flex;
  align-items: stretch;
  flex: 0 0 auto;
  gap: 0;
  margin-left: 0.1rem;
  border: 1px solid var(--surface-border);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  background: var(--surface);
}

.template-search-actions .template-search-button {
  width: 2.55rem;
  height: 2.55rem;
  padding: 0;
  flex: 0 0 auto;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.template-search-actions .template-search-button:focus-visible {
  position: relative;
  z-index: 1;
  outline: none;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.38);
}

.template-search-actions .template-search-button:active {
  transform: none;
}

.template-search-actions .template-search-button + .template-search-button {
  border-left: 1px solid rgba(255, 255, 255, 0.22);
}

.template-search-actions .template-search-button svg {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
}

.registry-sort-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.55rem;
}

.registry-sort-form {
  display: inline-flex;
}

.registry-sort-form select {
  min-width: 180px;
}

.template-create-form {
  max-width: 560px;
}

.template-gallery .template-card {
  min-height: 160px;
}

.registry-main {
  overflow-x: auto;
}

.registry-sidebar {
  position: sticky;
  top: 86px;
  display: grid;
  gap: 0.85rem;
}

.sidebar-stack {
  display: grid;
  gap: 0.75rem;
}

.sidebar-card {
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  background: #f8fbff;
  padding: 0.8rem;
  display: grid;
  gap: 0.55rem;
}

.sidebar-card h3 {
  font-size: 0.98rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.project-history-shell {
  overflow: hidden;
}

.project-history-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--surface-border);
}

.project-history-header h2 {
  font-size: 1.8rem;
}

.project-history-timeline {
  display: grid;
  gap: 0.9rem;
  padding-top: 1rem;
}

.history-stop {
  display: grid;
  gap: 0;
}

.history-card {
  border: 1px solid var(--surface-border);
  border-left-width: 8px;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
  padding: 0.95rem 1rem;
  display: grid;
  gap: 0.45rem;
  min-height: 0;
}

.history-card-top {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 0.5rem;
}

.history-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  color: #13203a;
}

.history-tag {
  white-space: nowrap;
}

.history-meta {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.history-tone-blue .history-card {
  border-left-color: #4a8bf3;
  background: #eef5ff;
}

.history-tone-submitted .history-card {
  border-left-color: #d48a1b;
  background: #fff9ea;
}

.history-tone-rejected .history-card {
  border-left-color: #e05555;
  background: #fff0f0;
}

.history-tone-approved .history-card {
  border-left-color: #18a06b;
  background: #eefaf4;
}

.history-tone-not-started .history-card {
  border-left-color: #64748b;
  background: #f5f7fa;
}

.history-tone-blue .history-tag {
  background: #4a8bf3;
  color: #ffffff;
}

.history-tone-submitted .history-tag {
  background: #d48a1b;
  color: #ffffff;
}

.history-tone-rejected .history-tag {
  background: #e05555;
  color: #ffffff;
}

.history-tone-approved .history-tag {
  background: #18a06b;
  color: #ffffff;
}

.history-tone-not-started .history-tag {
  background: #64748b;
  color: #ffffff;
}

@media (max-width: 820px) {
  .project-history-header {
    align-items: start;
    flex-direction: column;
  }

  .registry-sort-controls {
    justify-content: flex-start;
  }
}

.document-preview-shell {
  width: 100%;
  min-height: 520px;
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  background: #f8fbff;
  overflow: hidden;
}

.document-preview-frame {
  width: 100%;
  min-height: 520px;
  border: 0;
}

.detail-shell {
  display: grid;
  gap: 1rem;
}

.detail-hero {
  display: grid;
  gap: 0.8rem;
}

.detail-hero-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.detail-meta {
  display: grid;
  gap: 0.35rem;
}

.detail-meta-actions,
.detail-secondary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.detail-meta-actions .tag {
  color: #25324a;
  background: #edf2f7;
}

.detail-meta-actions .tag.status-submitted {
  background: #fff9df;
  color: #8b6a00;
}

.detail-meta-actions .tag.status-approved {
  background: #edf8f0;
  color: #156d3a;
}

.detail-meta-actions .tag.status-rejected {
  background: #fff0f0;
  color: #9b1c1c;
}

.detail-meta-actions .tag.status-not-started {
  background: #eef3f9;
  color: #5b6678;
}

.revision-timeline-shell {
  display: grid;
  gap: 0.8rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--surface-border);
}

.revision-timeline {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(230px, 1fr);
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.35rem;
}

.timeline-node {
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  background: #ffffff;
  padding: 0.8rem;
  display: grid;
  gap: 0.45rem;
  min-height: 180px;
  align-content: start;
}

.timeline-node.current {
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.1);
}

.timeline-node-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.timeline-dot {
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(15, 91, 216, 0.12);
}

.timeline-node.status-submitted {
  background: #fffaf0;
  border-color: #edd48a;
}

.timeline-node.status-approved {
  background: #eff9f2;
  border-color: #b2dbc0;
}

.timeline-node.status-rejected {
  background: #fff4f4;
  border-color: #f0bbbb;
}

.timeline-node .tag {
  width: fit-content;
}

.timeline-notes {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.upload-panel {
  display: none;
}

.upload-panel.open,
.upload-panel:target {
  display: grid;
  gap: 0.8rem;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 19, 34, 0.58);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 60;
}

.modal-backdrop.open {
  display: flex;
}

.modal-card {
  width: min(560px, 100%);
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  padding: 1rem 1.08rem;
  box-shadow: 0 18px 45px rgba(9, 17, 31, 0.27);
}

.upload-toast-region {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 90;
  display: grid;
  gap: 0.65rem;
  width: min(380px, calc(100vw - 2rem));
  pointer-events: none;
}

.upload-toast {
  display: grid;
  gap: 0.5rem;
  padding: 0.85rem;
  border: 1px solid #c8d7ee;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 36px rgba(9, 17, 31, 0.18);
  pointer-events: auto;
}

.upload-toast.success {
  border-color: #a6d9b8;
  background: #f4fbf6;
}

.upload-toast.error {
  border-color: #e4aaaa;
  background: #fff7f7;
}

.upload-toast-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.88rem;
  font-weight: 750;
  color: #1c2b44;
}

.upload-toast-track {
  width: 100%;
  height: 0.58rem;
  overflow: hidden;
  border-radius: 8px;
  background: #dfe8f7;
}

.upload-toast-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.18s ease;
}

.upload-toast.success .upload-toast-track span {
  background: var(--success-text);
}

.upload-toast.error .upload-toast-track span {
  background: var(--danger);
}

.upload-toast p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.84rem;
  overflow-wrap: anywhere;
}

.upload-queue-panel {
  display: grid;
  gap: 0.7rem;
  max-height: min(72vh, 620px);
  overflow: auto;
  padding: 0.9rem;
  border: 1px solid #c8d7ee;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 36px rgba(9, 17, 31, 0.2);
  pointer-events: auto;
}

.upload-queue-header,
.upload-queue-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.upload-queue-header h2,
.upload-queue-item h3 {
  margin: 0;
}

.upload-queue-header > span,
.upload-queue-item-head > span {
  flex: 0 0 auto;
  border-radius: 8px;
  background: #eef4ff;
  color: #1b4f9c;
  padding: 0.22rem 0.48rem;
  font-size: 0.76rem;
  font-weight: 750;
}

.upload-queue-list {
  display: grid;
  gap: 0.55rem;
}

.upload-queue-item {
  display: grid;
  gap: 0.45rem;
  padding: 0.7rem;
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  background: #f8fbff;
}

.upload-queue-item.complete {
  border-color: #a6d9b8;
  background: #f4fbf6;
}

.upload-queue-item.failed {
  border-color: #e4aaaa;
  background: #fff7f7;
}

.upload-queue-item h3 {
  font-size: 0.9rem;
}

.upload-queue-item p {
  margin: 0.2rem 0 0;
  color: var(--text-muted);
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

.upload-queue-track {
  width: 100%;
  height: 0.5rem;
  overflow: hidden;
  border-radius: 8px;
  background: #dfe8f7;
}

.upload-queue-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.18s ease;
}

.upload-queue-item.complete .upload-queue-track span {
  background: var(--success-text);
}

.upload-queue-item.failed .upload-queue-track span {
  background: var(--danger);
}

.upload-queue-retry {
  width: fit-content;
}

.floating-detail-card {
  width: min(1080px, 96vw);
  height: min(880px, 92vh);
  display: flex;
  flex-direction: column;
}

.floating-detail-frame {
  width: 100%;
  min-height: 0;
  flex: 1;
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  background: #ffffff;
}

.auth-card {
  width: min(460px, 100%);
  margin: 2rem auto;
}

.dashboard-hero,
.page-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.85fr);
  gap: 1rem;
  align-items: stretch;
  background:
    radial-gradient(circle at top right, rgba(15, 91, 216, 0.12), transparent 38%),
  linear-gradient(180deg, #ffffff 0%, #f7faff 100%);
}

.page-hero-stacked {
  grid-template-columns: 1fr;
}

.dashboard-hero-copy,
.page-hero-copy {
  display: grid;
  gap: 0.65rem;
  align-content: start;
}

.dashboard-hero h1,
.page-hero h1 {
  font-size: clamp(2rem, 3vw, 3.25rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.dashboard-greeting {
  margin-top: 0.25rem;
  color: #617089;
  font-size: 0.92rem;
  font-weight: 650;
}

.dashboard-focus-card,
.page-hero-panel {
  border: 1px solid #dbe6f5;
  border-radius: 16px;
  padding: 1rem 1.05rem;
  background: linear-gradient(180deg, #0f172a 0%, #173c72 100%);
  color: #f8fbff;
  display: grid;
  gap: 0.7rem;
  align-content: start;
}

.dashboard-focus-card .hint,
.page-hero-panel .hint {
  color: rgba(248, 251, 255, 0.78);
}

.dashboard-focus-card .eyebrow,
.page-hero-panel .eyebrow {
  color: rgba(248, 251, 255, 0.66);
}

.dashboard-focus-card h2,
.page-hero-panel h2 {
  font-size: 3rem;
  line-height: 0.95;
  letter-spacing: -0.05em;
}

.dashboard-focus-label,
.hero-panel-label {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
}

.users-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 0.9rem;
}

.user-card {
  display: grid;
  gap: 0.9rem;
}

.user-card .section-header {
  align-items: start;
}

.user-card .stack {
  gap: 0.6rem;
}

.dashboard-stats,
.summary-grid {
  margin-top: 0.8rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.7rem;
}

.hero-metrics {
  display: flex;
  gap: 0.7rem;
  margin-top: 0.35rem;
  align-self: center;
}

.summary-card {
  border: 1px solid var(--surface-border);
  border-radius: 16px;
  background: #ffffff;
  padding: 0.95rem 1rem;
  display: grid;
  gap: 0.35rem;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.stat-tile {
  display: grid;
  gap: 0.35rem;
  justify-items: center;
  min-height: 100%;
}

.stat-label {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.35px;
  text-transform: uppercase;
  text-align: center;
  color: #617089;
  font-weight: 700;
}

.stat-value {
  margin: 0;
  font-size: 1.9rem;
  font-weight: 800;
  color: #13203a;
  text-align: center;
}

.stat-note {
  margin: 0;
  color: #617089;
  font-size: 0.86rem;
}

.stat-active {
  background: var(--surface);
  border-color: var(--surface-border);
}

.stat-archived {
  background: var(--surface);
  border-color: var(--surface-border);
}

.stat-submitted {
  background: var(--surface);
  border-color: var(--surface-border);
}

.stat-rejected {
  background: var(--surface);
  border-color: var(--surface-border);
}

.rejected-queue {
  display: grid;
  gap: 1rem;
}

.page-toolbar-card {
  display: grid;
  gap: 0.9rem;
}

.page-toolbar-card .inline-form {
  align-items: center;
}

.registry-main-header {
  align-items: center;
}

.registry-main-header h2 {
  font-size: 1.15rem;
}

.registry-sort-form {
  display: inline-flex;
  align-items: center;
}

.registry-sort-form select {
  width: auto;
  min-width: 170px;
  padding: 0.42rem 0.6rem;
  font-size: 0.88rem;
  border-radius: 999px;
  background: #f8fbff;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.rejected-items-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.9rem;
}

.rejected-item-card {
  gap: 0.68rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.08s ease;
}

.rejected-item-card:hover {
  border-color: #b8c7df;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.11);
  transform: translateY(-1px);
}

.rejected-item-top {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 0.75rem;
}

.rejected-item-title {
  display: grid;
  gap: 0.25rem;
}

.rejected-item-title h3 {
  font-size: 1.02rem;
  line-height: 1.25;
}

.rejected-item-link {
  color: #13203a;
}

.rejected-item-card.status-rejected {
  background: #fff0f0;
  border-color: #efb5b5;
}

.rejected-item-link:hover {
  color: #9b1c1c;
}

.rejected-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.8rem;
}

.empty-state {
  border: 1px dashed #cfd8e6;
  border-radius: 16px;
  background: #f8fbff;
  padding: 1.1rem 1.15rem;
  display: grid;
  gap: 0.35rem;
}

@media (max-width: 980px) {
  .site-header-inner {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 0.65rem;
  }

  .brand,
  .header-actions {
    justify-self: center;
  }

  .container {
    margin-top: 1rem;
  }

  .dashboard-hero {
    grid-template-columns: 1fr;
  }

  .page-hero,
  .summary-grid {
    grid-template-columns: 1fr;
  }

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

  .section-header {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .actions-cell {
    min-width: 170px;
  }

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

  .project-registry-layout {
    grid-template-columns: 1fr;
  }

  .registry-sidebar {
    position: static;
  }
}

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

  .rejected-items-list {
    grid-template-columns: 1fr;
  }

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

  .hero-metrics {
    grid-template-columns: 1fr;
  }

  .document-preview-shell,
  .document-preview-frame {
    min-height: 420px;
  }

  .upload-toast-region {
    right: 0.75rem;
    bottom: 0.75rem;
    width: calc(100vw - 1.5rem);
  }
}
