/* ============================================
   TRACKER PAGE STYLES — Card Table Design
   ============================================ */

/* ---- Page Container ---- */
.tracker-page {
    max-width: 1300px;
    margin: 0 auto;
    padding: 24px 28px 40px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    color: #1a1a2e;
    min-height: 100vh;
}
[data-theme="dark"] .tracker-page { color: #e0e0f0; }

/* ---- Header ---- */
.tracker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px 28px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.25);
    position: relative;
    overflow: hidden;
}
.tracker-header::before {
    content: '';
    position: absolute;
    top: -50%; right: -20%;
    width: 300px; height: 300px;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    border-radius: 50%;
}
[data-theme="dark"] .tracker-header {
    background: linear-gradient(135deg, #2d1b69 0%, #11998e 100%);
    box-shadow: 0 8px 32px rgba(45, 27, 105, 0.4);
}
.tk-header-left { display: flex; align-items: center; gap: 16px; z-index: 1; }
.tk-logo {
    font-size: 36px; width: 56px; height: 56px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.15); border-radius: 14px; backdrop-filter: blur(10px);
}
.tk-header-left h1 { font-size: 22px; font-weight: 800; color: #fff; margin: 0 0 3px; letter-spacing: -0.3px; }
.tk-subtitle { font-size: 13px; color: rgba(255,255,255,0.75); font-weight: 400; }
.tk-header-right { display: flex; gap: 10px; z-index: 1; flex-wrap: wrap; justify-content: flex-end; }

/* ---- Buttons ---- */
.tk-btn {
    padding: 9px 18px; border-radius: 10px; font-size: 13px; font-weight: 600;
    font-family: inherit; text-decoration: none; cursor: pointer; border: none;
    transition: all 0.2s ease; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.tk-btn-icon { font-size: 16px; font-weight: 700; line-height: 1; }
.tk-btn-primary { background: #fff; color: #667eea; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.tk-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,0.15); }
.tk-btn-secondary { background: rgba(255,255,255,0.2); color: #fff; border: 1px solid rgba(255,255,255,0.3); backdrop-filter: blur(4px); }
.tk-btn-secondary:hover { background: rgba(255,255,255,0.3); transform: translateY(-1px); }
.tk-btn-home { background: rgba(255,255,255,0.15); color: #fff; border: 1px solid rgba(255,255,255,0.2); }
.tk-btn-home:hover { background: rgba(255,255,255,0.25); transform: translateY(-1px); }
.tk-btn-ghost { background: transparent; color: #888; border: 1px solid #ddd; }
.tk-btn-ghost:hover { background: #f5f5f5; border-color: #bbb; }
[data-theme="dark"] .tk-btn-ghost { color: #aaa; border-color: #444; }
[data-theme="dark"] .tk-btn-ghost:hover { background: #2a2a3c; border-color: #555; }
.tk-modal .tk-btn-primary { background: linear-gradient(135deg, #667eea, #764ba2); color: #fff; border: none; }
.tk-modal .tk-btn-primary:hover { box-shadow: 0 4px 18px rgba(102, 126, 234, 0.4); }
[data-theme="dark"] .tk-modal .tk-btn-primary { background: linear-gradient(135deg, #5a6fd6, #6a42a0); }

/* Danger button for confirm modals */
.tk-btn-danger {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: #fff; border: none;
    box-shadow: 0 2px 8px rgba(231,76,60,0.25);
}
.tk-btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 18px rgba(231,76,60,0.35);
}

/* ---- Toolbar ---- */
.tk-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.tk-toolbar-left { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 200px; }
.tk-toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.tk-search-wrap {
    position: relative;
    flex: 1;
    max-width: 340px;
}
.tk-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    pointer-events: none;
    opacity: 0.5;
}
.tk-search-input {
    width: 100%;
    padding: 10px 14px 10px 38px;
    border: 1.5px solid rgba(0,0,0,0.1);
    border-radius: 12px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: #333;
    background: #fff;
    transition: all 0.25s;
    outline: none;
}
.tk-search-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.1), 0 2px 8px rgba(102,126,234,0.08);
}
.tk-search-input::placeholder { color: #aaa; }
[data-theme="dark"] .tk-search-input {
    background: #1e1e2d;
    border-color: rgba(255,255,255,0.08);
    color: #d8d8e4;
}
[data-theme="dark"] .tk-search-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.15);
}
[data-theme="dark"] .tk-search-input::placeholder { color: #666; }

.tk-toolbar-btn {
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: 1.5px solid rgba(0,0,0,0.08);
    background: #fff;
    color: #555;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
    white-space: nowrap;
}
.tk-toolbar-btn:hover {
    background: #f0f0ff;
    border-color: rgba(102,126,234,0.25);
    color: #667eea;
    transform: translateY(-1px);
}
.tk-toolbar-btn:active { transform: translateY(0); }
[data-theme="dark"] .tk-toolbar-btn {
    background: #1e1e2d;
    border-color: rgba(255,255,255,0.06);
    color: #aab;
}
[data-theme="dark"] .tk-toolbar-btn:hover {
    background: #262640;
    border-color: rgba(102,126,234,0.3);
    color: #8898f0;
}

.tk-toolbar-export { color: #27ae60; }
.tk-toolbar-export:hover { color: #2ecc71; border-color: rgba(46,204,113,0.3); background: rgba(46,204,113,0.05); }
.tk-toolbar-import { color: #3498db; }
.tk-toolbar-import:hover { color: #2980b9; border-color: rgba(52,152,219,0.3); background: rgba(52,152,219,0.05); }
[data-theme="dark"] .tk-toolbar-export { color: #2ecc71; }
[data-theme="dark"] .tk-toolbar-import { color: #5dade2; }

.tk-toolbar-divider {
    width: 1px;
    height: 24px;
    background: rgba(0,0,0,0.08);
    margin: 0 4px;
}
[data-theme="dark"] .tk-toolbar-divider { background: rgba(255,255,255,0.06); }

/* ---- Stats Row ---- */
.tk-stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.tk-stat-card {
    background: #fff; border-radius: 14px; padding: 18px 20px;
    display: flex; align-items: center; gap: 14px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04); border: 1px solid rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
}
.tk-stat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.08); }
[data-theme="dark"] .tk-stat-card { background: #1e1e2d; border-color: rgba(255,255,255,0.06); box-shadow: 0 2px 12px rgba(0,0,0,0.2); }
[data-theme="dark"] .tk-stat-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,0.3); }
.tk-stat-icon { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.tk-stat-icon.purple { background: rgba(142,68,173,0.12); }
.tk-stat-icon.blue { background: rgba(52,152,219,0.12); }
.tk-stat-icon.green { background: rgba(46,204,113,0.12); }
.tk-stat-icon.orange { background: rgba(243,156,18,0.12); }
[data-theme="dark"] .tk-stat-icon.purple { background: rgba(142,68,173,0.2); }
[data-theme="dark"] .tk-stat-icon.blue { background: rgba(52,152,219,0.2); }
[data-theme="dark"] .tk-stat-icon.green { background: rgba(46,204,113,0.2); }
[data-theme="dark"] .tk-stat-icon.orange { background: rgba(243,156,18,0.2); }
.tk-stat-info { display: flex; flex-direction: column; }
.tk-stat-value { font-size: 22px; font-weight: 800; color: #1a1a2e; line-height: 1.2; }
[data-theme="dark"] .tk-stat-value { color: #f0f0fc; }
.tk-stat-label { font-size: 12px; color: #888; font-weight: 500; margin-top: 2px; }
.tk-progress-bar { width: 100%; height: 6px; background: #eee; border-radius: 3px; overflow: hidden; margin-top: 6px; }
[data-theme="dark"] .tk-progress-bar { background: #333; }
.tk-progress-fill { height: 100%; border-radius: 3px; transition: width 0.5s ease; }
.tk-progress-fill.green { background: linear-gradient(90deg, #27ae60, #2ecc71); }
.tk-progress-fill.orange { background: linear-gradient(90deg, #e67e22, #f39c12); }

/* ============================================
   TABLE + CARD LAYOUT
   ============================================ */

.tk-table-wrapper {
    position: relative;
    padding: 0 24px;
}

/* Scroll container */
.tk-table-scroll {
    overflow-x: auto;
    overflow-y: visible;
    scroll-behavior: smooth;
    border-radius: 16px;
    padding-bottom: 6px;
}

/* Styled scrollbar */
.tk-table-scroll::-webkit-scrollbar { height: 10px; }
.tk-table-scroll::-webkit-scrollbar-track { background: rgba(0,0,0,0.04); border-radius: 5px; margin: 0 8px; }
.tk-table-scroll::-webkit-scrollbar-thumb { background: linear-gradient(90deg, #667eea, #764ba2); border-radius: 5px; min-width: 40px; }
.tk-table-scroll::-webkit-scrollbar-thumb:hover { background: linear-gradient(90deg, #5a6fd6, #6a42a0); }
[data-theme="dark"] .tk-table-scroll::-webkit-scrollbar-track { background: rgba(255,255,255,0.04); }

/* Table base */
.tracker-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    text-align: center;
}

/* ---- Header Row ---- */
.tracker-table thead th {
    padding: 14px 14px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #8888a8;
    white-space: nowrap;
    background: transparent;
    border-bottom: 2px solid rgba(102, 126, 234, 0.15);
}
[data-theme="dark"] .tracker-table thead th {
    border-bottom-color: rgba(102, 126, 234, 0.2);
}

.tk-th-subject {
    text-align: left;
    min-width: 220px;
    padding-left: 22px !important;
}

.tk-th-series {
    cursor: pointer;
    transition: all 0.2s;
    min-width: 90px;
    position: relative;
}
.tk-th-series:hover { color: #e74c3c; }
.tk-th-x {
    font-size: 10px;
    color: #e74c3c;
    opacity: 0;
    margin-left: 4px;
    transition: opacity 0.2s;
}
.tk-th-series:hover .tk-th-x { opacity: 1; }

.tk-th-fixed { min-width: 90px; }

/* ---- Spacer between cards ---- */
.tk-spacer td {
    height: 12px;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
}

/* ---- Card tbody ---- */
.tk-card-body td {
    background: #ffffff;
    padding: 12px 14px;
    border-top: 1px solid transparent;
    border-bottom: 1px solid transparent;
    transition: background 0.15s;
}
[data-theme="dark"] .tk-card-body td {
    background: #1e1e30;
}

/* Card outer border */
.tk-card-body td:first-child {
    border-left: 1px solid rgba(0,0,0,0.07);
}
.tk-card-body td:last-child {
    border-right: 1px solid rgba(0,0,0,0.07);
}
.tk-card-first td {
    border-top: 1px solid rgba(0,0,0,0.07);
}
.tk-card-last td {
    border-bottom: 1px solid rgba(0,0,0,0.07);
}

[data-theme="dark"] .tk-card-body td:first-child { border-left-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .tk-card-body td:last-child { border-right-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .tk-card-first td { border-top-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .tk-card-last td { border-bottom-color: rgba(255,255,255,0.06); }

/* Rounded corners */
.tk-card-first td:first-child { border-top-left-radius: 14px; }
.tk-card-first td:last-child { border-top-right-radius: 14px; }
.tk-card-last td:first-child { border-bottom-left-radius: 14px; }
.tk-card-last td:last-child { border-bottom-right-radius: 14px; }

/* Card shadow via box-shadow on outer cells */
.tk-card-first td:first-child { box-shadow: -3px -3px 8px rgba(0,0,0,0.02); }
.tk-card-first td:last-child { box-shadow: 3px -3px 8px rgba(0,0,0,0.02); }
.tk-card-last td:first-child { box-shadow: -3px 3px 8px rgba(0,0,0,0.02); }
.tk-card-last td:last-child { box-shadow: 3px 3px 8px rgba(0,0,0,0.02); }

/* Hover effect on rows */
.tk-row-main:hover td { background: rgba(102, 126, 234, 0.03); }
.tk-row-sub:hover td { background: rgba(102, 126, 234, 0.03); }
[data-theme="dark"] .tk-row-main:hover td { background: rgba(102, 126, 234, 0.05); }
[data-theme="dark"] .tk-row-sub:hover td { background: rgba(102, 126, 234, 0.05); }

/* ---- Subject cell ---- */
.tk-td-subject {
    text-align: left !important;
    padding-left: 18px !important;
    white-space: nowrap;
}
.tk-subject-name {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #1a1a2e;
}
[data-theme="dark"] .tk-subject-name { color: #e0e0f0; }
.tk-subject-name strong { font-weight: 700; }

/* Subject info wrapper with mini progress */
.tk-subject-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tk-chevron {
    cursor: pointer;
    font-size: 10px;
    color: #aaa;
    user-select: none;
    width: 20px; height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    transition: all 0.2s;
}
.tk-chevron:hover { background: rgba(102,126,234,0.1); color: #667eea; }

/* ---- Drag Handle ---- */
.tk-drag-handle {
    cursor: grab;
    font-size: 16px;
    color: #bbb;
    user-select: none;
    width: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
    letter-spacing: 1px;
    flex-shrink: 0;
}
.tk-drag-handle:hover {
    color: #667eea;
    background: rgba(102,126,234,0.08);
}
.tk-drag-handle:active { cursor: grabbing; }
[data-theme="dark"] .tk-drag-handle { color: #555; }
[data-theme="dark"] .tk-drag-handle:hover { color: #8898f0; background: rgba(102,126,234,0.12); }

/* Drag states */
.tk-card-body.tk-dragging {
    opacity: 0.4;
}
.tk-card-body.tk-drag-over td {
    background: rgba(102,126,234,0.08) !important;
}
.tk-card-body.tk-drag-over .tk-card-first td {
    border-top: 2px solid #667eea !important;
}
[data-theme="dark"] .tk-card-body.tk-drag-over td {
    background: rgba(102,126,234,0.12) !important;
}

/* ---- Mini Progress Bar (per-subject) ---- */
.tk-mini-progress {
    width: 80px;
    height: 4px;
    background: rgba(0,0,0,0.06);
    border-radius: 2px;
    overflow: hidden;
}
.tk-mini-progress-fill {
    height: 100%;
    border-radius: 2px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transition: width 0.5s ease;
    min-width: 0;
}
[data-theme="dark"] .tk-mini-progress { background: rgba(255,255,255,0.06); }

/* Subtopic row */
.tk-td-subtopic {
    padding-left: 56px !important;
    font-weight: 500 !important;
    font-size: 13px !important;
    color: #666 !important;
}
[data-theme="dark"] .tk-td-subtopic { color: #a0a0c0 !important; }
.tk-sub-indent { color: #667eea; opacity: 0.5; margin-right: 6px; }

/* Divider between main row and sub rows */
.tk-row-sub td {
    border-top: 1px dashed rgba(0,0,0,0.06) !important;
}
[data-theme="dark"] .tk-row-sub td {
    border-top-color: rgba(255,255,255,0.05) !important;
}

/* ---- Cell Box (distinguishable checkbox container) ---- */
.tk-cell-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.025);
    border: 1.5px solid rgba(0,0,0,0.07);
    border-radius: 10px;
    padding: 6px 8px;
    min-width: 42px;
    min-height: 38px;
    transition: all 0.2s;
}
.tk-cell-box:hover {
    border-color: rgba(102,126,234,0.25);
    background: rgba(102,126,234,0.03);
}
[data-theme="dark"] .tk-cell-box {
    background: rgba(255,255,255,0.025);
    border-color: rgba(255,255,255,0.08);
}
[data-theme="dark"] .tk-cell-box:hover {
    border-color: rgba(102,126,234,0.3);
    background: rgba(102,126,234,0.06);
}

.tk-pyq-box {
    gap: 8px;
    padding: 4px 8px;
}

/* ---- Custom Checkbox ---- */
.tk-checkbox-label { display: inline-flex; align-items: center; cursor: pointer; position: relative; }
.tk-checkbox {
    -webkit-appearance: none; -moz-appearance: none; appearance: none;
    width: 22px; height: 22px;
    border: 2px solid #d0d0d8;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    background: #fff;
}
.tk-checkbox:hover { border-color: #667eea; box-shadow: 0 0 0 3px rgba(102,126,234,0.1); }
.tk-checkbox:checked {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-color: transparent;
    box-shadow: 0 2px 6px rgba(102,126,234,0.3);
}
.tk-checkbox:checked::after {
    content: '✓'; position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%); color: #fff; font-size: 12px; font-weight: 700;
}
[data-theme="dark"] .tk-checkbox { background: #2a2a3c; border-color: #444; }
[data-theme="dark"] .tk-checkbox:hover { border-color: #667eea; box-shadow: 0 0 0 3px rgba(102,126,234,0.15); }
[data-theme="dark"] .tk-checkbox:checked { background: linear-gradient(135deg, #667eea, #764ba2); border-color: transparent; }

.tk-pyq-wrap { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.tk-pyq-label { font-size: 9px; font-weight: 600; color: #a0a0a8; letter-spacing: 0.3px; }
[data-theme="dark"] .tk-pyq-label { color: #606070; }

/* ---- Expand / Action Buttons ---- */
.tk-expand-btn {
    background: rgba(142,68,173,0.08); color: #8e44ad;
    border: 1.5px solid rgba(142,68,173,0.2);
    padding: 5px 12px; border-radius: 8px; cursor: pointer;
    font-size: 12px; font-weight: 600; font-family: inherit;
    transition: all 0.2s; white-space: nowrap;
}
.tk-expand-btn:hover { background: rgba(142,68,173,0.15); border-color: rgba(142,68,173,0.4); transform: translateY(-1px); }
[data-theme="dark"] .tk-expand-btn { background: rgba(142,68,173,0.12); color: #c39bd3; border-color: rgba(195,155,211,0.25); }

.tk-action-btns { display: flex; gap: 6px; justify-content: center; align-items: center; }
.tk-subtopic-btn {
    background: none; border: 1.5px solid rgba(102,126,234,0.3); color: #667eea;
    cursor: pointer; font-size: 12px; padding: 4px 8px; border-radius: 6px;
    transition: all 0.2s; font-family: inherit; white-space: nowrap;
}
.tk-subtopic-btn:hover { background: rgba(102,126,234,0.08); border-color: #667eea; transform: scale(1.05); }
[data-theme="dark"] .tk-subtopic-btn { border-color: rgba(102,126,234,0.4); color: #8898f0; }

.tk-remove-btn {
    background: none; border: none; color: #ccc; cursor: pointer;
    font-size: 14px; padding: 4px 6px; border-radius: 6px; transition: all 0.2s;
}
.tk-remove-btn:hover { color: #e74c3c; background: rgba(231,76,60,0.08); }

/* ---- Notes Button ---- */
.tk-notes-btn {
    background: rgba(243,156,18,0.08);
    color: #f39c12;
    border: 1.5px solid rgba(243,156,18,0.2);
    padding: 5px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.2s;
    white-space: nowrap;
}
.tk-notes-btn:hover {
    background: rgba(243,156,18,0.15);
    border-color: rgba(243,156,18,0.4);
    transform: translateY(-1px);
}
.tk-notes-btn.has-notes {
    background: rgba(243,156,18,0.15);
    border-color: rgba(243,156,18,0.35);
    color: #e67e22;
}
[data-theme="dark"] .tk-notes-btn {
    background: rgba(243,156,18,0.1);
    color: #f5b041;
    border-color: rgba(243,156,18,0.25);
}

/* ---- Notes Panel ---- */
.tk-row-notes td { padding: 0 !important; }
.tk-notes-panel {
    padding: 18px 24px;
    text-align: left;
    background: rgba(243,156,18,0.03);
    border-top: 1px solid rgba(243,156,18,0.08);
}
[data-theme="dark"] .tk-notes-panel {
    background: rgba(243,156,18,0.05);
    border-top-color: rgba(243,156,18,0.12);
}
.tk-notes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.tk-notes-header h4 {
    margin: 0;
    color: #e67e22;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}
[data-theme="dark"] .tk-notes-header h4 { color: #f5b041; }

.tk-notes-textarea {
    width: 100%;
    min-height: 80px;
    max-height: 200px;
    padding: 12px 14px;
    border: 1.5px solid rgba(243,156,18,0.15);
    border-radius: 10px;
    font-family: inherit;
    font-size: 13px;
    color: #333;
    background: #fff;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    line-height: 1.6;
}
.tk-notes-textarea:focus {
    border-color: #f39c12;
    box-shadow: 0 0 0 3px rgba(243,156,18,0.1);
}
[data-theme="dark"] .tk-notes-textarea {
    background: #2a2a3c;
    border-color: rgba(243,156,18,0.15);
    color: #d8d8e4;
}
[data-theme="dark"] .tk-notes-textarea:focus {
    border-color: #f39c12;
    box-shadow: 0 0 0 3px rgba(243,156,18,0.15);
}

/* ---- Scroll Buttons ---- */
.tk-scroll-btn {
    position: absolute;
    top: 0;
    bottom: 16px; /* leave room for the scrollbar */
    z-index: 20;
    width: 32px;
    border: none;
    background: rgba(255,255,255,0.85);
    color: #667eea;
    font-size: 26px; font-weight: 700;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.25s ease;
    line-height: 1;
}
.tk-scroll-btn.visible { opacity: 1; pointer-events: auto; }
.tk-scroll-btn:hover {
    background: rgba(255,255,255,0.98);
    color: #5a6fd6;
    box-shadow: 0 0 12px rgba(102,126,234,0.2);
}
.tk-scroll-btn:active { background: rgba(240,240,250,0.95); }

.tk-scroll-left { 
    left: 0; 
    border-radius: 12px 0 0 12px;
    box-shadow: 4px 0 12px rgba(0,0,0,0.05);
    border-right: 1px solid rgba(0,0,0,0.05);
}
.tk-scroll-right { 
    right: 0; 
    border-radius: 0 12px 12px 0;
    box-shadow: -4px 0 12px rgba(0,0,0,0.05);
    border-left: 1px solid rgba(0,0,0,0.05);
}

[data-theme="dark"] .tk-scroll-btn {
    background: rgba(30,30,45,0.85);
    color: #8898f0;
}
[data-theme="dark"] .tk-scroll-left {
    box-shadow: 4px 0 12px rgba(0,0,0,0.3);
    border-right: 1px solid rgba(255,255,255,0.05);
}
[data-theme="dark"] .tk-scroll-right {
    box-shadow: -4px 0 12px rgba(0,0,0,0.3);
    border-left: 1px solid rgba(255,255,255,0.05);
}
[data-theme="dark"] .tk-scroll-btn:hover {
    background: rgba(45,45,65,0.98);
    color: #a0b0ff;
    box-shadow: 0 0 12px rgba(102,126,234,0.3);
}

/* ---- Todo Panel ---- */
.tk-row-todo td {
    padding: 0 !important;
}

.tk-todo-panel {
    padding: 18px 24px;
    text-align: left;
    background: rgba(142,68,173,0.03);
    border-top: 1px solid rgba(142,68,173,0.08);
}
[data-theme="dark"] .tk-todo-panel { background: rgba(142,68,173,0.05); border-top-color: rgba(142,68,173,0.12); }

.tk-todo-indented { margin-left: 24px; border-left: 3px solid rgba(102,126,234,0.25); padding-left: 20px !important; }

.tk-todo-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.tk-todo-header h4 { margin: 0; color: #8e44ad; font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
[data-theme="dark"] .tk-todo-header h4 { color: #c39bd3; }

.tk-todo-input-row { display: flex; gap: 8px; margin-bottom: 14px; }
.tk-todo-input {
    flex-grow: 1; padding: 10px 14px;
    border: 1.5px solid #e0e0e8; border-radius: 10px;
    background: #fff; color: #333; font-family: inherit; font-size: 13px;
    transition: border-color 0.2s, box-shadow 0.2s; outline: none;
}
.tk-todo-input:focus { border-color: #667eea; box-shadow: 0 0 0 3px rgba(102,126,234,0.1); }
[data-theme="dark"] .tk-todo-input { border-color: #3a3a50; background: #2a2a3c; color: #d8d8e4; }
[data-theme="dark"] .tk-todo-input:focus { border-color: #667eea; box-shadow: 0 0 0 3px rgba(102,126,234,0.15); }

.tk-todo-add {
    padding: 10px 20px;
    background: linear-gradient(135deg, #8e44ad, #9b59b6);
    color: white; border: none; border-radius: 10px;
    cursor: pointer; font-weight: 600; font-family: inherit; font-size: 13px;
    transition: all 0.2s;
}
.tk-todo-add:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(142,68,173,0.3); }

.tk-todo-list { list-style: none; padding: 0; margin: 0; max-height: 220px; overflow-y: auto; }
.tk-todo-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 8px; margin-bottom: 4px; transition: background 0.15s;
}
.tk-todo-item:hover { background: rgba(142,68,173,0.04); }
[data-theme="dark"] .tk-todo-item:hover { background: rgba(142,68,173,0.08); }
.tk-todo-item.done .tk-todo-text { text-decoration: line-through; color: #aaa; }
.tk-todo-text { flex-grow: 1; font-size: 13px; color: #333; font-weight: 500; }
[data-theme="dark"] .tk-todo-text { color: #d0d0e4; }
.tk-todo-empty { color: #aaa; font-size: 13px; font-style: italic; padding: 12px; }

.tk-close-btn {
    background: transparent; color: #aaa; border: 1px solid #ddd;
    padding: 4px 10px; border-radius: 6px; font-size: 11px;
    font-family: inherit; font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.tk-close-btn:hover { background: #f0f0f0; color: #666; }
[data-theme="dark"] .tk-close-btn { border-color: #444; color: #888; }
[data-theme="dark"] .tk-close-btn:hover { background: #2a2a3c; color: #bbb; }

/* ---- Empty state ---- */
.tk-empty-td { padding: 0 !important; background: transparent !important; }
.tk-empty-state { padding: 60px 20px; text-align: center; color: #aaa; }
.tk-empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.tk-empty-text { font-size: 15px; font-weight: 500; }
.tk-empty-hint { font-size: 13px; color: #bbb; margin-top: 6px; }

/* ---- Modal Overrides ---- */
.tk-modal {
    border-radius: 16px !important; padding: 0 !important; overflow: hidden;
    max-width: 420px; width: 90vw; box-shadow: 0 20px 60px rgba(0,0,0,0.2) !important;
}
.tk-confirm-modal { max-width: 400px; }
.tk-modal-header {
    font-size: 17px; font-weight: 700; padding: 20px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff; display: flex; align-items: center; gap: 10px;
}
[data-theme="dark"] .tk-modal-header { background: linear-gradient(135deg, #2d1b69 0%, #11998e 100%); }
.tk-modal-icon { font-size: 22px; }
.tk-modal-body { padding: 24px; }
.tk-modal-footer {
    padding: 16px 24px; display: flex; justify-content: flex-end; gap: 10px;
    border-top: 1px solid rgba(0,0,0,0.06); background: #fafafe;
}
[data-theme="dark"] .tk-modal-footer { border-top-color: rgba(255,255,255,0.06); background: #1a1a2a; }
.tk-label { font-weight: 600; font-size: 13px; display: block; margin-bottom: 6px; color: #444; }
[data-theme="dark"] .tk-label { color: #bbb; }
.tk-input, .tk-select {
    width: 100%; padding: 10px 14px; border: 1.5px solid #e0e0e8; border-radius: 10px;
    font-family: inherit; font-size: 14px; color: #333; background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s; outline: none;
}
.tk-input:focus, .tk-select:focus { border-color: #667eea; box-shadow: 0 0 0 3px rgba(102,126,234,0.1); }
[data-theme="dark"] .tk-input, [data-theme="dark"] .tk-select { background: #2a2a3c; border-color: #3a3a50; color: #d8d8e4; }
[data-theme="dark"] .tk-input:focus, [data-theme="dark"] .tk-select:focus { border-color: #667eea; box-shadow: 0 0 0 3px rgba(102,126,234,0.15); }
.tk-parent-badge {
    background: rgba(102,126,234,0.06); border: 1px solid rgba(102,126,234,0.15);
    border-radius: 10px; padding: 10px 14px; margin-bottom: 16px;
    display: flex; flex-direction: column; gap: 4px;
}
[data-theme="dark"] .tk-parent-badge { background: rgba(102,126,234,0.1); border-color: rgba(102,126,234,0.2); }
[data-theme="dark"] .tk-parent-badge strong { color: #c0c8ff; }

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.tk-toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
    pointer-events: none;
}

.tk-toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    border-radius: 12px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    background: #333;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2), 0 2px 8px rgba(0,0,0,0.1);
    pointer-events: auto;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: none;
    backdrop-filter: blur(12px);
}
.tk-toast-show {
    animation: tk-toast-in 0.35s ease forwards;
}
.tk-toast-hide {
    animation: tk-toast-out 0.3s ease forwards;
}

@keyframes tk-toast-in {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes tk-toast-out {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to   { opacity: 0; transform: translateY(-10px) scale(0.95); }
}

.tk-toast-success { background: linear-gradient(135deg, #27ae60, #2ecc71); }
.tk-toast-error   { background: linear-gradient(135deg, #e74c3c, #c0392b); }
.tk-toast-warning { background: linear-gradient(135deg, #f39c12, #e67e22); }
.tk-toast-info    { background: linear-gradient(135deg, #667eea, #764ba2); }

.tk-toast-icon { font-size: 16px; flex-shrink: 0; }
.tk-toast-msg  { flex: 1; }

/* ---- Responsive ---- */
@media (max-width: 900px) {
    .tracker-header { flex-direction: column; gap: 16px; text-align: center; }
    .tk-header-left { flex-direction: column; }
    .tk-header-right { justify-content: center; }
    .tk-stats-row { grid-template-columns: repeat(2, 1fr); }
    .tk-table-wrapper { padding: 0 14px; }
    .tk-toolbar { flex-direction: column; align-items: stretch; }
    .tk-toolbar-right { justify-content: center; }
}
@media (max-width: 550px) {
    .tk-stats-row { grid-template-columns: 1fr; }
    .tracker-page { padding: 12px; }
    .tk-table-wrapper { padding: 0 8px; }
    .tk-search-wrap { max-width: 100%; }
    .tk-toolbar-right { flex-wrap: wrap; justify-content: center; }
}
