:root {
    --primary-color: #203062;
    --accent-color: #99bae3;
    --bg-color: #f4f1ed;
}

html {
    font-size: 14px;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
    position: relative;
    min-height: 100%;
}

body {
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

#wrapper {
    display: flex;
    width: 100%;
    align-items: stretch;
    background-color: #f4f1ed; 
}

#sidebar {
    min-width: 250px;
    max-width: 250px;
    background: #203062; 
    color: #f4f1ed;
    transition: margin-left 0.3s ease-in-out; 
    min-height: 100vh;
    box-shadow: 2px 0 5px rgba(0,0,0,0.05);
}

#sidebar.active {
    margin-left: -250px;
}

#sidebar .sidebar-header {
    padding: 20px;
    background: #152044;
    border-bottom: 1px solid #99bae3; 
}

#sidebar ul.components {
    padding: 20px 0;
}

#sidebar ul li a {
    color: #99bae3; 
    padding: 12px 20px;
    display: block;
    text-decoration: none;
    transition: all 0.2s;
}

#sidebar ul li a:hover {
    color: #ffffff; 
    background: #2a3d7a; 
    border-left: 4px solid #99bae3; 
}

#sidebar .nav-link {
    color: #99bae3 !important;
}

#sidebar .nav-link:hover {
    color: #ffffff !important;
}

#content {
    width: 100%;
    padding: 20px;
    background-color: #f4f1ed; 
    transition: all 0.3s ease-in-out;
}

#sidebar-toggle {
    background-color: #203062; 
    border: none;
}

#sidebar-toggle:checked ~ #sidebar {
    margin-left: -250px;
}

#sidebar-toggle:checked ~ #content #sidebarCollapse {
    background-color: #203062;
}

#sidebarCollapse {
    background-color: #ffffff !important; 
    border: 1px solid #99bae3 !important; 
    color: #203062 !important; 
    padding: 5px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

#sidebarCollapse .navbar-toggler-icon {
    filter: invert(14%) sepia(26%) saturate(3015%) hue-rotate(207deg) brightness(91%) contrast(93%); 
    width: 1.2em;
    height: 1.2em;
}

#sidebarCollapse:hover {
    background-color: #99bae3 !important; 
    color: #203062 !important;
    border-color: #203062 !important;
}

.no-transition {
    transition: none !important;
}

.dataTables_wrapper .dataTables_filter {
    float: right;
    margin-bottom: 1rem;
}

.dataTables_wrapper .dataTables_length {
    float: left;
    margin-bottom: 1rem;
}

thead.table-light th {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

table.nowrap th,
table.nowrap td {
    white-space: nowrap;
}

.table-responsive::-webkit-scrollbar {
    height: 6px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 10px;
}

#content {
    flex: 1;
    min-width: 0;
    overflow-x: hidden;
}

.address-column {
    min-width: 200px;
    max-width: 300px;
    white-space: normal !important; 
    word-wrap: break-word;
    line-height: 1.4;
    font-size: 0.9rem;
}

th, td {
    vertical-align: middle !important;
    text-align: center !important;
}

#addRowForm td {
    padding: 5px !important;
    vertical-align: middle;
}

.table-input-sm {
    width: 100%;
    max-width: 110px;
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

.table-input-flat {
    width: 100%;
    max-width: 110px;
    border: none;
    border-bottom: 2px solid #ddd;
    background: transparent;
    padding: 4px 0;
    font-size: 13px;
    border-radius: 0;
}

.table-input-flat:focus {
    outline: none;
    border-bottom-color: #28a745;
}

thead th.vertical-header {
    writing-mode: vertical-lr;
    transform: rotate(180deg);
    text-align: center;
    vertical-align: bottom;
    height: 100px; 
    max-width: 35px; 
    white-space: nowrap; 

    padding: 12px 4px !important;
}

thead tr:nth-child(2) th {
    writing-mode: horizontal-tb !important;
    transform: none !important;
    height: auto !important;
}

.custom-card-hover {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.custom-card {
    border-radius: 10px !important;
    background-color: #ffffff !important;
    transition: transform 0.2s ease;
}

.custom-card .card-header {
    background-color: transparent !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
}

.custom-card .stat-number {
    font-weight: 700 !important;
}

.card-green {
    border: 2px solid #2e7d32 !important;
    box-shadow: inset 0 0 0 2px rgba(46, 125, 50, 0.15) !important;
}

.card-green .stat-number {
    color: #2e7d32 !important;
}

.card-blue {
    border: 2px solid #1976d2 !important;
    box-shadow: inset 0 0 0 2px rgba(25, 118, 210, 0.15) !important;
}

.card-blue .stat-number {
    color: #1976d2 !important;
}

.card-purple {
    border: 2px solid #7b1fa2 !important;
    box-shadow: inset 0 0 0 2px rgba(123, 31, 162, 0.15) !important;
}

.card-purple .stat-number {
    color: #7b1fa2 !important;
}

.card-red {
    border: 2px solid #d32f2f !important;
    box-shadow: inset 0 0 0 2px rgba(211, 47, 47, 0.15) !important;
}

.card-red .stat-number {
    color: #d32f2f !important;
}

.card-yellow {
    border: 2px solid #FDDA0D !important;
    box-shadow: inset 0 0 0 2px rgba(245, 124, 0, 0.15) !important;
}

.card-yellow .stat-number {
    color: #FDDA0D !important;
}

.custom-card-hover:hover .custom-card {
    transform: translateY(-3px);
}

.btn-track-toggle {
    font-size: 0.85rem !important;
    border-color: rgba(0, 0, 0, 0.08) !important;
}
.btn-track-toggle.active {
    background-color: #0d6efd !important;
    border-color: #0d6efd !important;
}

.split-rows-container .tracker-row {
    background-color: #ffffff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
    transition: background-color 0.15s ease-in-out;
}

.split-rows-container .tracker-row:hover {
    background-color: #f8f9fa;
}

.split-rows-container .tracker-row:last-child {
    border-bottom: none !important;
}

.tracker-label {
    font-size: 1.1rem;
    color: #495057 !important;
}

.tracker-value {
    font-size: 2.2rem;
    font-weight: 400;
    color: #212529;
    font-family: system-ui, -apple-system, sans-serif;
}

.small-badge {
    font-size: 0.8rem !important;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.tk-dashboard {
    display: flex;
    height: 87vh;
    box-sizing: border-box;
    background-color: #f8fafc;
    overflow: hidden;
    position: relative;
}

.tk-sidebar {
    width: 220px;
    flex-shrink: 0;
    background-color: #ffffff;
    color: #1e293b;
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    border-right: 1px solid #e2e8f0;
    transition: transform 0.3s ease;
}

.tk-btn-compose {
    background-color: #1e3a8a;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.tk-btn-compose:hover {
    background-color: #172554;
}

.tk-nav-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}

.tk-nav-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-decoration: none;
    color: #64748b;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

    .tk-nav-link:hover {
        background-color: #f1f5f9;
        color: #0f172a;
    }

    .tk-nav-link.tk-active {
        background-color: #e0f2fe;
        color: #0369a1;
        font-weight: 600;
    }

.tk-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: bold;
}

.tk-badge-open {
    background-color: #dcfce7;
    color: #166534;
}

.tk-badge-progress {
    background-color: #f1f5f9;
    color: #334155;
}

.tk-badge-high {
    background-color: #fee2e2;
    color: #991b1b;
}

.tk-badge-total {
    background-color: #fef3c7;
    color: #92400e;
    font-size: 18px;
    animation: total-pulse 2s infinite ease-in-out;
}

@keyframes total-pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(107, 33, 168, 0.4);
    }

    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(107, 33, 168, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(107, 33, 168, 0);
    }
}

.tk-list-pane {
    width: 300px;
    flex-shrink: 0;
    background-color: #ffffff;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.tk-list-header {
    padding: 15px;
    border-bottom: 1px solid #e2e8f0;
}

.tk-search-bar {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background-color: #f8fafc;
    box-sizing: border-box; 
}

.tk-list-items {
    flex: 1;
    overflow-y: auto;
}

.tk-item {
    padding: 10px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.tk-item:hover {
    background-color: #f8fafc;
}

.tk-item-active {
    background-color: #f0fdf4;
    border-left: 4px solid #22c55e;
}

.tk-item-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #64748b;
}

.tk-id {
    font-weight: 700;
}

.tk-item-subject {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}

.tk-tag-container {
    display: flex;
    gap: 6px;
    flex-wrap: wrap; 
}

.tk-tag {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
}

.tk-tag-high {
    background-color: #fee2e2;
    color: #ef4444;
}

.tk-tag-medium {
    background-color: #fef3c7;
    color: #d97706;
}

.tk-tag-low {
    background-color: #f1f5f9;
    color: #64748b;
}

.tk-tag-open {
    background-color: #dcfce7;
    color: #22c55e;
}

.tk-tag-progress {
    background-color: #e0f2fe;
    color: #3b82f6;
}

.tk-tag-completed {
    background-color: #e0e7ff;
    color: #4f46e5;
}

.tk-detail-pane {
    flex: 1;
    min-width: 0;
    background-color: #ffffff;
    display: flex;
    flex-direction: column;
}

.tk-detail-header {
    padding: 12px;
    border-bottom: 1px solid #e2e8f0;
    background-color: #f8fafc;
}

.tk-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    width: 100%;
}

.tk-metadata-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    font-size: 13px;
    color: #475569;
}

.tk-metadata-grid > * {
    flex: 1 1 calc(50% - 12px);
    min-width: 180px;
}

.tk-detail-body {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
}

.tk-timeline {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.tk-timeline-item {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

.tk-timeline-meta {
    background-color: #f1f5f9;
    padding: 10px 15px;
    font-size: 12px;
    color: #64748b;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center; 
    gap: 5px;
}

.tk-meta-right {
    display: flex;
    align-items: center;
}

.tk-timeline-content {
    padding: 15px;
    font-size: 14px;
    line-height: 1.5;
    color: #334155;
    white-space: pre-wrap;
    word-break: break-word;
}

.tk-post-agent {
    border-left: 4px solid #3b82f6;
}

.tk-post-note {
    border-left: 4px solid #22c55e;
}

.tk-detail-footer {
    padding: 20px;
    border-top: 1px solid #e2e8f0;
    background-color: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tk-reply-box {
    width: 100%;
    height: 100px;
    padding: 14px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    resize: none;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
}

.tk-reply-box:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.tk-footer-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.tk-btn {
    padding: 10px 16px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
}

.tk-btn-primary {
    background-color: #22c55e;
    color: white;
    border: none;
}

.tk-btn-secondary {
    background-color: #ffffff;
    color: #475569;
    border: 1px solid #cbd5e1;
}

.tk-btn-primary:hover {
    background-color: #16a34a;
}

.tk-btn-secondary:hover {
    background-color: #f1f5f9;
}

@media (max-width: 767px) {
    .tk-dashboard {
        height: auto;
        flex-direction: column; 
        overflow: visible; 
    }

    .tk-sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
        box-sizing: border-box;
    }

    .tk-list-pane {
        width: 100%;
        height: 400px; 
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
        flex-shrink: 0;
    }

    .tk-detail-pane {
        width: 100%;
        height: auto;
        min-height: 500px;
        display: flex;
        flex-direction: column;
    }

    .tk-detail-header,
    .tk-detail-body,
    .tk-detail-footer {
        padding: 16px;
    }

    .tk-metadata-grid {
        grid-template-columns: 1fr 1fr; 
        gap: 8px;
    }

    .tk-footer-actions {
        flex-direction: column-reverse; 
        gap: 8px;
    }

    .tk-btn {
        width: 100%;
        text-align: center;
    }
}