/* ============================================================
   SCRIBENEX — portal chrome (author + admin)
   ============================================================ */

/* ---------------- Auth shell ---------------- */
.auth-shell { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }
@media (max-width: 900px) { .auth-shell { grid-template-columns: 1fr; } }

.auth-brand {
  background: var(--ink);
  color: #fff;
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
  position: relative;
  overflow: hidden;
}
.auth-brand::after {
  content: "";
  position: absolute;
  right: -80px; bottom: -80px;
  width: 340px; height: 340px;
  background: url('/static/assets/logo-mark-light.png') no-repeat center/contain;
  opacity: .06;
  pointer-events: none;
}
@media (max-width: 900px) { .auth-brand { display: none; } }

.auth-benefits { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.auth-benefits li {
  display: flex; align-items: center; gap: 10px;
  color: #C9D0DC; font-size: .95rem;
}
.auth-benefits li svg { color: var(--gold); flex: 0 0 auto; }

.auth-form {
  display: grid;
  place-items: center;
  padding: 40px 24px;
  background: var(--paper);
}
.auth-form-inner { width: 100%; max-width: 420px; }
.auth-mobile-brand { margin-bottom: 32px; }
@media (min-width: 901px) { .auth-mobile-brand { display: none; } }

.divider-row {
  display: flex; align-items: center; gap: 14px;
  margin: 22px 0;
  color: var(--subtle);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .12em;
}
.divider-row::before, .divider-row::after {
  content: ""; flex: 1; height: 1px; background: var(--line);
}

/* ---------------- Password strength ---------------- */
.pw-meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 8px; }
.pw-meter i { height: 3px; border-radius: 2px; background: var(--line); transition: background .2s var(--ease); }
.pw-meter.s1 i:nth-child(1) { background: var(--danger); }
.pw-meter.s2 i:nth-child(-n+2) { background: var(--warn); }
.pw-meter.s3 i:nth-child(-n+3) { background: var(--gold); }
.pw-meter.s4 i { background: var(--success); }

/* ---------------- Dashboard shell ---------------- */
.dash-shell {
  display: grid;
  grid-template-columns: 256px 1fr;
  min-height: 100vh;
  background: var(--paper);
}

.dash-side {
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.dash-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dash-brand .brand .mark { width: 34px; height: 34px; }
.dash-brand .brand .word { height: 15px; }
.dash-label {
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .16em;
  color: var(--gold-text);
}

.dash-nav { padding: 16px 12px; flex: 1; }
.dash-group { margin-bottom: 18px; }
.dash-group-h {
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--subtle);
  padding: 0 10px 8px;
}
.dash-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.dash-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--r);
  font-size: .9rem;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.dash-nav a:hover { background: var(--paper-2); color: var(--ink); }
.dash-nav a.active { background: var(--gold-tint); color: var(--ink); font-weight: 600; }
.dash-nav a.active svg { color: var(--gold-text); }
.dash-nav a svg { color: var(--subtle); flex: 0 0 auto; }

.dash-side-foot { padding: 14px 12px; border-top: 1px solid var(--line); }

.dash-main { display: flex; flex-direction: column; min-width: 0; }

.dash-top {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 64px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.dash-burger { display: none; }
@media (max-width: 900px) {
  .dash-burger { display: inline-flex; }
  .dash-top .searchbar { display: none; }
}

.dash-user { display: flex; align-items: center; gap: 10px; }
.dash-user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.dash-user-meta strong { font-size: .86rem; color: var(--ink); }
.dash-user-meta span { font-size: .72rem; color: var(--muted); }
@media (max-width: 560px) { .dash-user-meta { display: none; } }

.dot-badge {
  position: absolute;
  top: 2px; right: 2px;
  min-width: 16px; height: 16px;
  border-radius: 8px;
  background: var(--danger);
  color: #fff;
  font-size: .62rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  padding: 0 4px;
}

.dash-body { padding: 28px 24px 64px; flex: 1; min-width: 0; }
@media (max-width: 560px) { .dash-body { padding: 20px 16px 48px; } }

@media (max-width: 900px) {
  .dash-shell { grid-template-columns: 1fr; }
  .dash-side {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(280px, 86vw);
    z-index: 60;
    transform: translateX(-100%);
    transition: transform .28s var(--ease);
  }
  .dash-shell.side-open .dash-side { transform: translateX(0); box-shadow: var(--sh-3); }
  .dash-shell.side-open::after {
    content: "";
    position: fixed; inset: 0;
    background: rgba(19,34,63,.42);
    z-index: 55;
  }
}

/* ---------------- Dashboard content blocks ---------------- */
.dash-title { font-size: clamp(1.5rem, 2.4vw, 2rem); margin: 0 0 6px; }
.dash-sub { color: var(--muted); font-size: .95rem; margin: 0 0 26px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
@media (max-width: 1100px) { .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .stat-grid { grid-template-columns: 1fr; } }

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-decoration: none;
  color: inherit;
  transition: box-shadow .2s var(--ease), transform .2s var(--ease);
}
a.stat:hover { box-shadow: var(--sh-2); transform: translateY(-1px); }
.stat .stat-v { font-family: var(--font-serif); font-size: 2rem; line-height: 1; color: var(--ink); }
.stat .stat-l { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.stat .stat-h { font-size: .8rem; color: var(--subtle); }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: 20px;
}
.panel-h {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.panel-h h2 { font-size: 1.1rem; margin: 0; }
.panel-b { padding: 20px; }
.panel-b.flush { padding: 0; }

.loading-block { display: grid; gap: 10px; }

.welcome-card {
  background: linear-gradient(135deg, #fff 0%, var(--paper-2) 100%);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: var(--r-lg);
  padding: 22px;
  margin-bottom: 24px;
}
.welcome-card h2 { font-size: 1.25rem; margin: 0 0 6px; }
.welcome-card p { margin: 0; color: var(--muted); font-size: .92rem; }

.pill-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* Config notice (when Firebase project isn't reachable yet) */
.config-note {
  border: 1px dashed var(--line-2);
  background: var(--warn-bg);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  font-size: .88rem;
  color: #5C3D08;
  margin-bottom: 20px;
}
.config-note strong { color: #4A3106; }

@media (prefers-reduced-motion: reduce) {
  .dash-side { transition: none; }
}

/* ===================== portal.js component styles ===================== */
.dash-head-row {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 16px; flex-wrap: wrap; margin-bottom: 22px;
}
.dash-head-row .dash-title { margin-bottom: 4px; }
.dash-head-row .dash-sub { margin-bottom: 0; }

.dash-backdrop {
  position: fixed; inset: 0; background: rgba(15, 22, 38, .42);
  z-index: 110; animation: fadeIn .18s var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } }

/* Module shortcut grid on the admin dashboard */
.mod-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}
.mod-card {
  display: flex; flex-direction: column; gap: 3px;
  padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--paper); text-decoration: none;
  transition: border-color .18s var(--ease), background .18s var(--ease), transform .18s var(--ease);
}
.mod-card:hover { border-color: var(--line-2); background: var(--surface); transform: translateY(-1px); }
.mod-card strong { font-size: .9rem; color: var(--ink); font-weight: 600; }
.mod-card span { font-size: .78rem; color: var(--muted); line-height: 1.4; }

/* Review moderation queue */
.review-queue { display: grid; }
.rq { padding: 18px 20px; border-bottom: 1px solid var(--line); }
.rq:last-child { border-bottom: 0; }
.rq-top { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.rq .stars { color: var(--gold); letter-spacing: 2px; font-size: .95rem; }
.rq h4 { font-family: var(--font-serif); font-size: 1.02rem; }

/* Notification list */
.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-list .notif { grid-template-columns: 10px 1fr; }
.notif-list .notif:last-child { border-bottom: 0; }
.notif-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--line-2); margin-top: 8px;
}
.notif.unread .notif-dot { background: var(--gold); box-shadow: 0 0 0 3px var(--gold-tint); }

/* Kanban columns (CRM / projects) */
.kcol-h {
  font-family: var(--font-sans); font-size: .74rem; font-weight: 600;
  letter-spacing: .07em; text-transform: uppercase; color: var(--muted);
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 6px 8px;
}
.kcol-h span {
  font-size: .68rem; background: var(--surface); border-radius: 999px;
  padding: 1px 7px; color: var(--muted); border: 1px solid var(--line);
}
.kcard {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 10px 12px; display: grid; gap: 2px;
  box-shadow: var(--sh-1);
}
.kcard select { margin-top: 6px; }

/* Compact selects inside table rows */
.select-xs {
  height: 30px; font-size: .8rem; padding: 0 26px 0 8px;
  border-radius: var(--r-sm); width: auto; min-width: 120px;
}

/* Inline status selects shouldn't stretch the row */
.tbl select.select-xs { min-width: 132px; }

@media (max-width: 900px) {
  .dash-head-row { align-items: flex-start; }
  .dash-head-row .row { width: 100%; }
  .mod-grid { grid-template-columns: 1fr 1fr; }
  .review-queue .rq { padding: 16px; }
}
@media (max-width: 560px) {
  .mod-grid { grid-template-columns: 1fr; }
}

/* ---------- manuscript upload meter ---------- */
.file-input { padding: 10px 12px; cursor: pointer; }
.file-input::file-selector-button {
  font: inherit; font-weight: 600; cursor: pointer;
  margin-right: 12px; padding: 7px 14px;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--paper-2); color: var(--ink);
  transition: background .15s var(--ease);
}
.file-input::file-selector-button:hover { background: var(--gold-tint); }

.upload-meter {
  margin-top: 10px; height: 6px; border-radius: 999px;
  background: var(--line); overflow: hidden;
}
.upload-meter-bar {
  height: 100%; width: 0; border-radius: 999px;
  background: var(--gold);
  transition: width .25s var(--ease), background .2s var(--ease);
}
.upload-meter-label { display: block; margin-top: 6px; }
.upload-meter-label[data-state="error"] { color: var(--danger); }
.upload-meter-label[data-state="ready"] { color: var(--success); }
.upload-meter-label[data-state="busy"] { color: var(--muted); }
/* The bar takes its colour from data-state on the wrapper, set by the handler. */
.upload-meter[data-state="error"] .upload-meter-bar { background: var(--danger); }
.upload-meter[data-state="busy"] .upload-meter-bar { background: var(--gold); }
.upload-meter[data-state="ready"] .upload-meter-bar { background: var(--success); }

