:root {
    --bg: #eceef1;
    --surface: #ffffff;
    --surface-2: #f4f5f7;
    --hover: #f0f1f4;
    --selected: #e7e9ee;
    --line: #e7e9ed;
    --ink: #1f2023;
    --ink-2: #5d6168;
    --ink-3: #9a9ea6;
    --accent: #ffdb4d;
    --accent-hover: #ffd21f;
    --accent-soft: #fff2bf;
    --link: #1a6dd8;
    --danger: #e5484d;
    --brand: #ff0000;
    --plan: #ff7a3c;
    --radius: 16px;
    --rail-w: 60px;
    --sidebar-w: 248px;
    --shadow: 0 12px 40px rgba(20, 24, 31, .16);
    color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0; background: var(--bg); color: var(--ink);
    font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 20px; height: 20px; flex: none; }
a { color: var(--link); }
[hidden], .hidden { display: none !important; }
.muted { color: var(--ink-2); }
.small { font-size: 12.5px; }
.spinner {
    width: 28px; height: 28px; border-radius: 50%;
    border: 3px solid rgba(0, 0, 0, .08); border-top-color: var(--ink-2);
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.boot { position: fixed; inset: 0; display: grid; place-items: center; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 36px; padding: 0 16px; border-radius: 10px; border: 0;
    background: var(--surface-2); font-weight: 550; text-decoration: none; color: inherit;
}
.btn:hover { background: var(--hover); }
.btn-primary { background: var(--accent); color: #1b1b1b; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-block { width: 100%; }
.btn-link { background: none; color: var(--ink-2); height: auto; padding: 8px; }
.icon-btn {
    display: inline-grid; place-items: center; width: 32px; height: 32px;
    border: 0; border-radius: 8px; background: none; color: var(--ink-2);
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }
.input {
    width: 100%; height: 42px; padding: 0 14px; border-radius: 10px;
    border: 1px solid var(--line); background: var(--surface); outline: none;
}
.input:focus { border-color: #c9ccd2; box-shadow: 0 0 0 3px rgba(255, 219, 77, .45); }

.login, .share {
    min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px;
}
.login-card, .share-card {
    width: 100%; max-width: 420px; background: var(--surface); border-radius: 20px;
    padding: 32px 28px 24px; box-shadow: 0 10px 30px rgba(0, 0, 0, .06); text-align: center;
}
.login-brand h1, .share-card h1 { margin: 12px 0 4px; font-size: 22px; font-weight: 650; }
.login-logo { width: 44px; height: 48px; }
.login-checking { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 24px 0; }
.login-profile { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.login-avatar {
    width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
    background: var(--accent-soft); font-size: 22px; font-weight: 600; margin-bottom: 8px;
}
.login-profile-name { font-size: 17px; font-weight: 600; }
.login-tabs { display: flex; background: var(--surface-2); border-radius: 10px; padding: 3px; margin-bottom: 16px; }
.login-tab { flex: 1; height: 32px; border: 0; border-radius: 8px; background: none; color: var(--ink-2); }
.login-tab.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.login-panel { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.qr-box { width: 232px; height: 232px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.qr-box img, .qr-box canvas, .qr-box svg { width: 100% !important; height: auto !important; }
.login-status { min-height: 18px; margin: 14px 0 0; }
.login-error { margin: 10px 0 0; color: var(--danger); font-size: 13px; }
.login-foot { margin-top: 18px; display: flex; align-items: center; justify-content: center; gap: 12px; }
.share-list { text-align: left; margin: 12px 0 18px; max-height: 280px; overflow: auto; }
.share-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.share-row a { color: inherit; text-decoration: none; }

.app { display: flex; height: 100vh; height: 100dvh; padding: 8px 8px 8px 0; }
.rail { width: var(--rail-w); flex: none; display: flex; flex-direction: column; align-items: center; padding: 6px 0 4px; }
.rail-logo { display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: 14px; }
.rail-logo img { width: 26px; height: 28px; }
.rail-services { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.rail-item {
    position: relative; display: grid; place-items: center; width: 40px; height: 40px;
    border-radius: 12px; color: #4a4e55; text-decoration: none;
}
.rail-item svg { width: 21px; height: 21px; }
.rail-item:hover { background: rgba(0, 0, 0, .06); color: var(--ink); }
.rail-item.active { background: var(--surface); color: var(--brand); box-shadow: 0 1px 4px rgba(0, 0, 0, .06); }
.rail-item .tip {
    position: absolute; left: 48px; top: 50%; transform: translateY(-50%); white-space: nowrap;
    background: #2a2c31; color: #fff; font-size: 12px; padding: 4px 9px; border-radius: 6px;
    opacity: 0; pointer-events: none; z-index: 30;
}
.rail-item:hover .tip { opacity: 1; }
.rail-bottom { margin-top: auto; position: relative; }
.rail-avatar, .user-avatar {
    width: 34px; height: 34px; border-radius: 50%; border: 0; padding: 0; overflow: hidden;
    display: grid; place-items: center; background: var(--accent-soft); font-size: 13px; font-weight: 600; color: #5a4700;
}
.rail-avatar img, .user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-avatar { width: 44px; height: 44px; font-size: 16px; }
.user-menu-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.user-menu {
    position: absolute; left: 46px; bottom: 0; width: 230px; background: var(--surface);
    border-radius: 14px; box-shadow: var(--shadow); padding: 12px; z-index: 40;
}
.user-menu-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu-item {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 0;
    border-radius: 8px; background: none; text-align: left;
}
.user-menu-item:hover { background: var(--hover); }
.user-menu-item svg { width: 18px; height: 18px; color: var(--ink-2); }

.workspace {
    flex: 1; min-width: 0; display: flex; background: var(--surface); border-radius: var(--radius);
    overflow: hidden; box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}
.sidebar {
    width: var(--sidebar-w); flex: none; display: flex; flex-direction: column;
    border-right: 1px solid var(--line); padding: 14px 12px 10px; min-height: 0; background: #fbfbfc;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 8px; }
.sidebar-head h2 { margin: 0; font-size: 22px; font-weight: 650; }
.search {
    display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; margin-bottom: 10px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 10px; color: var(--ink-3);
}
.search svg { width: 16px; height: 16px; }
.search-input { flex: 1; min-width: 0; border: 0; outline: none; background: none; }
.side-btn {
    display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 40px;
    border-radius: 12px; margin-bottom: 8px; font-weight: 600;
}
.btn-upload { background: #fff; border: 1px solid #e3e5e9; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.btn-upload:hover { background: var(--hover); }
.btn-create { background: #2c2e33; color: #fff; border: 0; }
.btn-create:hover { background: #1c1e22; }
.side-btn svg { width: 18px; height: 18px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; overflow: auto; }
.nav-btn {
    display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none;
    border-radius: 10px; padding: 8px 10px; text-align: left; color: var(--ink);
}
.nav-btn svg { width: 18px; height: 18px; color: var(--ink-2); }
.nav-btn:hover { background: var(--hover); }
.nav-btn.on { background: #eceef2; font-weight: 650; }
.quota { margin-top: auto; border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: #fff; }
.quota-label { font-size: 12.5px; color: var(--ink-2); margin-bottom: 8px; }
.quota-bar { height: 6px; background: #eceef1; border-radius: 99px; overflow: hidden; }
.quota-bar span { display: block; height: 100%; width: 0; background: #3d8bfd; border-radius: inherit; }
.btn-plan {
    width: 100%; margin-top: 12px; height: 36px; border: 0; border-radius: 10px;
    background: var(--plan); color: #fff; font-weight: 700;
}
.btn-plan:hover { filter: brightness(.96); }
.install {
    display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 4px 6px;
    color: var(--ink-2); text-decoration: none; font-size: 13px;
}
.install:hover { color: var(--ink); }
.install svg { width: 16px; height: 16px; }

.board { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; background: #f7f8fa; }
.board-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 18px 6px; }
.board-head h2 { margin: 0; font-size: 22px; font-weight: 650; }
.board-tools { display: flex; align-items: center; gap: 6px; }
.sort-wrap { position: relative; }
.sort-btn {
    height: 32px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--ink-2);
}
.sort-menu { position: absolute; right: 0; top: 36px; min-width: 160px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; min-height: 18px; }
.crumb, .crumb-static {
    border: 0; background: none; color: var(--ink-2); padding: 0 2px; font-size: 13px;
}
.crumb.drop, .tile.drop { outline: 2px solid #e0b400; background: var(--accent-soft); }
.crumb:hover { color: var(--ink); }
.board-scroll { flex: 1; min-height: 0; overflow: auto; padding: 8px 14px 20px; }
.grid { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 6px; }
.grid.list { display: flex; flex-direction: column; gap: 2px; }
.tile {
    width: 118px; border: 0; background: transparent; border-radius: 12px; padding: 8px 6px 10px;
    display: flex; flex-direction: column; align-items: center; gap: 6px; color: inherit; position: relative;
}
.grid.list .tile { width: 100%; flex-direction: row; padding: 6px 10px; gap: 12px; }
.tile:hover { background: rgba(0, 0, 0, .04); }
.tile.on { background: var(--selected); }
.tile .glyph, .tile .thumb {
    width: 76px; height: 60px; display: grid; place-items: center;
}
.grid.list .tile .glyph, .grid.list .tile .thumb { width: 36px; height: 30px; }
.tile .thumb { object-fit: cover; border-radius: 8px; background: #fff; }
.tile .name {
    font-size: 12.5px; text-align: center; width: 100%; word-break: break-word;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.grid.list .tile .name { text-align: left; -webkit-line-clamp: 1; flex: 1; }
.tile .meta { display: none; color: var(--ink-3); font-size: 12px; white-space: nowrap; }
.grid.list .tile .meta { display: block; }
.glyph.folder { color: #f5c451; }
.glyph.album { color: #8d9aa5; }
.glyph.document { color: #4c8dff; }
.glyph.spreadsheet { color: #3cba6e; }
.glyph.presentation { color: #f5a524; }
.glyph.file, .glyph.pdf { color: #9aa1ab; }
.glyph svg { width: 64px; height: 52px; }
.grid.list .glyph svg { width: 28px; height: 24px; }

.event-row, .space-row {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; background: #fff; margin-bottom: 6px;
}
.event-row b, .space-row b { font-weight: 600; }
.event-row span, .space-row span { margin-left: auto; color: var(--ink-2); font-size: 12.5px; }
.space { max-width: 520px; }
.empty { padding: 48px 16px; text-align: center; }
.drop-overlay {
    position: absolute; inset: 12px; border: 2px dashed #e0b400; border-radius: 14px;
    background: rgba(255, 242, 191, .82); display: grid; place-items: center;
    font-size: 16px; font-weight: 650; z-index: 5; pointer-events: none;
}
.footer {
    display: flex; justify-content: space-between; align-items: center; padding: 8px 18px;
    font-size: 12px; color: var(--ink-3); background: #f7f8fa;
}
.footer a { color: var(--ink-3); text-decoration: none; }
.footer a:hover { color: var(--ink); }
.footer-right { display: flex; align-items: center; gap: 12px; }
.lang-btn { border: 0; background: none; color: var(--ink-3); font-size: 12px; padding: 2px 4px; border-radius: 4px; text-transform: uppercase; }
.lang-btn:hover, .lang-btn[aria-expanded="true"] { color: var(--ink); background: var(--hover); }
.lang-menu {
    position: fixed; z-index: 90; width: 210px; max-height: min(360px, calc(100vh - 24px));
    overflow: auto; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); padding: 6px;
}
.lang-option {
    display: flex; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 8px;
}
.lang-option:hover { background: var(--hover); }
.lang-option.active { background: var(--accent-soft); font-weight: 600; }

.ctx {
    position: fixed; z-index: 50; min-width: 220px; background: #fff; border-radius: 14px;
    box-shadow: 0 16px 40px rgba(20, 24, 31, .2); padding: 6px;
}
.ctx button, .ctx .ctx-link {
    display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none;
    border-radius: 8px; padding: 8px 10px; text-align: left; color: inherit; text-decoration: none;
}
.ctx button:hover, .ctx .ctx-link:hover { background: var(--hover); }
.ctx svg { width: 18px; height: 18px; color: var(--ink-2); }
.ctx .ico { width: 22px; height: 22px; display: grid; place-items: center; }
.ctx hr { border: 0; border-top: 1px solid var(--line); margin: 4px 8px; }
.ctx .danger { color: var(--danger); }
.ctx .danger svg { color: var(--danger); }
.mini.folder { color: #f5c451; }
.mini.document { color: #4c8dff; }
.mini.spreadsheet { color: #3cba6e; }
.mini.presentation { color: #f5a524; }
.mini.album { color: #8d9aa5; }

.dialog-backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(15, 17, 20, .35); display: grid; place-items: center; padding: 16px; }
.dialog { width: 100%; max-width: 420px; background: var(--surface); border-radius: 16px; padding: 22px; box-shadow: var(--shadow); }
.dialog h3 { margin: 0 0 14px; font-size: 18px; }
.dialog p { margin: 0 0 16px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.picker { max-height: 280px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.picker button { display: flex; width: 100%; text-align: left; border: 0; background: none; padding: 8px 12px; gap: 8px; }
.picker button:hover, .picker button.on { background: var(--hover); }
.toast {
    position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 80;
    background: #25272c; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13.5px;
    box-shadow: var(--shadow); max-width: calc(100vw - 32px);
}

.office {
    position: fixed; z-index: 60;
    top: 8px; right: 8px; bottom: 8px; left: calc(var(--rail-w) + 8px);
    display: flex; flex-direction: column; overflow: hidden;
    background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
}
.office.hidden { display: none; }
.office-bar {
    flex: none; height: 48px; display: flex; align-items: center; gap: 12px;
    padding: 0 12px; border-bottom: 1px solid var(--line);
}
.office-bar h2 { margin: 0; font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.office-frame { flex: 1; min-height: 0; }
.office-frame iframe { width: 100%; height: 100%; border: 0; display: block; }

@media (max-width: 800px) {
    .app { padding: 0; }
    .rail { display: none; }
    .workspace { border-radius: 0; }
    .sidebar { width: 100%; max-height: 46vh; border-right: 0; border-bottom: 1px solid var(--line); }
    .workspace { flex-direction: column; }
    .footer { display: none; }
    .tile { width: 96px; }
    .office { left: 0; top: 0; right: 0; bottom: 0; border-radius: 0; }
}
