@font-face {
  font-family: "Source Han Sans CN";
  src: url("./assets/fonts/SourceHanSansCN-Regular-20260810.woff2") format("woff2"),
       url("./assets/fonts/SourceHanSansCN-Regular.otf") format("opentype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Source Han Sans CN";
  src: url("./assets/fonts/SourceHanSansCN-Medium-20260810.woff2") format("woff2"),
       url("./assets/fonts/SourceHanSansCN-Medium.otf") format("opentype");
  font-weight: 500 600;
  font-display: swap;
}
@font-face {
  font-family: "Source Han Sans CN";
  src: url("./assets/fonts/SourceHanSansCN-Bold-20260810.woff2") format("woff2"),
       url("./assets/fonts/SourceHanSansCN-Bold.otf") format("opentype");
  font-weight: 700;
  font-display: swap;
}

:root {
  --aubergine: #4d144a;
  --brand-red: #b8252e;
  --ink: #252525;
  --muted: #606060;
  --soft: #979797;
  --line: #e2ddeb;
  --line-strong: #d3bfd2;
  --surface: #fff;
  --surface-soft: #fcfaff;
  --surface-hover: #f3f0f7;
  --surface-selected: #f9eff6;
  --gradient-brand: linear-gradient(90deg, #4d144a 11.9%, #b8252e 100%);
  --shadow-soft: 0 8px 22px rgba(50, 29, 57, .08);
  --motion: 180ms cubic-bezier(.2, 0, 0, 1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  min-width: 980px;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  margin: 0;
  background: #fbfafc;
  color: var(--ink);
  font-family: "Source Han Sans CN", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid #7d6aa8;
  outline-offset: 2px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .97);
  backdrop-filter: blur(12px);
}
.topbar-inner {
  width: min(1180px, calc(100% - 64px));
  min-height: 68px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 360px;
  align-items: center;
  gap: 32px;
}
.topbar-start { min-width: 0; display: flex; align-items: center; gap: 12px; }
.brand { display: inline-flex; width: max-content; flex: 0 0 auto; align-items: center; gap: 8px; }
.brand-mark { width: 27px; height: 27px; object-fit: contain; }
.brand-wordmark { width: 98px; object-fit: contain; }
.brand > span { margin-left: 8px; padding-left: 16px; border-left: 1px solid var(--line); color: var(--aubergine); font-size: 14px; font-weight: 600; }
.search {
  width: 360px;
  max-width: 100%;
  justify-self: end;
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}
.search:focus-within { border-color: var(--aubergine); box-shadow: 0 0 0 2px rgba(77, 20, 74, .08); background: #fff; }
.search-icon {
  position: relative;
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  border: 1.5px solid var(--aubergine);
  border-radius: 50%;
}
.search-icon::after {
  content: "";
  position: absolute;
  right: -5px;
  bottom: -2px;
  width: 6px;
  height: 1.5px;
  border-radius: 2px;
  background: var(--aubergine);
  transform: rotate(45deg);
}
.search input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 13px; }
.search input::placeholder { color: #aaa3ad; }
.search kbd { padding: 3px 6px; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--soft); font-size: 9px; }
.submit-button {
  width: 100%;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, .22);
  border-radius: 0;
  background: var(--aubergine);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--motion), color var(--motion);
}
.submit-button:hover { border-color: #6b2868; background: #6b2868; }
.home-link {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 7px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--aubergine);
  font-size: 10px;
  font-weight: 500;
  white-space: nowrap;
  transition: color var(--motion), background var(--motion), border-color var(--motion), box-shadow var(--motion);
}
.home-link:hover { border-color: var(--aubergine); background: var(--surface-selected); box-shadow: 0 4px 12px rgba(77, 20, 74, .07); }
.topbar-home-link { min-height: 30px; margin-left: 0; }

.workspace {
  width: min(1180px, calc(100% - 64px));
  flex: 1 0 auto;
  margin: 0 auto;
}
.page-heading {
  display: flex;
  min-height: 150px;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
  padding: 24px 0 22px;
  border-bottom: 1px solid var(--line);
}
.page-heading-main { min-width: 0; }
.heading-summary {
  width: 128px;
  min-width: 128px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  box-shadow: 0 4px 14px rgba(50, 29, 57, .04);
}
.page-identity { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.workspace-badge {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border-radius: 4px;
  background: var(--aubergine);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .08em;
}
.eyebrow { color: var(--brand-red); font-size: 10px; font-weight: 700; letter-spacing: .08em; }
.page-heading h1 { margin: 6px 0 0; color: #000; font-size: clamp(30px, 3vw, 38px); line-height: 1.2; }
.page-heading p { margin: 9px 0 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.project-total {
  width: 100%;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 10px;
  background: var(--surface-soft);
  text-align: center;
}
.project-total strong { display: block; color: var(--aubergine); font-size: 23px; font-variant-numeric: tabular-nums; line-height: 1; }
.project-total span { display: block; margin-top: 4px; color: var(--soft); font-size: 9px; }
.project-total span b { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }

.directory { padding: 30px 0 62px; }
.directory-tools { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 17px; }
.directory-tools h2 { margin: 0; color: #000; font-size: 22px; }
.directory-tools p { margin: 5px 0 0; color: var(--soft); font-size: 11px; }
.recycle-button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 11px;
  transition: color var(--motion), background var(--motion), border-color var(--motion);
}
.recycle-button:hover { border-color: var(--line-strong); background: var(--surface-hover); color: var(--aubergine); }
.recycle-button img { width: 15px; height: 15px; opacity: .62; }
.recycle-button strong { min-width: 20px; min-height: 20px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; border-radius: 999px; background: var(--surface-hover); color: var(--aubergine); font-size: 9px; }
.category-manager-button { position: relative; width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--muted); transition: color var(--motion), background var(--motion), border-color var(--motion); }
.category-manager-button:hover { border-color: var(--line-strong); background: var(--surface-hover); color: var(--aubergine); }
.category-manager-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.category-manager-button::after {
  position: absolute;
  top: 50%;
  right: calc(100% + 8px);
  z-index: 10;
  width: max-content;
  max-width: 150px;
  padding: 6px 8px;
  border-radius: 6px;
  background: #2d2430;
  color: #fff;
  content: attr(data-tooltip);
  font-size: 9px;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  transform: translate(3px, -50%);
  transition: opacity var(--motion), transform var(--motion);
}
.category-manager-button:hover::after,
.category-manager-button:focus-visible::after { opacity: 1; transform: translate(0, -50%); }
.catalog-filters {
  margin-bottom: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(50, 29, 57, .025);
}
.filter-level {
  min-height: 52px;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
}
.filter-level-secondary { grid-template-columns: 92px minmax(0, 1fr); border-top: 1px solid #f0ecf3; background: var(--surface-soft); }
.filter-level-label { color: var(--soft); font-size: 11px; font-weight: 500; }
.filter-options { display: flex; min-width: 0; flex-wrap: wrap; align-items: center; gap: 6px; }
.category-filter,
.subcategory-filter {
  min-height: 32px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  transition: color var(--motion), background var(--motion), border-color var(--motion);
}
.category-filter:hover,
.subcategory-filter:hover { background: var(--surface-hover); color: var(--aubergine); }
.category-filter.active {
  border-color: var(--aubergine);
  background: var(--aubergine);
  color: #fff;
  font-weight: 500;
}
.subcategory-filter { border-color: var(--line); background: #fff; }
.subcategory-filter.active { border-color: var(--line-strong); background: var(--surface-selected); color: var(--aubergine); font-weight: 500; }
.project-list { display: grid; gap: 12px; }
.project-card {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 184px;
  grid-template-columns: 250px minmax(0, 1fr) 232px;
  align-items: stretch;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(50, 29, 57, .035);
  transition: border-color var(--motion), box-shadow var(--motion);
}
.project-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-soft); }
.project-card.is-pinned { border-color: #d8c1d6; box-shadow: 0 5px 16px rgba(77, 20, 74, .07); }
.project-card:focus-visible { outline: 2px solid #7d6aa8; outline-offset: 3px; }
.project-card.has-no-actions { grid-template-columns: 250px minmax(0, 1fr); }
.project-manage-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 6px 18px rgba(50, 29, 57, .12);
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity var(--motion), transform var(--motion);
}
.project-card:hover .project-manage-actions,
.project-card:focus-within .project-manage-actions {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.project-manage-actions button {
  min-height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--aubergine);
  font-size: 10px;
  font-weight: 500;
}
.project-manage-actions button:hover { background: var(--surface-hover); }
.project-manage-actions button.is-danger { color: #a02732; }
.project-manage-actions button.is-danger:hover { background: #fff0f1; }
.project-preview {
  position: relative;
  display: block;
  min-height: 182px;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: var(--surface-hover);
}
.project-preview iframe {
  position: absolute;
  inset: 0;
  width: 300%;
  height: 300%;
  border: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  transform: scale(.3334);
  transform-origin: 0 0;
  transition: opacity var(--motion);
}
.project-preview.has-live-preview iframe { opacity: 1; }
.project-preview > img {
  width: 100%;
  height: 100%;
  min-height: 182px;
  display: block;
  object-fit: cover;
}
.project-preview.is-generated { display: grid; place-items: center; padding: 32px; background: var(--surface-selected); }
.project-preview.is-generated > img { width: min(132px, 72%); height: auto; min-height: 0; object-fit: contain; }
.preview-mobile iframe { width: 150%; height: 150%; transform: scale(.6667); transform-origin: 50% 0; }
.preview-label {
  position: absolute;
  left: 10px;
  bottom: 10px;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, .94);
  color: var(--aubergine);
  font-size: 9px;
  box-shadow: 0 3px 10px rgba(50, 29, 57, .08);
}
.project-info { min-width: 0; display: flex; flex-direction: column; padding: 20px 24px; }
.project-meta { display: flex; align-items: center; justify-content: space-between; gap: 16px; color: var(--soft); font-size: 10px; }
.project-meta-actions { display: flex; min-width: 0; align-items: center; justify-content: flex-end; gap: 8px; white-space: nowrap; }
.project-share-button,
.project-pin-button {
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 9px;
  transition: color var(--motion), background var(--motion), border-color var(--motion);
}
.project-share-button { border-radius: 6px; color: var(--aubergine); font-weight: 500; }
.project-share-button:hover,
.project-pin-button:hover { border-color: var(--line-strong); background: var(--surface-hover); color: var(--aubergine); }
.project-pin-button.is-pinned { border-color: #d3b2ce; background: var(--surface-selected); color: var(--aubergine); font-weight: 600; }
.project-labels { display: flex; align-items: center; gap: 7px; }
.project-type {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border-radius: 4px;
  background: var(--surface-selected);
  color: var(--aubergine);
}
.project-status {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
  border-radius: 4px;
  font-weight: 500;
}
.project-status i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.project-status.is-complete { background: #edf8f1; color: #217a4a; }
.project-status.is-progress { background: #fff5e8; color: #a55a0b; }
.project-info h3 { margin: 10px 0 0; overflow: hidden; color: #000; font-size: 18px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.project-info p { max-width: 680px; min-height: 41px; margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.project-details { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: auto; padding-top: 10px; }
.project-tags { display: none; }
.project-tags span { padding: 3px 7px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 9px; }
.project-resources { display: flex; flex-wrap: wrap; gap: 6px; }
.project-resource-link {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-selected);
  color: var(--aubergine);
  font-size: 9px;
  font-weight: 500;
}
.project-resource-link:hover { border-color: var(--aubergine); background: var(--aubergine); color: #fff; }
.project-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px;
  border-left: 1px solid var(--line);
  background: var(--surface-soft);
}
.project-actions:empty { display: none; }
.project-actions-multiple { flex-direction: column; }
.project-link {
  min-width: 92px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  color: var(--aubergine);
  font-size: 11px;
  font-weight: 500;
  transition: color var(--motion), background var(--motion), border-color var(--motion);
}
.project-link:hover { border-color: var(--aubergine); background: var(--aubergine); color: #fff; }
.empty-state { padding: 70px 20px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); text-align: center; }
.empty-state img { width: 28px; height: 28px; opacity: .5; }
.empty-state h3 { margin: 12px 0 5px; font-size: 16px; }
.empty-state p { margin: 0; color: var(--muted); font-size: 12px; }
.empty-state button { min-height: 34px; margin-top: 18px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--surface-hover); color: var(--aubergine); }

.page-footer {
  flex: 0 0 auto;
  margin-top: auto;
  border-top: 1px solid var(--line);
  background: #fff;
}
.page-footer-inner {
  width: min(1180px, calc(100% - 64px));
  display: flex;
  min-height: 72px;
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
  color: var(--soft);
  font-size: 10px;
}

dialog {
  width: min(680px, calc(100% - 32px));
  max-height: min(88dvh, 860px);
  overflow-y: auto;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 16px 44px rgba(50, 29, 57, .2);
}
dialog::backdrop { background: rgba(37, 25, 39, .48); }
.dialog-close {
  position: absolute;
  top: 14px;
  right: 16px;
  z-index: 8;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  transition: color var(--motion), background var(--motion);
}
.dialog-close:hover { background: var(--surface-hover); color: var(--aubergine); }
.dialog-close span { display: block; font-family: Arial, sans-serif; font-size: 22px; font-weight: 300; line-height: 1; transform: translateY(-1px); }
.dialog-kicker { color: var(--brand-red); font-size: 9px; font-weight: 700; letter-spacing: .08em; }
dialog h2 { margin: 8px 0 0; font-size: 25px; }
dialog > p { margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
dialog form { display: grid; gap: 16px; margin-top: 22px; }
#submit-dialog { overflow: hidden; padding: 0; }
#submit-dialog[open] { display: flex; flex-direction: column; }
.project-dialog-header { position: relative; z-index: 3; flex: 0 0 auto; display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding: 26px 26px 20px 32px; border-bottom: 1px solid var(--line); background: #fff; box-shadow: 0 7px 18px rgba(50, 29, 57, .045); }
.project-dialog-header > div { min-width: 0; }
.project-dialog-header h2 { margin-top: 6px; }
.project-dialog-header p { margin: 7px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.project-dialog-header .dialog-close { position: static; flex: 0 0 34px; width: 34px; height: 34px; margin-top: -5px; border: 1px solid transparent; background: #fff; }
.project-dialog-header .dialog-close:hover { border-color: var(--line); background: var(--surface-hover); }
.project-dialog-body { min-height: 0; flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: 20px 32px; scrollbar-gutter: stable; }
#submit-dialog form { margin-top: 0; }
.project-dialog-footer { flex: 0 0 auto; display: flex; min-height: 70px; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 32px 18px; border-top: 1px solid var(--line); background: rgba(255, 255, 255, .98); box-shadow: 0 -8px 24px rgba(50, 29, 57, .06); }
.project-dialog-footer .dialog-actions { flex: 0 0 auto; margin: 0; }
dialog label { display: grid; gap: 6px; color: #454545; font-size: 11px; }
dialog input, dialog select, dialog textarea { width: 100%; min-height: 40px; padding: 0 11px; border: 1px solid var(--line); border-radius: 8px; outline: 0; background: #fff; color: var(--ink); font: inherit; font-size: 12px; }
dialog textarea { min-height: 76px; padding-top: 10px; padding-bottom: 10px; line-height: 1.6; resize: vertical; }
dialog input:focus, dialog select:focus, dialog textarea:focus { border-color: var(--aubergine); box-shadow: 0 0 0 2px rgba(77, 20, 74, .08); }
dialog input[aria-invalid="true"],
dialog textarea[aria-invalid="true"],
.category-selection-tree[aria-invalid="true"] { border-color: #c53a46; box-shadow: 0 0 0 2px rgba(197, 58, 70, .08); }
.field-error { margin: 0; color: #a02732; font-size: 10px; font-weight: 500; line-height: 1.45; }
.field-optional { justify-self: end; color: var(--soft); font-size: 9px; font-weight: 400; }
.form-section { display: grid; gap: 14px; padding: 17px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.form-section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.form-section-heading h3 { margin: 0; color: var(--ink); font-size: 14px; }
.form-section-heading p { margin: 4px 0 0; color: var(--soft); font-size: 10px; }
.form-section-heading > span { min-height: 22px; display: inline-flex; align-items: center; padding: 0 8px; border-radius: 999px; background: var(--surface-selected); color: var(--aubergine); font-size: 9px; font-weight: 600; }
.form-section-heading > span.is-optional { background: #f3f3f3; color: var(--muted); }
.required-field b,
.category-fieldset legend b { color: var(--brand-red); font-size: 12px; }
.category-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.category-fieldset legend { padding: 0; color: #454545; font-size: 11px; }
.status-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.status-fieldset legend { margin-bottom: 8px; padding: 0; color: #454545; font-size: 11px; }
.status-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.status-options label { cursor: pointer; }
.status-options input { position: absolute; opacity: 0; pointer-events: none; }
.status-options span { min-height: 38px; display: flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--muted); font-size: 11px; transition: border-color var(--motion), background var(--motion), color var(--motion), box-shadow var(--motion); }
.status-options i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-options label:first-child span { color: #a55a0b; }
.status-options label:last-child span { color: #217a4a; }
.status-options input:checked + span { border-color: var(--aubergine); background: var(--surface-selected); box-shadow: inset 0 0 0 1px var(--aubergine); }
.status-options input:focus-visible + span { outline: 2px solid var(--aubergine); outline-offset: 2px; }
.category-selection-help { margin: 5px 0 9px; color: var(--soft); font-size: 10px; }
.category-selection-tree {
  height: 300px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}
.category-selection-tree::-webkit-scrollbar { width: 8px; }
.category-selection-tree::-webkit-scrollbar-track { background: transparent; }
.category-selection-tree::-webkit-scrollbar-thumb { border: 2px solid #fff; border-radius: 999px; background: #c9c2ce; }
.category-selection-tree::-webkit-scrollbar-thumb:hover { background: #a99daf; }
.selection-category-root + .selection-category-root { border-top: 1px solid #f0ecf3; }
.selection-category-root > .tree-option { border-top: 0; }
.selection-category-children { padding-left: 28px; border-top: 1px solid #f0ecf3; background: #fdfcfe; }
.selection-category-children .tree-option { border-left: 1px solid var(--line); }
.category-fieldset-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 9px; }
.category-fieldset-toolbar p { margin: 0; color: var(--soft); font-size: 10px; }
.category-fieldset-toolbar button,
.category-root-actions button { min-height: 26px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--aubergine); font-size: 9px; white-space: nowrap; }
.category-fieldset-toolbar button:hover,
.category-root-actions button:hover { border-color: var(--line-strong); background: var(--surface-hover); }
.category-root-actions button.is-danger { color: #a02732; }
.category-inline-editor { margin: 0 0 9px; padding: 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; }
.category-inline-editor > label { margin-bottom: 6px; color: var(--muted); font-size: 10px; }
.category-inline-editor > div { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px; }
.category-inline-editor input { min-height: 34px; }
.category-inline-editor button { min-height: 34px; padding: 0 11px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--muted); font-size: 10px; }
.category-inline-editor button[data-save-category] { border-color: var(--aubergine); background: var(--aubergine); color: #fff; }
.category-tree { overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.category-root + .category-root { border-top: 1px solid #f0ecf3; }
.category-root-header { min-height: 50px; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 2px; padding: 0 9px 0 6px; }
.category-tree-label { min-width: 0; display: grid; gap: 2px; padding: 8px 10px; }
.category-tree-label strong { overflow: hidden; color: var(--ink); font-size: 11px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.category-tree-label small { color: var(--soft); font-size: 9px; }
.category-root-actions { display: flex; align-items: center; gap: 5px; }
.tree-toggle { width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 17px; line-height: 1; transition: color var(--motion), background var(--motion), transform var(--motion); }
.tree-toggle:hover { background: var(--surface-hover); color: var(--aubergine); }
.tree-toggle span { display: block; transform: rotate(90deg); transition: transform var(--motion); }
.tree-toggle[aria-expanded="false"] span { transform: rotate(0deg); }
.tree-option { min-height: 50px; display: grid; grid-template-columns: 18px minmax(0, 1fr); align-items: center; gap: 10px; padding: 8px 12px; border-top: 1px solid #f0ecf3; cursor: pointer; }
.tree-option:first-child { border-top: 0; }
.tree-option:hover { background: var(--surface-hover); }
.tree-option:has(input:checked) { background: var(--surface-selected); box-shadow: inset 3px 0 0 var(--aubergine); }
.tree-option input { width: 16px; min-height: 16px; margin: 0; accent-color: var(--aubergine); }
.tree-option > span { min-width: 0; display: grid; gap: 2px; }
.tree-option strong { color: var(--ink); font-size: 11px; font-weight: 500; }
.tree-option small { color: var(--soft); font-size: 9px; }
.tree-children { border-top: 1px solid #f0ecf3; background: #fdfcfe; }
.tree-child-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; padding: 0 9px 0 28px; border-top: 1px solid #f0ecf3; }
.tree-child-row:first-child { border-top: 0; }
.tree-child-row .category-tree-label { min-height: 48px; justify-content: center; border-left: 1px solid var(--line); }
.tree-child-row > button { min-height: 26px; padding: 0 8px; border: 0; border-radius: 6px; background: transparent; color: #a02732; font-size: 9px; }
.tree-child-row > button:hover { background: #fff0f1; }
.tree-child-actions { display: flex; align-items: center; gap: 2px; }
.tree-child-actions button { min-height: 26px; padding: 0 8px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 9px; white-space: nowrap; }
.tree-child-actions button:hover { background: var(--surface-soft); color: var(--aubergine); }
.tree-child-actions button[data-delete-secondary-category] { color: #a02732; }
.tree-child-actions button[data-delete-secondary-category]:hover { background: #fff0f1; }
.category-project-list { display: grid; border-top: 1px solid #f0ecf3; background: #fff; }
.category-project-list.is-root { padding-left: 34px; }
.category-project-list.is-secondary { grid-column: 1 / -1; margin: 0 -9px 0 -28px; padding-left: 70px; }
.category-project-row { min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 10px 7px 12px; border-left: 1px solid var(--line); border-top: 1px solid #f4f1f5; background: #fff; }
.category-project-row:first-child { border-top: 0; }
.category-project-info { min-width: 0; display: grid; gap: 2px; }
.category-project-info strong { overflow: hidden; color: var(--ink); font-size: 10px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.category-project-info small { color: var(--soft); font-size: 8px; }
.category-project-row button { min-height: 26px; flex: 0 0 auto; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--aubergine); font-size: 9px; }
.category-project-row button:hover { border-color: var(--line-strong); background: var(--surface-hover); }
.category-manager-dialog { width: min(720px, calc(100% - 32px)); max-height: min(86dvh, 820px); }
.category-manager-dialog > p { margin-bottom: 18px; }
.category-manager-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 10px; padding: 12px 13px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-soft); }
.category-manager-toolbar > div { min-width: 0; display: grid; gap: 3px; }
.category-manager-toolbar strong { color: var(--ink); font-size: 12px; }
.category-manager-toolbar span { color: var(--soft); font-size: 9px; }
.category-manager-toolbar button { min-height: 32px; flex: 0 0 auto; padding: 0 12px; border: 1px solid var(--aubergine); border-radius: 7px; background: var(--aubergine); color: #fff; font-size: 10px; }
.category-manager-dialog .category-inline-editor { margin-bottom: 10px; }
.move-project-dialog { width: min(520px, calc(100% - 32px)); }
.move-category-options { display: grid; gap: 8px; margin: 18px 0; padding: 13px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-soft); }
.move-category-options legend { padding: 0 6px; color: var(--muted); font-size: 10px; }
.move-category-group { display: grid; gap: 5px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.move-category-option { min-height: 34px; display: grid; grid-template-columns: 16px minmax(0, 1fr); align-items: center; gap: 8px; padding: 0 8px; border-radius: 6px; cursor: pointer; }
.move-category-option:hover { background: var(--surface-hover); }
.move-category-option.is-secondary { margin-left: 20px; }
.move-category-option input { width: 15px; min-height: 15px; padding: 0; accent-color: var(--aubergine); }
.move-category-option span { color: var(--ink); font-size: 10px; }
.link-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.link-grid-full { grid-column: 1 / -1; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.primary-button,
.secondary-button,
.danger-button { min-height: 36px; padding: 0 16px; border-radius: 999px; font-size: 12px; }
.primary-button { border: 0; background: var(--gradient-brand); color: #fff; }
.secondary-button { border: 1px solid var(--line-strong); background: #fff; color: var(--aubergine); }
.danger-button { border: 0; background: #a02732; color: #fff; }
.danger-button:hover { background: #851c26; }
#copy-status { min-height: 17px; flex: 1 1 auto; color: #217a4a; font-size: 10px; text-align: left; }
.confirm-dialog { width: min(420px, calc(100% - 32px)); padding: 28px; }
.confirm-dialog .delete-project-name { margin: 18px 0 20px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); color: var(--ink); font-size: 12px; font-weight: 500; }
.confirm-dialog .dialog-actions { margin-top: 0; }
.recycle-dialog { width: min(620px, calc(100% - 32px)); }
.recycle-list { display: grid; gap: 10px; margin-top: 22px; }
.recycle-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 18px; padding: 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-soft); }
.recycle-item-info { min-width: 0; display: grid; gap: 5px; }
.recycle-item-info strong { overflow: hidden; color: var(--ink); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.recycle-item-info span { color: var(--soft); font-size: 10px; }
.recycle-item-actions { display: flex; gap: 7px; }
.recycle-item-actions button { min-height: 32px; padding: 0 12px; border-radius: 999px; font-size: 10px; }
.recycle-restore { border: 1px solid var(--line-strong); background: #fff; color: var(--aubergine); }
.recycle-delete { border: 0; background: #fff0f1; color: #a02732; }
.recycle-empty { min-height: 210px; display: grid; place-items: center; align-content: center; gap: 7px; margin-top: 22px; border: 1px dashed var(--line); border-radius: 9px; background: var(--surface-soft); text-align: center; }
.recycle-empty img { width: 28px; height: 28px; margin-bottom: 4px; opacity: .42; }
.recycle-empty strong { font-size: 13px; }
.recycle-empty span { color: var(--soft); font-size: 10px; }
.page-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 100;
  min-width: 240px;
  max-width: min(420px, calc(100% - 40px));
  padding: 14px 20px;
  border: 1px solid #cfe4d8;
  border-radius: 12px;
  background: rgba(242, 251, 246, .98);
  color: #217a4a;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
  text-align: center;
  pointer-events: none;
  transform: translate(-50%, -50%);
  box-shadow: 0 16px 42px rgba(37, 74, 52, .2);
  backdrop-filter: blur(10px);
  margin: 0;
}
.page-toast.is-showing { animation: toast-center-in 220ms cubic-bezier(.2, 0, 0, 1); }
.page-toast.is-error { border-color: #f0cbd0; background: rgba(255, 243, 244, .98); color: #a02732; box-shadow: 0 16px 42px rgba(126, 32, 43, .18); }
@keyframes toast-center-in {
  from { opacity: 0; transform: translate(-50%, calc(-50% + 8px)) scale(.96); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@media (max-width: 1280px) {
  .topbar-inner { grid-template-columns: minmax(220px, 1fr) minmax(280px, 360px); gap: 20px; }
}
@media (max-width: 1100px) {
  .topbar-inner { width: calc(100% - 40px); grid-template-columns: minmax(180px, 1fr) minmax(260px, 340px); gap: 16px; }
  .brand > span { display: none; }
  .topbar-start { gap: 8px; }
  .workspace { width: calc(100% - 40px); }
  .page-footer-inner { width: calc(100% - 40px); }
  .project-card { grid-template-columns: 220px minmax(0, 1fr) 216px; }
  .project-card.has-no-actions { grid-template-columns: 220px minmax(0, 1fr); }
}
@media (max-width: 820px) {
  body { min-width: 0; }
  .topbar { position: relative; }
  .topbar-inner { width: calc(100% - 40px); grid-template-columns: 1fr; gap: 12px; padding: 12px 0; }
  .search { width: 100%; grid-row: 2; }
  .workspace { width: calc(100% - 32px); }
  .page-footer-inner { width: calc(100% - 32px); }
  .page-heading { min-height: 140px; }
  .project-card { grid-template-columns: 150px minmax(0, 1fr); }
  .project-actions { grid-column: 1 / -1; min-width: 0; flex-direction: row; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--line); border-left: 0; }
  .project-preview { min-height: 160px; }
}
@media (max-width: 580px) {
  .brand-wordmark { width: 88px; }
  .page-heading { min-height: auto; align-items: stretch; flex-direction: column; gap: 16px; padding: 22px 0; }
  .home-link { min-height: 28px; }
  .heading-summary { width: 100%; min-width: 0; display: grid; grid-template-columns: 92px minmax(0, 1fr); }
  .project-total { min-height: 54px; grid-column: 1; grid-row: 1; padding: 8px; }
  .heading-summary .submit-button { min-height: 54px; grid-column: 2; grid-row: 1; border-top: 0; border-left: 1px solid rgba(255, 255, 255, .22); }
  .project-total strong { font-size: 20px; }
  .project-total span { margin-top: 3px; }
  .catalog-filters { margin-top: 2px; }
  .recycle-button > span { display: none; }
  .recycle-item { grid-template-columns: 1fr; }
  .recycle-item-actions { justify-content: flex-end; }
  .filter-level { grid-template-columns: 1fr; gap: 7px; padding: 11px 12px 12px; }
  .filter-options { flex-wrap: nowrap; margin-right: -12px; padding-right: 12px; overflow-x: auto; scrollbar-width: none; }
  .filter-options::-webkit-scrollbar { display: none; }
  .category-filter, .subcategory-filter { flex: 0 0 auto; }
  .project-card { grid-template-columns: 1fr; }
  .project-card.has-no-actions { grid-template-columns: 1fr; }
  .project-preview { min-height: 190px; border-right: 0; border-bottom: 1px solid var(--line); }
  .project-info { padding: 18px; }
  .project-actions { grid-column: auto; }
  .page-footer-inner { align-items: flex-start; flex-direction: column; justify-content: center; gap: 5px; }
  dialog { padding: 24px 18px 20px; }
  #submit-dialog { padding: 0; }
  .project-dialog-header { padding: 22px 18px 16px; }
  .project-dialog-body { padding: 16px 18px; }
  .project-dialog-footer { min-height: 68px; padding: 12px 18px 16px; }
  .form-section { padding: 14px; }
  .link-grid { grid-template-columns: 1fr; }
  .link-grid-full { grid-column: auto; }
  .dialog-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .project-dialog-footer { display: block; }
  .project-dialog-footer .dialog-actions { margin-top: 8px; }
  .primary-button, .secondary-button, .danger-button { width: 100%; }
}
@media (hover: none) {
  .project-manage-actions { opacity: 1; transform: none; pointer-events: auto; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}

/* Permission system: additive styles that preserve the established directory UI. */
.topbar-inner { grid-template-columns: minmax(280px, 1fr) minmax(280px, 360px) auto; gap: 18px; }
.account-actions { justify-self: end; display: flex; align-items: center; gap: 8px; }
.account-button {
  min-width: 126px;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 10px 4px 5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--ink);
  text-align: left;
}
.account-button:hover { border-color: var(--line-strong); background: var(--surface-hover); }
.account-actions.is-loading .account-button {
  cursor: wait;
  pointer-events: none;
}
.account-actions.is-loading .account-avatar {
  background: #ded9e2;
  color: transparent;
}
.account-actions.is-loading .account-copy strong,
.account-actions.is-loading .account-copy small {
  width: 70px;
  overflow: hidden;
  border-radius: 3px;
  background: #e8e4ea;
  color: transparent;
  white-space: nowrap;
}
.account-actions.is-loading .account-copy small { width: 42px; }
.account-avatar,
.profile-avatar {
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: var(--aubergine);
  color: #fff;
  font-weight: 700;
  text-transform: uppercase;
}
.account-avatar { width: 32px; height: 32px; flex: 0 0 32px; font-size: 12px; }
.account-copy { min-width: 0; display: grid; gap: 1px; }
.account-copy strong { max-width: 80px; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.account-copy small { color: var(--soft); font-size: 8px; }

body.auth-pending > .topbar,
body.auth-pending > main {
  visibility: hidden;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 24px;
  background: rgba(251, 249, 252, .88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.auth-gate[hidden] { display: none; }
.auth-card {
  width: min(460px, 100%);
  margin: auto;
  padding: 32px;
  border: 1px solid #e4dce8;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(50, 28, 67, .14);
}
.auth-brand { color: #e5231f; font-size: 24px; font-weight: 800; }
.auth-card > .workspace-badge { display: inline-flex; min-height: 27px; margin-top: 24px; padding: 0 9px; border-radius: 6px; font-size: 11px; font-weight: 800; }
.auth-card h1 { margin: 15px 0 24px; color: #111; font-size: 28px; line-height: 1.25; }
.auth-card > p { margin: 0 0 24px; color: var(--muted); font-size: 13px; line-height: 1.75; }
.auth-card form { display: grid; gap: 15px; }
.auth-card label,
.permission-dialog label { display: block; color: var(--ink); font-size: 11px; font-weight: 600; }
.auth-card label b { color: var(--brand-red); }
.auth-card input,
.permission-dialog textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink);
}
.auth-card input { min-height: 48px; margin-top: 8px; padding: 0 14px; border-radius: 10px; }
.permission-dialog textarea { min-height: 104px; margin-top: 7px; padding: 12px; resize: vertical; }
.account-application-dialog textarea { min-height: 82px; }
.auth-card input:focus,
.permission-dialog textarea:focus { border-color: var(--aubergine); outline: 0; box-shadow: 0 0 0 2px rgba(77, 20, 74, .08); background: #fff; }
.project-admin-form { display: grid; gap: 14px; }
.project-admin-form input,
.project-admin-form select { width: 100%; min-height: 42px; margin-top: 7px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); color: var(--ink); }
.project-admin-form input:focus,
.project-admin-form select:focus { border-color: var(--aubergine); outline: 0; box-shadow: 0 0 0 2px rgba(77, 20, 74, .08); background: #fff; }
.project-admin-form label b { color: var(--brand-red); }
.inheritance-notice {
  margin: 0;
  padding: 11px 12px;
  border: 1px solid #eadfca;
  border-radius: 8px;
  background: #fffaf0;
  color: #8a5a18;
  font-size: 10px;
  line-height: 1.6;
}
.auth-error { margin: 0; padding: 9px 11px; border-radius: 7px; background: #fff0f1; color: #a02732; font-size: 11px; }
.auth-submit {
  min-height: 46px;
  border: 1px solid var(--aubergine);
  border-radius: 10px;
  background: var(--aubergine);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}
.auth-submit:hover { background: #3e103b; }
.auth-submit:disabled { cursor: wait; opacity: .62; }
.auth-apply-link {
  min-height: 46px;
  display: inline-flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border: 1px solid #d9cddd;
  border-radius: 10px;
  background: #fff;
  color: var(--aubergine);
  font-size: 12px;
  font-weight: 700;
}
.auth-apply-link:hover { border-color: var(--aubergine); background: var(--surface-selected); color: #3e103b; }
.auth-secondary-actions { display: flex; justify-content: space-between; gap: 10px; }
.account-application-status {
  display: grid;
  gap: 7px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
}
.account-application-status[hidden] { display: none; }
.account-application-status > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.account-application-status strong { color: var(--ink); font-size: 11px; }
.auth-card > small { display: block; margin-top: 18px; color: var(--soft); font-size: 9px; line-height: 1.6; text-align: center; }

.personal-center { flex: 1 0 auto; padding-top: 52px; }
.personal-heading { display: block; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.personal-heading h1 { margin: 12px 0 5px; color: #111; font-size: 31px; line-height: 1.2; }
.personal-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.personal-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 28px; padding: 28px 0 48px; }
.personal-nav { align-self: start; display: grid; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.personal-nav button { min-height: 48px; display: flex; align-items: center; justify-content: space-between; padding: 0 15px; border: 0; border-bottom: 1px solid #f0ecf3; background: #fff; color: var(--muted); font-size: 12px; text-align: left; }
.personal-nav button:last-child { border-bottom: 0; }
.personal-nav button:hover { background: var(--surface-hover); color: var(--aubergine); }
.personal-nav button.active { background: var(--surface-selected); color: var(--aubergine); font-weight: 600; box-shadow: inset 3px 0 var(--aubergine); }
.personal-nav button span { min-width: 22px; min-height: 20px; display: inline-grid; place-items: center; border-radius: 999px; background: var(--surface-hover); font-size: 9px; }
.personal-content { min-width: 0; }
.personal-panel { min-height: 440px; container-type: inline-size; }
.panel-heading { min-height: 72px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.panel-heading span { color: var(--brand-red); font-size: 9px; font-weight: 700; letter-spacing: .08em; }
.panel-heading h2 { margin: 5px 0 3px; color: #111; font-size: 23px; }
.panel-heading p { margin: 0; color: var(--soft); font-size: 11px; }
.account-add-button { flex: 0 0 auto; min-height: 36px; padding: 0 13px; border: 1px solid var(--aubergine); border-radius: 7px; background: var(--aubergine); color: #fff; font-size: 10px; font-weight: 600; }
.account-add-button:hover { background: #3e103b; }
.panel-heading-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }
.panel-heading-actions .secondary-button { min-height: 36px; }
.panel-subheading { margin: 24px 0 10px; color: var(--ink); font-size: 13px; }
.history-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.history-summary article { display: grid; gap: 7px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.history-summary span { color: var(--soft); font-size: 10px; }
.history-summary strong { color: var(--aubergine); font-size: 22px; line-height: 1.2; }
.history-list .data-row-main strong { white-space: normal; }
.profile-card { display: grid; grid-template-columns: 58px minmax(160px, 1fr) auto; align-items: center; gap: 16px; padding: 22px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 4px 16px rgba(50, 29, 57, .04); }
.profile-avatar { width: 58px; height: 58px; font-size: 20px; }
.profile-primary { display: grid; gap: 4px; }
.profile-primary strong { color: #111; font-size: 18px; }
.profile-primary span { color: var(--soft); font-size: 10px; }
.profile-actions { justify-self: end; display: flex; align-items: center; gap: 8px; }
.role-badge { padding: 5px 9px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface-selected); color: var(--aubergine); font-size: 9px; font-weight: 600; }
.profile-actions button { min-height: 30px; padding: 0 9px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--muted); font-size: 9px; }
.profile-actions button:hover { border-color: var(--line-strong); background: var(--surface-hover); color: var(--aubergine); }
.profile-card dl { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 2px 0 0; padding-top: 16px; border-top: 1px solid #f0ecf3; }
.profile-card dl div { display: grid; gap: 4px; }
.profile-card dt { color: var(--soft); font-size: 9px; }
.profile-card dd { margin: 0; color: var(--ink); font-size: 11px; }
.overview-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.overview-grid article { min-height: 132px; display: grid; align-content: start; gap: 7px; padding: 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.overview-grid article span { color: var(--muted); font-size: 10px; }
.overview-grid article strong { color: var(--aubergine); font-size: 24px; line-height: 1.2; }
.overview-grid article small { color: var(--soft); font-size: 9px; line-height: 1.6; }
.desktop-notification-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 12px;
  padding: 17px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.desktop-notification-card[hidden] { display: none; }
.desktop-notification-card > div { display: grid; gap: 4px; }
.desktop-notification-card span { color: var(--brand-red); font-size: 9px; font-weight: 700; letter-spacing: .08em; }
.desktop-notification-card strong { color: var(--ink); font-size: 13px; }
.desktop-notification-card p { margin: 0; color: var(--soft); font-size: 10px; line-height: 1.5; }
.desktop-notification-card .secondary-button { flex: 0 0 auto; min-height: 34px; }
.desktop-notification-card .secondary-button.is-enabled { border-color: #bedac8; background: #f0faf3; color: #27643c; }
.member-access-card { position: relative; overflow: hidden; padding: 24px; border: 1px solid #d9d1ee; border-radius: 14px; background: #fff; box-shadow: 0 12px 38px rgba(50, 29, 57, .07); }
.member-access-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--aubergine); }
.member-access-identity { display: grid; gap: 5px; padding-bottom: 20px; border-bottom: 1px solid #efebf3; }
.member-access-identity > span,
.member-section-heading span { color: var(--brand-red); font-size: 9px; font-weight: 700; letter-spacing: .08em; }
.member-it-code-row { display: flex; align-items: center; gap: 10px; }
.member-access-identity strong { color: #111; font-size: 28px; letter-spacing: .02em; }
.member-access-identity small { color: var(--soft); font-size: 10px; }
.readonly-badge { width: max-content; flex: 0 0 auto; padding: 5px 9px; border-radius: 999px; background: #ece7f8; color: var(--aubergine); font-size: 9px; font-weight: 700; }
.member-access-projects { margin-top: 20px; }
.member-section-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 11px; }
.member-section-heading h3 { margin: 4px 0 0; color: #111; font-size: 16px; }
.member-section-heading > strong { color: var(--aubergine); font-size: 24px; }
.member-project-list { display: grid; gap: 8px; }
.member-project-row { min-height: 64px; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 13px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-soft); }
.member-project-row > div { min-width: 0; display: grid; gap: 3px; }
.member-project-row > div strong { overflow: hidden; color: #111; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.member-project-row > div span { color: var(--soft); font-size: 9px; }
.member-project-row > a,
.member-directory-button { min-height: 32px; display: inline-flex; align-items: center; padding: 0 11px; border: 1px solid var(--aubergine); border-radius: 7px; background: #fff; color: var(--aubergine); font-size: 9px; }
.member-project-row > a:hover,
.member-directory-button:hover { background: var(--aubergine); color: #fff; }
.member-logout { margin-top: 20px; min-height: 34px; padding: 0 11px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--muted); font-size: 9px; }
.member-logout:hover { border-color: var(--line-strong); background: var(--surface-hover); color: var(--aubergine); }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 18px; padding: 18px; border: 1px solid #ead4d5; border-radius: 10px; background: #fffafa; }
.danger-zone strong { color: #6f1f25; font-size: 12px; }
.danger-zone p { margin: 5px 0 0; color: #8f6668; font-size: 10px; line-height: 1.6; }
.danger-zone button { flex: 0 0 auto; min-height: 36px; padding: 0 12px; border: 1px solid #b64a51; border-radius: 7px; background: #fff; color: #a02732; font-size: 10px; }
.permission-project-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.permission-project-card { min-width: 0; min-height: 154px; display: flex; flex-direction: column; align-items: stretch; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); font: inherit; text-align: left; transition: border-color var(--motion), box-shadow var(--motion), transform var(--motion); }
.permission-project-card:hover { border-color: #c8bbdc; box-shadow: 0 9px 24px rgba(50, 29, 57, .08); transform: translateY(-1px); }
.permission-project-card:focus-visible { outline: 2px solid rgba(77, 20, 74, .28); outline-offset: 2px; }
.permission-project-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.permission-project-card-top span { color: var(--brand-red); font-size: 9px; font-weight: 700; letter-spacing: .08em; }
.permission-project-card-top strong { flex: 0 0 auto; padding: 4px 8px; border-radius: 999px; background: var(--surface-selected); color: var(--aubergine); font-size: 9px; font-weight: 600; }
.permission-project-card h3 { margin: 18px 0 6px; overflow: hidden; color: #111; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.permission-project-card p { margin: 0; overflow: hidden; color: var(--soft); font-size: 9px; line-height: 1.6; text-overflow: ellipsis; white-space: nowrap; }
.permission-project-card-action { margin-top: auto; padding-top: 18px; color: var(--aubergine); font-size: 10px; font-weight: 600; }
.permission-users-dialog { width: min(760px, calc(100% - 32px)); max-height: min(82dvh, 760px); padding: 30px; overflow: hidden; }
.permission-users-dialog[open] { display: flex; flex-direction: column; }
.permission-users-dialog-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-top: 8px; padding-right: 24px; }
.permission-users-dialog-heading > div { min-width: 0; }
.permission-users-dialog-heading h2 { overflow: hidden; margin: 0; text-overflow: ellipsis; white-space: nowrap; }
.permission-users-dialog-heading p { margin: 8px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.permission-users-dialog-list { min-height: 120px; margin-top: 22px; overflow-y: auto; overscroll-behavior: contain; padding-right: 3px; }
.permission-users-dialog-list .empty-panel { min-height: 180px; }
.global-permissions-dialog { width: min(1040px, calc(100% - 32px)); max-height: min(88dvh, 880px); padding: 30px; overflow: hidden; }
.global-permissions-dialog[open] { display: flex; flex-direction: column; }
.global-permissions-heading { margin-top: 8px; padding-right: 30px; }
.global-permissions-heading h2 { margin: 0; color: #111; font-size: 24px; }
.global-permissions-heading p { margin: 8px 0 0; color: var(--muted); font-size: 11px; line-height: 1.65; }
.global-permissions-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 20px; }
.global-permissions-summary article { display: grid; gap: 5px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-soft); }
.global-permissions-summary span { color: var(--soft); font-size: 9px; }
.global-permissions-summary strong { color: var(--aubergine); font-size: 20px; }
.global-permissions-search { display: grid; grid-template-columns: auto minmax(220px, 360px); align-items: center; justify-content: end; gap: 10px; margin-top: 16px; color: var(--muted); font-size: 10px; }
.global-permissions-search input { min-height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); color: var(--ink); }
.global-permissions-search input:focus { border-color: var(--aubergine); outline: 0; box-shadow: 0 0 0 2px rgba(77, 20, 74, .08); background: #fff; }
.global-permissions-list { min-height: 180px; margin-top: 14px; padding-right: 3px; overflow-y: auto; overscroll-behavior: contain; }
.global-permission-user { display: grid; gap: 14px; padding: 17px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.global-permission-user + .global-permission-user { margin-top: 10px; }
.global-permission-user-header { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 14px; }
.global-permission-user-identity { min-width: 0; display: grid; gap: 4px; }
.global-permission-user-identity strong { color: #111; font-size: 13px; }
.global-permission-user-identity span { color: var(--soft); font-size: 9px; }
.global-permission-user-badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.global-permission-user-badges .status-pill { white-space: nowrap; }
.global-permission-user-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.global-account-delete { min-height: 32px; padding: 0 10px; border: 1px solid #e8c9cd; border-radius: 7px; background: #fff; color: #a02732; font-size: 9px; }
.global-account-delete:hover { border-color: #a02732; background: #fff0f1; }
.global-permission-scope { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 12px; padding-top: 12px; border-top: 1px solid #f0ecf3; }
.global-permission-scope > strong { color: var(--muted); font-size: 10px; }
.global-permission-items { display: grid; gap: 7px; }
.global-permission-item { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; background: var(--surface-soft); }
.global-permission-item-copy { min-width: 0; display: grid; gap: 3px; }
.global-permission-item-copy strong { overflow: hidden; color: var(--ink); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.global-permission-item-copy span { color: var(--soft); font-size: 8px; }
.global-permission-item button { min-height: 30px; padding: 0 9px; border: 1px solid #e8c9cd; border-radius: 7px; background: #fff; color: #a02732; font-size: 9px; }
.global-permission-item button:hover { border-color: #a02732; background: #fff0f1; }
.global-permission-item-access { color: var(--soft); font-size: 9px; white-space: nowrap; }
.global-permission-empty { color: var(--soft); font-size: 9px; line-height: 1.6; }
.grant-permission-field[hidden] { display: none; }
.grant-directory-field { min-width: 0; margin: 0; padding: 0; border: 0; }
.grant-directory-field legend { width: 100%; margin: 0 0 8px; padding: 0; color: #454545; font-size: 11px; font-weight: 600; line-height: 1.45; }
.grant-directory-field legend b { color: var(--brand-red); }
.grant-directory-toolbar { min-height: 40px; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0; padding: 0 18px; border: 1px solid var(--line); border-radius: 8px 8px 0 0; background: var(--surface-soft); }
.grant-directory-toolbar label { display: inline-flex; align-items: center; gap: 7px; color: var(--aubergine); font-size: 10px; cursor: pointer; }
.grant-directory-toolbar input,
.grant-directory-option input { width: 15px; height: 15px; min-height: 15px; flex: 0 0 15px; margin: 0; padding: 0; accent-color: var(--aubergine); }
.grant-directory-toolbar span { color: var(--soft); font-size: 9px; }
.grant-directory-options { max-height: 168px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; overflow-y: auto; padding: 10px 9px; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 8px 8px; background: #fff; }
.permission-dialog .grant-directory-option { min-width: 0; min-height: 38px; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 0 9px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); font-size: 10px; line-height: 1.4; cursor: pointer; }
.grant-directory-option:has(input:checked) { border-color: var(--line-strong); background: var(--surface-selected); color: var(--aubergine); }
.grant-directory-empty { grid-column: 1 / -1; padding: 12px; color: var(--soft); font-size: 10px; text-align: center; }

@container (max-width: 850px) {
  .permission-project-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@container (max-width: 560px) {
  .permission-project-list { grid-template-columns: minmax(0, 1fr); }
  .grant-directory-options { grid-template-columns: minmax(0, 1fr); }
}
.data-list { display: grid; gap: 9px; }
.data-row { display: grid; grid-template-columns: minmax(180px, 1.35fr) minmax(110px, .7fr) minmax(110px, .7fr) auto auto; align-items: center; gap: 14px; min-height: 72px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.data-row-main { min-width: 0; display: grid; gap: 4px; }
.data-row-main strong { overflow: hidden; color: #111; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.data-row-main span,
.data-cell span { color: var(--soft); font-size: 9px; }
.data-cell { display: grid; gap: 4px; }
.data-cell strong { color: var(--muted); font-size: 10px; font-weight: 500; }
.data-row-actions { display: flex; justify-content: flex-end; gap: 7px; }
.data-row-actions button,
.data-row-actions a { min-height: 32px; display: inline-flex; align-items: center; padding: 0 10px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--aubergine); font-size: 9px; }
.data-row-actions button:hover,
.data-row-actions a:hover { border-color: var(--aubergine); background: var(--aubergine); color: #fff; }
.data-row-actions .is-danger { color: #a02732; }
.inline-select { min-height: 32px; padding: 0 25px 0 9px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--muted); font-size: 9px; }
.role-editor-select { min-width: 118px; }
.role-editor-select:disabled { background: var(--surface-hover); color: var(--soft); cursor: not-allowed; }
.status-pill { width: max-content; padding: 4px 8px; border-radius: 999px; background: #edf8f1; color: #217a4a; font-size: 9px; font-weight: 600; }
.status-pill.is-pending { background: #fff5e8; color: #a55a0b; }
.status-pill.is-rejected,
.status-pill.is-revoked,
.status-pill.is-deleted,
.status-pill.is-permission_deleted { background: #fff0f1; color: #a02732; }
.status-pill.is-disabled { background: #fff5e8; color: #a55a0b; }
.status-pill.is-expired,
.status-pill.is-cancelled,
.status-pill.is-project_archived,
.status-pill.is-directory_revoked,
.status-pill.is-superseded { background: #f0eef2; color: #6e6870; }
.empty-panel { min-height: 260px; display: grid; place-items: center; padding: 30px; border: 1px dashed var(--line-strong); border-radius: 10px; background: var(--surface-soft); color: var(--soft); font-size: 11px; text-align: center; }
.permission-dialog { width: min(520px, calc(100% - 32px)); padding: 30px; }
.permission-dialog > p { margin: 8px 0 22px; color: var(--muted); font-size: 11px; line-height: 1.7; }
.permission-dialog .dialog-actions { margin-top: 20px; }
.share-link-field { display: grid; gap: 7px; color: var(--ink); font-size: 11px; font-weight: 500; }
.share-link-field input { background: var(--surface-soft); color: var(--muted); font-size: 11px; }
.share-link-status { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.share-link-status > div { display: grid; gap: 5px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); }
.share-link-status span { color: var(--soft); font-size: 9px; }
.share-link-status strong { color: var(--ink); font-size: 10px; font-weight: 600; }
.share-link-status strong.is-active { color: #217a4a; }
.share-link-status strong.is-inactive { color: #a02732; }
.share-expiry-field { display: grid; gap: 7px; margin-top: 12px; color: var(--ink); font-size: 11px; font-weight: 500; }
.share-expiry-field select { width: 100%; min-height: 38px; padding: 0 34px 0 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--muted); }
.permission-dialog > .share-link-help { margin: 10px 0 0; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-selected); color: var(--muted); font-size: 10px; }
.share-link-actions { flex-wrap: wrap; }
.share-link-actions button:disabled { cursor: not-allowed; opacity: .48; }
.shared-project-application-dialog { width: min(560px, calc(100% - 32px)); max-height: min(88dvh, 820px); overflow-y: auto; }
.shared-project-application-dialog textarea { min-height: 82px; }
.project-card.is-locked .project-preview { cursor: default; }
.project-card.is-locked .project-preview::after { content: "申请权限后查看项目入口"; position: absolute; inset: auto 12px 12px; padding: 7px 9px; border: 1px solid rgba(255,255,255,.8); border-radius: 7px; background: rgba(255,255,255,.92); color: var(--aubergine); font-size: 9px; text-align: center; }
.project-apply-button { min-height: 36px; padding: 0 14px; border: 1px solid var(--aubergine); border-radius: 999px; background: #fff; color: var(--aubergine); font-size: 10px; font-weight: 600; }
.project-apply-button:hover { background: var(--aubergine); color: #fff; }
.project-apply-button:disabled { border-color: var(--line); background: var(--surface-hover); color: var(--soft); cursor: default; }

/* Keep every native dropdown indicator aligned to the shared 16px field gutter. */
select:not([multiple]) {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 44px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14' fill='none'%3E%3Cpath d='m4 5.5 3 3 3-3' stroke='%23646A73' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 14px 14px;
}

body[data-role="MEMBER"] [data-manager-ui] { display: none !important; }

@media (max-width: 1100px) {
  .topbar-inner { grid-template-columns: minmax(240px, 1fr) minmax(240px, 320px) auto; }
  .account-button { min-width: 42px; padding-right: 5px; }
  .account-copy { display: none; }
  .personal-layout { grid-template-columns: 180px minmax(0, 1fr); }
  .data-row { grid-template-columns: minmax(180px, 1fr) minmax(110px, .8fr) auto auto; }
  .data-row .data-cell:nth-of-type(2) { display: none; }
}

@media (max-width: 759px) {
  .topbar-inner { grid-template-columns: minmax(0, 1fr) auto; }
  .topbar .search { grid-column: 1 / -1; grid-row: 2; width: 100%; }
  .account-actions { grid-column: 2; grid-row: 1; }
  .account-button { border-radius: 999px; }
  .personal-center { padding-top: 30px; }
  .personal-heading h1 { font-size: 27px; }
  .personal-layout { grid-template-columns: 1fr; gap: 20px; padding-top: 20px; }
  .personal-nav { grid-auto-flow: column; grid-auto-columns: max-content; display: grid; overflow-x: auto; border-radius: 9px; }
  .personal-nav button { min-width: 105px; border-right: 1px solid #f0ecf3; border-bottom: 0; }
  .personal-nav button.active { box-shadow: inset 0 -3px var(--aubergine); }
  .desktop-notification-card { align-items: stretch; flex-direction: column; }
  .desktop-notification-card .secondary-button { width: 100%; }
  .profile-card { grid-template-columns: 50px minmax(0, 1fr); padding: 18px; }
  .profile-avatar { width: 50px; height: 50px; }
  .profile-actions { grid-column: 1 / -1; justify-self: start; }
  .profile-card dl { grid-template-columns: 1fr; }
  .overview-grid { grid-template-columns: 1fr; }
  .history-summary { grid-template-columns: 1fr; }
  .panel-heading { align-items: stretch; flex-direction: column; }
  .panel-heading-actions { align-items: stretch; flex-direction: column; }
  .global-permissions-dialog { width: calc(100% - 20px); padding: 22px 18px; }
  .global-permissions-summary { grid-template-columns: 1fr; }
  .global-permissions-search { grid-template-columns: 1fr; justify-content: stretch; }
  .global-permission-user-header,
  .global-permission-scope { grid-template-columns: 1fr; }
  .global-permission-user-badges { justify-content: flex-start; }
  .global-permission-user-actions { align-items: flex-start; flex-direction: column; }
  .overview-grid article { min-height: 104px; }
  .danger-zone { align-items: flex-start; flex-direction: column; }
  .data-row { grid-template-columns: 1fr; gap: 9px; }
  .data-row .data-cell { display: grid !important; }
  .data-row-actions { justify-content: flex-start; flex-wrap: wrap; }
  .auth-gate { padding: 14px; }
  .auth-card { padding: 28px 22px 24px; border-radius: 13px; }
  .auth-card h1 { font-size: 24px; }
  .member-access-card { padding: 20px; }
  .member-project-row { grid-template-columns: minmax(0, 1fr) auto; }
  .member-project-row > a,
  .member-directory-button { grid-column: 1 / -1; justify-content: center; }
}
