/* ===================================================
   Admin — login, dashboard, upload / placement flow
   =================================================== */

/* ─── Top bar ───────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(7, 0, 61, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
}
.topbar__brand { display: flex; align-items: center; gap: 0.7rem; }
.topbar__mark {
  width: 34px; height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand-purple-mid), var(--brand-purple-dark));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--white);
  box-shadow: 0 4px 14px rgba(17, 0, 123, 0.5);
  flex-shrink: 0;
}
.topbar__title { font-family: var(--font-display); font-size: 1.25rem; font-weight: 600; color: var(--white); }
.topbar__subtitle { font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-muted); }
.topbar__actions { display: flex; align-items: center; gap: 0.75rem; }

/* ─── Login screen ──────────────────────────────── */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 2rem;
}
.login-screen__bg {
  position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(ellipse 70% 60% at 70% 20%, rgba(17, 0, 123, 0.55) 0%, transparent 70%),
    radial-gradient(ellipse 50% 60% at 10% 90%, rgba(26, 14, 160, 0.25) 0%, transparent 60%),
    linear-gradient(180deg, var(--navy-900) 0%, var(--navy-800) 100%);
}
.login-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 400px;
  padding: 2.75rem 2.25rem;
  text-align: center;
}
.login-card__mark {
  width: 56px; height: 56px;
  margin: 0 auto 1.5rem;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--brand-purple-mid), var(--brand-purple-dark));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  box-shadow: var(--shadow-lg);
}
.login-card__title { font-size: 1.6rem; margin-bottom: 0.4rem; color: var(--white); }
.login-card__subtitle { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 2rem; }
.login-card form { text-align: left; }
.login-card .field__label { display: block; margin-bottom: 0.5rem; }

.login-error {
  background: var(--danger-red-bg);
  border: 1px solid rgba(210, 58, 58, 0.3);
  color: #ff8a8a;
  font-size: 0.8rem;
  border-radius: var(--radius);
  padding: 0.6rem 0.85rem;
  margin-bottom: 1.1rem;
  display: none;
  text-align: left;
}
.login-error.visible { display: block; }

/* ─── Dashboard layout ──────────────────────────── */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 2.5rem 0 1.75rem;
}
.page-head h1 { font-size: 2rem; color: var(--white); }
.page-head p { font-size: 0.88rem; color: var(--text-muted); margin-top: 0.35rem; }

.toolbar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.toolbar .input { max-width: 320px; }
.toolbar .select { max-width: 160px; }

.doc-table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }
.doc-table { width: 100%; border-collapse: collapse; min-width: 880px; }
.doc-table thead th {
  text-align: left;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  padding: 0.9rem 1.1rem;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border);
}
.doc-table tbody td {
  padding: 1rem 1.1rem;
  font-size: 0.86rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  vertical-align: middle;
}
.doc-table tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
.doc-table .ref-no { font-family: var(--font-mono); color: var(--white); font-size: 0.82rem; }
.doc-table .subject-cell { color: var(--white); font-weight: 500; max-width: 280px; }
.doc-table .row-actions { display: flex; gap: 0.5rem; justify-content: flex-end; }

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}
.empty-state h3 { color: var(--white); font-size: 1.3rem; margin-bottom: 0.5rem; }

/* ─── Upload flow: stepper ──────────────────────── */
.stepper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 2.5rem;
}
.stepper__step {
  display: flex; align-items: center; gap: 0.6rem;
  font-size: 0.78rem; color: var(--text-muted);
}
.stepper__dot {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 600;
  color: var(--text-muted);
  transition: var(--transition);
}
.stepper__step.is-active .stepper__dot { background: var(--brand-purple); border-color: var(--brand-purple); color: var(--white); }
.stepper__step.is-active span.stepper__label { color: var(--white); }
.stepper__step.is-done .stepper__dot { background: var(--ok-green); border-color: var(--ok-green); color: var(--white); }
.stepper__line { width: 36px; height: 1px; background: var(--border); }

.upload-panel { padding: 2rem; margin-bottom: 2rem; }

.dropzone {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  text-align: center;
  transition: var(--transition);
  cursor: pointer;
}
.dropzone:hover, .dropzone.is-dragover {
  border-color: var(--brand-purple-light);
  background: var(--brand-purple-faint);
}
.dropzone__icon { font-size: 2rem; margin-bottom: 0.75rem; }
.dropzone__title { color: var(--white); font-size: 1rem; margin-bottom: 0.3rem; }
.dropzone__hint { font-size: 0.8rem; color: var(--text-muted); }
.dropzone input[type="file"] { display: none; }

.file-chip {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.85rem 1.1rem;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 1rem;
}
.file-chip__icon {
  width: 34px; height: 34px; border-radius: 8px;
  background: var(--brand-purple-faint);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
}
.file-chip__name { font-size: 0.85rem; color: var(--white); }
.file-chip__meta { font-size: 0.75rem; color: var(--text-muted); }
.file-chip__remove { margin-left: auto; color: var(--text-muted); font-size: 1.2rem; }
.file-chip__remove:hover { color: var(--danger-red); }

/* ─── QR placement step ─────────────────────────── */
.placement-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
  align-items: start;
}
@media (max-width: 900px) { .placement-layout { grid-template-columns: 1fr; } }

.placement-stage {
  background: var(--navy-800);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
.placement-canvas-wrap {
  position: relative;
  max-width: 100%;
  box-shadow: var(--shadow-lg);
  background: var(--white);
  line-height: 0;
}
.placement-canvas-wrap canvas { display: block; max-width: 100%; height: auto; }

.qr-seal-target {
  position: absolute;
  border: 2px solid var(--brand-purple);
  background: rgba(17, 0, 123, 0.18);
  cursor: move;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  touch-action: none;
}
.qr-seal-target__icon {
  width: 70%; height: 70%;
  background-image: repeating-linear-gradient(0deg, var(--brand-purple) 0 2px, transparent 2px 4px),
                     repeating-linear-gradient(90deg, var(--brand-purple) 0 2px, transparent 2px 4px);
  opacity: 0.45;
}
.qr-seal-target__handle {
  position: absolute;
  width: 14px; height: 14px;
  background: var(--white);
  border: 2px solid var(--brand-purple);
  border-radius: 3px;
  right: -7px; bottom: -7px;
  cursor: nwse-resize;
}

.placement-pager { display: flex; align-items: center; gap: 1rem; }
.placement-pager__label { font-size: 0.8rem; color: var(--text-muted); }

.placement-side h3 { color: var(--white); font-size: 1.05rem; margin-bottom: 0.6rem; }
.placement-side p { font-size: 0.83rem; color: var(--text-muted); margin-bottom: 1rem; line-height: 1.6; }
.placement-side .hint-list { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 1.5rem; }
.placement-side .hint-list li { font-size: 0.8rem; color: var(--text-secondary); display: flex; gap: 0.5rem; }
.placement-side .hint-list li::before { content: '—'; color: var(--brand-purple-light); flex-shrink: 0; }

.summary-card { padding: 1.25rem; margin-bottom: 1.5rem; }
.summary-row { display: flex; justify-content: space-between; gap: 0.75rem; font-size: 0.82rem; padding: 0.45rem 0; border-bottom: 1px solid var(--border-subtle); }
.summary-row:last-child { border-bottom: none; }
.summary-row dt { color: var(--text-muted); }
.summary-row dd { color: var(--white); text-align: right; max-width: 60%; }

/* ─── Success step ──────────────────────────────── */
.success-panel { text-align: center; padding: 3rem 2rem; }
.success-seal {
  width: 84px; height: 84px;
  margin: 0 auto 1.5rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ok-green), #157a4d);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.2rem;
  box-shadow: 0 10px 30px rgba(31, 157, 99, 0.4);
  animation: seal-stamp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes seal-stamp {
  0% { transform: scale(2) rotate(-12deg); opacity: 0; }
  60% { transform: scale(0.95) rotate(3deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); }
}
.success-panel h2 { color: var(--white); font-size: 1.6rem; margin-bottom: 0.5rem; }
.success-panel p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 2rem; }

.verify-link-box {
  display: flex; align-items: center; gap: 0.75rem;
  background: var(--glass); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.7rem 1rem;
  font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-secondary);
  max-width: 480px; margin: 0 auto 2rem;
  overflow: hidden;
}
.verify-link-box span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; text-align: left; }

.success-actions { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }

/* ─── Document detail modal-ish drawer ──────────── */
.drawer-overlay {
  position: fixed; inset: 0; background: rgba(2, 0, 20, 0.6);
  z-index: 1500; display: none;
}
.drawer-overlay.open { display: block; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: 420px;
  background: var(--navy-800); border-left: 1px solid var(--border);
  z-index: 1600; transform: translateX(100%); transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
  overflow-y: auto;
}
.drawer.open { transform: translateX(0); }
.drawer__inner { padding: 2rem; position: relative; }
.drawer__close { position: absolute; top: 1.5rem; right: 1.5rem; font-size: 1.4rem; color: var(--text-muted); }
.drawer h2 { color: var(--white); font-size: 1.4rem; margin-bottom: 1.5rem; padding-right: 2rem; }
.drawer dl { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 2rem; }
.drawer dt { font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.25rem; }
.drawer dd { font-size: 0.9rem; color: var(--white); }
.drawer dd.mono { font-family: var(--font-mono); font-size: 0.8rem; word-break: break-all; color: var(--text-secondary); }
.drawer__actions { display: flex; flex-direction: column; gap: 0.6rem; }

@media (max-width: 480px) { .drawer { width: 100%; } }
