:root {
  --bg: #f5f7f6;
  --surface: #ffffff;
  --surface-soft: #f8faf9;
  --ink: #17221e;
  --muted: #708078;
  --line: #e5ebe8;
  --green: #167a5a;
  --green-dark: #105f46;
  --green-soft: #e6f4ee;
  --coral: #e96950;
  --coral-soft: #fff0ec;
  --yellow: #e2a72e;
  --yellow-soft: #fff7dc;
  --shadow: 0 10px 30px rgba(24, 45, 36, 0.08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif; letter-spacing: 0; }
button, input, select { font: inherit; letter-spacing: 0; }
button { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
svg { width: 18px; height: 18px; stroke-width: 2; }
[hidden] { display: none !important; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; width: 232px; padding: 24px 16px 18px; display: flex; flex-direction: column; background: #152a23; color: #f5faf8; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 28px; color: white; font-size: 17px; font-weight: 700; text-decoration: none; }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; flex: 0 0 34px; border-radius: 8px; background: #2c9976; color: white; }
.brand-mark svg { width: 20px; height: 20px; }
.main-nav { display: grid; gap: 5px; }
.nav-item, .space-item { width: 100%; min-height: 42px; border: 0; border-radius: 6px; background: transparent; color: #afc0ba; display: flex; align-items: center; gap: 12px; padding: 0 11px; cursor: pointer; text-align: left; transition: background .18s ease, color .18s ease; }
.nav-item:hover, .space-item:hover { background: #203b32; color: white; }
.nav-item.active { background: #285f4c; color: white; }
.nav-item svg { width: 18px; }
.nav-count { margin-left: auto; color: #8fa59d; font-size: 12px; }
.sidebar-section { margin-top: 28px; }
.section-label { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 8px 11px; color: #778e86; font-size: 11px; font-weight: 700; }
.space-item { min-height: 36px; font-size: 13px; }
.space-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.space-dot.coral { background: var(--coral); }
.space-dot.teal { background: #40af8a; }
.space-dot.yellow { background: var(--yellow); }
.storage-card { margin-top: auto; padding: 14px; border: 1px solid #2b453c; border-radius: 8px; background: #1a3129; }
.storage-head { display: flex; justify-content: space-between; align-items: center; font-size: 12px; }
.storage-head strong { color: #72d2b0; }
.progress-track { height: 5px; margin: 10px 0 8px; overflow: hidden; border-radius: 5px; background: #365047; }
.progress-track span { display: block; height: 100%; background: #4bbb93; }
.storage-meta { color: #80988f; font-size: 11px; }
.text-button { display: block; padding: 8px 0 0; border: 0; background: transparent; color: #8dddbc; font-size: 11px; cursor: pointer; }
.account-card { display: flex; align-items: center; gap: 10px; margin-top: 16px; padding: 12px 6px 0; border-top: 1px solid #29423a; }
.avatar { width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; border-radius: 50%; background: #f0b246; color: #3c2a0d; font-size: 13px; font-weight: 800; }
.account-copy { min-width: 0; display: grid; gap: 2px; }
.account-copy strong { font-size: 12px; }
.account-copy span { color: #7f968d; font-size: 10px; }

.main-frame { min-width: 0; margin-left: 232px; }
.topbar { position: sticky; top: 0; z-index: 15; min-height: 72px; padding: 0 38px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.94); backdrop-filter: blur(12px); }
.mobile-brand { display: none; }
.search-box { width: min(460px, 50vw); height: 42px; display: flex; align-items: center; gap: 10px; padding: 0 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); color: var(--muted); }
.search-box:focus-within { border-color: #72b59f; box-shadow: 0 0 0 3px rgba(22,122,90,.1); }
.search-box svg { width: 17px; flex: 0 0 auto; }
.search-box input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--ink); }
.search-box input::placeholder { color: #98a49f; }
kbd { padding: 3px 7px; border: 1px solid #dce3df; border-radius: 4px; background: white; color: #89968f; font-size: 11px; box-shadow: 0 1px 1px rgba(0,0,0,.04); }
.topbar-actions, .toolbar-actions { display: flex; align-items: center; gap: 9px; }
.icon-button { position: relative; width: 40px; height: 40px; flex: 0 0 40px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 7px; background: white; cursor: pointer; transition: .18s ease; }
.icon-button:hover, .icon-button.active { color: var(--green); border-color: #afd1c5; background: var(--green-soft); }
.icon-button.ghost { border: 0; background: transparent; color: inherit; }
.icon-button.compact { width: 28px; height: 28px; flex-basis: 28px; }
.icon-button.compact svg { width: 16px; height: 16px; }
.notify-dot { position: absolute; top: 9px; right: 9px; width: 6px; height: 6px; border-radius: 50%; background: var(--coral); box-shadow: 0 0 0 2px white; }
.primary-button, .secondary-button { height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 16px; border-radius: 7px; cursor: pointer; font-weight: 700; font-size: 13px; }
.primary-button { border: 1px solid var(--green); background: var(--green); color: white; }
.primary-button:hover { background: var(--green-dark); }
.primary-button:disabled { border-color: #9bb6ac; background: #9bb6ac; cursor: not-allowed; }
.secondary-button { border: 1px solid var(--line); background: white; color: var(--ink); }

main { width: min(1320px, 100%); margin: 0 auto; padding: 34px 38px 64px; }
.welcome-row { display: flex; align-items: center; justify-content: space-between; gap: 32px; padding-bottom: 30px; }
.eyebrow { margin: 0 0 8px; color: var(--green); font-size: 11px; font-weight: 800; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(26px, 3vw, 34px); line-height: 1.2; }
.subtle { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.summary-strip { display: flex; align-items: center; gap: 4px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.summary-strip > div { min-width: 116px; display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-right: 1px solid var(--line); }
.summary-strip > div:last-child { border: 0; }
.summary-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 7px; }
.summary-icon svg { width: 16px; }
.coral-bg { background: var(--coral-soft); color: var(--coral); }
.teal-bg { background: var(--green-soft); color: var(--green); }
.yellow-bg { background: var(--yellow-soft); color: #af7710; }
.summary-strip p { margin: 0; display: grid; }
.summary-strip strong { font-size: 16px; }
.summary-strip p span { color: var(--muted); font-size: 10px; }

.content-section { margin-top: 12px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.section-heading > div:first-child { display: flex; align-items: baseline; gap: 10px; }
.section-heading h2 { margin: 0; font-size: 18px; }
.section-heading span { color: var(--muted); font-size: 11px; }
.link-button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 0; border: 0; background: transparent; color: var(--green); font-size: 12px; cursor: pointer; }
.link-button svg { width: 14px; }
.recent-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.recent-card { min-width: 0; overflow: hidden; display: grid; grid-template-columns: minmax(122px, 42%) 1fr; min-height: 142px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; transition: transform .18s ease, box-shadow .18s ease; }
.recent-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.media-cover, .document-cover { position: relative; min-width: 0; overflow: hidden; background: #dbe7e2; }
.media-cover img { width: 100%; height: 100%; display: block; object-fit: cover; }
.media-cover::after { content: ""; position: absolute; inset: auto 0 0; height: 44px; background: linear-gradient(transparent, rgba(0,0,0,.5)); pointer-events: none; }
.play-button { position: absolute; inset: 50% auto auto 50%; z-index: 2; width: 38px; height: 38px; display: grid; place-items: center; transform: translate(-50%,-50%); border: 1px solid rgba(255,255,255,.8); border-radius: 50%; background: rgba(255,255,255,.9); color: var(--green); cursor: pointer; }
.play-button svg { width: 16px; fill: currentColor; }
.duration, .page-count { position: absolute; right: 8px; bottom: 7px; z-index: 2; padding: 3px 6px; border-radius: 4px; background: rgba(17,28,24,.78); color: white; font-size: 9px; }
.document-cover { display: grid; place-items: center; }
.doc-green { background: #dcece6; }
.doc-sheet { width: 66px; height: 84px; padding: 10px; transform: rotate(-3deg); border-radius: 3px; background: white; box-shadow: 0 8px 16px rgba(35,86,69,.15); color: var(--green); }
.doc-sheet span { font-size: 8px; font-weight: 800; }
.doc-sheet b { display: block; margin: 4px 0 10px; font-size: 20px; }
.doc-sheet i { display: block; width: 100%; height: 3px; margin-top: 5px; background: #dce8e3; }
.recent-body { min-width: 0; padding: 15px 14px 12px; display: flex; flex-direction: column; justify-content: space-between; gap: 9px; }
.recent-body h3 { margin: 7px 0 6px; overflow: hidden; font-size: 13px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.recent-body p { margin: 0; color: var(--muted); font-size: 10px; }
.file-kind { display: inline-flex; align-items: center; gap: 4px; font-size: 9px !important; font-weight: 700; }
.file-kind svg { width: 12px; height: 12px; }
.file-kind.video { color: var(--coral); }
.file-kind.document { color: var(--green); }
.watch-progress { height: 3px; overflow: hidden; border-radius: 2px; background: #edf0ef; }
.watch-progress span { display: block; height: 100%; background: var(--coral); }
.teal-progress span { background: var(--green); }

.library-section { margin-top: 38px; }
.library-heading { align-items: center; }
.view-switch { display: flex !important; gap: 6px !important; align-items: center !important; }
.view-switch .icon-button { width: 36px; height: 36px; flex-basis: 36px; }
.toolbar { position: relative; min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 17px; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.filter-tabs { display: flex; align-items: center; gap: 3px; overflow-x: auto; }
.filter-tab { height: 36px; padding: 0 14px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; white-space: nowrap; }
.filter-tab:hover, .filter-tab.active { background: var(--green-soft); color: var(--green-dark); font-weight: 700; }
.filter-button { height: 36px; display: inline-flex; align-items: center; gap: 7px; padding: 0 11px; border: 1px solid var(--line); border-radius: 6px; background: white; cursor: pointer; font-size: 11px; }
.filter-button svg { width: 14px; }
.filter-button .chevron { width: 12px; color: var(--muted); }
.space-menu { position: absolute; z-index: 12; right: 104px; top: 50px; width: 164px; padding: 6px; border: 1px solid var(--line); border-radius: 7px; background: white; box-shadow: var(--shadow); }
.space-menu button { width: 100%; height: 34px; display: flex; align-items: center; gap: 9px; padding: 0 9px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); text-align: left; cursor: pointer; font-size: 11px; }
.space-menu button:hover, .space-menu button.active { background: var(--surface-soft); color: var(--green); }
.space-menu svg { width: 14px; }

.library-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; }
.library-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: white; transition: transform .18s ease, box-shadow .18s ease; }
.library-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.library-thumb { position: relative; height: 136px; overflow: hidden; background: #e9eeeb; }
.library-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s ease; }
.library-card:hover .library-thumb img { transform: scale(1.025); }
.library-thumb .type-badge { position: absolute; left: 9px; top: 9px; height: 23px; display: inline-flex; align-items: center; gap: 4px; padding: 0 7px; border-radius: 5px; background: rgba(255,255,255,.92); color: var(--ink); font-size: 9px; font-weight: 700; }
.type-badge svg { width: 11px; height: 11px; }
.library-thumb .duration { bottom: 9px; }
.favorite-button { position: absolute; top: 8px; right: 8px; z-index: 3; width: 28px; height: 28px; display: grid; place-items: center; border: 0; border-radius: 6px; background: rgba(255,255,255,.92); color: #77847e; cursor: pointer; }
.favorite-button svg { width: 15px; }
.favorite-button.active { color: #c98a13; }
.favorite-button.active svg { fill: #f2bc48; }
.thumb-document { display: grid; place-items: center; }
.doc-preview { width: 76px; height: 96px; padding: 13px 11px; background: white; border: 1px solid #e0e6e3; border-radius: 3px; box-shadow: 0 8px 16px rgba(30,55,46,.1); }
.doc-preview strong { color: var(--preview-color, var(--green)); font-size: 12px; }
.doc-preview span { display: block; height: 4px; margin-top: 8px; border-radius: 2px; background: #e7ecea; }
.doc-preview span:nth-child(3) { width: 78%; }
.doc-preview span:nth-child(4) { width: 90%; }
.library-body { padding: 13px; }
.library-body h3 { min-height: 39px; margin: 0 0 11px; overflow: hidden; font-size: 12px; line-height: 1.55; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.card-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 9px; }
.card-space { min-width: 0; display: flex; align-items: center; gap: 6px; }
.card-space span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.library-grid.list-view { grid-template-columns: 1fr; gap: 8px; }
.list-view .library-card { display: grid; grid-template-columns: 112px minmax(0,1fr); }
.list-view .library-thumb { height: 82px; }
.list-view .doc-preview { width: 44px; height: 56px; padding: 7px; }
.list-view .doc-preview strong { font-size: 8px; }
.list-view .doc-preview span { height: 2px; margin-top: 4px; }
.list-view .library-body { min-width: 0; display: grid; grid-template-columns: minmax(0,1fr) minmax(180px, 30%); align-items: center; gap: 20px; }
.list-view .library-body h3 { min-height: auto; margin: 0; }
.load-more { width: 100%; height: 42px; margin-top: 18px; display: flex; align-items: center; justify-content: center; gap: 7px; border: 1px dashed #cfd9d4; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; font-size: 11px; }
.load-more:hover { border-color: #8cb8a8; color: var(--green); background: #f1f7f4; }
.load-more svg { width: 14px; }
.empty-state { padding: 54px 16px; text-align: center; }
.empty-state > span { width: 52px; height: 52px; display: grid; place-items: center; margin: 0 auto 12px; border-radius: 50%; background: var(--green-soft); color: var(--green); }
.empty-state h3 { margin: 0 0 6px; font-size: 15px; }
.empty-state p { margin: 0 0 18px; color: var(--muted); font-size: 11px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(14,31,25,.56); }
.modal { width: min(520px,100%); padding: 22px; border-radius: 8px; background: white; box-shadow: 0 28px 80px rgba(0,0,0,.28); animation: modalIn .2s ease; }
@keyframes modalIn { from { transform: translateY(8px); opacity: 0; } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.modal-head h2 { margin: 0; font-size: 20px; }
.drop-zone { width: 100%; min-height: 156px; margin-top: 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; border: 1px dashed #aabeb6; border-radius: 8px; background: #f8fbfa; cursor: pointer; }
.drop-zone.dragging { border-color: var(--green); background: var(--green-soft); }
.drop-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: var(--green-soft); color: var(--green); }
.drop-zone strong { font-size: 13px; }
.drop-zone > span:last-child { color: var(--muted); font-size: 10px; }
.upload-form { display: grid; grid-template-columns: 1fr 1.45fr; gap: 12px; margin-top: 16px; }
.upload-form label { display: grid; gap: 6px; color: var(--muted); font-size: 10px; }
.upload-form input, .upload-form select { width: 100%; height: 39px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; outline: 0; background: white; color: var(--ink); font-size: 12px; }
.upload-form input:focus, .upload-form select:focus { border-color: #72b59f; box-shadow: 0 0 0 3px rgba(22,122,90,.09); }
.selected-file { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); }
.selected-file-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 6px; background: var(--green-soft); color: var(--green); }
.selected-file div { min-width: 0; flex: 1; display: grid; gap: 2px; }
.selected-file strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.selected-file div span { color: var(--muted); font-size: 9px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.toast { position: fixed; z-index: 70; left: 50%; bottom: 28px; min-width: 220px; max-width: calc(100vw - 32px); min-height: 42px; display: flex; align-items: center; justify-content: center; gap: 9px; padding: 0 15px; transform: translate(-50%, 90px); opacity: 0; border-radius: 7px; background: #172f27; color: white; box-shadow: var(--shadow); pointer-events: none; transition: .25s ease; font-size: 11px; }
.toast.show { transform: translate(-50%,0); opacity: 1; }
.toast svg { width: 16px; color: #75d0ae; }
.mobile-nav { display: none; }

@media (max-width: 1120px) {
  .summary-strip > div { min-width: 94px; padding-inline: 9px; }
  .summary-icon { width: 30px; height: 30px; }
  .recent-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .recent-card:last-child { display: none; }
  .library-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
}

@media (max-width: 820px) {
  .sidebar { display: none; }
  .main-frame { margin-left: 0; }
  .topbar { min-height: 62px; padding: 0 18px; gap: 12px; }
  .mobile-brand { display: flex; align-items: center; gap: 9px; }
  .mobile-brand strong { font-size: 14px; }
  .mobile-brand .brand-mark { width: 30px; height: 30px; flex-basis: 30px; }
  .search-box { flex: 1; width: auto; }
  .search-box kbd { display: none; }
  .topbar-actions .icon-button { display: none; }
  main { padding: 26px 18px 92px; }
  .welcome-row { display: block; }
  .summary-strip { margin-top: 22px; }
  .summary-strip > div { flex: 1; min-width: 0; }
  .library-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .mobile-nav { position: fixed; inset: auto 0 0; z-index: 30; height: calc(66px + env(safe-area-inset-bottom)); padding: 6px 14px env(safe-area-inset-bottom); display: flex; align-items: center; justify-content: space-around; border-top: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(10px); }
  .mobile-nav button { width: 62px; height: 50px; display: grid; place-items: center; gap: 1px; border: 0; background: transparent; color: var(--muted); font-size: 9px; }
  .mobile-nav button svg { width: 19px; }
  .mobile-nav button.active { color: var(--green); }
}

@media (max-width: 600px) {
  .topbar { flex-wrap: wrap; padding-block: 10px; }
  .mobile-brand { flex: 1; }
  .search-box { order: 3; width: 100%; flex-basis: 100%; }
  .topbar-actions .primary-button { width: 40px; padding: 0; }
  .topbar-actions .primary-button span { display: none; }
  .welcome-row { padding-bottom: 20px; }
  h1 { font-size: 25px; }
  .summary-strip { overflow-x: auto; }
  .summary-strip > div { min-width: 98px; }
  .recent-grid { grid-template-columns: 1fr; }
  .recent-card { min-height: 132px; }
  .recent-card:nth-child(2) { display: none; }
  .section-heading > div:first-child { display: block; }
  .section-heading span { display: block; margin-top: 4px; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .filter-tabs { width: 100%; }
  .filter-tab { flex: 1; padding-inline: 8px; }
  .toolbar-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .filter-button { justify-content: center; }
  .space-menu { top: 98px; right: auto; left: 6px; }
  .library-grid { grid-template-columns: 1fr; }
  .library-thumb { height: 180px; }
  .list-view .library-card { grid-template-columns: 92px minmax(0,1fr); }
  .list-view .library-thumb { height: 92px; }
  .list-view .library-body { display: block; padding: 12px; }
  .list-view .library-body h3 { margin-bottom: 9px; }
  .upload-form { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
