@import url("https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:ital,wght@0,400;0,500;0,600;0,700;0,800;1,400&family=Crimson+Pro:wght@500;600;700&display=swap");

:root {
  --ink: #12263a;
  --ink-soft: #3d5163;
  --muted: #5c6b73;
  --paper: #f4efe6;
  --paper-deep: #ebe4d6;
  --card: #fffcf7;
  --line: #d9cfc0;
  --line-strong: #c4b6a2;
  --teal: #0f5c56;
  --teal-deep: #0a3f3b;
  --teal-mid: #157a72;
  --teal-soft: #d7efe9;
  --gold: #b45309;
  --gold-soft: #f3e0c8;
  --exam: #9f1239;
  --official: #1d4ed8;
  --course: #0f766e;
  --lecture: #b45309;
  --quiz: #6d28d9;
  --danger: #b91c1c;
  --ok: #047857;
  --shadow: 0 10px 30px rgba(18, 38, 58, 0.08);
  --shadow-lg: 0 24px 50px rgba(18, 38, 58, 0.14);
  --radius: 16px;
  --radius-sm: 10px;
  --header: 72px;
  --font: "Be Vietnam Pro", "Segoe UI", sans-serif;
  --serif: "Crimson Pro", "Times New Roman", serif;
  --focus: 0 0 0 3px rgba(15, 92, 86, 0.35);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

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

html {
  scroll-behavior: smooth;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100vh; /* fallback Android WebView cũ */
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(21, 122, 114, 0.12), transparent 50%),
    radial-gradient(900px 400px at 100% 0%, rgba(180, 83, 9, 0.08), transparent 45%),
    var(--paper);
  line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
  overflow-x: clip;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}

/* Touch / Android: tắt noise texture (SVG filter nặng GPU) + transition ngắn */
@media (hover: none), (pointer: coarse) {
  body::before {
    display: none;
  }
  html {
    scroll-behavior: auto;
  }
  .btn,
  .explorer-item,
  .explorer-row-btn,
  .nav-link,
  .explorer-sub,
  .ex-path-item,
  .subject-card,
  .doc-card {
    transition-duration: 80ms;
  }
  /* Android Chrome: giảm pull-to-refresh giật khi vuốt list */
  .explorer,
  .explorer-drop,
  .staff-table-wrap,
  .app-shell {
    overscroll-behavior-y: contain;
  }
  /* Bớt shadow phức tạp trên máy yếu */
  .explorer,
  .subject-card,
  .doc-card,
  .login-glass,
  .upload-dialog,
  .staff-dialog,
  .user-menu-card {
    box-shadow: 0 8px 20px rgba(18, 38, 58, 0.1);
  }
  .site-header {
    box-shadow: 0 4px 12px rgba(10, 63, 59, 0.22);
  }
}

/* Class gắn bởi JS trên thiết bị touch */
html.is-touch body::before {
  display: none;
}
html.is-touch .explorer-item,
html.is-touch .btn,
html.is-touch .explorer-row-btn {
  transition-duration: 70ms;
}

/* Dialog: hỗ trợ visualViewport (bàn phím Android) — ẩn thanh trượt */
dialog.login-dialog[open],
dialog.staff-dialog[open],
dialog.upload-dialog[open] {
  position: fixed;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* legacy Edge */
}
dialog.login-dialog[open]::-webkit-scrollbar,
dialog.staff-dialog[open]::-webkit-scrollbar,
dialog.upload-dialog[open]::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

/* Khóa cuộn nền khi dialog mở — tránh thanh trượt trang phía sau */
body:has(dialog[open]) {
  overflow: hidden;
}

/* Android: input search không bị style lệch */
input[type="search"] {
  -webkit-appearance: none;
  appearance: none;
}
input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  height: 16px;
  width: 16px;
  background: center / contain no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%235c6b73'%3E%3Cpath d='M18.3 5.7 12 12l6.3 6.3-1.4 1.4L10.6 13.4 4.3 19.7 2.9 18.3 9.2 12 2.9 5.7 4.3 4.3l6.3 6.3 6.3-6.3z'/%3E%3C/svg%3E");
  cursor: pointer;
}

button,
a,
.explorer-item,
.explorer-sub,
.explorer-item-main,
.explorer-row-btn,
.nav-link,
.btn,
.ex-path-item,
.user-menu-btn,
.user-menu-link,
.user-menu-logout {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--teal);
  text-decoration: none;
}

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

button,
a,
.explorer-item,
.explorer-sub,
.doc-card,
.subject-card {
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.72;
  cursor: wait;
}

.btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  background: var(--teal);
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 100;
}

.skip:focus {
  top: 12px;
}

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

.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: calc(var(--header) + var(--safe-top));
  padding-top: var(--safe-top);
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
  overflow: visible;
  display: flex;
  align-items: center;
  background: color-mix(in srgb, var(--teal-deep) 92%, black);
  color: #f6f1e8;
  box-shadow: 0 8px 24px rgba(10, 63, 59, 0.28);
  /* Android: layer riêng → scroll mượt hơn, ít flicker status bar */
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.header-inner {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  flex-shrink: 0;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(160deg, #1d9b90, #0f5c56);
  display: grid;
  place-items: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
  color: #fff;
}

.brand-mark svg {
  width: 22px;
  height: 22px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-text strong {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.brand-text span {
  font-size: 0.72rem;
  opacity: 0.78;
}


/* Segment nav — auto layout, góc phải */
.header-end {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: clamp(6px, 1.5vw, 12px);
  margin-left: auto;
  min-width: 0;
  flex: 1 1 auto;
  max-width: 100%;
}
.header-seg {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  align-items: stretch;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.12);
  flex: 0 1 auto;
  min-width: 0;
  max-width: min(100%, 320px);
}
.seg-link {
  color: rgba(246, 241, 232, 0.78);
  padding: 7px clamp(8px, 1.8vw, 16px);
  border-radius: 999px;
  font-size: clamp(0.75rem, 2.2vw, 0.88rem);
  font-weight: 600;
  min-height: 36px;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
  transition: background 120ms ease, color 120ms ease;
  /* cho phép co chữ khi chật */
  overflow: hidden;
}
.seg-label {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.seg-link.is-active {
  color: #0f3d3a;
  background: #f3efe4;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
@media (hover: hover) and (pointer: fine) {
  .seg-link:hover:not(.is-active) {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
  }
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
}

.nav-link {
  color: rgba(246, 241, 232, 0.82);
  padding: 8px 12px;
  border-radius: 999px;
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.nav-link.is-active {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

@media (hover: hover) and (pointer: fine) {
  .nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
  }
}

.nav-link:active {
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
}

.header-tools .btn-light {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.22);
}

.header-tools .btn-light:hover {
  background: rgba(255, 255, 255, 0.2);
}

.header-tools {
  margin-left: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.guest-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 4px 14px 4px 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  font-weight: 600;
  font-size: 0.88rem;
}

.guest-chip:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.guest-ico {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  display: grid;
  place-items: center;
}

.icon-btn,
.menu-toggle {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  border-radius: 12px;
  display: grid;
  place-items: center;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 4px 10px 4px 4px;
  min-height: 44px;
  white-space: nowrap;
  flex-shrink: 0;
}

.user-menu {
  position: relative;
  flex-shrink: 0;
}

.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 4px 10px 4px 4px;
  min-height: 44px;
}

.user-menu-caret {
  opacity: 0.8;
  transition: transform 160ms ease;
}

.user-menu.is-open .user-menu-caret {
  transform: rotate(180deg);
}

.user-menu-card {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: 260px;
  padding: 12px;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  z-index: 50;
}

.user-menu.is-open .user-menu-card {
  display: block;
}

.user-menu-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 10px;
}

.user-menu-head .avatar {
  width: 40px;
  height: 40px;
  background: var(--teal);
}

.user-menu-name {
  margin: 0;
  font-weight: 700;
  line-height: 1.25;
}

.user-menu-role {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.user-menu-sep {
  height: 1px;
  margin: 6px 4px;
  background: var(--line);
}

.user-menu-link,
.user-menu-logout {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border-radius: 10px;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
  font-weight: 600;
}

.drawer-label {
  margin: 12px 12px 4px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(246, 241, 232, 0.55);
}

.user-menu-link:hover {
  background: var(--teal-soft);
  color: var(--teal-deep);
}

.user-menu-logout {
  color: var(--danger);
}

.user-menu-logout:hover {
  background: #fde8ee;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gold);
  color: #fff;
  display: grid;
  place-items: center;
}

.avatar svg {
  width: 18px;
  height: 18px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.92rem;
  transition: transform 100ms ease, background 120ms ease, box-shadow 120ms ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--gold);
  color: #fff;
}

.btn-primary:hover {
  background: #9a3f07;
}

.btn-ghost {
  background: transparent;
  color: inherit;
  border-color: currentColor;
}

.btn-light {
  background: #fff;
  color: var(--teal-deep);
  border-color: var(--line);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-teal {
  background: var(--teal);
  color: #fff;
}

.menu-toggle {
  display: none;
}

main {
  flex: 1;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 64px;
}

body.is-landing {
  background:
    radial-gradient(1100px 480px at 6% -12%, rgba(15, 118, 110, 0.16), transparent 52%),
    radial-gradient(900px 380px at 100% 0%, rgba(217, 119, 6, 0.1), transparent 48%),
    #f3efe4;
}

body.is-landing main {
  width: min(1120px, calc(100% - 48px));
  padding: 36px 0 72px;
}

body.is-landing .landing-eyebrow {
  color: #0f766e;
}

body.is-landing .landing-copy h1 {
  color: #134e4a;
}

body.is-landing .landing-cta .btn-primary,
body.is-landing .landing-band .btn-primary {
  background: #c2410c;
}

body.is-landing .landing-cta .btn-primary:hover,
body.is-landing .landing-band .btn-primary:hover {
  background: #9a3412;
}

body.is-landing .landing-steps b {
  color: #0f766e;
}

body.is-landing .landing-tree li {
  background: #d7efe9;
  color: #0f5c56;
}

body.is-landing .landing-band {
  background: #0f5c56;
}

.landing {
  padding: 8px 0 0;
}

.landing-hero {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(300px, 1.08fr);
  gap: 56px;
  align-items: center;
}

.landing-eyebrow {
  margin: 0 0 18px;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--teal);
}

.landing-copy h1 {
  font-size: clamp(1.7rem, 2.6vw, 2.25rem);
  line-height: 1.22;
  margin: 0 0 16px;
  max-width: 18ch;
  color: var(--teal-deep);
}

.landing-copy .lede {
  margin: 0 0 28px;
  max-width: 42ch;
  font-size: 1.05rem;
  line-height: 1.65;
}

.landing-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin: 0;
}

.landing-cta .btn {
  min-width: 160px;
  min-height: 48px;
  padding: 0 22px;
}

.landing-frame {
  position: relative;
  min-height: 420px;
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.landing-frame-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.landing-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10, 63, 59, 0.08) 20%, rgba(10, 63, 59, 0.62));
}

.landing-stage {
  position: absolute;
  z-index: 1;
  left: 16px;
  right: 16px;
  bottom: 16px;
  padding: 12px 10px 8px;
  background: rgba(255, 252, 247, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(10, 63, 59, 0.2);
  pointer-events: none;
  user-select: none;
}

.landing-stage-badge {
  margin: 0 6px 6px;
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--teal);
  background: var(--teal-soft);
  padding: 2px 8px;
  border-radius: 999px;
}

.landing-stage-path {
  margin: 0 6px 8px;
  font-size: 0.75rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.landing-stage-path span {
  margin: 0 4px;
  opacity: 0.55;
}

.landing-stage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 40px;
  padding: 0 8px;
  border-radius: 8px;
  color: var(--ink);
}

.landing-stage-row > span {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
  font-size: 0.84rem;
  font-weight: 600;
  overflow: hidden;
}

.landing-stage-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.landing-stage-row svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

.landing-stage-row em {
  flex: 0 0 auto;
  flex-shrink: 0;
  font-style: normal;
  font-size: 0.75rem;
  font-weight: 700;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 11px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--teal-deep);
  white-space: nowrap;
}

.landing-stage-row.is-on {
  background: var(--teal-soft);
}

.landing-stage-row.is-on em {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

.landing-steps {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin: 64px 0 12px;
  padding: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.landing-steps li {
  padding: 28px 28px 28px 0;
}

.landing-steps li + li {
  padding-left: 28px;
  border-left: 1px solid var(--line);
}

.landing-steps b {
  display: block;
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--teal);
}

.landing-steps strong {
  display: block;
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.landing-steps p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
  max-width: 28ch;
}

.landing-how-note {
  margin: 0 0 48px;
  color: var(--muted);
  font-size: 0.88rem;
}

.landing-points {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
  margin: 0 0 56px;
}

.landing-points h3 {
  margin: 0 0 8px;
  font-size: 1.2rem;
}

.landing-points p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.landing-sec {
  margin: 0 0 56px;
}

.landing-sec h2 {
  margin: 0 0 8px;
  font-size: clamp(1.4rem, 2.2vw, 1.75rem);
}

.landing-sec > p {
  margin: 0 0 20px;
  color: var(--muted);
  max-width: 62ch;
}

.landing-tree {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.landing-tree article {
  padding: 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.landing-tree strong {
  display: block;
  font-size: 1.05rem;
}

.landing-tree ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 0;
  padding: 0;
}

.landing-tree li {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--paper);
  color: var(--teal-deep);
}

.landing-shared {
  margin-top: 16px;
  padding: 20px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: color-mix(in srgb, var(--paper) 55%, white);
}

.landing-shared strong {
  display: block;
  margin-bottom: 6px;
}

.landing-shared p {
  margin: 0;
  color: var(--muted);
}

.landing-notes {
  margin: 0;
  padding: 0 0 0 1.15em;
  color: var(--ink-soft);
  line-height: 1.7;
}

.landing-notes li + li {
  margin-top: 8px;
}

.landing-faq {
  border-top: 1px solid var(--line);
}

.landing-faq details {
  border-bottom: 1px solid var(--line);
}

.landing-faq summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  font-weight: 600;
  cursor: pointer;
}

.landing-faq summary:hover {
  color: var(--teal-deep);
}

.landing-faq p {
  margin: 0 0 14px;
  color: var(--muted);
  max-width: 68ch;
}

.landing-band {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 32px 36px;
  border-radius: 12px;
  background: var(--teal-deep);
  color: #f6f1e8;
}

.landing-band h2 {
  margin: 0 0 6px;
  color: inherit;
  font-size: 1.5rem;
}

.landing-band p {
  margin: 0;
  color: rgba(246, 241, 232, 0.78);
}

@media (prefers-reduced-motion: no-preference) {
  .landing-frame {
    animation: landing-up 480ms ease-out;
  }
}

@keyframes landing-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 28px;
  align-items: center;
  padding: 12px 0 8px;
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--teal-soft);
  color: var(--teal-deep);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h1,
h2,
h3,
.serif {
  font-family: var(--serif);
  letter-spacing: -0.02em;
}

.hero h1 {
  font-size: clamp(2.1rem, 4vw, 3.4rem);
  line-height: 1.12;
  margin: 14px 0 12px;
}

.lede {
  font-size: 1.05rem;
  color: var(--ink-soft);
  max-width: 56ch;
  margin: 0 0 22px;
}

.search-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 10px;
  box-shadow: var(--shadow);
  position: relative;
}

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

.search-row .btn {
  flex-shrink: 0;
}

.search-row input {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  border: 0;
  background: transparent;
  padding: 0 14px;
  font-size: 1rem;
  color: var(--ink);
}

.search-row input::placeholder {
  color: #8a7c6c;
}

.suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 20;
  display: none;
}

.suggest.is-open {
  display: block;
}

.suggest button {
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 12px 16px;
  min-height: 48px;
  color: var(--ink);
}

.suggest button:hover,
.suggest button.is-active {
  background: var(--paper-deep);
}

.hero-art {
  background:
    linear-gradient(160deg, rgba(15, 92, 86, 0.08), rgba(180, 83, 9, 0.08)),
    var(--card);
  border: 1px solid var(--line);
  border-radius: 28px;
  min-height: 280px;
  padding: 24px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 8px;
}

.stat-card {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
}

.stat-card b {
  display: block;
  font-size: 1.4rem;
  font-family: var(--serif);
}

.stat-card span {
  color: var(--muted);
  font-size: 0.82rem;
}

.section {
  margin-top: 42px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 16px;
}

.section-head h2 {
  margin: 0;
  font-size: 1.7rem;
}

.section-head p {
  margin: 4px 0 0;
  color: var(--muted);
}

.subject-grid,
.doc-grid,
.feature-grid {
  display: grid;
  gap: 14px;
}

.subject-grid {
  grid-template-columns: repeat(5, 1fr);
}

.doc-grid {
  grid-template-columns: repeat(3, 1fr);
}

.feature-grid {
  grid-template-columns: repeat(4, 1fr);
}

.subject-card,
.doc-card,
.feature-card,
.panel,
.login-card,
.empty,
.admin-table-wrap {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.subject-card {
  padding: 16px;
  min-height: 132px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: inherit;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.subject-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.subject-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
}

.subject-card strong {
  font-size: 1rem;
}

.subject-card span {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: auto;
}

.doc-card {
  padding: 16px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 230px;
  color: inherit;
  transition: transform 180ms ease;
}

.doc-card:hover {
  transform: translateY(-3px);
}

.doc-card h3 {
  margin: 0;
  font-size: 1.18rem;
  line-height: 1.3;
}

.doc-card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 12px;
  margin-top: auto;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
}

.doc-card-foot span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

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

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

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--paper-deep);
  color: var(--ink-soft);
  border: 1px solid transparent;
}

.chip.exam { background: #fde8ee; color: var(--exam); }
.chip.official { background: #e8efff; color: var(--official); }
.chip.course { background: #ddf4ef; color: var(--course); }
.chip.lecture { background: #f8ead8; color: var(--lecture); }
.chip.quiz { background: #eee7fb; color: var(--quiz); }

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0;
}

.filter-search {
  position: relative;
  flex: 1 1 280px;
  min-width: min(100%, 240px);
}

.filter-search input {
  width: 100%;
  padding-right: 44px;
}

.filter-search-ico {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  display: grid;
  place-items: center;
  pointer-events: none;
}

.filter-bar select,
.filter-bar input,
.form-grid input,
.form-grid select,
.form-grid textarea,
.login-card input {
  min-height: 44px;
  border: 1px solid var(--line-strong);
  background: #fff;
  border-radius: 12px;
  padding: 8px 12px;
  color: var(--ink);
  font-size: 0.95rem;
}

.filter-bar select,
.filter-bar input {
  min-width: 150px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.feature-card {
  padding: 18px;
}

.feature-card h3 {
  margin: 12px 0 6px;
  font-size: 1.15rem;
}

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

.ico {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--teal-soft);
  color: var(--teal);
  display: grid;
  place-items: center;
}

.page-head {
  margin-bottom: 18px;
}

.page-head h1 {
  margin: 8px 0;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
}

.crumb {
  color: var(--muted);
  font-size: 0.88rem;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.crumb a {
  color: var(--teal-mid);
}

.detail {
  display: grid;
  grid-template-columns: 1.4fr 0.7fr;
  gap: 20px;
}

.panel {
  padding: 22px;
}

.about-lead {
  margin-bottom: 18px;
}

.about-lead p {
  font-size: 1.05rem;
  color: var(--ink-soft);
  max-width: 72ch;
}

.about-lead p + p {
  margin-top: 12px;
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 0 0 18px;
}

.about-grid h2 {
  font-size: 1.25rem;
  margin: 10px 0 8px;
}

.about-grid p {
  margin: 0;
  color: var(--ink-soft);
}

.about-body h2 {
  font-size: 1.35rem;
  margin: 22px 0 10px;
}

.about-body h2:first-child {
  margin-top: 0;
}

.about-body p,
.about-body li {
  color: var(--ink-soft);
  max-width: 72ch;
}

.about-steps {
  margin: 0;
  padding-left: 1.2rem;
}

.about-steps li {
  margin: 8px 0;
}

.about-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

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

#app:focus,
#app:focus-visible {
  outline: none;
  box-shadow: none;
}

.skel-card,
.skel-line,
.skel-preview {
  background: linear-gradient(90deg, var(--paper-deep) 25%, #fff 50%, var(--paper-deep) 75%);
  background-size: 200% 100%;
  animation: skel 1.2s ease-in-out infinite;
  border-radius: 14px;
}

.skel-card {
  min-height: 160px;
  border: 1px solid var(--line);
}

.skel-line {
  height: 28px;
  width: 60%;
  margin-bottom: 16px;
}

.skel-preview {
  min-height: 320px;
  margin: 12px 0;
}

@keyframes skel {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .skel-card, .skel-line, .skel-preview { animation: none; }
}

.preview-stage {
  position: relative;
  min-height: 72vh;
}

.preview-wait {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  gap: 10px;
  border-radius: 14px;
  background: #fff;
  color: var(--muted);
  font-size: 0.95rem;
}

.preview-stage.is-ready .preview-wait {
  display: none;
}

.drive-frame {
  width: 100%;
  min-height: 72vh;
  height: 72vh;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: #fff;
}

.doc-preview {
  white-space: pre-wrap;
  font-family: var(--serif);
  background: #fff;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  padding: 20px;
  min-height: 280px;
  line-height: 1.7;
}

.side-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.side-list a {
  color: inherit;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.login-wrap {
  min-height: 60vh;
  display: grid;
  place-items: center;
}

.login-card {
  width: min(460px, 100%);
  padding: 28px;
}

.login-card h1 {
  margin: 8px 0 6px;
}

body.is-login .site-header,
body.is-login .footer {
  display: none;
}

body.is-login #app {
  width: 100%;
  max-width: none;
  padding: 0;
  margin: 0;
}

body.is-login {
  background: #00342e;
}

.login-hero {
  position: relative;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  overflow: hidden;
}

.login-hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.82;
  z-index: 0;
}

.login-hero-veil {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgba(0, 52, 46, 0.28);
}

.login-dialog {
  width: min(440px, calc(100% - 32px));
  max-height: calc(100dvh - 24px);
  margin: auto;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: auto;
  overscroll-behavior: contain;
}

dialog.login-dialog {
  display: none;
}

dialog.login-dialog[open] {
  display: flex;
  flex-direction: column;
}

.login-dialog::backdrop {
  background: rgba(10, 63, 59, 0.52);
}

body.is-login-open {
  overflow: hidden;
}

.login-glass,
.login-help {
  position: relative;
  z-index: 2;
}

.login-glass {
  position: relative;
  width: 100%;
  max-width: 440px;
  flex: 0 1 auto;
  padding: 28px 28px 22px;
  border-radius: 16px;
  background: #fcf9f0;
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 16px 40px rgba(0, 52, 46, 0.28);
  overflow: hidden;
}

.login-head {
  text-align: center;
  margin-bottom: 16px;
}

.login-badge {
  width: 52px;
  height: 52px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: #0f5c56;
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 20px rgba(15, 92, 86, 0.28);
}

.login-head h1 {
  margin: 0 0 6px;
  color: #134e4a;
  font-size: 1.55rem;
}

.login-head p {
  margin: 0;
  color: #404946;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.glass-field {
  position: relative;
}

.glass-field > label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: #00342e;
  margin: 0 0 6px;
}

.glass-ico {
  position: absolute;
  left: 14px;
  bottom: 14px;
  color: #707976;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.glass-field input {
  width: 100%;
  min-height: 48px;
  padding: 10px 44px 10px 46px;
  border-radius: 10px;
  border: 1px solid rgba(191, 200, 197, 0.55);
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink);
  font-size: 1rem;
}

.glass-field input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.88);
  border-color: #00342e;
  box-shadow: 0 0 0 2px rgba(0, 52, 46, 0.12);
}

.glass-eye {
  position: absolute;
  right: 8px;
  bottom: 4px;
  border: 0;
  background: none;
  color: #707976;
  min-height: 40px;
  min-width: 40px;
  display: grid;
  place-items: center;
}

.login-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

.login-remember {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  color: #404946;
  font-size: 0.92rem;
}

.login-remember input {
  width: 18px;
  height: 18px;
}

.login-forgot-note {
  margin: 10px 0 0;
  font-size: 0.84rem;
  color: #404946;
  text-align: center;
}

.login-submit {
  width: 100%;
  min-height: 48px;
  margin-top: 4px;
  border: 0;
  border-radius: 10px;
  background: #00342e;
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(0, 52, 46, 0.35);
}

.login-submit:hover {
  background: #0f4c44;
  transform: translateY(-1px);
}

.login-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: #134e4a;
  display: grid;
  place-items: center;
}

.login-close:hover {
  background: #ebe4d6;
  color: #0f5c56;
}

.login-help {
  margin: 20px 0 0;
  padding: 12px 16px;
  border-radius: 10px;
  background: rgba(252, 249, 240, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.45);
  color: #1c1c17;
  font-size: 0.88rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  backdrop-filter: blur(12px);
}

.login-glass .alert {
  margin: 0 0 4px;
}

.login-glass .alert:not(.is-on) {
  display: none;
}

.login-glass .alert a {
  display: block;
  margin-top: 4px;
  color: inherit;
  font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
  .login-submit:hover { transform: none; }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 14px;
}

.field label {
  font-weight: 600;
  font-size: 0.9rem;
}

.demo-box {
  margin-top: 16px;
  background: var(--paper);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.form-grid textarea {
  min-height: 180px;
  resize: vertical;
}

.admin-table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th,
td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}

th {
  background: var(--paper-deep);
  font-weight: 600;
}

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

.dash-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}

.dash-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}

.dash-card span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.dash-card b {
  display: block;
  font-family: var(--serif);
  font-size: 1.8rem;
  line-height: 1.2;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

.staff-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.staff-head .page-head {
  margin: 0;
  flex: 1 1 240px;
  min-width: 0;
}

.admin-tabs {
  display: flex;
  gap: 0;
  margin: 0 0 0 auto;
  padding: 4px;
  border-radius: 999px;
  background: #efe8dc;
  flex-shrink: 0;
}

.admin-tab {
  min-height: 40px;
  padding: 0 20px;
  border-radius: 999px;
  border: 0;
  background: transparent;
  color: #6b6458;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
}

.admin-tab:hover {
  color: var(--ink);
}

.admin-tab.is-on {
  background: #fff;
  color: #1c1917;
  box-shadow: 0 1px 2px rgba(28, 25, 23, 0.12);
  font-weight: 700;
}

.staff-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.staff-total {
  display: flex;
  align-items: center;
  gap: 12px;
}

.staff-total-ico {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #f1eee5;
  color: var(--teal);
  display: grid;
  place-items: center;
}

.staff-total-kicker {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.staff-total strong {
  color: var(--teal-deep);
  font-size: 1.35rem;
}

.staff-add {
  background: #9a4602;
}

.staff-add:hover {
  background: #7c3800;
}

.staff-table-wrap {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: auto;
}

.staff-table {
  min-width: 0;
  width: 100%;
}

.staff-table thead th {
  background: #fffcf7;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.72rem;
}

.staff-actions-col {
  text-align: right;
}

.staff-table .row-actions {
  justify-content: flex-end;
}

.staff-table .staff-user {
  font-weight: 700;
  color: var(--teal-deep);
}

.role-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--paper-deep);
  color: var(--ink-soft);
}

.role-pill.role-admin {
  background: var(--teal-soft);
  color: var(--teal-deep);
}

.role-pill.role-board {
  background: var(--gold-soft);
  color: var(--gold);
}

.pass-pending {
  font-style: italic;
  color: var(--muted);
}

.icon-action {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--teal-deep);
  display: inline-grid;
  place-items: center;
}

.icon-action:hover {
  background: var(--teal-soft);
}

.icon-action.danger {
  color: var(--danger);
}

.icon-action.danger:hover {
  background: #fde8ee;
}

.icon-action:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.staff-dialog {
  width: min(600px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: #fcf9f0;
  color: #1a1b18;
  box-shadow: 0 20px 40px rgba(26, 27, 24, 0.22);
  overflow: hidden;
  flex-direction: column;
}

dialog.staff-dialog {
  display: none;
}

dialog.staff-dialog[open],
section.staff-dialog {
  display: flex;
}

.staff-dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
}

.staff-dialog-head {
  padding: 24px 24px 8px;
}

.staff-dialog-head h2 {
  margin: 0 0 4px;
  font-size: 1.5rem;
  font-weight: 800;
  color: #1a1b18;
  letter-spacing: -0.02em;
}

.staff-dialog-head p {
  margin: 0;
  font-size: 0.875rem;
  color: #44483e;
}

.staff-dialog-body {
  padding: 16px 24px 8px;
  overflow: auto;
  flex: 1 1 auto;
  min-height: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.staff-dialog-body::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.staff-dialog-body form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.staff-dialog .field {
  margin: 0;
  gap: 4px;
}

.staff-dialog label {
  font-size: 0.875rem;
  font-weight: 700;
  color: #1a1b18;
}

.staff-dialog input,
.staff-dialog select {
  width: 100%;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid #c5c7ba;
  border-radius: 8px;
  background: #fff;
  color: #1a1b18;
  font-size: 0.92rem;
  box-shadow: none;
}

.staff-dialog input::placeholder {
  color: #75776d;
}

.staff-dialog #staff-subject:has(option[value=""]:checked) {
  color: #75776d;
}

.staff-dialog input:focus,
.staff-dialog select:focus {
  border-color: #0f4c44;
  box-shadow: 0 0 0 1px #0f4c44;
  outline: none;
}

.staff-dialog #staff-role {
  border: 2px solid #0f4c44;
}

.staff-dialog select {
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2344483e' stroke-width='2'><path d='M19 9l-7 7-7-7' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}

.staff-dialog-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.staff-pass-hint {
  margin: 4px 0 0;
  font-size: 0.75rem;
  font-weight: 500;
  color: #75776d;
}

.staff-dialog-foot {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px 24px;
  border-top: 1px solid #f1eddc;
  background: #fcf9f0;
}

.staff-dialog-cancel,
.staff-dialog-save {
  min-height: 40px;
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 700;
}

.staff-dialog-cancel {
  border: 1px solid #c5c7ba;
  background: transparent;
  color: #1a1b18;
}

.staff-dialog-cancel:hover {
  background: #f1eddc;
}

.staff-dialog-save {
  border: 0;
  background: #9c4300;
  color: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.staff-dialog-save:hover {
  background: #7a3400;
}

.staff-dialog-save:disabled {
  opacity: 0.72;
  cursor: wait;
}

@media (max-width: 640px) {
  .staff-dialog {
    width: calc(100% - 16px);
    max-height: calc(100dvh - 12px - var(--safe-top) - var(--safe-bottom));
    border-radius: 12px;
  }
  .staff-dialog-head,
  .staff-dialog-body,
  .staff-dialog-foot {
    padding-left: 16px;
    padding-right: 16px;
  }
  .staff-dialog-head {
    padding-top: 20px;
  }
  .staff-dialog-head h2 {
    font-size: 1.25rem;
  }
  .staff-dialog input {
    min-height: 48px;
    font-size: 16px;
  }
  .staff-dialog-foot {
    flex-direction: column-reverse;
    gap: 8px;
    padding-bottom: calc(16px + var(--safe-bottom));
  }
  .staff-dialog-cancel,
  .staff-dialog-save {
    width: 100%;
    min-height: 48px;
    justify-content: center;
  }
  .staff-toolbar {
    padding: 12px;
  }
  .staff-table-wrap {
    background: transparent;
    border: 0;
    overflow: visible;
  }
  .staff-table thead {
    display: none;
  }
  .staff-table,
  .staff-table tbody,
  .staff-table tr,
  .staff-table td {
    display: block;
    width: 100%;
  }
  .staff-table tr {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 10px;
  }
  .staff-table td {
    border: 0;
    padding: 6px 0;
  }
  .staff-table .staff-user {
    font-weight: 800;
    font-size: 1.05rem;
  }
  .staff-table .row-actions {
    justify-content: flex-start;
    padding-top: 8px;
  }
}

.empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: calc(18px + var(--safe-right));
  bottom: calc(18px + var(--safe-bottom));
  background: var(--ink);
  color: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  z-index: 80;
  opacity: 0;
  transform: translateY(8px);
  transition: 200ms ease;
  max-width: calc(100vw - 36px - var(--safe-left) - var(--safe-right));
}

.toast.is-on {
  opacity: 1;
  transform: none;
}

.footer {
  border-top: 1px solid var(--line);
  padding: 28px 0 calc(36px + var(--safe-bottom));
  color: var(--muted);
  font-size: 0.9rem;
}

.footer-inner {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-mark {
  color: var(--teal);
  display: grid;
  place-items: center;
}

.footer-brand strong {
  display: block;
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--teal-deep);
  line-height: 1.2;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 20px;
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0;
}

.footer-nav a {
  color: var(--muted);
  font-size: 0.85rem;
}

.footer-nav a:hover {
  color: var(--gold);
}

.pwd-wrap {
  position: relative;
}

.pwd-wrap input {
  width: 100%;
  padding-right: 48px;
}

.pwd-wrap .toggle-pwd {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: none;
  min-height: 40px;
  color: var(--muted);
}

.drawer {
  display: none;
}

.required {
  color: var(--danger);
}

.alert {
  background: #fde8ee;
  color: var(--danger);
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 10px;
  display: none;
}

.alert.is-on {
  display: block;
}

.pager {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 20px;
}

.pager button {
  min-width: 44px;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
}

.pager button.is-active {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
}

@media (max-width: 1024px) {
  .subject-grid { grid-template-columns: repeat(3, 1fr); }
  .doc-grid, .feature-grid, .dash-grid { grid-template-columns: repeat(2, 1fr); }
  .hero, .detail, .landing-hero { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  /* iOS: font < 16px trên input sẽ auto-zoom — ép 16px để tránh */
  input,
  select,
  textarea {
    font-size: 16px;
  }

  .header-nav {
    display: flex;
    margin-left: 0;
    gap: 0;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .nav-link {
    font-size: 0.8rem;
    padding: 8px 10px;
    min-height: 44px;
    white-space: nowrap;
  }
  .header-inner {
    gap: 8px;
    width: min(1180px, calc(100% - 20px));
  }
  .menu-toggle,
  .drawer {
    display: none !important;
  }
  .header-tools > .btn-primary { display: none; }
  .brand-text span { display: none; }
  .brand-text strong {
    font-size: 0.95rem;
  }
  .user-chip > span:not(.avatar) { display: none; }
  .user-chip .btn { display: none; }
  .user-menu-caret { display: none; }
  .user-menu-btn {
    gap: 6px;
    padding: 4px 10px 4px 4px;
  }
  .user-menu-label {
    font-size: 0.82rem;
  }
  /* Header mobile: chỉ logo + tab ngắn + avatar */
  .header-inner {
    gap: 8px;
    width: min(1180px, calc(100% - 16px));
  }
  .header-end {
    gap: 8px;
    flex: 0 0 auto;
    min-width: 0;
    margin-left: auto;
  }
  .header-seg {
    padding: 3px;
    flex: 0 0 auto;
    max-width: none;
    width: auto;
  }
  .seg-link {
    padding: 7px 12px;
    font-size: 0.8rem;
    min-height: 36px;
  }
  /* Ẩn tên trường — chỉ logo */
  .brand-text {
    display: none !important;
  }
  .brand {
    gap: 0;
    flex-shrink: 0;
  }
  .brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    flex-shrink: 0;
  }
  /* Tab luôn dùng nhãn ngắn trên mobile */
  .seg-link .seg-label {
    font-size: 0;
    line-height: 0;
  }
  .seg-link[data-short]::after {
    content: attr(data-short);
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.2;
  }
  .user-menu-label,
  .user-menu-caret {
    display: none !important;
  }
  .user-menu-btn {
    padding: 2px;
    gap: 0;
    border-radius: 999px;
  }
  .user-menu-btn .avatar {
    width: 36px;
    height: 36px;
  }


  /* Toolbar mobile: auto layout — search sát nút, không phình dọc */
  .explorer-toolbar {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto !important;
    align-items: stretch;
    justify-content: flex-start;
    gap: 8px;
    padding: 10px 12px;
    min-height: 0;
    height: auto;
  }
  .ex-search {
    flex: 0 0 auto !important;
    flex-grow: 0 !important;
    min-width: 0 !important;
    width: 100%;
    max-width: none;
    margin: 0;
  }
  .ex-search input {
    min-height: 42px;
  }
  .explorer-toolbar-actions {
    margin-left: 0;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 6px;
    flex: 0 0 auto;
  }
  .explorer-toolbar-actions .btn-text {
    display: none;
  }
  .explorer-toolbar .btn {
    min-height: 42px;
  }
  .explorer-toolbar .ex-ico-btn {
    width: 42px;
  }
  .explorer-main {
    min-height: 0;
  }
  .explorer-drop {
    flex: 1 1 auto;
    min-height: 0;
  }
  /* Quota: một hàng, chữ không vỡ "Bộ / nhớ / kho:" */
  .ex-path-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 8px 12px;
  }
  .quota {
    min-width: 0;
    width: 100%;
    max-width: none;
    flex: none;
  }
  .quota > span {
    flex-shrink: 0;
    white-space: nowrap;
  }
  .quota-track {
    min-width: 48px;
    flex: 1 1 auto;
  }
  .quota b {
    flex-shrink: 0;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
  }
  .page-head h1 {
    font-size: 1.35rem;
  }
  .staff-head {
    margin-bottom: 10px;
    padding-bottom: 10px;
  }
  .subject-grid, .doc-grid, .feature-grid, .form-grid, .stat-grid,
  .landing-steps, .landing-points, .landing-tree {
    grid-template-columns: 1fr;
  }
  .dash-grid {
    grid-template-columns: 1fr 1fr;
  }
  .landing-steps li + li {
    padding-left: 0;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .landing-band {
    flex-direction: column;
    align-items: flex-start;
  }
  .landing-frame {
    min-height: 300px;
    aspect-ratio: 16 / 11;
  }
  /* Landing mobile: gọn hơn, bớt CTA trùng */
  .landing-band {
    display: none;
  }
  .landing-frame {
    min-height: 240px;
  }
  .landing-stage {
    left: 12px;
    right: 12px;
    bottom: 12px;
    padding: 10px 8px 6px;
  }
  .landing-stage-row {
    min-height: 36px;
    gap: 6px;
  }
  .landing-stage-row em {
    font-size: 0.72rem;
    padding: 0 9px;
  }
  .landing-how-note {
    margin-bottom: 20px;
  }
  .landing-steps {
    margin-top: 36px;
  }

  /* Landing mobile: tránh chữ bị cắt mép / tràn ngang */
  body.is-landing main {
    width: min(1120px, calc(100% - 32px));
    padding: 20px 0 56px;
    overflow-x: clip;
  }
  .landing-hero {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .landing-copy h1 {
    max-width: none;
    font-size: clamp(1.45rem, 6.5vw, 1.85rem);
  }
  .landing-copy .lede {
    max-width: none;
    font-size: 0.98rem;
  }
  .user-chip span:last-child { display: none; }

  .upload-dialog {
    width: calc(100% - 16px);
    max-height: calc(100dvh - 12px - var(--safe-top) - var(--safe-bottom));
    padding: 20px 16px;
  }
  .upload-dialog input,
  .upload-dialog select {
    font-size: 16px;
    min-height: 48px;
  }
  .login-dialog {
    width: calc(100% - 16px);
    max-height: calc(100dvh - 12px - var(--safe-top) - var(--safe-bottom));
  }
  .login-hero {
    padding: calc(24px + var(--safe-top)) 16px calc(24px + var(--safe-bottom));
  }
  .ex-search input {
    font-size: 16px;
    min-height: 44px;
  }
}



@media (max-width: 420px) {
  .brand-text span { display: none; }
  .brand-text strong {
    font-size: 0.88rem;
    max-width: 42vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

.explorer {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.explorer-side {
  background: var(--paper);
  border-right: 1px solid var(--line);
  padding: 14px 10px;
}

.explorer-kicker {
  margin: 0 8px 8px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.explorer-subs {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.explorer-sub {
  text-align: left;
  background: none;
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  min-height: 44px;
  color: var(--ink);
  font-weight: 600;
}

.explorer-sub.is-on {
  background: var(--teal-soft);
  color: var(--teal-deep);
}

@media (hover: hover) and (pointer: fine) {
  .explorer-sub:hover {
    background: var(--teal-soft);
    color: var(--teal-deep);
  }
}

.explorer-sub:active {
  background: var(--teal-soft);
  color: var(--teal-deep);
}

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

.explorer-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 70%, white);
}

.explorer-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.ex-search {
  flex: 1 1 240px;
  min-width: 180px;
  max-width: none;
}

.ex-search input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 14px;
  background: #fff;
  color: var(--ink);
}

.ex-search-more {
  margin: 10px 16px 4px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.explorer-toolbar .btn-primary {
  background: #d97736;
  color: #fff;
}

.explorer-toolbar .btn-primary:hover {
  background: #c4682e;
}

.explorer-toolbar .btn {
  transition: transform 160ms ease, background 160ms ease;
  min-height: 40px;
  padding: 0 14px;
  font-size: 0.88rem;
}

.explorer-toolbar .btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.explorer-toolbar .ex-ico-btn {
  width: 40px;
  padding: 0;
}

.explorer-toolbar [data-ex="back"]:disabled,
.explorer-toolbar [data-ex="fwd"]:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.explorer-toolbar .btn:active {
  transform: scale(0.97);
}

.explorer-status {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.82rem;
}

.quota {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  width: min(420px, 100%);
  color: var(--ink-soft);
  font-size: 0.82rem;
  flex-shrink: 1;
}

.quota-track {
  flex: 1;
  min-width: 64px;
  height: 10px;
  border-radius: 99px;
  background: var(--paper-deep);
  overflow: hidden;
}

.quota-track i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: var(--teal);
  transition: width 200ms ease, background 200ms ease;
}

.quota.is-warn .quota-track i {
  background: #d97706;
}

.quota.is-danger .quota-track i {
  background: var(--danger);
}

.quota.is-warn b,
.quota.is-danger b {
  color: inherit;
}

.quota.is-danger {
  color: var(--danger);
}

.quota.is-warn {
  color: #9a3412;
}

.quota b {
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.quota-alert {
  margin: 0 16px 8px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #f3e0c8;
  color: #9a3412;
  border: 1px solid #e8c48a;
}

.quota-alert.is-danger {
  background: #fde8ee;
  color: var(--danger);
  border-color: #f3c4cc;
}

.quota-alert strong {
  display: block;
  font-size: 0.88rem;
}

.quota-alert p {
  margin: 2px 0 0;
  font-size: 0.84rem;
}

.ex-path-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 6px 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.ex-path {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0;
  margin: 0;
  min-height: 44px;
  min-width: 0;
  flex: 1;
}

.ex-path-item {
  border: 0;
  background: none;
  color: var(--teal);
  font-weight: 700;
  min-height: 32px;
  padding: 0 8px;
  border-radius: 8px;
}

.ex-path-item:first-child {
  font-weight: 800;
  color: var(--teal-deep);
}

@media (hover: hover) and (pointer: fine) {
  .ex-path-item:hover {
    background: var(--teal-soft);
  }
}

.ex-path-item:active {
  background: var(--teal-soft);
}

.ex-path-sep {
  color: var(--muted);
  padding: 0 2px;
}

.explorer-drop {
  flex: 1;
  min-height: 0;
  padding: 0;
}

.explorer-hint {
  margin: 0 0 12px;
  padding: 12px 14px;
  border: 2px dashed var(--line-strong);
  border-radius: 12px;
  color: var(--ink-soft);
  font-size: 0.9rem;
  background: color-mix(in srgb, var(--teal-soft) 50%, white);
}

.explorer-drop.is-over {
  outline: 2px dashed var(--teal);
  background: var(--teal-soft);
}

.explorer-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.explorer-headrow,
.explorer-item {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) 90px 90px 110px minmax(128px, 0.7fr) 120px;
  align-items: center;
  gap: 8px;
  text-align: left;
  width: 100%;
  position: relative;
}

.explorer-headrow {
  padding: 10px 16px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: color-mix(in srgb, var(--paper) 70%, white);
  border-bottom: 1px solid var(--line);
}

.explorer-headrow span:nth-child(5),
.explorer-item-when {
  text-align: right;
}

.explorer-item {
  background: #fff;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 8px 16px;
  min-height: 56px;
  color: inherit;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: background 120ms ease;
  content-visibility: auto;
  contain-intrinsic-size: auto 56px;
  contain: layout style;
}

@media (hover: hover) and (pointer: fine) {
  .explorer-item:hover {
    background: color-mix(in srgb, var(--teal-soft) 45%, white);
  }
}

.explorer-item:active {
  background: color-mix(in srgb, var(--teal-soft) 55%, white);
}

.explorer-item.is-on {
  border-color: var(--line);
  background: var(--teal-soft);
  box-shadow: none;
}

.explorer-item.is-on:active {
  background: color-mix(in srgb, var(--teal-soft) 80%, var(--teal));
}

.explorer-item-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-height: 40px;
  justify-self: end;
}

.explorer-row-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--teal-deep);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background 100ms ease, border-color 100ms ease, transform 80ms ease;
}

.explorer-row-btn.is-ico {
  width: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 9px;
}

@media (hover: hover) and (pointer: fine) {
  .explorer-row-btn:hover {
    background: var(--paper);
    border-color: var(--teal);
  }
}

.explorer-row-btn:active {
  background: var(--teal-soft);
  border-color: var(--teal);
  transform: scale(0.96);
}

/* Nút tải về: loading → done */
.explorer-row-btn.is-downloading,
#detail-download.is-downloading {
  background: var(--teal-soft);
  border-color: var(--teal);
  color: var(--teal-deep);
  pointer-events: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 22%, transparent);
}

.explorer-row-btn.is-downloading .dl-spin,
#detail-download.is-downloading .dl-spin {
  animation: dl-spin 0.7s linear infinite;
}

.explorer-row-btn.is-dl-done,
#detail-download.is-dl-done {
  background: color-mix(in srgb, #1a7f4b 14%, #fff);
  border-color: #1a7f4b;
  color: #1a7f4b;
  animation: dl-pop 280ms ease;
}

.explorer-row-btn.is-dl-error,
#detail-download.is-dl-error {
  background: color-mix(in srgb, #b42318 10%, #fff);
  border-color: #b42318;
  color: #b42318;
}

@keyframes dl-spin {
  to { transform: rotate(360deg); }
}

@keyframes dl-pop {
  0% { transform: scale(0.88); }
  60% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .explorer-row-btn.is-downloading .dl-spin,
  #detail-download.is-downloading .dl-spin {
    animation: none;
  }
  .explorer-row-btn.is-dl-done,
  #detail-download.is-dl-done {
    animation: none;
  }
}


.ex-folder-ico {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
}

.detail-body {
  display: grid;
  gap: 10px;
  padding: 4px 0 16px;
}

.detail-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 12px;
  align-items: baseline;
  font-size: 0.92rem;
}

.detail-row span {
  color: var(--muted);
  font-weight: 600;
}

.detail-row b {
  font-weight: 700;
  color: var(--ink);
  word-break: break-word;
}

.explorer-item-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.explorer-item-name {
  font-weight: 600;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.explorer-item-meta {
  color: var(--muted);
  font-size: 0.75rem;
}

.explorer-empty {
  grid-column: 1 / -1;
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
}

.explorer-loading {
  display: flex;
  flex-direction: column;
  min-height: 120px;
  padding: 0 0 16px;
}

.explorer-loading-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 8px 0 0;
  padding: 14px;
  color: var(--muted);
  font-size: 0.92rem;
}

.explorer-spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid var(--teal-soft);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

.explorer-skel-row {
  pointer-events: none;
}

.explorer-skel-icon,
.explorer-skel-bar {
  display: block;
  background: linear-gradient(90deg, var(--paper-deep) 25%, #fff 50%, var(--paper-deep) 75%);
  background-size: 200% 100%;
  animation: skel 1.2s ease-in-out infinite;
}

.explorer-skel-icon {
  width: 22px;
  height: 18px;
  border-radius: 4px;
  flex-shrink: 0;
}

.explorer-skel-bar {
  height: 10px;
  border-radius: 99px;
  max-width: 220px;
}

.explorer-skel-meta {
  width: 72%;
  max-width: none;
  justify-self: start;
}

.explorer-skel-meta.explorer-item-when {
  justify-self: end;
  width: 80%;
}

@media (prefers-reduced-motion: reduce) {
  .explorer-spinner { animation: none; border-top-color: var(--teal); }
  .explorer-skel-icon, .explorer-skel-bar { animation: none; }
}

.explorer-preview {
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.explorer-preview-bar {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.explorer-preview iframe {
  flex: 1;
  border: 0;
  min-height: 420px;
  background: #fff;
}

@media (max-width: 900px) {
  .explorer {
    grid-template-columns: 1fr;
  }
  .explorer-headrow,
  .explorer-item {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .explorer-headrow span:nth-child(n+2):not(:last-child),
  .explorer-item .explorer-item-meta {
    display: none;
  }
  .explorer-item-actions {
    justify-self: end;
    flex-shrink: 0;
    gap: 6px;
  }
  .explorer-item-actions .explorer-row-btn:not(.is-ico) {
    display: none;
  }
  .explorer-row-btn.is-ico {
    width: 40px;
    min-width: 40px;
    min-height: 40px;
  }
  .upload-row {
    grid-template-columns: 1fr;
  }
  .quota {
    width: 100%;
    margin-left: 0;
  }
}

.upload-dialog {
  width: min(520px, calc(100% - 32px));
  border: 0;
  border-radius: 20px;
  padding: 28px;
  background: #fcf9f0;
  color: var(--ink);
  box-shadow: 0 16px 40px rgba(0, 52, 46, 0.28);
  overflow: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.upload-dialog::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.upload-dialog::backdrop {
  background: rgba(10, 63, 59, 0.52);
}

.upload-dialog-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}

.upload-dialog h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #1c1b1b;
}

.upload-dialog-head p {
  margin: 0;
  font-size: 0.875rem;
  color: #484747;
}

.upload-dialog form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.upload-dialog .field {
  margin: 0;
  gap: 6px;
}

.upload-dialog label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.875rem;
  font-weight: 700;
  color: #1c1b1b;
  margin: 0;
}

.upload-dialog input,
.upload-dialog select {
  width: 100%;
  min-height: 44px;
  font-size: 0.95rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 10px 14px;
  color: var(--ink);
  box-shadow: none;
}

.upload-dialog input:focus,
.upload-dialog select:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: var(--focus);
}

.upload-dialog select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%230f5c56' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  appearance: none;
  padding-right: 40px;
}

.conflict-choices {
  display: grid;
  gap: 10px;
  margin: 4px 0 12px;
}

.conflict-choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  margin: 0;
  padding: 14px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
  transition: border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.conflict-choice:hover,
.conflict-choice:focus-visible {
  border-color: var(--teal);
  background: color-mix(in srgb, var(--teal-soft) 50%, white);
  box-shadow: 0 0 0 1px var(--teal);
  outline: none;
}

.conflict-choice strong {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
}

.conflict-choice span {
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--muted);
}

.upload-scope {
  margin: 0 0 4px;
  padding: 0;
  border: 0;
  min-width: 0;
}

.upload-scope legend {
  padding: 0;
  margin: 0 0 8px;
  font-size: 0.875rem;
  font-weight: 700;
  color: #1c1b1b;
}

.upload-scope-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 520px) {
  .upload-scope-grid {
    grid-template-columns: 1fr;
  }
}

.upload-scope-card {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 0;
  padding: 12px 12px 12px 10px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.upload-scope-card:has(input:checked) {
  border-color: var(--teal);
  background: color-mix(in srgb, var(--teal-soft) 55%, white);
  box-shadow: 0 0 0 1px var(--teal);
}

.upload-scope-card input {
  margin-top: 3px;
  flex-shrink: 0;
  accent-color: var(--teal);
}

.upload-scope-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.upload-scope-body strong {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink);
}

.upload-scope-body em {
  font-style: normal;
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--muted);
}

#upload-classified-fields[hidden] {
  display: none !important;
}

.doc-kind-pill {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  vertical-align: middle;
  white-space: nowrap;
  background: var(--teal-soft);
  color: var(--teal-deep);
}

.doc-kind-pill[data-kind="de-thi"] {
  background: #fde8ee;
  color: var(--exam);
}

.doc-kind-pill[data-kind="luyen-tap"] {
  background: #e8e4fb;
  color: var(--quiz);
}

.doc-kind-pill[data-kind="giao-an"] {
  background: var(--gold-soft);
  color: var(--gold);
}

.upload-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.upload-pick {
  width: 100%;
  margin: 8px 0 0;
  padding: 24px 16px;
  min-height: 120px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 16px;
  background: #fff;
  color: inherit;
  text-align: center;
}

.upload-pick:hover {
  background: var(--teal-soft);
  border-color: var(--teal);
}

.upload-pick strong {
  display: block;
  margin-bottom: 4px;
  font-size: 1rem;
  font-weight: 700;
  color: #1c1b1b;
}

.upload-pick span,
.upload-pick em {
  display: block;
  color: #484747;
  font-size: 0.875rem;
  font-style: normal;
  max-width: 100%;
}

.upload-pick em:not(:empty) {
  margin-top: 8px;
  color: var(--teal-deep);
  font-weight: 700;
  /* Tên file dài: cắt giữa, giữ đuôi mở rộng */
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 4px;
  box-sizing: border-box;
}

.upload-progress {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.upload-progress[hidden] {
  display: none;
}

.upload-progress-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 0.88rem;
}

.upload-progress-top span {
  color: var(--ink-soft);
  font-weight: 600;
}

.upload-progress-top b {
  font-variant-numeric: tabular-nums;
  color: #a95200;
}

.upload-progress-track {
  height: 10px;
  border-radius: 99px;
  background: #efe8dc;
  overflow: hidden;
}

.upload-progress-track i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: #d97736;
  transition: width 160ms ease;
}

.upload-progress-meta {
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* —— Upload busy: nút + progress có hiệu ứng —— */
.upload-submit.is-uploading {
  position: relative;
  overflow: hidden;
  pointer-events: none;
  gap: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(120deg, #c4682e 0%, #d97736 40%, #e8a05a 70%, #d97736 100%);
  background-size: 200% 100%;
  animation: upload-btn-shine 1.6s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(217, 119, 54, 0.45);
}
.upload-submit.is-uploading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 30%,
    rgba(255, 255, 255, 0.28) 48%,
    transparent 66%
  );
  transform: translateX(-120%);
  animation: upload-btn-sweep 1.4s ease-in-out infinite;
}
.upload-submit.is-uploading .btn-spinner {
  width: 18px;
  height: 18px;
  border-width: 2.5px;
  border-color: rgba(255, 255, 255, 0.28);
  border-top-color: #fff;
  border-right-color: rgba(255, 255, 255, 0.65);
  flex-shrink: 0;
  animation: spin 0.55s linear infinite;
  position: relative;
  z-index: 1;
}
.upload-submit.is-uploading .upload-busy-text {
  position: relative;
  z-index: 1;
  letter-spacing: 0.01em;
}

@keyframes upload-btn-shine {
  0%, 100% {
    background-position: 0% 50%;
    box-shadow: 0 0 0 0 rgba(217, 119, 54, 0.35);
  }
  50% {
    background-position: 100% 50%;
    box-shadow: 0 6px 18px rgba(217, 119, 54, 0.35);
  }
}
@keyframes upload-btn-sweep {
  0% { transform: translateX(-120%); }
  60%, 100% { transform: translateX(120%); }
}

.upload-progress.is-on {
  border-color: color-mix(in srgb, #d97736 35%, var(--line));
  background: linear-gradient(180deg, #fffdf8 0%, #fff 100%);
  box-shadow: 0 4px 14px rgba(180, 83, 9, 0.08);
}
.upload-progress-track {
  position: relative;
}
.upload-progress-track i {
  background: linear-gradient(90deg, #c4682e, #e8a05a, #d97736);
  background-size: 200% 100%;
  animation: upload-bar-flow 1.2s linear infinite;
  position: relative;
}
.upload-progress-track i::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.45),
    transparent
  );
  animation: upload-bar-sheen 1.1s ease-in-out infinite;
}
@keyframes upload-bar-flow {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}
@keyframes upload-bar-sheen {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.upload-progress-top b {
  transition: color 160ms ease;
}
.upload-progress.is-on .upload-progress-top span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.upload-progress.is-on .upload-progress-top span::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d97736;
  box-shadow: 0 0 0 0 rgba(217, 119, 54, 0.5);
  animation: upload-dot-pulse 1.2s ease-out infinite;
}
@keyframes upload-dot-pulse {
  0% { box-shadow: 0 0 0 0 rgba(217, 119, 54, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(217, 119, 54, 0); }
  100% { box-shadow: 0 0 0 0 rgba(217, 119, 54, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .upload-submit.is-uploading,
  .upload-submit.is-uploading::after,
  .upload-submit.is-uploading .btn-spinner,
  .upload-progress-track i,
  .upload-progress-track i::after,
  .upload-progress.is-on .upload-progress-top span::before {
    animation: none !important;
  }
}


.upload-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 8px;
}

.upload-cancel,
.upload-submit {
  min-height: 44px;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
}

.upload-cancel {
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--teal-deep);
}

.upload-cancel:hover {
  background: var(--paper-deep);
}

.upload-submit {
  border: 0;
  background: #c2410c;
  color: #fff;
  box-shadow: 0 4px 14px rgba(194, 65, 12, 0.28);
}

.upload-submit:hover {
  background: #8c4400;
}

.upload-submit:disabled {
  opacity: 0.72;
  cursor: wait;
}

.upload-submit.upload-danger {
  background: var(--danger);
}

.upload-submit.upload-danger:hover {
  background: #8f1515;
}

.pass-warn {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px solid #f3e0c8;
  border-radius: 12px;
  background: #fff8ee;
}

.pass-warn strong {
  display: block;
  color: #9c4300;
}

.pass-warn p {
  margin: 4px 0 0;
  color: #5c6b73;
  font-size: 0.9rem;
}

.pass-warn-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.change-pass-wrap {
  min-height: calc(100dvh - var(--header) - 32px);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
  padding: 24px 16px 40px;
}

.change-pass-card {
  width: min(600px, 100%);
  max-height: none;
  margin: 0;
  overflow: hidden;
}

.change-pass-card .alert:not(.is-on) {
  display: none;
}

.change-pass-note {
  margin: 0;
  max-width: 600px;
  text-align: center;
  font-size: 0.88rem;
  color: var(--muted);
}

.ex-menu {
  position: fixed;
  z-index: 90;
  min-width: 176px;
  max-width: min(280px, calc(100vw - 20px - var(--safe-left) - var(--safe-right)));
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  -webkit-user-select: none;
  user-select: none;
}

.ex-menu button {
  width: 100%;
  text-align: left;
  border: 0;
  background: none;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 8px;
  color: inherit;
  font-size: 0.95rem;
  font-weight: 600;
}

.ex-menu button:hover {
  background: var(--teal-soft);
}

.ex-menu button[data-menu="delete"]:hover {
  background: #fde8ee;
  color: var(--danger);
}

.admin-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.admin-board {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 18px;
}

.admin-pane {
  padding: 18px;
  min-height: 320px;
}

.admin-mons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-mon {
  display: grid;
  grid-template-columns: 6px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: inherit;
  min-height: 56px;
}

.admin-mon:hover {
  border-color: var(--teal-mid);
  background: var(--teal-soft);
}

.admin-mon-bar {
  width: 6px;
  align-self: stretch;
  border-radius: 99px;
}

.admin-mon-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.admin-mon-body strong {
  font-size: 0.98rem;
}

.admin-mon-body span {
  color: var(--muted);
  font-size: 0.82rem;
}

.admin-mon-go {
  color: var(--teal);
  font-weight: 600;
  font-size: 0.88rem;
}

.admin-files {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.admin-file-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
  color: inherit;
}

.admin-file-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

@media (max-width: 900px) {
  .admin-board {
    grid-template-columns: 1fr;
  }
}

@media print {
  .site-header, .footer, .btn, .filter-bar, .toolbar, .explorer-toolbar { display: none !important; }
  body, main { background: #fff; width: auto; }
  .doc-preview { border: 0; }
}


/* Xem nhanh trong kho */
.preview-dialog {
  width: min(960px, 96vw);
  max-height: min(92vh, 900px);
  padding: 0;
  overflow: hidden;
  flex-direction: column;
  border: none;
  border-radius: 16px;
}
.preview-dialog[open] {
  display: flex;
}
.preview-dialog:not([open]) {
  display: none;
}
.preview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 8px;
}
.preview-close {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 10px;
  background: var(--paper, #f4f6f6);
  font-size: 1.4rem;
  line-height: 1;
  color: #333;
  cursor: pointer;
}
.preview-stage {
  flex: 1;
  min-height: 50vh;
  max-height: min(70vh, 640px);
  overflow: auto;
  background: #0f1416;
  margin: 0 12px;
  border-radius: 12px;
  display: grid;
  place-items: center;
}
.preview-loading,
.preview-fallback {
  color: #e8eeee;
  text-align: center;
  padding: 24px;
  max-width: 28rem;
}
.preview-fallback .meta {
  color: #b7c4c4;
}
.preview-img {
  max-width: 100%;
  max-height: min(68vh, 620px);
  object-fit: contain;
}
.preview-frame {
  width: 100%;
  height: min(68vh, 620px);
  border: 0;
  background: #fff;
}
.preview-docx {
  width: 100%;
  height: min(68vh, 620px);
  overflow: auto;
  background: #fff;
  color: #1c1b1b;
  padding: 20px 22px;
  text-align: left;
  line-height: 1.55;
  font-size: 0.95rem;
}
.preview-docx img {
  max-width: 100%;
}
.preview-actions {
  padding: 12px 16px 16px;
}

/* File mới */
.new-files {
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px solid var(--line, #d5dddd);
  border-radius: 14px;
  background: color-mix(in srgb, var(--teal, #0f6b5c) 6%, #fff);
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}
.new-files-head h2 {
  margin: 0 0 4px;
  font-size: 1.05rem;
}
.new-files-head .meta {
  margin: 0;
}
.new-files-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
  max-width: 100%;
}
.new-files-list li {
  display: flex;
  gap: 10px;
  align-items: baseline;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--line, #e2e8e8);
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}
.new-files-name {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  font-weight: 600;
  font-size: 0.88rem;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.new-files-when {
  flex: 0 0 auto;
  font-size: 0.75rem;
  color: #5c6b73;
  white-space: nowrap;
}
@media (max-width: 640px) {
  .preview-stage {
    min-height: 42vh;
    margin: 0 8px;
  }
  .new-files {
    padding: 12px;
  }
  .new-files-list li {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }
  .new-files-name {
    width: 100%;
    display: block;
  }
  .new-files-when {
    align-self: flex-start;
  }
}
