:root {
  font-family: Inter, "Microsoft YaHei", system-ui, sans-serif;
  color: #202422;
  background: #f3f5f4;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; overflow: hidden; }
button, input { font: inherit; }
button { cursor: pointer; }
.app-shell { display: grid; grid-template: 64px calc(100vh - 64px) / 250px 1fr; }
.topbar {
  grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px; background: #fff; border-bottom: 1px solid #dce1de;
}
.brand-block { display: flex; align-items: center; gap: 11px; }
.brand-block > div:last-child { display: grid; gap: 1px; }
.brand-block strong { font-size: 16px; }
.brand-block span:not(.brand-mark) { color: #77807b; font-size: 11px; }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 6px;
  background: #202422; color: #fff; font-size: 11px; font-weight: 800;
}
.brand-mark.large { width: 46px; height: 46px; margin-bottom: 18px; font-size: 14px; }
.top-actions { display: flex; align-items: center; gap: 14px; }
.cloud-state { display: flex; align-items: center; gap: 7px; color: #59615d; font-size: 13px; }
.cloud-state i { width: 8px; height: 8px; border-radius: 50%; background: #1f8a55; }
.icon-button {
  display: grid; place-items: center; width: 34px; height: 34px; padding: 0;
  border: 1px solid #d8dedb; border-radius: 5px; background: #fff; color: #3b423e; font-size: 19px;
}
.icon-button:hover { background: #f1f4f2; border-color: #bfc8c3; }
.icon-button.small { width: 28px; height: 28px; font-size: 16px; }
.sidebar { overflow-y: auto; background: #ecefed; border-right: 1px solid #d6dcda; padding: 20px 12px; }
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 13px; color: #68716c; font-size: 12px; font-weight: 650; }
.device-tree { display: grid; gap: 7px; }
.device-row, .root-row {
  width: 100%; display: flex; align-items: center; gap: 9px; min-height: 38px; padding: 7px 9px;
  border: 0; border-radius: 5px; background: transparent; color: #303632; text-align: left;
}
.device-row:hover, .root-row:hover, .root-row.active { background: #fff; }
.device-row strong { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.device-icon { display: grid; place-items: center; width: 23px; height: 23px; border: 1px solid #bfc8c3; border-radius: 4px; font-size: 10px; }
.online-dot { width: 7px; height: 7px; border-radius: 50%; background: #aab1ad; }
.online-dot.online { background: #1f8a55; }
.root-list { display: grid; margin: -2px 0 3px 31px; }
.root-row { min-height: 34px; color: #5e6762; font-size: 13px; }
.root-symbol { color: #a76b16; font-size: 15px; }
.workspace { min-width: 0; overflow-y: auto; padding: 30px 34px 48px; }
.workspace-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.breadcrumbs { min-height: 22px; display: flex; align-items: center; gap: 5px; margin-bottom: 4px; color: #69716d; font-size: 12px; }
.breadcrumbs button { border: 0; padding: 2px 3px; background: transparent; color: inherit; }
.breadcrumbs button:hover { color: #146c43; }
h1 { margin: 0; font-size: 25px; letter-spacing: 0; }
#pageMeta { margin: 6px 0 0; color: #747d78; font-size: 13px; }
.workspace-tools { display: flex; gap: 10px; }
.search-box {
  display: flex; align-items: center; gap: 7px; width: 230px; height: 36px; padding: 0 10px;
  border: 1px solid #d5dcd8; border-radius: 5px; background: #fff; color: #7b847f;
}
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: #202422; font-size: 13px; }
.segmented { display: flex; height: 36px; border: 1px solid #d5dcd8; border-radius: 5px; overflow: hidden; background: #fff; }
.segmented button { width: 38px; border: 0; border-left: 1px solid #e0e5e2; background: #fff; color: #69716d; font-size: 16px; }
.segmented button:first-child { border-left: 0; }
.segmented button.active { background: #e7efe9; color: #146c43; }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.file-card {
  min-width: 0; display: grid; grid-template-rows: 104px auto; padding: 0; overflow: hidden;
  border: 1px solid #dce1de; border-radius: 6px; background: #fff; text-align: left;
}
.file-card:hover { border-color: #aeb9b3; box-shadow: 0 3px 12px rgba(24, 33, 28, .07); }
.file-visual { display: grid; place-items: center; background: #f0f3f1; border-bottom: 1px solid #e2e6e4; }
.file-glyph { display: grid; place-items: center; width: 48px; height: 57px; border: 1px solid #c4ccc8; border-radius: 4px; background: #fff; color: #69716d; font-size: 11px; font-weight: 750; }
.file-glyph.folder { width: 60px; height: 44px; border-color: #d2a04e; background: #e7b65e; color: #694718; font-size: 18px; }
.file-info { min-width: 0; padding: 12px; }
.file-name { display: block; overflow: hidden; color: #272c29; font-size: 13px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.file-detail { display: block; margin-top: 5px; color: #818985; font-size: 11px; }
.file-grid.list { display: table; width: 100%; border-collapse: collapse; background: #fff; border: 1px solid #dce1de; border-radius: 6px; overflow: hidden; }
.file-grid.list .file-card { display: table-row; border: 0; border-radius: 0; box-shadow: none; }
.file-grid.list .file-card + .file-card > * { border-top: 1px solid #e5e9e7; }
.file-grid.list .file-visual { display: table-cell; width: 56px; height: 50px; border: 0; background: #fff; vertical-align: middle; }
.file-grid.list .file-glyph { width: 28px; height: 32px; margin: auto; font-size: 8px; }
.file-grid.list .file-glyph.folder { width: 32px; height: 25px; font-size: 11px; }
.file-grid.list .file-info { display: table-cell; padding: 10px 12px; vertical-align: middle; }
.empty-state { grid-column: 1 / -1; padding: 70px 20px; border-top: 1px solid #dce1de; text-align: center; color: #78817c; }
.empty-state strong { display: block; margin-bottom: 7px; color: #3f4642; font-size: 15px; }
.skeleton { height: 168px; border: 1px solid #e0e4e2; border-radius: 6px; background: #e9ecea; animation: pulse 1.3s infinite alternate; }
@keyframes pulse { to { background: #f5f6f5; } }
.auth-screen { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px; background: #eef1ef; }
.auth-screen.hidden { display: none; }
.auth-panel { width: min(390px, 100%); padding: 34px; border: 1px solid #d7ddda; border-radius: 7px; background: #fff; box-shadow: 0 16px 44px rgba(27, 36, 31, .12); }
.auth-panel h2 { margin: 0; font-size: 23px; }
.auth-panel p { margin: 7px 0 24px; color: #747d78; font-size: 13px; }
.auth-panel label { display: grid; gap: 7px; color: #545c58; font-size: 12px; font-weight: 650; }
.auth-panel label + label { margin-top: 13px; }
.auth-panel input { width: 100%; height: 42px; padding: 0 11px; border: 1px solid #cdd5d1; border-radius: 5px; outline: 0; }
.auth-panel input:focus { border-color: #2c7c55; box-shadow: 0 0 0 3px #e0eee6; }
.primary-button { width: 100%; height: 42px; margin-top: 17px; border: 0; border-radius: 5px; background: #216c48; color: #fff; font-weight: 700; }
.primary-button:hover { background: #185a3b; }
.form-error { min-height: 18px; margin-top: 8px; color: #b42318; font-size: 12px; }
.settings-dialog { width: min(620px, calc(100% - 28px)); max-height: min(720px, calc(100vh - 28px)); padding: 0; border: 1px solid #cfd6d2; border-radius: 7px; background: #fff; box-shadow: 0 22px 70px rgba(19, 28, 23, .25); }
.settings-dialog::backdrop { background: rgba(24, 29, 26, .58); }
.settings-dialog > header { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px; border-bottom: 1px solid #dde2df; }
.settings-dialog h2 { margin: 0; font-size: 19px; }
.settings-dialog header p { margin: 5px 0 0; color: #747d78; font-size: 12px; }
.access-code-form { display: flex; align-items: end; gap: 10px; padding: 18px 22px; border-bottom: 1px solid #e3e7e5; }
.access-code-form label { flex: 1; display: grid; gap: 6px; color: #59615d; font-size: 12px; font-weight: 650; }
.access-code-form input { height: 38px; padding: 0 10px; border: 1px solid #cdd5d1; border-radius: 5px; outline: 0; }
.button-reset { height: 38px; border: 0; }
.issued-code { margin: 18px 22px 0; padding: 13px; border: 1px solid #b8d4c3; border-radius: 6px; background: #edf6f0; }
.issued-code > span { display: block; margin-bottom: 9px; color: #526059; font-size: 12px; }
.issued-code > div { display: flex; align-items: center; gap: 8px; }
.issued-code code { flex: 1; min-width: 0; overflow-wrap: anywhere; color: #174c34; font-size: 13px; }
.access-code-list { max-height: 390px; overflow-y: auto; padding: 12px 22px 22px; }
.access-code-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 62px; border-bottom: 1px solid #e3e7e5; }
.access-code-row > div { min-width: 0; display: grid; gap: 5px; }
.access-code-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.access-code-row span { color: #747d78; font-size: 11px; }
.preview-dialog { position: relative; width: min(1000px, calc(100% - 32px)); max-width: none; height: min(760px, calc(100vh - 32px)); max-height: none; padding: 0; border: 1px solid #cfd6d2; border-radius: 7px; background: #fff; box-shadow: 0 22px 70px rgba(19, 28, 23, .25); }
.preview-dialog[open] { display: grid; grid-template-rows: 58px minmax(0, 1fr) 58px; }
.preview-dialog.maximized { width: 100vw; height: 100vh; margin: 0; border: 0; border-radius: 0; }
.preview-dialog::backdrop { background: rgba(24, 29, 26, .58); }
.preview-dialog header, .preview-dialog footer { height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 0 18px; }
.preview-dialog header { border-bottom: 1px solid #dde2df; }
.preview-dialog header strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-dialog footer { border-top: 1px solid #dde2df; color: #707974; font-size: 12px; }
.preview-body { position: relative; width: 100%; min-width: 0; min-height: 0; overflow: hidden; background: #252a27; }
.preview-body img { position: absolute; inset: 0; display: block; width: auto; height: auto; max-width: 100%; max-height: 100%; margin: auto; object-fit: contain; }
.preview-body video { display: block; max-width: 100%; max-height: 100%; }
.preview-body.actual-size { display: block; overflow: auto; padding: 24px; }
.preview-body.actual-size img { position: static; width: auto; height: auto; max-width: none; max-height: none; margin: auto; object-fit: none; }
.preview-body video { width: 100%; height: 100%; background: #000; }
.preview-body audio { width: min(640px, calc(100% - 40px)); }
.preview-body iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.preview-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.preview-size-controls { height: 34px; }
.preview-size-controls button { width: auto; min-width: 82px; padding: 0 11px; font-size: 12px; }
.preview-nav { position: absolute; z-index: 2; top: 50%; width: 44px; height: 54px; padding: 0; border: 1px solid rgba(255, 255, 255, .25); border-radius: 5px; background: rgba(24, 29, 26, .72); color: #fff; font-size: 34px; line-height: 1; }
.preview-nav:hover { background: rgba(24, 29, 26, .92); }
.preview-nav:disabled { cursor: default; opacity: .28; }
.preview-nav.previous { left: 14px; }
.preview-nav.next { right: 14px; }
.preview-fallback { color: #d6dcd8; text-align: center; }
.command-button { display: inline-flex; align-items: center; min-height: 34px; padding: 0 14px; border-radius: 5px; background: #216c48; color: #fff; text-decoration: none; font-weight: 650; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 30; max-width: min(380px, calc(100% - 44px)); padding: 12px 15px; border-radius: 5px; background: #282e2a; color: #fff; font-size: 13px; opacity: 0; transform: translateY(8px); pointer-events: none; transition: .18s ease; }
.toast.visible { opacity: 1; transform: translateY(0); }
@media (max-width: 760px) {
  body { overflow: auto; }
  .app-shell { grid-template: 58px auto 1fr / 1fr; min-height: 100vh; }
  .topbar { height: 58px; padding: 0 15px; }
  .sidebar { max-height: 180px; border-right: 0; border-bottom: 1px solid #d6dcda; padding: 12px; }
  .workspace { padding: 22px 16px 40px; overflow: visible; }
  .workspace-head { align-items: stretch; flex-direction: column; }
  .workspace-tools { width: 100%; }
  .search-box { flex: 1; width: auto; }
  .file-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .file-card { grid-template-rows: 88px auto; }
  .cloud-state { display: none; }
  .preview-dialog { width: 100vw; height: 100vh; margin: 0; border: 0; border-radius: 0; }
  .preview-dialog header, .preview-dialog footer { padding: 0 10px; gap: 8px; }
  .preview-size-controls button { min-width: 0; padding: 0 8px; }
  .preview-nav.previous { left: 8px; }
  .preview-nav.next { right: 8px; }
  .access-code-form { align-items: stretch; flex-direction: column; }
}
