/* ═══════════════════════════════════════════════════════════════
   Medialab Boost — Design System
   Theme: Light  |  Red / Light-Gray / White
   ═══════════════════════════════════════════════════════════════ */

/* ── Tokens ── */
:root {
    --red-50:  #FFEBEE;
    --red-100: #FFCDD2;
    --red-200: #EF9A9A;
    --red-300: #E57373;
    --red-400: #EF5350;
    --red-500: #E53935;
    --red-600: #D32F2F;
    --red-700: #C62828;
    --red-800: #B71C1C;

    --gray-50:  #FAFAFA;
    --gray-100: #F5F5F5;
    --gray-200: #EEEEEE;
    --gray-300: #E0E0E0;
    --gray-400: #BDBDBD;
    --gray-500: #9E9E9E;
    --gray-600: #757575;
    --gray-700: #616161;
    --gray-800: #424242;
    --gray-900: #212121;

    --white: #FFFFFF;
    --green-500: #43A047;
    --green-100: #E8F5E9;
    --amber-500: #FB8C00;
    --amber-100: #FFF8E1;
    --blue-500: #1E88E5;
    --blue-100: #E3F2FD;

    --primary: var(--red-500);
    --primary-hover: var(--red-600);
    --primary-light: var(--red-50);
    --bg: var(--gray-100);
    --surface: var(--white);
    --text: var(--gray-900);
    --text-secondary: var(--gray-600);
    --border: var(--gray-300);
    --border-light: var(--gray-200);

    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow: 0 4px 12px rgba(0,0,0,.07);
    --shadow-lg: 0 10px 30px rgba(0,0,0,.1);
    --transition: .2s cubic-bezier(.4,0,.2,1);

    --sidebar-w: 240px;
    --header-h: 64px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

/* Force the arrow cursor on every element (defeats the browser's UA cursor:
   text default for text-content elements). Combined with `user-select: none`
   on UI chrome below, the I-beam never appears on headings, nav, buttons,
   etc. Data areas (tables, logs, inputs) keep selection enabled so text
   can still be copied. Hides the blinking caret on non-inputs. */
* { 
    cursor: default !important; 
    caret-color: transparent !important;
}

/* UI chrome — never selectable, no I-beam. */
.sidebar, .sidebar *,
.top-header, .top-header *,
.card-header, .card-header *,
.tool-card-header, .tool-card-header *,
.batch-bar, .batch-bar *,
.add-link-bar > .btn, .add-link-bar > .ch-select-wrap,
button, .btn, .nav-item, .list-item-name, .list-item-count,
label, h1, h2, h3, h4, h5, h6,
.page-title, .brand-name, .brand-sub,
.task-status, .badge,
.toggle-switch, .sort-mode-toggle, .sort-opt,
.filter-group, .filter-group *,
.tool-title, .tool-desc,
.section-header, .section-header *,
.profiles-info, .profiles-info *,
.worker-status, .worker-status *,
.modal-header, .modal-header *,
.toast, .toast *,
.empty-state, .empty-state *,
th, .sidebar-footer * {
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
}

html { font-size: 14px; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ═══ SIDEBAR ═══ */
.sidebar {
    width: var(--sidebar-w);
    min-height: 100vh;
    background: var(--white);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 24px;
}
.brand-icon {
    width: 42px; height: 42px;
    background: linear-gradient(135deg, var(--red-500), var(--red-700));
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    color: var(--white);
    box-shadow: 0 4px 12px rgba(229,57,53,.3);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-weight: 800; font-size: 1.15rem; color: var(--gray-900); letter-spacing: -.02em; }
.brand-sub  { font-weight: 600; font-size: .85rem; color: var(--red-500); letter-spacing: .04em; text-transform: uppercase; }

.sidebar-nav {
    flex: 1;
    padding: 0 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    color: var(--gray-600);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}
.nav-item:hover { background: var(--gray-100); color: var(--gray-800); }
.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}
.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0; top: 50%; transform: translateY(-50%);
    width: 3px; height: 20px;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.worker-status {
    display: flex; align-items: center; gap: 8px;
    font-size: .85rem; color: var(--text-secondary);
}
.status-dot {
    width: 8px; height: 8px; border-radius: 50%;
    display: inline-block;
    transition: var(--transition);
}
.status-dot.offline { background: var(--gray-400); }
.status-dot.online  { background: var(--green-500); box-shadow: 0 0 6px rgba(67,160,71,.5); animation: pulse 2s infinite; }
@keyframes pulse {
    0%,100% { opacity: 1; }
    50% { opacity: .5; }
}
.btn-worker {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 14px;
    border: none; border-radius: var(--radius-sm);
    background: var(--primary);
    color: var(--white);
    font-weight: 600; font-size: .85rem;
    cursor: pointer;
    transition: var(--transition);
}
.btn-worker:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(229,57,53,.25); }
.btn-worker.running { background: var(--gray-700); }
.btn-worker.running:hover { background: var(--gray-800); box-shadow: 0 4px 12px rgba(0,0,0,.15); }

/* ═══ MAIN CONTENT ═══ */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ── Header ── */
.top-header {
    height: var(--header-h);
    background: var(--white);
    border-bottom: 1px solid var(--border-light);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 32px;
    position: sticky; top: 0; z-index: 50;
}
.page-title { font-size: 1.35rem; font-weight: 700; color: var(--gray-900); }
.active-count {
    display: flex; align-items: center; gap: 8px;
    font-size: .9rem; font-weight: 500; color: var(--text-secondary);
    background: var(--gray-100);
    padding: 6px 14px;
    border-radius: 20px;
}
.active-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--green-500);
    box-shadow: 0 0 6px rgba(67,160,71,.4);
}

/* ── Page wrapper ── */
.page-content { padding: 28px 32px; flex: 1; }

/* ═══ ADD LINK BAR ═══ */
.add-link-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}
.add-link-bar input[type="url"],
.add-link-bar select,
.add-link-bar .ch-select-wrap,
.add-link-bar .btn {
    height: 40px;
    box-sizing: border-box;
}
.add-link-bar input[type="url"],
.add-link-bar select {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 16px;
    font-size: .9rem;
    outline: none;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}
.add-link-bar input[type="url"] {
    flex: 1;
}
.add-link-bar select {
    min-width: 160px;
    color: var(--gray-700);
}
.add-link-bar input[type="url"]:focus,
.add-link-bar select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(229,57,53,.15);
}
.add-link-bar .btn {
    border-radius: var(--radius-sm);
    padding: 0 24px;
    font-size: .9rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* ═══ CUSTOM CHANNEL SELECT ═══ */
.ch-select-wrap {
    position: relative;
    min-width: 160px;
    height: 40px;
    box-sizing: border-box;
}
.ch-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    height: 40px;
    padding: 0 12px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .9rem;
    color: var(--gray-400);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    user-select: none;
    white-space: nowrap;
    box-sizing: border-box;
}
.ch-select-trigger.has-value { color: var(--gray-700); }
.ch-select-trigger.open,
.ch-select-trigger:hover { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(229,57,53,.15); }
.ch-select-trigger svg { flex-shrink: 0; opacity: .5; }
.ch-select-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 100%;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    z-index: 999;
    overflow: hidden;
}
.ch-select-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px 8px 14px;
    font-size: .875rem;
    color: var(--gray-700);
    cursor: pointer;
    gap: 6px;
}
.ch-select-item:hover { background: var(--gray-50); }
.ch-item-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-item-delete {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: 4px;
    color: var(--gray-400);
    cursor: pointer;
    font-size: .7rem;
    padding: 0;
    line-height: 1;
    transition: var(--transition);
    opacity: 0;
}
.ch-select-item:hover .ch-item-delete { opacity: 1; }
.ch-item-delete:hover { background: rgba(229,57,53,.12); color: var(--primary); }
.ch-select-add {
    color: var(--primary);
    font-weight: 600;
    border-top: 1px solid var(--border);
    justify-content: flex-start;
}
.ch-select-add:hover { background: rgba(229,57,53,.06); }

/* ═══ CARDS ═══ */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    overflow: hidden;
    transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow); }
.card-accent { border-top: 3px solid var(--primary); }
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
}
.card-header h2 {
    font-size: 1rem; font-weight: 600; color: var(--gray-800);
    display: flex; align-items: center; gap: 8px;
}
.card-body { padding: 20px; }
.card-body.no-pad { padding: 0; }

/* ═══ FORMS ═══ */
.form-row {
    display: flex; gap: 16px; flex-wrap: wrap;
    margin-top: 12px;
}
.form-row:first-child { margin-top: 0; }
.form-group {
    display: flex; flex-direction: column; gap: 5px;
    flex: 1; min-width: 120px;
}
.form-group-btn { justify-content: flex-end; min-width: auto; flex: 0 0 auto; }
.flex-3 { flex: 3; }
.flex-1 { flex: 1; }

label {
    font-size: .8rem; font-weight: 600; color: var(--gray-600);
    text-transform: uppercase; letter-spacing: .04em;
}
input, select {
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-xs);
    font-family: var(--font);
    font-size: .95rem;
    color: var(--text);
    background: var(--white);
    transition: var(--transition);
    outline: none;
}
input:focus, select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(229,57,53,.1);
}
input::placeholder { color: var(--gray-400); }

/* ═══ BUTTONS ═══ */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border: none; border-radius: var(--radius-xs);
    font-family: var(--font); font-weight: 600; font-size: .85rem;
    cursor: pointer; transition: var(--transition);
    text-decoration: none;
}
.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(229,57,53,.25); }
.btn-sm { padding: 5px 12px; font-size: .8rem; }
.btn-lg { padding: 10px 24px; font-size: .95rem; }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--gray-100); }
.btn-danger { background: transparent; color: var(--red-500); }
.btn-danger:hover { background: var(--red-50); }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-icon-danger { color: var(--gray-400); padding: 5px 6px; }
.btn-icon-danger:hover { color: var(--red-500); background: var(--red-50); }
.btn-copy { color: var(--gray-400); padding: 4px 6px; line-height: 0; }
.btn-copy:hover { color: var(--primary); background: var(--gray-100); }

/* ═══ SECTION HEADER ═══ */
.section-header {
    display: flex; align-items: center; gap: 10px;
    margin: 24px 0 14px;
}
.section-header h2 { font-size: 1.05rem; font-weight: 700; color: var(--gray-800); }
.badge {
    background: var(--primary);
    color: var(--white);
    font-size: .75rem; font-weight: 700;
    padding: 2px 10px;
    border-radius: 20px;
    min-width: 24px; text-align: center;
}

/* ═══ TASK CARDS ═══ */
.tasks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
}
.task-card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    animation: fadeUp .3s ease;
}
.task-card:hover { box-shadow: var(--shadow); }
.task-card-header {
    display: flex; align-items: start; justify-content: space-between;
    margin-bottom: 12px;
}
.task-link {
    font-size: .85rem; color: var(--gray-700); font-weight: 500;
    word-break: break-all;
    max-height: 2.6em; overflow: hidden;
}
.task-channel {
    font-size: .75rem; color: var(--white); font-weight: 600;
    background: var(--primary);
    padding: 2px 8px; border-radius: 4px;
    white-space: nowrap; margin-left: 8px; flex-shrink: 0;
}
.task-progress { margin: 10px 0 6px; }
.progress-bar {
    width: 100%; height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--red-400), var(--red-600));
    border-radius: 4px;
    transition: width .5s ease;
}
.progress-fill.complete { background: linear-gradient(90deg, var(--green-500), #2E7D32); }
.task-meta {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 6px;
}
.task-views { font-size: .85rem; font-weight: 700; color: var(--gray-800); }
.task-status {
    font-size: .75rem; font-weight: 600;
    padding: 3px 10px; border-radius: 20px;
}
.task-status.running  { background: var(--blue-100); color: var(--blue-500); }
.task-status.queued   { background: var(--amber-100); color: var(--amber-500); }
.task-status.completed{ background: var(--green-100); color: var(--green-500); }
.task-status.paused   { background: var(--gray-200); color: var(--gray-600); }
.task-status.failed   { background: var(--red-50); color: var(--red-500); }
.task-actions { display: flex; gap: 6px; margin-top: 10px; }

/* ═══ EMPTY STATE ═══ */
.empty-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 40px 20px;
    color: var(--gray-500);
    text-align: center;
}
.empty-state p { margin-top: 12px; font-size: .9rem; }

/* ═══ LOG CONTAINER ═══ */
.log-container {
    max-height: 220px;
    overflow-y: auto;
    padding: 12px 16px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: .8rem;
    line-height: 1.7;
    background: var(--gray-50);
    color: var(--gray-700);
}
.log-container-full {
    max-height: calc(100vh - 180px);
    min-height: 400px;
}
.log-entry { display: flex; gap: 8px; padding: 1px 0; }
.log-time { color: var(--gray-400); flex-shrink: 0; }
.log-msg { word-break: break-word; }
.log-msg.success { color: var(--green-500); }
.log-msg.error   { color: var(--red-500); }
.log-msg.warning { color: var(--amber-500); }

/* ═══ BATCH BAR ═══ */
.batch-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    margin-top: 12px;
    background: var(--gray-800);
    color: var(--white);
    border-radius: var(--radius-sm);
    font-size: .85rem;
    font-weight: 500;
    animation: fadeUp .2s ease;
}
.batch-bar .btn-danger {
    color: var(--white);
    background: var(--red-600);
    border: none;
}
.batch-bar .btn-danger:hover {
    background: var(--red-700);
}

/* ═══ TWO-COL LAYOUT (channels) ═══ */
.two-col { display: flex; gap: 20px; }
.col-side { width: 280px; flex-shrink: 0; }
.col-main { flex: 1; }

.list-group { display: flex; flex-direction: column; }
.list-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: var(--transition);
}
.list-item:last-child { border-bottom: none; }
.list-item:hover { background: var(--gray-50); }
.list-item.active { background: var(--primary-light); border-left: 3px solid var(--primary); }
.list-item-name { font-weight: 500; color: var(--gray-800); }
.list-item-count { font-size: .8rem; color: var(--gray-500); }
.list-item-actions { display: flex; gap: 4px; }

.link-item {
    display: flex; flex-direction: column; gap: 6px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-light);
}
.link-item:last-child { border-bottom: none; }
.link-url {
    font-size: .85rem; color: var(--gray-700); word-break: break-all;
    max-height: 2.6em; overflow: hidden;
}
.link-meta {
    display: flex; align-items: center; justify-content: space-between;
}
.link-views { font-size: .8rem; color: var(--gray-500); }
.link-actions { display: flex; gap: 6px; }

/* ═══ DATA TABLE ═══ */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    text-align: left; padding: 12px 16px;
    font-size: .75rem; font-weight: 700; color: var(--gray-500);
    text-transform: uppercase; letter-spacing: .05em;
    background: var(--gray-50);
    border-bottom: 2px solid var(--border-light);
}
.data-table td {
    padding: 12px 16px;
    font-size: .85rem; color: var(--gray-700);
    border-bottom: 1px solid var(--border-light);
}
.data-table tr:hover td { background: var(--gray-50); }

/* ═══ SETTINGS ═══ */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 20px;
}
.settings-actions { margin-top: 24px; display: flex; justify-content: flex-end; }

/* ═══ FILTER GROUP ═══ */
.filter-group { display: flex; gap: 8px; align-items: center; }
.filter-group select {
    padding: 6px 12px; font-size: .85rem;
}

/* ═══ PROXY SETTINGS ═══ */
.card-proxy textarea { width: 100%; font-family: monospace; font-size: .85rem; resize: vertical; }
.label-hint { color: var(--gray-500); font-size: .75rem; text-transform: none; margin-left: 6px; }
.toggle-switch {
    position: relative; display: inline-block; width: 44px; height: 24px; cursor: pointer;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute; inset: 0; background-color: var(--gray-300);
    border-radius: 24px; transition: var(--transition);
}
.toggle-slider:before {
    position: absolute; content: ""; height: 18px; width: 18px;
    left: 3px; bottom: 3px; background-color: white;
    border-radius: 50%; transition: var(--transition); box-shadow: var(--shadow-sm);
}
.toggle-switch input:checked + .toggle-slider { background-color: var(--green-500); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(20px); }

.proxy-test-result {
    margin-top: 16px; padding: 12px; border-radius: var(--radius-sm);
    font-size: .85rem; font-weight: 500;
}
.proxy-test-result.success { background: var(--green-100); color: var(--green-500); }
.proxy-test-result.error { background: var(--red-50); color: var(--red-500); }

.proxy-pool-info {
    margin-top: 16px; background: var(--gray-50); border-radius: var(--radius-sm);
    padding: 12px; border: 1px solid var(--border-light);
}
.proxy-pool-row { display: flex; justify-content: space-between; font-size: .85rem; padding: 4px 0; }
.proxy-pool-row span:first-child { color: var(--gray-600); font-weight: 500; }
.proxy-pool-row span:last-child { font-weight: 700; color: var(--gray-800); }
.text-green { color: var(--green-500) !important; }
.text-amber { color: var(--amber-500) !important; }

/* ═══ PROFILES INFO (sidebar) ═══ */
.profiles-info {
    background: var(--gray-50);
    border-radius: var(--radius-xs);
    padding: 10px 12px;
}
.profiles-info-row {
    display: flex; align-items: center; gap: 8px;
    font-size: .85rem; color: var(--gray-700);
}
.profiles-info-row.sub {
    margin-top: 4px;
    font-size: .78rem; color: var(--gray-500);
}
.profiles-label { flex: 1; }
.profiles-count {
    font-weight: 700; color: var(--gray-800);
    font-size: .9rem;
}
.profiles-info-row.sub .profiles-count {
    font-size: .78rem; font-weight: 600; color: var(--gray-500);
}
.sidebar-divider {
    height: 1px;
    background: var(--border-light);
    margin: 2px 0;
}

/* ═══ MODAL ═══ */
.modal-overlay {
    position: fixed; inset: 0;
    left: 0 !important;
    margin: 0 !important;
    background: rgba(0,0,0,.35);
    backdrop-filter: blur(4px);
    display: none; align-items: center; justify-content: center;
    z-index: 1000;
    animation: fadeIn .2s ease;
}
.modal-overlay.open { display: flex; }
.modal-overlay.closing {
    animation: fadeOut .2s ease forwards;
}
.modal-overlay.closing .modal {
    animation: scaleOut .2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
.modal {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%; max-width: 480px;
    animation: scaleIn .3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes scaleIn { from { transform: scale(.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes scaleOut { from { transform: scale(1); opacity: 1; } to { transform: scale(.95); opacity: 0; } }
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
}
.modal-header h3 { font-size: 1.05rem; font-weight: 700; }
.btn-close {
    background: none; border: none;
    font-size: 1.4rem; color: var(--gray-500);
    cursor: pointer; line-height: 1;
    padding: 4px 8px; border-radius: var(--radius-xs);
    transition: var(--transition);
}
.btn-close:hover { background: var(--gray-100); color: var(--gray-900); }
.modal-body { padding: 20px; }
.modal-body .form-group { margin-bottom: 14px; }
.modal-body .form-group:last-child { margin-bottom: 0; }
.modal-body .btn { width: 100%; justify-content: center; margin-top: 8px; }

/* ═══ TOAST ═══ */
.toast-container {
    position: fixed; bottom: 24px; right: 24px;
    display: flex; flex-direction: column-reverse; gap: 10px;
    z-index: 2000;
}
.toast {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    background: var(--gray-800);
    color: var(--white);
    font-size: .85rem; font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: slideInToast .3s ease;
    display: flex; align-items: center; gap: 8px;
    max-width: 380px;
}
.toast.success { background: var(--green-500); }
.toast.error   { background: var(--red-600); }
.toast.warning { background: var(--amber-500); color: var(--gray-900); }
@keyframes slideInToast {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

/* ═══ TOOLS PAGE ═══ */

/* Tool section header (icon + title + description) */
.tool-card-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 20px 20px 0;
    margin-bottom: 20px;
}
.tool-icon {
    width: 44px; height: 44px; flex-shrink: 0;
    border-radius: var(--radius-sm);
    background: #FF0000;
    display: flex; align-items: center; justify-content: center;
    color: var(--white);
    box-shadow: 0 4px 12px rgba(255,0,0,.3);
}
.tool-title  { font-size: 1.1rem; font-weight: 700; color: var(--gray-900); margin-bottom: 2px; }
.tool-desc   { font-size: .85rem; color: var(--gray-500); line-height: 1.4; }

/* Sort mode segmented control */
.sort-mode-toggle {
    display: flex;
    gap: 0;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-xs);
    overflow: hidden;
    background: var(--white);
    height: 40px;
}
.sort-opt {
    display: flex; align-items: center;
    cursor: pointer;
    position: relative;
    flex: 1;
}
.sort-opt input[type="radio"] {
    position: absolute; opacity: 0; width: 0; height: 0;
    pointer-events: none;
}
.sort-opt span {
    display: flex; align-items: center; justify-content: center;
    width: 100%;
    padding: 0 16px;
    font-size: .85rem; font-weight: 500;
    color: var(--gray-600);
    transition: var(--transition);
    white-space: nowrap;
    height: 40px;
    border: none;
    user-select: none;
}
.sort-opt + .sort-opt span {
    border-left: 1.5px solid var(--border);
}
.sort-opt input:checked + span {
    background: var(--primary);
    color: var(--white);
    font-weight: 600;
}
.sort-opt:hover span { background: var(--gray-100); }
.sort-opt input:checked + span:hover { background: var(--primary-hover); }

/* ═══ CURSOR OVERRIDES ═══ */
/* All elements get arrow cursor (!important) at the top of the file. These
   rules restore the correct cursor for interactive elements and editable
   inputs — also !important so they beat the universal rule above. */
a[href], button, select,
input[type="checkbox"], input[type="radio"],
input[type="submit"], input[type="button"], input[type="reset"],
[role="button"], [onclick],
.btn, .nav-item, .ch-select-trigger, .ch-select-item,
.ch-item-delete, .ch-select-add, .list-item,
.sort-opt, .toggle-switch, .btn-close { cursor: pointer !important; }

input[type="text"], input[type="url"], input[type="number"],
input[type="password"], input[type="email"], input[type="search"],
input[type="tel"], input:not([type]), textarea { 
    cursor: text !important; 
    caret-color: auto !important;
}

button:disabled, .btn:disabled,
input:disabled, textarea:disabled, select:disabled,
[disabled] { cursor: not-allowed !important; }

/* Data areas — explicitly selectable so users can copy URLs, log lines, etc.
   These rules win over any user-select: none above because they target more
   specific elements. */
.data-table td, .data-table td *,
.log-container, .log-container *,
.task-link, .link-url,
input, textarea {
    user-select: text !important;
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
}

/* ═══ ANIMATIONS ═══ */
.spin { animation: spin 1s linear infinite; }
@keyframes spin { 100% { transform: rotate(360deg); } }

/* ═══ SCROLLBAR ═══ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

