/* App shell — not part of card chrome (card.css). */

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

body {
  margin: 0;
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
  background: #0f1419;
  color: #e8eaed;
  line-height: 1.45;
}

/* Login */
.login-panel {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: min(380px, 100%);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 28px;
}

.login-card h1 {
  margin: 0 0 6px;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.login-card > p.tag {
  margin: 0 0 22px;
  font-size: 0.9rem;
  color: #98a4b8;
}

.login-panel label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: #b8c0ce;
  margin-bottom: 6px;
}

.login-panel input {
  width: 100%;
  margin-bottom: 16px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.28);
  color: inherit;
  font-size: 1rem;
}

.login-panel button[type='submit'],
.topbar-btn {
  cursor: pointer;
  font-weight: 600;
  border-radius: 10px;
  border: none;
  font-size: 0.95rem;
}

.login-panel button[type='submit'] {
  width: 100%;
  padding: 12px;
  margin-top: 8px;
  background: linear-gradient(135deg, #ff6130 0%, #ff8c39 100%);
  color: #fff;
}

.login-panel button[type='submit']:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.login-error {
  margin: 14px 0 0;
  font-size: 0.875rem;
  color: #f87171;
  min-height: 1.3em;
}

.login-sent-panel {
  padding-top: 4px;
}

.login-sent-panel p {
  margin: 0 0 14px;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #b8c5d6;
}

.login-sent-email {
  color: #e8eaed;
  word-break: break-all;
}

.login-sent-secondary {
  display: inline;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: #ff9466;
  text-decoration: underline;
}

.login-sent-secondary:hover {
  color: #ffb088;
}

/* App chrome */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px clamp(16px, 4vw, 28px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.35);
}

.topbar-title {
  font-weight: 700;
  font-size: 1.05rem;
}

.topbar-user {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  font-size: 0.875rem;
  color: #b8c0ce;
}

.topbar-email {
  max-width: min(520px, 70vw);
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-btn {
  padding: 8px 16px;
  background: transparent;
  color: #ff9466;
  border: 1px solid rgba(255, 148, 102, 0.45);
}

.topbar-stats {
  width: 100%;
  flex-basis: 100%;
  margin-top: 4px;
  font-size: 0.875rem;
  color: #98a4b8;
}

.topbar-leading {
  flex: 1;
  min-width: 200px;
}

.topbar-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 14px;
}

.topbar-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.topbar-nav-link {
  font-size: 0.875rem;
  font-weight: 600;
  color: #ff9466;
  text-decoration: none;
  padding: 4px 0;
}

.topbar-nav-link:hover {
  text-decoration: underline;
}

.overview-topbar-stats {
  line-height: 1.35;
}

.queue-art-stale-badge {
  width: 100%;
  max-width: 360px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #fde68a;
  background: rgba(234, 179, 8, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.35);
  border-radius: 10px;
  padding: 8px 10px;
  text-align: center;
}

.overview-shell {
  max-width: 960px;
}

.overview-scroll {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
}

.overview-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  padding: 16px clamp(14px, 3vw, 22px);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.25);
}

@media (min-width: 720px) {
  .overview-row {
    grid-template-columns: minmax(200px, 280px) minmax(0, 1fr);
    align-items: start;
    gap: 20px;
  }
}

.muted {
  color: #98a4b8;
  font-weight: 400;
}

.overview-row__left {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.overview-row__thumb {
  width: 72px;
  height: auto;
  max-height: 88px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.overview-row__meta {
  min-width: 0;
}

.overview-row__title-line .overview-row__word {
  font-weight: 700;
  font-size: 1rem;
  color: #e8eaed;
}

.overview-row__sub {
  font-size: 0.84rem;
  margin-top: 4px;
}

.overview-row__votes {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.overview-row__votes--none {
  color: #fcd34d;
  font-weight: 600;
}

.vote-approved {
  color: #86efac;
}

.vote-rejected {
  color: #fca5a5;
}

.overview-empty-msg {
  margin: 0;
  padding: 20px;
  font-size: 0.92rem;
  color: #98a4b8;
  text-align: center;
}

.overview-reviewer-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.overview-reviewer-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  row-gap: 6px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.overview-reviewer-who {
  font-size: 0.8rem;
  font-weight: 600;
  color: #cdd5e1;
}

.overview-verdict-tag {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.overview-verdict-tag.tag-approved {
  color: #bbf7d0;
  border-color: rgba(34, 197, 94, 0.35);
}

.overview-verdict-tag.tag-rejected {
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.38);
}

.overview-verdict-tag.tag-na {
  color: #cbd5f5;
}

.overview-art-stale-pill {
  font-size: 0.73rem;
  font-weight: 600;
  color: #fde68a;
  background: rgba(234, 179, 8, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.4);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}

.overview-comment {
  width: 100%;
  flex-basis: 100%;
  margin: 4px 0 0;
  padding: 8px 10px;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: #cdd5e1;
  border-left: 2px solid rgba(255, 255, 255, 0.15);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px clamp(16px, 4vw, 28px);
}

.filter-bar-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #98a4b8;
  margin-right: 8px;
}

.filter-pill {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: transparent;
  color: inherit;
  font-size: 0.8125rem;
  cursor: pointer;
}

.filter-pill.is-active {
  background: rgba(255, 97, 48, 0.2);
  border-color: rgba(255, 97, 48, 0.5);
  color: #ffbfaa;
}

.app-loading-banner {
  padding: 40px clamp(16px, 4vw, 28px);
  font-size: 0.95rem;
  color: #98a4b8;
}

.app-hidden {
  display: none !important;
}

.review-queue-shell {
  box-sizing: border-box;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: clamp(16px, 4vw, 36px);
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.queue-grid {
  display: grid;
  gap: clamp(28px, 4vw, 44px);
  grid-template-columns: 1fr;
  grid-auto-rows: auto;
  align-items: start;
  width: 100%;
}

@media (min-width: 700px) {
  .queue-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1100px) {
  .queue-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.queue-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px;
}

.queue-pager__btn {
  cursor: pointer;
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
  color: #e8eaed;
  font-size: 0.8125rem;
  font-weight: 600;
}

.queue-pager__btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.queue-pager__lab {
  font-size: 0.875rem;
  color: #98a4b8;
}

.queue-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-width: 0;
}

.queue-item__unit-rule {
  width: 100%;
  max-width: 360px;
  align-self: center;
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  margin: 0 0 2px;
  padding: 0;
  opacity: 0.95;
}

.queue-status-wrap {
  width: 100%;
  max-width: 360px;
  display: flex;
  justify-content: center;
  align-self: center;
  margin: 4px 0 4px;
}

.queue-status-wrap .queue-status {
  text-align: center;
}

.queue-item__slot {
  width: 100%;
  max-width: 360px;
}

.queue-item__card-inner {
  width: 100%;
  --card-width: 100%;
}

.queue-controls {
  width: 100%;
  max-width: 360px;
}

.queue-thumb-row {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.queue-thumb-row button {
  flex: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #e8eaed;
  font-size: 0.875rem;
  font-weight: 600;
}

.queue-thumb-row button.is-approved {
  background: rgba(34, 197, 94, 0.22);
  border-color: rgba(34, 197, 94, 0.5);
  color: #bbf7d0;
}

.queue-thumb-row button.is-rejected {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(248, 113, 113, 0.45);
  color: #fecaca;
}

.queue-comment {
  width: 100%;
  min-height: 72px;
  padding: 10px 12px;
  margin-bottom: 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.3);
  color: inherit;
  font-family: inherit;
  font-size: 0.875rem;
  resize: vertical;
}

.queue-status {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.queue-status.pending {
  color: #fcd34d;
}

.queue-status.done {
  color: #86efac;
}

.queue-save-hint {
  font-size: 0.74rem;
  color: #6b7586;
}

/* Unified app header (mounted by shared/app-shell-header.js) */

.unified-app-topbar {
  justify-content: flex-start;
}

.app-brand-static {
  font-weight: 700;
  font-size: 1.06rem;
  letter-spacing: -0.02em;
}

.app-brand-cluster {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  min-width: 0;
}

.app-brand-logo {
  display: block;
  height: 39px;
  width: auto;
  max-width: 180px;
  flex-shrink: 0;
  object-fit: contain;
}

.topbar-unified-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.topbar-grow-spacer {
  flex: 0;
  width: 0;
  min-width: 0;
}

.app-topbar-desktop-middle {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
}

@media (min-width: 641px) {
  .topbar-grow-spacer {
    flex: 1 1 auto;
    min-width: 8px;
    width: auto;
  }

  .unified-app-topbar .topbar-user {
    align-items: center;
    flex-shrink: 0;
  }
}

.topbar-nav-link--current {
  padding: 4px 0;
  border-bottom: 2px solid #ff9466;
  color: #e8eaed;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: default;
  pointer-events: none;
  user-select: none;
}

.app-shell-mount {
  position: relative;
}

/* Desktop: hide bottom chrome (≤640 styles override) */
.app-bottom-nav {
  display: none;
}

.app-bottom-nav__row {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  width: 100%;
}

.app-bottom-nav__stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 44px;
  padding: 6px 2px 10px;
}

.app-bottom-nav__icon {
  display: block;
  flex-shrink: 0;
  color: currentColor;
}

.app-bottom-nav__label {
  font-size: 0.685rem;
  font-weight: 600;
  letter-spacing: 0.035em;
  line-height: 1.08;
}

.app-bottom-nav__item {
  flex: 1;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  align-items: center;
  text-decoration: none;
}

.app-bottom-nav__item--link {
  border: none;
  background: none;
  cursor: pointer;
  color: #98a4b8;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.app-bottom-nav__item--link:link,
.app-bottom-nav__item--link:visited {
  color: #98a4b8;
}

.app-bottom-nav__item--link:focus-visible .app-bottom-nav__stack,
.app-bottom-nav__item--link:focus-visible {
  outline: none;
}

.app-bottom-nav__item--link:focus-visible .app-bottom-nav__stack {
  box-shadow: 0 0 0 2px rgba(255, 148, 102, 0.55);
  border-radius: 8px;
}

.app-bottom-nav__item--current {
  color: #ff9466;
  cursor: default;
  pointer-events: none;
  user-select: none;
}

@media (max-width: 640px) {
  html {
    scroll-padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    scroll-padding-top: calc(60px + env(safe-area-inset-top, 0px));
  }

  .app-topbar-desktop-middle {
    display: none !important;
  }

  .app-shell-mount > header.topbar.unified-app-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    box-sizing: border-box;
    z-index: 100;
    margin: 0;
    flex-wrap: nowrap;
    gap: 8px;
    padding: 12px clamp(14px, 4vw, 22px);
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(12, 16, 21, 0.98);
  }

  .unified-app-topbar .topbar-user {
    margin-left: auto;
    gap: 8px;
    flex-shrink: 0;
    align-items: center;
    font-size: 0.7825rem;
  }

  .unified-app-topbar .topbar-email {
    max-width: min(46vw, 190px);
  }

  .unified-app-topbar .topbar-btn {
    padding: 8px 12px;
    font-size: 0.7825rem;
  }

  .app-brand-cluster {
    gap: 6px;
  }

  .app-brand-logo {
    height: 33px;
    max-width: 144px;
  }

  .app-brand-static {
    flex-shrink: 0;
    font-size: 0.98rem;
  }

  #app-view:not(.app-hidden) {
    padding-top: calc(60px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
  }

  .app-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 90;
    background: rgba(12, 16, 21, 0.98);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-sizing: border-box;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
}

/* Secondary stats row beneath shared header */

.region-under-header {
  margin-top: 0;
  flex-basis: auto;
  width: 100%;
  padding: 11px clamp(16px, 4vw, 28px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.24);
}

/* Review dashboard surfaces (dashboard.html — Chart.js) */

.dash-main {
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(16px, 4vw, 32px);
  padding-top: clamp(12px, 3vw, 24px);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.dash-metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(154px, 1fr));
  gap: clamp(14px, 3vw, 22px);
}

.dash-metric {
  background: rgba(0, 0, 0, 0.25);
  color: #e8eaed;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: clamp(14px, 3vw, 20px);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 108px;
}

.dash-metric-value {
  font-size: clamp(1.85rem, 4.5vw, 2.4rem);
  font-weight: 700;
  line-height: 1.08;
  color: #e8eaed;
}

.dash-metric-label {
  font-size: 0.845rem;
  font-weight: 600;
  color: #98a4b8;
}

.dash-meta-text {
  font-size: 0.7825rem;
  color: #98a4b8;
  margin: 0;
  line-height: 1.4;
}

.dash-chart-surface {
  background: rgba(0, 0, 0, 0.25);
  color: #e8eaed;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: clamp(14px, 3vw, 20px);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dash-section-heading {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #e8eaed;
}

.dash-section-caption {
  margin: 0;
  max-width: 58ch;
  line-height: 1.45;
  color: #98a4b8;
}

.dash-custom-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: center;
}

.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  color: #cdd5e1;
}

.chart-legend-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.chart-legend-label {
  font-weight: 500;
}

.chart-legend-value {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  margin-left: 2px;
  color: #e8eaed;
}

.dash-realtime-hint {
  margin: 0 clamp(16px, 4vw, 28px);
  padding: 12px clamp(14px, 3vw, 20px);
  font-size: 0.8475rem;
  color: #fcd34d;
  background: rgba(234, 179, 8, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.28);
  border-radius: 10px;
  max-width: 1080px;
  margin-left: auto;
  margin-right: auto;
}

/* Chart wrappers: bounded height triggers Chart.js layout (maintainAspectRatio:false). */

.dash-chart-canvas-shell {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  flex-shrink: 0;
  padding: 0;
  overflow: hidden;
}

.dash-chart-canvas-shell--verdict {
  height: 220px;
}

.dash-chart-canvas-shell--difficulty {
  height: 240px;
}

.dash-chart-canvas-shell--category {
  height: 280px;
}

@media (max-width: 640px) {
  .dash-metrics-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .dash-main {
    width: 100%;
    padding-inline: clamp(14px, 4vw, 20px);
  }

  .dash-chart-surface {
    width: 100%;
  }

  .dash-chart-canvas-shell--verdict {
    height: 200px;
  }

  .dash-chart-canvas-shell--difficulty {
    height: 210px;
  }

  .dash-chart-canvas-shell--category {
    height: 244px;
  }
}

@media (max-width: 360px) {
  .dash-metrics-row {
    grid-template-columns: 1fr;
  }
}
