/* ============================================
   AI Product Dashboard - Light Theme System
   ============================================ */

:root {
    /* Base colors mapped from demo */
    --bg-primary: #f1f5f9; /* Nền xám nhạt toàn trang */
    --bg-secondary: #ffffff; /* Nền sidebar, panels */
    --bg-card: #ffffff;
    --bg-hover: #f8fafc;
    --bg-active: #e2e8f0;

    --border: #e2e8f0;
    --border-light: #f1f5f9;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;

    /* Accents */
    --accent: #4f46e5; /* Nút AI */
    --accent-light: #818cf8;
    --accent-glow: #eef2ff;

    /* Status */
    --success: #059669;
    --success-bg: #dcfce7;
    --success-text: #166534;

    --warning: #d97706;
    --warning-bg: #fef9c3;
    --warning-text: #854d0e;

    --danger: #dc2626;
    --danger-bg: #fee2e2;
    --danger-text: #b91c1c;

    --info: #2563eb;
    --info-bg: #dbeafe;
    --info-text: #1d4ed8;

    /* Category Levels (Mapped to Demo) */
    --level-1: #eff6ff; /* Root */
    --level-2: #f9fafb;
    --level-3: #f5f3ff;
    --level-4: #ecfdf3;
    --level-5: #fff7ed;

    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 16px;
    --shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --transition: all 0.2s ease;
    --font:
        system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    overflow: hidden;
    height: 100vh;
}

/* ============ TOP NAV (Mới theo Demo) ============ */
.topbar {
    height: 50px;
    background: #0f172a;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    font-size: 14px;
    z-index: 100;
}
.topbar-title {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}
.topbar-tabs {
    display: flex;
    gap: 10px;
}
.topbar-tab {
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13px;
    cursor: pointer;
    background: rgba(148, 163, 184, 0.2);
    color: white;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: var(--transition);
}
.topbar-tab.active {
    background: white;
    color: #0f172a;
}
.topbar-tab:hover:not(.active) {
    background: rgba(148, 163, 184, 0.4);
}

/* ============ MAIN LAYOUT ============ */
.layout {
    display: flex;
    height: calc(100vh - 50px);
}

/* ============ SIDEBAR / CATEGORIES ============ */
.sidebar {
    width: 340px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}
.sidebar-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}
.sidebar-header-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
}
.sidebar-header span.desc {
    font-size: 11px;
    color: #94a3b8;
}
.sidebar-search {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #cbd5f5;
    border-radius: var(--radius-sm);
    font-size: 12px;
    outline: none;
    margin-top: 8px;
}
.category-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0 10px;
}
.category-item {
    padding: 6px 14px;
    cursor: pointer;
    font-size: 13px;
    border-left: 3px solid transparent;
    transition:
        background 0.15s ease,
        border-color 0.15s ease;
}
.category-item:hover {
    filter: brightness(0.98);
}
.category-item.active {
    border-left-color: #0ea5e9;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08); /* active demo outline */
}
.category-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}
.category-main {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
}
.category-toggle {
    width: 16px;
    height: 16px;
    border-radius: 999px;
    border: 1px solid #cbd5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    background: #eff6ff;
    color: #1d4ed8;
    flex-shrink: 0;
    cursor: pointer;
}
.category-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}
.category-count {
    font-size: 11px;
    background: var(--border);
    border-radius: 999px;
    padding: 2px 8px;
    flex-shrink: 0;
}
.category-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
    justify-content: flex-end;
}

/* Category levels */
.lvl-0 {
    background: var(--level-1);
}
.lvl-1 {
    background: var(--level-2);
}
.lvl-2 {
    background: var(--level-3);
}
.lvl-3 {
    background: var(--level-4);
}
.lvl-4 {
    background: var(--level-5);
}
.lvl-5 {
    background: #fff1f2;
}

/* Legend */
.legend {
    border-top: 1px solid var(--border);
    padding: 10px 14px;
    font-size: 11px;
    background: #f9fafb;
}
.legend-title {
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.legend-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}
.legend-color {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid var(--border);
}

/* ============ MAIN CONTENT ============ */
.main {
    flex: 1;
    padding: 18px 22px;
    overflow-y: auto;
}
.main-columns {
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    gap: 18px;
    height: 100%;
}

/* ============ PANELS ============ */
.panel {
    background: white;
    border-radius: 10px;
    border: 1px solid var(--border);
    padding: 14px 16px;
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
}
.panel-fill {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.panel-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    min-height: 28px;
}
.panel-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}
.panel-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.panel-actions {
    display: flex;
    gap: 6px;
}

/* ============ PRODUCT LIST ============ */
.product-list {
    flex: 1;
    overflow-y: auto;
    margin-top: 8px;
    padding-right: 4px;
}
.product-item {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 8px;
    cursor: pointer;
    font-size: 13px;
    background: #f9fafb;
    transition: var(--transition);
}
.product-item:hover {
    border-color: #cbd5e1;
}
.product-item.active {
    border-color: var(--accent);
    background: var(--accent-glow);
}
.product-item-title {
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 2px;
}
.product-item-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

/* ============ PILLS & STATUS BADGES ============ */
.pill {
    display: inline-block;
    font-size: 10px;
    border-radius: 999px;
    padding: 2px 6px;
    margin-right: 4px;
    font-weight: 500;
}
.pill-green {
    background: var(--success-bg);
    color: var(--success-text);
}
.pill-yellow {
    background: var(--warning-bg);
    color: var(--warning-text);
}
.pill-red {
    background: var(--danger-bg);
    color: var(--danger-text);
}
.pill-blue {
    background: var(--info-bg);
    color: var(--info-text);
}
.pill-gray {
    background: var(--border);
    color: var(--text-secondary);
}

/* Compat old badges */
.status-tag {
    display: inline-block;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
    margin-right: 4px;
}
.status-tag.danger {
    background: var(--danger-bg);
    color: var(--danger-text);
}
.status-tag.success {
    background: var(--success-bg);
    color: var(--success-text);
}
.status-tag.info {
    background: var(--info-bg);
    color: var(--info-text);
}
.status-tag.warning {
    background: var(--warning-bg);
    color: var(--warning-text);
}

/* ============ BUTTONS ============ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: var(--font);
    cursor: pointer;
    transition: var(--transition);
}
.btn:active {
    transform: scale(0.96);
}

.btn-ai {
    border: none;
    border-radius: 999px;
    background: var(--accent);
    color: white;
    padding: 4px 10px;
    font-size: 11px;
}
.btn-ai:hover {
    background: #4338ca;
}
.btn-ai-small {
    padding: 3px 8px;
    font-size: 10px;
}

.btn-search {
    border: none;
    border-radius: 999px;
    background: #0ea5e9;
    color: white;
    padding: 4px 10px;
    font-size: 11px;
}

.btn-primary,
.btn-success {
    border: none;
    border-radius: 6px;
    background: var(--success);
    color: white;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 500;
}
.btn-primary:hover,
.btn-success:hover {
    background: #047857;
}

.btn-secondary {
    border: 1px solid #cbd5f5;
    border-radius: 6px;
    background: white;
    color: #0f172a;
    padding: 6px 10px;
    font-size: 12px;
}
.btn-secondary:hover {
    background: #f8fafc;
}

.btn-ghost {
    border: 1px solid var(--border);
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    padding: 6px 10px;
    font-size: 12px;
}
.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: #cbd5e1;
}

.btn-warning {
    border: none;
    border-radius: 6px;
    background: #f59e0b;
    color: white;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 500;
}
.btn-warning:hover {
    background: var(--warning);
}

.btn-danger {
    border: none;
    border-radius: 6px;
    background: var(--danger);
    color: white;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 500;
}
.btn-sm {
    padding: 4px 10px;
    font-size: 11px;
}
.btn-xs {
    padding: 2px 8px;
    font-size: 10px;
}
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Filter / List Actions */
.list-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

/* ============ FORM FIELDS ============ */
.field-row {
    margin-bottom: 12px;
}
.field-row:last-child {
    margin-bottom: 0;
}
.field-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}
.field-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}
.field-sublabel {
    font-size: 11px;
    color: var(--text-muted);
}
.field-label-actions {
    display: flex;
    gap: 4px;
}

input[type="text"],
input[type="number"],
input[type="password"],
textarea,
select,
.field-input,
.setting-input {
    width: 100%;
    border: 1px solid #cbd5f5;
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 13px;
    background: white;
    color: var(--text-primary);
    outline: none;
    font-family: var(--font);
    transition: var(--transition);
}
input:focus,
textarea:focus,
select:focus,
.field-input:focus,
.setting-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}
textarea {
    min-height: 80px;
    resize: vertical;
}
.field-input.dirty {
    background: #fffbeb;
    border-color: #fcd34d;
}

/* ============ LAYOUT GRIDS / PANELS ============ */
.two-cols {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.three-cols {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

/* ============ DETAILS OVERVIEW ============ */
.detail-action-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 14px;
}
.detail-product-info h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}
.detail-product-info .meta {
    font-size: 12px;
    color: var(--text-muted);
}
.detail-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.detail-body {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding-right: 4px;
}

/* Details block from Demo */
.detail-block {
    background: white;
    border-radius: 10px;
    border: 1px solid var(--border);
    padding: 14px 16px;
    margin-bottom: 14px;
}
.block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    border-bottom: 1px dashed var(--border);
    padding-bottom: 8px;
}
.block-header h4 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
}
.block-header-actions {
    display: flex;
    gap: 6px;
}

/* Images Grid */
.images-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.image-card {
    width: 90px;
    font-size: 11px;
}
.image-card img {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border);
    margin-bottom: 4px;
}

/* Specs Grid - Editable */
.spec-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.spec-item {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.spec-item .field-input {
    border-color: transparent;
    background: transparent;
    padding: 4px 6px;
}
.spec-item .field-input:focus {
    border-color: var(--accent);
    background: white;
}
.spec-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 2px;
}
.spec-value {
    font-size: 12px;
    font-weight: 500;
}

/* Image Gallery */
.image-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.image-thumb {
    width: 90px;
    height: 90px;
    border-radius: 8px;
    border: 1px solid var(--border);
    overflow: hidden;
    cursor: pointer;
    position: relative;
    transition: var(--transition);
}
.image-thumb:hover {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.15);
    transform: scale(1.05);
}
.image-thumb.primary {
    border-color: var(--accent);
    border-width: 2px;
}
.image-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.image-badge {
    position: absolute;
    bottom: 2px;
    left: 2px;
    background: var(--accent);
    color: white;
    font-size: 9px;
    padding: 1px 5px;
    border-radius: 4px;
    font-weight: 600;
}

/* Checkboxes (Attributes block) */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    font-size: 12px;
}
.checkbox-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-primary);
}

/* ============ SETTINGS PAGE ============ */
.settings-container {
    padding: 18px 22px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    height: 100%;
    overflow-y: auto;
}
.settings-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 18px;
}
.settings-page-header h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}
.settings-subtitle {
    font-size: 12px;
    color: var(--text-muted);
}
.settings-row {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 18px;
    margin-bottom: 16px;
}
.settings-label {
    font-size: 13px;
    font-weight: 500;
}
.settings-desc {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 3px;
}

/* Prompt Grid */
.prompt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 14px;
}
.prompt-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    transition: var(--transition);
}
.prompt-card-header {
    padding: 12px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background: var(--bg-hover);
    border-bottom: 1px solid transparent;
}
.prompt-card-header:hover {
    background: #f1f5f9;
}
.prompt-card-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.prompt-icon {
    font-size: 18px;
}
.prompt-card-title {
    font-size: 12px;
    font-weight: 600;
}
.prompt-card-desc {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}
.prompt-card-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}
.prompt-char-count {
    font-size: 10px;
    color: var(--text-muted);
    background: white;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border);
}
.prompt-card-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}
.prompt-card-body.expanded {
    max-height: 500px;
    border-top: 1px solid var(--border);
}
.prompt-textarea {
    width: 100%;
    min-height: 110px;
    padding: 12px;
    border: none;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    resize: vertical;
    outline: none;
    border-radius: 0;
    background: transparent;
}
.prompt-card-footer {
    padding: 8px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.prompt-field-tag {
    font-size: 10px;
    color: var(--text-muted);
    background: var(--bg-primary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    border: 1px solid var(--border);
}
.prompt-save-bar {
    margin-top: 18px;
    padding: 14px 18px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.prompt-save-info {
    font-size: 12px;
    color: var(--text-muted);
}
.prompt-save-actions {
    display: flex;
    gap: 8px;
}

/* ============ SYNC PAGE ============ */
.sync-container {
    padding: 24px;
    overflow-y: auto;
    height: 100%;
    max-width: 1400px;
    margin: 0 auto;
}
.sync-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
}
.sync-page-header h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}
.sync-page-actions {
    display: flex;
    gap: 8px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    text-align: center;
}
.stat-icon {
    font-size: 24px;
    margin-bottom: 6px;
}
.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1;
}
.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}
.stat-bar {
    height: 4px;
    background: var(--bg-primary);
    border-radius: 2px;
    margin-top: 10px;
    overflow: hidden;
}
.stat-bar-fill {
    height: 100%;
    border-radius: 2px;
    background: #0ea5e9;
}
.stat-bar-fill.warning {
    background: #f59e0b;
}
.stat-bar-fill.info {
    background: #3b82f6;
}
.stat-bar-fill.success {
    background: #10b981;
}

.workflow-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 14px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 20px;
}
.workflow-step {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
}
.workflow-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}
.workflow-circle.draft {
    background: #fef3c7;
    color: #d97706;
}
.workflow-circle.confirmed {
    background: #e0e7ff;
    color: #4338ca;
}
.workflow-circle.synced {
    background: #dcfce7;
    color: #166534;
}
.workflow-arrow {
    color: #cbd5e1;
    font-weight: bold;
}

.sync-filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 16px;
}
.filter-tabs {
    display: flex;
    gap: 6px;
}
.filter-tab {
    padding: 6px 12px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}
.filter-tab:hover {
    background: #f8fafc;
}
.filter-tab.active {
    background: #eef2ff;
    border-color: #4f46e5;
    color: #4f46e5;
}
.filter-count {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
}
.filter-tab.active .filter-count {
    background: #e0e7ff;
}

.sync-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}
.sync-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}
.sync-table th,
.sync-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.sync-table th {
    background: #f8fafc;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
}
.sync-table tr:hover td {
    background: #f8fafc;
}
.wp-id-badge {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    border: 1px solid var(--border);
}
.edit-count-badge {
    background: #fef3c7;
    color: #d97706;
    padding: 2px 6px;
    border-radius: 999px;
    font-weight: 600;
}
.product-name-cell {
    max-width: 220px;
}
.product-name-text {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}
.action-cell {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.time-cell {
    font-size: 11px;
    color: var(--text-muted);
}
.field-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.field-tag {
    background: #eef2ff;
    color: #4f46e5;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 10px;
}
.pending-count-badge {
    background: #eef2ff;
    color: #4f46e5;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}

/* ============ OTHER COMPONENTS ============ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
    gap: 8px;
}
.empty-state-icon {
    font-size: 32px;
    opacity: 0.6;
}

.loading-shimmer {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e2e8f0;
    border-top-color: #4f46e5;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
.spinner-sm {
    width: 14px;
    height: 14px;
    border-width: 2px;
}

/* AI Preview HTML */
.ai-html-preview {
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--text-primary);
    max-height: 250px;
    overflow-y: auto;
    word-break: break-word;
}
.ai-html-preview h1,
.ai-html-preview h2,
.ai-html-preview h3 {
    margin: 8px 0;
    font-weight: 600;
    color: #0f172a;
}
.ai-html-preview p {
    margin: 6px 0;
    color: var(--text-secondary);
}
.ai-html-preview ul {
    padding-left: 20px;
    margin: 6px 0;
}
.ai-html-preview table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0;
}
.ai-html-preview table th,
.ai-html-preview table td {
    border: 1px solid var(--border);
    padding: 4px 8px;
}

/* =============== MODAL =============== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 20px;
    animation: fadeIn 0.15s ease-out;
}
.modal-overlay.hidden {
    display: none;
}
.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    max-height: 85vh;
}
.modal-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
}
.modal-close {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: var(--text-muted);
}
.modal-body {
    padding: 18px;
    overflow-y: auto;
    font-size: 13px;
}
.modal-footer {
    padding: 14px 18px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    background: #f8fafc;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

/* AI Save Details & Result in Modal */
.ai-result-section {
    margin-bottom: 14px;
}
.ai-result-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.ai-result-label-new {
    color: var(--success);
}
.ai-result-current {
    background: #f1f5f9;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
    opacity: 0.8;
    max-height: 100px;
    overflow-y: auto;
}
.ai-result-new {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    padding: 12px;
    border-radius: 6px;
    max-height: 250px;
    overflow-y: auto;
    color: #166534;
}
.ai-raw-toggle {
    margin-top: 10px;
    font-size: 11px;
    color: var(--text-muted);
    cursor: pointer;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}
.ai-raw-toggle summary {
    padding: 8px;
    background: #f8fafc;
    font-weight: 500;
}
.ai-raw-code {
    padding: 10px;
    background: #f1f5f9;
    white-space: pre-wrap;
    word-break: break-all;
    font-family: monospace;
    font-size: 10px;
    color: var(--text-secondary);
    max-height: 200px;
    overflow-y: auto;
}

/* Diff Modal table */
.diff-header-info {
    display: flex;
    justify-content: space-between;
    background: #f8fafc;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 12px;
    font-weight: 600;
}
.diff-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.diff-table th,
.diff-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}
.diff-old {
    background: #fee2e2;
    color: #b91c1c;
    padding: 4px 6px;
    border-radius: 4px;
}
.diff-new {
    background: #dcfce7;
    color: #166534;
    padding: 4px 6px;
    border-radius: 4px;
}
.diff-note {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 12px;
    padding: 10px;
    background: #f8fafc;
    border-radius: 6px;
    line-height: 1.6;
}

/* =============== TOAST =============== */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: white;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.toast.show {
    transform: translateX(0);
}
.toast-info {
    background: #3b82f6;
}
.toast-success {
    background: #10b981;
}
.toast-warning {
    background: #f59e0b;
    color: white;
}
.toast-error {
    background: #ef4444;
}

/* =============== BULK AI =============== */
.bulk-progress-container {
    font-size: 13px;
}
.bulk-stats-row {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}
.bulk-stat {
    flex: 1;
    padding: 10px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 6px;
    text-align: center;
}
.bulk-stat-num {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
}
.bulk-stat-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
}
.bulk-stat-ok .bulk-stat-num {
    color: #166534;
}
.bulk-stat-err .bulk-stat-num {
    color: #b91c1c;
}
.bulk-progress-bar {
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}
.bulk-progress-fill {
    height: 100%;
    background: #4f46e5;
    transition: width 0.3s;
}
.bulk-progress-text {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.bulk-status-text {
    text-align: center;
    font-size: 11px;
    color: #4f46e5;
    background: #eef2ff;
    padding: 4px;
    border-radius: 4px;
    margin-bottom: 12px;
    display: none;
}
.bulk-log {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 6px;
}
.bulk-log-item {
    display: flex;
    gap: 8px;
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
    font-size: 11px;
}
.bulk-log-idx {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}
.bulk-log-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bulk-log-status {
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}
.bulk-log-success {
    background: #f0fdf4;
}
.bulk-log-error {
    background: #fef2f2;
}
.bulk-log-processing {
    background: #f8fafc;
}

/* Utilities */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.status-dot.online {
    background: var(--success);
}
.status-dot.offline {
    background: var(--danger);
}
.connection-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
}
.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}
.input-icon {
    position: absolute;
    left: 10px;
    font-size: 14px;
    color: var(--text-muted);
}
.input-with-icon input {
    padding-left: 32px;
}
.eye-toggle {
    position: absolute;
    right: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
}
.test-result-box {
    margin-top: 10px;
    border-radius: 6px;
    font-size: 12px;
}
.test-result-box.testing {
    padding: 12px;
    background: #f8fafc;
    border: 1px solid var(--border);
}
.test-result-box.test-success {
    padding: 12px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}
.test-result-box.test-error {
    padding: 12px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}
@keyframes fadeIn {
    from {
        opacity: 0;
    }
}
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}
