:root {
  --ink: #1d211c;
  --muted: #6b7068;
  --paper: #f5f2ea;
  --panel: #fffdf8;
  --line: #ddd9ce;
  --green: #255d45;
  --green-2: #dce9df;
  --orange: #c96d3b;
  --shadow: 0 20px 60px rgba(43, 49, 39, .12);
  font-family: Inter, "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--paper); }
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 80% 15%, #dfe9da, transparent 30%), radial-gradient(circle at 15% 85%, #f0d9c8, transparent 26%), var(--paper); }
.login-card { width: min(100%, 510px); padding: 48px; background: rgba(255,253,248,.94); border: 1px solid rgba(42,56,43,.12); border-radius: 28px; box-shadow: var(--shadow); }
.brand-mark { width: 48px; height: 48px; display: grid; place-items: center; color: white; background: var(--green); border-radius: 15px 15px 15px 5px; font-weight: 800; letter-spacing: -.04em; margin-bottom: 28px; }
.eyebrow { margin: 0 0 8px; color: var(--green); font-size: 11px; letter-spacing: .18em; font-weight: 800; }
h1 { margin: 0; font-family: Georgia, "Noto Serif SC", serif; font-size: clamp(30px, 5vw, 47px); line-height: 1.08; letter-spacing: -.035em; }
.muted { color: var(--muted); line-height: 1.7; margin: 18px 0 30px; }
label { display: block; color: #41463f; font-size: 13px; font-weight: 700; }
.password-row { display: flex; gap: 10px; margin-top: 9px; }
input { min-width: 0; border: 1px solid var(--line); border-radius: 12px; background: white; padding: 13px 14px; color: var(--ink); outline: none; }
input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(37,93,69,.12); }
.password-row input { flex: 1; }
.primary, .secondary { border: 0; border-radius: 12px; padding: 12px 18px; font-weight: 750; }
.primary { color: white; background: var(--green); }
.primary:hover { background: #174b34; }
.secondary { background: var(--green-2); color: var(--green); }
.error { color: #a13d30; min-height: 20px; font-size: 13px; }
.trust-note { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 20px; color: var(--muted); font-size: 12px; }
.trust-note span { color: var(--green); margin-right: 7px; }

.app-shell { min-height: 100vh; padding-bottom: 96px; }
.topbar { height: 112px; display: flex; align-items: center; justify-content: space-between; padding: 20px max(24px, calc((100vw - 1180px)/2)); background: var(--panel); border-bottom: 1px solid var(--line); }
.topbar h1 { font-size: 28px; }
.status-wrap { display: flex; align-items: center; gap: 14px; }
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 750; border-radius: 999px; padding: 8px 11px; }
.status i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.online { color: var(--green); background: var(--green-2); }
.status.offline { color: #8b4a34; background: #f4dfd5; }
.icon-button, .back-button { border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 9px 12px; color: var(--muted); }
.back-button { font-size: 19px; width: 42px; padding: 6px; }
.icon-button:hover, .back-button:hover:not(:disabled) { border-color: #a7aaa2; color: var(--ink); }
.back-button:disabled { opacity: .38; cursor: default; }

.workspace { width: min(1180px, calc(100% - 48px)); margin: 28px auto; }
.toolbar { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; margin-bottom: 24px; }
.breadcrumbs { display: flex; gap: 5px; align-items: center; overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.breadcrumbs button { border: 0; background: none; color: var(--muted); padding: 7px 5px; font-weight: 650; }
.breadcrumbs button:last-child { color: var(--ink); }
.breadcrumbs span { color: #aaa99f; }
.action-row { display: flex; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.search-box { display: flex; flex: 1; max-width: 480px; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--panel); border-radius: 13px; padding-left: 13px; }
.search-box:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px rgba(37,93,69,.08); }
.search-box input { width: 100%; border: 0; box-shadow: none; background: transparent; padding-left: 0; }
.search-box input:focus { box-shadow: none; }
.view-toggle { display: flex; background: #ebe8df; border-radius: 11px; padding: 3px; }
.view-toggle button { width: 38px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 18px; }
.view-toggle button.active { background: var(--panel); color: var(--green); box-shadow: 0 2px 8px rgba(0,0,0,.08); }

.selection-bar { display: flex; justify-content: space-between; gap: 16px; align-items: center; background: var(--green-2); border: 1px solid #c5d9ca; padding: 14px 16px; border-radius: 14px; margin-bottom: 16px; }
.selection-bar span, .selection-bar strong { display: block; }
.selection-bar span { color: var(--green); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.selection-bar strong { margin-top: 4px; word-break: break-all; font-size: 13px; }
.loading { display: flex; gap: 10px; align-items: center; justify-content: center; padding: 70px; color: var(--muted); }
.loading i { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--green); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.file-area { border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: var(--panel); }
.file-row { display: grid; grid-template-columns: minmax(0, 1fr) 100px 130px auto; align-items: center; gap: 18px; min-height: 64px; padding: 9px 16px; border-bottom: 1px solid #ebe8df; }
.file-row:last-child { border-bottom: 0; }
.file-row:hover { background: #faf8f2; }
.file-main { min-width: 0; display: flex; align-items: center; gap: 13px; cursor: pointer; }
.file-icon { flex: 0 0 auto; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: #ece9df; color: var(--muted); font-weight: 800; font-size: 12px; text-transform: uppercase; }
.file-icon.folder { background: #e5eadb; color: #556b3d; border-radius: 9px 9px 9px 4px; }
.file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 650; }
.file-meta { color: var(--muted); font-size: 12px; }
.row-action { border: 0; background: transparent; color: var(--green); padding: 8px; font-size: 12px; font-weight: 750; }

.file-area.grid-view { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1px; background: var(--line); }
.grid-view .file-row { display: flex; flex-direction: column; align-items: stretch; gap: 8px; min-height: 184px; padding: 12px; background: var(--panel); border: 0; }
.grid-view .file-main { display: block; }
.grid-view .file-icon { width: 100%; height: 108px; font-size: 22px; }
.grid-view .file-icon.image { overflow: hidden; background: #e9e7df; }
.grid-view .file-icon.image img { width: 100%; height: 100%; object-fit: cover; }
.grid-view .file-name { display: block; margin-top: 9px; }
.grid-view .file-meta.date { display: none; }
.grid-view .row-action { text-align: left; padding: 0; }

.empty-panel { padding: 80px 20px; text-align: center; border: 1px dashed #cbc7bb; border-radius: 18px; background: rgba(255,253,248,.55); }
.empty-panel.compact { padding: 60px 20px; }
.empty-panel h2 { font-family: Georgia, "Noto Serif SC", serif; margin: 12px 0 7px; }
.empty-panel p { color: var(--muted); margin: 0 0 20px; }
.empty-icon { width: 52px; height: 52px; display: grid; place-items: center; margin: auto; border-radius: 16px; background: var(--green-2); color: var(--green); font-size: 25px; }
.select-folder { position: fixed; z-index: 4; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); border: 0; border-radius: 999px; padding: 15px 24px; background: var(--green); color: white; font-weight: 800; box-shadow: 0 12px 35px rgba(26,75,51,.32); }
.toast { position: fixed; z-index: 20; left: 50%; bottom: 88px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: #1f241f; color: white; border-radius: 10px; padding: 11px 16px; font-size: 13px; transition: .2s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.preview-dialog { width: min(920px, calc(100% - 28px)); max-height: 90vh; border: 0; border-radius: 20px; padding: 0; background: #161916; color: white; overflow: hidden; box-shadow: 0 30px 90px rgba(0,0,0,.4); }
.preview-dialog::backdrop { background: rgba(18,22,18,.72); backdrop-filter: blur(5px); }
.preview-dialog > img { display: block; width: 100%; max-height: 70vh; object-fit: contain; background: #0e100e; }
.close-preview { position: absolute; right: 12px; top: 12px; z-index: 2; width: 38px; height: 38px; border: 0; border-radius: 50%; background: rgba(0,0,0,.55); color: white; font-size: 25px; }
.preview-caption { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 16px 18px; }
.preview-caption strong, .preview-caption span { display: block; }
.preview-caption span { max-width: 650px; margin-top: 5px; color: #aab0aa; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 680px) {
  .login-card { padding: 32px 23px; border-radius: 22px; }
  .password-row { display: grid; }
  .topbar { height: 92px; padding: 16px; }
  .topbar h1 { font-size: 23px; }
  .status-wrap { gap: 7px; }
  .workspace { width: calc(100% - 24px); margin: 15px auto; }
  .toolbar { gap: 7px; margin-bottom: 15px; }
  .action-row { gap: 8px; }
  .file-row { grid-template-columns: minmax(0,1fr) auto; gap: 8px; padding: 9px 11px; }
  .file-meta { display: none; }
  .file-area.grid-view { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid-view .file-row { min-height: 175px; }
  .grid-view .file-meta.size { display: block; }
  .selection-bar { align-items: flex-end; }
  .selection-bar strong { max-width: 220px; }
  .preview-caption { align-items: flex-end; }
}
