.iz-prompt-library,
.iz-prompt-library * {
    box-sizing: border-box;
}

.iz-prompt-library {
    --iz-primary: #3188cf;
    --iz-primary-soft: #edf6ff;
    --iz-text: #263650;
    --iz-muted: #788397;
    --iz-line: #e8edf4;
    --iz-surface: #ffffff;
    --iz-card: #f8fafc;
    position: relative;
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    gap: 18px;
    width: 100%;
    max-width: 1480px;
    margin: 18px auto;
    padding: 0 12px;
    color: var(--iz-text);
}

.iz-prompt-sidebar {
    position: sticky;
    top: 88px;
    align-self: start;
    padding: 18px 13px;
    background: var(--iz-surface);
    border: 1px solid rgba(226, 232, 240, 0.78);
    border-radius: 16px;
    box-shadow: 0 8px 28px rgba(34, 54, 84, 0.06);
}

.iz-prompt-sidebar-title {
    margin-bottom: 10px;
    padding: 0 11px;
    color: var(--iz-text);
    font-size: 17px;
    font-weight: 700;
}

.iz-prompt-sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.iz-prompt-sidebar nav a {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 42px;
    padding: 10px 12px;
    color: #536074;
    font-size: 14.5px;
    line-height: 1.4;
    text-decoration: none;
    border-radius: 10px;
    transition: color 0.18s ease, background 0.18s ease;
}

.iz-prompt-sidebar nav a:hover,
.iz-prompt-sidebar nav a.is-active {
    color: var(--iz-primary);
    background: var(--iz-primary-soft);
}

.iz-prompt-sidebar nav a.is-active::before {
    position: absolute;
    top: 11px;
    bottom: 11px;
    left: 0;
    width: 3px;
    background: var(--iz-primary);
    border-radius: 3px;
    content: "";
}

.iz-prompt-main {
    min-width: 0;
}

.iz-prompt-toolbar {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 10px;
    padding: 13px 15px;
    background: var(--iz-surface);
    border: 1px solid rgba(226, 232, 240, 0.78);
    border-radius: 15px;
    box-shadow: 0 6px 22px rgba(34, 54, 84, 0.04);
}

.iz-prompt-search-wrap {
    position: relative;
    min-width: 0;
    flex: 1;
}

.iz-prompt-search-icon {
    position: absolute;
    top: 50%;
    left: 14px;
    color: #9aa5b4;
    font-size: 20px;
    transform: translateY(-52%);
    pointer-events: none;
}

.iz-prompt-search {
    display: block;
    width: 100%;
    height: 44px;
    margin: 0;
    padding: 0 42px;
    color: #364154;
    font: inherit;
    font-size: 14px;
    background: #f6f8fb;
    border: 1px solid #e4e9f0;
    border-radius: 11px;
    outline: none;
    appearance: none;
}

.iz-prompt-search:focus {
    background: #fff;
    border-color: #79b6e5;
    box-shadow: 0 0 0 3px rgba(49, 136, 207, 0.12);
}

.iz-prompt-search-clear {
    position: absolute;
    top: 50%;
    right: 10px;
    width: 28px;
    height: 28px;
    padding: 0;
    color: #8490a2;
    font-size: 20px;
    line-height: 1;
    background: transparent;
    border: 0;
    border-radius: 50%;
    transform: translateY(-50%);
    cursor: pointer;
}

.iz-prompt-result-count {
    flex: 0 0 auto;
    color: #7a8494;
    font-size: 14px;
    white-space: nowrap;
}

.iz-prompt-model-filter {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 12px;
    padding: 10px 13px;
    overflow-x: auto;
    background: var(--iz-surface);
    border: 1px solid rgba(226, 232, 240, 0.78);
    border-radius: 14px;
    scrollbar-width: thin;
}

.iz-prompt-model-label {
    flex: 0 0 auto;
    margin-right: 3px;
    color: #667085;
    font-size: 13px;
    font-weight: 600;
}

.iz-prompt-model-button {
    flex: 0 0 auto;
    min-height: 34px;
    margin: 0;
    padding: 6px 13px;
    color: #5b6678;
    font: inherit;
    font-size: 13px;
    line-height: 1.2;
    background: #f6f8fb;
    border: 1px solid transparent;
    border-radius: 18px;
    cursor: pointer;
    transition: 0.18s ease;
}

.iz-prompt-model-button:hover,
.iz-prompt-model-button.is-active {
    color: #fff;
    background: var(--iz-primary);
    border-color: var(--iz-primary);
}

.iz-prompt-section {
    margin-bottom: 15px;
    padding: 16px;
    background: var(--iz-surface);
    border: 1px solid rgba(226, 232, 240, 0.78);
    border-radius: 16px;
    scroll-margin-top: 90px;
}

.iz-prompt-section[hidden],
.iz-prompt-card[hidden],
.iz-prompt-no-results[hidden],
.iz-prompt-search-clear[hidden] {
    display: none !important;
}

.iz-prompt-section-heading {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin: 0 0 13px;
}

.iz-prompt-section-heading h2 {
    position: relative;
    margin: 0;
    padding-left: 11px;
    color: var(--iz-text);
    font-size: 19px;
    font-weight: 700;
    line-height: 1.45;
}

.iz-prompt-section-heading h2::before {
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 0;
    width: 3px;
    background: var(--iz-primary);
    border-radius: 3px;
    content: "";
}

.iz-prompt-section-heading p {
    margin: 0;
    color: #98a1af;
    font-size: 12.5px;
}

.iz-prompt-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.iz-prompt-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 228px;
    padding: 15px;
    overflow: visible;
    background: var(--iz-card);
    border: 1px solid var(--iz-line);
    border-radius: 13px;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.iz-prompt-card:hover {
    z-index: 2;
    border-color: #dbe4ef;
    box-shadow: 0 10px 28px rgba(31, 54, 88, 0.08);
    transform: translateY(-2px);
}

.iz-prompt-card h3 {
    position: relative;
    margin: 0 0 9px;
    padding-left: 11px;
    color: #303b4e;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.45;
}

.iz-prompt-card h3::before {
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 0;
    width: 3px;
    background: var(--iz-primary);
    border-radius: 3px;
    content: "";
}

.iz-prompt-text {
    display: -webkit-box;
    overflow: hidden;
    color: var(--iz-muted);
    font-size: 13.5px;
    line-height: 1.72;
    white-space: pre-line;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 5;
}

.iz-prompt-card.is-expanded .iz-prompt-text {
    display: block;
    overflow: visible;
}

.iz-prompt-model-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 11px;
}

.iz-prompt-model-badge {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 3px 8px;
    color: #607087;
    font-size: 11.5px;
    line-height: 1.2;
    background: #edf1f6;
    border-radius: 12px;
}

.iz-model-doubao { color: #986113; background: #fff4df; }
.iz-model-deepseek { color: #365fb7; background: #eaf1ff; }
.iz-model-chatgpt { color: #18715f; background: #e6f6f1; }
.iz-model-kimi { color: #4e4e78; background: #efeffa; }
.iz-model-qianwen { color: #7951a8; background: #f2eafa; }

.iz-prompt-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: stretch;
    gap: 6px;
    min-width: 0;
    margin-top: auto;
    padding-top: 12px;
}

.iz-prompt-copy,
.iz-prompt-edit,
.iz-prompt-expand,
.iz-prompt-run-toggle {
    min-height: 33px;
    width: 100%;
    margin: 0;
    padding: 6px 4px;
    color: #5e6879;
    font: inherit;
    font-size: 12.5px;
    line-height: 1.25;
    white-space: nowrap;
    background: #fff;
    border: 1px solid #dfe5ed;
    border-radius: 8px;
    cursor: pointer;
    box-sizing: border-box;
}

.iz-prompt-copy,
.iz-prompt-edit,
.iz-prompt-expand {
    min-width: 0;
    text-align: center;
}

.iz-prompt-copy:hover,
.iz-prompt-edit:hover,
.iz-prompt-expand:hover,
.iz-prompt-run-toggle:hover {
    color: var(--iz-primary);
    border-color: #8fc4ed;
}

.iz-prompt-run {
    position: relative;
    display: block;
    width: 100%;
    min-width: 0;
    margin-left: 0;
    justify-self: stretch;
}

.iz-prompt-run[open] {
    z-index: 80;
}

.iz-prompt-run summary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    width: 100%;
    overflow: hidden;
    list-style: none;
    text-align: center;
    text-overflow: ellipsis;
}

.iz-prompt-run summary::-webkit-details-marker {
    display: none;
}

.iz-prompt-run-menu {
    position: absolute;
    right: 0;
    bottom: calc(100% + 8px);
    z-index: 80;
    width: 158px;
    padding: 7px;
    background: #fff;
    border: 1px solid #e3e8ef;
    border-radius: 11px;
    box-shadow: 0 14px 38px rgba(30, 48, 75, 0.17);
}

.iz-prompt-run:not([open]) .iz-prompt-run-menu {
    display: none !important;
}

.iz-prompt-run-menu a {
    display: block;
    padding: 9px 10px;
    color: #4f596a;
    font-size: 13.5px;
    text-decoration: none;
    border-radius: 8px;
}

.iz-prompt-run-menu a:first-child {
    color: var(--iz-primary);
    background: var(--iz-primary-soft);
    font-weight: 600;
}

.iz-prompt-run-menu a:hover {
    color: var(--iz-primary);
    background: var(--iz-primary-soft);
}

.iz-prompt-no-results,
.iz-prompt-empty {
    margin: 20px auto;
    padding: 36px 24px;
    max-width: 900px;
    color: #70798a;
    text-align: center;
    background: #fff;
    border: 1px solid var(--iz-line);
    border-radius: 15px;
}

.iz-prompt-toast {
    position: fixed;
    right: 24px;
    bottom: 30px;
    z-index: 99999;
    visibility: hidden;
    padding: 11px 17px;
    color: #fff;
    background: #25354d;
    border-radius: 9px;
    opacity: 0;
    transform: translateY(8px);
    transition: 0.2s ease;
}

.iz-prompt-toast.is-visible {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}

.iz-prompt-editor[hidden],
.iz-prompt-admin-edit[hidden] {
    display: none !important;
}

.iz-prompt-editor {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.iz-prompt-editor-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 31, 48, 0.52);
    backdrop-filter: blur(2px);
}

.iz-prompt-editor-panel {
    position: relative;
    z-index: 1;
    width: min(760px, 100%);
    max-height: min(760px, calc(100vh - 40px));
    overflow: auto;
    padding: 22px;
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 24px 70px rgba(22, 39, 65, 0.25);
}

.iz-prompt-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.iz-prompt-editor-header h2 {
    margin: 0;
    color: var(--iz-text);
    font-size: 20px;
}

.iz-prompt-editor-close {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    padding: 0;
    color: #687386;
    font-size: 25px;
    line-height: 1;
    background: #f4f6f9;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}

.iz-prompt-editor-label {
    display: block;
    margin-bottom: 8px;
    color: #465166;
    font-weight: 600;
}

.iz-prompt-editor-textarea {
    display: block;
    width: 100%;
    min-height: 330px;
    padding: 14px;
    color: #344054;
    font: inherit;
    font-size: 14px;
    line-height: 1.75;
    resize: vertical;
    background: #fbfcfe;
    border: 1px solid #dce2ea;
    border-radius: 10px;
    outline: none;
}

.iz-prompt-editor-textarea:focus {
    border-color: #6baee0;
    box-shadow: 0 0 0 3px rgba(49, 136, 207, 0.12);
}

.iz-prompt-editor-note {
    margin: 9px 0 0;
    color: #8a94a3;
    font-size: 13px;
}

.iz-prompt-editor-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.iz-prompt-editor-actions button,
.iz-prompt-admin-edit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 7px 13px;
    color: #536074;
    font-size: 14px;
    line-height: 1.3;
    text-decoration: none;
    background: #fff;
    border: 1px solid #dce2ea;
    border-radius: 8px;
    cursor: pointer;
}

.iz-prompt-editor-apply,
.iz-prompt-editor-copy {
    color: #fff !important;
    background: var(--iz-primary) !important;
    border-color: var(--iz-primary) !important;
}

.iz-prompt-admin-edit {
    margin-left: auto;
}

body.iz-prompt-editor-open {
    overflow: hidden;
}

@media (max-width: 1180px) {
    .iz-prompt-library {
        grid-template-columns: 170px minmax(0, 1fr);
        gap: 14px;
    }

    .iz-prompt-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    .iz-prompt-library {
        display: block;
        margin: 12px auto;
        padding: 0 9px;
    }

    .iz-prompt-sidebar {
        position: static;
        margin-bottom: 10px;
        padding: 11px;
        border-radius: 13px;
    }

    .iz-prompt-sidebar-title {
        display: none;
    }

    .iz-prompt-sidebar nav {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 2px;
        scrollbar-width: thin;
    }

    .iz-prompt-sidebar nav a {
        flex: 0 0 auto;
        min-height: 36px;
        padding: 8px 12px;
        white-space: nowrap;
    }

    .iz-prompt-sidebar nav a.is-active::before {
        display: none;
    }

    .iz-prompt-toolbar {
        gap: 9px;
        padding: 10px;
    }

    .iz-prompt-result-count {
        font-size: 12px;
    }

    .iz-prompt-model-filter {
        padding: 9px 10px;
    }

    .iz-prompt-model-label {
        display: none;
    }

    .iz-prompt-section {
        padding: 12px;
        border-radius: 13px;
    }

    .iz-prompt-section-heading p {
        display: none;
    }

    .iz-prompt-grid {
        grid-template-columns: 1fr;
    }

    .iz-prompt-card {
        min-height: 215px;
        padding: 14px;
    }

    .iz-prompt-actions {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .iz-prompt-run {
        margin-left: 0;
    }

    .iz-prompt-editor {
        align-items: flex-end;
        padding: 10px;
    }

    .iz-prompt-editor-panel {
        max-height: calc(100vh - 20px);
        padding: 17px;
        border-radius: 14px 14px 8px 8px;
    }

    .iz-prompt-editor-textarea {
        min-height: 42vh;
    }

    .iz-prompt-admin-edit {
        width: 100%;
        margin-left: 0;
    }

    .iz-prompt-toast {
        right: 15px;
        bottom: 20px;
        left: 15px;
        text-align: center;
    }
}

@media (max-width: 390px) {
    .iz-prompt-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .iz-prompt-result-count {
        padding: 0 3px;
        text-align: right;
    }

    .iz-prompt-copy,
    .iz-prompt-edit,
    .iz-prompt-expand,
    .iz-prompt-run-toggle {
        padding: 6px 8px;
        font-size: 12px;
    }
}
