.annotate-admin {
    --annotate-surface: #ffffff;
    --annotate-surface-subtle: #f8fafc;
    --annotate-surface-elevated: #f1f5f9;
    --annotate-border: #e2e8f0;
    --annotate-border-strong: #cbd5e1;
    --annotate-primary: #4f46e5;
    --annotate-primary-light: #6366f1;
    --annotate-primary-dark: #3730a3;
    --annotate-accent: #8b5cf6;
    --annotate-text: #0f172a;
    --annotate-text-secondary: #475569;
    --annotate-text-muted: #94a3b8;
    --annotate-danger: #ef4444;
    --annotate-danger-dark: #dc2626;
    --annotate-success: #10b981;
    --annotate-radius-sm: 8px;
    --annotate-radius-md: 12px;
    --annotate-radius-lg: 16px;
    --annotate-radius-xl: 20px;
    --annotate-shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --annotate-shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --annotate-shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --annotate-shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
    --annotate-transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.annotate-admin h1 {
    color: var(--annotate-text);
    font-weight: 700;
    font-size: 28px;
    letter-spacing: -0.02em;
}

.annotate-has-tabs .annotate-nav-tab-wrapper {
    margin-top: 24px;
    display: inline-flex;
    gap: 8px;
    padding-left: 0;
    align-items: flex-end;
    /* give the tab row a subtle bottom border to anchor tabs visually */
    border-bottom: 1px solid var(--annotate-border);
}

.annotate-has-tabs .annotate-nav-tab-wrapper .nav-tab {
    background: transparent;
    color: var(--annotate-text-secondary);
    border: 1px solid transparent;
    padding: 8px 16px;
    font-weight: 600;
    border-radius: 8px 8px 0 0;
    text-decoration: none;
    margin-bottom: -1px; /* pull tab over panel border so it appears connected */
    transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.annotate-has-tabs .annotate-nav-tab-wrapper .nav-tab:hover {
    color: var(--annotate-primary);
    border-color: rgba(79,70,229,0.12);
    background: rgba(79,70,229,0.02);
}

.annotate-has-tabs .annotate-nav-tab-wrapper .nav-tab.nav-tab-active {
    background: var(--annotate-surface);
    color: var(--annotate-text);
    border-color: var(--annotate-border);
    box-shadow: none;
}

.annotate-has-tabs .annotate-tab-panel {
    margin-top: 0.5rem;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
}

body.wp-admin.dans-tools_page_annotate-settings,
body.wp-admin.settings_page_annotate-settings {
    background: #ffffff;
}

.annotate-admin .annotate-admin-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    margin-top: 24px;
    max-width: 800px;
}

@media (min-width: 900px) {
    .annotate-admin .annotate-admin-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.annotate-admin .annotate-card {
    background: var(--annotate-surface);
    border: 1px solid var(--annotate-border);
    border-radius: var(--annotate-radius-xl);
    padding: 28px;
    color: var(--annotate-text);
    box-shadow: var(--annotate-shadow-md);
    transition: box-shadow var(--annotate-transition), transform var(--annotate-transition);
    position: relative;
    overflow: hidden;
}

.annotate-admin .annotate-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--annotate-primary), var(--annotate-accent));
    opacity: 0;
    transition: opacity var(--annotate-transition);
}

.annotate-admin .annotate-card:hover::before {
    opacity: 1;
}

.annotate-admin .annotate-card-danger {
    border-color: rgba(239, 68, 68, 0.3);
}

.annotate-admin .annotate-card-danger::before {
    background: linear-gradient(90deg, var(--annotate-danger), #f97316);
}

.annotate-admin .annotate-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 8px;
}

.annotate-admin .annotate-eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 10px;
    color: var(--annotate-primary);
    margin-bottom: 4px;
    font-weight: 700;
}

.annotate-admin .annotate-card h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--annotate-text);
}

.annotate-admin .annotate-lead {
    color: var(--annotate-text-secondary);
    font-size: 14px;
    margin-top: 8px;
    margin-bottom: 20px;
    line-height: 1.6;
}

.annotate-admin .annotate-chip {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.1), rgba(139, 92, 246, 0.1));
    color: var(--annotate-primary-dark);
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid rgba(79, 70, 229, 0.2);
    white-space: nowrap;
}

.annotate-admin .annotate-chip-danger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(249, 115, 22, 0.1));
    border-color: rgba(239, 68, 68, 0.25);
    color: var(--annotate-danger-dark);
}

.annotate-admin .annotate-settings-form {
    margin-top: 16px;
}

.annotate-admin .button,
.annotate-admin .button-primary,
.annotate-admin .button-secondary {
    border-radius: var(--annotate-radius-sm);
    font-weight: 600;
    padding: 8px 14px;
    line-height: 1.2;
    box-shadow: none;
}

.annotate-admin .button-primary {
    background: var(--annotate-primary);
    border-color: var(--annotate-primary);
    color: #fff;
}

.annotate-admin .button-primary:hover {
    background: var(--annotate-primary-dark);
    border-color: var(--annotate-primary-dark);
}

.annotate-admin input[type="text"],
.annotate-admin input[type="email"],
.annotate-admin input[type="search"] {
    border-radius: var(--annotate-radius-sm);
    border: 1px solid var(--annotate-border);
    padding: 10px 12px;
    transition: border-color var(--annotate-transition), box-shadow var(--annotate-transition);
}

.annotate-admin input[type="text"]:focus,
.annotate-admin input[type="email"]:focus,
.annotate-admin input[type="search"]:focus {
    outline: none;
    border-color: var(--annotate-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.annotate-admin .annotate-field {
    margin-bottom: 28px;
}

.annotate-admin .annotate-switch {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    color: var(--annotate-text);
    font-weight: 600;
}

.annotate-admin .annotate-switch input {
    display: none;
}

.annotate-admin .annotate-slider {
    width: 56px;
    height: 32px;
    background: var(--annotate-surface-elevated);
    border-radius: 999px;
    position: relative;
    transition: all var(--annotate-transition);
    border: 2px solid var(--annotate-border);
    flex-shrink: 0;
}

.annotate-admin .annotate-slider::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 4px;
    width: 22px;
    height: 22px;
    background: var(--annotate-surface);
    border-radius: 50%;
    transform: translateY(-50%);
    transition: all var(--annotate-transition);
    box-shadow: var(--annotate-shadow-md);
}

.annotate-admin .annotate-switch input:checked + .annotate-slider {
    background: linear-gradient(135deg, var(--annotate-primary), var(--annotate-accent));
    border-color: var(--annotate-primary);
}

.annotate-admin .annotate-switch input:checked + .annotate-slider::after {
    left: calc(100% - 26px);
}

.annotate-switch-compact .annotate-slider {
    height: 28px;
    width: 50px;
}

.annotate-switch-compact .annotate-slider::after {
    width: 18px;
    height: 18px;
    left: 3px;
}

.annotate-switch-compact input:checked + .annotate-slider::after {
    left: calc(100% - 22px);
}

.annotate-admin .annotate-switch-label {
    font-size: 15px;
    line-height: 1.4;
}

.annotate-admin .annotate-help {
    color: var(--annotate-text-secondary);
    margin: 10px 0 0 70px;
    font-size: 13px;
    line-height: 1.5;
}

.annotate-admin .annotate-card-divider {
    border: 0;
    border-bottom: 1px solid var(--annotate-border);
    margin: 24px 0 20px;
}

.annotate-admin .annotate-date-field label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.annotate-admin .annotate-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--annotate-primary-light), var(--annotate-accent));
    display: inline-block;
    animation: annotate-dot-pulse 2s ease-in-out infinite;
}

@keyframes annotate-dot-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(0.9); }
}

.annotate-admin .annotate-range-field {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.annotate-admin .annotate-range-field label {
    font-weight: 600;
    font-size: 14px;
    color: var(--annotate-text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.annotate-admin .annotate-range-control {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 16px;
}

.annotate-admin .annotate-range-control input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: var(--annotate-surface-elevated);
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.annotate-admin .annotate-range-control input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--annotate-primary), var(--annotate-accent));
    cursor: pointer;
    box-shadow: var(--annotate-shadow-md);
    transition: transform var(--annotate-transition);
}

.annotate-admin .annotate-range-control input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.annotate-admin .annotate-range-control input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--annotate-primary), var(--annotate-accent));
    cursor: pointer;
    border: none;
    box-shadow: var(--annotate-shadow-md);
}

.annotate-admin .annotate-range-value {
    min-width: 90px;
    padding: 12px 14px;
    border-radius: var(--annotate-radius-md);
    border: 1px solid var(--annotate-border);
    background: var(--annotate-surface);
    color: var(--annotate-text);
    text-align: right;
    font-weight: 700;
    font-size: 16px;
    box-shadow: var(--annotate-shadow-sm);
}

.annotate-admin .annotate-range-units {
    color: var(--annotate-text-muted);
    font-weight: 500;
    font-size: 13px;
    margin-left: 4px;
}

.annotate-admin .annotate-range-field.is-disabled {
    opacity: 0.5;
    pointer-events: none;
}

.annotate-admin .annotate-range-field.is-disabled .annotate-range-control input[type="range"] {
    cursor: not-allowed;
}

.annotate-admin .annotate-card .button.button-primary {
    background: linear-gradient(135deg, var(--annotate-primary), var(--annotate-accent));
    border: none;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
    padding: 12px 20px;
    border-radius: var(--annotate-radius-md);
    text-shadow: none;
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    transition: all var(--annotate-transition);
}

.annotate-admin .annotate-card .button.button-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.45);
}

.annotate-admin .annotate-card .button.button-primary:active {
    transform: translateY(0);
}

.annotate-admin .annotate-card-danger .button.delete {
    background: linear-gradient(135deg, var(--annotate-danger), #f97316);
    border: none;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    padding: 14px 20px;
    border-radius: var(--annotate-radius-md);
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
    transition: all var(--annotate-transition);
}

.annotate-admin .annotate-card-danger .button.delete:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.45);
}

.annotate-admin .annotate-card-danger .button.delete:active {
    transform: translateY(0);
}

.annotate-admin .annotate-card-danger .annotate-lead {
    color: var(--annotate-danger-dark);
}

.annotate-export-actions .button,
.annotate-col-actions .button,
#annotate-threads-list .button,
#annotate-collaborators-list .button {
    border-radius: var(--annotate-radius-sm);
    font-weight: 600;
    padding: 8px 14px;
    font-size: 13px;
    line-height: 1.2;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
    background: var(--annotate-surface-elevated);
    border: 1px solid var(--annotate-border);
    color: var(--annotate-text);
    text-shadow: none;
    transition: transform var(--annotate-transition), box-shadow var(--annotate-transition), background var(--annotate-transition), border-color var(--annotate-transition);
}

.annotate-col-actions .button.button-small,
#annotate-collaborators-list .annotate-col-actions .button.button-small {
    padding: 8px 14px;
    font-size: 13px;
}

.annotate-export-actions .button.button-primary,
.annotate-col-actions .button.button-primary,
#annotate-threads-list .button.button-primary,
#annotate-collaborators-list .button.button-primary {
    background: linear-gradient(135deg, var(--annotate-primary), var(--annotate-accent));
    border: none;
    color: #fff;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}

.annotate-export-actions .button.button-primary:hover,
.annotate-col-actions .button.button-primary:hover,
#annotate-threads-list .button.button-primary:hover,
#annotate-collaborators-list .button.button-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.45);
}

.annotate-export-actions .button:not(.button-primary):not(.button-link-delete):hover,
.annotate-col-actions .button:not(.button-primary):not(.button-link-delete):hover,
#annotate-threads-list .button:not(.button-primary):not(.button-link-delete):hover,
#annotate-collaborators-list .button:not(.button-primary):not(.button-link-delete):hover {
    background: #fff;
    border-color: var(--annotate-primary);
    color: var(--annotate-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.12);
}

.annotate-export-actions .button.button-link-delete,
.annotate-col-actions .button.button-link-delete,
#annotate-threads-list .button.button-link-delete,
#annotate-collaborators-list .button.button-link-delete {
    background: linear-gradient(135deg, var(--annotate-danger), #f97316);
    border: none;
    color: #fff;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
    text-shadow: none;
}

.annotate-export-actions .button.button-link-delete:hover,
.annotate-col-actions .button.button-link-delete:hover,
#annotate-threads-list .button.button-link-delete:hover,
#annotate-collaborators-list .button.button-link-delete:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.5);
}

.annotate-admin .annotate-notice {
    margin-top: 16px;
}

/* Responsive adjustments */
@media (max-width: 782px) {
    .annotate-admin .annotate-help {
        margin-left: 0;
        margin-top: 12px;
    }

    .annotate-admin .annotate-switch {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .annotate-admin .annotate-card {
        padding: 20px;
    }

    .annotate-admin .annotate-range-control {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .annotate-admin .annotate-range-value {
        width: 100%;
        text-align: center;
    }
}

/* All Threads Page Styles */
.annotate-all-threads .annotate-threads-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: space-between;
    align-items: center;
    margin: 24px 0;
    padding: 16px 20px;
    background: var(--annotate-surface);
    border: 1px solid var(--annotate-border);
    border-radius: var(--annotate-radius-md);
    box-shadow: var(--annotate-shadow-sm);
}

.annotate-all-threads .annotate-search-box {
    flex: 1;
    min-width: 200px;
    max-width: 400px;
}

.annotate-all-threads .annotate-search-box input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--annotate-border);
    border-radius: var(--annotate-radius-sm);
    font-size: 14px;
    transition: border-color var(--annotate-transition), box-shadow var(--annotate-transition);
}

.annotate-all-threads .annotate-search-box input:focus {
    outline: none;
    border-color: var(--annotate-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.annotate-all-threads .annotate-export-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.annotate-all-threads .annotate-threads-table-wrap {
    overflow-x: auto;
    background: var(--annotate-surface);
    border: 1px solid var(--annotate-border);
    border-radius: var(--annotate-radius-md);
    box-shadow: var(--annotate-shadow-md);
}

.annotate-all-threads .annotate-threads-table {
    border: none;
    border-radius: var(--annotate-radius-md);
    overflow: hidden;
}

.annotate-all-threads .annotate-threads-table thead th {
    background: var(--annotate-surface-elevated);
    border-bottom: 1px solid var(--annotate-border);
    padding: 14px 12px;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--annotate-text-secondary);
}

.annotate-all-threads .annotate-threads-table tbody td {
    padding: 14px 12px;
    vertical-align: middle;
    border-bottom: 1px solid var(--annotate-border);
}

.annotate-all-threads .annotate-threads-table tbody tr:last-child td {
    border-bottom: none;
}

.annotate-all-threads .annotate-threads-table tbody tr:hover {
    background: var(--annotate-surface-subtle);
}

.annotate-all-threads .annotate-col-check {
    width: 40px;
    text-align: center;
}

.annotate-all-threads .annotate-col-id {
    width: 60px;
    font-weight: 600;
    color: var(--annotate-text-muted);
}

.annotate-all-threads .annotate-col-page a {
    color: var(--annotate-primary);
    text-decoration: none;
    font-weight: 500;
}

.annotate-all-threads .annotate-col-page a:hover {
    text-decoration: underline;
}

.annotate-all-threads .annotate-selector-preview {
    display: block;
    font-size: 11px;
    color: var(--annotate-text-muted);
    margin-top: 4px;
    font-family: monospace;
}

.annotate-all-threads .annotate-status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.annotate-all-threads .annotate-status-open {
    background: rgba(16, 185, 129, 0.1);
    color: var(--annotate-success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.annotate-all-threads .annotate-status-closed {
    background: rgba(148, 163, 184, 0.1);
    color: var(--annotate-text-muted);
    border: 1px solid var(--annotate-border);
}

.annotate-all-threads .annotate-col-comments {
    text-align: center;
    font-weight: 600;
}

.annotate-all-threads .annotate-col-participants {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    color: var(--annotate-text-secondary);
}

.annotate-all-threads .annotate-col-activity {
    white-space: nowrap;
    font-size: 13px;
    color: var(--annotate-text-secondary);
}

.annotate-all-threads .annotate-col-actions {
    text-align: center;
}

.annotate-all-threads .annotate-col-actions .button {
    padding: 4px 12px;
    font-size: 12px;
}

.annotate-tab-panel-collaborators .annotate-threads-table-wrap {
    overflow-x: auto;
    background: var(--annotate-surface);
    border: 1px solid var(--annotate-border);
    border-radius: var(--annotate-radius-md);
    box-shadow: var(--annotate-shadow-md);
}

.annotate-tab-panel-collaborators .annotate-threads-table {
    border: none;
    border-radius: var(--annotate-radius-md);
    overflow: hidden;
}

.annotate-tab-panel-collaborators .annotate-threads-table thead th {
    background: var(--annotate-surface-elevated);
    border-bottom: 1px solid var(--annotate-border);
    padding: 12px 10px;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--annotate-text-secondary);
}

.annotate-tab-panel-collaborators .annotate-threads-table tbody td {
    padding: 12px 10px;
    vertical-align: middle;
    border-bottom: 1px solid var(--annotate-border);
}

.annotate-tab-panel-collaborators .annotate-threads-table tbody tr:last-child td {
    border-bottom: none;
}

.annotate-tab-panel-collaborators .annotate-status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.annotate-tab-panel-collaborators .annotate-status-open {
    background: rgba(16, 185, 129, 0.1);
    color: var(--annotate-success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.annotate-tab-panel-collaborators .annotate-status-closed {
    background: rgba(148, 163, 184, 0.1);
    color: var(--annotate-text-muted);
    border: 1px solid var(--annotate-border);
}

.annotate-tab-panel-collaborators .annotate-col-actions {
    white-space: nowrap;
}

.annotate-inline-form {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 6px;
    vertical-align: middle;
}

.annotate-inline-form .button {
    padding: 6px 12px;
    font-size: 12px;
    line-height: 1.3;
}

.annotate-switch-compact {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
}

.annotate-tab-panel-collaborators .annotate-search-box {
    max-width: 360px;
}

.annotate-tab-panel-collaborators .annotate-threads-toolbar {
    justify-content: flex-start;
    gap: 14px;
    flex-wrap: wrap;
}

.annotate-toolbar-note {
    color: var(--annotate-text);
    font-size: 13px;
    max-width: 320px;
    line-height: 1.4;
    font-weight: 600;
    letter-spacing: 0.01em;
    margin: 0;
}

@media (max-width: 900px) {
    .annotate-all-threads .annotate-threads-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .annotate-all-threads .annotate-search-box {
        max-width: none;
    }

    .annotate-all-threads .annotate-export-actions {
        justify-content: flex-start;
    }
}
