/* ========== Reset & Base ========== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #f5f5f7;
    --surface: #ffffff;
    --text: #1d1d1f;
    --text-secondary: #86868b;
    --text-tertiary: #aeaeb2;
    --border: #e5e5ea;
    --border-light: #f2f2f7;
    --accent: #0071e3;
    --accent-hover: #0077ed;
    --accent-light: #e8f2ff;
    --green: #34c759;
    --green-bg: #eafbf0;
    --orange: #ff9500;
    --orange-bg: #fff8ec;
    --red: #ff3b30;
    --red-bg: #ffeeed;
    --yellow: #ffcc00;
    --yellow-bg: #fffbea;
    --gray: #8e8e93;
    --gray-bg: #f2f2f7;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.08);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --transition: 0.2s ease;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--accent-hover);
}

/* ========== Sidebar Navigation ========== */
.sidebar {
    width: 180px;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    background: var(--bg);
    border-right: 0.5px solid var(--border);
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    z-index: 50;
}

.sidebar-brand {
    display: block;
    padding: 0 16px 20px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
}
.sidebar-brand:hover { color: var(--text); }

.sidebar-section-label {
    padding: 4px 16px;
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 2px;
}

.sidebar-item {
    display: block;
    padding: 7px 16px;
    margin: 1px 8px;
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.1s ease;
}
.sidebar-item:hover { background: rgba(0,0,0,0.03); color: var(--text-secondary); }
.sidebar-item.active { background: var(--surface); color: var(--text); font-weight: 500; }

/* Workflow flow line */
.sidebar-flow {
    position: relative;
    padding-left: 32px;
    margin: 8px 0 0;
}
.sidebar-flow-line {
    position: absolute;
    left: 23px;
    top: 14px;
    bottom: 14px;
    width: 1.5px;
    background: var(--border);
}
.sidebar-flow-item {
    display: flex;
    align-items: center;
    padding: 6px 12px 6px 0;
    font-size: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    cursor: pointer;
    border-radius: 6px;
    margin-right: 8px;
    position: relative;
}
.sidebar-flow-item:hover { background: rgba(0,0,0,0.03); }
.sidebar-flow-item.active { color: var(--text); font-weight: 500; }
.sidebar-flow-dot {
    position: absolute;
    left: -13px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--border);
    border: 1.5px solid var(--bg);
    flex-shrink: 0;
}
.sidebar-flow-item.active .sidebar-flow-dot {
    background: var(--text);
}

.sidebar-layout-toggle {
    width: 32px; height: 32px; border-radius: 6px; display: flex; align-items: center;
    justify-content: center; cursor: pointer; border: 0.5px solid var(--border);
    background: rgba(55,138,221,0.08); color: #185FA5; margin: 0 auto 8px;
}
.sidebar-layout-toggle:hover { background: rgba(55,138,221,0.14); }

.sidebar-divider { height: 0.5px; background: var(--border); margin: 0 16px 8px; }

.sidebar-scrape-btn {
    display: block;
    width: 100%;
    padding: 8px 0;
    border-radius: 8px;
    background: var(--text);
    color: var(--surface);
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    border: none;
    font-family: inherit;
}
.sidebar-scrape-btn:hover { opacity: 0.85; }

.nav-badge {
    font-size: 10px;
    font-weight: 700;
    background: var(--red);
    color: #fff;
    padding: 1px 5px;
    border-radius: 99px;
    margin-left: 4px;
}

/* Content area */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.content-area { min-height: 100vh; padding: 24px 32px; animation: fadeIn 0.15s ease; background: var(--surface); }
.content-area-sidebar { margin-left: 180px; }
.content-area-topbar { margin-left: 0; margin-top: 48px; max-width: 1200px; margin-left: auto; margin-right: auto; }

/* ========== Top Bar Nav ========== */
.topbar {
    position: fixed; top: 0; left: 0; right: 0; height: 48px; z-index: 50;
    display: flex; align-items: center; padding: 0 20px; gap: 2px;
    background: var(--surface); border-bottom: 0.5px solid var(--border);
}
.topbar-brand {
    font-size: 14px; font-weight: 500; color: var(--text); margin-right: 24px;
    text-decoration: none; cursor: pointer;
}
.topbar-brand:hover { color: var(--text); }
.topbar-item {
    padding: 6px 12px; font-size: 13px; color: var(--text-secondary); border-radius: 6px;
    cursor: pointer; text-decoration: none; white-space: nowrap; border: none; background: transparent;
    font-family: inherit; display: inline-flex; align-items: center;
}
.topbar-item:hover { background: rgba(0,0,0,0.03); }
.topbar-item.active { background: var(--bg); color: var(--text); font-weight: 500; }
.topbar-trigger { position: relative; }

.topbar-dropdown { position: relative; }
.topbar-dropdown-menu {
    display: none; position: absolute; top: 38px; left: 0;
    background: var(--surface); border: 0.5px solid var(--border); border-radius: 8px;
    padding: 4px 0; min-width: 140px; z-index: 100; box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.topbar-dropdown-menu.open { display: block; }
.topbar-dd-item {
    display: block; padding: 8px 14px; font-size: 12px; color: var(--text);
    cursor: pointer; text-decoration: none;
}
.topbar-dd-item:hover { background: var(--bg); }
.topbar-dd-item.active { font-weight: 500; }

.topbar-icon-btn {
    width: 32px; height: 32px; border-radius: 6px; display: flex; align-items: center;
    justify-content: center; cursor: pointer; border: 0.5px solid var(--border);
    background: rgba(55,138,221,0.08); color: #185FA5;
}
.topbar-icon-btn:hover { background: rgba(55,138,221,0.14); }

.topbar-scrape-btn {
    padding: 6px 14px; font-size: 12px; font-weight: 500; background: var(--text);
    color: var(--surface); border-radius: 6px; border: none; cursor: pointer; font-family: inherit;
}
.topbar-scrape-btn:hover { opacity: 0.85; }

/* Nav scrape button (used elsewhere too) */
.nav-scrape-btn {
    padding: 0.35rem 0.9rem;
    font-size: 12px;
    font-weight: 600;
    border-radius: 99px;
    gap: 0.35rem;
}
.nav-scrape-btn:disabled { opacity: 0.7; cursor: pointer; }

/* Scrape dropdown */
.scrape-dropdown { position: relative; }

.scrape-menu {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    width: 300px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg), 0 0 0 1px var(--border-light);
    z-index: 200;
    overflow: hidden;
}

.scrape-menu.open {
    display: block;
}

.scrape-menu-section-label {
    padding: 0.5rem 0.85rem 0.2rem;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
}

.scrape-menu-sources {
    padding: 0.2rem 0.4rem 0.4rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-bottom: 1px solid var(--border-light);
}

.scrape-menu-sources label {
    display: flex;
    align-items: center;
    padding: 0.25rem 0.45rem;
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0;
    cursor: pointer;
    border-radius: var(--radius-xs);
    transition: background var(--transition);
}

.scrape-menu-sources label:hover {
    background: var(--gray-bg);
}

.scrape-menu-location {
    padding: 0.25rem 0.85rem 0.5rem;
    border-bottom: 1px solid var(--border-light);
}

.scrape-menu-location input {
    height: 32px;
    font-size: 12px;
    padding: 0 0.6rem;
}

.scrape-menu-section-label small {
    font-weight: 500;
    text-transform: none;
    letter-spacing: normal;
}

.scrape-menu-header {
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--border-light);
}

.scrape-menu-header label {
    display: flex;
    align-items: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0;
    cursor: pointer;
}

.scrape-menu-list {
    max-height: 260px;
    overflow-y: auto;
    padding: 0.35rem 0;
}

.scrape-menu-list label {
    display: flex;
    align-items: center;
    padding: 0.4rem 0.85rem;
    font-size: 13px;
    font-weight: 400;
    color: var(--text);
    margin-bottom: 0;
    cursor: pointer;
    transition: background var(--transition);
}

.scrape-menu-list label:hover {
    background: var(--gray-bg);
}

.scrape-ind-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-right: 0.5rem;
}

.scrape-ind-row label {
    flex: 1;
}

.ind-edit-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 11px;
    color: var(--text-tertiary);
    padding: 2px 4px;
    opacity: 0;
    transition: opacity 0.15s;
}

.scrape-ind-row:hover .ind-edit-btn {
    opacity: 1;
}

.ind-edit-btn:hover {
    color: var(--accent);
}

.ind-kw-count {
    font-size: 10px;
    color: var(--text-tertiary);
    background: var(--gray-bg);
    padding: 0 4px;
    border-radius: 3px;
    margin-left: 4px;
}

.scrape-menu-add {
    display: flex;
    gap: 0.4rem;
    padding: 0.5rem 0.85rem;
    border-top: 1px solid var(--border-light);
}

.scrape-menu-add input {
    flex: 1;
    height: 32px;
    font-size: 12px;
    padding: 0 0.6rem;
}

.scrape-menu-add button {
    width: 32px;
    height: 32px;
    padding: 0;
    font-size: 16px;
    font-weight: 600;
    border-radius: var(--radius-xs);
    flex-shrink: 0;
}

.scrape-menu-go {
    display: block;
    width: calc(100% - 1.7rem);
    margin: 0.5rem 0.85rem 0.75rem;
    padding: 0.5rem;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    text-align: center;
}

.scrape-menu-list::-webkit-scrollbar {
    width: 4px;
}

.scrape-menu-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

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

.spin {
    animation: spin 0.8s linear infinite;
}

/* ========== Main Content ========== */
/* Legacy main-content class — content-area handles layout now */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
}

h2 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 1.5rem;
    color: var(--text);
}

h4 {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
    color: var(--text);
}

/* ========== Cards ========== */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    padding: 1.5rem;
    transition: box-shadow var(--transition);
}

.card:hover {
    box-shadow: var(--shadow);
}

/* ========== Stat Cards ========== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    padding: 1.25rem 1.5rem;
    transition: all var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.stat-card .stat-value {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.04em;
    color: var(--text);
    line-height: 1.2;
}

.stat-card .stat-label {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.25rem;
}

/* ========== Tables ========== */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    overflow: hidden;
    font-size: 13px;
}

.co-tabs {
    overflow: hidden;
    max-height: 42px;
    opacity: 1;
    transition: max-height 0.25s ease, opacity 0.2s ease, margin-bottom 0.25s ease;
}
.co-tabs.collapsed {
    max-height: 0;
    opacity: 0;
    margin-bottom: 0 !important;
    border-bottom-color: transparent !important;
}
.co-tab {
    font-size: 13px;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
}
.co-tab:hover { color: var(--text); }
.co-tab.active {
    color: var(--text);
    border-bottom-color: var(--accent, #6abf78);
    font-weight: 600;
}

.companies-table {
    min-width: 1100px;
    table-layout: fixed;
    width: 100%;
}
.companies-table td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.companies-table td:first-child,
.companies-table td:nth-last-child(-n+2) {
    overflow: visible;
}

thead {
    background: var(--bg);
}

th {
    padding: 0.65rem 0.7rem;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

td {
    padding: 0.75rem 0.7rem;
    border-bottom: 1px solid var(--border-light);
    color: var(--text);
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

tbody tr {
    transition: background var(--transition);
}

tbody tr:hover {
    background: #fafafa;
}

th.sortable {
    cursor: pointer;
    user-select: none;
    transition: color var(--transition);
}

th.sortable:hover {
    color: var(--accent);
}

/* ========== Buttons ========== */
button, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 1.15rem;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    background: var(--accent);
    color: #fff;
    line-height: 1.4;
}

button:hover {
    background: var(--accent-hover);
    transform: translateY(-0.5px);
    box-shadow: 0 2px 8px rgba(0,113,227,0.3);
}

button:active {
    transform: translateY(0);
}

button.secondary, .btn-secondary {
    background: var(--gray-bg);
    color: var(--text);
}

button.secondary:hover, .btn-secondary:hover {
    background: var(--border);
    box-shadow: none;
}

button.danger {
    background: var(--red);
    color: #fff;
}

button.danger:hover {
    background: #e8342a;
    box-shadow: 0 2px 8px rgba(255,59,48,0.3);
}

button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ========== Inputs ========== */
input[type="text"],
input[type="search"],
input[type="email"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 0.55rem 0.85rem;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: all var(--transition);
    line-height: 1.4;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0,113,227,0.12);
}

input::placeholder {
    color: var(--text-tertiary);
}

label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 1rem;
}

label small {
    font-weight: 400;
    color: var(--text-secondary);
}

label input, label select {
    margin-top: 0.35rem;
}

/* Checkboxes */
input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    border-radius: 4px;
    cursor: pointer;
    vertical-align: middle;
    margin-right: 0.35rem;
}

fieldset {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

legend {
    font-weight: 600;
    font-size: 13px;
    padding: 0 0.5rem;
    color: var(--text);
}

/* ========== Badges ========== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.55rem;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge-pending { background: var(--yellow-bg); color: #946800; }
.badge-running { background: var(--accent-light); color: var(--accent); }
.badge-paused { background: var(--gray-bg); color: var(--gray); }
.badge-completed { background: var(--green-bg); color: #1a8a36; }
.badge-failed { background: var(--red-bg); color: var(--red); }
.badge-cancelled { background: var(--gray-bg); color: var(--gray); }
.badge-source { background: var(--gray-bg); color: var(--text-secondary); }
a .badge-source { cursor: pointer; }
a .badge-source:hover { background: var(--border-light); }
.badge-green { background: var(--green-bg); color: #1a8a36; }
.badge-orange { background: var(--orange-bg); color: #946800; }
.badge-flagged { background: #fff1e6; color: #c2410c; }
.badge-gray { background: var(--gray-bg); color: var(--gray); }

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-xs);
    line-height: 1;
}
.btn-icon:hover { background: var(--red-bg); }

/* Revenue confidence */
.rev-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    margin-right: 5px;
    vertical-align: middle;
}
.rev-high { background: #22c55e; }
.rev-med { background: #f59e0b; }
.rev-low { background: #ef4444; }
.rev-unknown { color: var(--gray); font-size: 0.85em; }

/* ========== Progress Bar ========== */
.progress-bar {
    background: var(--border-light);
    border-radius: 99px;
    height: 8px;
    overflow: hidden;
    position: relative;
    min-width: 100px;
}

.progress-bar .fill {
    background: linear-gradient(90deg, var(--accent), #40a0ff);
    height: 100%;
    border-radius: 99px;
    transition: width 0.4s ease;
}

.progress-bar .label {
    position: absolute;
    right: 0;
    top: -18px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ========== Confidence ========== */
.confidence-high { color: var(--green); font-weight: 600; }
.confidence-medium { color: var(--orange); font-weight: 600; }
.confidence-low { color: var(--red); font-weight: 500; }

/* ========== Filter Bar ========== */
.filter-bar {
    display: flex;
    gap: 0.75rem;
    align-items: end;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.filter-bar > * {
    margin-bottom: 0;
}

.filter-bar input,
.filter-bar select {
    margin-bottom: 0;
    height: 38px;
}

.filter-bar input[type="search"] {
    min-width: 240px;
}

/* ========== Layout Grids ========== */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}


/* ========== Company Logo ========== */
.company-logo {
    vertical-align: middle;
    margin-right: 0.5rem;
    border-radius: 6px;
    object-fit: contain;
    background: var(--bg);
    padding: 1px;
}

.company-name-cell {
    display: inline-flex;
    align-items: center;
    font-weight: 500;
}

/* ========== Log Feed ========== */
.log-feed {
    max-height: 400px;
    overflow-y: auto;
    background: #1d1d1f;
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 12px;
    color: #e5e5ea;
}

.log-entry {
    padding: 0.3rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    line-height: 1.6;
}

.log-entry:last-child {
    border-bottom: none;
}

.log-entry small {
    color: #636366;
}

.log-info { color: #e5e5ea; }
.log-warning { color: var(--orange); }
.log-error { color: var(--red); }

/* ========== Pagination ========== */
.pagination {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    margin-top: 1.25rem;
}
.pagination .page-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
}
.pagination .page-btn {
    min-width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    border: none;
    background: none;
    box-shadow: none;
    transform: none;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 400;
    font-family: inherit;
    line-height: 1;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    padding: 0 4px;
    -webkit-appearance: none;
    appearance: none;
}
.pagination .page-btn.nav-btn {
    min-width: 56px;
}
.pagination .page-btn:hover:not(:disabled):not(.active) {
    background: var(--accent-light);
    color: var(--accent);
}
.pagination .page-btn.active {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    cursor: default;
}
.pagination .page-btn:disabled {
    opacity: 0.35;
    cursor: default;
}
.pagination .page-ellipsis {
    min-width: 32px;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 13px;
    user-select: none;
}
.pagination .page-goto {
    display: flex;
    align-items: center;
    gap: 4px;
}
.pagination .page-goto-input {
    width: 52px;
    height: 28px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    background: var(--bg);
    color: var(--text);
    padding: 0 4px;
}
.pagination .page-goto-input:focus {
    outline: none;
    border-color: var(--accent);
}
.pagination .page-total {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* ========== Section Spacing ========== */
section {
    margin-bottom: 2rem;
}

/* ========== Actions Row ========== */
.actions-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

/* ========== Bar Chart ========== */
.bar-chart {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.bar-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.bar-label {
    min-width: 180px;
    font-size: 13px;
    font-weight: 500;
    text-align: right;
    color: var(--text-secondary);
}

.bar-track {
    flex: 1;
    background: var(--border-light);
    border-radius: 99px;
    height: 8px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #40a0ff);
    border-radius: 99px;
    transition: width 0.4s ease;
    min-width: 2px;
}

.bar-value {
    min-width: 36px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

/* ========== Page Header ========== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.page-header h2 {
    margin-bottom: 0;
}

/* ========== Back Link ========== */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 13px;
    font-weight: 500;
    color: var(--accent);
    margin-bottom: 0.75rem;
}

/* ========== Empty State ========== */
td[colspan] {
    text-align: center;
    color: var(--text-secondary);
    padding: 2.5rem 1rem;
    font-size: 14px;
}

/* ========== Form ========== */
form button[type="submit"] {
    margin-top: 0.5rem;
    padding: 0.65rem 2rem;
    font-size: 14px;
    font-weight: 600;
}

/* ========== Revenue Display ========== */
td strong {
    font-weight: 600;
    color: var(--text);
}

td small {
    color: var(--text-tertiary);
    font-size: 11px;
}

/* ========== Inline Action Buttons ========== */
.btn-delete-co,
.btn-edit-contact {
    background: none;
    color: var(--text-tertiary);
    font-size: 16px;
    line-height: 1;
    padding: 0.15rem 0.35rem;
    border-radius: var(--radius-xs);
    box-shadow: none;
}

.btn-delete-co:hover {
    background: var(--red-bg);
    color: var(--red);
    box-shadow: none;
    transform: none;
}

/* LinkedIn badge */
.crm-linkedin {
    display: inline-block;
    font-size: 9px;
    font-weight: 700;
    background: #0a66c2;
    color: #fff;
    padding: 1px 4px;
    border-radius: 3px;
    text-decoration: none;
    vertical-align: middle;
    line-height: 1.3;
}
.crm-linkedin:hover { background: #004182; color: #fff; }

.btn-add-pipeline {
    background: none;
    color: var(--text-tertiary);
    font-size: 16px;
    font-weight: 600;
    border: none;
    padding: 2px 6px;
    cursor: pointer;
    border-radius: 4px;
}
.btn-add-pipeline:hover {
    background: var(--accent-light);
    color: var(--accent);
}

.btn-hide-co {
    background: none;
    color: var(--text-tertiary);
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 4px;
    border-radius: 4px;
    line-height: 1;
    opacity: 0.4;
}

.btn-hide-co:hover {
    opacity: 1;
    background: var(--gray-bg);
}

.btn-hide-co.hidden-active {
    opacity: 0.7;
    color: var(--text-secondary);
}

.btn-edit-contact:hover {
    background: var(--accent-light);
    color: var(--accent);
    box-shadow: none;
    transform: none;
}

/* ========== Pipeline ========== */
.pipeline {
    display: flex;
    align-items: stretch;
    gap: 0;
    overflow-x: auto;
    padding: 0.25rem 0;
}

.phase-card {
    flex: 1;
    min-width: 140px;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    transition: all var(--transition);
}

.phase-card.phase-done {
    border-color: var(--green);
    background: var(--green-bg);
}

.phase-card.phase-active {
    border-color: var(--accent);
    background: var(--accent-light);
    box-shadow: 0 0 0 2px rgba(0,113,227,0.15);
}

.phase-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.phase-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.phase-duration {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--gray-bg);
    padding: 0.1rem 0.45rem;
    border-radius: 99px;
    white-space: nowrap;
}

.phase-done .phase-duration {
    background: rgba(52,199,89,0.15);
    color: #1a8a36;
}

.phase-active .phase-duration {
    background: rgba(0,113,227,0.12);
    color: var(--accent);
}

.phase-detail {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 0.35rem;
    line-height: 1.4;
}

.phase-check {
    color: var(--green);
    font-weight: 700;
    margin-right: 0.15rem;
}

.phase-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid var(--accent-light);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin-right: 0.25rem;
    flex-shrink: 0;
}

.phase-connector {
    width: 20px;
    min-width: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.phase-connector::after {
    content: "";
    width: 100%;
    height: 2px;
    background: var(--border);
}

.pipeline-empty {
    color: var(--text-tertiary);
    font-size: 13px;
    padding: 1rem;
}

/* ========== Activity Feed ========== */
.activity-feed {
    max-height: 420px;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 0.5rem;
}

.activity-empty {
    color: var(--text-tertiary);
    font-size: 13px;
    padding: 1.5rem;
    text-align: center;
}

.activity-item {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.3rem 0.5rem;
    border-radius: var(--radius-xs);
    font-size: 13px;
    line-height: 1.5;
    transition: background var(--transition);
}

.activity-item:hover {
    background: var(--gray-bg);
}

.activity-icon {
    width: 16px;
    text-align: center;
    font-weight: 700;
    flex-shrink: 0;
    font-size: 12px;
}

.activity-found .activity-icon { color: var(--green); }
.activity-enriched .activity-icon { color: var(--accent); }
.activity-enriching .activity-icon { color: var(--text-tertiary); }
.activity-search .activity-icon { color: var(--orange); }
.activity-done .activity-icon { color: var(--green); }
.activity-warn .activity-icon { color: var(--orange); }
.activity-error .activity-icon { color: var(--red); }

.activity-time {
    font-size: 11px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.activity-msg {
    color: var(--text);
    flex: 1;
    min-width: 0;
}

.activity-msg strong {
    font-weight: 600;
}

.activity-feed::-webkit-scrollbar {
    width: 4px;
}

.activity-feed::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

/* ========== Mini Toggle ========== */
.mini-toggle { position:relative; display:inline-block; width:36px; height:20px; cursor:pointer; }
.mini-toggle input { opacity:0; width:0; height:0; }
.mini-toggle-track { position:absolute; inset:0; border-radius:10px; border:0.5px solid var(--border); background:var(--gray-bg); transition:background 0.2s; }
.mini-toggle-track::after { content:""; position:absolute; width:16px; height:16px; border-radius:50%; background:#fff; top:1.5px; left:1.5px; transition:transform 0.2s; box-shadow:0 1px 2px rgba(0,0,0,0.1); }
.mini-toggle input:checked + .mini-toggle-track { background:var(--accent, #185FA5); border-color:var(--accent, #185FA5); }
.mini-toggle input:checked + .mini-toggle-track::after { transform:translateX(16px); }
.mini-toggle[style*="32px"] .mini-toggle-track::after { width:14px; height:14px; }
.mini-toggle[style*="32px"] input:checked + .mini-toggle-track::after { transform:translateX(14px); }

/* ========== Log Toggle ========== */
.log-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

/* ========== Scrollbar Styling ========== */
.log-feed::-webkit-scrollbar {
    width: 6px;
}

.log-feed::-webkit-scrollbar-track {
    background: transparent;
}

.log-feed::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 3px;
}

/* Clean & Enrich status bar */
.clean-status-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    margin-bottom: 16px;
    background: var(--accent-light);
    border: 1px solid var(--accent);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text);
}

.clean-status-bar #clean-phase {
    font-weight: 600;
    white-space: nowrap;
}

.clean-status-bar #clean-progress {
    color: var(--text-secondary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ========== Email Verification Log ========== */
#verify-log {
    max-height: 500px;
    overflow-y: auto;
}

.verify-log-entry { font-size: 13px; }
.log-ok { color: var(--green); }
.log-err { color: var(--red); }
.log-warn { color: var(--orange); }
.log-muted { color: var(--text-secondary); }
.log-divider { border-bottom: none !important; }

.log-spin {
    display: inline-block;
    animation: spin 0.8s linear infinite;
    color: var(--accent);
}

/* ========== Pipeline View (Companies Page) ========== */
.pip-section {
    margin-bottom: 2px;
}

.pip-sublabel {
    padding: 0.35rem 20px 0.15rem;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
}
.pip-sublabel-followup {
    margin-top: 0.25rem;
    border-top: 1px solid var(--border);
    padding-top: 0.4rem;
}

.pip-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 20px;
    cursor: pointer;
    user-select: none;
    font-size: 11px;
    font-weight: 500;
    border-left: none;
}
.pip-header:hover { filter: brightness(0.97); }

.pip-header-no_action { background: var(--bg-secondary, #f5f5f4); color: var(--text-secondary); border-bottom: 2px solid #B4B2A9; }
.pip-header-replied { background: #E1F5EE; color: #085041; border-bottom: 2px solid #1D9E75; }
.pip-header-overdue { background: #FCEBEB; color: #791F1F; border-bottom: 2px solid #E24B4A; }
.pip-header-contact_today { background: #E6F1FB; color: #0C447C; border-bottom: 2px solid #378ADD; }
.pip-header-tomorrow { background: #FAEEDA; color: #633806; border-bottom: 2px solid #EF9F27; }
.pip-header-day_3 { background: #F5ECD8; color: #5C3D0E; border-bottom: 2px solid #9E6B1D; }
.pip-header-day_4 { background: #EEEDFE; color: #3C3489; border-bottom: 2px solid #7C6BBF; }
.pip-header-rest_of_week { background: #E8F0EB; color: #2D4D3A; border-bottom: 2px solid #5B8A72; }
.pip-header-next_week { background: #F0ECF9; color: #44337A; border-bottom: 2px solid #805AD5; }
.pip-header-later { background: var(--bg-secondary, #f5f5f4); color: var(--text-secondary); border-bottom: 2px solid #B4B2A9; }
.pip-header-paused { background: var(--bg-secondary, #f5f5f4); color: var(--text-secondary); border-bottom: 2px solid #D3D1C7; }

.pip-row-head {
    display: grid;
    grid-template-columns: 1fr 1.2fr 150px 90px;
    align-items: center;
    gap: 12px;
    padding: 6px 20px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-tertiary);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.pip-row-card {
    display: grid;
    grid-template-columns: 1fr 1.2fr 150px 90px;
    align-items: center;
    gap: 12px;
    padding: 9px 20px;
    border-bottom: 0.5px solid var(--border-light, rgba(0,0,0,0.06));
    font-size: 12px;
}
.pip-row-card:nth-child(even) { background: var(--bg-secondary, #fafaf9); }
.pip-row-card:hover { background: #f0efed; }

.pip-row-co { display: flex; align-items: center; gap: 6px; font-weight: 500; flex-wrap: wrap; min-width: 0; }
.pip-row-ov { font-size: 10px; color: #A32D2D; font-weight: 500; }
.pip-row-ct { font-size: 11px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.pip-ooo-tag { font-size: 9px; padding: 1px 5px; border-radius: 3px; background: #FAEEDA; color: #854F0B; font-weight: 500; white-space: nowrap; margin-left: 4px; }
.pip-row-step { font-size: 10px; color: var(--text-tertiary); display: flex; align-items: center; gap: 4px; }
.pip-row-type { font-weight: 500; display: inline-flex; align-items: center; gap: 3px; }
.pip-row-type.email { color: #0C447C; }
.pip-row-type.call { color: #712B13; }
.pip-row-type .pip-auto-icon { width: 10px; height: 10px; flex-shrink: 0; }
.pip-row-step .pip-pips { display: flex; gap: 2px; align-items: center; }
.pip-row-step .pip-pip { width: 4px; height: 4px; border-radius: 50%; background: #D3D1C7; }
.pip-row-step .pip-pip.done { background: #1D9E75; }
.pip-row-step .pip-pip.current { background: #378ADD; }
.pip-row-actions { display: flex; gap: 4px; justify-content: flex-end; }

.pip-pill { font-size: 10px; font-weight: 500; padding: 1px 6px; border-radius: 3px; flex-shrink: 0; white-space: nowrap; display: inline-flex; align-items: center; gap: 3px; }
.pip-pill-email { background: #E6F1FB; color: #0C447C; }
.pip-pill-call { background: #E1F5EE; color: #1a8a36; }
.pip-auto-icon { width: 10px; height: 10px; flex-shrink: 0; }

.pip-row-due { font-size: 12px; color: var(--text-secondary); white-space: nowrap; flex-shrink: 0; }
.pip-overdue { font-size: 11px; color: #A32D2D; font-weight: 500; margin-left: 6px; }
.pip-ooo { font-size: 11px; color: #BA7517; margin-top: 2px; }

.pip-pips { display: flex; gap: 2px; flex-shrink: 0; align-items: center; }
.pip-pip { width: 5px; height: 5px; border-radius: 50%; background: #D3D1C7; }
.pip-pip.done { background: #1D9E75; }
.pip-pip.current { background: #378ADD; }

.pip-btn-primary {
    padding: 2px 8px; border-radius: 4px; font-size: 10px; font-weight: 500;
    background: var(--text); color: var(--surface); border: none; cursor: pointer;
    font-family: inherit; flex-shrink: 0;
}
.pip-btn-primary:hover { opacity: 0.85; }

.pip-btn-resume {
    padding: 5px 12px; border-radius: 6px; font-size: 11px; font-weight: 500;
    border: 0.5px solid rgba(55,138,221,0.3); background: rgba(55,138,221,0.1);
    color: #185FA5; cursor: pointer; font-family: inherit; flex-shrink: 0;
}
.pip-btn-resume:hover { background: rgba(55,138,221,0.18); }

.pip-btn-overflow {
    padding: 3px 10px; border-radius: 4px; font-size: 10px; font-weight: 500; letter-spacing: 1px;
    border: none; background: transparent; color: var(--text);
    box-shadow: inset 0 0 0 1px #999;
    cursor: pointer; font-family: inherit; flex-shrink: 0;
}
.pip-btn-overflow:hover { box-shadow: inset 0 0 0 1px var(--text); }

.pip-overflow-menu {
    position: absolute; right: 0; top: 100%; margin-top: 4px;
    background: var(--surface); border: 0.5px solid var(--border); border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08); padding: 4px 0; min-width: 140px; z-index: 100;
}
.pip-menu-item {
    padding: 8px 14px; font-size: 12px; color: var(--text); cursor: pointer;
}
.pip-menu-item:hover { background: var(--gray-bg); }
.pip-menu-divider { height: 0.5px; background: var(--border); margin: 4px 0; }

/* Keep old .pip-btn for any remaining uses */
.pip-btn {
    padding: 0.2rem 0.5rem; font-size: 11px; border-radius: 4px;
    border: 1px solid var(--border); background: var(--surface);
    color: var(--text-secondary); cursor: pointer; white-space: nowrap;
}
.pip-btn:hover { background: var(--border-light); }

.pip-log-option {
    padding: 5px 12px;
    font-size: 12px;
    cursor: pointer;
    color: var(--text);
}

.pip-log-option:hover {
    background: var(--border-light);
}

.pip-done {
    color: #1a8a36;
    border-color: #1a8a36;
}

.pip-done:hover {
    background: var(--green-bg);
}

.pip-snooze {
    color: #8B6914;
    border-color: #8B6914;
}

.pip-snooze:hover {
    background: rgba(139,105,20,0.1);
}

.pip-pause {
    color: var(--text-secondary);
    border-color: var(--border);
}

.pip-pause:hover {
    background: var(--gray-bg);
}

.pip-start-seq {
    color: var(--accent);
    border-color: var(--accent);
}

.pip-start-seq:hover {
    background: var(--accent-light);
}

/* Pipeline guide */
.pip-guide {
    background: var(--surface);
    border: none;
    border-radius: 0;
    padding: 0;
    margin-bottom: 0;
}

.pip-guide-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.pip-guide-steps {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.pip-guide-step {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.pip-guide-day {
    font-size: 11px;
    color: var(--text-tertiary);
    font-weight: 500;
}

.pip-guide-action {
    font-size: 11px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 3px;
}

.pip-guide-email {
    background: var(--accent-light);
    color: var(--accent);
}

.pip-guide-call {
    background: var(--green-bg);
    color: #1a8a36;
}

.pip-guide-desc {
    font-size: 11px;
    color: var(--text-secondary);
}

.pip-guide-arrow {
    color: var(--text-tertiary);
    font-size: 12px;
}

.pip-guide-edit-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.35rem;
}


/* Group header breakdown */
.pip-header .breakdown { font-weight: 400; font-size: 10px; opacity: 0.7; margin-left: 6px; }

/* Top bar buttons */
.pip-top-btn { font-family: inherit; font-size: 10px; padding: 3px 8px; border: 0.5px solid var(--border); border-radius: 4px; background: var(--surface); color: var(--text-secondary); cursor: pointer; }
.pip-top-btn:hover { background: var(--bg-secondary); }
.pip-top-btn.active { background: var(--text); color: #fff; border-color: var(--text); }
.pip-top-btn.active:hover { background: var(--text); opacity: 0.85; }

/* Info bar (cadence + stats) */
.pip-info-bar { display: flex; align-items: center; padding: 5px 20px; gap: 10px; background: var(--bg-secondary, #fafaf9); border-bottom: 1px solid var(--border); }
.pip-info-cadence { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-secondary); }
.pip-info-meta { color: var(--text-tertiary); font-size: 10px; margin-left: 2px; }
.pip-info-arrow { color: var(--text-tertiary); font-size: 10px; }
.pip-info-stats { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.pip-info-stat { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-secondary); }
.pip-info-stat .num { font-weight: 600; font-size: 13px; }
.pip-info-stat.overdue .num { color: #A32D2D; }
.pip-info-stat.replied .num { color: var(--text-tertiary); }

/* Edit bar */
.pip-edit-bar { border-bottom: 1px solid var(--border); background: var(--bg-secondary); }
.pip-edit-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 20px 0; }
.pip-edit-title { font-size: 11px; font-weight: 500; }
.pip-edit-rename { border: none; border-bottom: 1px solid var(--border); background: transparent; font-family: inherit; font-size: 11px; font-weight: 500; color: var(--text); padding: 0 2px; width: 140px; outline: none; }
.pip-edit-rename:focus { border-color: var(--accent); }
.pip-edit-actions { display: flex; gap: 4px; align-items: center; }
.pip-edit-delete { font-family: inherit; font-size: 10px; font-weight: 500; padding: 3px 10px; border-radius: 4px; background: var(--surface); color: #A32D2D; border: 0.5px solid rgba(163,45,45,0.3); cursor: pointer; }
.pip-edit-cancel { font-family: inherit; font-size: 10px; font-weight: 500; padding: 3px 10px; border-radius: 4px; background: var(--surface); color: var(--text-secondary); border: 0.5px solid var(--border); cursor: pointer; }
.pip-edit-save { font-family: inherit; font-size: 10px; font-weight: 500; padding: 3px 10px; border-radius: 4px; background: var(--text); color: var(--surface); border: none; cursor: pointer; }
.pip-edit-save.disabled { opacity: 0.3; cursor: default; }
.pip-edit-flow { display: flex; align-items: center; flex-wrap: wrap; gap: 0; padding: 4px 20px 8px; }
.pip-edit-pill { font-size: 10px; font-weight: 500; padding: 2px 6px; border-radius: 3px; display: inline-flex; align-items: center; gap: 3px; }
.pip-edit-pill-email { background: var(--accent-light); color: var(--accent); }
.pip-edit-pill-call { background: #E1F5EE; color: #1a8a36; }
.pip-edit-x { font-size: 9px; opacity: 0; cursor: pointer; }
.pip-edit-pill:hover .pip-edit-x { opacity: 0.6; }
.pip-edit-pill:hover .pip-edit-x:hover { opacity: 1; color: #A32D2D; }
.pip-edit-gap { font-size: 9px; color: var(--text-tertiary); display: inline-flex; align-items: center; padding: 0 3px; }
.pip-edit-gap input { width: 14px; font-family: inherit; font-size: 9px; text-align: center; border: none; border-bottom: 1px solid var(--border); background: transparent; color: var(--text); padding: 0; outline: none; }
.pip-edit-gap input:focus { border-color: var(--accent); }
.pip-edit-add { font-family: inherit; font-size: 9px; color: var(--text-tertiary); background: none; border: 1px dashed var(--border); border-radius: 3px; padding: 1px 5px; cursor: pointer; margin-left: 4px; }
.pip-edit-add:hover { border-color: var(--accent); color: var(--accent); }
.pip-edit-total { font-size: 10px; color: var(--text-tertiary); margin-left: 8px; }
.pip-edit-empty { padding: 12px 20px; display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-tertiary); }
.pip-edit-picker { display: inline-flex; gap: 3px; margin-left: 4px; }
.pip-edit-pick-email { font-family: inherit; font-size: 9px; font-weight: 500; padding: 2px 6px; border-radius: 3px; border: none; cursor: pointer; background: var(--accent-light); color: var(--accent); }
.pip-edit-pick-email:hover { background: #d4e8fc; }
.pip-edit-pick-call { font-family: inherit; font-size: 9px; font-weight: 500; padding: 2px 6px; border-radius: 3px; border: none; cursor: pointer; background: #E1F5EE; color: #1a8a36; }
.pip-edit-pick-call:hover { background: #c5edd9; }
.pip-edit-step { display: inline-flex; align-items: center; gap: 0; position: relative; }
.pip-edit-handle { font-size: 12px; color: var(--text-tertiary); cursor: grab; padding: 2px 4px 2px 0; opacity: 0.5; transition: opacity 0.1s; user-select: none; }
.pip-edit-step:hover .pip-edit-handle { opacity: 0.8; }
.pip-edit-handle:hover { opacity: 1 !important; color: var(--text); }
.pip-edit-handle:active { cursor: grabbing; }
.pip-edit-step.dragging { opacity: 0.3; }
.pip-edit-drop-target { width: 3px; height: 20px; background: var(--accent); border-radius: 2px; margin: 0 2px; animation: pip-pulse 0.8s ease-in-out infinite alternate; }
@keyframes pip-pulse { from { opacity: 0.4; } to { opacity: 1; } }
.pip-edit-step.just-dropped .pip-edit-pill { outline: 2px solid var(--accent); outline-offset: 1px; border-radius: 3px; }
.guide-tab-btn { user-select: none; }
.guide-tab-btn.dragging { opacity: 0.3; }
.tab-drop-target { width: 3px; height: 20px; background: var(--accent); border-radius: 2px; margin: 0 -1px; display: inline-block; vertical-align: middle; animation: pip-pulse 0.8s ease-in-out infinite alternate; }
.guide-tab-btn.just-dropped { outline: 2px solid var(--accent); outline-offset: -1px; border-radius: 3px; }

/* Day subheaders for future groups */
.pip-day-header { padding: 4px 20px 2px; font-size: 10px; font-weight: 500; color: var(--text-tertiary); border-bottom: 0.5px solid var(--border-light, rgba(0,0,0,0.06)); background: var(--bg-secondary, #fafaf9); }

.guide-input {
    font-size: 12px;
    padding: 2px 6px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
}

.guide-input.guide-label {
    flex: 1;
    min-width: 100px;
}

.guide-input.guide-action {
    width: 70px;
}

.seq-pick-opt {
    display: block;
    width: 100%;
    text-align: left;
    font-size: 12px;
    padding: 5px 10px;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 4px;
    color: var(--text);
}
.seq-pick-opt:hover {
    background: var(--gray-bg);
}

/* ========== Nurture Page ========== */
.nurture-section {
    margin-bottom: 1.5rem;
}

.nurture-row {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    margin-bottom: 0.35rem;
    transition: box-shadow var(--transition);
}

.nurture-row:hover {
    box-shadow: var(--shadow-sm);
}

.nurture-row-main {
    display: grid;
    grid-template-columns: minmax(160px, 1.5fr) minmax(150px, 1.5fr) 120px 120px 60px minmax(260px, auto);
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.75rem;
    font-size: 13px;
}

.nurture-cell {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nurture-company {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 500;
}

.nurture-contact {
    color: var(--text-secondary);
}

.nurture-email {
    color: var(--text-tertiary);
    font-size: 11px;
}

.nurture-meta {
    color: var(--text-secondary);
    font-size: 12px;
}

.nurture-interval {
    cursor: pointer;
    border-bottom: 1px dashed var(--text-tertiary);
    color: var(--text-secondary);
    font-size: 12px;
}

.nurture-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
    overflow: visible;
}

.nurture-status {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
}

.nurture-overdue {
    background: rgba(255,59,48,0.12);
    color: #ff3b30;
}

.nurture-due-soon {
    background: rgba(255,149,0,0.12);
    color: #ff9500;
}

.nurture-ok {
    background: rgba(52,199,89,0.12);
    color: #34c759;
}

.nurture-snoozed {
    background: var(--gray-bg);
    color: var(--gray);
}

.nurture-ping-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-top: 1px solid var(--border-light);
    background: var(--bg);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

/* Do This Now — dashboard */
.dtn-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
}

.dtn-row:last-child {
    border-bottom: none;
}

.dtn-company {
    font-weight: 500;
    min-width: 140px;
}

.dtn-contact {
    color: var(--text-secondary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dtn-status {
    font-size: 11px;
    font-weight: 600;
    color: #ff3b30;
    white-space: nowrap;
}

.dtn-actions {
    display: flex;
    gap: 0.35rem;
}


/* ========== Pipeline Sidebar ========== */
.page-with-sidebar {
    display: flex;
    gap: 0;
    margin: -24px -32px;
    height: calc(100vh - 48px);
}
.page-with-sidebar > .page-main {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    padding: 16px 18px;
}
.pipeline-sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 0.5px solid var(--border);
    overflow-y: auto;
}
.pipeline-sidebar.hidden {
    display: none;
}
.ps-header { display: none; }
.ps-close { display: none; }
.ps-group-label {
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-tertiary);
    padding: 8px 12px 4px;
}
.ps-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 0.5px solid var(--border-light);
    transition: background 0.1s;
}
.ps-item:hover { background: var(--bg); }
.ps-item.active { background: rgba(55,138,221,0.05); }
.ps-item img { flex-shrink: 0; border-radius: 4px; }
.ps-item-info { min-width: 0; flex: 1; }
.ps-item-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ps-item-step {
    font-size: 10px;
    color: var(--text-secondary);
}
.ps-item-type {
    flex-shrink: 0;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 1px 5px;
    border-radius: 3px;
}
.ps-item-type.call { color: var(--orange); background: var(--orange-bg); }
.ps-item-type.email { color: var(--accent); background: var(--accent-light); }
.ps-toggle-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.3rem 0.55rem;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    transition: color 0.15s, border-color 0.15s;
}
.ps-toggle-btn:hover { color: var(--text); border-color: var(--text-tertiary); }

/* Toast notification */
.toast-msg {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--accent, #4f8cff);
    color: #fff;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-size: 0.9rem;
    z-index: 9999;
    animation: toast-in 0.25s ease-out;
}
@keyframes toast-in {
    from { opacity: 0; transform: translateY(1rem); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========== Raw Paste Review Cards ========== */
.rp-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 6px;
    transition: opacity 0.2s, transform 0.2s;
}
.rp-card.removing {
    opacity: 0;
    transform: translateX(20px);
}
.rp-card .rp-field {
    border: 1px solid transparent;
    background: none;
    padding: 2px 4px;
    border-radius: 4px;
    color: var(--text);
    font-size: inherit;
    font-family: inherit;
}
.rp-card .rp-field:hover,
.rp-card .rp-field:focus {
    border-color: var(--border);
    background: var(--bg);
}
.rp-card .rp-field::placeholder {
    color: var(--text-tertiary);
}
.rp-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}
.rp-actions button {
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    padding: 2px 8px;
    line-height: 1.2;
    transition: background 0.15s;
}
.rp-actions button:hover {
    background: var(--gray-bg);
}
.rp-contact-row {
    display: flex;
    gap: 4px;
    font-size: 12px;
    margin-top: 4px;
    padding-left: 4px;
    align-items: center;
    color: var(--text-secondary);
}
.rp-contact-row::before {
    content: "\1F464";
    font-size: 10px;
}
.rp-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 99px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.rp-badge.high { background: var(--green-bg); color: #166534; }
.rp-badge.medium { background: var(--yellow-bg); color: #854d0e; }
.rp-badge.low { background: var(--gray-bg); color: var(--text-secondary); }

/* ========== Slideout Panel (shared) ========== */
.slideout-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.3); z-index: 100;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.slideout-overlay.open { opacity: 1; }
.slideout-panel {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: 480px; max-width: 90vw;
    background: var(--surface); z-index: 101;
    box-shadow: -4px 0 20px rgba(0,0,0,0.15);
    display: flex; flex-direction: column;
    overflow: hidden;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.slideout-panel.open { transform: translateX(0); }
.slideout-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}
.slideout-header h3 { margin: 0; font-size: 16px; }
.slideout-body {
    flex: 1; overflow-y: auto; padding: 1rem 1.25rem;
}
.slideout-section {
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}
.slideout-section:last-child { border-bottom: none; }
.slideout-section-title {
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.5px; color: var(--text-secondary); margin-bottom: 0.5rem;
}
.timeline-item {
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
}
.timeline-item:last-child { border-bottom: none; }
.timeline-date { font-size: 11px; color: var(--text-tertiary); }
