:root {
  --bg: #f5f5f7;
  --panel: #ffffff;
  --panel-soft: #fafafa;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --subtle: #8a8a91;
  --line: #dedee3;
  --line-soft: #ececf0;
  --blue: #0a84ff;
  --blue-pressed: #006dd6;
  --red: #d70015;
  --green: #2e9e44;
  --shadow: 0 18px 48px rgba(20, 26, 38, 0.08);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

* {
  box-sizing: border-box;
}

html,
body,
#root {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 360px;
  height: 100vh;
  background: var(--bg);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 24px 18px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(22px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #1d1d1f;
  color: white;
  font-weight: 700;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 15px;
  line-height: 1.2;
}

.brand span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.sidebar-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.sidebar-stats div {
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel);
}

.sidebar-stats b,
.sidebar-stats span {
  display: block;
}

.sidebar-stats b {
  font-size: 22px;
  line-height: 1;
}

.sidebar-stats span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.category-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: -14px;
  padding: 0 4px;
  color: var(--subtle);
  font-size: 12px;
  font-weight: 700;
}

.settings-button {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.settings-button:hover {
  color: var(--blue);
  border-color: rgba(10, 132, 255, 0.35);
  background: #f5faff;
}

.category-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 0 12px 0 calc(12px + var(--level, 0) * 18px);
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #343438;
  text-align: left;
  font-size: 14px;
}

.category-item:hover,
.category-item.is-active {
  background: #ebf4ff;
  color: #005fbe;
}

.category-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
}

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

.workspace {
  min-width: 0;
  overflow: auto;
  padding: 22px 28px 32px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 10;
  padding-bottom: 16px;
  background: linear-gradient(180deg, var(--bg) 76%, rgba(245, 245, 247, 0));
}

.search-box {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 260px;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
}

.search-icon {
  color: var(--subtle);
  font-size: 20px;
  line-height: 1;
  margin-right: 10px;
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 15px;
}

.topbar-actions,
.modal-actions,
.card-actions,
.file-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.primary-button {
  border: 1px solid var(--blue);
  background: var(--blue);
  color: white;
}

.primary-button:hover {
  background: var(--blue-pressed);
}

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

.link-button {
  white-space: nowrap;
}

.readonly-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: #f2f2f5;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.library-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 8px 0 20px;
}

.library-title-block {
  min-width: 0;
}

.library-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.library-header h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.15;
  letter-spacing: 0;
}

.library-header p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.header-side {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex: 0 0 auto;
}

.header-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.header-pills span {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.wechat-qr-card {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  cursor: zoom-in;
  font: inherit;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.wechat-qr-card:hover {
  border-color: rgba(10, 132, 255, 0.45);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.wechat-qr-card img {
  width: 78px;
  height: 78px;
  object-fit: contain;
  border-radius: 6px;
  background: white;
}

.wechat-qr-card span {
  max-width: 94px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
}

.qr-lightbox {
  z-index: 70;
}

.qr-lightbox-panel {
  width: min(430px, 92vw);
  display: grid;
  gap: 16px;
  padding: 18px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.25);
}

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

.qr-lightbox-head span {
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.qr-lightbox-head h2 {
  margin: 5px 0 0;
  font-size: 20px;
  line-height: 1.3;
}

.qr-lightbox-panel img {
  width: min(340px, 80vw);
  height: min(340px, 80vw);
  justify-self: center;
  object-fit: contain;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: white;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(420px, 1.4fr);
  gap: 18px;
}

.products-panel,
.files-panel {
  min-width: 0;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 32px;
  margin-bottom: 12px;
}

.section-title h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.2;
}

.section-title button {
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 13px;
  font-weight: 600;
}

.section-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.sort-hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.product-list {
  display: grid;
  gap: 12px;
}

.product-card {
  padding: 16px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.product-card:hover,
.product-card.is-selected {
  border-color: rgba(10, 132, 255, 0.45);
  box-shadow: var(--shadow);
}

.product-card:hover {
  transform: translateY(-1px);
}

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

.product-card h3,
.file-card h3 {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  line-height: 1.35;
}

.product-card p,
.file-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.file-count {
  flex: 0 0 auto;
  padding: 5px 8px;
  border-radius: 999px;
  background: #f2f2f5;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.product-card-badges,
.file-title-badges {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex: 0 0 auto;
  flex-wrap: wrap;
}

.status-pill {
  flex: 0 0 auto;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.status-pill.is-public {
  background: #eaf7ee;
  color: #1d7f36;
}

.status-pill.is-private {
  background: #f2f2f5;
  color: var(--muted);
}

.spec-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.spec-grid span {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  color: var(--subtle);
  font-size: 11px;
}

.spec-grid b {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-tags,
.file-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.product-tags {
  margin-top: 14px;
  min-height: 24px;
}

.product-tags span,
.file-tags span {
  max-width: 100%;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f2f2f5;
  color: #4d4d52;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
}

.card-actions {
  justify-content: flex-end;
  margin-top: 14px;
}

.card-actions button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.card-actions button.danger-inline {
  border-color: rgba(215, 0, 21, 0.22);
  background: rgba(215, 0, 21, 0.05);
  color: var(--red);
}

.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.file-card {
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.file-card.is-draggable {
  cursor: grab;
}

.file-card.is-draggable:active {
  cursor: grabbing;
}

.file-card.is-dragging {
  opacity: 0.48;
  transform: scale(0.98);
}

.file-card:hover,
.file-card.is-selected {
  border-color: rgba(10, 132, 255, 0.45);
  box-shadow: var(--shadow);
}

.file-card:hover {
  transform: translateY(-1px);
}

.file-thumb {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  background: #f0f0f4;
  overflow: hidden;
}

.file-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file-symbol {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 16px;
  color: white;
  font-size: 16px;
  font-weight: 800;
}

.kind-pdf {
  background: #ff453a;
}

.kind-video {
  background: #af52de;
}

.kind-cad3d {
  background: #30b0c7;
}

.kind-design {
  background: #ff9f0a;
}

.kind-spreadsheet {
  background: var(--green);
}

.kind-document,
.kind-archive,
.kind-other {
  background: #6e6e73;
}

.file-meta {
  padding: 13px;
}

.file-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.file-title-row.no-file-name {
  justify-content: flex-start;
}

.file-title-row h3 {
  min-width: 0;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.file-title-badges > span:not(.status-pill) {
  flex: 0 0 auto;
  padding: 4px 7px;
  border-radius: 7px;
  background: #eef6ff;
  color: #006dd6;
  font-size: 11px;
  font-weight: 700;
}

.file-tags {
  margin-top: 10px;
  min-height: 22px;
}

.file-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
  color: var(--subtle);
  font-size: 12px;
}

.file-actions a,
.file-actions button {
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.file-actions button {
  color: var(--red);
}

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

.preview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 20px 14px;
  border-bottom: 1px solid var(--line-soft);
}

.preview-head span {
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

.preview-head h2 {
  margin: 5px 0 0;
  font-size: 18px;
  line-height: 1.35;
  word-break: break-word;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
}

.preview-body {
  display: grid;
  place-items: center;
  min-height: 300px;
  max-height: 48vh;
  margin: 16px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel-soft);
  overflow: hidden;
}

.preview-image,
.preview-video,
.preview-frame {
  width: 100%;
  height: 100%;
  min-height: 300px;
  border: 0;
  object-fit: contain;
}

.unsupported-preview {
  display: grid;
  place-items: center;
  gap: 12px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.unsupported-preview div {
  display: grid;
  place-items: center;
  width: 82px;
  height: 82px;
  border-radius: 18px;
  background: #1d1d1f;
  color: white;
  font-weight: 800;
}

.unsupported-preview p {
  margin: 0;
  max-width: 230px;
  font-size: 13px;
  line-height: 1.5;
}

.preview-info {
  display: grid;
  gap: 10px;
  padding: 0 20px;
}

.preview-info div {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.preview-info dt {
  color: var(--subtle);
  font-size: 12px;
}

.preview-info dd {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
}

.download-wide {
  display: grid;
  place-items: center;
  min-height: 42px;
  margin: 18px 20px 20px;
  border-radius: 8px;
  background: var(--blue);
  color: white;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.image-lightbox {
  z-index: 60;
}

.image-lightbox-panel {
  width: min(1180px, 94vw);
  max-height: 92vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  padding: 18px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.25);
}

.image-lightbox-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.image-lightbox-head span {
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.image-lightbox-head h2 {
  margin: 5px 0 0;
  font-size: 18px;
  line-height: 1.3;
  word-break: break-word;
}

.image-lightbox-body {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 16px;
}

.image-lightbox-image {
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: #f2f2f5;
}

.image-lightbox-image img {
  width: 100%;
  height: 100%;
  max-height: calc(92vh - 96px);
  object-fit: contain;
}

.image-lightbox-info {
  min-width: 0;
  max-height: calc(92vh - 96px);
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfbfd;
}

.image-lightbox-info h3 {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.3;
}

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

.product-spec-list div {
  display: grid;
  gap: 4px;
  padding-bottom: 10px;
  border-bottom: 1px solid #ececf0;
}

.product-spec-list div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.product-spec-list dt {
  color: var(--subtle);
  font-size: 12px;
}

.product-spec-list dd {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.45;
  word-break: break-word;
}

.spec-value-list {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  flex-wrap: wrap;
}

.spec-value-list span {
  max-width: 100%;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f2f2f5;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  word-break: break-word;
}

.package-options-section,
.preview-package-options {
  margin-top: 18px;
}

.package-options-section h3,
.preview-package-options h3 {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.3;
}

.package-options-table {
  display: grid;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.package-options-head,
.package-options-row {
  display: grid;
  grid-template-columns: 1fr minmax(0, 1.5fr) 0.8fr;
  gap: 0;
  min-width: 0;
}

.package-options-head {
  background: #f5f5f7;
  color: var(--subtle);
  font-size: 11px;
  font-weight: 800;
}

.package-options-head span,
.package-options-row span {
  min-width: 0;
  padding: 8px;
  border-right: 1px solid var(--line);
  word-break: break-word;
}

.package-options-head span:last-child,
.package-options-row span:last-child {
  border-right: 0;
}

.package-options-row {
  border-top: 1px solid var(--line);
  color: var(--text);
  font-size: 12px;
  line-height: 1.4;
}

.preview-empty {
  display: grid;
  place-items: center;
  align-content: center;
  height: 100%;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.preview-empty span {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin-bottom: 16px;
  border-radius: 18px;
  background: #f2f2f5;
  color: var(--subtle);
  font-weight: 700;
}

.preview-empty p {
  margin: 0;
  max-width: 230px;
  font-size: 13px;
  line-height: 1.5;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(29, 29, 31, 0.28);
  backdrop-filter: blur(18px);
}

.modal {
  width: min(760px, 100%);
  max-height: min(860px, 92vh);
  overflow: auto;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.2);
}

.upload-modal {
  width: min(560px, 100%);
}

.file-edit-modal {
  width: min(560px, 100%);
}

.login-modal {
  width: min(420px, 100%);
}

.account-settings-modal {
  width: min(860px, 100%);
}

.maintenance-modal {
  width: min(760px, 100%);
}

.category-change-modal {
  width: min(460px, 100%);
}

.compact-info {
  display: grid;
  gap: 8px;
  margin: 0 0 16px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fafafa;
}

.compact-info div {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 10px;
}

.compact-info dt {
  color: var(--subtle);
  font-size: 12px;
}

.compact-info dd {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  word-break: break-word;
}

.category-picker {
  gap: 9px;
}

.category-option-list {
  display: grid;
  gap: 4px;
  max-height: 220px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafafa;
}

.category-option {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 34px;
  padding: 0 10px 0 calc(10px + var(--level, 0) * 18px);
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-size: 13px;
  font-weight: 650;
}

.category-option:hover,
.category-option.is-selected {
  background: #ebf4ff;
  color: #005fbe;
}

.new-category-hint {
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

.category-settings-modal {
  width: min(640px, 100%);
}

.app-settings-modal {
  width: min(700px, 100%);
}

.brand-setting-row {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fbfbfd;
}

.setting-brand-preview {
  align-self: stretch;
  min-height: 112px;
  padding: 14px;
  border: 1px dashed #c9c9d0;
  border-radius: 8px;
  background: white;
}

.brand-setting-fields {
  display: grid;
  grid-template-columns: 0.65fr 1fr;
  gap: 12px;
}

.brand-setting-fields label:last-child {
  grid-column: 1 / -1;
}

.account-add-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fbfbfd;
}

.account-add-row .primary-button {
  min-height: 40px;
}

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

.account-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel);
}

.account-row-main {
  display: grid;
  grid-template-columns: 0.8fr 1fr 1fr;
  gap: 12px;
}

.account-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 190px;
}

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

.maintenance-card {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 16px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fbfbfd;
}

.maintenance-card h3 {
  margin: 0;
  font-size: 17px;
}

.maintenance-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.danger-zone {
  border-color: rgba(215, 0, 21, 0.24);
  background: #fff7f8;
}

.qr-setting-row {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fbfbfd;
}

.qr-setting-preview {
  display: grid;
  place-items: center;
  width: 120px;
  height: 120px;
  border: 1px dashed #c9c9d0;
  border-radius: 8px;
  background: white;
  overflow: hidden;
}

.qr-setting-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.qr-setting-preview span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.qr-setting-actions {
  display: grid;
  gap: 10px;
}

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

.modal-head span {
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.modal-head h2 {
  margin: 5px 0 0;
  font-size: 22px;
  line-height: 1.25;
}

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

label {
  display: grid;
  gap: 7px;
  color: #3d3d42;
  font-size: 13px;
  font-weight: 700;
}

.visibility-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.visibility-check input {
  width: 18px;
  min-height: 18px;
  height: 18px;
  margin: 1px 0 0;
  flex: 0 0 auto;
  accent-color: var(--blue);
}

.visibility-check span {
  line-height: 1.45;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  outline: 0;
  font-size: 14px;
}

input,
select {
  min-height: 40px;
  padding: 0 11px;
}

textarea {
  min-height: 86px;
  padding: 10px 11px;
  resize: vertical;
}

.field-hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
}

.packaging-editor {
  display: grid;
  gap: 10px;
}

.packaging-editor-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.packaging-editor-title strong {
  display: block;
  color: var(--text);
  font-size: 13px;
}

.packaging-editor-title span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
}

.packaging-editor-head,
.packaging-editor-row {
  display: grid;
  grid-template-columns: 1fr 1.3fr 0.8fr 1fr 1fr 58px;
  gap: 8px;
  align-items: center;
}

.packaging-editor-head {
  color: var(--subtle);
  font-size: 11px;
  font-weight: 800;
}

.packaging-editor-row input {
  min-height: 36px;
}

.packaging-editor-row .danger-inline {
  min-height: 36px;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.12);
}

.span-2 {
  grid-column: 1 / -1;
}

.drop-zone {
  place-items: center;
  min-height: 160px;
  margin-top: 14px;
  border: 1.5px dashed #c9c9d0;
  border-radius: 10px;
  background: #fafafa;
  color: var(--muted);
  text-align: center;
}

.drop-zone input {
  display: none;
}

.drop-zone strong {
  color: var(--text);
  font-size: 16px;
}

.drop-zone span {
  max-width: 340px;
  font-size: 12px;
  line-height: 1.5;
}

.compression-summary {
  margin: 10px 0 0;
  padding: 9px 10px;
  border: 1px solid rgba(46, 158, 68, 0.22);
  border-radius: 8px;
  background: #f1fbf3;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
}

.selected-files {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.selected-files li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 8px;
  background: #f5f5f7;
  font-size: 13px;
}

.selected-files span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.category-editor-list {
  display: grid;
  gap: 8px;
}

.category-editor-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fafafa;
}

.category-editor-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  gap: 10px;
  align-items: center;
}

.category-editor-fields input {
  padding-left: calc(11px + var(--level, 0) * 18px);
}

.category-editor-fields input::placeholder {
  color: #a1a1a8;
}

.category-editor-fields span {
  color: var(--subtle);
  font-size: 12px;
  text-align: right;
  white-space: nowrap;
}

.category-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.compact-button {
  min-height: 40px;
  padding: 0 12px;
  white-space: nowrap;
}

.danger-button {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid rgba(215, 0, 21, 0.24);
  border-radius: 8px;
  background: rgba(215, 0, 21, 0.06);
  color: var(--red);
  font-size: 14px;
  font-weight: 700;
}

.danger-button:disabled {
  color: var(--subtle);
  border-color: var(--line);
  background: #f4f4f6;
}

.helper-text {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.modal-actions {
  justify-content: flex-end;
  margin-top: 20px;
}

.error-box {
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(215, 0, 21, 0.25);
  border-radius: 8px;
  background: rgba(215, 0, 21, 0.06);
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
}

.empty-state,
.loading {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 360px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  text-align: center;
}

.empty-state div {
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
}

.empty-state p {
  max-width: 360px;
  margin: 10px 0 18px;
  font-size: 13px;
  line-height: 1.55;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 50;
  transform: translateX(-50%);
  padding: 11px 14px;
  border-radius: 999px;
  background: rgba(29, 29, 31, 0.92);
  color: white;
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--shadow);
}

@media (max-width: 1180px) {
  body {
    overflow: auto;
  }

  .app-shell {
    grid-template-columns: 220px minmax(0, 1fr);
    height: auto;
    min-height: 100vh;
  }

  .preview-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    width: min(420px, 94vw);
    transform: translateX(100%);
    transition: transform 180ms ease;
    box-shadow: -20px 0 60px rgba(0, 0, 0, 0.14);
  }

  .preview-panel.is-open {
    transform: translateX(0);
  }
}

@media (max-width: 860px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    gap: 14px;
    padding: 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar-stats {
    display: none;
  }

  .category-list {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .sidebar-section-head {
    margin-bottom: 0;
    justify-content: flex-start;
  }

  .category-item {
    flex: 0 0 auto;
    width: auto;
  }

  .workspace {
    padding: 16px;
  }

  .topbar,
  .library-header,
  .content-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    justify-content: stretch;
  }

  .topbar-actions button {
    flex: 1;
  }

  .library-header,
  .header-side {
    align-items: flex-start;
  }

  .header-side {
    flex-direction: column;
  }

  .brand-setting-row,
  .brand-setting-fields,
  .account-add-row,
  .account-row,
  .account-row-main,
  .maintenance-grid,
  .qr-setting-row {
    grid-template-columns: 1fr;
  }

  .account-row-actions {
    min-width: 0;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .library-header h1 {
    font-size: 24px;
  }

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

  .span-2 {
    grid-column: auto;
  }

  .category-add-row,
  .category-editor-row,
  .category-editor-fields {
    grid-template-columns: 1fr;
  }

  .category-editor-fields span {
    text-align: left;
  }

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

  .packaging-editor-title {
    display: grid;
  }

  .packaging-editor-head {
    display: none;
  }

  .packaging-editor-row {
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfbfd;
  }

  .image-lightbox-panel {
    max-height: 94vh;
    overflow: auto;
  }

  .image-lightbox-body {
    grid-template-columns: 1fr;
  }

  .image-lightbox-image img {
    height: auto;
    max-height: 54vh;
  }

  .image-lightbox-info {
    max-height: none;
  }
}
