html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
    color: #1A1A1A;
    background: #FFFFFF;
}

* {
    box-sizing: border-box;
}

.sideload-msg {
    padding: 24px;
    text-align: center;
    color: #6B7280;
}

.app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 40px 12px 14px;
    background: #EEF0FF;
    border-bottom: 1px solid #E5E7F5;
}

.app-header__left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.app-header__icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 1px 2px rgba(91, 111, 237, 0.15);
}

.app-header__text {
    min-width: 0;
}

.app-header__title {
    font-size: 13px;
    font-weight: 600;
    color: #1A1A1A;
    line-height: 1.3;
}

.app-header__subtitle {
    font-size: 11px;
    color: #6B7280;
    line-height: 1.3;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-header__status {
    position: relative;
    font-size: 11px;
    color: #6B7280;
    flex-shrink: 0;
    padding-left: 8px;
}

.account-btn {
    border: 1px solid #D6DAF5;
    background: #FFFFFF;
    color: #5B6FED;
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 14px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
}

.account-btn:hover {
    background: #F5F6FF;
    border-color: #5B6FED;
}

.dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 110px;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    padding: 4px 0;
    z-index: 100;
}

.dropdown__item {
    padding: 8px 16px;
    font-size: 13px;
    color: #1A1A1A;
    cursor: pointer;
    white-space: nowrap;
}

.dropdown__item:hover {
    background: #F5F6FF;
    color: #5B6FED;
}

.view {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 20px 24px;
}

.login-view {
    justify-content: center;
}

.login-title {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 6px;
    color: #1A1A1A;
}

.login-hint {
    font-size: 13px;
    color: #6B7280;
    margin: 0 0 18px;
}

.login-form {
    width: 100%;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.login-input {
    width: 100%;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 14px;
    color: #1A1A1A;
    font-family: inherit;
    outline: none;
    background: #FAFBFC;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.login-input::placeholder {
    color: #9CA3AF;
}

.login-input:focus {
    border-color: #5B6FED;
    background: #FFFFFF;
}

.login-error {
    min-height: 18px;
    color: #E5484D;
    font-size: 12px;
    line-height: 1.4;
    padding: 0 2px;
}

.primary-btn {
    border: none;
    background: #3B6FF5;
    color: #FFFFFF;
    font-size: 14px;
    font-weight: 500;
    padding: 10px 40px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease;
    font-family: inherit;
}

.primary-btn:hover {
    background: #2B5CE0;
}

.primary-btn:active {
    background: #1F4BC9;
}

.home-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #FFFFFF;
}

.tabs {
    display: flex;
    border-bottom: 1px solid #F0F1F5;
    padding: 0 14px;
}

.tab {
    flex: 1;
    background: none;
    border: none;
    padding: 12px 0;
    font-size: 14px;
    color: #6B7280;
    cursor: pointer;
    font-family: inherit;
    position: relative;
    font-weight: 500;
}

.tab--active {
    color: #3B6FF5;
    font-weight: 600;
}

.tab--active::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -1px;
    transform: translateX(-50%);
    width: 36px;
    height: 2px;
    background: #3B6FF5;
    border-radius: 2px;
}

.home-content {
    flex: 1;
    overflow-y: auto;
    padding: 14px 14px 0;
}

.tab-panel {
    display: block;
}

.info-card {
    background: #F5F6F8;
    border-radius: 10px;
    padding: 14px;
}

.info-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.info-card__title {
    font-size: 13px;
    font-weight: 600;
    color: #1A1A1A;
}

.info-card__badge {
    font-size: 11px;
    color: #6B7280;
    background: #E5E7EB;
    padding: 2px 8px;
    border-radius: 10px;
}

.info-card__desc {
    font-size: 12px;
    color: #4B5563;
    line-height: 1.6;
    margin: 0 0 10px;
}

.info-card__list {
    margin: 0;
    padding-left: 18px;
    font-size: 12px;
    color: #4B5563;
    line-height: 1.7;
}

.info-card__list li {
    margin-bottom: 4px;
}

.home-footer {
    padding: 12px 14px 16px;
    border-top: 1px solid #F0F1F5;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.primary-btn--block {
    width: 100%;
    padding: 11px 0;
    border-radius: 22px;
    font-size: 14px;
    font-weight: 600;
}

.aux-textarea {
    width: 100%;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 12px;
    color: #1A1A1A;
    font-family: inherit;
    resize: none;
    line-height: 1.5;
    outline: none;
    transition: border-color 0.15s ease;
}

.aux-textarea::placeholder {
    color: #9CA3AF;
}

.aux-textarea:focus {
    border-color: #5B6FED;
}

.search-box {
    position: relative;
    margin-bottom: 14px;
}

.search-box__input {
    width: 100%;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    padding: 10px 56px 10px 12px;
    font-size: 13px;
    color: #1A1A1A;
    font-family: inherit;
    outline: none;
    background: #FAFBFC;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.search-box__input::placeholder {
    color: #9CA3AF;
}

.search-box__input:focus {
    border-color: #5B6FED;
    background: #FFFFFF;
}

.search-box__adorn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
}

.search-box__search-btn {
    right: 10px;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 4px;
    pointer-events: auto;
    padding: 0;
    color: #9CA3AF;
}

.search-box__clear {
    right: 32px;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 4px;
    pointer-events: auto;
    padding: 0;
    color: #9CA3AF;
}

.search-box__clear:hover,
.search-box__search-btn:hover {
    background: #F3F4F6;
    color: #5B6FED;
}

.quick-search {
    background: #F9FAFC;
    border: 1px solid #EEF0F5;
    border-radius: 10px;
    padding: 12px 14px;
}

.quick-search__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.quick-search__title {
    font-size: 13px;
    font-weight: 600;
    color: #1A1A1A;
}

.quick-search__hint {
    font-size: 11px;
    color: #9CA3AF;
}

.quick-search__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    border: none;
    background: #EEF2FF;
    color: #5B6FED;
    font-size: 12px;
    padding: 6px 14px;
    border-radius: 16px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s ease;
}

.chip:hover {
    background: #E0E7FF;
}

.material-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.material-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #FFFFFF;
    border: 1px solid #EEF0F5;
    border-radius: 10px;
    padding: 10px;
}

.material-item__icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    overflow: hidden;
}

.material-item__icon-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.material-item__body {
    flex: 1;
    min-width: 0;
}

.material-item__title {
    font-size: 13px;
    font-weight: 600;
    color: #1A1A1A;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.material-item__meta {
    font-size: 11px;
    color: #9CA3AF;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.material-item__btn {
    border: 1px solid #D6DAF5;
    background: #F5F6FF;
    color: #5B6FED;
    font-size: 12px;
    padding: 5px 12px;
    border-radius: 14px;
    cursor: pointer;
    font-family: inherit;
    flex-shrink: 0;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.material-item__btn:hover {
    background: #E0E7FF;
    border-color: #5B6FED;
}

.material-item__btn:active {
    background: #D6DAF5;
}

.material-empty {
    text-align: center;
    font-size: 12px;
    color: #9CA3AF;
    padding: 30px 0;
}

.material-item__body {
    cursor: pointer;
}

.preview-modal {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #FFFFFF;
    z-index: 9999;
    display: flex;
    flex-direction: column;
}

body.preview-open {
    overflow: hidden;
}

/* ─── 选择插入项 modal (弹窗样式,带遮罩) ─── */
.items-modal {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.items-modal__dialog {
    width: 100%;
    max-width: 720px;
    max-height: 100%;
    background: #FFFFFF;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.items-modal__header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px;
    border-bottom: 1px solid #F0F1F5;
    flex-shrink: 0;
}

.items-modal__title {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    font-weight: 600;
    color: #1A1A1A;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.items-modal__close {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: #6B7280;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    border-radius: 4px;
    flex-shrink: 0;
}

.items-modal__close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #1A1A1A;
}

.items-modal__body {
    flex: 1;
    overflow: hidden;
    position: relative;
    background: #FFFFFF;
    min-height: 200px;
}

.items-modal__status {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-align: center;
    font-size: 13px;
    color: #6B7280;
}

.items-modal__list {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    align-content: start;
}

.items-modal__item {
    position: relative;
    aspect-ratio: 1;
    background: #F5F6F8;
    border: 2px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.items-modal__item:hover {
    border-color: #C7CEE5;
}

.items-modal__item--selected {
    border-color: #5B6FED;
}

.items-modal__item-thumb {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.items-modal__item-checkbox {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 22px;
    height: 22px;
    border: 2px solid #CBD5E1;
    background: #FFFFFF;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: all 0.15s ease;
}

.items-modal__item--selected .items-modal__item-checkbox {
    background: #3B6FF5;
    border-color: #3B6FF5;
}

.items-modal__item--selected .items-modal__item-checkbox::after {
    content: "";
    width: 6px;
    height: 10px;
    border: solid #FFFFFF;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) translate(-1px, -1px);
}

.items-modal__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 16px;
    border-top: 1px solid #F0F1F5;
    background: #FFFFFF;
    flex-shrink: 0;
}

.items-modal__count {
    font-size: 12px;
    color: #6B7280;
}

.items-modal__actions {
    display: flex;
    gap: 8px;
}

.items-modal__btn {
    font-size: 13px;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    border: 1px solid transparent;
    transition: all 0.15s ease;
}

.items-modal__btn--ghost {
    background: #FFFFFF;
    border-color: #D1D5DB;
    color: #374151;
}

.items-modal__btn--ghost:hover {
    background: #F3F4F6;
}

.items-modal__btn--primary {
    background: #3B6FF5;
    color: #FFFFFF;
    border-color: #3B6FF5;
}

.items-modal__btn--primary:hover:not(:disabled) {
    background: #2B5CE0;
}

.items-modal__btn--primary:disabled {
    background: #C7CEE5;
    border-color: #C7CEE5;
    cursor: not-allowed;
}

body.items-open {
    overflow: hidden;
}

.preview-modal__header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid #E5E7EB;
    background: #EEF0FF;
}

.preview-modal__title {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    font-weight: 600;
    color: #1A1A1A;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-modal__action {
    flex-shrink: 0;
    border: 1px solid #5B6FED;
    background: #FFFFFF;
    color: #5B6FED;
    font-size: 12px;
    padding: 5px 12px;
    border-radius: 14px;
    cursor: pointer;
    font-family: inherit;
}

.preview-modal__action:hover {
    background: #E0E7FF;
}

.preview-modal__close {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: #6B7280;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    border-radius: 4px;
}

.preview-modal__close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #1A1A1A;
}

.preview-modal__body {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #F5F6F8;
}

.preview-modal__iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

.preview-modal__status {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-align: center;
    font-size: 13px;
    color: #6B7280;
}
