:root {
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  color: #202c3c;
  background: #f3f6fa;
  --muted: #536377;
  --line: #e1e7ee;
  --accent: #145b50;
  --nav: #172639;
  --white: #fff;
  --header-height: 60px;
  --header-inset: var(--workspace-header-height, var(--header-height));
  --page-padding: clamp(15px, 3vw, 42px);
  scroll-padding-top: calc(var(--header-inset) + 8px);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; position: relative; }
body, h1, h2, p { margin: 0; }

h2 { font-size: 1.1rem; }
a, button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: wait; }
:where(button, a, input):focus-visible { outline: 3px solid #36a594; outline-offset: 3px; }
[hidden] { display: none !important; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 9;
  background: var(--nav);
  color: white;
  transition: transform .18s ease-out;
}
:root.header-hidden { --header-inset: 0px; }
.header-hidden .site-header { transform: translateY(-100%); pointer-events: none; }
.site-header-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--header-height);
  max-width: 1540px;
  margin: auto;
  padding: 6px var(--page-padding);
}
.site-title { min-width: 0; font-size: clamp(1rem, 2vw, 1.25rem); line-height: 1.25; }
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: inherit;
  font-weight: 700;
  text-decoration: none;
}
.brand-icon {
  display: block;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  object-fit: contain;
}
.site-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; margin-inline-start: auto; }
.account-name {
  max-inline-size: clamp(3.5em, 15vw, 13em);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .875rem;
}
.content { max-width: 1540px; margin: auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 14px var(--page-padding) 42px; }
.library-page { display: flex; flex-direction: column; }
.library-page > main { flex: 1; }
.site-footer { border-top: 1px solid #dbe5eb; background: #edf3f7; color: var(--muted); font-size: .875rem; }
.site-footer nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 14px;
  max-width: 1540px;
  margin: auto;
  padding: 8px var(--page-padding);
}
.site-footer-label { font-size: .8125rem; font-weight: 600; }
.site-footer a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 4px 12px;
  border: 1px solid #c9dcd5;
  border-radius: 999px;
  background: var(--white);
  color: var(--accent);
  font-weight: 650;
  text-decoration: none;
}
.site-footer a:hover { border-color: #9ebeb3; background: #e4f2ed; }
.site-footer a:focus-visible { outline: 2px solid #238574; outline-offset: 2px; }
.site-footer-arrow { font-size: .9375rem; line-height: 1; }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: 13px; padding: 19px 20px; min-width: 0; }
.secondary { min-height: 42px; border-radius: 8px; padding: 10px 15px; font-size: .88rem; font-weight: 650; white-space: nowrap; }
.secondary { border: 1px solid #c9d5e1; background: white; color: #1e354c; }
.quiet { border: 0; background: none; padding: 8px; color: var(--accent); font-weight: 700; }
.actions { display: flex; gap: 9px; flex-wrap: wrap; }
.feedback { color: var(--accent); font-size: .86rem; }
.feedback:empty { display: none; }
.empty { color: var(--muted); font-size: .87rem; padding: 5px 0; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: .82rem; }
th, td { padding: 9px 8px; border-bottom: 1px solid #eaf0f4; }
th { color: var(--muted); font-weight: 600; white-space: nowrap; }
td:first-child, th:first-child { padding-inline-start: 0; }
tbody tr:last-child td { border-bottom: 0; }

@media (max-width: 620px) {
  :root { --header-height: 54px; }
  .library-page { min-height: 100dvh; }
  .site-footer { padding-bottom: env(safe-area-inset-bottom); }
  .site-header-inner { gap: 6px; padding: 5px 12px; }
  .site-actions { gap: 8px; }
  .brand { gap: 7px; }
  .brand-icon { width: 30px; height: 30px; }
  .content { padding-top: 10px; }
  .panel { padding: 15px; }
}

.library-explorer {
  display: grid;
  grid-template-columns: fit-content(min(34%, 420px)) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.library-explorer.tree-collapsed { grid-template-columns: minmax(0, 1fr); }
.library-main { min-width: 0; display: grid; gap: 12px; }
.library-tree {
  min-inline-size: 220px;
  position: sticky;
  top: calc(var(--header-inset) + 12px);
  max-height: calc(100vh - var(--header-inset) - 24px);
  overflow: auto;
  padding: 14px 11px;
}
.library-tree h2 { padding: 0 6px 10px; }

.folder-tree { list-style: none; margin: 0; padding: 0; }
.folder-tree .folder-tree { margin-left: 13px; padding-left: 4px; border-left: 1px solid var(--line); }
.tree-line { min-width: 0; display: flex; align-items: start; gap: 2px; border-radius: 7px; }
.tree-line:hover { background: #f2f6fa; }
.tree-folder, .tree-expander, .link-control, .file-name {
  background: none;
  border: 0;
  color: inherit;
  text-align: left;
  text-decoration: none;
}
.tree-expander, .tree-spacer { flex: 0 0 29px; }
.tree-expander { min-height: 33px; padding: 4px; text-align: center; color: #39536a; }
.tree-folder, .file-name {
  display: flex;
  align-items: baseline;
  gap: 9px;
  min-width: 0;
  overflow-wrap: anywhere;
  border-radius: 6px;
  font-size: .9rem;
}
.tree-folder { width: 100%; padding: 7px 5px; }
.tree-folder[aria-current] { background: #dcefe8; color: #145b50; font-weight: 650; }
.tree-more { padding: 5px 4px; color: var(--muted); font-size: .85rem; }

.folder-icon {
  position: relative;
  display: inline-block;
  flex: 0 0 15px;
  height: 11px;
  border-radius: 2px;
  background: #edbd57;
}
.folder-icon::before { content: ''; position: absolute; left: 1px; top: -3px; width: 7px; height: 4px; border-radius: 2px; background: #edbd57; }

.file-icon {
  flex: 0 0 24px;
  height: 24px;
  background: url('/static/file-icons.webp') no-repeat 0 0 / 264px 24px;
}

.file-icon--pdf { background-position-x: -24px; }
.file-icon--word { background-position-x: -48px; }
.file-icon--sheet { background-position-x: -72px; }
.file-icon--slides {
  position: relative;
  background: none;
}
.file-icon--slides::before {
  content: '';
  position: absolute;
  inset: 1px 0 2px 5px;
  border-radius: 1px;
  background: linear-gradient(#ff926f 0 25%, #ee714b 25% 50%, #d65330 50% 75%, #b53a20 75%);
  box-shadow: 0 1px 2px rgb(0 0 0 / 22%);
}
.file-icon--slides::after {
  content: 'P';
  position: absolute;
  top: 6px;
  left: 0;
  display: grid;
  place-items: center;
  width: 12px;
  height: 12px;
  border-radius: 1px;
  background: #b8391e;
  color: #fff;
  font: 700 9px/1 "Segoe UI", sans-serif;
  box-shadow: 1px 1px 2px rgb(85 23 12 / 34%);
}
.file-icon--image { background-position-x: -120px; }
.file-icon--text { background-position-x: -144px; }
.file-icon--archive { background-position-x: -168px; }
.file-icon--audio { background-position-x: -192px; }
.file-icon--video { background-position-x: -216px; }
.file-icon--cad { background-position-x: -240px; }

.library-folder-heading, .library-path {
  display: flex;
  align-items: baseline;
  gap: 7px;
  flex-wrap: wrap;
  min-width: 0;
}
.library-folder-heading {
  column-gap: 14px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}
#folder-activity { white-space: nowrap; text-decoration: underline; text-underline-offset: .16em; }
.path-separator { color: #7a8b9c; }
.path-current { font-weight: 650; }
.link-control { padding: 2px 0; color: var(--accent); font-size: .9rem; }
.link-control:hover, .file-name:hover { text-decoration: underline; }
.file-name { padding: 0; min-height: 26px; align-items: center; }
button.file-name { width: 100%; }
.file-name > .folder-icon { margin-inline: 4.5px; }
.file-sort {
  display: inline-flex;
  align-items: center;
  gap: .32rem;
  padding: 4px 0;
  margin-block: -4px;
  min-height: 24px;
  color: inherit;
  font: inherit;
  background: transparent;
  border: 0;
}
.file-sort-arrow {
  display: inline-block;
  width: 1em;
  line-height: 1;
  text-align: center;
  color: #687a8e;
  font-weight: 400;
}
.file-table th[aria-sort] .file-sort-arrow { color: var(--accent); font-weight: 750; }
.file-table td { vertical-align: middle; }
.file-date, .file-size, .file-actions { white-space: nowrap; }
.file-table .file-actions { width: 5.75rem; text-align: center; }
.file-more { margin-top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

@media (max-width: 850px), (hover: none) and (pointer: coarse) {
  .library-explorer { display: block; }
  .library-tree {
    min-inline-size: 0;
    position: fixed;
    inset: calc(var(--header-inset) + 6px) var(--page-padding) auto;
    z-index: 8;
    max-height: 65vh;
    max-height: 65dvh;
    overscroll-behavior: contain;
    box-shadow: 0 8px 24px rgb(23 38 57 / 16%);
  }
}

@media (max-width: 620px) {
  .library-files { padding-inline-end: 10px; }
  .file-table-scroll { overflow-x: auto; }
  .file-table {
    --file-size-width: 5.25rem;
    --file-date-width: 10.5rem;
    width: calc(100% + var(--file-size-width) + var(--file-date-width));
    table-layout: fixed;
  }
  .file-table td { padding-block: 5px; }
  .file-table .file-size { width: var(--file-size-width); }
  .file-table .file-actions { width: 4.75rem; padding-inline: 0; }
  .file-table .file-date { width: var(--file-date-width); }
  .file-name { font-size: .86rem; }
}

@media (prefers-reduced-motion: reduce) {
  .site-header { transition: none; }
}

.file-controls { display: flex; justify-content: flex-end; }
.file-action {
  display: inline-grid;
  place-items: center;
  width: 2.375rem;
  height: 2.25rem;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--accent);
  text-decoration: none;
}
.file-action:hover { background: #edf0f2; }
.file-action:focus-visible { outline-color: #666; outline-offset: -3px; }
.file-action--download { --action-image: url('/static/download.webp'); }
.file-action--share { --action-image: url('/static/share.webp'); }
.file-action-icon {
  width: 18px;
  height: 18px;
  background: var(--action-image) center / contain no-repeat;
}
:is(.header-share, .library-tree-toggle, .logout-button) { flex-shrink: 0; width: 44px; height: 44px; }
:is(.header-share, .library-tree-toggle, .logout-button):hover,
.library-tree-toggle[aria-expanded="true"] { background: #29425b; }
:is(.header-share, .library-tree-toggle, .logout-button):focus-visible { outline-color: white; }
.logout-button { color: white; }
.header-share .file-action-icon { width: 21px; height: 21px; filter: brightness(0) invert(1); }
.library-tree-toggle-icon {
  position: relative;
  width: 38px;
  height: 38px;
  background: url('/static/wddf-tree.aff4b25286a0c2d8.webp') left center / 200% 100% no-repeat;
}
.library-tree-toggle[aria-expanded="true"] .library-tree-toggle-icon { background-position: right center; }
.library-tree-toggle-icon::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 9px;
  width: 10px;
  height: 20px;
  box-sizing: border-box;
  color: #c4d2e0;
  border-left: 2px solid;
  background: linear-gradient(currentColor, currentColor) left center / 100% 2px no-repeat;
}

@media (max-width: 620px) {
  .file-action-icon { width: 16px; height: 16px; }
  @supports (mask-image: none) or (-webkit-mask-image: none) {
    .file-action-icon {
      /* Offset two copies of the alpha mask to keep the smaller strokes legible. */
      --action-mask:
        var(--action-image) calc(50% - .15px) calc(50% - .15px) / contain no-repeat,
        var(--action-image) calc(50% + .15px) calc(50% + .15px) / contain no-repeat;
      background: #777;
      -webkit-mask: var(--action-mask);
      mask: var(--action-mask);
    }
  }
}

.share-feedback { position: fixed; right: 16px; bottom: 16px; z-index: 10; background: var(--nav); color: #fff; border-radius: 8px; padding: 12px 16px; }
.share-dialog { width: min(440px, calc(100% - 30px)); color: inherit; }
.share-dialog::backdrop { background: #0d192866; }
.share-dialog form { display: grid; gap: 12px; }
.share-dialog label { font-weight: 650; }
.share-dialog input { min-width: 0; padding: 8px; border: 1px solid #c9d5e1; border-radius: 5px; }
.share-dialog button { justify-self: end; }
.wechat-share { width: 100%; max-width: 36rem; margin-inline: auto; }
.wechat-share h1 { font-size: 1.05rem; line-height: 1.45; overflow-wrap: anywhere; }
#share-page-number { margin: .4rem 0 0; color: var(--nav); font-weight: 650; }
.wechat-share-hint { margin: .8rem 0 .45rem; color: var(--nav); line-height: 1.6; }
.wechat-share .link-control { display: inline-flex; align-items: center; min-height: 44px; }

.login-panel,.share-panel {max-width:26rem;margin:clamp(2rem,12vh,8rem) auto 2rem;padding:2rem;}
.login-panel h2,.share-panel h1 {font-size:1.45rem;margin:0 0 .65rem;}
.login-panel p,.share-panel p {line-height:1.65;color:var(--muted);}
.login-panel form {display:grid;gap:.55rem;margin:1.5rem 0 .75rem;}
.login-panel label {font-size:.9rem;font-weight:600;}
.login-panel input {width:100%;height:44px;border:1px solid #adbcca;border-radius:6px;padding:0 10px;margin-bottom:.55rem;}
.login-panel button {background:var(--accent);color:white;border:0;border-radius:6px;min-height:44px;font-weight:650;}
.share-panel {text-align:center;}
.share-panel img {border-radius:10px;}
.share-panel p {margin:1rem 0;}
.share-panel .secondary {display:inline-flex;align-items:center;text-decoration:none;}
.library-path {flex-wrap:wrap;overflow-wrap:anywhere;}
@media(max-width:480px){.login-panel,.share-panel{margin-inline:12px;padding:1.45rem;}}

@media (max-width: 360px) {
  .site-header-inner { padding-inline: 8px; }
  .brand { gap: 4px; }
  .brand-icon { width: 24px; height: 24px; }
  .account-name { max-inline-size: 3em; }
}

.workspace-views {
  display: flex; align-items: end; gap: 22px;
  padding-inline: max(var(--page-padding), calc((100% - 1540px) / 2 + var(--page-padding)));
  border-bottom: 1px solid var(--line);
  background: #f3f6fa;
}
.workspace-views a { padding: 12px 2px 9px; border-bottom: 3px solid transparent; color: var(--muted); font-size: .92rem; font-weight: 650; text-decoration: none; }
.workspace-views a[aria-current="page"] { color: var(--accent); border-color: var(--accent); }
.workspace-views a:hover, .activity-project-link:hover { color: var(--accent); }
.activity-layout { display: grid; grid-template-columns: minmax(200px,260px) minmax(0,1fr); align-items: start; gap: 14px; }
.activity-sidebar { position: sticky; top: calc(var(--header-inset) + 12px); max-height: calc(100vh - var(--header-inset) - 24px); overflow-y: auto; padding: 15px 12px; }
.activity-sidebar h2 { margin: 0 4px 12px; }
.activity-sidebar input, .activity-search input, .activity-picker-panel input, .activity-picker-toggle { box-sizing: border-box; min-width: 0; min-height: 40px; border: 1px solid #b8c8d5; border-radius: 7px; padding: 7px 10px; font: inherit; font-size: .88rem; color: #24384c; background: white; }
.activity-sidebar input { width: 100%; margin-bottom: 8px; }
.activity-sidebar h3, .activity-picker-list h3 { margin: 14px 6px 3px; color: var(--muted); font-size: .78rem; font-weight: 600; }
.activity-project-link { display: flex; flex-wrap: wrap; gap: 2px 6px; align-items: baseline; padding: 8px 7px; border-radius: 6px; font-size: .88rem; color: #24384c; text-decoration: none; overflow-wrap: anywhere; }
.activity-project-link small, .activity-project-code { color: var(--muted); font-size: .77rem; }
.activity-project-link:hover { background: #f2f6f8; }
.activity-project-link[aria-current] { color: var(--accent); background: #e4f0eb; font-weight: 650; }
.activity-main { min-width: 0; }
.activity-mobile-picker { display: none; }
.activity-picker-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  text-align: start;
}
#activity-picker-current { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-picker-chevron {
  flex: none;
  width: 8px;
  height: 8px;
  margin-inline-end: 3px;
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  transform: translateY(-2px) rotate(45deg);
}
.activity-picker-toggle[aria-expanded="true"] .activity-picker-chevron {
  transform: translateY(2px) rotate(225deg);
}
.activity-picker-panel {
  position: absolute;
  z-index: 5;
  inset: calc(100% + 6px) 0 auto;
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-block-size: min(320px, 46vh);
  max-block-size: min(320px, 46dvh);
  padding: 8px;
  box-shadow: 0 8px 24px rgb(23 38 57 / 16%);
}
.activity-picker-panel input { flex: none; width: 100%; font-size: 1rem; }
.activity-picker-list { min-block-size: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px; }
.activity-picker-list .activity-project-link {
  position: relative;
  align-content: center;
  min-height: 44px;
  padding-inline-end: 30px;
}
.activity-picker-list .activity-project-link[aria-current]::after {
  content: "";
  position: absolute;
  inset-inline-end: 11px;
  top: 50%;
  width: 7px;
  height: 12px;
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  transform: translateY(-65%) rotate(45deg);
}
.activity-head { display: flex; gap: 8px 16px; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.activity-head h2 { overflow-wrap: anywhere; }
.activity-head a { flex: none; }
.activity-search { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.activity-search input { width: min(100%, 24rem); flex: 0 1 24rem; }
.activity-search button, #activity-more { min-height: 40px; padding: 6px 12px; }
#activity-table { table-layout: fixed; font-size: .88rem; }
#activity-table th:first-child { width: 21%; }
#activity-table th:nth-child(3) { width: 12%; }
#activity-table th:last-child { width: 9.5em; }
#activity-table td { vertical-align: top; overflow-wrap: anywhere; line-height: 1.55; }
.activity-summary { white-space: pre-wrap; }
.activity-project-name { color: #1c514a; font-weight: 600; text-decoration: none; }
.activity-project-name:hover, .activity-attachment:hover { text-decoration: underline; }
.activity-project-code, .activity-work-date { display: block; }
.activity-author, .activity-time, .activity-work-date { font-size: .81rem; color: #536377; }
.activity-files { margin-top: 5px; font-size: .82rem; }
.activity-files span { margin-inline-end: 7px; color: var(--muted); }
.activity-attachment { display: inline-block; margin-inline-end: 12px; color: var(--accent); text-underline-offset: 2px; overflow-wrap: anywhere; }
#activity-more { margin-top: 12px; }
@media (max-width: 850px) {
  .activity-layout { display: block; } .activity-sidebar { display: none; }
  .activity-mobile-picker {
    position: relative;
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: .88rem;
  }
}
@media (max-width: 620px) {
  .workspace-views a { padding: 9px 2px 7px; }
  .activity-search input { flex: 1 1 0; }
  #activity-table, #activity-entries { display: block; }
  #activity-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  #activity-entries tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 12px 0; border-top: 1px solid var(--line); }
  #activity-entries td { padding: 0; border: none; min-width: 0; max-width: 100%; }
  #activity-entries td:nth-child(-n+2) { flex: 0 0 100%; }
  .activity-project-code, .activity-work-date { display: inline; margin-inline-start: 5px; }
  .activity-time, .activity-author { font-size: .77rem; }
  .activity-author::before { content: '登记人 '; }
}
