:root {
  --bg: #38393d;
  --bg-soft: #565656;
  --card: rgba(56, 57, 61, 0.92);
  --line: rgba(4, 124, 252, 0.28);
  --text: #f5f7fb;
  --muted: #d6d6d6;
  --accent: #ffcc3c;
  --accent-2: #047cfc;
  --accent-3: #1034a6;
  --danger: #ff9797;
  --shadow: 0 24px 50px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 11%, rgba(16, 52, 166, 0.46) 0%, transparent 34%),
    radial-gradient(circle at 88% 8%, rgba(4, 124, 252, 0.34) 0%, transparent 30%),
    linear-gradient(150deg, #2f3033 0%, #38393d 56%, #404144 100%);
  font-family: "Montserrat", sans-serif;
}

.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.14;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.45) 0.65px, transparent 0.85px);
  background-size: 3px 3px;
}

main {
  position: relative;
  z-index: 1;
  padding: 1.3rem 1.6rem;
  max-width: 1720px;
  margin: 0 auto;
}

.card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.74rem;
  color: var(--accent-2);
  margin: 0 0 0.35rem;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: "Montserrat", sans-serif;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.lead {
  color: var(--muted);
  line-height: 1.45;
}

.login-card {
  width: min(520px, 100%);
  margin: 8vh auto;
  padding: 2rem;
  display: none;
}

.login-card.active {
  display: block;
  animation: rise 420ms ease-out;
}

.login-form,
.stack-form {
  margin-top: 1rem;
  display: grid;
  gap: 0.7rem;
}

label {
  display: grid;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.9rem;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  padding: 0.72rem 0.8rem;
}

textarea {
  resize: vertical;
}

button {
  border: none;
  border-radius: 10px;
  cursor: pointer;
  padding: 0.65rem 0.85rem;
  font-weight: 700;
  color: #38393d;
  background: linear-gradient(90deg, var(--accent), #ffe08f);
  transition:
    transform 140ms ease,
    filter 140ms ease;
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

button.ghost {
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line);
}

.danger-btn {
  color: #2d0909;
  background: linear-gradient(90deg, #ff9f9f, #ffd0d0);
}

.doc-list-empty {
  list-style: none;
  padding: 1rem;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 12px;
}

.doc-list-item {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.doc-list-item.active {
  border-color: rgba(255, 204, 60, 0.55);
  box-shadow: inset 0 0 0 1px rgba(255, 204, 60, 0.18);
}

.doc-list-open {
  display: grid;
  gap: 0.18rem;
  justify-items: start;
  width: 100%;
  padding: 0;
  color: var(--text);
  background: transparent;
}

.doc-list-open strong {
  color: var(--text);
}

.doc-list-open small {
  color: var(--muted);
}

.doc-list-actions {
  display: flex;
  gap: 0.45rem;
  flex-shrink: 0;
}

.media-viewer {
  display: grid;
  place-items: center;
  min-height: 320px;
  padding: 1rem;
}

.inline-video-player {
  width: min(100%, 980px);
  max-height: 68vh;
  border-radius: 14px;
  background: #0c1118;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.34);
}

.hidden {
  display: none;
}

.dashboard.nda-locked {
  filter: blur(5px);
  pointer-events: none;
  user-select: none;
}

body.nda-lock main {
  filter: blur(14px) brightness(0.55);
  pointer-events: none;
  user-select: none;
}

html.nda-lock body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 39;
  background: rgba(7, 10, 16, 0.62);
  backdrop-filter: blur(8px);
  pointer-events: auto;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(10, 14, 20, 0.82);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 1rem;
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(560px, 100%);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(56, 57, 61, 0.98);
  box-shadow: var(--shadow);
  padding: 1rem;
}

.modal-card p {
  color: var(--muted);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 0.3rem;
}

.progress-bar-track {
  width: 100%;
  height: 10px;
  background: var(--bg-soft);
  border-radius: 5px;
  overflow: hidden;
  margin-top: 0.75rem;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 5px;
  transition: width 0.2s ease;
}

.nda-check {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin-top: 0.4rem;
  color: var(--text);
}

.topbar {
  position: relative;
  z-index: 50;
  overflow: visible;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.2rem;
}

.topbar-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.brand-logo {
  display: block;
  height: auto;
  width: auto;
}

.login-logo {
  max-width: 180px;
  margin-bottom: 0.9rem;
}

.topbar-logo {
  max-width: 120px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-left: auto;
}

.notification-btn {
  position: relative;
  min-width: 42px;
  min-height: 38px;
  padding: 0.45rem 0.55rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.notification-icon {
  width: 19px;
  height: 19px;
  display: block;
}

.notification-dot {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff3b3b;
  box-shadow: 0 0 0 2px rgba(56, 57, 61, 0.9);
}

.notification-panel {
  position: fixed;
  left: 0;
  right: auto;
  top: 0;
  width: min(420px, calc(100vw - 2rem));
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(56, 57, 61, 0.98);
  box-shadow: var(--shadow);
  z-index: 2147483647;
}

.notification-head {
  position: sticky;
  top: 0;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--line);
  background: rgba(56, 57, 61, 0.98);
}

.notification-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.notification-list li {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--line);
  display: block;
}

.notification-item {
  transition: background-color 120ms ease;
}

.notification-item:hover,
.notification-item:focus-within {
  background: rgba(4, 124, 252, 0.14);
}

.notification-open-btn {
  width: 100%;
  display: grid;
  justify-items: start;
  align-items: start;
  gap: 0.3rem;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  text-align: left !important;
  color: #fff !important;
  background: transparent !important;
  box-shadow: none;
}

.notification-open-btn:hover,
.notification-open-btn:focus-visible {
  background: transparent !important;
  color: #fff !important;
  transform: none;
  filter: none;
  outline: none;
}

.notification-open-btn .notification-title,
.notification-open-btn .notification-meta,
.notification-open-btn div,
.notification-open-btn small {
  color: #fff !important;
  text-align: left !important;
}

.notification-open-btn:disabled {
  opacity: 0.72;
  cursor: progress;
}

.notification-list li:last-child {
  border-bottom: 0;
}

.notification-title {
  font-weight: 700;
}

.notification-meta {
  color: var(--muted);
  font-size: 0.82rem;
}

.logo-white {
  filter: brightness(0) invert(1);
}

.user-tag {
  color: var(--accent);
  font-size: 0.9rem;
}

.shell {
  margin-top: 1rem;
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1rem;
}

.sidebar-stack {
  display: grid;
  align-content: start;
  gap: 0.8rem;
}

.nav-card {
  height: fit-content;
  padding: 0.7rem;
  display: grid;
  gap: 0.45rem;
}

.sidebar-request-btn {
  width: 100%;
}

.nav-btn {
  background: transparent;
  color: var(--text);
  border: 1px solid transparent;
  text-align: left;
  font-family: "Montserrat", sans-serif;
  letter-spacing: 0.02em;
}

.nav-btn:hover,
.nav-btn.active {
  border-color: var(--line);
  background: rgba(4, 124, 252, 0.2);
}

.content-stack {
  display: grid;
}

.page {
  padding: 1rem;
}

#pageOverview {
  position: relative;
  overflow: hidden;
  min-height: calc(100vh - 190px);
  padding: 0;
  background:
    linear-gradient(160deg, rgba(205, 213, 219, 0.18), rgba(89, 98, 108, 0.22)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.14)),
    #717b84;
}

#pageOverview::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(150deg, transparent 0 8%, rgba(255, 255, 255, 0.18) 8.2%, transparent 8.4%),
    linear-gradient(170deg, transparent 0 24%, rgba(255, 255, 255, 0.14) 24.2%, transparent 24.4%),
    linear-gradient(140deg, transparent 0 54%, rgba(255, 255, 255, 0.14) 54.2%, transparent 54.4%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 20%);
  opacity: 0.45;
  pointer-events: none;
}

#pageDocuments {
  min-height: 0;
  overflow: hidden;
}

#pageDocuments.active {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 190px);
}

.page-head {
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.6rem;
  margin-bottom: 0.9rem;
}

.page-head p {
  margin: 0.3rem 0 0;
  color: var(--muted);
}

.documents-head-actions {
  margin-top: 0.7rem;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
}

.overview-scene {
  position: relative;
  z-index: 1;
  min-height: calc(100vh - 190px);
  padding: clamp(0.9rem, 1.5vw, 1.35rem);
}

.overview-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.9fr);
  gap: 0.85rem;
  min-height: calc(100vh - 245px);
}

.overview-backdrop {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 24px;
}

.overview-floor {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(60, 70, 79, 0.28) 1px, transparent 1px),
    linear-gradient(90deg, rgba(60, 70, 79, 0.22) 1px, transparent 1px);
  background-size: 120px 120px;
  opacity: 0.35;
}

.overview-panel {
  position: relative;
  z-index: 2;
  border: 2px solid rgba(9, 41, 59, 0.88);
  border-radius: 18px;
  background: rgba(244, 245, 246, 0.9);
  color: #06080b;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14);
}

.overview-main-panel {
  min-height: 100%;
  padding: clamp(0.95rem, 1.4vw, 1.25rem);
}

.overview-side-column {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-rows: auto minmax(220px, 1fr);
  gap: 0.85rem;
}

.overview-status-panel {
  padding: 1rem 1.05rem;
}

.overview-status-panel h3,
.overview-section h3 {
  margin-bottom: 0.55rem;
  font-size: clamp(0.98rem, 1.25vw, 1.4rem);
  color: #020304;
}

.overview-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.9rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid rgba(6, 8, 11, 0.12);
}

.overview-brand-logo {
  width: min(46%, 340px);
  max-width: 100%;
  filter: drop-shadow(0 5px 7px rgba(0, 0, 0, 0.16));
}

.overview-copy {
  display: grid;
  gap: 1rem;
}

.overview-facts {
  display: grid;
  gap: 0.45rem;
}

.overview-fact-row {
  display: grid;
  grid-template-columns: minmax(120px, 165px) 1fr;
  gap: 0.65rem;
  align-items: baseline;
  font-size: clamp(0.85rem, 1.05vw, 1.08rem);
}

.overview-fact-row span {
  font-weight: 700;
  color: rgba(6, 8, 11, 0.92);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.76em;
}

.overview-fact-row strong {
  font-size: inherit;
  font-weight: 500;
  text-align: left;
}

.overview-list,
.overview-status-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.overview-list {
  display: grid;
  gap: 0.24rem;
  font-size: clamp(0.9rem, 1.05vw, 1.08rem);
}

.overview-list li,
.overview-status-list li {
  position: relative;
  padding-left: 1.05rem;
}

.overview-list li::before,
.overview-status-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.7em;
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), #e0b530);
}

.overview-status-list {
  display: grid;
  gap: 0.38rem;
  font-size: clamp(0.9rem, 1.05vw, 1.08rem);
}

.overview-status-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  margin-top: 0.9rem;
  padding-top: 0.8rem;
  border-top: 1px solid rgba(6, 8, 11, 0.18);
}

.overview-status-meta span {
  display: block;
  margin-bottom: 0.22rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(6, 8, 11, 0.65);
}

.overview-status-meta strong {
  font-size: 0.92rem;
  color: #06080b;
}

.overview-visual-panel {
  overflow: hidden;
  min-height: auto;
  aspect-ratio: 16 / 9;
  padding: 0;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.32), transparent 34%),
    linear-gradient(180deg, rgba(214, 220, 225, 0.88), rgba(177, 187, 196, 0.9));
}

.overview-stream-player {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: cover;
  border-radius: inherit;
  background: #d6dde3;
}

.kpi-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.8rem;
  background: rgba(32, 33, 36, 0.9);
}

.kpi-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.kpi-card strong {
  display: block;
  margin-top: 0.4rem;
  font-family: "Montserrat", sans-serif;
  font-size: 2rem;
  color: var(--accent);
}

.kpi-card small {
  color: var(--accent-2);
}

.document-layout {
  display: none;
  grid-template-columns: 360px 1fr;
  gap: 0.8rem;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

#pageDocuments.active .document-layout {
  display: grid;
}

.document-layout.folder-collapsed {
  grid-template-columns: 0 minmax(0, 1fr);
}

.doc-sidebar,
.doc-list-wrap,
.viewer-wrap,
.admin-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(45, 46, 50, 0.9);
}

.doc-sidebar {
  padding: 0.8rem 0.8rem 0.4rem;
  height: 100%;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.document-layout.folder-collapsed .doc-sidebar {
  opacity: 0;
  pointer-events: none;
}

.sidebar-head {
  margin-bottom: 0.7rem;
}

.sidebar-head small {
  color: var(--muted);
}

.tree {
  display: grid;
  gap: 0.35rem;
  align-content: start;
}

.sidebar-checkbox {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.4rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.sidebar-download-btn {
  margin-top: 0.25rem;
  width: 100%;
}

.tree-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 0.3rem;
  align-items: center;
}

.tree-toggle {
  width: 22px;
  min-width: 22px;
  height: 22px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 0.75rem;
}

.tree-toggle:hover {
  color: var(--text);
  border-color: rgba(4, 124, 252, 0.45);
  background: rgba(4, 124, 252, 0.18);
}

.tree-spacer {
  cursor: default;
  opacity: 0.7;
}

.tree-folder-btn {
  background: transparent;
  color: var(--text);
  border: 1px solid transparent;
  text-align: left;
  padding: 0.35rem 0.45rem;
  border-radius: 8px;
  font-size: 0.8rem;
  width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

.tree-folder-btn:hover,
.tree-folder-btn.active {
  background: rgba(16, 52, 166, 0.26);
  border-color: rgba(16, 52, 166, 0.52);
}

.tree-row.depth-1 {
  margin-left: 0.5rem;
}

.tree-row.depth-2 {
  margin-left: 1rem;
}

.tree-children {
  display: grid;
  gap: 0.35rem;
}

.tree-file-row {
  grid-template-columns: 22px minmax(0, 1fr) auto;
}

.tree-file-btn {
  background: transparent;
  color: var(--text);
  border: 1px solid transparent;
  text-align: left;
  padding: 0.35rem 0.45rem;
  border-radius: 8px;
  font-size: 0.8rem;
  width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

.tree-file-btn:hover,
.tree-file-btn.active {
  background: rgba(4, 124, 252, 0.18);
  border-color: rgba(4, 124, 252, 0.48);
}

.tree-file-actions {
  display: inline-flex;
  gap: 0.15rem;
  flex-shrink: 0;
}

.tree-icon-btn {
  width: 24px;
  min-width: 24px;
  height: 24px;
  padding: 0.1rem;
  display: grid;
  place-items: center;
}

.tree-icon-btn svg {
  width: 14px;
  height: 14px;
  display: block;
}

.tree-icon-btn-excel {
  color: #4caf50;
}

.tree-icon-btn-excel:hover,
.tree-icon-btn-excel:focus-visible {
  color: #66bb6a;
}

.doc-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 0.8rem;
  min-height: 0;
  overflow: hidden;
}

.doc-main.qa-collapsed {
  grid-template-columns: minmax(0, 1fr) 0;
}

.doc-list-wrap {
  display: none;
  height: 100%;
  min-height: 0;
  overflow: auto;
}

.doc-list {
  list-style: none;
  margin: 0;
  padding: 0.4rem;
  font-size: 0.84rem;
}

.doc-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
}

.doc-item.is-admin {
  grid-template-columns: 1fr auto auto;
}

.doc-list button {
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--text);
  border: 1px solid transparent;
  padding: 0.45rem 0.5rem;
}

.doc-list button:hover,
.doc-list button.active {
  border-color: rgba(4, 124, 252, 0.48);
  background: rgba(4, 124, 252, 0.18);
}

.download-btn {
  width: 40px;
  min-width: 40px;
  padding: 0.5rem;
  text-align: center;
  background: transparent;
  color: #fff;
  border: 1px solid transparent;
  box-shadow: none;
}

.download-btn:hover,
.download-btn:focus-visible {
  background: transparent;
  color: #fff;
  border-color: transparent;
  filter: none;
}

.download-btn:hover {
  transform: none;
}

.overlay-root {
  position: fixed;
  inset: 0;
  z-index: 2147483646;
  pointer-events: none;
}

.overlay-root .notification-panel {
  pointer-events: auto;
}

.download-btn span,
.doc-delete-btn span {
  display: inline-block;
  font-size: 0.95rem;
  line-height: 1;
}

.doc-delete-btn {
  width: 40px;
  min-width: 40px;
  padding: 0.5rem;
  text-align: center;
  background: transparent;
  color: #fff;
  border: 1px solid transparent;
  box-shadow: none;
}

.doc-delete-btn:hover,
.doc-delete-btn:focus-visible {
  background: transparent;
  color: #fff;
  border-color: transparent;
  filter: none;
}

.doc-delete-btn:hover {
  transform: none;
}

.tree-icon-btn.danger-btn {
  background: transparent;
  color: #fff;
  border: 1px solid transparent;
  box-shadow: none;
}

.tree-icon-btn.danger-btn:hover,
.tree-icon-btn.danger-btn:focus-visible {
  background: transparent;
  color: #fff;
  border-color: transparent;
  filter: none;
  transform: none;
}

.doc-meta {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.73rem;
}

.viewer-wrap {
  position: relative;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.viewer-head {
  padding: 0.65rem 0.8rem;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.8rem;
}

#viewerStatus {
  color: var(--muted);
  font-size: 0.84rem;
}

.viewer-head-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.viewer-toolbar {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.5rem 0.8rem;
  border-bottom: 1px solid var(--line);
}

#markingStatus {
  color: var(--muted);
  font-size: 0.84rem;
}

#toggleMarkModeBtn.active {
  border-color: rgba(255, 204, 60, 0.7);
  background: rgba(255, 204, 60, 0.26);
}

.pdf-viewer {
  position: relative;
  height: 100%;
  min-height: 0;
  overflow: auto;
  padding: 0.9rem;
  background: #38393d;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.viewer-float-actions {
  position: sticky;
  top: 0.5rem;
  align-self: flex-end;
  display: flex;
  gap: 0.35rem;
  z-index: 10;
  margin-right: 0.5rem;
  margin-bottom: -2.2rem;
}

.viewer-float-btn {
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.55);
  color: #ddd;
  font-size: 1.05rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  backdrop-filter: blur(6px);
  transition: background 0.15s;
  line-height: 1;
  padding: 0;
}

.viewer-float-btn:hover {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  transform: none;
}

.viewer-wrap:fullscreen,
.viewer-wrap:-webkit-full-screen {
  background: #38393d;
}

.viewer-wrap:fullscreen .pdf-viewer,
.viewer-wrap:-webkit-full-screen .pdf-viewer {
  height: 100%;
  max-height: 100vh;
}

.pdf-stack {
  width: max-content;
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 1rem;
}

.pdf-page {
  position: relative;
  width: fit-content;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.28);
}

.pdf-canvas {
  display: block;
  background: #fff;
}

.mark-layer {
  position: absolute;
  inset: 0;
  cursor: crosshair;
}

.mark-box {
  position: absolute;
  border-radius: 3px;
  pointer-events: none;
}

.mark-draft {
  border: 2px dashed rgba(255, 204, 60, 0.9);
  background: rgba(255, 204, 60, 0.2);
}

.mark-preview {
  border: 2px solid rgba(255, 204, 60, 0.92);
  background: rgba(255, 204, 60, 0.28);
}

.mark-reference {
  border: 2px solid rgba(4, 124, 252, 0.95);
  background: rgba(4, 124, 252, 0.24);
}

.qa-panel {
  border-left: 1px solid var(--line);
  padding: 0.8rem;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 0.7rem;
  background: rgba(56, 57, 61, 0.97);
  height: 100%;
  min-height: 0;
  z-index: 3;
  transition:
    width 200ms ease,
    opacity 200ms ease,
    padding 200ms ease;
  width: 360px;
  min-width: 0;
  opacity: 1;
  overflow: hidden;
}

.qa-panel.collapsed {
  width: 0;
  opacity: 0;
  overflow: hidden;
  padding-left: 0;
  padding-right: 0;
  border-left: 0;
}

.qa-head {
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
  align-items: baseline;
}

.qa-head small {
  color: var(--muted);
}

.question-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
  min-height: 0;
  overflow: auto;
}

.question-list li {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem;
  background: rgba(47, 48, 52, 0.84);
}

.question-list p {
  margin: 0.2rem 0 0;
  color: var(--text);
  white-space: pre-wrap;
}

.question-list small {
  color: var(--muted);
}

.answer-box {
  margin-top: 0.45rem;
  padding-top: 0.45rem;
  border-top: 1px dashed rgba(4, 124, 252, 0.34);
}

.answer-form {
  margin-top: 0.45rem;
  display: grid;
  gap: 0.45rem;
}

.message-thread {
  margin-top: 0.35rem;
  display: grid;
  gap: 0.35rem;
}

.message-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.4rem 0.48rem;
}

.message-item.from-admin {
  background: rgba(4, 124, 252, 0.16);
  border-color: rgba(4, 124, 252, 0.38);
}

.message-item.from-user {
  background: rgba(255, 204, 60, 0.12);
  border-color: rgba(255, 204, 60, 0.32);
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}

.admin-card {
  padding: 0.8rem;
}

.admin-wide {
  grid-column: 1 / -1;
}

.admin-note {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 0.45rem 0.55rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.84rem;
}

.admin-table th {
  color: var(--accent-2);
  font-weight: 700;
  position: sticky;
  top: 0;
  background: rgba(56, 57, 61, 0.98);
}

.reset-doc-stats-btn {
  padding: 0.2rem 0.4rem;
  line-height: 1;
  cursor: pointer;
  border: none;
  border-radius: 4px;
}

.reset-all-stats-card {
  margin-top: 1rem;
}

.reset-all-stats-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.reset-all-stats-row .danger-btn {
  margin-left: auto;
}

.reset-all-stats-row .danger-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--line);
  border-radius: 22px;
  transition: background 0.2s;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
  background: #ff6b6b;
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
}

.inbox-actions {
  margin-top: 0.6rem;
  margin-bottom: 0.4rem;
}

.inline-form {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.user-list {
  list-style: none;
  margin: 0.7rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
  max-height: 280px;
  overflow: auto;
}

.user-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.42rem 0.5rem;
  font-size: 0.85rem;
}

.error-text {
  color: var(--danger);
  margin-top: 0.7rem;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---- Tablet ---- */
@media (max-width: 1200px) {
  .shell,
  .admin-grid,
  .inline-form,
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .document-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .document-layout.folder-collapsed {
    grid-template-columns: 1fr;
    grid-template-rows: 0 minmax(0, 1fr);
  }

  .document-layout.folder-collapsed .doc-sidebar {
    overflow: hidden;
    padding: 0;
    border: 0;
    min-height: 0;
    height: 0;
  }

  .doc-sidebar {
    height: auto;
    max-height: 40vh;
    overflow: auto;
  }

  .overview-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .overview-main-panel {
    min-height: auto;
  }

  .overview-side-column {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto;
  }

  .doc-main {
    grid-template-columns: 1fr;
  }

  .doc-main.qa-collapsed {
    grid-template-columns: 1fr;
  }

  .viewer-wrap {
    height: 100%;
    min-height: 0;
  }

  .qa-panel {
    width: 100%;
    border-left: 0;
    border-top: 1px solid var(--line);
    max-height: 50vh;
    overflow: auto;
  }

  .qa-panel.collapsed {
    width: 100%;
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-top: 0;
  }

  .notification-panel {
    width: min(420px, calc(100vw - 2rem));
  }

  #pageDocuments.active {
    height: auto;
    min-height: calc(100vh - 190px);
  }
}

/* ---- Topbar wrapping ---- */
@media (max-width: 900px) {
  .topbar {
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.7rem 0.8rem;
  }

  .topbar-actions {
    flex-wrap: wrap;
    gap: 0.4rem;
  }

  .user-tag {
    font-size: 0.78rem;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* ---- Small tablet / large phone ---- */
@media (max-width: 760px) {
  #pageOverview,
  .overview-scene {
    min-height: auto;
  }

  .overview-scene {
    padding: 0.9rem;
  }

  .overview-side-column {
    grid-template-columns: 1fr;
  }

  .overview-brand-logo {
    width: min(88%, 420px);
  }

  .overview-fact-row {
    grid-template-columns: 1fr;
    gap: 0.12rem;
  }

  .overview-fact-row strong {
    text-align: left;
  }

  .overview-status-meta {
    grid-template-columns: 1fr;
  }

  .overview-visual-panel {
    aspect-ratio: 16 / 9;
  }

  .topbar h2 {
    font-size: 1rem;
  }

  .topbar-actions button {
    font-size: 0.78rem;
    padding: 0.45rem 0.55rem;
  }

  .viewer-head {
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.5rem 0.6rem;
  }

  .viewer-head-actions {
    flex-wrap: wrap;
    gap: 0.35rem;
    width: 100%;
  }

  #viewerStatus {
    font-size: 0.74rem;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .viewer-toolbar {
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.4rem 0.6rem;
  }

  .doc-sidebar {
    max-height: 35vh;
  }

  .qa-panel {
    max-height: 45vh;
  }

  .qa-head {
    flex-direction: column;
    gap: 0.3rem;
  }

  .modal-card {
    padding: 0.8rem;
  }

  .page {
    padding: 0.7rem;
  }

  .page-head h3 {
    font-size: 1.1rem;
  }

  .kpi-card strong {
    font-size: 1.5rem;
  }
}

/* ---- Phone ---- */
@media (max-width: 640px) {
  main {
    padding: 0.6rem;
  }

  .doc-item {
    grid-template-columns: 1fr;
  }

  .login-card {
    padding: 1.2rem;
    margin: 3vh auto;
  }

  .topbar-title h2 {
    display: none;
  }

  .user-tag {
    max-width: 120px;
    font-size: 0.72rem;
  }

  .topbar-actions {
    gap: 0.3rem;
  }

  .topbar-actions button {
    font-size: 0.72rem;
    padding: 0.4rem 0.5rem;
  }

  .inline-form {
    grid-template-columns: 1fr 1fr;
  }

  .inline-form button[type="submit"] {
    grid-column: 1 / -1;
  }

  .overview-brand {
    flex-direction: column;
    align-items: flex-start;
  }

  .overview-brand-logo {
    width: 100%;
    max-width: 280px;
  }

  .doc-sidebar {
    max-height: 30vh;
  }

  .tree-folder-btn,
  .tree-file-btn {
    font-size: 0.75rem;
    padding: 0.4rem;
  }

  .sidebar-head h4 {
    font-size: 0.9rem;
  }

  button {
    padding: 0.55rem 0.7rem;
  }

  input,
  select,
  textarea {
    padding: 0.6rem 0.7rem;
    font-size: 0.88rem;
  }
}

/* ---- Very small phone ---- */
@media (max-width: 400px) {
  main {
    padding: 0.4rem;
  }

  .topbar {
    padding: 0.5rem;
  }

  .topbar-logo {
    max-width: 80px;
  }

  .user-tag {
    display: none;
  }

  .login-card {
    border-radius: 12px;
    padding: 1rem;
  }

  .card {
    border-radius: 12px;
  }

  .doc-sidebar {
    padding: 0.5rem 0.5rem 0.3rem;
  }

  .notification-panel {
    width: 100vw;
    border-radius: 0 0 12px 12px;
  }
}

/* ── Mobile notice banner ──────────────────────────────── */
.mobile-notice {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: var(--accent);
  color: #1a1a1a;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 8px;
  margin-bottom: 0.75rem;
}

.mobile-notice.hidden {
  display: none;
}

.mobile-notice-dismiss {
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.15);
  color: #1a1a1a;
  border: none;
  border-radius: 6px;
  padding: 0.35rem 0.75rem;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.mobile-notice-dismiss:hover {
  background: rgba(0, 0, 0, 0.25);
}
