#aive-root, #aive-root * {
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.aive-hidden { display: none !important; }

.aive-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
    background: #6d28d9;
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
.aive-toggle.aive-active { background: #dc2626; }

.aive-hover-box {
    position: absolute;
    z-index: 999998;
    outline: 2px solid #6d28d9;
    background: rgba(109,40,217,0.08);
    pointer-events: none;
}

body.aive-edit-mode { cursor: crosshair; }

.aive-savebar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 999997;
    background: #111827;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    font-size: 14px;
}
.aive-savebar-label { font-weight: 600; }
.aive-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #22c55e;
    display: inline-block;
    animation: aive-blink 1.4s infinite;
}
@keyframes aive-blink { 0%,100% { opacity: 1; } 50% { opacity: .3; } }
.aive-counter {
    flex: 1;
    font-size: 12px;
    color: #9ca3af;
}

.aive-btn {
    border: none;
    border-radius: 6px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.aive-btn-primary { background: #6d28d9; color: #fff; }
.aive-btn-success { background: #16a34a; color: #fff; }
.aive-btn-ghost { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.4); }
.aive-full { width: 100%; margin-top: 8px; }

.aive-panel {
    position: fixed;
    top: 50px;
    right: 0;
    bottom: 0;
    width: 340px;
    background: #fff;
    color: #111827;
    z-index: 999996;
    box-shadow: -4px 0 20px rgba(0,0,0,.15);
    overflow-y: auto;
    padding: 16px;
}
.aive-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.aive-close {
    background: none; border: none; font-size: 20px; cursor: pointer; line-height: 1;
}
.aive-tag-label {
    display: inline-block;
    background: #f3f4f6;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 12px;
    font-family: monospace;
    margin-bottom: 12px;
}
.aive-section {
    border-top: 1px solid #e5e7eb;
    padding-top: 12px;
    margin-top: 12px;
}
.aive-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 13px;
}
.aive-section label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.aive-section textarea {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 8px;
    font-size: 13px;
    resize: vertical;
}
.aive-status { font-size: 12px; color: #6b7280; margin-top: 6px; min-height: 16px; }
.aive-action-row { display: flex; gap: 8px; margin-top: 10px; }

.aive-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 8px;
    margin-bottom: 4px;
}
.aive-tab {
    background: #f3f4f6;
    border: none;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    color: #374151;
}
.aive-tab-active { background: #6d28d9; color: #fff; }

.aive-subtabs { display: flex; gap: 6px; margin-bottom: 10px; }
.aive-subtab {
    flex: 1;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 6px;
    font-size: 12px;
    cursor: pointer;
}
.aive-subtab-active { background: #ede9fe; border-color: #6d28d9; color: #6d28d9; font-weight: 600; }

.aive-hint { font-size: 12px; color: #6b7280; margin-bottom: 10px; }

.aive-divider { border-top: 1px dashed #e5e7eb; margin: 14px 0; }

.aive-font-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.aive-font-card {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
    padding: 10px 6px;
    text-align: center;
    cursor: pointer;
    font-size: 15px;
}
.aive-font-card:hover { border-color: #6d28d9; background: #faf5ff; }
.aive-font-card small { font-size: 10px; color: #6b7280; }

.aive-pulsing { animation: aive-elem-pulse 1.6s ease-in-out infinite; }
@keyframes aive-elem-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.04); }
}

body.aive-media-open #aive-root {
    display: none !important;
}

.aive-preview-pulse {
    animation: aive-pulse 1s ease-in-out 2;
    outline: 2px dashed #6d28d9;
}
@keyframes aive-pulse {
    0%, 100% { outline-color: #6d28d9; }
    50% { outline-color: #c4b5fd; }
}
