:root {
    --blue: #1769ff;
    --blue-strong: #0e54d8;
    --blue-soft: #eaf2ff;
    --ink: #152033;
    --muted: #708096;
    --line: #e7ebf2;
    --surface: #ffffff;
    --surface-soft: #f6f8fb;
    --danger: #d64545;
    --shadow: 0 22px 60px rgba(31, 45, 72, 0.14);
    --rail-width: 72px;
    --sidebar-width: 272px;
}

body.workflow-space {
    --blue: #4059e8;
    --blue-strong: #3047cd;
    --blue-soft: #edf0ff;
    --surface-soft: #f5f7fb;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
    margin: 0;
    overflow: hidden;
    color: var(--ink);
    background: var(--surface-soft);
    font-family: Inter, "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
    -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
    outline: 3px solid rgba(23, 105, 255, 0.22);
    outline-offset: 2px;
}

[hidden] { display: none !important; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.app-shell {
    display: grid;
    grid-template-columns: var(--rail-width) var(--sidebar-width) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    height: 100vh;
}

.icon-rail {
    position: relative;
    z-index: 30;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: visible;
    align-items: center;
    gap: 10px;
    padding: 18px 12px;
    color: #738197;
    border-right: 1px solid var(--line);
    background: #fff;
    box-shadow: 8px 0 24px rgba(31, 45, 72, 0.035);
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    margin-bottom: 14px;
    overflow: hidden;
    border-radius: 13px;
    background: transparent;
    box-shadow: none;
}

.brand-mark img { width: 100%; height: 100%; object-fit: contain; }

.rail-btn {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    color: inherit;
    border-radius: 13px;
    text-decoration: none;
    transition: 160ms ease;
}

.rail-btn svg { width: 20px; height: 20px; }
.rail-btn:hover { color: var(--blue); background: var(--blue-soft); }
.rail-btn.active { color: var(--blue); background: var(--blue-soft); }
.rail-btn.active::before {
    content: "";
    position: absolute;
    left: -12px;
    width: 3px;
    height: 22px;
    border-radius: 0 3px 3px 0;
    background: var(--blue);
}
.rail-btn { position: relative; }
.rail-tooltip {
    position: absolute;
    left: 55px;
    z-index: 80;
    padding: 6px 8px;
    color: #fff;
    border-radius: 7px;
    background: #1b2638;
    box-shadow: 0 8px 22px rgba(0,0,0,.18);
    font-size: 10px;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-4px);
    transition: 140ms ease;
    white-space: nowrap;
}
.rail-btn:hover .rail-tooltip { opacity: 1; transform: translateX(0); }

.account-anchor { position: relative; margin-top: auto; }

.avatar-button {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    padding: 0;
    overflow: hidden;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    border: 2px solid #dce5f4;
    border-radius: 50%;
    background: linear-gradient(135deg, #347dff, #6942d9);
    cursor: pointer;
}

.avatar-button > #railAvatar {
    display: grid;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    place-items: center;
    line-height: 1;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
}

.account-popover {
    position: absolute;
    left: 58px;
    bottom: 0;
    width: 286px;
    padding: 10px;
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
    box-shadow: var(--shadow);
}

.account-popover::after {
    content: "";
    position: absolute;
    right: 100%;
    bottom: 0;
    width: 18px;
    height: 64px;
}

.account-popover::before {
    content: "";
    position: absolute;
    left: -8px;
    bottom: 22px;
    width: 14px;
    height: 14px;
    transform: rotate(45deg);
    border-left: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: #fff;
}

.account-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 8px 12px;
}

.account-summary > div:last-child { min-width: 0; }
.account-summary strong, .account-summary span { display: block; }
.account-summary strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.account-summary span { overflow: hidden; margin-top: 3px; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }

.account-credit-card {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    margin: 0 4px 8px;
    padding: 10px;
    border: 1px solid #e7edf7;
    border-radius: 12px;
    background: #f8fbff;
}

.account-credit-card .credit-symbol {
    width: 34px;
    height: 34px;
    object-fit: contain;
    border-radius: 10px;
    background: #eaf1ff;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.7);
}

.account-credit-card span { display: grid; gap: 2px; min-width: 0; }
.account-credit-card small, .account-credit-card b { color: var(--muted); font-size: 10px; }
.account-credit-card strong { font-size: 18px; }

.account-ledger {
    display: grid;
    gap: 7px;
    margin: 0 4px 8px;
    padding: 8px 10px;
    border-top: 1px solid #edf2f8;
    border-bottom: 1px solid #edf2f8;
}

.account-ledger-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; font-size: 11px; }
.account-ledger-row span { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.account-ledger-row b { color: var(--ink); }

.popover-action {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 9px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    cursor: pointer;
}

.popover-action:first-of-type { margin-top: 6px; }
.popover-action svg { width: 16px; height: 16px; color: var(--muted); }
.popover-action-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
}
.popover-action:hover { background: var(--surface-soft); }
.popover-action.danger { color: var(--danger); }
.popover-action.danger svg { color: currentColor; }

.sidebar {
    position: relative;
    z-index: 20;
    display: flex;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    flex-direction: column;
    border-right: 1px solid var(--line);
    background:
        linear-gradient(180deg, rgba(246,249,255,.65), transparent 180px),
        var(--surface);
}

.sidebar-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 30px 24px 20px;
}

.eyebrow {
    display: block;
    color: #9ba7ba;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
}

.sidebar-heading h1 {
    margin: 0;
    font-size: 22px;
    letter-spacing: -0.03em;
}

.sidebar-close { display: none !important; }

.create-actions {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    padding: 0 24px 22px;
}

.primary-button, .secondary-button, .danger-button {
    display: inline-flex;
    min-height: 50px;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 0 15px;
    border-radius: 13px;
    font-size: 14px;
    font-weight: 750;
    cursor: pointer;
    transition: 160ms ease;
}

.primary-button {
    color: #fff;
    border: 1px solid var(--blue);
    background: var(--blue);
    box-shadow: 0 7px 16px rgba(23, 105, 255, 0.2);
}

.primary-button:hover { border-color: var(--blue-strong); background: var(--blue-strong); transform: translateY(-1px); }
.primary-button:disabled { opacity: 0.55; cursor: wait; transform: none; }
.primary-button svg, .secondary-button svg { width: 17px; height: 17px; }
.primary-button.compact { min-height: 38px; }

.secondary-button {
    color: #4c5b70;
    border: 1px solid var(--line);
    background: #fff;
}

.secondary-button:hover { border-color: #c8d1df; background: var(--surface-soft); }
.create-actions .secondary-button { min-width: 94px; padding: 0 12px; }
.create-actions .secondary-button span { display: inline; }
.create-actions .primary-button {
    min-width: 0;
    padding-inline: 10px;
    white-space: nowrap;
    box-shadow: 0 10px 24px color-mix(in srgb, var(--blue) 22%, transparent);
}
.create-actions .secondary-button {
    min-width: 100px;
    gap: 7px;
    padding-inline: 9px;
    white-space: nowrap;
}

.danger-button {
    color: #fff;
    border: 1px solid var(--danger);
    background: var(--danger);
}

.space-nav { padding: 0 20px 18px; }
.space-nav-item, .folder-row {
    display: flex;
    width: 100%;
    min-height: 44px;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    color: #526075;
    border: 0;
    border-radius: 11px;
    background: transparent;
    cursor: pointer;
    text-align: left;
    font-size: 15px;
}

.space-nav-item svg, .folder-row svg { width: 17px; height: 17px; }
.sidebar-asset-icon {
    width: 23px;
    height: 23px;
    flex: 0 0 23px;
    object-fit: contain;
    filter: saturate(.88);
}
.folder-row .sidebar-asset-icon { width: 21px; height: 21px; flex-basis: 21px; }
.space-nav-item:hover, .folder-row:hover { background: var(--surface-soft); }
.space-nav-item.active, .folder-row.active {
    color: var(--blue);
    background: transparent;
    box-shadow: none;
    font-weight: 650;
}
.space-nav-item.active:hover, .folder-row.active:hover { background: transparent; }
.count-badge, .folder-count { margin-left: auto; color: #8c98aa; font-size: 11px; }

.folder-section {
    min-height: 0;
    flex: 1;
    padding: 0 20px;
    overflow: hidden;
}

.folder-section-title {
    display: flex;
    height: 34px;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px 0 0;
    color: #8a96a8;
    font-size: 12px;
    font-weight: 750;
}

.folder-list { max-height: calc(100vh - 284px); overflow-y: auto; }
.folder-item { position: relative; display: flex; align-items: center; }
.folder-row { padding-right: 62px; }
.folder-actions {
    position: absolute;
    right: 7px;
    display: flex;
    gap: 1px;
    opacity: 0;
    transition: opacity 140ms ease;
}
.folder-item:hover .folder-actions, .folder-actions:focus-within { opacity: 1; }

.mini-icon-button, .icon-button {
    display: inline-grid;
    place-items: center;
    padding: 0;
    color: #6e7c90;
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
}

.mini-icon-button { width: 28px; height: 28px; border-radius: 8px; }
.mini-icon-button svg { width: 15px; height: 15px; }
.mini-icon-button:hover { color: var(--blue); background: var(--blue-soft); }

.icon-button {
    width: 40px;
    height: 40px;
    border-color: var(--line);
    border-radius: 11px;
    background: #fff;
}
.icon-button:hover { color: var(--blue); border-color: #cad8ee; }
.icon-button svg { width: 18px; height: 18px; }

.avatar {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 36px;
    height: 36px;
    overflow: hidden;
    color: #fff;
    font-weight: 700;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, #347dff, #6942d9);
    background-position: center;
    background-size: cover;
}
.avatar-lg { width: 42px; height: 42px; }
.avatar-xl { width: 68px; height: 68px; cursor: pointer; }
.workspace {
    min-width: 0;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(circle at 80% -20%, color-mix(in srgb, var(--blue) 7%, transparent), transparent 40%),
        var(--surface-soft);
}

.workspace-header {
    display: flex;
    min-height: 86px;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    padding: 16px 28px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(14px);
}

.header-title { display: flex; min-width: 0; align-items: center; gap: 12px; }
.mobile-menu-button { display: none; }
.header-tools { display: flex; align-items: center; gap: 9px; }

.search-control {
    display: flex;
    width: min(330px, 32vw);
    height: 42px;
    align-items: center;
    gap: 9px;
    padding: 0 11px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-soft);
}
.search-control:focus-within { border-color: rgba(23, 105, 255, 0.5); box-shadow: 0 0 0 3px rgba(23, 105, 255, 0.08); }
.search-control svg { width: 17px; height: 17px; color: #8b98aa; }
.search-control input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; }
.search-control input::placeholder { color: #a6afbd; }
kbd { padding: 2px 5px; color: #9aa5b5; border: 1px solid #dde2ea; border-radius: 5px; background: #fff; font-size: 10px; }

.select-control { position: relative; display: flex; height: 42px; align-items: center; }
.sort-label {
    position: absolute;
    left: 13px;
    z-index: 1;
    color: #6f7d91;
    font-size: 12px;
    font-weight: 700;
    pointer-events: none;
}
.select-control select {
    height: 100%;
    min-width: 156px;
    padding: 0 38px 0 51px;
    color: #56657a;
    border: 1px solid var(--line);
    border-radius: 11px;
    outline: 0;
    appearance: none;
    background: #fff;
    cursor: pointer;
}
.select-control svg { position: absolute; right: 12px; width: 15px; height: 15px; pointer-events: none; }

.header-home-button {
    color: #516176;
    border-color: var(--line);
    text-decoration: none;
}

.content-area { position: relative; min-height: 0; flex: 1; overflow-y: auto; padding: 28px; }
.loading-state, .empty-state { min-height: calc(100vh - 150px); display: grid; place-content: center; justify-items: center; text-align: center; }
.loading-state p, .empty-state p { color: var(--muted); font-size: 13px; }
.spinner { width: 30px; height: 30px; border: 3px solid #dfe7f4; border-top-color: var(--blue); border-radius: 50%; animation: spin 800ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.empty-visual {
    display: grid;
    width: 78px;
    height: 78px;
    place-items: center;
    color: var(--blue);
    border: 1px solid #dce8ff;
    border-radius: 24px;
    background: linear-gradient(145deg, #fff, #eaf2ff);
    box-shadow: 0 16px 35px rgba(23, 105, 255, 0.12);
}
.empty-visual svg { width: 32px; height: 32px; }
.empty-state h3 { margin: 20px 0 0; font-size: 19px; }
.empty-state p { max-width: 360px; margin: 8px 0 18px; line-height: 1.7; }
.empty-actions { display: flex; align-items: center; justify-content: center; gap: 9px; }
.empty-actions .secondary-button { min-height: 38px; }

.file-card.workflow-card .file-preview {
    background-color: #f3f6fc;
    background-image: radial-gradient(circle, #ccd5e3 1px, transparent 1.2px);
    background-size: 18px 18px;
}
.file-card.workflow-card .file-preview::after {
    inset: 25px 30px;
    border-color: rgba(255,255,255,.9);
    background: linear-gradient(135deg, rgba(255,255,255,.92), rgba(232,240,255,.86));
}
.workflow-preview {
    position: relative;
    z-index: 2;
    display: grid;
    width: 58px;
    height: 58px;
    place-items: center;
    color: var(--blue);
    border: 1px solid #c8d9ff;
    border-radius: 17px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(23,105,255,.14);
}
.workflow-preview svg { width: 27px; height: 27px; }
.file-kind-label {
    display: inline-flex !important;
    width: max-content;
    align-items: center;
    margin-top: 7px !important;
    padding: 3px 6px;
    color: var(--blue) !important;
    border-radius: 5px;
    background: var(--blue-soft);
    font-size: 9px !important;
    font-weight: 700;
}

.file-collection.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
    gap: 18px;
}

.file-list-header {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) 130px 160px 42px;
    align-items: center;
    gap: 12px;
    min-height: 38px;
    padding: 0 14px 0 66px;
    color: #8794a7;
    border-bottom: 1px solid #e2e8f1;
    font-size: 10px;
    font-weight: 720;
    letter-spacing: .04em;
}
.file-list-header span:last-child { text-align: center; }

.file-card {
    position: relative;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 2px 4px rgba(18, 30, 50, 0.02);
    cursor: pointer;
    transition: 160ms ease;
}
.file-card:hover { transform: translateY(-2px); border-color: #cddaf0; box-shadow: 0 14px 34px rgba(31, 45, 72, 0.09); }
.file-card:focus-visible { outline: 3px solid rgba(23, 105, 255, 0.2); outline-offset: 3px; }
.file-preview {
    position: relative;
    display: grid;
    height: 154px;
    place-items: center;
    overflow: hidden;
    background-color: #f5f8fd;
    background-image:
        linear-gradient(#edf1f7 1px, transparent 1px),
        linear-gradient(90deg, #edf1f7 1px, transparent 1px);
    background-size: 22px 22px;
}
.file-preview::after {
    content: "";
    position: absolute;
    inset: 20px 28px;
    border: 1px solid rgba(255, 255, 255, 0.92);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.74);
    box-shadow: 0 14px 32px rgba(30, 65, 125, 0.09);
    backdrop-filter: blur(8px);
}
.file-preview-logo {
    position: relative;
    z-index: 1;
    width: 54px;
    height: 54px;
    object-fit: cover;
    border-radius: 15px;
    box-shadow: 0 10px 24px rgba(20, 48, 94, 0.16);
}
.file-card-body { display: flex; align-items: center; gap: 10px; padding: 13px 48px 14px 14px; }
.file-main { min-width: 0; flex: 1; }
.file-main strong { display: block; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.file-main span { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }
.file-menu-button {
    position: absolute;
    right: 12px;
    bottom: 14px;
    opacity: 0;
}
.file-card:hover .file-menu-button, .file-menu-button:focus { opacity: 1; }

.file-collection.list-view {
    display: grid;
    gap: 4px;
    padding: 6px;
    border: 1px solid #e2e8f1;
    border-radius: 16px;
    background: rgba(255,255,255,.82);
    box-shadow: 0 14px 42px rgba(31,45,72,.055);
}
.list-view .file-card {
    display: grid;
    grid-template-columns: 44px minmax(260px, 1fr) 130px 160px 42px;
    align-items: center;
    gap: 12px;
    min-height: 62px;
    padding: 7px 7px 7px 10px;
    border-color: transparent;
    border-radius: 11px;
    box-shadow: none;
}
.list-view .file-card:hover {
    transform: none;
    border-color: #d8e1ef;
    background: #f8fbff;
    box-shadow: 0 7px 18px rgba(31,45,72,.06);
}
.list-view .file-preview { width: 42px; height: 42px; border-radius: 9px; }
.list-view .file-preview::after { inset: 5px; border-width: 1px; border-radius: 7px; }
.list-view .file-preview-logo { width: 26px; height: 26px; border-radius: 7px; box-shadow: none; }
.list-view .file-card-body { padding: 0; }
.file-list-kind,
.file-list-date { display: none; }
.list-view .file-list-kind,
.list-view .file-list-date {
    display: block;
    overflow: hidden;
    color: #66758b;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.list-view .file-list-kind {
    width: max-content;
    padding: 5px 8px;
    color: var(--blue);
    border-radius: 999px;
    background: var(--blue-soft);
    font-size: 9px;
    font-weight: 700;
}
.list-view .file-menu-button {
    position: static;
    opacity: 1;
}
.list-view .file-kind-label { display: none !important; }

.workflow-space .sidebar-heading h1 { color: #1b2850; }
.workflow-space .file-card.workflow-card .file-preview {
    background-color: #eef1fa;
    background-image: radial-gradient(circle, #bbc6dc 1px, transparent 1.25px);
}
.workflow-space .workflow-preview {
    color: #4059e8;
    border-color: #cdd5ff;
    background: linear-gradient(145deg, #fff, #f2f4ff);
}

.context-menu {
    position: fixed;
    z-index: 200;
    width: 170px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    box-shadow: var(--shadow);
}
.context-menu button {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 9px;
    padding: 9px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    text-align: left;
}
.context-menu button:hover { background: var(--surface-soft); }
.context-menu button.danger { color: var(--danger); }
.context-menu svg { width: 16px; height: 16px; }

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: grid;
    place-items: center;
    padding: 22px;
    background: rgba(12, 20, 34, 0.52);
    backdrop-filter: blur(8px);
}

.modal-card {
    display: flex;
    flex-direction: column;
    width: min(680px, 100%);
    max-height: min(760px, calc(100vh - 40px));
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 20px;
    background: #fff;
    box-shadow: var(--shadow);
    animation: modal-in 180ms ease both;
}

.modal-asset-icon {
    width: 42px;
    height: 42px;
    object-fit: contain;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
.modal-small { width: min(430px, 100%); }
.modal-header { display: flex; flex: 0 0 auto; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 24px 18px; }
.modal-heading { display: flex; gap: 12px; }
.modal-heading h3 { margin: 1px 0 0; font-size: 17px; }
.modal-heading p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.modal-icon { display: grid; flex: 0 0 auto; width: 38px; height: 38px; place-items: center; color: var(--blue); border-radius: 11px; background: var(--blue-soft); }
.modal-icon.warning { color: var(--danger); background: #fff0f0; }
.modal-icon svg { width: 18px; height: 18px; }
.modal-close { width: 34px; height: 34px; }
.modal-body { min-height: 0; padding: 2px 24px 24px; overflow-y: auto; scrollbar-gutter: stable; }
.modal-footer { display: flex; flex: 0 0 auto; justify-content: flex-end; gap: 9px; padding: 16px 24px 18px; border-top: 1px solid var(--line); background: #fff; }

.field { display: grid; gap: 7px; }
.field > span { color: #526075; font-size: 12px; font-weight: 600; }
.field input, .field select {
    width: 100%;
    height: 42px;
    padding: 0 12px;
    color: var(--ink);
    border: 1px solid #dfe4ec;
    border-radius: 10px;
    outline: 0;
    background: #fff;
}
.field input:focus, .field select:focus { border-color: rgba(23, 105, 255, 0.58); box-shadow: 0 0 0 3px rgba(23, 105, 255, 0.08); }
.field small, .form-error { min-height: 16px; margin: 0; color: var(--danger); font-size: 11px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.full-width { grid-column: 1 / -1; }
.toast-region { position: fixed; z-index: 800; right: 22px; bottom: 22px; display: grid; gap: 9px; }
.toast {
    display: flex;
    min-width: 260px;
    max-width: 360px;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    box-shadow: var(--shadow);
    animation: toast-in 180ms ease both;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.toast svg { width: 17px; height: 17px; color: var(--blue); }
.toast.error svg { color: var(--danger); }
.toast span { font-size: 12px; }

.sidebar-scrim { display: none; }

@media (max-width: 1080px) {
    :root { --sidebar-width: 244px; }
    .workspace-header { align-items: flex-start; flex-direction: column; gap: 12px; }
    .header-tools { width: 100%; }
    .search-control { width: auto; flex: 1; }
}

@media (max-width: 820px) {
    body { overflow: auto; }
    .app-shell { grid-template-columns: 1fr; min-height: 100dvh; }
    .icon-rail {
        position: fixed;
        z-index: 60;
        inset: auto 0 0;
        height: 62px;
        flex-direction: row;
        justify-content: center;
        padding: 8px 16px;
    }
    .brand-mark { width: 40px; height: 40px; margin: 0 auto 0 0; }
    .account-anchor { margin: 0 0 0 auto; }
    .account-popover { left: auto; right: 0; bottom: 52px; }
    .account-popover::before { left: auto; right: 14px; bottom: -8px; transform: rotate(-45deg); }
    .account-popover::after { right: 0; bottom: -18px; width: 64px; height: 18px; }
    .sidebar {
        position: fixed;
        z-index: 55;
        inset: 0 auto 62px 0;
        width: min(310px, 88vw);
        transform: translateX(-105%);
        box-shadow: 18px 0 48px rgba(23, 32, 51, 0.16);
        transition: transform 200ms ease;
    }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .sidebar-close { display: inline-grid !important; }
    .sidebar-scrim {
        position: fixed;
        z-index: 50;
        inset: 0 0 62px;
        display: block;
        width: 100%;
        border: 0;
        background: rgba(12, 20, 34, 0.34);
    }
    .workspace { min-height: calc(100dvh - 62px); padding-bottom: 62px; }
    .mobile-menu-button { display: inline-grid; }
    .workspace-header { min-height: auto; padding: 16px; }
    .content-area { padding: 18px 16px 28px; }
    .file-collection.grid-view { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .loading-state, .empty-state { min-height: 58vh; }
}

@media (max-width: 560px) {
    .header-tools { display: grid; grid-template-columns: minmax(0, 1fr) 42px; }
    .search-control { width: 100%; }
    .select-control { display: none; }
    .search-control kbd { display: none; }
    .content-area { padding: 14px 12px 24px; }
    .file-collection.grid-view { grid-template-columns: 1fr; gap: 10px; }
    .file-card { display: grid; grid-template-columns: 64px minmax(0, 1fr); align-items: center; border-radius: 13px; }
    .file-preview { width: 64px; height: 64px; }
    .file-preview::after { inset: 13px; border-width: 1px; border-radius: 7px; }
    .file-menu-button { opacity: 1; }
    .modal-overlay { padding: 12px; align-items: end; }
    .modal-card { max-height: 88dvh; border-radius: 20px 20px 14px 14px; }
    .form-grid { grid-template-columns: 1fr; }
    .full-width { grid-column: auto; }
    .toast-region { right: 12px; bottom: 76px; left: 12px; }
    .toast { min-width: 0; max-width: none; }
}

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

/* 2026-08-20 · 画鸭/冲鸭统一轻量新建按钮 */
#newCanvasButton {
    border: 1px solid #c8d9ef; border-radius: 14px; color: #18385f;
    background: linear-gradient(180deg, #fff 0%, #f2f7fd 100%);
    box-shadow: 0 8px 20px rgba(42,72,111,.10), inset 0 1px 0 rgba(255,255,255,.96);
    font-weight: 850; letter-spacing: .01em;
    transition: transform .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease, color .16s ease;
}
#newCanvasButton svg { color: #1169ff; stroke-width: 2.15; }
#newCanvasButton:hover {
    color: #0b3978; border-color: #8eb4ea; background: linear-gradient(180deg, #fff 0%, #eaf3ff 100%);
    box-shadow: 0 11px 24px rgba(42,87,145,.14); transform: translateY(-1px);
}
#newCanvasButton:active { transform: translateY(0); box-shadow: 0 5px 12px rgba(42,72,111,.10); }
#newCanvasButton:focus-visible { outline: 3px solid rgba(17,105,255,.18); outline-offset: 2px; }
