:root {
  color-scheme: light;
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  background: #f3f5fa;
  color: #182747;
  --surface: #fff;
  --line: #dce3ee;
  --muted: #52617a;
  --accent: #254cbf;
  --accent-light: #edf2ff;
  --danger: #a62339;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
header {
  min-height: 4.5rem;
  padding: .8rem clamp(1rem, 5vw, 5rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: #152446;
  color: #fff;
}
.brand { display: flex; align-items: center; gap: .8rem; font-size: 1.05rem; font-weight: 700; letter-spacing: .04em; }
.brand strong { min-width: 0; overflow-wrap: anywhere; }
.brand span {
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border: 1px solid #97adfc;
  border-radius: .6rem;
  color: #dce5ff;
  font-family: Georgia, serif;
  font-size: .95rem;
  letter-spacing: 0;
  flex: 0 0 2.1rem;
}
header .secondary { color: #fff; border-color: #6d7fa3; background: transparent; }
header .secondary:hover { background: #263960; }
main { width: min(76rem, calc(100% - 3rem)); margin: clamp(1.5rem, 4vw, 3.5rem) auto; }
#workspace.owner { display: grid; grid-template-columns: minmax(11.5rem, 15rem) minmax(0, 1fr); align-items: start; gap: 1.35rem; }
#workspace:not(.owner) { max-width: 54rem; margin-inline: auto; }
.workspace-content { min-width: 0; }
#sidebar, .panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  box-shadow: 0 10px 28px #25345609;
}
#sidebar { display: grid; gap: 1.4rem; padding: .85rem; }
#sidebar nav { display: grid; gap: .25rem; }
#sidebar nav button { width: 100%; text-align: left; background: transparent; color: var(--muted); }
#sidebar nav button:hover, #sidebar nav button[aria-current] { background: var(--accent-light); color: var(--accent); }
.panel { padding: clamp(1.2rem, 4vw, 2.6rem); }
#drive, #share-panel, #review-panel { min-height: 22rem; }
#login { max-width: 28rem; margin: clamp(2rem, 8vw, 6rem) auto; border-top: 4px solid var(--accent); }
h1, h2, h3 { margin: 0; line-height: 1.3; font-weight: 700; }
h1, h2 { font-size: clamp(1.55rem, 4.5vw, 2.05rem); }
h3 { font-size: 1.05rem; margin-top: 2rem; }
p { line-height: 1.6; }
label { font-weight: 600; }
form { display: grid; gap: .75rem; margin-top: 1.55rem; }
button, input, select, .download { font: inherit; border-radius: .55rem; padding: .6rem .85rem; }
input, select { width: 100%; border: 1px solid #a9b7cd; background: #fff; color: inherit; }
input[type="checkbox"] { width: 1.05rem; height: 1.05rem; margin: 0; accent-color: var(--accent); }
button { border: 1px solid transparent; background: var(--accent); color: #fff; font-weight: 650; cursor: pointer; }
button:hover { background: #1c3d9e; }
button:disabled { opacity: .65; cursor: default; }
.secondary, .download { background: #fff; border: 1px solid #a9b7cd; color: #254779; }
.secondary:hover, .download:hover { background: var(--accent-light); border-color: #8ba1de; }
.download { text-decoration: none; white-space: nowrap; }
:focus-visible { outline: 2px solid #335ede; outline-offset: 3px; }
.toolbar, li { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.toolbar { flex-wrap: wrap; }
ul { padding: 0; margin: .85rem 0; list-style: none; }
ul:empty { margin: 0; }
li { border-top: 1px solid var(--line); padding: .75rem 0; }
li:last-child { border-bottom: 1px solid var(--line); }
.file-name { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
small { display: block; color: var(--muted); padding-top: .25rem; font-size: .85rem; font-weight: 400; }
.muted, #status, #selected-count, #share-expiry, #empty, #shares-empty, #inbox-empty { color: var(--muted); }
#empty, #inbox-empty { padding: 1.4rem; border-radius: .7rem; background: #f3f6fc; text-align: center; }
#status { margin: .8rem 0; }
#status:empty { display: none; }
#status[data-error], #edit-error { color: var(--danger); }
#selection { margin-top: 1rem; padding: .65rem .8rem; border-radius: .65rem; background: #f3f6fc; }
#selection label { display: inline-flex; gap: .45rem; align-items: center; }
#share-selection { margin-inline-start: auto; }
.share-form { max-width: 22rem; margin: 1.25rem 0; }
#generated { max-width: 36rem; padding: 1rem; border-radius: .7rem; background: var(--accent-light); }
#generated .toolbar { flex-wrap: nowrap; margin-top: .5rem; }
#share-key { min-width: 0; font-family: ui-monospace, Consolas, monospace; }
#share-expiry { margin-bottom: 0; }
.review-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.review-actions button, .review-actions .download { font-size: .9rem; padding: .45rem .65rem; }
.inline-confirm { min-width: 0; }
.review-actions:has(> .inline-confirm > .inline-confirm-panel:not([hidden])) > :not(.inline-confirm) {
  display: none;
}
.inline-confirm-panel {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: .4rem;
  max-width: 22rem;
  padding: .45rem;
  border: 1px solid color-mix(in srgb, var(--danger) 32%, transparent);
  border-radius: .7rem;
  background: color-mix(in srgb, var(--danger) 7%, var(--glass-solid));
}
.inline-confirm-detail, .inline-confirm-error {
  flex-basis: 100%;
  font-size: .875rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.inline-confirm-error { color: var(--danger); }
.inline-confirm-error:empty { display: none; }
.inline-confirm-panel .confirm-danger {
  color: #fff;
  background: #a62339;
  border-color: #a62339;
}
.inline-confirm-panel .confirm-danger:hover { background: #86172b; }
.quota { padding: .65rem .4rem .15rem; border-top: 1px solid var(--line); }
.quota progress { display: block; width: 100%; height: .65rem; margin-top: .65rem; accent-color: var(--accent); }
.quota p { color: var(--muted); margin: .45rem 0; font-size: .85rem; }
.folder-toolbar { margin-top: 1.4rem; padding: .4rem 0; }
#folder-trail { display: flex; flex-wrap: wrap; gap: .3rem; min-width: 0; }
#folder-trail button, .folder-name { max-width: 100%; overflow-wrap: anywhere; text-align: left; }
#folder-trail [aria-current] { opacity: 1; border-color: transparent; color: inherit; }
.folder-name { min-width: 0; }
dialog { width: min(30rem, calc(100% - 2rem)); padding: 1.7rem; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: 1rem; box-shadow: 0 18px 70px #17244245; }
dialog::backdrop { background: #14234398; }
dialog form { margin: 0; }
dialog input, dialog select { margin-top: .35rem; }
dialog .toolbar { margin-top: .55rem; justify-content: flex-end; }
#edit-description, #edit-error { margin: 0; overflow-wrap: anywhere; }
#edit-error:empty { display: none; }
@media (max-width: 54rem) {
  #workspace.owner { grid-template-columns: minmax(0, 1fr); gap: .85rem; }
  #sidebar { grid-template-columns: minmax(0, 1fr) minmax(9rem, 14rem); gap: .55rem; align-items: center; }
  #sidebar nav { display: flex; flex-wrap: wrap; }
  #sidebar nav button { width: auto; }
  .quota { border-top: 0; padding-top: 0; }
}
@media (max-width: 38rem) {
  main { width: calc(100% - 1.5rem); }
  #sidebar { grid-template-columns: minmax(0, 1fr); }
  #sidebar nav { justify-content: space-between; }
  #sidebar nav button { padding: .55rem .45rem; font-size: .9rem; }
  #inbox li { align-items: flex-start; flex-direction: column; }
  #files li { flex-wrap: wrap; }
  #files li .review-actions { justify-content: flex-end; flex-basis: 100%; }
}

:root {
  --canvas: #eaf0f9;
  --glow-one: #adc6f6;
  --glow-two: #cee8e7;
  --glow-three: #e4d6fa;
  --glass: #ffffff70;
  --glass-solid: #f7f9fee6;
  --line: #ffffff9c;
  --divider: #485d831f;
  --control: #ffffff8a;
  --control-line: #3553803b;
  --text: #1d2a42;
  --muted: #49617a;
  --danger: #a62339;
  --accent: var(--user-accent, #4768ec);
  --accent-light: color-mix(in srgb, var(--accent) 12%, transparent);
  --accent-text: color-mix(in srgb, var(--accent) 42%, var(--text));
  --shadow: #3b507726;
  color: var(--text);
  background: var(--canvas);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #121826;
  --glow-one: #243965;
  --glow-two: #173945;
  --glow-three: #312343;
  --glass: #1d2639a8;
  --glass-solid: #202c41f2;
  --line: #a4b7e130;
  --divider: #c5d5ff25;
  --control: #a3b9ff14;
  --control-line: #b2c6f64a;
  --text: #eff3ff;
  --muted: #b6c3db;
  --danger: #ff9aab;
  --accent: var(--user-accent, #8399ff);
  --shadow: #0306117a;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
body {
  min-height: 100vh;
  isolation: isolate;
  background: var(--canvas);
  background-attachment: fixed;
}
.ambient-background { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.ambient-glow {
  position: absolute;
  width: 110%;
  height: 100%;
  background: radial-gradient(ellipse at center, var(--glow), transparent 65%);
}
.glow-blue { left: -45%; top: -45%; --glow: var(--glow-one); }
.glow-green { left: 40%; top: -31%; --glow: var(--glow-two); }
.glow-purple { left: 12%; top: 30%; --glow: var(--glow-three); }
header {
  position: sticky;
  z-index: 1;
  top: 0;
  color: var(--text);
  background: var(--glass);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(24px) saturate(145%);
}
.brand span {
  color: var(--text);
  border-color: var(--line);
  background: var(--accent-light);
  font-family: inherit;
  letter-spacing: -.08em;
}
.header-actions { display: flex; flex-shrink: 0; gap: .55rem; align-items: center; }
.header-actions select { width: auto; padding-block: .45rem; }
header .secondary, .secondary, .download, input, select {
  color: var(--text);
  background: var(--control);
  border-color: var(--control-line);
}
header .secondary:hover, .secondary:hover, .download:hover {
  background: var(--accent-light);
  border-color: var(--control-line);
}
button { color: var(--accent-ink, #fff); }
button:hover { background: color-mix(in srgb, var(--accent) 88%, var(--text)); }
#sidebar, .panel {
  background: var(--glass);
  border-color: var(--line);
  border-radius: 1.4rem;
  box-shadow: 0 16px 42px var(--shadow), inset 0 1px 0 var(--line);
  backdrop-filter: blur(22px) saturate(150%);
}
#sidebar { position: sticky; top: 5.5rem; }
#sidebar nav button:hover, #sidebar nav button[aria-current] { color: var(--accent-text); }
#sidebar nav button[aria-current] { box-shadow: inset 3px 0 0 var(--accent); }
#login { border-top-color: var(--line); }
li { border-top-color: var(--divider); }
li:last-child, .quota { border-bottom-color: var(--divider); border-top-color: var(--divider); }
#empty, #inbox-empty, #selection { background: var(--control); }
#generated { background: var(--accent-light); }
.folder-name {
  position: relative;
  padding-inline-start: 2.6rem;
  min-height: 2.35rem;
  border-color: transparent;
  background: transparent;
}
.folder-name::before, .folder-name::after {
  content: "";
  position: absolute;
  left: .58rem;
  width: 1.42rem;
  pointer-events: none;
}
.folder-name::before {
  top: calc(50% - .57rem);
  height: .82rem;
  border-radius: .26rem;
  background: linear-gradient(100deg, #639bf8, #7bb9fa);
  clip-path: polygon(0 0, 36% 0, 52% 23%, 100% 23%, 100% 100%, 0 100%);
}
.folder-name::after {
  top: calc(50% - .28rem);
  height: .75rem;
  border-radius: .22rem;
  background: linear-gradient(155deg, #d0f0ffbf, #4792f6e6);
  border: 1px solid #a7d8fc99;
  box-shadow: 0 2px 4px #224e8440;
}
.appearance { padding: .6rem .4rem .2rem; border-top: 1px solid var(--divider); color: var(--muted); font-size: .9rem; }
.appearance-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; margin-top: .45rem; }
.appearance-actions input { width: 2.25rem; height: 2.1rem; padding: .2rem; cursor: pointer; }
.appearance-actions button { padding: .35rem .55rem; }
dialog { background: var(--glass-solid); border-color: var(--line); backdrop-filter: blur(24px) saturate(145%); }
dialog::backdrop { background: #121a3673; backdrop-filter: blur(5px); }
.space-name-input, .personal-actions { display: flex; align-items: center; gap: .55rem; }
.space-name-input input { min-width: 0; }
.space-name-input button { white-space: nowrap; }
#settings-dialog form, #personal-dialog .personal-actions { margin-top: 1rem; }
#space-name-form { padding-bottom: .8rem; border-bottom: 1px solid var(--divider); }
#space-name-status, #upgrade-status { margin: 0; color: var(--muted); }
#space-name-status:empty, #upgrade-status:empty { display: none; }
.planned-menu { margin-block: .6rem 1rem; }
.planned-menu li { padding-block: .45rem; }
.personal-actions { justify-content: flex-end; flex-wrap: wrap; }
#storage-upgrade { margin-block: .55rem; }
:root[data-motion="on"] dialog[open] {
  animation: dialog-enter 170ms cubic-bezier(.2,.75,.3,1) both;
}
:root[data-motion="on"] dialog[open]::backdrop { animation: backdrop-enter 170ms ease-out both; }
@keyframes dialog-enter {
  from { opacity: 0; transform: translateY(7px) scale(.985); }
  to { opacity: 1; transform: none; }
}
@keyframes backdrop-enter {
  from { opacity: 0; }
  to { opacity: 1; }
}
.quota-inputs, .transfer { display: flex; align-items: center; gap: .65rem; }
.file-controls { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: .65rem; margin-block: 1.1rem; }
.file-search-input, .file-sort { display: flex; align-items: center; gap: .55rem; margin: 0; }
#file-search { flex: 1 1 17rem; max-width: 31rem; margin: 0; gap: .5rem; }
#file-search input { min-width: 0; }
#file-search button, .file-sort label { white-space: nowrap; }
.file-sort select { width: auto; }
#search-scope { display: flex; flex-wrap: wrap; gap: .25rem; padding: .2rem; margin: 0; min-width: 0; width: fit-content; border: 1px solid var(--control-line); border-radius: .65rem; background: var(--control); }
#search-scope label { position: relative; cursor: pointer; }
#search-scope input { position: absolute; width: 1px; height: 1px; opacity: 0; }
#search-scope span { display: block; padding: .32rem .65rem; border-radius: .45rem; font-size: .875rem; }
#search-scope input:checked + span { background: var(--accent-light); color: var(--accent-text); }
#search-scope input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.quota-inputs input[type="range"] { appearance: auto; border: 0; padding: 0; accent-color: var(--accent); }
.quota-inputs input[type="number"] { flex: 0 0 6rem; width: 6rem; }
.transfer { flex-wrap: wrap; margin: .8rem 0; }
.transfer progress { flex: 1; min-width: 7rem; accent-color: var(--accent); }
#upload-tasks { margin-top: .8rem; }
#upload-tasks summary { cursor: pointer; color: var(--accent-text); }
@media (max-width: 54rem) { #sidebar { position: static; } }
@media (max-width: 38rem) {
  .header-actions { gap: .35rem; }
  .header-actions select, .header-actions button { font-size: .875rem; padding-inline: .45rem; }
}
