/* Custom table styles for Credit View components */
/* These styles ensure tables render properly within Filament infolists */

/* Table container */
.credit-table-container {
    overflow-x: auto;
    border: 1px solid rgb(229 231 235);
    border-radius: 0.5rem;
}

.dark .credit-table-container {
    border-color: rgb(255 255 255 / 0.1);
}

/* Table base */
.credit-table {
    width: 100%;
    font-size: 0.875rem;
    line-height: 1.25rem;
    border-collapse: collapse;
}

/* Table header */
.credit-table thead {
    background-color: rgb(249 250 251);
}

.dark .credit-table thead {
    background-color: rgb(255 255 255 / 0.05);
}

.credit-table th {
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    color: rgb(107 114 128);
}

.dark .credit-table th {
    color: rgb(156 163 175);
}

.credit-table th.text-right {
    text-align: right;
}

.credit-table th.text-center {
    text-align: center;
}

/* Table body */
.credit-table tbody {
    background-color: white;
}

.dark .credit-table tbody {
    background-color: rgb(17 24 39);
}

.credit-table tbody tr {
    border-bottom: 1px solid rgb(229 231 235);
}

.dark .credit-table tbody tr {
    border-bottom-color: rgb(255 255 255 / 0.05);
}

.credit-table tbody tr:hover {
    background-color: rgb(249 250 251);
}

.dark .credit-table tbody tr:hover {
    background-color: rgb(255 255 255 / 0.05);
}

/* Table cells */
.credit-table td {
    padding: 0.5rem 0.75rem;
}

.credit-table td.text-right {
    text-align: right;
}

.credit-table td.text-center {
    text-align: center;
}

/* Table footer */
.credit-table tfoot {
    background-color: rgb(249 250 251);
    font-weight: 500;
}

.dark .credit-table tfoot {
    background-color: rgb(255 255 255 / 0.05);
}

.credit-table tfoot td {
    padding: 0.5rem 0.75rem;
}

/* Row variants */
.credit-table tr.row-success {
    background-color: rgb(240 253 244);
}

.dark .credit-table tr.row-success {
    background-color: rgb(34 197 94 / 0.05);
}

.credit-table tr.row-danger {
    background-color: rgb(254 242 242);
}

.dark .credit-table tr.row-danger {
    background-color: rgb(239 68 68 / 0.05);
}

/* Stats cards */
.stats-grid {
    display: grid;
    gap: 1rem;
    margin-bottom: 1rem;
}

.stats-grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stats-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat-card {
    padding: 0.75rem;
    border-radius: 0.5rem;
    text-align: center;
}

.stat-card-default {
    background-color: rgb(243 244 246);
}

.dark .stat-card-default {
    background-color: rgb(255 255 255 / 0.05);
}

.stat-card-success {
    background-color: rgb(220 252 231);
}

.dark .stat-card-success {
    background-color: rgb(34 197 94 / 0.1);
}

.stat-card-danger {
    background-color: rgb(254 226 226);
}

.dark .stat-card-danger {
    background-color: rgb(239 68 68 / 0.1);
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
}

.stat-value-success {
    color: rgb(22 163 74);
}

.dark .stat-value-success {
    color: rgb(74 222 128);
}

.stat-value-danger {
    color: rgb(220 38 38);
}

.dark .stat-value-danger {
    color: rgb(248 113 113);
}

.stat-label {
    font-size: 0.75rem;
    color: rgb(107 114 128);
}

.dark .stat-label {
    color: rgb(156 163 175);
}

/* Badges */
.credit-badge {
    display: inline-flex;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
}

.badge-success {
    background-color: rgb(220 252 231);
    color: rgb(21 128 61);
}

.dark .badge-success {
    background-color: rgb(34 197 94 / 0.2);
    color: rgb(74 222 128);
}

.badge-danger {
    background-color: rgb(254 226 226);
    color: rgb(185 28 28);
}

.dark .badge-danger {
    background-color: rgb(239 68 68 / 0.2);
    color: rgb(248 113 113);
}

.badge-warning {
    background-color: rgb(254 249 195);
    color: rgb(161 98 7);
}

.dark .badge-warning {
    background-color: rgb(234 179 8 / 0.2);
    color: rgb(250 204 21);
}

.badge-info {
    background-color: rgb(219 234 254);
    color: rgb(29 78 216);
}

.dark .badge-info {
    background-color: rgb(59 130 246 / 0.2);
    color: rgb(96 165 250);
}

.badge-gray {
    background-color: rgb(243 244 246);
    color: rgb(55 65 81);
}

.dark .badge-gray {
    background-color: rgb(107 114 128 / 0.2);
    color: rgb(156 163 175);
}

.badge-purple {
    background-color: rgb(243 232 255);
    color: rgb(126 34 206);
}

.dark .badge-purple {
    background-color: rgb(168 85 247 / 0.2);
    color: rgb(192 132 252);
}

/* Money formatting */
.money {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.money-success {
    color: rgb(22 163 74);
}

.dark .money-success {
    color: rgb(74 222 128);
}

.money-danger {
    color: rgb(220 38 38);
}

.dark .money-danger {
    color: rgb(248 113 113);
}

/* Empty state */
.empty-state {
    padding: 2rem 0.75rem;
    text-align: center;
    color: rgb(107 114 128);
}

.dark .empty-state {
    color: rgb(156 163 175);
}

/* Timeline styles */
.timeline-container {
    position: relative;
}

.timeline-line {
    position: absolute;
    left: 1.25rem;
    top: 0;
    height: 100%;
    width: 2px;
    background-color: rgb(229 231 235);
}

.dark .timeline-line {
    background-color: rgb(55 65 81);
}

.timeline-events {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.timeline-event {
    position: relative;
    display: flex;
    gap: 1rem;
}

.timeline-icon {
    position: relative;
    z-index: 10;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 9999px;
    box-shadow: 0 0 0 4px white;
}

.dark .timeline-icon {
    box-shadow: 0 0 0 4px rgb(17 24 39);
}

.timeline-icon svg {
    width: 1.25rem;
    height: 1.25rem;
}

.timeline-icon-success {
    background-color: rgb(220 252 231);
}
.timeline-icon-success svg {
    color: rgb(22 163 74);
}
.dark .timeline-icon-success {
    background-color: rgb(34 197 94 / 0.3);
}
.dark .timeline-icon-success svg {
    color: rgb(74 222 128);
}

.timeline-icon-danger {
    background-color: rgb(254 226 226);
}
.timeline-icon-danger svg {
    color: rgb(220 38 38);
}
.dark .timeline-icon-danger {
    background-color: rgb(239 68 68 / 0.3);
}
.dark .timeline-icon-danger svg {
    color: rgb(248 113 113);
}

.timeline-icon-warning {
    background-color: rgb(254 249 195);
}
.timeline-icon-warning svg {
    color: rgb(161 98 7);
}
.dark .timeline-icon-warning {
    background-color: rgb(234 179 8 / 0.3);
}
.dark .timeline-icon-warning svg {
    color: rgb(250 204 21);
}

.timeline-icon-info {
    background-color: rgb(219 234 254);
}
.timeline-icon-info svg {
    color: rgb(29 78 216);
}
.dark .timeline-icon-info {
    background-color: rgb(59 130 246 / 0.3);
}
.dark .timeline-icon-info svg {
    color: rgb(96 165 250);
}

.timeline-icon-purple {
    background-color: rgb(243 232 255);
}
.timeline-icon-purple svg {
    color: rgb(126 34 206);
}
.dark .timeline-icon-purple {
    background-color: rgb(168 85 247 / 0.3);
}
.dark .timeline-icon-purple svg {
    color: rgb(192 132 252);
}

.timeline-icon-gray {
    background-color: rgb(243 244 246);
}
.timeline-icon-gray svg {
    color: rgb(107 114 128);
}
.dark .timeline-icon-gray {
    background-color: rgb(107 114 128 / 0.3);
}
.dark .timeline-icon-gray svg {
    color: rgb(156 163 175);
}

.timeline-content {
    flex: 1;
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid rgb(229 231 235);
    background-color: white;
}

.dark .timeline-content {
    border-color: rgb(55 65 81);
    background-color: rgb(17 24 39);
}

.timeline-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.timeline-date {
    text-align: right;
    font-size: 0.75rem;
    color: rgb(107 114 128);
}

.dark .timeline-date {
    color: rgb(156 163 175);
}

.timeline-meta {
    margin-top: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    font-size: 0.75rem;
    color: rgb(107 114 128);
}

.dark .timeline-meta {
    color: rgb(156 163 175);
}

.timeline-meta-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.timeline-meta-item svg {
    width: 1rem;
    height: 1rem;
}

.timeline-details {
    margin-top: 0.5rem;
}

.timeline-details summary {
    cursor: pointer;
    font-size: 0.75rem;
    color: rgb(107 114 128);
}

.timeline-details summary:hover {
    color: rgb(55 65 81);
}

.dark .timeline-details summary:hover {
    color: rgb(209 213 219);
}

.timeline-details pre {
    margin-top: 0.5rem;
    overflow-x: auto;
    border-radius: 0.25rem;
    background-color: rgb(249 250 251);
    padding: 0.5rem;
    font-size: 0.75rem;
}

.dark .timeline-details pre {
    background-color: rgb(31 41 55);
}

.timeline-note {
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: rgb(75 85 99);
}

.dark .timeline-note {
    color: rgb(156 163 175);
}

.timeline-footer {
    margin-top: 1rem;
    text-align: center;
    font-size: 0.75rem;
    color: rgb(107 114 128);
}

.dark .timeline-footer {
    color: rgb(156 163 175);
}

/* ================================================
   Lineage Component Styles
   ================================================ */

.lineage-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.75rem;
    color: rgb(107 114 128);
}

.dark .lineage-legend {
    color: rgb(156 163 175);
}

.lineage-legend-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.lineage-legend-dot {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 9999px;
}

.lineage-legend-dot-purple {
    background-color: rgb(168 85 247);
}

.lineage-legend-dot-blue {
    background-color: rgb(59 130 246);
}

.lineage-legend-dot-gray {
    background-color: rgb(156 163 175);
}

.lineage-container {
    position: relative;
}

.lineage-line {
    position: absolute;
    left: 1.25rem;
    top: 0;
    height: 100%;
    width: 2px;
    background-color: rgb(229 231 235);
}

.dark .lineage-line {
    background-color: rgb(55 65 81);
}

.lineage-items {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.lineage-item {
    position: relative;
    display: flex;
    gap: 1rem;
}

.lineage-item-child {
    margin-left: 1.5rem;
}

.lineage-icon {
    position: relative;
    z-index: 10;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 9999px;
    box-shadow: 0 0 0 4px white;
}

.dark .lineage-icon {
    box-shadow: 0 0 0 4px rgb(17 24 39);
}

.lineage-icon svg {
    width: 1.25rem;
    height: 1.25rem;
}

.lineage-icon-purple {
    background-color: rgb(243 232 255);
}
.lineage-icon-purple svg {
    color: rgb(126 34 206);
}
.dark .lineage-icon-purple {
    background-color: rgb(168 85 247 / 0.3);
}
.dark .lineage-icon-purple svg {
    color: rgb(192 132 252);
}

.lineage-icon-success {
    background-color: rgb(220 252 231);
}
.lineage-icon-success svg {
    color: rgb(22 163 74);
}
.dark .lineage-icon-success {
    background-color: rgb(34 197 94 / 0.3);
}
.dark .lineage-icon-success svg {
    color: rgb(74 222 128);
}

.lineage-icon-warning {
    background-color: rgb(254 249 195);
}
.lineage-icon-warning svg {
    color: rgb(161 98 7);
}
.dark .lineage-icon-warning {
    background-color: rgb(234 179 8 / 0.3);
}
.dark .lineage-icon-warning svg {
    color: rgb(250 204 21);
}

.lineage-icon-info {
    background-color: rgb(219 234 254);
}
.lineage-icon-info svg {
    color: rgb(29 78 216);
}
.dark .lineage-icon-info {
    background-color: rgb(59 130 246 / 0.3);
}
.dark .lineage-icon-info svg {
    color: rgb(96 165 250);
}

.lineage-icon-gray {
    background-color: rgb(243 244 246);
}
.lineage-icon-gray svg {
    color: rgb(107 114 128);
}
.dark .lineage-icon-gray {
    background-color: rgb(107 114 128 / 0.3);
}
.dark .lineage-icon-gray svg {
    color: rgb(156 163 175);
}

.lineage-icon-current {
    background-color: rgb(219 234 254);
    box-shadow: 0 0 0 4px white, 0 0 0 6px rgb(59 130 246 / 0.3);
}
.lineage-icon-current svg {
    color: rgb(37 99 235);
}
.dark .lineage-icon-current {
    background-color: rgb(59 130 246 / 0.3);
    box-shadow: 0 0 0 4px rgb(17 24 39), 0 0 0 6px rgb(59 130 246 / 0.3);
}
.dark .lineage-icon-current svg {
    color: rgb(96 165 250);
}

.lineage-content {
    flex: 1;
    display: block;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid rgb(229 231 235);
    background-color: white;
    text-decoration: none;
    transition: all 0.15s ease;
}

.dark .lineage-content {
    border-color: rgb(55 65 81);
    background-color: rgb(17 24 39);
}

.lineage-content-ancestor:hover,
.lineage-content-child:hover {
    border-color: rgb(168 85 247);
    background-color: rgb(250 245 255);
}

.dark .lineage-content-ancestor:hover,
.dark .lineage-content-child:hover {
    border-color: rgb(168 85 247);
    background-color: rgb(168 85 247 / 0.1);
}

.lineage-content-current {
    border-color: rgb(59 130 246);
    border-width: 2px;
    background-color: rgb(239 246 255);
}

.dark .lineage-content-current {
    border-color: rgb(59 130 246);
    background-color: rgb(59 130 246 / 0.1);
}

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

.lineage-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: rgb(17 24 39);
}

.dark .lineage-title {
    color: rgb(243 244 246);
}

.lineage-subtitle {
    font-size: 0.75rem;
    color: rgb(107 114 128);
    margin-top: 0.125rem;
}

.dark .lineage-subtitle {
    color: rgb(156 163 175);
}

.lineage-right {
    flex-shrink: 0;
}

.lineage-meta {
    margin-top: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: rgb(107 114 128);
}

.dark .lineage-meta {
    color: rgb(156 163 175);
}

.lineage-meta-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.lineage-meta-item svg {
    width: 0.875rem;
    height: 0.875rem;
}

.lineage-summary {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgb(229 231 235);
}

.dark .lineage-summary {
    border-top-color: rgb(55 65 81);
}

.lineage-summary-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: rgb(55 65 81);
    margin-bottom: 0.75rem;
}

.dark .lineage-summary-title {
    color: rgb(209 213 219);
}

/* ================================================
   Audit Changes Table Styles
   ================================================ */

.audit-changes-table .audit-field-label {
    font-weight: 500;
    color: rgb(55 65 81);
    white-space: nowrap;
}

.dark .audit-changes-table .audit-field-label {
    color: rgb(209 213 219);
}

.audit-changes-table .audit-cell-before {
    background-color: rgb(254 252 248);
}

.dark .audit-changes-table .audit-cell-before {
    background-color: rgb(255 255 255 / 0.02);
}

.audit-changes-table .audit-cell-after {
    background-color: rgb(248 252 251);
}

.dark .audit-changes-table .audit-cell-after {
    background-color: rgb(255 255 255 / 0.04);
}

.audit-changes-table .audit-col-before,
.audit-changes-table .audit-col-after {
    min-width: 8rem;
}

/* Audit event detail */
.audit-event-summary {
    font-size: 0.875rem;
    color: rgb(75 85 99);
    margin-top: 0.25rem;
}

.dark .audit-event-summary {
    color: rgb(156 163 175);
}

.audit-event-reason {
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    font-style: italic;
    color: rgb(75 85 99);
    background-color: rgb(249 250 251);
    border-left: 3px solid rgb(209 213 219);
    border-radius: 0 0.25rem 0.25rem 0;
}

.dark .audit-event-reason {
    color: rgb(156 163 175);
    background-color: rgb(255 255 255 / 0.03);
    border-left-color: rgb(75 85 99);
}

/* Audit data block (key-value pairs) */
.audit-data-block {
    display: grid;
    gap: 0.375rem;
}

.audit-data-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 0.8125rem;
    line-height: 1.5;
}

.audit-data-key {
    flex-shrink: 0;
    color: rgb(107 114 128);
    min-width: 10rem;
}

.dark .audit-data-key {
    color: rgb(156 163 175);
}

.audit-data-value {
    font-weight: 500;
    color: rgb(17 24 39);
}

.dark .audit-data-value {
    color: rgb(243 244 246);
}

.audit-data-separator {
    flex: 1;
    border-bottom: 1px dotted rgb(209 213 219);
    min-width: 1rem;
    margin-bottom: 0.25rem;
}

.dark .audit-data-separator {
    border-bottom-color: rgb(55 65 81);
}

/* Timeline summary text */
.timeline-summary {
    margin-top: 0.25rem;
    font-size: 0.8125rem;
    color: rgb(75 85 99);
}

.dark .timeline-summary {
    color: rgb(156 163 175);
}

/* Timeline translated data in details */
.timeline-data-block {
    margin-top: 0.5rem;
    padding: 0.5rem 0;
}

.timeline-data-row {
    display: flex;
    justify-content: space-between;
    padding: 0.125rem 0;
    font-size: 0.75rem;
    border-bottom: 1px dotted rgb(229 231 235);
}

.dark .timeline-data-row {
    border-bottom-color: rgb(55 65 81);
}

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

.timeline-data-key {
    color: rgb(107 114 128);
}

.dark .timeline-data-key {
    color: rgb(156 163 175);
}

.timeline-data-value {
    font-weight: 500;
    color: rgb(17 24 39);
}

.dark .timeline-data-value {
    color: rgb(243 244 246);
}
