﻿:root {
  --bg: #FFFFFF;
  --bg-soft: #F5FAFF;
  --surface: #FFFFFF;
  --text: #1F2937;
  --text-heading: #111827;
  --text-muted: #6B7280;
  --line: #E5E7EB;
  --line-strong: #E5E7EB;
  --primary: #165DFF;
  --primary-strong: #165DFF;
  --success: #00B42A;
  --success-soft: rgba(0, 180, 42, 0.12);
  --warning: #FF7D00;
  --warning-soft: rgba(255, 125, 0, 0.12);
  --danger: #F53F3F;
  --danger-soft: rgba(245, 63, 63, 0.12);
  --shadow: none;
  --radius: 6px;
  --app-topbar-height: 72px;
  --app-sidebar-width: 248px;
  --anno-draft-color: #FF9500;
  --anno-draft-fill: rgba(255, 149, 0, 0.16);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  min-height: 100%;
}

body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
}

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

a:hover {
  text-decoration: underline;
}

.hidden {
  display: none !important;
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.site-brand__mark {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: #165DFF;
  box-shadow: 0 8px 18px rgba(22, 93, 255, 0.24);
  object-fit: cover;
}

.app-topbar .site-brand {
  gap: 0;
}

.app-topbar .site-brand > span:not(.site-brand__mark) {
  display: none;
}

.app-topbar .site-brand img.site-brand__mark {
  width: auto;
  height: 44px;
  max-width: min(260px, 30vw);
  border-radius: 10px;
  background: transparent;
  box-shadow: none;
}

.app-topbar .site-brand span.site-brand__mark {
  width: 44px;
  height: 44px;
}

.u-btn {
  height: 36px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background-color 0.16s ease, color 0.16s ease;
}

.u-btn.has-button-icon::before {
  content: "";
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  background-color: currentColor;
  -webkit-mask: var(--button-icon) center / contain no-repeat;
  mask: var(--button-icon) center / contain no-repeat;
}

.u-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.u-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

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

.u-btn--light {
  color: var(--primary);
  background: #FFFFFF;
  border-color: var(--primary);
}

.u-btn--danger {
  color: var(--primary);
  background: #FFFFFF;
  border-color: var(--primary);
}

.u-btn--primary:hover:not(:disabled) {
  background: #0F4FE0;
  border-color: #0F4FE0;
}

.u-btn--light:hover:not(:disabled),
.u-btn--danger:hover:not(:disabled) {
  background: #F5FAFF;
  border-color: var(--primary);
}

.u-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.u-alert {
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 14px;
  margin-bottom: 12px;
}

.u-alert--error {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(245, 63, 63, 0.28);
}

.u-alert--success {
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid rgba(0, 180, 42, 0.28);
}

.u-form {
  display: grid;
  gap: 12px;
}

.u-field {
  display: grid;
  gap: 6px;
}

.u-field label {
  font-size: 13px;
  color: var(--text-muted);
}

.u-input {
  width: 100%;
  height: 40px;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--text);
  font-size: 14px;
  padding: 0 12px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.u-input:focus {
  border-color: #E8F3FF;
  box-shadow: 0 0 0 3px rgba(22, 93, 255, 0.18);
}

.u-input[disabled] {
  background: #F9FAFB;
  color: #6B7280;
}

.u-hint {
  color: var(--text-muted);
  font-size: 12px;
}

/* Auth Pages */
.auth-layout {
  min-height: calc(100vh - 48px);
  width: min(1120px, 100%);
  margin: 24px auto;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(360px, 480px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 28px 60px rgba(17, 24, 39, 0.16);
}

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-layout--compact {
  min-height: clamp(520px, 72vh, 680px);
  width: min(960px, 100%);
  margin: 0 auto;
  grid-template-columns: minmax(0, 1.08fr) minmax(330px, 410px);
  border-radius: 20px;
}

.auth-layout--compact > .auth-panel {
  padding: 24px 22px;
}

.auth-side {
  position: relative;
  overflow: hidden;
  background: #ffffff;
}

.auth-carousel {
  position: absolute;
  inset: 0;
}

.auth-carousel__dots {
  position: absolute;
  right: 0;
  bottom: 18px;
  left: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.auth-carousel__dot {
  width: 7px;
  height: 7px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  transition: width 0.2s ease, border-radius 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.auth-carousel__dot:hover,
.auth-carousel__dot:focus-visible {
  background: #ffffff;
  transform: scale(1.15);
  outline: none;
}

.auth-carousel__dot.active {
  width: 22px;
  border-radius: 999px;
  background: #ffffff;
}

.auth-carousel__item {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.auth-carousel__item.active {
  opacity: 1;
}

.auth-carousel__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.auth-carousel__overlay {
  display: none !important;
}

.auth-panel {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
}

.auth-layout > .auth-panel {
  border-left: 1px solid rgba(232, 243, 255, 0.6);
  background: #F5FAFF;
  padding: 30px 28px;
}

.auth-panel__card {
  width: 100%;
  max-width: 380px;
  padding: 24px;
}

.auth-layout .auth-panel__card {
  max-width: 390px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  padding: 4px;
}

.auth-layout--compact .auth-panel .site-brand {
  width: 100%;
  justify-content: center;
  gap: 0;
}

.auth-layout--compact .auth-panel img.site-brand__mark {
  width: auto;
  height: 48px;
  max-width: min(220px, 72%);
  border-radius: 12px;
  background: transparent;
  box-shadow: none;
}

.auth-layout--compact .auth-panel span.site-brand__mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
}

.auth-title {
  font-size: 24px;
  margin-bottom: 8px;
}

.auth-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 16px;
}

.auth-links {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  font-size: 13px;
}

.auth-links--split {
  width: 100%;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 16px;
}

.auth-links--split a:last-child {
  margin-left: auto;
  text-align: right;
}

/* App Pages */
.app-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  min-height: 64px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: #FFFFFF;
  backdrop-filter: none;
}

.app-topbar__brand-group {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
  flex: 0 1 auto;
}

.app-topbar__right {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.storage-chip {
  min-width: 220px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  padding: 8px 10px;
  box-shadow: none;
}

.storage-chip small {
  display: block;
  margin-bottom: 6px;
  color: var(--text-muted);
  font-size: 12px;
}

.storage-track {
  height: 7px;
  border-radius: 999px;
  background: #E5E7EB;
  overflow: hidden;
}

.storage-fill {
  width: 0;
  height: 100%;
  position: relative;
  overflow: hidden;
  background: #165DFF;
  transition: width 0.25s ease, background 0.25s ease;
}

.storage-fill::after {
  content: "";
  position: absolute;
  top: -70%;
  bottom: -70%;
  left: -36%;
  width: 36%;
  pointer-events: none;
  background: linear-gradient(
    105deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.56) 48%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: translateX(-220%) skewX(-18deg);
  animation: upload-progress-shine 0.85s linear infinite;
}

.storage-fill--safe {
  background: #00B42A;
}

.storage-fill--warn {
  background: #FF7D00;
}

.storage-fill--danger {
  background: #F53F3F;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  padding: 6px 10px;
  cursor: pointer;
  text-decoration: none;
}

.user-chip:hover {
  text-decoration: none;
  background: var(--bg-soft);
}

.user-chip--btn {
  border: 1px solid var(--line);
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  object-fit: cover;
  background: #165DFF;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
}

.user-menu {
  position: relative;
}

.user-menu-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 140px;
  border-radius: 10px;
  padding: 6px;
  z-index: 30;
}

.user-menu-pop a {
  display: block;
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
}

.user-menu-pop a:hover {
  background: #E8F3FF;
}

.app-wrap {
  position: relative;
  min-height: 100vh;
  padding-top: calc(var(--app-topbar-height) + 8px);
}

.app-topbar + .app-wrap {
  padding-top: calc(var(--app-topbar-height) + 8px);
}

.app-sidebar {
  position: fixed;
  left: 0;
  bottom: 0;
  width: var(--app-sidebar-width);
  top: calc(var(--app-topbar-height) + 8px);
  max-height: none;
  overflow-y: auto;
  padding: 16px 12px 20px;
  border: none;
  border-right: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
  background: #FFFFFF;
  backdrop-filter: none;
}

.app-topbar + .app-wrap .app-sidebar {
  top: calc(var(--app-topbar-height) + 8px);
}

.app-menu {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  overflow: visible;
}

.app-menu a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  margin-bottom: 0;
}

.app-menu a:hover {
  background: #E8F3FF;
}

.app-menu a.active {
  color: #fff;
  background: #165DFF;
}

.menu-link-icon,
.btn-icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
}

.btn-icon {
  width: 15px;
  height: 15px;
}

.icon-upload {
  -webkit-mask-image: url("../../svg/Upload.svg");
  mask-image: url("../../svg/Upload.svg");
}

.icon-refresh {
  -webkit-mask-image: url("../../svg/Refresh.svg");
  mask-image: url("../../svg/Refresh.svg");
}

.icon-console {
  -webkit-mask-image: url("../../svg/Console.svg");
  mask-image: url("../../svg/Console.svg");
}

.icon-resource {
  -webkit-mask-image: url("../../svg/image.svg");
  mask-image: url("../../svg/image.svg");
}

.icon-share {
  -webkit-mask-image: url("../../svg/Share.svg");
  mask-image: url("../../svg/Share.svg");
}

.icon-message {
  -webkit-mask-image: url("../../svg/Label.svg");
  mask-image: url("../../svg/Label.svg");
}

.icon-return {
  -webkit-mask-image: url("../../svg/Return.svg");
  mask-image: url("../../svg/Return.svg");
}

.icon-enlarge {
  -webkit-mask-image: url("../../svg/Enlarge.svg");
  mask-image: url("../../svg/Enlarge.svg");
}

.icon-reduce {
  -webkit-mask-image: url("../../svg/Reduce.svg");
  mask-image: url("../../svg/Reduce.svg");
}

.icon-reset {
  -webkit-mask-image: url("../../svg/Reset.svg");
  mask-image: url("../../svg/Reset.svg");
}

.icon-full {
  -webkit-mask-image: url("../../svg/Full.svg");
  mask-image: url("../../svg/Full.svg");
}

.icon-rotate {
  -webkit-mask-image: url("../../svg/Reset.svg");
  mask-image: url("../../svg/Reset.svg");
  transform: rotate(90deg);
}

.icon-label {
  -webkit-mask-image: url("../../svg/Label.svg");
  mask-image: url("../../svg/Label.svg");
}

.icon-flip {
  -webkit-mask-image: url("../../svg/Reset.svg");
  mask-image: url("../../svg/Reset.svg");
}

.icon-image-adjust {
  -webkit-mask-image: url("../../svg/Image-Adjustment.svg");
  mask-image: url("../../svg/Image-Adjustment.svg");
}

.icon-magnifier {
  -webkit-mask-image: url("../../svg/Magnifying glass.svg");
  mask-image: url("../../svg/Magnifying glass.svg");
}

.icon-grid {
  -webkit-mask-image: url("../../svg/Grid.svg");
  mask-image: url("../../svg/Grid.svg");
}

.icon-coordinate {
  -webkit-mask-image: url("../../svg/Coordinate.svg");
  mask-image: url("../../svg/Coordinate.svg");
}

.icon-export-image {
  -webkit-mask-image: url("../../svg/Export-Image.svg");
  mask-image: url("../../svg/Export-Image.svg");
}

.icon-line-segment {
  -webkit-mask-image: url("../../svg/Line-segment.svg");
  mask-image: url("../../svg/Line-segment.svg");
}

.icon-polygon {
  -webkit-mask-image: url("../../svg/Polygon.svg");
  mask-image: url("../../svg/Polygon.svg");
}

.icon-paintbrush {
  -webkit-mask-image: url("../../svg/Paintbrush.svg");
  mask-image: url("../../svg/Paintbrush.svg");
}

.icon-export-mark {
  -webkit-mask-image: url("../../svg/Export-Mark.svg");
  mask-image: url("../../svg/Export-Mark.svg");
}

.icon-qr {
  -webkit-mask-image: url("../../svg/qr.svg");
  mask-image: url("../../svg/qr.svg");
}

.icon-copy {
  -webkit-mask-image: url("../../svg/copy.svg");
  mask-image: url("../../svg/copy.svg");
}

.icon-download {
  -webkit-mask-image: url("../../svg/download.svg");
  mask-image: url("../../svg/download.svg");
}

.icon-search {
  -webkit-mask-image: url("../../svg/Search.svg");
  mask-image: url("../../svg/Search.svg");
}

.icon-settings {
  -webkit-mask-image: url("../../svg/Settings.svg");
  mask-image: url("../../svg/Settings.svg");
}

.icon-freedom {
  -webkit-mask-image: url("../../svg/Freedom.svg");
  mask-image: url("../../svg/Freedom.svg");
}

.icon-square-shape {
  -webkit-mask-image: url("../../svg/Square.svg");
  mask-image: url("../../svg/Square.svg");
}

.icon-circle-shape {
  -webkit-mask-image: url("../../svg/Circle.svg");
  mask-image: url("../../svg/Circle.svg");
}

.icon-screenshot {
  -webkit-mask-image: url("../../svg/Screenshot.svg");
  mask-image: url("../../svg/Screenshot.svg");
}

.app-main {
  margin-left: var(--app-sidebar-width);
  padding: 20px 24px 24px;
  min-height: calc(100vh - var(--app-topbar-height) - 8px);
  display: grid;
  min-width: 0;
  gap: 18px;
  align-content: start;
}

.app-main .u-card {
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.hero {
  padding: 0 0 10px;
  border-bottom: 1px solid var(--line);
}

.hero h2 {
  font-size: 22px;
  margin-bottom: 8px;
}

.hero p {
  color: var(--text-muted);
  font-size: 14px;
}

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

.hero__actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.stat-card {
  padding: 0;
}

.stat-card small {
  color: var(--text-muted);
}

.stat-card strong {
  display: block;
  margin-top: 6px;
  font-size: 26px;
  color: #165DFF;
}

.panel {
  padding: 0;
}

.panel__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

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

.resource-toolbar__search {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) minmax(140px, 0.6fr);
  gap: 10px;
  flex: 1 1 480px;
}

.category-strip {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.category-card {
  flex: 0 0 auto;
  min-height: 28px;
  min-width: 0;
  border-radius: 7px;
  border: 1px solid #E4E7EC;
  background: #FFFFFF;
  color: #667085;
  padding: 0 9px;
  text-align: center;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 1px 3px rgba(22, 93, 255, 0.04);
  transition: transform 0.16s ease, border-color 0.16s ease, background-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.category-card__icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.category-card:hover {
  transform: translateY(-1px);
  background: #F5FAFF;
  border-color: rgba(22, 93, 255, 0.28);
  box-shadow: 0 6px 14px rgba(22, 93, 255, 0.08);
}

.category-card:active {
  transform: translateY(1px);
}

.category-card.active {
  border-color: #165DFF;
  background: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 8px 18px rgba(22, 93, 255, 0.18);
}

.category-card.active .category-card__icon {
  filter: brightness(0) invert(1);
}

.category-card.active:hover {
  background: #0F4FE0;
  border-color: #0F4FE0;
}

.category-card__name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.category-card__count {
  font-size: 12px;
  color: #98A2B3;
}

.category-card.active .category-card__count {
  color: #FFFFFF;
}

.tabs {
  display: inline-flex;
  gap: 6px;
  background: #E8F3FF;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 4px;
}

.tab-btn {
  border: none;
  background: transparent;
  border-radius: 7px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 13px;
}

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

.chart-box {
  height: 300px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #F5FAFF;
  padding: 8px;
}

.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 10px;
  min-width: 0;
}

.resource-item {
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  /* Keep the white card body inside the card's rounded lower corners. */
  overflow: hidden;
  min-width: 0;
  background: #fff;
  box-shadow: 0 2px 8px rgba(16, 24, 40, 0.04);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.resource-item:hover {
  transform: translateY(-2px);
  border-color: #D9E6FF;
  box-shadow: 0 10px 24px rgba(22, 93, 255, 0.12);
}

.resource-item.is-selected {
  border-color: rgba(22, 93, 255, 0.62);
  box-shadow: 0 0 0 2px rgba(22, 93, 255, 0.16);
}

.resource-item.is-pending {
  opacity: 0.78;
  filter: grayscale(0.12);
}

.resource-thumb {
  position: relative;
  height: 182px;
  display: grid;
  place-items: center;
  color: #165DFF;
  background: linear-gradient(180deg, #FBFCFE 0%, #F6F9FF 100%);
  border-bottom: 1px solid #EEF2F7;
  z-index: 0;
  overflow: hidden;
  border-radius: 9px 9px 0 0;
}

.resource-select-corner {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 4px;
  border: 0;
  color: #165DFF;
  background: transparent;
  cursor: pointer;
  user-select: none;
}

.resource-select-corner input {
  width: 16px;
  height: 16px;
  margin: 0;
  border-radius: 4px;
  background: transparent;
  accent-color: #165DFF;
  cursor: pointer;
}

.resource-time-overlay {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 2;
  height: 22px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: #FFFFFF;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}

.resource-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center center;
  background: transparent;
}

.resource-thumb .resource-cover {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: cover;
  object-position: center center;
  -webkit-mask-image: none;
  mask-image: none;
}

.resource-cover--pending {
  opacity: 0;
  transition: opacity 0.2s ease;
}

.resource-cover--pending.is-loaded {
  opacity: 1;
}

.resource-cover-loading {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: rgba(248, 251, 255, 0.52);
}

.resource-cover-loading img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  filter: brightness(0) saturate(100%) invert(32%) sepia(93%) saturate(3353%) hue-rotate(214deg) brightness(99%) contrast(104%);
  animation: resource-cover-spin 0.9s linear infinite;
}

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

@supports not ((-webkit-mask-image: linear-gradient(#000, #000)) or (mask-image: linear-gradient(#000, #000))) {
  .resource-thumb .resource-cover {
    box-shadow: 0 0 10px rgba(245, 245, 245, 0.88);
  }
}

.resource-thumb__fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.resource-body {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
  padding: 14px 14px 12px;
  background: #fff;
  min-height: 214px;
  min-width: 0;
}

.resource-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.resource-name {
  display: block;
  min-width: 0;
  font-weight: 700;
  position: relative;
  margin: 0;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.resource-name-edit {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #165DFF;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease, color 0.2s ease;
}

.resource-name-edit:hover:not(:disabled) {
  background: transparent;
  color: #0E42D2;
  transform: none;
}

.resource-rename-icon {
  width: 15px;
  height: 15px;
  display: block;
  object-fit: contain;
}

.resource-status {
  position: absolute;
  top: 8px;
  right: 8px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid #D8E5FF;
  color: #165DFF;
  background: rgba(232, 243, 255, 0.96);
}

.resource-status--ok {
  border-color: #D0F0E0;
  color: #039855;
  background: #E6F7EF;
}

.resource-status--processing {
  border-color: #D8E5FF;
  color: #165DFF;
  background: rgba(232, 243, 255, 0.96);
}

.resource-status--danger {
  border-color: #FEC7C4;
  color: #D92D20;
  background: #FEE4E2;
}

.resource-meta {
  margin-top: 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.6;
  display: grid;
  gap: 8px;
  padding-top: 2px;
}

.resource-meta-tags {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.resource-meta-tag {
  display: flex;
  align-items: center;
  min-height: 24px;
  min-width: 0;
  padding: 3px 8px;
  border-radius: 8px;
  background: #EEF4FF;
  color: #165DFF;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.resource-meta-tag--format {
  grid-column: auto;
  justify-self: stretch;
}

.resource-meta-tag--format-xin {
  border: 1px solid #F5D08A;
  background: #FFF6DD;
  color: #B7791F;
}

.resource-meta-tag--format-slide {
  border: 1px solid #C9DCFF;
  background: #EEF4FF;
  color: #165DFF;
}

.resource-meta-tag--format-image {
  border: 1px solid #B7E4C7;
  background: #ECFDF3;
  color: #039855;
}

.resource-meta-tag--format-zip {
  border: 1px solid #D8B4FE;
  background: #F3E8FF;
  color: #7C3AED;
}

.resource-meta-tag--format-default {
  border: 1px solid #C9DCFF;
  background: #EEF4FF;
  color: #165DFF;
}

.resource-progress-text {
  color: #667085;
  font-size: 12px;
  line-height: 1.5;
}

.resource-actions {
  margin-top: 2px;
  padding-top: 12px;
  border-top: 1px solid #EEF2F7;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.resource-actions .u-btn {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  transform: none !important;
  padding: 0;
  width: 100%;
  min-width: 0;
  color: #165DFF !important;
}

.resource-action-btn {
  width: 34px !important;
  min-width: 34px !important;
  height: 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
  max-width: 100%;
  background: transparent !important;
  color: #64748B !important;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.resource-actions .resource-action-btn {
  color: #64748B !important;
}

.resource-action-btn:hover:not(:disabled),
.resource-action-btn:focus-visible {
  background: rgba(22, 93, 255, 0.1) !important;
  color: #165DFF !important;
  box-shadow: 0 0 0 1px rgba(22, 93, 255, 0.08) inset;
  transform: translateY(-1px);
}

.resource-actions .resource-action-btn:hover:not(:disabled),
.resource-actions .resource-action-btn:focus-visible {
  color: #165DFF !important;
  transform: translateY(-1px) !important;
}

.resource-action-btn:disabled {
  opacity: 0.42;
}

.resource-action-icon {
  width: 16px;
  height: 16px;
  display: inline-block;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
}

.resource-favorite-icon {
  width: 18px;
  height: 18px;
  display: block;
  transition: transform 0.18s ease;
}

.resource-action-btn.is-favorited {
  background: rgba(212, 160, 23, 0.1) !important;
}

.resource-action-btn.is-favorited:hover:not(:disabled),
.resource-action-btn.is-favorited:focus-visible {
  background: rgba(212, 160, 23, 0.16) !important;
}

.resource-action-btn.is-favorited .resource-favorite-icon {
  transform: scale(1.08);
}

.resource-action-icon--preview {
  -webkit-mask-image: url("../../svg/Preview-card/Preview.svg");
  mask-image: url("../../svg/Preview-card/Preview.svg");
}

.resource-action-icon--details {
  -webkit-mask-image: url("../../svg/Preview-card/Details.svg");
  mask-image: url("../../svg/Preview-card/Details.svg");
}

.resource-action-icon--classification {
  -webkit-mask-image: url("../../svg/Preview-card/Classification.svg");
  mask-image: url("../../svg/Preview-card/Classification.svg");
}

.resource-action-icon--share {
  -webkit-mask-image: url("../../svg/Preview-card/Share.svg");
  mask-image: url("../../svg/Preview-card/Share.svg");
}

.resource-action-icon--delete {
  -webkit-mask-image: url("../../svg/Preview-card/Delete.svg");
  mask-image: url("../../svg/Preview-card/Delete.svg");
}

.resource-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid #E7ECF3;
  border-radius: 12px;
  background: #FFFFFF;
  box-shadow: 0 4px 14px rgba(16, 24, 40, 0.04);
}

.resource-pagination.is-empty {
  border-style: dashed;
  background: #FCFDFE;
}

.resource-pagination__total {
  color: #667085;
  font-size: 13px;
  white-space: nowrap;
}

.resource-pagination__controls,
.resource-pagination__pages,
.resource-pagination__jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.resource-pagination__controls {
  margin-left: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.resource-pagination__nav,
.resource-pagination__page,
.resource-pagination__jump-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid #D9E2F0;
  border-radius: 8px;
  background: #FFFFFF;
  color: #344054;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.resource-pagination__page {
  padding: 0;
}

.resource-pagination__nav:hover:not(:disabled),
.resource-pagination__page:hover,
.resource-pagination__jump-btn:hover {
  border-color: #165DFF;
  color: #165DFF;
  background: #F3F7FF;
}

.resource-pagination__page.is-active {
  border-color: #165DFF;
  background: #165DFF;
  color: #FFFFFF;
  cursor: default;
}

.resource-pagination__page:disabled {
  border-color: #E4E7EC;
  background: #F8FAFC;
  color: #98A2B3;
  cursor: not-allowed;
}

.resource-pagination__nav:disabled,
.resource-pagination__nav.is-disabled {
  color: #98A2B3;
  background: #F8FAFC;
  cursor: not-allowed;
}

.resource-pagination__ellipsis {
  min-width: 20px;
  color: #98A2B3;
  text-align: center;
  user-select: none;
}

.resource-pagination__jump {
  color: #667085;
  font-size: 12px;
  white-space: nowrap;
}

.resource-pagination__input {
  width: 58px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid #D9E2F0;
  border-radius: 8px;
  color: #344054;
  background: #FFFFFF;
  font-size: 12px;
  text-align: center;
  outline: none;
}

.resource-pagination__input:focus {
  border-color: #165DFF;
  box-shadow: 0 0 0 3px rgba(22, 93, 255, 0.12);
}

.resource-pagination__input:disabled {
  border-color: #E4E7EC;
  background: #F8FAFC;
  color: #98A2B3;
  cursor: not-allowed;
  box-shadow: none;
}

.resource-pagination__jump-btn {
  min-width: 48px;
  padding: 0 8px;
  border-color: #165DFF;
  background: #165DFF;
  color: #FFFFFF;
}

.resource-pagination__jump-btn:hover {
  background: #0E42D2;
  color: #FFFFFF;
}

.resource-pagination__jump-btn:disabled {
  border-color: #E4E7EC;
  background: #F8FAFC;
  color: #98A2B3;
  cursor: not-allowed;
}

.resource-retry-row {
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.resource-retry-btn {
  height: 28px;
  border-radius: 8px;
  border: 1px solid #165DFF;
  background: #FFFFFF;
  color: #165DFF;
  font-size: 12px;
  padding: 0 10px;
  white-space: nowrap;
  flex: 0 0 auto;
  cursor: pointer;
}

.empty-box {
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  color: var(--text-muted);
  text-align: center;
  padding: 28px;
}

.badge {
  display: inline-block;
  border-radius: 999px;
  border: 1px solid #E5E7EB;
  color: #165DFF;
  background: #E8F3FF;
  padding: 3px 8px;
  font-size: 12px;
}

.badge--danger {
  border-color: #E5E7EB;
  color: var(--danger);
  background: var(--danger-soft);
}

/* Modal */
html {
  scrollbar-gutter: stable;
}

html.modal-open,
body.modal-open {
  overflow: hidden !important;
}

.u-modal {
  position: fixed;
  inset: 0;
  z-index: 260;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: none;
}

.u-modal.show {
  display: flex;
}

.user-app-page .u-modal {
  z-index: 320;
}

/* Keep the feedback dialog focused without shifting the application's colors. */
#messageModal {
  background: rgba(0, 0, 0, 0.22);
}

.u-modal__panel {
  position: relative;
  width: min(560px, calc(100vw - 32px));
  border: 0;
  border-radius: 16px;
  background: #FFFFFF;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.14);
  padding: 24px;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.upload-modal__panel {
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  overflow: visible;
}

.category-modal__panel {
  width: min(620px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  overflow: auto;
}

.upload-category-row {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.upload-category-row label {
  color: var(--text-muted);
  font-size: 13px;
}

.u-modal__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  position: relative;
  margin: 0 0 16px;
  padding: 0 32px 0 0;
  border: 0;
  border-radius: 0;
  color: #1F2937;
  background: transparent;
}

.u-modal__head h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.35;
  color: #1F2937;
}

.u-modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  border-radius: 0;
  color: #344054;
  font-size: 0;
  line-height: 0;
  cursor: pointer;
  transition: color 0.2s ease, transform 0.2s ease;
}

.u-modal__close::before {
  content: "";
  width: 16px;
  height: 16px;
  background-color: #344054;
  -webkit-mask: url("../../svg/Delete.svg") center / contain no-repeat;
  mask: url("../../svg/Delete.svg") center / contain no-repeat;
}

.u-modal__close:hover {
  background: transparent;
  color: #1D2939;
}

.u-modal__close:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(22, 93, 255, 0.16);
}

.u-modal .u-btn,
.u-modal button[type="submit"] {
  height: auto;
  min-height: 36px;
  border-radius: 8px;
  padding: 9px 22px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.u-modal .u-btn:hover:not(:disabled),
.u-modal button[type="submit"]:hover:not(:disabled) {
  transform: none;
}

.u-modal .u-btn--light {
  background: #FFFFFF;
  border-color: #D1D5DB;
  color: #374151;
}

.u-modal .u-btn--light:hover:not(:disabled) {
  background: #F9FAFB;
  border-color: #D1D5DB;
  color: #374151;
}

.u-modal .u-btn--primary,
.u-modal button[type="submit"] {
  background: #165DFF;
  border-color: #165DFF;
  color: #FFFFFF;
}

.u-modal .u-btn--primary:hover:not(:disabled),
.u-modal button[type="submit"]:hover:not(:disabled) {
  background: #0E42D2;
  border-color: #0E42D2;
  color: #FFFFFF;
}

.u-modal .u-btn--danger {
  background: #FFFFFF;
  border-color: #FECACA;
  color: #DC2626;
}

.u-modal .u-btn--danger:hover:not(:disabled) {
  background: #FEF2F2;
  border-color: #FECACA;
  color: #B91C1C;
}

.u-modal .u-input,
.u-modal select,
.u-modal textarea {
  border-radius: 8px;
  border-color: #D1D5DB;
}

.u-modal .u-input:focus,
.u-modal select:focus,
.u-modal textarea:focus {
  border-color: #165DFF;
  box-shadow: 0 0 0 3px rgba(22, 93, 255, 0.12);
}

.confirm-modal__panel {
  width: min(480px, calc(100vw - 32px));
}

.rename-modal__panel {
  width: min(500px, calc(100vw - 32px));
}

.detail-modal__panel {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 72px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.detail-modal__body {
  max-height: min(54vh, 420px);
  overflow: auto;
  font-size: 14px;
  line-height: 1.75;
  color: #4B5563;
}

.detail-modal__body .u-field {
  margin-bottom: 8px;
}

.detail-modal__body .u-field > label {
  font-size: 12px;
}

.detail-modal__body .u-hint {
  font-size: 12px;
  line-height: 1.7;
  color: #6B7280;
}

.message-modal__panel {
  width: min(560px, calc(100vw - 32px));
}

.action-dialog__panel {
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
}

.action-dialog__head {
  border-bottom: 0;
}

.action-dialog__title {
  color: #1F2937;
}

.action-dialog__body {
  display: grid;
  gap: 10px;
}

.action-dialog__message {
  margin: 0;
  color: #4B5563;
  line-height: 1.75;
  word-break: break-word;
  white-space: pre-wrap;
}

.action-dialog__extra {
  max-height: 180px;
  overflow: auto;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #E5E7EB;
  background: #F8FAFC;
  font-size: 12px;
  color: #4B5563;
  white-space: pre-wrap;
}

.action-dialog__input {
  margin-top: 2px;
}
.action-dialog__picker { position: relative; margin-top: 2px; }
.action-dialog__picker-trigger { display: flex; align-items: center; width: 100%; min-height: 40px; gap: 9px; padding: 0 34px 0 12px; border: 1px solid #d0d5dd; border-radius: 8px; background: #fff; color: #344054; font-size: 14px; text-align: left; cursor: pointer; }
.action-dialog__picker-trigger::after { content: ''; position: absolute; top: 16px; right: 14px; width: 7px; height: 7px; border-right: 1px solid #667085; border-bottom: 1px solid #667085; transform: rotate(45deg); }
.action-dialog__picker-trigger:focus { border-color: #165dff; outline: 0; box-shadow: 0 0 0 3px rgba(22, 93, 255, .12); }
.action-dialog__picker-trigger img, .action-dialog__picker-option img { width: 18px; height: 18px; flex: 0 0 18px; object-fit: contain; }
.action-dialog__picker-menu { position: static; z-index: 4; display: none; max-height: min(224px, calc(100dvh - 300px)); margin-top: 6px; overflow-y: auto; padding: 5px; border: 1px solid #d0d5dd; border-radius: 8px; background: #fff; box-shadow: 0 10px 24px rgba(15, 23, 42, .14); }
.action-dialog__picker.is-open .action-dialog__picker-menu { display: block; }
.action-dialog__picker-option { display: flex; align-items: center; width: 100%; min-height: 36px; gap: 9px; padding: 7px 9px; border: 0; border-radius: 6px; background: transparent; color: #344054; text-align: left; cursor: pointer; }
.action-dialog__picker-option:hover, .action-dialog__picker-option.is-selected { background: #f2f7ff; color: #165dff; }

.message-textarea {
  min-height: 150px;
  height: auto;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.5;
}

.message-counter {
  text-align: right;
}

.message-modal__actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.category-create-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-bottom: 14px;
}

.category-icon-picker {
  display: grid;
  gap: 10px;
  margin: -2px 0 14px;
  padding: 12px;
  border: 1px solid #E5E7EB;
  border-radius: 14px;
  background: #FFFFFF;
}

.category-icon-selected {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: #F7F9FC;
  color: #344054;
  font-size: 12px;
}

.category-icon-selected img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex: 0 0 auto;
}

.category-icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding: 2px 2px 4px;
}

.category-icon-option {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  height: 62px;
  padding: 6px;
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  background: #FFFFFF;
  color: #344054;
  cursor: pointer;
  transition: border-color .2s ease, background-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.category-icon-option:hover {
  border-color: rgba(22, 93, 255, 0.36);
  background: #F5FAFF;
  transform: translateY(-1px);
}

.category-icon-option.is-selected {
  border-color: #165DFF;
  background: #E8F3FF;
  box-shadow: 0 6px 14px rgba(22, 93, 255, 0.12);
}

.category-icon-option img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex: 0 0 auto;
  filter: brightness(0) saturate(0%) contrast(1.2);
  opacity: .76;
}

.category-icon-option span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  line-height: 1.2;
  color: #667085;
}

.category-card__icon,
.category-manage-item__icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  object-fit: contain;
  filter: brightness(0) saturate(0%) contrast(1.2);
  opacity: .76;
}

.category-card.active .category-card__icon {
  filter: brightness(0) invert(1);
}

.category-manage-item__main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.category-manage-item__copy {
  min-width: 0;
}

.category-manage-list {
  display: grid;
  gap: 10px;
  max-height: min(46vh, 380px);
  overflow: auto;
}

.category-manage-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(232, 243, 255, 0.85);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.86);
  padding: 12px;
}

.category-manage-item__name {
  font-size: 14px;
  font-weight: 700;
  color: #111827;
}

.category-manage-item__meta {
  margin-top: 4px;
  font-size: 12px;
  color: #6B7280;
}

.category-manage-item__icon {
  width: 20px;
  height: 20px;
}

.category-manage-item__actions {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

@media (max-width: 640px) {
  .category-create-row {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .category-icon-grid {
    grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  }
}

.confirm-modal__msg {
  margin: 0;
  text-align: left;
  color: #4B5563;
  font-size: 14px;
  line-height: 1.75;
}

.confirm-modal__actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.switch {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

.dropzone {
  margin-top: 10px;
  border: 1px dashed #165DFF;
  border-radius: 10px;
  background: #F5FAFF;
  text-align: center;
  padding: 24px;
  cursor: pointer;
  color: #165DFF;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.dropzone p {
  font-size: 16px;
  font-weight: 700;
}

.dropzone.drag {
  border-color: #165DFF;
  background: #E8F3FF;
  box-shadow: none;
}

.upload-status {
  display: none;
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 10px;
  border: 1px solid rgba(22, 93, 255, 0.28);
  border-radius: 10px;
  background: #f7fbff;
  padding: 10px;
  overflow: hidden;
}

.upload-status.show {
  display: flex;
  flex-direction: column;
}

.upload-summary-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.upload-summary-copy {
  min-width: 0;
}

.upload-summary-stats {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.upload-summary-stats span {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(22, 93, 255, 0.18);
  background: rgba(255, 255, 255, 0.85);
  color: #165DFF;
  font-size: 12px;
  font-weight: 600;
}

.upload-progress {
  height: 8px;
  border-radius: 999px;
  background: #E5E7EB;
  overflow: hidden;
  margin: 8px 0;
}

.upload-progress > div {
  width: 0;
  height: 100%;
  position: relative;
  overflow: hidden;
  background: #00B42A;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.08);
}

.upload-progress > div::after {
  content: "";
  position: absolute;
  top: -70%;
  bottom: -70%;
  left: -36%;
  width: 36%;
  pointer-events: none;
  opacity: 1;
  background: linear-gradient(
    105deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.56) 48%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: translateX(-220%) skewX(-18deg);
  animation: upload-progress-shine 0.85s linear infinite;
}

@keyframes upload-progress-shine {
  0% {
    transform: translateX(-220%) skewX(-18deg);
  }
  100% {
    transform: translateX(360%) skewX(-18deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .storage-fill::after,
  .upload-progress > div::after {
    animation: none;
    opacity: 0.35;
  }
}

.upload-progress--item {
  height: 7px;
  margin: 6px 0 0;
}

.upload-list {
  margin-top: 12px;
  display: grid;
  gap: 10px;
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
  padding-right: 2px;
}

.upload-item {
  position: relative;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 36px 10px 10px;
  border-radius: 12px;
  border: 1px solid rgba(22, 93, 255, 0.16);
  background: rgba(255, 255, 255, 0.82);
}

.upload-item__thumb {
  position: relative;
  width: 58px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: #eef4ff;
  overflow: hidden;
}

.upload-item__remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 999px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  color: #fff;
  background: rgba(17, 24, 39, 0.72);
  box-shadow: 0 6px 14px rgba(17, 24, 39, 0.28);
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease, opacity 0.18s ease;
}

.upload-item__remove:hover {
  background: rgba(239, 68, 68, 0.9);
  transform: scale(1.04);
}

.upload-item__remove:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.upload-item__thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.upload-item__thumb-note {
  font-size: 11px;
  font-weight: 700;
  color: #6B7280;
}

.upload-item__body {
  min-width: 0;
}

.upload-item__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.upload-item__name {
  min-width: 0;
  font-size: 14px;
  font-weight: 700;
  color: #111827;
  line-height: 1.45;
  word-break: break-all;
}

.upload-item__status {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.26);
  background: #F9FAFB;
  color: #6B7280;
  font-size: 12px;
  font-weight: 700;
}

.upload-item__status--active {
  border-color: rgba(22, 93, 255, 0.22);
  background: rgba(232, 243, 255, 0.95);
  color: #165DFF;
}

.upload-item__status--ok {
  border-color: rgba(22, 93, 255, 0.22);
  background: rgba(234, 241, 255, 0.95);
  color: #165DFF;
}

.upload-item__status--error {
  border-color: rgba(22, 93, 255, 0.24);
  background: rgba(234, 241, 255, 0.95);
  color: #165DFF;
}

.upload-item__meta {
  margin-top: 6px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: #6B7280;
  font-size: 12px;
}

.upload-item__error {
  margin-top: 6px;
  color: #165DFF;
  font-size: 12px;
  line-height: 1.45;
}

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

/* Upload modal visual polish only. */
.upload-modal__panel {
  width: min(800px, calc(100vw - 32px));
  border-radius: 20px;
  padding: 26px;
  background: #FFFFFF;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22), 0 8px 24px rgba(22, 93, 255, 0.10);
}

.upload-modal__panel .u-modal__head {
  margin-bottom: 18px;
  padding-right: 36px;
}

.upload-modal__panel .u-modal__head h3 {
  color: #101828;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0;
}

.upload-modal__panel .u-modal__close {
  width: 30px;
  height: 30px;
  border-radius: 0;
  color: #344054;
}

.upload-modal__panel .u-modal__close:hover {
  background: transparent;
  color: #1D2939;
}

.upload-category-row {
  gap: 8px;
  margin-bottom: 14px;
}

.upload-category-row label {
  color: #344054;
  font-size: 13px;
  font-weight: 600;
}

.upload-category-row select {
  height: 42px;
  border: 1px solid #D0D5DD;
  border-radius: 10px;
  background-color: #FFFFFF;
  background-image:
    linear-gradient(45deg, transparent 50%, #667085 50%),
    linear-gradient(135deg, #667085 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 17px,
    calc(100% - 13px) 17px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  color: #1D2939;
  font-size: 14px;
  font-weight: 500;
  padding: 0 38px 0 12px;
  appearance: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.upload-category-row select:focus {
  border-color: #165DFF;
  box-shadow: 0 0 0 3px rgba(22, 93, 255, 0.14);
  outline: none;
}

.upload-category-row select option {
  color: #1D2939;
  font-size: 14px;
}

.upload-category-select {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  overflow: visible;
}

.upload-category-select__icon {
  display: none;
  position: static;
  z-index: 1;
  width: 20px;
  height: 20px;
  object-fit: contain;
  transform: none;
  flex: 0 0 20px;
  pointer-events: none;
  box-sizing: border-box;
  padding: 2px;
  border-radius: 6px;
  background: #F5FAFF;
  border: 1px solid #DDE9FF;
}

.upload-category-select select {
  display: none;
}

.upload-category-select__trigger {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 38px 0 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  position: relative;
  border: 1px solid #D0D5DD;
  border-radius: 10px;
  background: #FFFFFF;
  color: #1D2939;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

.upload-category-select__trigger:focus-visible {
  outline: none;
  border-color: #165DFF;
  box-shadow: 0 0 0 3px rgba(22, 93, 255, 0.14);
}

.upload-category-select__trigger img {
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  object-fit: contain;
}

.upload-category-select__chevron {
  position: absolute;
  right: 15px;
  top: 15px;
  width: 8px;
  height: 8px;
  border-right: 2px solid #667085;
  border-bottom: 2px solid #667085;
  transform: rotate(45deg);
}

.upload-category-select__menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 252px;
  padding: 6px;
  overflow-y: auto;
  border: 1px solid #DCE3ED;
  border-radius: 14px;
  background: #FFFFFF;
  box-shadow: 0 12px 28px rgba(16, 24, 40, 0.14);
}

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

.upload-category-select__option {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #344054;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.upload-category-select__option:hover { background: #F2F6FC; }
.upload-category-select__option.is-selected { background: #E8F1FF; color: #165DFF; font-weight: 600; }
.upload-category-select__option-icon { width: 19px; height: 19px; object-fit: contain; flex: 0 0 19px; }
.public-library-nav { display:inline-flex; align-items:center; justify-content:flex-start; height:34px; margin-left:8px; padding:0; border:0; border-radius:0; color:#344054; background:transparent; font-size:13px; font-weight:600; text-decoration:none; white-space:nowrap; transition:color .18s ease, opacity .18s ease; }
.public-library-nav:hover { color:#165DFF; opacity:.88; }
@media (max-width:760px) { .public-library-nav { margin-left:6px; font-size:12px; } .site-brand__name { display:none; } }
.upload-category-row { grid-template-columns: auto minmax(180px, 1fr) auto; align-items: center; }
.upload-category-row > label:first-child { white-space: nowrap; }
.upload-public-toggle { display:inline-flex; align-items:center; gap:7px; cursor:pointer; white-space:nowrap; color:#344054 !important; font-size:13px !important; font-weight:600; }
.upload-public-toggle input { position:absolute; opacity:0; pointer-events:none; }
.upload-public-toggle__track { width:36px; height:20px; padding:2px; border-radius:999px; background:#D0D5DD; transition:background .18s ease; }
.upload-public-toggle__track span { display:block; width:16px; height:16px; border-radius:50%; background:#fff; box-shadow:0 1px 2px rgba(16,24,40,.2); transition:transform .18s ease; }
.upload-public-toggle input:checked + .upload-public-toggle__track { background:#165DFF; }
.upload-public-toggle input:checked + .upload-public-toggle__track span { transform:translateX(16px); }
@media (max-width:640px) { .upload-category-row { grid-template-columns:1fr; align-items:start; } }

.upload-progress {
  height: 5px;
}

.toolbar-btn__icon--trash {
  --toolbar-icon: url('../../svg/Delete.svg');
}

.recycle-bin-modal__panel { width: min(560px, calc(100vw - 32px)); }
.recycle-bin-list { display: grid; gap: 8px; margin-top: 14px; }
.recycle-bin-item { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px; border: 1px solid #E4E7EC; border-radius: 8px; background: #F9FAFB; }
.recycle-bin-item strong, .recycle-bin-item small { display: block; }
.recycle-bin-item strong { color: #344054; font-size: 14px; }
.recycle-bin-item small { color: #98A2B3; margin-top: 4px; font-size: 12px; }
}

.dropzone {
  margin-top: 12px;
  border: 1px dashed rgba(22, 93, 255, 0.36);
  border-radius: 16px;
  background: linear-gradient(180deg, #F7FAFF 0%, #F2F7FF 100%);
  padding: 28px 24px;
  color: #165DFF;
  box-shadow: inset 0 0 0 1px rgba(22, 93, 255, 0.04);
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.dropzone:hover,
.dropzone.drag {
  border-color: #165DFF;
  background: #EEF5FF;
  box-shadow: 0 10px 24px rgba(22, 93, 255, 0.10);
}

.dropzone p {
  margin: 0 0 8px;
  color: #165DFF;
  font-size: 17px;
  font-weight: 700;
}

.dropzone small,
.upload-modal__panel .u-hint {
  color: #98A2B3;
  font-size: 12px;
  line-height: 1.65;
}

.upload-status {
  margin-top: 14px;
  border: 1px solid #E4E7EC;
  border-radius: 16px;
  background: #F6F8FB;
  padding: 14px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.78);
}

.upload-summary-head {
  align-items: center;
  gap: 16px;
  padding: 10px 12px;
  border: 1px solid #E8EEF7;
  border-radius: 14px;
  background: #FFFFFF;
}

.upload-file-name {
  color: #101828;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
}

.upload-summary-copy .u-hint {
  display: block;
  margin-top: 3px;
  color: #98A2B3;
}

.upload-summary-stats span,
.upload-item__status {
  border: 0;
  border-radius: 999px;
  background: #E8F3FF;
  color: #165DFF;
  box-shadow: none;
}

.upload-summary-stats span {
  height: 26px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
}

.upload-progress {
  height: 5px;
  margin: 12px 0 8px;
  border-radius: 999px;
  background: #E9EEF5;
}

.upload-progress > div {
  border-radius: inherit;
  background: #12B76A;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.08), 0 4px 10px rgba(18, 183, 106, 0.22);
}

.upload-progress--item {
  height: 4px;
  margin-top: 8px;
}

.upload-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 2px 2px;
  color: #667085;
  font-size: 12px;
}

.upload-list {
  gap: 12px;
  margin-top: 14px;
  padding: 2px 4px 4px 2px;
}

.upload-item {
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 14px;
  padding: 14px 42px 14px 14px;
  border: 1px solid #EEF2F7;
  border-radius: 16px;
  background: #FFFFFF;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
}

.upload-item__thumb {
  width: 64px;
  height: 64px;
  border: 1px solid #E4E7EC;
  border-radius: 14px;
  background: #F4F7FB;
}

.upload-item__thumb-note {
  color: #667085;
  font-size: 11px;
  font-weight: 700;
}

.upload-item__head {
  align-items: center;
  gap: 12px;
}

.upload-item__name {
  color: #101828;
  font-size: 14px;
  font-weight: 700;
}

.upload-item__status {
  height: 24px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 700;
}

.upload-item__status--active {
  background: #E8F3FF;
  color: #165DFF;
}

.upload-item__status--ok {
  background: #ECFDF3;
  color: #039855;
}

.upload-item__status--error {
  background: #FEF3F2;
  color: #D92D20;
}

.upload-item__meta {
  gap: 8px;
  margin-top: 8px;
  color: #667085;
  font-size: 12px;
}

.upload-item__meta span {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: #F2F4F7;
  color: #667085;
}

.upload-item__error {
  margin-top: 8px;
  color: #D92D20;
}

.upload-item__remove {
  top: 10px;
  right: 10px;
  width: 24px;
  height: 24px;
  background: #F2F4F7;
  color: #667085;
  box-shadow: none;
  font-size: 16px;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.upload-item__remove:hover:not(:disabled) {
  background: #FEF3F2;
  color: #D92D20;
  transform: scale(1.04);
}

.upload-item__remove:disabled {
  background: #F2F4F7;
  color: #98A2B3;
  opacity: 0.6;
}

.upload-actions {
  margin-top: 16px;
  gap: 12px;
}

.upload-actions .u-btn {
  min-height: 38px;
  border-radius: 10px;
  padding: 9px 20px;
  box-shadow: none;
}

.upload-actions .u-btn--light {
  border-color: #D0D5DD;
  background: #FFFFFF;
  color: #344054;
}

.upload-actions .u-btn--light:hover:not(:disabled) {
  border-color: #B8C0CC;
  background: #F9FAFB;
}

.upload-actions .u-btn--primary {
  border-color: #165DFF;
  background: #165DFF;
  color: #FFFFFF;
  box-shadow: 0 8px 18px rgba(22, 93, 255, 0.20);
}

.upload-actions .u-btn--primary:hover:not(:disabled) {
  background: #0E42D2;
  border-color: #0E42D2;
  box-shadow: 0 10px 22px rgba(22, 93, 255, 0.26);
}

.upload-actions .u-btn:disabled {
  border-color: #E4E7EC;
  background: #F2F4F7;
  color: #98A2B3;
  box-shadow: none;
  opacity: 1;
  cursor: not-allowed;
}

.toast {
  position: fixed;
  left: 50%;
  top: max(16px, env(safe-area-inset-top));
  transform: translate(-50%, -8px);
  z-index: 1000;
  color: #fff;
  background: rgba(20, 24, 32, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 8px 11px;
  font-size: 13px;
  max-width: min(80vw, 560px);
  text-align: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.16);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.u-alert,
.success,
.error {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  left: 50%;
  z-index: 1000;
  width: max-content;
  max-width: min(80vw, 560px);
  margin: 0;
  transform: translateX(-50%);
  box-shadow: 0 8px 20px rgba(29, 33, 41, 0.14);
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Unified floating notification pill */
.toast.toast-shell,
.success.toast-shell,
.error.toast-shell,
.u-alert.toast-shell {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  left: 50%;
  z-index: 5000;
  width: max-content;
  max-width: min(88vw, 720px);
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(20, 24, 32, 0.4);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.16);
  color: #fff;
  padding: 7px 11px 7px 10px;
  font-size: 13px;
  line-height: 1.4;
  text-align: left;
  transform: translate(-50%, -12px);
  opacity: 0;
  pointer-events: auto;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.toast-shell.show,
.success.toast-shell,
.error.toast-shell,
.u-alert.toast-shell {
  opacity: 1;
  transform: translate(-50%, 0);
  animation: toast-pill-enter 0.24s ease-out both;
}

.toast-shell.is-hiding {
  animation: toast-pill-exit 0.2s ease-in both;
}

.toast-shell.is-dismissed {
  display: none !important;
}

.toast__indicator {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: #165dff;
  box-shadow: 0 0 0 0 rgba(22, 93, 255, 0.5);
  animation: toast-pill-pulse 1.6s ease-out infinite;
}

.preview-page .toast__indicator {
  background: #00b42a;
  color: #00b42a;
  box-shadow: 0 0 0 0 rgba(0, 180, 42, 0.48);
}

.toast-type-success .toast__indicator {
  background: #00b42a;
  color: #00b42a;
  box-shadow: 0 0 0 0 rgba(0, 180, 42, 0.52);
}

.toast-type-warning .toast__indicator {
  background: #ff7d00;
  color: #ff7d00;
  box-shadow: 0 0 0 0 rgba(255, 125, 0, 0.5);
}

.toast-type-error .toast__indicator {
  background: #f53f3f;
  color: #f53f3f;
  box-shadow: 0 0 0 0 rgba(245, 63, 63, 0.5);
}

.toast__message {
  min-width: 0;
  overflow-wrap: anywhere;
}

.toast__close {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 16px;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  opacity: 0.7;
  padding: 0;
  transition: opacity 0.16s ease;
}

.toast__close:hover {
  opacity: 1;
}

@keyframes toast-pill-enter {
  from { opacity: 0; transform: translate(-50%, -14px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes toast-pill-exit {
  from { opacity: 1; transform: translate(-50%, 0); }
  to { opacity: 0; transform: translate(-50%, -14px); }
}

@keyframes toast-pill-pulse {
  0% { box-shadow: 0 0 0 0 currentColor; }
  70% { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

@media (max-width: 560px) {
  .toast.toast-shell,
  .success.toast-shell,
  .error.toast-shell,
  .u-alert.toast-shell {
    max-width: calc(100vw - 24px);
    font-size: 13px;
  }
}

.back-top-btn {
  position: fixed;
  right: 20px;
  bottom: 72px;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(232, 243, 255, 0.95);
  border-radius: 999px;
  background: #165DFF;
  box-shadow: 0 12px 28px rgba(30, 64, 175, 0.36);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 58;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  pointer-events: none;
}

.back-top-btn.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.back-top-btn:hover {
  box-shadow: 0 16px 32px rgba(30, 64, 175, 0.46);
}

.back-top-btn img {
  width: 18px;
  height: 18px;
  display: block;
  filter: brightness(0) invert(1);
}

.preview-page .back-top-btn {
  bottom: 96px;
}

/* Preview */
.preview-wrap {
  position: relative;
  height: 100%;
  width: 100%;
  border: none;
  border-radius: 0;
  background: #FFFFFF;
  overflow: hidden;
  box-shadow: none;
}

#viewer {
  position: relative;
  width: 100%;
  height: 100%;
}

.line-draft-overlay {
  position: absolute;
  inset: 0;
  z-index: 22;
  pointer-events: none;
  width: 100%;
  height: 100%;
}

.preview-zoom-rail {
  position: absolute;
  left: 18px;
  top: 50%;
  z-index: 18;
  transform: translateY(-50%);
  width: 58px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 14px 10px;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  user-select: none;
}

.preview-zoom-rail.is-disabled {
  opacity: 0.65;
}

.preview-zoom-rail__value {
  min-width: 42px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: #165DFF;
}

.preview-zoom-rail__track {
  position: relative;
  width: 12px;
  height: min(42vh, 280px);
  border-radius: 999px;
  background: #F5FAFF;
  box-shadow: inset 0 0 0 1px rgba(232, 243, 255, 0.95);
  cursor: ns-resize;
  touch-action: none;
}

.preview-zoom-rail__fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0;
  border-radius: inherit;
  background: #165DFF;
  box-shadow: 0 10px 18px rgba(22, 93, 255, 0.24);
  pointer-events: none;
}

.preview-zoom-rail__thumb {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 22px;
  height: 22px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: #165DFF;
  box-shadow: 0 8px 20px rgba(22, 93, 255, 0.35);
  transform: translate(-50%, 50%);
  cursor: grab;
  touch-action: none;
}

.preview-zoom-rail__thumb:active {
  cursor: grabbing;
}

.preview-tools {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 24;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(245, 250, 255, 0.9);
  box-shadow: 0 16px 34px rgba(17, 24, 39, 0.12);
  padding: 8px 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  backdrop-filter: blur(8px);
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: #E8F3FF;
  color: #165DFF;
  padding: 0 12px;
  cursor: pointer;
}

.tool-icon {
  display: inline-block;
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
}

.tool-btn.active,
.tool-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.preview-page {
  overflow: hidden;
}

.preview-topbar {
  border-bottom: 1px solid var(--line);
  box-shadow: 0 8px 20px rgba(17, 24, 39, 0.05);
}

.preview-main--max {
  position: fixed;
  left: 0;
  right: 0;
  top: var(--preview-topbar-height, var(--app-topbar-height, 72px));
  bottom: 0;
  z-index: 1;
  padding: 0;
  overflow: hidden;
}

.preview-tool-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.preview-tool-sep {
  width: 1px;
  align-self: stretch;
  background: var(--line);
}

.anno-count {
  display: inline-flex;
  align-items: center;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 0 10px;
  font-size: 12px;
  color: #334155;
  background: #F5FAFF;
}

.qr-share-wrap {
  position: relative;
}

.qr-share-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(320px, calc(100vw - 32px));
  padding: 12px;
  z-index: 50;
  border: 1px solid var(--line);
  background: #FFFFFF;
  box-shadow: none !important;
}

.rotate-config-pop {
  position: fixed;
  width: min(280px, calc(100vw - 18px));
  z-index: 32;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #FFFFFF;
  box-shadow: none;
  padding: 12px;
  backdrop-filter: none;
}

.rotate-config-title {
  font-size: 13px;
  font-weight: 700;
  color: #111827;
}

.rotate-config-angle {
  margin-top: 6px;
  font-size: 24px;
  line-height: 1;
  font-weight: 800;
  color: #165DFF;
}

.rotate-config-range {
  width: 100%;
  margin-top: 14px;
  accent-color: #165DFF;
}

.rotate-config-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}

.rotate-config-presets {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.rotate-config-preset-btn {
  width: 100%;
  min-width: 0;
  height: 32px;
  padding: 0;
}

.line-config-pop {
  position: fixed;
  width: min(240px, calc(100vw - 18px));
  z-index: 40;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #FFFFFF;
  box-shadow: none;
  padding: 10px 12px;
  backdrop-filter: none;
}

.line-config-title {
  font-size: 12px;
  font-weight: 700;
  color: #165DFF;
  margin-bottom: 8px;
}

.line-color-group {
  gap: 10px;
}

.qr-share-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.qr-close {
  font-size: 0;
  line-height: 0;
}

.qr-share-tip {
  margin-bottom: 10px;
}

.qr-box {
  width: 184px;
  height: 184px;
  margin: 0 auto 10px;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  display: grid;
  place-items: center;
}

.qr-link-box {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  background: var(--bg-soft);
  font-size: 12px;
  word-break: break-all;
}

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

.qr-actions .u-btn {
  min-width: 0;
  padding-left: 8px;
  padding-right: 8px;
  white-space: nowrap;
}

/* Resource cards remain contained when names or categories are unusually long. */
.resource-item,
.resource-item * {
  min-width: 0;
}

.resource-name-row {
  width: 100%;
  min-width: 0;
  align-items: center;
}

.resource-name {
  flex: 1 1 auto;
  display: block;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
  overflow: hidden;
  min-height: 0;
  max-height: none;
}

.resource-name-edit {
  flex: 0 0 30px;
  margin-top: 0;
}

.resource-meta-tags {
  width: 100%;
  grid-template-columns: minmax(0, 1.35fr) minmax(64px, .85fr) minmax(48px, .7fr);
}

.resource-meta-tag {
  max-width: 100%;
  justify-content: center;
  text-align: center;
}

.resource-meta-tag:first-child {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
  line-height: 1.25;
  display: flex;
  max-height: none;
}

.resource-body {
  min-height: 0;
  gap: 8px;
}

.resource-retry-row:empty {
  display: none;
  min-height: 0;
}

.resource-actions {
  grid-template-columns: repeat(5, minmax(30px, 1fr));
  max-width: 100%;
  margin-top: 0;
  padding-top: 10px;
}

@media (max-width: 420px) {
  .resource-meta-tags {
    grid-template-columns: minmax(0, 1.2fr) minmax(58px, .8fr) minmax(44px, .65fr);
    gap: 6px;
  }

  .resource-meta-tag {
    padding-left: 6px;
    padding-right: 6px;
    font-size: 11px;
  }
}

@media (max-width: 680px) {
  .qr-actions .u-btn {
    padding-left: 4px;
    padding-right: 4px;
    font-size: 11px;
  }
}

.preview-tools--pro .tool-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.a9s-annotationlayer .a9s-inner,
.a9s-annotationlayer .a9s-outer {
  stroke-width: 2px !important;
}

.a9s-selection rect.a9s-inner,
.a9s-selection rect.a9s-outer {
  stroke: var(--anno-draft-color, #FF9500) !important;
  fill: var(--anno-draft-fill, rgba(255, 149, 0, 0.16)) !important;
}

.a9s-selection .a9s-selection-line-draft,
.a9s-selection .a9s-selection-square-draft,
.a9s-selection .a9s-selection-circle-draft {
  stroke: var(--anno-draft-color, #FF9500) !important;
}

.anno-config-pop {
  position: fixed;
  width: 320px;
  max-width: calc(100vw - 16px);
  z-index: 41;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #FFFFFF;
  box-shadow: none;
  padding: 10px;
  backdrop-filter: none;
}

.anno-config-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}

.anno-config-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.anno-label {
  color: var(--text-muted);
  font-size: 12px;
  min-width: 56px;
}

.anno-shape-group {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}

.anno-shape-btn {
  height: 32px;
  font-size: 12px;
  padding: 0 10px;
}

.anno-color-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.anno-color-btn {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(17, 24, 39, 0.2);
  cursor: pointer;
  background: var(--c);
}

.anno-color-btn.active {
  transform: scale(1.1);
  box-shadow: 0 0 0 2px var(--primary);
}

.anno-delete-pop {
  position: fixed;
  z-index: 42;
}

.anno-delete-mini {
  height: 28px;
  border: 1px solid #165DFF;
  border-radius: 999px;
  background: #FFFFFF;
  color: #165DFF;
  font-size: 12px;
  padding: 0 10px;
  cursor: pointer;
}

/* Shared Utilities */
.auth-panel--full {
  min-height: 100vh;
}

.brand-spaced {
  margin-bottom: 10px;
}

.u-mt-10 {
  margin-top: 10px;
}

.u-flex {
  display: flex;
}

.u-gap-8 {
  gap: 8px;
}

.u-gap-18 {
  gap: 18px;
}

.u-wrap {
  flex-wrap: wrap;
}

.u-items-center {
  align-items: center;
}

.u-justify-between {
  justify-content: space-between;
}

.u-justify-end {
  justify-content: flex-end;
}

.share-list {
  display: grid;
  gap: 10px;
}

.share-card {
  padding: 12px;
}

.share-card__layout {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

.share-card__cover {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 88px;
  overflow: hidden;
  border-radius: 8px;
  background: #f5f7fa;
}

.share-card__image {
  display: block;
  width: 100%;
  height: 88px;
  object-fit: contain;
  object-position: center;
}

.share-card__content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
}

.share-card__main {
  min-width: 0;
}

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

.share-quick-toggle {
  flex: 0 0 auto;
  min-height: 26px;
  padding: 4px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 12px;
  line-height: 16px;
  cursor: pointer;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease;
}

.share-quick-toggle.is-active {
  border-color: #b7ebc9;
  background: #e8f8ed;
  color: #159947;
}

.share-quick-toggle.is-active:hover {
  border-color: #55bd7a;
  background: #d7f3e0;
}

.share-quick-toggle.is-inactive {
  border-color: #d9dee8;
  background: #f5f6f8;
  color: #7b8494;
}

.share-quick-toggle:disabled {
  cursor: wait;
  opacity: .65;
}

.share-card .resource-cover-loading {
  z-index: 1;
  background: rgba(248, 251, 255, 0.72);
}

.share-card .resource-cover-loading img {
  width: 28px;
  height: 28px;
  animation: resource-cover-spin 0.9s linear infinite;
}

.share-card .share-actions {
  justify-content: flex-end;
}

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

.share-meta {
  margin-top: 6px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.share-meta--stats {
  flex-wrap: nowrap;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 2px;
  white-space: nowrap;
  scrollbar-width: thin;
}

.share-meta--stats span {
  flex: 0 0 auto;
}

.share-meta--badges {
  min-height: 26px;
  align-items: center;
}

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

@media (max-width: 680px) {
  .share-card__layout {
    grid-template-columns: 1fr;
  }

  .share-card__image,
  .share-card__cover {
    height: 180px;
  }

  .share-card__head {
    align-items: flex-start;
  }
}

.profile-avatar-wrap {
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
}

.profile-aside {
  display: grid;
  gap: 8px;
}

.avatar-lg {
  width: 96px;
  height: 96px;
  font-size: 28px;
}

.form-max-520 {
  max-width: 520px;
}

.upload-file-name {
  font-size: 14px;
  font-weight: 700;
}

.upload-meta-row {
  display: flex;
  justify-content: space-between;
}

.preview-title {
  font-weight: 700;
  font-size: 16px;
  max-width: 60vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-top-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.preview-top-left {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.preview-back-btn {
  flex-shrink: 0;
}

.preview-main {
  padding: 0;
}

.share-result-box {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-soft);
  padding: 10px;
  font-size: 13px;
  word-break: break-all;
}

.share-result-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}

.verify-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.verify-card {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 16px 40px rgba(22, 93, 255, 0.12);
}

.verify-title {
  font-size: 22px;
  margin-bottom: 8px;
}

.verify-sub {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 18px;
}

.verify-error {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #E8F3FF;
  color: #165DFF;
  font-size: 14px;
}

.verify-submit {
  width: 100%;
}

@media (max-width: 960px) {
  .auth-page {
    display: block;
    min-height: auto;
    padding: 0;
  }

  .auth-layout {
    min-height: auto;
    width: auto;
    margin: 16px;
    grid-template-columns: 1fr;
    border-radius: 18px;
  }

  .auth-side {
    display: none;
  }

  .auth-layout > .auth-panel {
    border-left: 0;
    padding: 22px 18px;
  }

  .auth-layout .auth-panel__card {
    max-width: none;
  }

  .app-topbar {
    flex-wrap: wrap;
  }

  .app-wrap {
    padding-top: 84px;
  }

  .app-topbar + .app-wrap {
    padding-top: 142px;
  }

  .app-sidebar {
    position: fixed;
    left: 10px;
    right: 10px;
    width: auto;
    top: 72px;
    bottom: auto;
    z-index: 18;
    max-height: none;
    overflow: visible;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
    background: #fff;
  }

  .app-menu {
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .app-menu a {
    width: auto;
  }

  .app-main {
    margin-left: 0;
    padding: 14px 12px 16px;
    min-height: auto;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .resource-grid {
    grid-template-columns: 1fr;
  }

  .preview-main--max {
    padding: 0;
  }

  .preview-zoom-rail {
    left: 10px;
    width: 50px;
    padding: 12px 8px;
    gap: 10px;
  }

  .preview-zoom-rail__track {
    height: min(34vh, 220px);
  }

  .preview-tools {
    left: 8px;
    right: 8px;
    bottom: 8px;
    justify-content: center;
  }

  .upload-modal__panel {
    max-height: calc(100vh - 24px);
  }

  .app-wrap {
    padding-top: 80px;
  }

  .app-topbar + .app-wrap {
    padding-top: 138px;
  }

  .app-sidebar {
    left: 8px;
    right: 8px;
    width: auto;
    top: 6px;
  }

  .app-topbar + .app-wrap .app-sidebar {
    top: 70px;
  }

  .back-top-btn {
    right: 12px;
    bottom: 64px;
    width: 44px;
    height: 44px;
  }

  .preview-page .back-top-btn {
    bottom: 86px;
  }

  .anno-config-pop {
    width: min(300px, calc(100vw - 16px));
  }

  .rotate-config-pop {
    width: min(260px, calc(100vw - 16px));
  }

  .line-config-pop {
    width: min(230px, calc(100vw - 16px));
  }

  .preview-tool-sep {
    display: none;
  }

  .qr-share-panel {
    position: fixed;
    left: 50%;
    top: 50%;
    right: auto;
    width: min(320px, calc(100vw - 24px));
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    transform: translate(-50%, -50%);
  }
}

/* The resource page has a more specific grid rule in its view stylesheet. */
@media (max-width: 640px) {
  #resourcesPane .resource-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #resourcesPane .resource-actions {
    gap: 6px;
  }
}

@media (max-width: 360px) {
  #resourcesPane .resource-actions {
    gap: 4px;
  }

  #resourcesPane .resource-action-btn {
    width: 32px !important;
    min-width: 32px !important;
    height: 32px;
  }
}

/* Login shell adapted from the DEMO layout while retaining the current auth flow. */
.auth-page {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px;
  background: #eef3ff;
}

.auth-layout.auth-layout--compact {
  width: min(960px, calc(100vw - 48px));
  min-height: 520px;
  max-height: calc(100dvh - 48px);
  margin: 0;
  grid-template-columns: minmax(0, 56%) minmax(340px, 44%);
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(16, 24, 40, .18);
}

.auth-layout--compact .auth-side {
  min-height: 520px;
  background: #ffffff;
}

.auth-layout--compact .auth-carousel__item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .12);
  pointer-events: none;
}

.auth-layout--compact .auth-panel {
  display: block;
  overflow-y: auto;
  padding: 48px 44px;
  background: #fff;
}

.auth-layout--compact .auth-panel__card,
.auth-layout .auth-panel__card {
  width: 100%;
  max-width: none;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.auth-layout--compact .auth-panel .site-brand {
  justify-content: center;
  min-height: 64px;
  margin-bottom: 20px;
}

.auth-layout--compact .auth-panel img.site-brand__mark {
  height: 48px;
  max-width: min(220px, 72%);
  margin: 0;
  border-radius: 0;
}

.auth-layout--compact .auth-panel span.site-brand__mark {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #e8f0ff;
}

.auth-title {
  margin-bottom: 8px;
  color: #262626;
  font-size: 22px;
  font-weight: 600;
  text-align: center;
}

.auth-subtitle {
  margin-bottom: 24px;
  color: #86909c;
  font-size: 14px;
  line-height: 1.6;
  text-align: center;
}

.auth-layout .u-field {
  gap: 7px;
  margin-bottom: 18px;
}

.auth-layout .u-field label {
  color: #4e5969;
  font-size: 13px;
}

.auth-layout .u-input {
  height: 42px;
  border-color: #d9dce3;
  border-radius: 6px;
  padding: 0 12px;
}

.auth-layout .u-input:focus {
  border-color: #165dff;
  box-shadow: 0 0 0 3px rgba(22, 93, 255, .14);
}

.auth-layout .u-btn--primary {
  width: 100%;
  height: 42px;
  border-radius: 6px;
  font-weight: 600;
}

.auth-password-field {
  position: relative;
}

.auth-password-field .u-input {
  padding-right: 44px;
}

.auth-password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  width: 32px;
  height: 32px;
  margin-top: -16px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

.auth-password-toggle:hover,
.auth-password-toggle:focus-visible {
  background: #f2f3f5;
  outline: none;
}

.auth-password-toggle img {
  width: 18px;
  height: 18px;
  opacity: .66;
}

/* The upload picker is a simple input surface, not a highlighted drop card. */
.user-app-page .dropzone {
  background: var(--surface, #fff);
  box-shadow: none;
}
.user-app-page .dropzone:hover,
.user-app-page .dropzone.drag {
  background: var(--surface, #fff);
  box-shadow: none;
}

.auth-layout .auth-links {
  margin-top: 18px;
  font-size: 13px;
}

@media (max-width: 960px) {
  .auth-page {
    display: flex;
    padding: 16px;
  }

  .auth-layout.auth-layout--compact {
    width: min(440px, 100%);
    min-height: 0;
    max-height: none;
    grid-template-columns: 1fr;
    border-radius: 8px;
  }

  .auth-layout--compact .auth-side {
    display: none;
  }

  .auth-layout--compact .auth-panel {
    padding: 36px 28px;
  }
}

@media (max-width: 420px) {
  .auth-page {
    padding: 10px;
  }

  .auth-layout--compact .auth-panel {
    padding: 30px 20px;
  }
}





