.iotab-wb {
    --iotab-wb-cols: 5;
    box-sizing: border-box;
    margin: 16px 0;
    color: #24292f;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

.iotab-wb *,
.iotab-wb *::before,
.iotab-wb *::after {
    box-sizing: border-box;
}

.iotab-wb-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.iotab-wb-tabs {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    border-radius: 20px;
    background: #f1f3f6;
}

.iotab-wb-tab {
    padding: 6px 14px;
    border: 0;
    border-radius: 16px;
    background: transparent;
    color: #5d6470;
    font-size: 12px;
    line-height: 1.4;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.iotab-wb-tab:hover {
    color: #1f6feb;
}

.iotab-wb-tab.is-active {
    background: #2388f5;
    color: #fff;
    box-shadow: 0 2px 8px rgba(35, 136, 245, 0.22);
}

.iotab-wb-heading {
    color: #333;
    font-size: 13px;
    font-weight: 600;
}

.iotab-wb-edit {
    padding: 6px 14px;
    border: 0;
    border-radius: 16px;
    background: #2388f5;
    color: #fff !important;
    font-size: 12px;
    line-height: 1.4;
    text-decoration: none !important;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(35, 136, 245, 0.22);
}

.iotab-wb-edit:hover {
    background: #0d73e0;
    color: #fff !important;
}

.iotab-wb-edit[aria-pressed="true"] {
    background: #24292f;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.iotab-wb-addcard {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 64px;
    padding: 9px 12px;
    border: 1px dashed #c9ced6;
    border-radius: 8px;
    background: #fafbfc;
    color: #8b929c !important;
    font-size: 12px;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.iotab-wb-addcard[hidden] {
    display: none !important;
}

.iotab-wb-addcard:hover {
    border-color: #2388f5;
    background: #f5f9ff;
    color: #2388f5 !important;
}

.iotab-wb-addcard-plus {
    font-size: 16px;
    line-height: 1;
}

.iotab-wb-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

.iotab-wb-modal[hidden] {
    display: none !important;
}

.iotab-wb-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.iotab-wb-modal-panel {
    position: relative;
    z-index: 1;
    width: 620px;
    max-width: 100%;
    padding: 28px 32px 26px;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
    color: #24292f;
}

.iotab-wb-modal-panel h3 {
    margin: 0 0 8px;
    padding: 0;
    color: #24292f;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
}

.iotab-wb-modal-hint {
    margin: 0 0 18px;
    color: #8b929c;
    font-size: 13px;
    line-height: 1.5;
    text-align: center;
}

.iotab-wb-input {
    display: block;
    width: 100%;
    height: 42px;
    margin: 0 0 10px;
    padding: 0 14px;
    border: 1px solid #e2e5ea;
    border-radius: 7px;
    background: #f4f5f7;
    color: #24292f;
    font-size: 13px;
    outline: none;
    box-shadow: none;
}

.iotab-wb-input:focus {
    border-color: #2388f5;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(35, 136, 245, 0.12);
}

.iotab-wb-modal-error {
    margin: 2px 0 8px;
    color: #e03131;
    font-size: 12px;
    line-height: 1.5;
}

.iotab-wb-modal-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
}

.iotab-wb-btn {
    min-width: 76px;
    height: 38px;
    padding: 0 20px;
    border: 0;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
}

.iotab-wb-btn-add {
    background: #f1404b;
    color: #fff !important;
}

.iotab-wb-btn-add:hover {
    background: #d92f3b;
}

.iotab-wb-btn-add:disabled {
    opacity: 0.6;
    cursor: wait;
}

.iotab-wb-btn-cancel {
    background: #17181a;
    color: #fff !important;
}

.iotab-wb-btn-cancel:hover {
    background: #333;
}

.iotab-wb.is-editing .iotab-wb-edit {
    background: #24292f;
}

@media (max-width: 600px) {
    .iotab-wb-modal-panel {
        padding: 22px 20px 20px;
    }
}

/* 编辑 / 弹窗 end */

.iotab-wb-grid {
    display: grid;
    grid-template-columns: repeat(var(--iotab-wb-cols, 5), minmax(0, 1fr));
    gap: 12px;
}

.iotab-wb-grid.is-auto {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.iotab-wb-card {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    min-height: 64px;
    padding: 9px 12px;
    border: 1px solid #edf0f3;
    border-radius: 8px;
    background: #fff;
    color: #24292f !important;
    text-decoration: none !important;
    box-shadow: 0 2px 8px rgba(20, 35, 60, 0.03);
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.iotab-wb-card:hover {
    border-color: #dbe8fa;
    box-shadow: 0 6px 18px rgba(20, 35, 60, 0.08);
    transform: translateY(-1px);
}

.iotab-wb-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 34px !important;
    height: 34px !important;
    max-width: 34px !important;
    max-height: 34px !important;
    overflow: hidden;
    border-radius: 50%;
    background: var(--iotab-wb-bg, #f1404b);
}

.iotab-wb-icon img {
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: cover;
    border-radius: 50%;
}

.iotab-wb-letter {
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
}

.iotab-wb-info {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.iotab-wb-title {
    display: flex;
    align-items: center;
    min-width: 0;
    overflow: hidden;
    color: #24292f;
    font-size: 13px;
    line-height: 1.35;
    white-space: nowrap;
}

.iotab-wb-title strong {
    overflow: hidden;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.iotab-wb-badge {
    flex: none;
    margin-right: 5px;
    padding: 1px 4px;
    border-radius: 3px;
    background: #f1404b;
    color: #fff;
    font-size: 9px;
    font-style: normal;
    font-weight: 400;
    line-height: 1.4;
}

.iotab-wb-desc {
    overflow: hidden;
    color: #9aa1ac;
    font-size: 11px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.iotab-wb-goto {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 20px;
    height: 20px;
    border: 1px solid #dce0e6;
    border-radius: 50%;
    color: #a8afb9;
    font-size: 13px;
    line-height: 1;
}

.iotab-wb-card:hover .iotab-wb-goto {
    border-color: #2388f5;
    color: #2388f5;
}

.iotab-wb-empty {
    margin: 12px 0;
    color: #9aa1ac;
    font-size: 12px;
}

.iotab-wb-card.is-hidden {
    display: none;
}

/* 悬停网址卡片 */
.iotab-wb-pop {
    position: fixed;
    z-index: 99998;
    width: 296px;
    max-width: calc(100vw - 20px);
    padding: 16px;
    border: 1px solid #e8edf5;
    border-radius: 16px;
    background:
        radial-gradient(circle at 100% 0%, rgba(35, 136, 245, 0.08), transparent 34%),
        #fff;
    box-shadow: 0 22px 60px rgba(15, 23, 42, 0.2);
    opacity: 0;
    transform: translateY(6px) scale(0.98);
    transform-origin: center bottom;
    pointer-events: auto;
    transition: opacity 0.16s ease, transform 0.16s ease;
}

.iotab-wb-pop[hidden] {
    display: none !important;
}

.iotab-wb-pop.is-open {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.iotab-wb-pop.is-below {
    transform-origin: center top;
}

.iotab-wb-pop-arrow {
    position: absolute;
    left: 50%;
    bottom: -6px;
    width: 12px;
    height: 12px;
    margin-left: -6px;
    border-right: 1px solid #e8edf5;
    border-bottom: 1px solid #e8edf5;
    background: #fff;
    transform: rotate(45deg);
}

.iotab-wb-pop.is-below .iotab-wb-pop-arrow {
    top: -6px;
    bottom: auto;
    border: 0;
    border-left: 1px solid #e8edf5;
    border-top: 1px solid #e8edf5;
}

.iotab-wb-pop-head {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.iotab-wb-pop-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 38px !important;
    height: 38px !important;
    max-width: 38px !important;
    max-height: 38px !important;
    overflow: hidden;
    border-radius: 50%;
    background: var(--iotab-wb-bg, #f1404b);
    box-shadow: 0 4px 10px rgba(20, 35, 60, 0.12);
}

.iotab-wb-pop-icon img {
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: cover;
    border-radius: 50%;
}

.iotab-wb-pop-icon .iotab-wb-letter {
    font-size: 15px;
}

.iotab-wb-pop-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.iotab-wb-pop-title {
    overflow: hidden;
    color: #1f2937;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.iotab-wb-pop-desc {
    overflow: hidden;
    color: #8a93a3;
    font-size: 11px;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.iotab-wb-pop-url {
    overflow: hidden;
    margin: 11px 0;
    padding: 7px 9px;
    border: 1px solid #eef1f6;
    border-radius: 7px;
    background: #f8fafc;
    color: #697386;
    font-family: Consolas, Monaco, monospace;
    font-size: 10px;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.iotab-wb-pop-qr {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 12px 0 13px;
    padding: 10px;
    border: 1px solid #edf1f7;
    border-radius: 12px;
    background: linear-gradient(135deg, #f7fbff 0%, #fff 55%, #fff7f8 100%);
}

.iotab-wb-pop-qr-box {
    flex: none;
    width: 108px;
    height: 108px;
    padding: 5px;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(20, 35, 60, 0.08);
}

.iotab-wb-pop-qr-box canvas,
.iotab-wb-pop-qr-box img {
    display: block;
    width: 98px !important;
    height: 98px !important;
}

.iotab-wb-pop-qr-label {
    color: #8a93a3;
    font-size: 11px;
    line-height: 1.5;
    writing-mode: vertical-rl;
    letter-spacing: 2px;
}

.iotab-wb-pop-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.iotab-wb-pop-open {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    padding: 0 14px;
    border-radius: 8px;
    background: #f1404b;
    color: #fff !important;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none !important;
    box-shadow: 0 5px 14px rgba(241, 64, 75, 0.22);
}

.iotab-wb-pop-open:hover {
    background: #d93641;
    color: #fff !important;
}

.iotab-wb-pop-host {
    overflow: hidden;
    color: #a0a7b3;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 600px) {
    .iotab-wb-pop {
        width: 280px;
    }

    .iotab-wb-pop-qr {
        gap: 8px;
    }
}

@media (max-width: 1100px) {
    .iotab-wb-grid {
        grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    }
}

@media (max-width: 600px) {
    .iotab-wb-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 8px;
    }

    .iotab-wb-card {
        min-height: 56px;
        padding: 8px 10px;
    }

    .iotab-wb-icon {
        width: 30px;
        height: 30px;
    }

    .iotab-wb-desc {
        display: none;
    }

    .iotab-wb-tab {
        padding: 5px 11px;
        font-size: 11px;
    }
}
