/* ============================================
   Component Styles
   ============================================ */

/* --- Stat Card --- */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow-sm);
}

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

.stat-card__label {
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.stat-card__icon {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.stat-card__icon--blue { background: var(--accent-muted); color: var(--accent); }
.stat-card__icon--green { background: var(--success-muted); color: var(--success); }
.stat-card__icon--red { background: var(--error-muted); color: var(--error); }
.stat-card__icon--yellow { background: var(--warning-muted); color: var(--warning); }
.stat-card__icon--purple { background: var(--purple-muted); color: var(--purple); }
.stat-card__icon--cyan { background: var(--info-muted); color: var(--info); }

.stat-card__value {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
    font-family: var(--font-mono);
}



.stat-card__footer {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

.stat-card__trend {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 2px;
}

.stat-card__trend--up { color: var(--success); }
.stat-card__trend--down { color: var(--error); }

/* --- Panel / Card --- */
.panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.panel__title {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
}

.panel__subtitle {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-top: 1px;
}

.panel__actions {
    display: flex;
    gap: 4px;
}

.panel__body {
    padding: 16px;
}

.panel__body--no-padding {
    padding: 0;
}

/* --- Chart Container --- */
.chart-container {
    position: relative;
    width: 100%;
    height: 280px;
    padding: 12px;
}

.chart-container--sm {
    height: 200px;
}

.chart-container--lg {
    height: 360px;
}

/* --- Data Table --- */
.data-table-wrapper {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
}

.data-table th {
    text-align: left;
    padding: 10px 12px;
    font-weight: 600;
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    position: sticky;
    top: 0;
    z-index: 1;
}

.data-table th:hover {
    color: var(--text-primary);
}

.data-table th .sort-icon {
    display: inline-block;
    margin-left: 4px;
    opacity: 0.3;
    font-size: 10px;
}

.data-table th.sorted .sort-icon {
    opacity: 1;
    color: var(--accent);
}

.data-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
    white-space: nowrap;
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.data-table tr:hover td {
    background: var(--bg-card-hover);
}

.data-table tr.expanded td {
    background: var(--bg-secondary);
}

.data-table .cell-mono {
    font-family: var(--font-mono);
    font-size: var(--font-size-xs);
    color: #e8ecf4;
    font-weight: 600;
}

.data-table .cell-domain {
    color: var(--text-link);
    font-weight: 500;
}

.data-table .cell-ip {
    font-family: var(--font-mono);
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

/* --- Expand Row (Hreflang details) --- */
.expand-row {
    display: none;
}

.expand-row.open {
    display: table-row;
}

.expand-row td {
    padding: 12px 16px;
    background: var(--bg-secondary);
}

.expand-content {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* --- Status Badge --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: var(--font-size-xs);
    font-weight: 600;
    white-space: nowrap;
}

.badge--success {
    background: var(--success-muted);
    color: var(--success);
}

.badge--error {
    background: var(--error-muted);
    color: var(--error);
}

.badge--warning {
    background: var(--warning-muted);
    color: var(--warning);
}

.badge--info {
    background: var(--info-muted);
    color: var(--info);
}

.badge--neutral {
    background: var(--bg-input);
    color: var(--text-secondary);
}

.badge--accent {
    background: var(--accent-muted);
    color: var(--accent);
}

.badge--purple {
    background: var(--purple-muted);
    color: var(--purple);
}

/* --- HTTP Status --- */
.status-code {
    font-family: var(--font-mono);
    font-size: var(--font-size-xs);
    font-weight: 700;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}

.status-code--2xx { background: var(--success-muted); color: var(--success); }
.status-code--3xx { background: var(--info-muted); color: var(--info); }
.status-code--4xx { background: var(--warning-muted); color: var(--warning); }
.status-code--5xx { background: var(--error-muted); color: var(--error); }

/* --- Brand Tag --- */
.brand-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: 600;
    background: var(--purple-muted);
    color: var(--purple);
}

/* --- GEO Tag --- */
.geo-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: 600;
    background: var(--info-muted);
    color: var(--info);
}

/* --- Form Inputs (generic) --- */
.input,
input.input,
textarea.input,
select.input {
    padding: 7px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    font-family: var(--font-sans);
    outline: none;
    transition: border-color var(--transition);
}
.input:focus { border-color: var(--accent); }
.input::placeholder { color: var(--text-muted); }
textarea.input { resize: vertical; }

/* --- Settings Panel (inside modals) --- */
.settings-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    margin-top: 12px;
}
.settings-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.settings-panel__title {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0;
}
.settings-panel__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.settings-panel__label {
    font-size: 11px;
    color: var(--text-muted);
    display: block;
    margin-bottom: 4px;
}
.settings-panel__label code {
    color: var(--text-secondary);
    background: var(--bg-primary);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 11px;
}
.settings-panel .input {
    width: 100%;
    font-family: var(--font-mono);
    font-size: 12px;
}

/* --- Filter Bar --- */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.filter-bar__search {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.filter-bar__search input {
    width: 100%;
    padding: 7px 12px 7px 32px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    font-family: var(--font-sans);
    outline: none;
    transition: border-color var(--transition);
}

.filter-bar__search input:focus {
    border-color: var(--accent);
}

.filter-bar__search input::placeholder {
    color: var(--text-muted);
}

.filter-bar__search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 13px;
    pointer-events: none;
}

.filter-bar select {
    padding: 7px 28px 7px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    font-family: var(--font-sans);
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b92a5' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}

.filter-bar select:focus {
    border-color: var(--accent);
}

/* --- Pagination --- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-top: 1px solid var(--border-color);
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

.pagination__info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pagination__controls {
    display: flex;
    gap: 4px;
}

.pagination__btn {
    padding: 4px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: var(--font-size-xs);
    font-family: var(--font-sans);
    transition: all var(--transition);
}

.pagination__btn:hover:not(:disabled) {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.pagination__btn--active {
    background: var(--accent-muted);
    border-color: var(--accent);
    color: var(--accent);
}

.pagination__btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* --- Button --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all var(--transition);
    border: 1px solid transparent;
    white-space: nowrap;
}

.btn--primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.btn--primary:hover {
    background: var(--accent-hover);
}

.btn--outline {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.btn--outline:hover {
    color: var(--text-primary);
    border-color: var(--text-muted);
    background: var(--bg-card-hover);
}

.btn--sm {
    padding: 4px 10px;
    font-size: var(--font-size-xs);
}

.btn:disabled,
.btn--loading {
    opacity: 0.55;
    pointer-events: none;
    cursor: not-allowed;
}

/* --- Scan Progress Toast --- */
.scan-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    display: none;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    min-width: 280px;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    animation: toast-slide-in 0.3s ease;
}
.scan-toast + .scan-toast {
    bottom: 90px;
}
.scan-toast--done {
    border-color: var(--success);
}
.scan-toast--error {
    border-color: var(--error);
}
.scan-toast__body {
    flex: 1;
    min-width: 0;
}
.scan-toast__label {
    font-weight: 600;
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 2px;
}
.scan-toast__msg {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.scan-toast__close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
}
.scan-toast__close:hover {
    color: var(--text-primary);
}
.scan-toast__stop {
    background: var(--error);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
}
.scan-toast__stop:hover {
    opacity: 0.85;
}
.scan-toast__icon--done {
    color: var(--success);
    font-size: 18px;
    font-weight: bold;
}
.scan-toast__icon--error {
    color: var(--error);
    font-size: 18px;
    font-weight: bold;
}
.scan-toast__spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: toast-spin 0.8s linear infinite;
}
@keyframes toast-spin {
    to { transform: rotate(360deg); }
}
@keyframes toast-slide-in {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* --- Operations Panel (Overview) --- */
.ops-panel {
    margin-bottom: 16px;
    overflow: visible !important;
}
.ops-row {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
}
.ops-row:last-child {
    border-bottom: none;
}
.ops-row__header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}
.ops-row--done .ops-row__header {
    margin-bottom: 0;
}
.ops-row__label {
    font-weight: 600;
    font-size: var(--font-size-sm);
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 70px;
}
.ops-row__progress-text {
    flex: 1;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ops-row__time {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    white-space: nowrap;
}
.ops-row__pct {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    text-align: right;
    margin-top: 2px;
}
.ops-row__bar-track {
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
}
.ops-row__bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.5s ease;
    min-width: 2px;
}

/* --- Notification Badge & Log Panel --- */
.notif-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: var(--error);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.notif-log-panel {
    position: fixed;
    top: 50px;
    right: 16px;
    width: 380px;
    max-height: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 32px rgba(0,0,0,0.2);
    z-index: 10001;
    display: flex;
    flex-direction: column;
    animation: toast-slide-in 0.2s ease;
}
.notif-log-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: var(--font-size-sm);
}
.notif-log-panel__body {
    overflow-y: auto;
    max-height: 360px;
    scrollbar-width: thin;
}
.notif-log-panel__item {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: var(--font-size-sm);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.notif-log-panel__item:last-child {
    border-bottom: none;
}
.notif-log-panel__time {
    margin-left: auto;
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    white-space: nowrap;
}
.notif-log-panel__empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

/* --- Hreflang Tag --- */
.hreflang-tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: 500;
    font-family: var(--font-mono);
    background: var(--bg-input);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.hreflang-tag--primary {
    background: var(--accent-muted);
    color: var(--accent);
    border-color: rgba(59, 130, 246, 0.3);
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state__icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state__text {
    font-size: var(--font-size-md);
    margin-bottom: 4px;
}

.empty-state__sub {
    font-size: var(--font-size-sm);
}

/* --- Tooltip --- */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 8px;
    background: var(--bg-tooltip);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition);
    z-index: 1000;
}

.tooltip:hover::after {
    opacity: 1;
}

/* --- Health Bar --- */
.health-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    overflow: hidden;
}

.health-bar__fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.health-bar__fill--good { background: var(--success); }
.health-bar__fill--warn { background: var(--warning); }
.health-bar__fill--bad { background: var(--error); }

/* --- Loading Spinner --- */
.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- Tab Navigation --- */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-color);
    padding: 0 16px;
}

.tab {
    padding: 10px 16px;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all var(--transition);
    user-select: none;
}

.tab:hover {
    color: var(--text-primary);
}

.tab--active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* --- Scrollable Table --- */
.table-scroll {
    max-height: 500px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-light) transparent;
}

.table-scroll::-webkit-scrollbar {
    width: 4px;
}
.table-scroll::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 2px;
}

/* --- List Item (for sidebar-style lists) --- */
.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: var(--font-size-sm);
}

.list-item:last-child {
    border-bottom: none;
}

.list-item__label {
    color: var(--text-primary);
    font-weight: 500;
}

.list-item__value {
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: var(--font-size-xs);
}

/* --- Progress Bar (for health/coverage) --- */
.progress-inline {
    display: flex;
    align-items: center;
    gap: 8px;
}

.progress-inline__bar {
    flex: 1;
    height: 4px;
    background: var(--bg-input);
    border-radius: 2px;
    overflow: hidden;
}

.progress-inline__fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
}

.progress-inline__label {
    font-size: var(--font-size-xs);
    font-family: var(--font-mono);
    color: var(--text-secondary);
    min-width: 36px;
    text-align: right;
}

/* --- Trend Value (green up / red down) --- */
.trend-val {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-family: var(--font-mono);
    font-weight: 600;
}

.trend-val--up {
    color: var(--success);
}

.trend-val--down {
    color: var(--error);
}

.trend-val--neutral {
    color: var(--text-primary);
}

.trend-val--zero {
    color: var(--text-muted);
}

.trend-val__delta {
    font-size: 0.5em;
    margin-left: 6px;
    opacity: 0.85;
}

.data-table .trend-val__delta {
    font-size: 0.85em;
    margin-left: 4px;
}

/* --- Domain Detail Modal / Overlay --- */
.domain-detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 20px;
    overflow-y: auto;
}

.domain-detail {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 960px;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.2s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.domain-detail__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.domain-detail__title {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--text-link);
}

.domain-detail__close {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.domain-detail__close:hover {
    background: var(--error-muted);
    color: var(--error);
    border-color: var(--error);
}

.domain-detail__body {
    padding: 20px;
}

.domain-detail__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.domain-detail__field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.domain-detail__field-label {
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.domain-detail__field-value {
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    word-break: break-all;
}

.domain-detail__section {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.domain-detail__section-title {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.domain-detail__charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.domain-detail__mini-chart {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
}

.domain-detail__mini-chart-title {
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* --- Hreflang Tooltip (rich) --- */
.hreflang-cell {
    position: relative;
    cursor: default;
}

.hreflang-cell__tags {
    display: flex;
    gap: 3px;
    align-items: center;
}

.hreflang-cell__more {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-left: 2px;
}

.hreflang-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    min-width: 380px;
    max-height: 300px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 5000;
    padding: 8px 0;
    scrollbar-width: thin;
}

.hreflang-cell:hover .hreflang-tooltip {
    display: block;
}

.hreflang-tooltip__row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    font-size: var(--font-size-xs);
    font-family: var(--font-mono);
}

.hreflang-tooltip__row:hover {
    background: var(--bg-card-hover);
}

.hreflang-tooltip__url {
    color: var(--text-link);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hreflang-tooltip__lang {
    color: var(--text-secondary);
    min-width: 50px;
}

/* --- Searchable Dropdown Filter --- */
.filter-dropdown {
    position: relative;
    display: inline-block;
}

.filter-dropdown__trigger {
    padding: 7px 28px 7px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    font-family: var(--font-sans);
    cursor: pointer;
    white-space: nowrap;
    min-width: 140px;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.filter-dropdown__trigger::after {
    content: '';
    border: 4px solid transparent;
    border-top-color: var(--text-muted);
    margin-top: 2px;
}

.filter-dropdown__trigger:hover {
    border-color: var(--text-muted);
}

.filter-dropdown__panel {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 220px;
    max-height: 320px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 4000;
    overflow: hidden;
}

.filter-dropdown.open .filter-dropdown__panel {
    display: block;
}

.filter-dropdown__search {
    padding: 8px;
    border-bottom: 1px solid var(--border-color);
}

.filter-dropdown__search input {
    width: 100%;
    padding: 6px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: var(--font-size-xs);
    font-family: var(--font-sans);
    outline: none;
}

.filter-dropdown__search input:focus {
    border-color: var(--accent);
}

.filter-dropdown__list {
    max-height: 240px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.filter-dropdown__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    font-size: var(--font-size-xs);
    cursor: pointer;
    color: var(--text-primary);
    transition: background var(--transition);
}

.filter-dropdown__item:hover {
    background: var(--bg-card-hover);
}

.filter-dropdown__item--active {
    background: var(--accent-muted);
    color: var(--accent);
}

.filter-dropdown__item-count {
    font-family: var(--font-mono);
    color: var(--text-muted);
    font-size: 10px;
}

/* --- Search Help Hint --- */
.search-help {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    padding: 4px 16px 8px;
    line-height: 1.6;
}

.search-help code {
    background: var(--bg-input);
    padding: 1px 5px;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--accent);
}

/* --- Hreflang URL list in detail --- */
.hreflang-url-list {
    list-style: none;
    font-size: var(--font-size-xs);
    font-family: var(--font-mono);
    max-height: 260px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.hreflang-url-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    border-bottom: 1px solid var(--border-color);
}

.hreflang-url-list li:last-child {
    border-bottom: none;
}

.hreflang-url-list__href {
    color: var(--text-link);
    flex: 1;
    word-break: break-all;
    white-space: normal;
}

.hreflang-url-list__sep {
    color: var(--text-muted);
}

.hreflang-url-list__lang {
    color: var(--text-secondary);
    min-width: 50px;
    white-space: nowrap;
}

.hreflang-url-list__canonical {
    color: var(--text-muted);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --- Period Comparison Selector --- */
.period-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.period-selector__label {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 600;
}

.period-selector__dropdown {
    position: relative;
}

.period-selector__btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--accent);
    font-size: var(--font-size-xs);
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition);
}

.period-selector__btn:hover {
    border-color: var(--accent);
    background: var(--accent-muted);
}

.period-selector__btn-arrow {
    font-size: 10px;
    color: var(--text-muted);
}

.period-selector__menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 140px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 4000;
    overflow: hidden;
}

.period-selector__menu.open {
    display: block;
}

.period-selector__item {
    padding: 7px 14px;
    font-size: var(--font-size-xs);
    font-weight: 500;
    cursor: pointer;
    color: var(--text-primary);
    transition: background var(--transition);
}

.period-selector__item:hover {
    background: var(--bg-card-hover);
}

.period-selector__item--active {
    background: var(--accent-muted);
    color: var(--accent);
    font-weight: 600;
}

/* --- Per-Page Selector --- */
.per-page-selector {
    display: flex;
    align-items: center;
    gap: 6px;
}

.per-page-selector__label {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    white-space: nowrap;
}

.per-page-selector__select {
    padding: 3px 24px 3px 8px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: var(--font-size-xs);
    font-family: var(--font-sans);
    cursor: pointer;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%238b92a5' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
}

/* --- Checkbox --- */
.row-checkbox {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
    margin: 0;
}

/* --- Action Bar --- */
.action-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.action-bar__count {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-right: 4px;
}

.action-bar .btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* --- Domain Suggestions Dropdown --- */
.domain-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 240px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 5000;
    scrollbar-width: thin;
}

.domain-suggestions__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    font-size: var(--font-size-xs);
    cursor: pointer;
    color: var(--text-primary);
    transition: background var(--transition);
}

.domain-suggestions__item:hover {
    background: var(--bg-card-hover);
}

.domain-suggestions__item-domain {
    font-family: var(--font-mono);
    color: var(--text-link);
}

.domain-suggestions__item-brand {
    font-size: 10px;
    color: var(--text-muted);
}

/* --- Workspace Tabs --- */
.workspace-tabs {
    display: flex;
    gap: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0 16px;
}

.workspace-tab {
    padding: 10px 20px;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all var(--transition);
    user-select: none;
}

.workspace-tab:hover {
    color: var(--text-primary);
}

.workspace-tab--active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* --- SERP Result Card --- */
.serp-result {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    transition: background var(--transition);
}

.serp-result:last-child {
    border-bottom: none;
}

.serp-result:hover {
    background: var(--bg-card-hover);
}

.serp-result__position {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-muted);
    font-size: var(--font-size-xs);
    font-weight: 700;
    font-family: var(--font-mono);
    margin-right: 10px;
    flex-shrink: 0;
}

.serp-result--current {
    background: rgba(59, 130, 246, 0.12);
    border-left: 3px solid var(--accent);
}

.serp-result--current:hover {
    background: rgba(59, 130, 246, 0.18);
}

.serp-result__position--current {
    background: rgba(59, 130, 246, 0.2);
    color: var(--accent);
}

.serp-result--own {
    background: rgba(34, 197, 94, 0.08);
    border-left: 3px solid var(--success);
}

.serp-result--own:hover {
    background: rgba(34, 197, 94, 0.14);
}

.serp-result__position--own {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.serp-result__title {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-link);
    margin-bottom: 2px;
}

.serp-result__url {
    font-size: var(--font-size-xs);
    font-family: var(--font-mono);
    color: var(--success);
    margin-bottom: 2px;
}

.serp-result__description {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    line-height: 1.5;
}

/* --- Stats Grid (wider for domain widgets) --- */
.grid-stats-wide {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
    margin-bottom: 16px;
}

.grid-stats-wide .stat-card {
    padding: 12px;
}

.grid-stats-wide .stat-card__value {
    font-size: var(--font-size-lg);
}

/* --- Hreflang Table in Detail Modal --- */
.hreflang-detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-xs);
    font-family: var(--font-mono);
}

.hreflang-detail-table th {
    text-align: left;
    padding: 6px 8px;
    font-weight: 600;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.hreflang-detail-table td {
    padding: 4px 8px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    word-break: break-all;
}

.hreflang-detail-table tr:hover td {
    background: var(--bg-card-hover);
}

/* --- Period Filter Inline --- */
.period-filter-inline {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
}

.period-filter-inline__btn {
    padding: 3px 10px;
    font-size: var(--font-size-xs);
    font-family: var(--font-sans);
    font-weight: 500;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.period-filter-inline__btn:hover {
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.period-filter-inline__btn--active {
    background: var(--accent-muted);
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 600;
}

/* --- API Balance Panel --- */
.balance-panel__cards {
    display: flex;
    gap: 12px;
    padding: 16px;
    flex-wrap: wrap;
}

.balance-card {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 240px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all var(--transition);
}

.balance-card:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow-sm);
}

.balance-card__icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: var(--font-size-sm);
    flex-shrink: 0;
}

.balance-card__info {
    flex: 1;
    min-width: 0;
}

.balance-card__name {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
}

.balance-card__detail {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-top: 2px;
}

.balance-card__value {
    font-size: 20px;
    font-weight: 700;
    font-family: var(--font-mono);
    flex-shrink: 0;
}

/* Keyword source indicator dot */
.kw-source {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
    flex-shrink: 0;
}
.kw-source--imported { background: var(--accent); }
.kw-source--dataforseo { background: var(--success); }
.kw-source--serp_auto { background: #e67e22; }

/* Stale keyword rows (not seen in SERP for 30+ days) */
tr.kw-stale td { opacity: 0.5; }
tr.kw-stale:hover td { opacity: 0.8; }

/* URL cell with flex layout */
.url-cell {
    display: flex;
    align-items: center;
    gap: 4px;
    max-width: 100%;
}
.url-cell__text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--font-mono);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

/* URL action buttons (open + copy) */
.url-action {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    font-size: 12px;
    line-height: 1;
    color: var(--text-muted);
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    transition: color 0.15s, border-color 0.15s;
}
.url-action:hover {
    color: var(--primary);
    border-color: var(--primary);
}

/* SERP button — distinct style */
.btn-serp {
    padding: 2px 10px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--warning, #f0a500);
    background: none;
    border: 1.5px solid var(--warning, #f0a500);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.btn-serp:hover {
    background: var(--warning, #f0a500);
    color: var(--bg-primary, #1a1a2e);
}

/* Ahrefs info button */
.ahrefs-info-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    background: var(--surface-hover);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
    font-style: italic;
    font-family: serif;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.ahrefs-info-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-muted);
}

/* SV Trend button */
.sv-trend-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 22px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--surface-hover);
    color: var(--text-secondary);
    font-size: 11px;
    letter-spacing: -2px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}
.sv-trend-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Keyword source legend */
.kw-legend {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    color: var(--text-muted);
    gap: 2px;
}

/* --- Keywords Bulk Toolbar --- */
.kw-bulk-toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.kw-bulk-toolbar__group {
    display: flex;
    gap: 4px;
    align-items: center;
}
.kw-bulk-toolbar__sep {
    width: 1px;
    height: 24px;
    background: var(--border-color);
    margin: 0 4px;
}
.kw-bulk-toolbar__input {
    padding: 4px 8px;
    font-size: var(--font-size-sm);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-body);
    color: var(--text-color);
    width: 80px;
}
.kw-bulk-toolbar__select {
    padding: 4px 6px;
    font-size: var(--font-size-sm);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-body);
    color: var(--text-color);
}
.kw-bulk-toolbar__select option {
    background: var(--bg-card);
    color: var(--text-color);
}
.btn--danger {
    background: var(--error);
    color: #fff;
    border: 1px solid var(--error);
}
.btn--danger:hover {
    opacity: 0.9;
}
.kw-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--accent);
}
.kw-geo-option {
    padding: 6px 12px;
    cursor: pointer;
    font-size: var(--font-size-sm);
    color: var(--text-color);
    transition: background 0.15s;
}
.kw-geo-option:hover {
    background: var(--surface-2);
}
.kw-geo-option--active {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
}
.kw-geo-option--active:hover {
    background: var(--accent);
}

/* --- Operations Menu (Unified Selector + Run) --- */
.ops-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.ops-menu__selector {
    position: relative;
    display: inline-block;
}

.ops-menu__trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 5px 10px;
    min-width: 180px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--font-size-xs);
    font-weight: 500;
    font-family: var(--font-sans);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition);
    user-select: none;
}

.ops-menu__trigger:hover {
    border-color: var(--text-muted);
}

.ops-menu__trigger-arrow {
    font-size: 10px;
    color: var(--text-muted);
    margin-left: auto;
}

.ops-menu__dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 300px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 6000;
    overflow: hidden;
}

/* Ensure parent containers don't clip the dropdown */
.page-header__actions,
.panel__header,
.domain-detail__header {
    overflow: visible;
}

.ops-menu__selector.open .ops-menu__dropdown {
    display: block;
}

.ops-menu__search {
    padding: 8px;
    border-bottom: 1px solid var(--border-color);
}

.ops-menu__search input {
    width: 100%;
    padding: 5px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: var(--font-size-xs);
    font-family: var(--font-sans);
    outline: none;
}

.ops-menu__search input:focus {
    border-color: var(--accent);
}

.ops-menu__list {
    max-height: 280px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.ops-menu__item {
    padding: 8px 12px;
    cursor: pointer;
    transition: background var(--transition);
}

.ops-menu__item:hover {
    background: var(--bg-card-hover);
}

.ops-menu__item--active {
    background: var(--accent-muted);
}

.ops-menu__item-label {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
}

.ops-menu__item-desc {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-top: 1px;
}

.ops-menu__desc {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-top: 4px;
    padding-left: 2px;
    max-width: 380px;
}

.btn--run {
    background: var(--success);
    color: #fff;
    border: 1px solid var(--success);
    padding: 5px 14px;
    font-weight: 600;
    font-size: var(--font-size-xs);
}

.btn--run:hover:not(:disabled) {
    filter: brightness(1.1);
}

.btn--run:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

/* --- EMZ Score --- */
.emz-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 4px;
    vertical-align: middle;
}
.emz-dot--green  { background: #22c55e; }
.emz-dot--yellow { background: #eab308; }
.emz-dot--orange { background: #f97316; }
.emz-dot--red    { background: #ef4444; }

.emz-score {
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 12px;
    white-space: nowrap;
}
.emz-score:hover {
    text-decoration: underline;
}

.btn-emz-run {
    padding: 1px 6px;
    margin: 0 4px;
    color: #a855f7;
    background: none;
    border: 1px solid #a855f7;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
}
.btn-emz-run:hover {
    background: #a855f7;
    color: #fff;
}
.btn-emz-run:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* EMZ Detail Modal */
.domain-detail__card {
    background: var(--bg-card);
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    color: var(--text-color);
    animation: slideUp 0.2s ease;
}
.domain-detail__card .emz-section__title,
.domain-detail__card .emz-comp__header span,
.domain-detail__card .emz-header__number,
.domain-detail__card .emz-signal__value {
    color: var(--text-color);
}
.domain-detail__card .emz-comp__points,
.domain-detail__card .emz-header__max {
    color: var(--text-muted);
}
.domain-detail__card .domain-detail__close {
    background: var(--surface-2);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    width: 36px;
    height: 36px;
    font-size: 18px;
    font-weight: 700;
}
.domain-detail__card .domain-detail__close:hover {
    background: var(--error);
    color: #fff;
    border-color: var(--error);
}
.domain-detail__card .domain-detail__subtitle {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 4px;
}
.emz-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}
.emz-header__score {
    display: flex;
    align-items: center;
    gap: 6px;
}
.emz-header__number {
    font-size: 36px;
    font-weight: 700;
    font-family: var(--font-mono);
}
.emz-header__max {
    font-size: 36px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}
.emz-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.emz-badge--green  { background: rgba(34,197,94,0.15); color: #22c55e; }
.emz-badge--yellow { background: rgba(234,179,8,0.15); color: #eab308; }
.emz-badge--orange { background: rgba(249,115,22,0.15); color: #f97316; }
.emz-badge--red    { background: rgba(239,68,68,0.15); color: #ef4444; }
.emz-badge--action { background: var(--surface-2); color: var(--text-color); }
.emz-badge--cap { background: var(--warning); color: #000; font-weight: 700; }
.emz-badge--penalty { background: var(--danger); color: #fff; font-weight: 700; }
.emz-badge--mirror { background: var(--success); color: #fff; font-weight: 700; }
.emz-badge--irrelevant { background: #8b5cf6; color: #fff; font-weight: 700; }

.emz-section {
    margin-bottom: 20px;
}
.emz-section__title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 10px;
    color: var(--text-color);
}

/* EMZ Components */
.emz-comp {
    margin-bottom: 10px;
}
.emz-comp__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    margin-bottom: 4px;
}
.emz-comp__points {
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 700;
    color: var(--text-color);
}
.emz-comp__bar {
    height: 6px;
    background: var(--surface-2);
    border-radius: 3px;
    overflow: hidden;
}
.emz-comp__fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}
.emz-comp__fill--green { background: #22c55e; }
.emz-comp__fill--yellow { background: #eab308; }
.emz-comp__fill--red { background: #ef4444; }
.emz-comp__hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 3px;
    line-height: 1.3;
}

/* EMZ Signals Grid */
.emz-signals {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}
.emz-signal {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    padding: 6px 10px;
    background: var(--surface-2);
    border-radius: var(--radius);
    font-size: 12px;
}
.emz-signal__label {
    color: var(--text-color);
    font-weight: 700;
}
.emz-signal__value {
    font-weight: 600;
    font-family: var(--font-mono);
}
.emz-signal__value.emz-sv--green { color: #22c55e !important; }
.emz-signal__value.emz-sv--yellow { color: #eab308 !important; }
.emz-signal__value.emz-sv--red { color: #ef4444 !important; }
.emz-signal__hint {
    width: 100%;
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 2px;
    line-height: 1.3;
}

/* EMZ Recommendation */
.emz-recommendation {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
    padding: 12px;
    background: var(--surface-2);
    border-radius: var(--radius);
}

/* EMZ Research Toggle */
.research-toggle {
    display: flex;
    gap: 2px;
    background: var(--surface-hover);
    border-radius: var(--radius);
    padding: 2px;
    flex-shrink: 0;
}
.research-toggle__btn {
    padding: 4px 12px;
    font-size: var(--font-size-sm);
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: calc(var(--radius) - 2px);
    transition: all 0.15s;
    white-space: nowrap;
}
.research-toggle__btn:hover { color: var(--text-color); }
.research-toggle__btn--active {
    background: var(--bg-card);
    color: var(--text-color);
    box-shadow: 0 1px 3px rgba(0,0,0,.1);
}

/* EMZ Research comment input */
.research-comment {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--text-color);
    font-size: var(--font-size-sm);
    padding: 2px 4px;
    border-radius: 3px;
}
.research-comment:focus {
    outline: none;
    background: var(--surface-hover);
    box-shadow: 0 0 0 1px var(--accent);
}

/* EMZ color classes for table cells */
.emz-sv--green { color: #22c55e; }
.emz-sv--yellow { color: #eab308; }
.emz-sv--red { color: #ef4444; }

/* ============================================
   App Toast Notifications
   ============================================ */
.app-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    min-width: 250px;
    max-width: 450px;
    padding: 10px 36px 10px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    line-height: 1.4;
    color: #fff;
    z-index: 10000;
    animation: toast-in 0.25s ease-out;
    box-shadow: 0 4px 12px rgba(0,0,0,.3);
    word-break: break-word;
}
.app-toast--success { background: var(--success); }
.app-toast--error { background: var(--danger); }
.app-toast--warning { background: #d97706; }
.app-toast--info { background: var(--accent); }
.app-toast__close {
    position: absolute;
    top: 6px;
    right: 8px;
    background: none;
    border: none;
    color: rgba(255,255,255,.7);
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
}
.app-toast__close:hover { color: #fff; }
@keyframes toast-in {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ============================================
   Keyword Pager (Modal Pagination)
   ============================================ */
.kw-pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 4px 4px;
    font-size: 12px;
    color: var(--text-muted);
}
.kw-pager__info { font-family: var(--font-mono); }
.kw-pager__nav { display: flex; align-items: center; gap: 6px; }
.kw-pager__current { font-family: var(--font-mono); }
.kw-pager__btn {
    padding: 2px 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-color);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
}
.kw-pager__btn:hover { background: var(--surface-hover); }
.kw-pager__btn:disabled { opacity: 0.3; cursor: default; }

/* --- Export View (Smart Export) --- */
.export-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
}
.export-tabs__btn {
    padding: 8px 20px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    border-radius: var(--radius) var(--radius) 0 0;
    cursor: pointer;
    font-size: var(--font-size-sm);
    font-weight: 500;
    transition: all .15s;
}
.export-tabs__btn:hover {
    background: var(--surface-hover);
    color: var(--text-color);
}
.export-tabs__btn--active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.export-filters {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}
.export-filters__field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.export-filters__field--wide {
    grid-column: span 2;
}
.export-filters__field label {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    font-weight: 500;
}
.export-filters__field select,
.export-filters__field input {
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--surface-2);
    color: var(--text-color);
    font-size: var(--font-size-sm);
    font-family: inherit;
}
.export-filters__field select:focus,
.export-filters__field input:focus {
    outline: none;
    border-color: var(--accent);
}
.export-filters__field select[multiple] {
    min-height: 80px;
}
.export-filters__hint {
    font-size: 10px;
    color: var(--text-muted);
}

/* Domain picker dropdown */
.export-dom-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    z-index: 100;
}
.export-dom-dropdown__item {
    padding: 4px 8px;
    font-size: var(--font-size-sm);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.export-dom-dropdown__item:hover {
    background: var(--surface-hover);
}
.export-dom-dropdown__item--selected {
    background: rgba(59,130,246,0.15);
    color: var(--accent);
    font-weight: 500;
}

/* Domain tags */
.export-dom-tag {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 1px 6px;
    background: var(--surface-2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 11px;
    color: var(--text-color);
}
.export-dom-tag button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
    padding: 0 2px;
    line-height: 1;
}
.export-dom-tag button:hover {
    color: var(--error);
}

/* ===== Research Keyword Popup ===== */
.rkp-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.rkp-left {
    border-right: 1px solid var(--border-color);
    padding-right: 20px;
}
.rkp-right {
    min-width: 0;
}
.rkp-info-row {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    border-bottom: 1px solid rgba(128,128,128,0.1);
}
.rkp-info-label {
    color: var(--text-muted);
}
.rkp-info-value {
    font-weight: 500;
}
.research-copy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 12px;
    padding: 1px 4px;
    color: var(--text-muted);
    line-height: 1;
    vertical-align: middle;
}
.research-copy-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
}

/* ===== OpsLauncher Modal ===== */
.ops-launcher__tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 16px;
}
.ops-launcher__tab {
    padding: 8px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: var(--font-size-sm);
    font-weight: 600;
}
.ops-launcher__tab--active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}
.ops-launcher__tab:hover {
    color: var(--text-primary);
}
.ops-launcher__section {
    margin-bottom: 16px;
}
.ops-launcher__label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.ops-launcher__picker {
    position: relative;
}
.ops-launcher__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 4px;
}
.ops-launcher__tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: var(--surface-hover);
    border-radius: var(--radius);
    font-size: 11px;
    color: var(--accent);
}
.ops-launcher__tag button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 10px;
    padding: 0 2px;
    line-height: 1;
}
.ops-launcher__tag button:hover {
    color: var(--error);
}
.ops-launcher__search {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 12px;
}
.ops-launcher__search:focus {
    border-color: var(--accent);
    outline: none;
}
.ops-launcher__dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 100;
}
.ops-launcher__dd-item {
    padding: 6px 10px;
    cursor: pointer;
    font-size: 12px;
}
.ops-launcher__dd-item:hover {
    background: var(--surface-hover);
}
.ops-launcher__dd-item--active {
    background: rgba(59,130,246,0.1);
    color: var(--accent);
}
.ops-launcher__select {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 12px;
}
.ops-launcher__summary {
    padding: 10px 14px;
    background: var(--surface-hover);
    border-radius: var(--radius);
    font-size: 13px;
    margin: 12px 0;
}
.ops-launcher__actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.btn--run {
    padding: 8px 18px;
    font-weight: 600;
}
.btn--accent {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
}
.btn--accent:hover {
    opacity: 0.9;
}
.ops-launcher__filter-hints {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 5px;
    align-items: center;
}
.ops-launcher__hint-tag {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    background: #e8edf2;
    color: #3a4a5c;
    cursor: pointer;
    border: 1px solid #c5cdd6;
    transition: all .15s;
    user-select: none;
    font-weight: 500;
}
.ops-launcher__hint-tag:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.ops-launcher__hint-sep {
    font-size: 12px;
    color: #a0a8b4;
    margin: 0 3px;
    font-weight: 300;
}
.ops-launcher__hint-ops {
    font-size: 10px;
    color: #7a8594;
    font-family: monospace;
    cursor: help;
    background: #f5f6f8;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px dashed #c5cdd6;
}
.ops-launcher__descriptions {
    margin-top: 10px;
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.5;
    border-top: 1px solid var(--border);
    padding-top: 8px;
}
.ops-launcher__descriptions div { margin-bottom: 2px; }
.ops-launcher__descriptions b { color: var(--text-secondary); }
