:root {
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #202521;
  background: #f7f7f3;
  font-synthesis: none;
  --ink: #202521;
  --muted: #576259;
  --forest: #284835;
  --tint: #e9efe7;
  --line: #e1e5de;
  --paper: #fff;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 300px; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: wait; }
a { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid #567b58; outline-offset: 3px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(2rem, 4vw, 3rem); letter-spacing: -.06em; line-height: 1.15; }
h2 { font-size: 1.32rem; }
.muted { color: var(--muted); line-height: 1.6; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.primary, .secondary, .quiet, .text-action {
  border-radius: .7rem;
  min-height: 2.65rem;
  padding: .55rem .92rem;
  font-weight: 650;
  white-space: nowrap;
}
.primary { border: 1px solid var(--forest); background: var(--forest); color: white; }
.primary:hover { background: #345840; }
.secondary { border: 1px solid #dce3db; background: var(--paper); color: var(--ink); }
.secondary:hover, .quiet:hover, .text-action:hover { background: var(--tint); }
.quiet, .text-action { border: 0; background: transparent; color: var(--forest); }
.text-action { display: inline-flex; align-items: center; font-size: .86rem; padding: .35rem .55rem; min-height: 2rem; text-decoration: none; }
.danger { color: #a03936; }
.feedback { font-size: .88rem; color: var(--muted); overflow-wrap: anywhere; }
.feedback[data-error="true"] { color: #a03936; }

.gate { min-height: 100svh; display: grid; grid-template-columns: minmax(260px, 1fr) minmax(450px, 1fr); }
.gate-art {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: radial-gradient(ellipse at 94% 7%, #566b42, transparent 45%), #1c3529;
}
.gate-art::before, .gate-art::after { content: ""; position: absolute; width: 66vmin; height: 66vmin; border-radius: 38%; border: 1px solid #b7ca9c66; z-index: -1; transform: rotate(30deg); }
.gate-art::before { box-shadow: 0 0 0 3.7vmin #c2d5ab17, 0 0 0 7.4vmin #c2d5ab0f, 0 0 0 11.1vmin #c2d5ab0a; }
.gate-art::after { transform: rotate(60deg); }
.logo { display: grid; place-items: center; width: 2.45rem; height: 2.45rem; background: #284835; color: #edf4e9; border-radius: .75rem; font-family: Georgia, serif; font-size: 1.6rem; font-style: italic; font-weight: 600; }
.gate-art .logo { background: #e7eedb; color: #254330; width: 5.25rem; height: 5.25rem; border-radius: 1.4rem; font-size: 3.4rem; }
.gate-panel { display: grid; place-items: center; padding: 2rem; background: #f9f9f6; }
.gate-content { width: min(100%, 24rem); }
.wordmark { margin-bottom: .65rem; font-weight: 750; color: var(--forest); letter-spacing: -.02em; }
.gate h1 { margin-bottom: .75rem; }
.gate form { display: grid; gap: .65rem; margin-top: 2rem; }
.gate label, dialog label { font-size: .9rem; font-weight: 650; }
.gate input, dialog input, .search input { min-width: 0; border: 1px solid #dce3db; border-radius: .65rem; background: white; color: var(--ink); padding: .72rem .85rem; }
.gate .primary { margin-top: .45rem; }
.gate .feedback { min-height: 1.4rem; margin-top: .9rem; }

.workspace { min-height: 100svh; display: grid; grid-template-columns: 14rem minmax(0, 1fr); }
.sidebar { border-right: 1px solid var(--line); background: #f0f2eb; padding: 1.7rem 1rem 1.2rem; display: flex; flex-direction: column; gap: 2rem; }
.brand { display: flex; align-items: center; gap: .7rem; padding: 0 .35rem; text-decoration: none; font-weight: 750; }
.brand small { display: block; margin-top: .22rem; color: var(--muted); font-weight: 500; }
.nav { display: grid; gap: .4rem; }
.nav-item { width: 100%; min-height: 2.75rem; padding: .5rem .75rem; display: flex; align-items: center; gap: .65rem; border: 0; border-radius: .8rem; color: var(--muted); background: transparent; font-weight: 650; text-align: left; }
.nav-item:hover, .nav-item[aria-current] { background: #dfe8dc; color: #264532; }
.logout { margin-top: auto; align-self: flex-start; }
.main { width: min(100%, 84rem); padding: clamp(1.2rem, 4vw, 4.25rem); }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1.1rem; margin-bottom: 1.75rem; }
.page-head p { margin-top: .55rem; }
.actions { display: flex; align-items: center; gap: .6rem; }
.drop { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.55rem; padding: 1.15rem 1.2rem; background: #eef2e9; border: 1px dashed #9aaa96; border-radius: 1rem; }
.drop.active { outline: 2px dashed #567b58; background: #dce9d9; }
.drop-icon { display: grid; place-items: center; width: 2.65rem; height: 2.65rem; flex: 0 0 auto; border-radius: .7rem; background: #dce7da; color: var(--forest); font-size: 1.3rem; }
.drop p { font-size: .87rem; margin-top: .22rem; }
.listing, .transfers { border: 1px solid var(--line); background: white; border-radius: 1rem; overflow: hidden; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .78rem 1rem; border-bottom: 1px solid var(--line); }
.crumbs { display: flex; align-items: center; flex-wrap: wrap; min-width: 0; gap: .28rem; overflow-wrap: anywhere; }
.crumbs button { text-align: left; white-space: normal; min-width: 0; }
.search input { max-width: 100%; width: 12rem; padding-block: .48rem; font-size: .85rem; }
.list-status:not(:empty) { padding: .55rem 1rem; }
.empty { padding: 3.5rem 1rem; text-align: center; }
.empty p { margin-top: .4rem; }
.files { list-style: none; padding: 0; margin: 0; }
.file-row { display: grid; grid-template-columns: minmax(8rem, 1fr) minmax(5rem, auto) auto; align-items: center; gap: .75rem; padding: .6rem 1rem; min-height: 3.7rem; }
.file-row + .file-row { border-top: 1px solid #eff1ed; }
.file-name { display: flex; align-items: center; gap: .65rem; min-width: 0; overflow-wrap: anywhere; }
.file-name button { white-space: normal; min-width: 0; text-align: left; overflow-wrap: anywhere; }
.file-meta { color: var(--muted); font-size: .8rem; text-align: right; }
.file-actions { display: flex; flex-wrap: wrap; gap: .3rem; }
.icon { display: inline-block; flex: 0 0 auto; width: 1.05rem; height: .94rem; border: 1.5px solid #53715b; border-radius: .16rem; position: relative; }
.icon.folder { height: .72rem; margin-top: .2rem; background: #e4ebdc; }
.icon.folder::before { content: ""; display: block; position: absolute; left: -1px; top: -.24rem; width: .42rem; height: .22rem; background: #e4ebdc; border: 1px solid #53715b; border-bottom: 0; border-radius: .13rem .13rem 0 0; }
.icon.photo::before { content: ""; position: absolute; bottom: .16rem; left: .25rem; border-left: .22rem solid transparent; border-right: .22rem solid transparent; border-bottom: .28rem solid #53715b; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(12rem, 100%), 1fr)); padding: 1rem; gap: 1rem; }
.card { min-width: 0; border: 1px solid var(--line); border-radius: .8rem; overflow: hidden; }
.thumbnail { display: block; width: 100%; border: 0; padding: 0; background: #e9ede6; aspect-ratio: 4 / 3; overflow: hidden; }
.thumbnail img { display: block; width: 100%; height: 100%; object-fit: contain; }
.thumbnail:hover { background: #dce5da; }
.card-body { display: grid; gap: .25rem; padding: .75rem; }
.card-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-body .file-meta { text-align: left; }
.card .file-actions { margin-top: .3rem; }
.more { margin: .75rem 1rem; }

.transfers { margin-top: 1.4rem; padding: .8rem 1rem; }
.transfer-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.transfer-head .quiet { min-height: 2rem; }
.transfers ul { padding: 0; margin: .25rem 0 0; list-style: none; }
.transfer { display: grid; grid-template-columns: 1fr auto; gap: .4rem .8rem; border-top: 1px solid var(--line); padding: .6rem 0; overflow-wrap: anywhere; }
.transfer progress { grid-column: 1 / -1; width: 100%; height: .5rem; accent-color: #4b7553; }

dialog { width: min(92vw, 27rem); padding: 1.35rem; border: 1px solid var(--line); border-radius: 1rem; color: var(--ink); }
dialog::backdrop { background: #1a281cc0; }
dialog form { display: grid; gap: .85rem; }
.dialog-actions { justify-content: flex-end; margin-top: .3rem; }
#preview { width: min(94vw, 62rem); padding: 1rem; }
.preview-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-bottom: .75rem; overflow-wrap: anywhere; }
.preview-image { display: grid; place-items: center; min-height: 5rem; background: #eef2eb; border-radius: .65rem; overflow: hidden; }
.preview-image img { display: block; max-width: 100%; max-height: 75svh; object-fit: contain; }

@media (max-width: 730px) {
  .gate { grid-template-columns: 1fr; grid-template-rows: 9rem 1fr; }
  .gate-panel { align-items: start; padding-top: 2.5rem; }
  .gate-art .logo { width: 3.5rem; height: 3.5rem; font-size: 2.2rem; border-radius: 1rem; }
  .workspace { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .sidebar { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; padding: .75rem 1rem; gap: .55rem; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { padding: 0; }
  .brand small { display: none; }
  .nav { order: 3; display: flex; flex: 0 0 100%; }
  .nav-item { width: auto; }
  .logout { margin: 0; padding-inline: .5rem; }
  .page-head { display: grid; align-items: start; }
}
@media (max-width: 510px) {
  .file-row { grid-template-columns: minmax(0, 1fr) auto; column-gap: .2rem; row-gap: .2rem; }
  .file-actions { grid-column: 1 / -1; }
  .toolbar { flex-wrap: wrap; }
  .search, .search input { width: 100%; }
}
