:root {
    --ct-brand: #89f336;
    --ct-charcoal: #151515;
    --ct-bg: #f7f7f7;
    --ct-surface: #ffffff;
    --ct-border: #e4e4e4;
    --ct-border-subtle: #eeeeee;
    --ct-text-primary: #151515;
    --ct-text-secondary: #4f4f4f;
    --ct-text-tertiary: #8a8a8a;
    --ct-accent: #89f336;
    --ct-on-accent: #151515;
    --ct-accent-text: #3f7a0c;
    --ct-accent-soft: #eefbe2;
    --ct-header-bg: #151515;
    --ct-header-text: #f7f7f7;
    --ct-header-muted: #a3a3a3;
    --ct-header-border: #2a2a2a;
    --ct-radius: 12px;
    --ct-shadow: 0 1px 2px rgba(21, 21, 21, .04), 0 4px 12px rgba(21, 21, 21, .05);
    --ct-shadow-hover: 0 2px 6px rgba(21, 21, 21, .06), 0 10px 24px rgba(21, 21, 21, .09);
}

body[data-theme="dark"] {
    --ct-bg: #0f0f0f;
    --ct-surface: #1b1b1b;
    --ct-border: #2e2e2e;
    --ct-border-subtle: #262626;
    --ct-text-primary: #f2f2f2;
    --ct-text-secondary: #b5b5b5;
    --ct-text-tertiary: #7a7a7a;
    --ct-accent: #89f336;
    --ct-on-accent: #151515;
    --ct-accent-text: #89f336;
    --ct-accent-soft: rgba(137, 243, 54, .12);
    --ct-header-bg: #151515;
    --ct-header-border: #262626;
    --ct-shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 4px 12px rgba(0, 0, 0, .3);
    --ct-shadow-hover: 0 2px 6px rgba(0, 0, 0, .4), 0 10px 24px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Inter', 'Segoe UI', Roboto, Arial, sans-serif;
    background: var(--ct-bg);
    color: var(--ct-text-primary);
    -webkit-font-smoothing: antialiased;
}

body.embed-mode header {
    display: none;
}

.impersonate-banner {
    background: var(--ct-brand);
    color: #151515;
    text-align: center;
    padding: .55rem 1rem;
    font-size: .82rem;
    position: sticky;
    top: 0;
    left: 0;
    z-index: 501;
}

.impersonate-banner a {
    color: #151515;
    font-weight: 700;
    margin-left: .6rem;
}

header {
    background: var(--ct-header-bg);
    color: var(--ct-header-text);
    border-bottom: 1px solid var(--ct-header-border);
    padding: .75rem 1.5rem;
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
    position: sticky;
    top: 0;
    left: 0;
    z-index: 500;
}

.header-left {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.theme-toggle {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .05em;
    color: var(--ct-header-muted);
    text-transform: uppercase;
    cursor: pointer;
}

.theme-switch {
    position: relative;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-switch-slider {
    position: absolute;
    inset: 0;
    background: #3a3a3a;
    border-radius: 999px;
    cursor: pointer;
    transition: background .2s ease;
}

.theme-switch-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
}

.theme-switch input:checked + .theme-switch-slider {
    background: var(--ct-accent);
}

.theme-switch input:checked + .theme-switch-slider::before {
    transform: translateX(22px);
}

header .mark {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    background: var(--ct-brand);
    box-shadow: 0 0 0 4px rgba(137, 243, 54, .15);
    flex-shrink: 0;
}

header h1 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -.01em;
    color: var(--ct-header-text);
    white-space: nowrap;
}

.header-sep {
    width: 1px;
    height: 24px;
    background: var(--ct-header-border);
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    color: var(--ct-header-muted);
    text-decoration: none;
    font-size: .85rem;
    font-weight: 500;
    padding: .5rem .75rem;
    border-radius: 8px;
    transition: background .15s ease, color .15s ease;
}

.nav-link:hover {
    color: var(--ct-header-text);
    background: rgba(255, 255, 255, .06);
}

.nav-link.active {
    color: var(--ct-brand);
}

.icon-btn svg, .nav-link svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
}

.layout {
    display: flex;
    align-items: flex-start;
}

.header-right {
    display: flex;
    align-items: center;
    gap: .35rem;
}

.dashboard-switcher {
    display: flex;
    align-items: center;
    gap: .25rem;
    flex: 1;
    margin-left: 1rem;
    padding: .25rem;
    min-width: 0;
}

.dashboard-switcher select {
    appearance: none;
    -webkit-appearance: none;
    padding: .55rem 2.2rem .55rem .9rem;
    border: 1px solid var(--ct-header-border);
    border-radius: 10px;
    background: #1f1f1f url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2389f336' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right .8rem center;
    color: var(--ct-header-text);
    font-family: inherit;
    font-size: .9rem;
    font-weight: 600;
    min-width: 180px;
    max-width: 280px;
    cursor: pointer;
    transition: border-color .15s ease;
}

.dashboard-switcher select:hover,
.dashboard-switcher select:focus {
    border-color: var(--ct-brand);
    outline: none;
}

.icon-btn {
    border: 1px solid transparent;
    background: transparent;
    border-radius: 10px;
    width: 38px;
    height: 38px;
    cursor: pointer;
    font-size: 1rem;
    color: var(--ct-header-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s ease, color .15s ease;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, .07);
    color: var(--ct-header-text);
}

.icon-btn.icon-btn-accent {
    background: var(--ct-brand);
    color: var(--ct-charcoal);
}

.icon-btn.icon-btn-accent:hover {
    filter: brightness(1.08);
    background: var(--ct-brand);
    color: var(--ct-charcoal);
}

.icon-btn.icon-btn-danger:hover {
    color: #ff6b5e;
}

:focus-visible {
    outline: 2px solid var(--ct-brand);
    outline-offset: 2px;
}

.notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #e5484d;
    color: #fff;
    font-size: .62rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
}

.notif-item {
    border: 1px solid var(--ct-border-subtle);
    border-radius: 8px;
    padding: .6rem .7rem;
    margin-bottom: .5rem;
    font-size: .8rem;
}

.notif-item .notif-title {
    font-weight: 600;
    color: var(--ct-text-primary);
    margin-bottom: .15rem;
}

.notif-item .notif-detail {
    color: var(--ct-text-secondary);
    font-size: .76rem;
}

.notif-item .notif-time {
    color: var(--ct-text-tertiary);
    font-size: .68rem;
    margin-top: .25rem;
}

.notif-empty {
    color: var(--ct-text-secondary);
    font-size: .8rem;
    text-align: center;
    padding: 1rem 0;
}

.add-chart-wrapper {
    position: relative;
}

.add-chart-button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: var(--ct-accent);
    color: var(--ct-on-accent);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: filter .15s ease;
}

.add-chart-button:hover {
    filter: brightness(1.1);
}

.floating-add-chart {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 900;
}

.floating-add-chart .add-chart-button {
    width: 56px;
    height: 56px;
    font-size: 2rem;
    box-shadow: 0 6px 20px rgba(137, 243, 54, .35), 0 2px 6px rgba(21, 21, 21, .25);
}

.floating-add-chart .add-chart-dropdown {
    top: auto;
    bottom: calc(100% + 12px);
    right: 0;
}

.add-chart-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 280px;
    max-height: 70vh;
    overflow-y: auto;
    background: var(--ct-surface);
    border: 1px solid var(--ct-border);
    border-radius: 12px;
    box-shadow: var(--ct-shadow-hover);
    padding: 1.1rem;
    z-index: 950;
    color: var(--ct-text-primary);
    scrollbar-color: var(--ct-border) transparent;
    scrollbar-width: thin;
}

.add-chart-dropdown::-webkit-scrollbar {
    width: 8px;
}

.add-chart-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.add-chart-dropdown::-webkit-scrollbar-thumb {
    background: var(--ct-border);
    border-radius: 8px;
}

.add-chart-dropdown::-webkit-scrollbar-thumb:hover {
    background: var(--ct-text-tertiary);
}

.add-chart-dropdown.open {
    display: block;
}

.add-chart-dropdown h2 {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--ct-text-tertiary);
    font-weight: 600;
    margin: 0 .25rem .9rem .25rem;
}

.palette-item {
    display: flex;
    align-items: center;
    gap: .65rem;
    border: 1px solid var(--ct-border-subtle);
    border-radius: 10px;
    padding: .7rem .75rem;
    margin-bottom: .55rem;
    cursor: grab;
    background: var(--ct-surface);
    font-size: .85rem;
    font-weight: 500;
    color: var(--ct-text-primary);
    user-select: none;
    transition: box-shadow .15s ease, border-color .15s ease, transform .1s ease;
}

.palette-item:hover {
    box-shadow: var(--ct-shadow);
    border-color: var(--ct-border);
}

.palette-item:active {
    cursor: grabbing;
    transform: scale(.98);
}

.palette-icon {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    border-radius: 8px;
    background: var(--ct-accent-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ct-accent-text);
}

.palette-hint {
    font-size: .76rem;
    color: var(--ct-text-tertiary);
    margin: 1.1rem .25rem 0 .25rem;
    line-height: 1.5;
}

.palette-search {
    width: 100%;
    padding: .55rem .7rem;
    margin-bottom: .8rem;
    border: 1px solid var(--ct-border-subtle);
    border-radius: 8px;
    background: var(--ct-surface);
    color: var(--ct-text-primary);
    font-size: .85rem;
}

.palette-category {
    margin-bottom: .5rem;
    border-bottom: 1px solid var(--ct-border-subtle);
    padding-bottom: .4rem;
}

.palette-category:last-child {
    border-bottom: none;
}

.palette-category summary {
    cursor: pointer;
    font-size: .78rem;
    font-weight: 600;
    color: var(--ct-text-tertiary);
    text-transform: uppercase;
    letter-spacing: .03em;
    padding: .5rem .25rem;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.palette-category summary::-webkit-details-marker {
    display: none;
}

.palette-category summary::after {
    content: '▾';
    font-size: .7rem;
    transition: transform .15s ease;
}

.palette-category[open] summary::after {
    transform: rotate(180deg);
}

.palette-category-items {
    padding-top: .2rem;
}

main {
    flex: 1;
    padding: 1.5rem;
}

.grid-stack {
    background: transparent;
    width: 100%;
}

.grid-stack-item-content {
    background: var(--ct-surface);
    border: 1px solid var(--ct-border-subtle);
    border-radius: 12px;
    box-shadow: var(--ct-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden !important;
    transition: box-shadow .15s ease;
}

.grid-stack-item-content:hover {
    box-shadow: var(--ct-shadow-hover);
}

.widget-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .7rem .95rem;
    border-bottom: 1px solid var(--ct-border-subtle);
    cursor: grab;
}

.widget-header:active { cursor: grabbing; }

.widget-title {
    font-size: .88rem;
    font-weight: 600;
    color: var(--ct-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -.005em;
}

.widget-actions button {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: .85rem;
    color: var(--ct-text-tertiary);
    padding: .25rem .4rem;
    border-radius: 6px;
    transition: background .12s ease, color .12s ease;
}

.widget-actions button:hover {
    color: var(--ct-text-primary);
    background: var(--ct-accent-soft);
}

.widget-chart {
    flex: 1;
    min-height: 0;
    opacity: 0;
    transition: opacity .5s ease;
}

.widget-chart .leaflet-container {
    width: 100%;
    height: 100%;
    border-radius: 0 0 12px 12px;
}

.widget-chart.loaded {
    opacity: 1;
}

.data-table {
    width: 100%;
    height: 100%;
    overflow: auto;
    font-size: .8rem;
}

.data-table table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    position: sticky;
    top: 0;
    background: var(--ct-surface);
    text-align: left;
    padding: .5rem .7rem;
    border-bottom: 1.5px solid var(--ct-border);
    color: var(--ct-text-secondary);
    font-weight: 600;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.data-table td {
    padding: .5rem .7rem;
    border-bottom: 1px solid var(--ct-border-subtle);
    color: var(--ct-text-primary);
    white-space: nowrap;
}

.data-table tr:hover td {
    background: var(--ct-accent-soft);
}

.data-table tr.table-row-clickable {
    cursor: pointer;
}

.data-table tr.table-row-clickable:hover td {
    background: rgba(59, 130, 246, .12);
}

.data-table .anomaly-tag {
    background: #fdecea;
    color: #c92f35;
    padding: .15rem .5rem;
    border-radius: 5px;
    font-weight: 600;
    font-size: .74rem;
}

.data-table .status-tag {
    display: inline-block;
    padding: .15rem .55rem;
    border-radius: 5px;
    font-weight: 600;
    font-size: .74rem;
}

.data-table .status-tag.status-critical {
    background: #e5484d;
    color: #fff;
}

.data-table .status-tag.status-warning {
    background: #f5a524;
    color: #1a1a1a;
}

.data-table .status-tag.status-ok {
    background: var(--ct-brand);
    color: var(--ct-charcoal);
}

.data-table .empty-table {
    padding: 2rem;
    text-align: center;
    color: var(--ct-text-secondary);
}

.kpi-card {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: 0 1.1rem;
}

.kpi-card.kpi-no-sparkline {
    justify-content: center;
}

.kpi-card.kpi-no-sparkline .kpi-left {
    width: 100%;
}

.kpi-left {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    min-width: 0;
}

.kpi-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--ct-text-primary);
    line-height: 1;
    letter-spacing: -.01em;
}

.kpi-value-row {
    display: flex;
    align-items: baseline;
    gap: .5rem;
}

.kpi-trend {
    font-size: .78rem;
    font-weight: 600;
    white-space: nowrap;
}

.kpi-trend-good {
    color: var(--ct-accent-text);
}

.kpi-trend-bad {
    color: #e5484d;
}

.kpi-badge {
    display: inline-block;
    width: fit-content;
    font-size: .7rem;
    font-weight: 600;
    line-height: 1.3;
    color: #fff;
    padding: .28rem .6rem;
    border-radius: 6px;
}

.kpi-badge-teal { background: var(--ct-brand); color: var(--ct-charcoal); }
.kpi-badge-pink { background: #f5a524; color: var(--ct-charcoal); }
.kpi-badge-gray { background: #9ca3af; }

.kpi-sparkline {
    flex: 1;
    min-width: 0;
    height: 70%;
    max-width: 50%;
}

.kpi-card.kpi-unavailable .kpi-value {
    color: var(--ct-text-tertiary);
}

.kpi-card.kpi-clickable {
    cursor: pointer;
    transition: background-color .15s ease;
}

.kpi-card.kpi-clickable:hover {
    background-color: rgba(255, 255, 255, .04);
}

.kpi-click-hint {
    position: absolute;
    bottom: .5rem;
    right: .8rem;
    font-size: .65rem;
    color: var(--ct-text-tertiary);
    opacity: 0;
    transition: opacity .15s ease;
}

.kpi-card.kpi-clickable:hover .kpi-click-hint {
    opacity: 1;
}

.modal.kpi-detail-modal {
    max-width: 720px;
    width: 90vw;
}

.kpi-detail-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.kpi-detail-modal-header h3 {
    margin: 0;
}

.kpi-detail-modal-body {
    min-height: 200px;
}

.kpi-detail-loading,
.kpi-detail-empty {
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--ct-text-secondary);
    font-size: .9rem;
}

.driving-inertia-row {
    flex-shrink: 0;
    text-align: center;
    font-size: .75rem;
    color: var(--ct-text-secondary);
    padding: .3rem 0;
}

.driving-inertia-row strong {
    color: #c4b5fd;
}

.driving-chart {
    width: 100%;
    height: 100%;
}

.driving-widget-body {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

.driving-widget-body .driving-chart {
    flex: 1;
    min-height: 0;
}

.driving-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .9rem;
    padding: .4rem 0 .2rem;
    flex-shrink: 0;
}

.driving-legend-item {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .72rem;
    color: var(--ct-text-secondary);
}

.driving-legend-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.driving-shape-diamond {
    border-radius: 2px;
    transform: rotate(45deg);
}

.driving-shape-triangle {
    width: 0;
    height: 0;
    background: transparent !important;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 8px solid;
}

.driving-shape-circle {
    border-radius: 50%;
}

.widget-title-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--ct-text-tertiary);
    margin-right: .45rem;
    flex-shrink: 0;
}

.widget-title-with-icon {
    display: inline-flex;
    align-items: center;
    min-width: 0;
}

.empty-hint {
    color: var(--ct-text-secondary);
    font-size: .92rem;
    padding: 3rem 2rem;
    margin: 2rem auto;
    max-width: 520px;
    text-align: center;
    border: 1.5px dashed var(--ct-border);
    border-radius: var(--ct-radius);
    background: var(--ct-surface);
    line-height: 1.6;
}

.empty-hint strong {
    display: block;
    color: var(--ct-text-primary);
    font-size: 1.05rem;
    margin-bottom: .35rem;
}

/* Modal */
.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 15, 15, .6);
    backdrop-filter: blur(3px);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-backdrop.open { display: flex; }

.modal {
    background: var(--ct-surface);
    border: 1px solid var(--ct-border-subtle);
    border-radius: 14px;
    width: 380px;
    max-width: 92vw;
    padding: 1.4rem;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
}

.modal h3 {
    margin: 0 0 1rem 0;
    font-size: 1rem;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 8px;
    background: var(--ct-border-subtle);
    color: var(--ct-text-secondary);
    font-size: .85rem;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}

.btn-icon:hover {
    background: var(--ct-border);
    color: var(--ct-text-primary);
}

.field { margin-bottom: .85rem; }

.field label {
    display: block;
    font-size: .8rem;
    color: var(--ct-text-secondary);
    margin-bottom: .3rem;
}

.field input, .field select {
    width: 100%;
    padding: .6rem .7rem;
    border: 1px solid var(--ct-border);
    border-radius: 8px;
    font-size: .88rem;
    font-family: inherit;
    background: var(--ct-surface);
    color: var(--ct-text-primary);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.field input:focus, .field select:focus, .palette-search:focus {
    outline: none;
    border-color: var(--ct-brand);
    box-shadow: 0 0 0 3px rgba(137, 243, 54, .25);
}

#fieldDriverId {
    position: relative;
}

.autocomplete-list {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 20;
    margin-top: .2rem;
    max-height: 220px;
    overflow-y: auto;
    background: var(--ct-surface, #1f1f1f);
    border: 1px solid var(--ct-border);
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .3);
}

.autocomplete-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .5rem;
    padding: .5rem .6rem;
    cursor: pointer;
    font-size: .82rem;
}

.autocomplete-item:hover {
    background: var(--ct-hover, rgba(255, 255, 255, .06));
}

.autocomplete-item-name {
    color: var(--ct-text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.autocomplete-item-cpf {
    color: var(--ct-text-tertiary);
    font-size: .75rem;
    flex-shrink: 0;
}

.autocomplete-empty {
    padding: .6rem;
    font-size: .8rem;
    color: var(--ct-text-tertiary);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
    margin-top: 1.1rem;
}

.btn {
    border: none;
    border-radius: 8px;
    padding: .6rem 1.1rem;
    font-size: .86rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: filter .15s ease, background .15s ease;
}

.btn:hover { filter: brightness(1.05); }

.btn-primary { background: var(--ct-accent); color: var(--ct-on-accent); }
.btn-secondary { background: var(--ct-bg); color: var(--ct-text-primary); border: 1px solid var(--ct-border); }
.btn-danger { background: #fdecea; color: #b3261e; }

.viz-confirm-row {
    display: flex;
    align-items: center;
    gap: .6rem;
}

.viz-confirm {
    background: var(--ct-accent-soft);
    color: var(--ct-accent-text);
    font-weight: 600;
    font-size: .85rem;
    padding: .5rem .7rem;
    border-radius: 6px;
    flex: 1;
}

.btn-link {
    border: none;
    background: none;
    color: var(--ct-text-secondary);
    font-size: .78rem;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}

.btn-link:hover { color: var(--ct-accent-text); }

/* Galeria de visualizações (passo 1 da criação) */
.gallery-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, .5);
    align-items: center;
    justify-content: center;
    z-index: 1100;
    padding: 2rem;
}

.gallery-backdrop.open { display: flex; }

.gallery {
    background: var(--ct-surface);
    border-radius: 16px;
    width: 100%;
    max-width: 880px;
    max-height: 86vh;
    padding: 1.5rem 1.75rem;
    box-shadow: 0 24px 60px rgba(17, 24, 39, .25);
    display: flex;
    flex-direction: column;
}

.gallery-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.gallery-header h2 {
    margin: 0 0 .2rem 0;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -.01em;
}

.gallery-header p {
    margin: 0;
    font-size: .82rem;
    color: var(--ct-text-secondary);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: .9rem;
    overflow-y: auto;
    padding: .2rem;
}

.viz-card {
    border: 1.5px solid var(--ct-border-subtle);
    border-radius: 12px;
    padding: .85rem;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease, transform .1s ease;
    background: var(--ct-surface);
}

.viz-card:hover {
    border-color: var(--ct-accent);
    box-shadow: var(--ct-shadow-hover);
}

.viz-card:active { transform: scale(.98); }

.viz-card-preview {
    width: 100%;
    height: 110px;
    margin-bottom: .6rem;
}

.viz-card-label {
    font-size: .82rem;
    font-weight: 600;
    color: var(--ct-text-primary);
    text-align: center;
}

.gallery-empty {
    color: var(--ct-text-secondary);
    font-size: .88rem;
    padding: 2.5rem;
    text-align: center;
}
.grid-stack-item-content:hover .widget-header::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 3px;
    height: 18px;
    transform: translateY(-50%);
    border-radius: 0 3px 3px 0;
    background: var(--ct-brand);
}

.btn-nav-label {
    font-size: .85rem;
    font-weight: 600;
}

@media (max-width: 900px) {
    header {
        flex-wrap: wrap;
        padding: .6rem 1rem;
    }

    .dashboard-switcher {
        order: 3;
        flex-basis: 100%;
        margin-left: 0;
    }

    .dashboard-switcher select {
        flex: 1;
        max-width: none;
    }

    .theme-toggle .theme-toggle-label,
    .nav-link span {
        display: none;
    }

    main {
        padding: 1rem;
    }
}

.widget-error {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1rem;
    font-size: .85rem;
    color: var(--ct-text-secondary);
}
.period-filter {
    position: relative;
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--ct-header-border);
    border-radius: 10px;
    background: #1f1f1f;
    margin-right: .5rem;
}

.period-filter-icon {
    width: 16px;
    height: 16px;
    margin: 0 .35rem 0 .45rem;
    stroke: var(--ct-header-muted);
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

.period-filter > button {
    border: none;
    background: transparent;
    color: var(--ct-header-muted);
    font-family: inherit;
    font-size: .8rem;
    font-weight: 600;
    padding: .42rem .7rem;
    border-radius: 7px;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s ease, color .15s ease;
}

.period-filter > button:hover {
    color: var(--ct-header-text);
    background: rgba(255, 255, 255, .06);
}

.period-filter > button.active {
    background: var(--ct-brand);
    color: var(--ct-charcoal);
}

.period-custom {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 280px;
    padding: 1rem;
    background: var(--ct-surface);
    color: var(--ct-text-primary);
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius);
    box-shadow: var(--ct-shadow-hover);
    z-index: 960;
}

.period-custom.open {
    display: block;
}

.field-note {
    font-size: .8rem;
    line-height: 1.5;
    color: var(--ct-text-secondary);
    background: var(--ct-accent-soft);
    border-left: 3px solid var(--ct-brand);
    border-radius: 6px;
    padding: .6rem .75rem;
    margin: 0 0 .9rem 0;
}

.widget-actions {
    display: flex;
    align-items: center;
    gap: .15rem;
    flex-shrink: 0;
}

.widget-heading {
    display: flex;
    align-items: center;
    gap: .5rem;
    min-width: 0;
    flex: 1;
}

.widget-heading .widget-title,
.widget-heading .widget-title-with-icon {
    min-width: 0;
}

.widget-heading .widget-updated {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    flex-shrink: 0;
    height: 20px;
    padding: 0 .5rem;
    border: none;
    border-radius: 999px;
    background: var(--ct-accent-soft);
    color: var(--ct-text-tertiary);
    font-family: inherit;
    font-size: .68rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: background .12s ease, color .12s ease;
}

.widget-heading .widget-updated::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: .75;
}

.widget-heading .widget-updated:hover {
    color: var(--ct-text-primary);
}

.widget-heading .widget-updated:empty,
.widget-heading .widget-updated.is-hidden {
    display: none;
}

.widget-heading .widget-updated.is-loading {
    display: inline-flex;
    width: 20px;
    padding: 0;
    justify-content: center;
    background: transparent;
    color: var(--ct-accent-text);
}

.widget-heading .widget-updated.is-loading::before {
    animation: widget-updated-pulse 1s ease-in-out infinite;
}

.widget-heading .widget-updated.is-error {
    color: #e5484d;
    background: rgba(229, 72, 77, .12);
}

@keyframes widget-updated-pulse {
    0%, 100% { opacity: .3; }
    50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .widget-heading .widget-updated.is-loading::before {
        animation: none;
    }
}

.widget-header {
    gap: .5rem;
}

.widget-skeleton {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 1rem 1.1rem;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.widget-skeleton-bars,
.widget-skeleton-table {
    justify-content: flex-end;
}

.widget-skeleton-table {
    justify-content: flex-start;
}

.sk {
    background: linear-gradient(90deg, var(--ct-border-subtle) 25%, var(--ct-border) 50%, var(--ct-border-subtle) 75%);
    background-size: 200% 100%;
    animation: sk-shimmer 1.4s ease-in-out infinite;
    border-radius: 6px;
}

.sk-line {
    height: 12px;
}

.sk-rows {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.sk-bars {
    display: flex;
    align-items: flex-end;
    gap: 8%;
    height: 80%;
    padding: 0 4%;
    border-bottom: 2px solid var(--ct-border-subtle);
}

.sk-bar {
    flex: 1;
    border-radius: 6px 6px 0 0;
}

.sk-circle {
    width: min(60%, 180px);
    aspect-ratio: 1;
    border-radius: 50%;
    align-self: center;
}

@keyframes sk-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
    .sk {
        animation: none;
    }
}

.widget-state {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .65rem;
    padding: 1rem 1.25rem;
    text-align: center;
}

.widget-state-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ct-accent-soft);
    color: var(--ct-accent-text);
}

.widget-state-icon svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.widget-state-error .widget-state-icon {
    background: rgba(229, 72, 77, .12);
    color: #e5484d;
}

.widget-state-text {
    font-size: .85rem;
    line-height: 1.5;
    color: var(--ct-text-secondary);
    max-width: 320px;
}

.widget-state-action {
    padding: .45rem 1rem;
    font-size: .8rem;
}

.lookup {
    position: relative;
}

.lookup .lookup-input {
    padding-right: 2.2rem;
}

.lookup.selected .lookup-input {
    font-weight: 600;
    border-color: var(--ct-brand);
}

.lookup-clear {
    position: absolute;
    right: .4rem;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: var(--ct-text-tertiary);
    cursor: pointer;
    font-size: .8rem;
    padding: .3rem .4rem;
    border-radius: 6px;
    display: none;
}

.lookup.selected .lookup-clear,
.lookup .lookup-input:not(:placeholder-shown) + .lookup-clear {
    display: block;
}

.lookup-clear:hover {
    background: var(--ct-border-subtle);
    color: var(--ct-text-primary);
}

.lookup-list {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    max-height: 240px;
    overflow-y: auto;
    background: var(--ct-surface);
    border: 1px solid var(--ct-border);
    border-radius: 10px;
    box-shadow: var(--ct-shadow-hover);
    z-index: 30;
    padding: .3rem;
}

.lookup-list.open {
    display: block;
}

.lookup-option {
    display: flex;
    flex-direction: column;
    gap: .1rem;
    padding: .5rem .6rem;
    border-radius: 7px;
    cursor: pointer;
}

.lookup-option:hover,
.lookup-option.active {
    background: var(--ct-accent-soft);
}

.lookup-option-label {
    font-size: .86rem;
    font-weight: 600;
    color: var(--ct-text-primary);
}

.lookup-option-detail {
    font-size: .75rem;
    color: var(--ct-text-tertiary);
}

.lookup-empty {
    padding: .7rem .6rem;
    font-size: .82rem;
    color: var(--ct-text-tertiary);
}

@media (max-width: 1200px) {
    .period-filter {
        order: 4;
        flex-wrap: wrap;
        margin: .25rem 0 0 0;
    }

    header {
        flex-wrap: wrap;
    }
}

.widget-state-empty .widget-state-icon {
    background: var(--ct-border-subtle);
    color: var(--ct-text-tertiary);
}

.widget-state-unavailable .widget-state-icon {
    background: var(--ct-border-subtle);
    color: var(--ct-text-tertiary);
}

.palette-item.unavailable {
    cursor: not-allowed;
    opacity: .6;
    background: transparent;
    border-style: dashed;
    border-color: var(--ct-border);
}

.palette-item.unavailable:hover {
    box-shadow: none;
    border-color: var(--ct-border);
}

.palette-item.unavailable:active {
    transform: none;
}

.palette-item-text {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    min-width: 0;
}

.palette-item-note {
    font-size: .72rem;
    font-weight: 400;
    color: var(--ct-text-tertiary);
}

.widget-chart {
    container-type: size;
}

@container (max-height: 190px) {
    .widget-state {
        gap: .35rem;
        padding: .5rem .9rem;
    }

    .widget-state-icon {
        display: none;
    }

    .widget-state-text {
        font-size: .8rem;
        line-height: 1.4;
    }

    .widget-state-action {
        padding: .3rem .8rem;
        font-size: .75rem;
    }
}

.icon-btn .icon-locked {
    display: none;
}

.icon-btn.is-active {
    color: var(--ct-brand);
    background: rgba(137, 243, 54, .12);
}

.icon-btn.is-active .icon-locked {
    display: block;
}

.icon-btn.is-active .icon-unlocked {
    display: none;
}

body.layout-locked .widget-header {
    cursor: default;
}

body.layout-locked .widget-header:active {
    cursor: default;
}

.widget-actions .btn-download,
.widget-actions .btn-duplicate {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .15s ease, background .12s ease, color .12s ease;
}

.grid-stack-item-content:hover .widget-actions .btn-download,
.grid-stack-item-content:hover .widget-actions .btn-duplicate,
.widget-actions .btn-download:focus-visible,
.widget-actions .btn-duplicate:focus-visible {
    opacity: 1;
}

.widget-actions svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
}

body.layout-locked .widget-actions .btn-duplicate {
    display: none;
}

.widget-menu {
    display: none;
    position: absolute;
    z-index: 980;
    min-width: 220px;
    padding: .35rem;
    background: var(--ct-surface);
    border: 1px solid var(--ct-border);
    border-radius: 10px;
    box-shadow: var(--ct-shadow-hover);
}

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

.widget-menu button {
    display: block;
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    color: var(--ct-text-primary);
    font-family: inherit;
    font-size: .85rem;
    padding: .55rem .7rem;
    border-radius: 7px;
    cursor: pointer;
}

.widget-menu button:hover,
.widget-menu button:focus-visible {
    background: var(--ct-accent-soft);
}

.widget-menu-empty {
    padding: .6rem .7rem;
    font-size: .82rem;
    color: var(--ct-text-tertiary);
}

.field-row {
    display: flex;
    gap: .5rem;
}

.field-row input {
    flex: 1;
    min-width: 0;
}

.field-row select {
    width: auto !important;
    flex-shrink: 0;
}

.kpi-value-good {
    color: var(--ct-accent-text);
}

.kpi-value-bad {
    color: #e5484d;
}

.kpi-target {
    font-size: .75rem;
    font-weight: 600;
    color: var(--ct-text-tertiary);
    margin-top: .45rem;
}

.kpi-target-good {
    color: var(--ct-accent-text);
}

.kpi-target-bad {
    color: #e5484d;
}

.tv-exit {
    display: none;
}

body.tv-mode header,
body.tv-mode .floating-add-chart,
body.tv-mode .impersonate-banner,
body.tv-mode .widget-actions .btn-edit,
body.tv-mode .widget-actions .btn-duplicate,
body.tv-mode .widget-actions .btn-download,
body.tv-mode .widget-state-action {
    display: none !important;
}

body.tv-mode {
    cursor: none;
}

body.tv-mode.tv-show-controls {
    cursor: default;
}

body.tv-mode .tv-exit {
    display: block;
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1100;
    border: 1px solid var(--ct-header-border);
    background: rgba(21, 21, 21, .85);
    color: #f7f7f7;
    font-family: inherit;
    font-size: .85rem;
    font-weight: 600;
    padding: .6rem 1rem;
    border-radius: 10px;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
}

body.tv-mode.tv-show-controls .tv-exit {
    opacity: 1;
    pointer-events: auto;
}

body.tv-mode main {
    padding: 1rem;
}


.dashboard-switcher {
    flex: 0 1 auto;
    min-width: 0;
    margin-left: 1rem;
    padding: 0;
}

.dashboard-switcher select[hidden] {
    display: none !important;
}

header .period-filter {
    margin-left: auto;
}

.dash-picker {
    position: relative;
    min-width: 0;
}

.dash-picker-trigger {
    display: flex;
    align-items: center;
    gap: .7rem;
    min-width: 230px;
    max-width: 340px;
    padding: .4rem .7rem .4rem .45rem;
    border: 1px solid var(--ct-header-border);
    border-radius: 12px;
    background: linear-gradient(180deg, #232323 0%, #1b1b1b 100%);
    color: var(--ct-header-text);
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.dash-picker-trigger:hover {
    border-color: #3a3a3a;
    background: linear-gradient(180deg, #282828 0%, #1f1f1f 100%);
}

.dash-picker.open .dash-picker-trigger {
    border-color: var(--ct-brand);
    box-shadow: 0 0 0 3px rgba(137, 243, 54, .18);
}

.dash-picker-icon {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: var(--ct-brand);
    color: var(--ct-charcoal);
}

.dash-picker-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linejoin: round;
}

.dash-picker-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
    line-height: 1.2;
}

.dash-picker-caption {
    font-size: .64rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ct-header-muted);
}

.dash-picker-name {
    font-size: .95rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-picker-count {
    flex-shrink: 0;
    font-size: .7rem;
    font-weight: 700;
    color: var(--ct-header-muted);
    background: rgba(255, 255, 255, .07);
    border-radius: 999px;
    padding: .15rem .5rem;
}

.dash-picker-count:empty {
    display: none;
}

.dash-picker-chevron {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    stroke: var(--ct-brand);
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform .2s ease;
}

.dash-picker.open .dash-picker-chevron {
    transform: rotate(180deg);
}

.dash-picker-panel {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    width: 340px;
    max-width: calc(100vw - 24px);
    padding: .5rem;
    background: var(--ct-surface);
    color: var(--ct-text-primary);
    border: 1px solid var(--ct-border);
    border-radius: 14px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .28), 0 2px 8px rgba(0, 0, 0, .12);
    z-index: 990;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px) scale(.98);
    transform-origin: top left;
    transition: opacity .16s ease, transform .16s ease, visibility 0s linear .16s;
}

.dash-picker.open .dash-picker-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    transition: opacity .16s ease, transform .16s ease, visibility 0s;
}

.dash-picker-search {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .2rem .6rem;
    border: 1px solid var(--ct-border);
    border-radius: 10px;
    background: var(--ct-bg);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.dash-picker-search:focus-within {
    border-color: var(--ct-brand);
    box-shadow: 0 0 0 3px rgba(137, 243, 54, .2);
}

.dash-picker-search svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    stroke: var(--ct-text-tertiary);
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
}

.dash-picker-search input {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    color: var(--ct-text-primary);
    font-family: inherit;
    font-size: .88rem;
    padding: .5rem 0;
    outline: none;
}

.dash-picker-kbd {
    font-family: inherit;
    font-size: .65rem;
    font-weight: 600;
    color: var(--ct-text-tertiary);
    border: 1px solid var(--ct-border);
    border-radius: 5px;
    padding: .05rem .35rem;
}

.dash-picker-label {
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ct-text-tertiary);
    padding: .8rem .6rem .35rem;
}

.dash-picker-list {
    max-height: min(52vh, 340px);
    overflow-y: auto;
    padding: 0 .1rem .3rem;
    scrollbar-width: thin;
    scrollbar-color: var(--ct-border) transparent;
}

.dash-picker-item {
    display: flex;
    align-items: center;
    gap: .65rem;
    width: 100%;
    border: none;
    background: transparent;
    color: var(--ct-text-primary);
    font-family: inherit;
    text-align: left;
    padding: .5rem .55rem;
    border-radius: 9px;
    cursor: pointer;
    transition: background .12s ease;
}

.dash-picker-item:hover,
.dash-picker-item.highlighted {
    background: var(--ct-accent-soft);
}

.dash-picker-avatar {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: .72rem;
    font-weight: 800;
    color: var(--ct-text-secondary);
    background: var(--ct-border-subtle);
}

.dash-picker-item.active .dash-picker-avatar {
    background: var(--ct-brand);
    color: var(--ct-charcoal);
}

.dash-picker-item-name {
    flex: 1;
    min-width: 0;
    font-size: .88rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-picker-item.active .dash-picker-item-name {
    font-weight: 700;
}

.dash-picker-item-name mark {
    background: rgba(137, 243, 54, .35);
    color: inherit;
    border-radius: 3px;
    padding: 0 1px;
}

.dash-picker-check {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    stroke: var(--ct-accent-text);
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    visibility: hidden;
}

.dash-picker-item.active .dash-picker-check {
    visibility: visible;
}

.dash-picker-empty {
    padding: 1rem .6rem;
    font-size: .85rem;
    text-align: center;
    color: var(--ct-text-tertiary);
}

.dash-picker-footer {
    border-top: 1px solid var(--ct-border-subtle);
    margin-top: .2rem;
    padding-top: .5rem;
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.dash-picker-actions-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .35rem;
}

.dash-picker-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    border: 1px solid var(--ct-border);
    background: transparent;
    color: var(--ct-text-secondary);
    font-family: inherit;
    font-size: .78rem;
    font-weight: 600;
    padding: .5rem .4rem;
    border-radius: 9px;
    cursor: pointer;
    transition: background .12s ease, color .12s ease, border-color .12s ease;
}

.dash-picker-action svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
}

.dash-picker-action:hover {
    background: var(--ct-border-subtle);
    color: var(--ct-text-primary);
}

.dash-picker-action-primary {
    border-color: transparent;
    background: var(--ct-brand);
    color: var(--ct-charcoal);
    font-size: .85rem;
    padding: .6rem;
}

.dash-picker-action-primary:hover {
    background: var(--ct-brand);
    color: var(--ct-charcoal);
    filter: brightness(1.06);
}

.dash-picker-action-danger:hover {
    color: #e5484d;
    border-color: rgba(229, 72, 77, .4);
    background: rgba(229, 72, 77, .08);
}

@media (max-width: 900px) {
    .dashboard-switcher {
        margin-left: 0;
        flex-basis: 100%;
    }

    .dash-picker,
    .dash-picker-trigger {
        width: 100%;
        max-width: none;
    }

    .dash-picker-panel {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .dash-picker-panel,
    .dash-picker-chevron {
        transition: none;
    }
}

.dash-picker-grip {
    display: inline-flex;
    width: 14px;
    margin-left: -.25rem;
    margin-right: -.35rem;
    color: var(--ct-text-muted, #8a8f98);
    opacity: 0;
    cursor: grab;
    transition: opacity .15s ease;
}

.dash-picker-grip svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
    stroke: none;
}

.dash-picker-item:hover .dash-picker-grip,
.dash-picker-item.highlighted .dash-picker-grip {
    opacity: .8;
}

.dash-picker-list.reorderable .dash-picker-item {
    cursor: grab;
}

.dash-picker-item.dragging {
    opacity: .45;
    background: var(--ct-accent-soft);
    outline: 1px dashed var(--ct-brand);
    outline-offset: -1px;
}

.dash-picker-list.is-dragging .dash-picker-item:not(.dragging):hover {
    background: transparent;
}

@media (hover: none) {
    .dash-picker-grip {
        opacity: .6;
    }
}

#fieldEvents .field-hint {
    display: block;
    margin-top: .45rem;
    font-size: .78rem;
    color: var(--ct-text-secondary);
}

.attention {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.attention-summary {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    padding: .65rem .95rem .5rem;
}

.attention-count {
    padding: .18rem .55rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
}

.attention-count.is-critical { background: rgba(229, 72, 77, .14); color: #e5484d; }
.attention-count.is-high { background: rgba(245, 165, 36, .16); color: #c27c0e; }
.attention-count.is-medium { background: rgba(128, 128, 128, .14); color: var(--ct-text-secondary); }

body[data-theme="dark"] .attention-count.is-high { color: #f5a524; }

.attention-list {
    list-style: none;
    margin: 0;
    padding: 0 .6rem .6rem;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.attention-item {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: .7rem;
    padding: .6rem .65rem .6rem .9rem;
    border-radius: 8px;
    margin-bottom: .35rem;
    background: rgba(0, 0, 0, .035);
}

body[data-theme="dark"] .attention-item {
    background: rgba(255, 255, 255, .04);
}

.attention-item.is-critical,
body[data-theme="dark"] .attention-item.is-critical {
    background: rgba(229, 72, 77, .08);
}

.attention-bar {
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 3px;
    background: var(--ct-text-tertiary);
}

.attention-item.is-critical .attention-bar { background: #e5484d; }
.attention-item.is-high .attention-bar { background: #f5a524; }

.attention-main {
    flex: 1;
    min-width: 0;
}

.attention-top {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.attention-plate {
    font-size: .88rem;
    letter-spacing: .02em;
    color: var(--ct-text-primary);
}

.attention-priority {
    font-size: .66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--ct-text-tertiary);
}

.attention-item.is-critical .attention-priority { color: #e5484d; }
.attention-item.is-high .attention-priority { color: #c27c0e; }
body[data-theme="dark"] .attention-item.is-high .attention-priority { color: #f5a524; }

.attention-problem {
    margin-top: .15rem;
    font-size: .84rem;
    font-weight: 500;
    color: var(--ct-text-primary);
}

.attention-meta {
    margin-top: .15rem;
    font-size: .76rem;
    color: var(--ct-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attention-seen {
    flex-shrink: 0;
    font-size: .74rem;
    color: var(--ct-text-tertiary);
    white-space: nowrap;
}

.attention-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .3rem;
    height: 100%;
    color: var(--ct-text-secondary);
    font-size: .85rem;
    text-align: center;
}

.attention-empty strong {
    font-size: .95rem;
    color: var(--ct-text-primary);
}

.attention-empty-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--ct-accent-soft);
    color: var(--ct-accent-text);
    font-weight: 700;
    margin-bottom: .2rem;
}

.config-modal {
    width: 520px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 48px);
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: config-modal-in .18s ease-out;
}

@keyframes config-modal-in {
    from { opacity: 0; transform: translateY(8px) scale(.98); }
    to { opacity: 1; transform: none; }
}

.config-head {
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: 1.15rem 1.25rem 1rem;
    border-bottom: 1px solid var(--ct-border-subtle);
}

.config-head-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 10px;
    background: var(--ct-brand);
    color: var(--ct-charcoal);
}

.config-head-icon svg,
.config-close svg,
.config-section-title svg,
.btn-danger-ghost svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.config-head-text {
    flex: 1;
    min-width: 0;
}

.config-modal .config-head h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -.01em;
}

.config-head p {
    margin: .15rem 0 0;
    font-size: .8rem;
    color: var(--ct-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.config-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--ct-text-tertiary);
    cursor: pointer;
    transition: background .12s ease, color .12s ease;
}

.config-close:hover {
    background: var(--ct-accent-soft);
    color: var(--ct-text-primary);
}

.config-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: .4rem 1.25rem 1rem;
}

.config-section {
    padding: .9rem 0 .15rem;
}

.config-section + .config-section {
    border-top: 1px dashed var(--ct-border-subtle);
}

.config-section-title {
    display: flex;
    align-items: center;
    gap: .45rem;
    margin: 0 0 .75rem;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ct-text-tertiary);
}

.config-section-title svg {
    width: 14px;
    height: 14px;
}

.config-modal .field label {
    font-size: .8rem;
    font-weight: 600;
    color: var(--ct-text-primary);
    margin-bottom: .35rem;
}

.config-modal .field input,
.config-modal .field select {
    border-radius: 10px;
    padding: .62rem .75rem;
    background: var(--ct-bg);
}

.config-modal .field input:hover,
.config-modal .field select:hover {
    border-color: var(--ct-text-tertiary);
}

.config-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 .75rem;
}

.config-optional {
    display: inline-block;
    margin-left: .3rem;
    padding: .05rem .4rem;
    border-radius: 999px;
    background: var(--ct-accent-soft);
    color: var(--ct-text-tertiary);
    font-size: .66rem;
    font-weight: 600;
    vertical-align: 1px;
}

.config-modal .viz-confirm-row {
    gap: .5rem;
}

.config-modal .viz-confirm {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .6rem .8rem;
    border-radius: 10px;
    font-size: .88rem;
}

.config-modal .viz-confirm::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ct-brand);
}

.config-modal .btn-link {
    padding: .6rem .8rem;
    border: 1px solid var(--ct-border);
    border-radius: 10px;
    background: var(--ct-bg);
    color: var(--ct-text-primary);
    font-size: .82rem;
    font-weight: 600;
    text-decoration: none;
    transition: border-color .12s ease;
}

.config-modal .btn-link:hover {
    border-color: var(--ct-text-tertiary);
}

.config-modal .field-note {
    border-left: none;
    border-radius: 10px;
    padding: .65rem .8rem;
    font-size: .78rem;
}

.config-advanced {
    border: 1px solid var(--ct-border-subtle);
    border-radius: 10px;
    padding: 0 .8rem;
}

.config-advanced summary {
    list-style: none;
    display: flex;
    align-items: center;
    gap: .2rem;
    padding: .65rem 0;
    font-size: .82rem;
    font-weight: 600;
    color: var(--ct-text-secondary);
    cursor: pointer;
}

.config-advanced summary::-webkit-details-marker {
    display: none;
}

.config-advanced summary::after {
    content: '';
    margin-left: auto;
    width: 7px;
    height: 7px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    transition: transform .15s ease;
}

.config-advanced[open] summary::after {
    transform: rotate(-135deg) translateY(-2px);
}

.config-advanced[open] {
    padding-bottom: .8rem;
}

.config-advanced .field-hint {
    display: block;
    margin-top: .45rem;
    font-size: .76rem;
    color: var(--ct-text-secondary);
}

.config-info {
    margin: 0 0 .8rem;
    padding: .65rem .8rem;
    border-radius: 10px;
    background: var(--ct-accent-soft);
    font-size: .8rem;
    line-height: 1.5;
    color: var(--ct-text-secondary);
}

.config-foot {
    align-items: center;
    margin: 0;
    padding: .85rem 1.25rem;
    border-top: 1px solid var(--ct-border-subtle);
    background: var(--ct-surface);
}

.config-foot-spacer {
    flex: 1;
}

.btn-danger-ghost {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .55rem .7rem;
    background: transparent;
    color: #e5484d;
}

.btn-danger-ghost svg {
    width: 15px;
    height: 15px;
}

.btn-danger-ghost:hover {
    background: rgba(229, 72, 77, .1);
    filter: none;
}

.config-foot .btn-primary {
    min-width: 96px;
}

@media (max-width: 560px) {
    .config-grid {
        grid-template-columns: 1fr;
    }

    .btn-danger-ghost span,
    .config-foot .btn {
        padding-left: .8rem;
        padding-right: .8rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .config-modal {
        animation: none;
    }
}

.config-grid > .field,
.config-grid input {
    min-width: 0;
}

.grid-stack > .grid-stack-placeholder > .placeholder-content {
    border: 2px dashed var(--ct-brand);
    border-radius: 12px;
    background: rgba(137, 243, 54, .08);
}

.grid-stack.grid-stack-animate .grid-stack-item {
    transition: left .22s cubic-bezier(.2, .8, .2, 1), top .22s cubic-bezier(.2, .8, .2, 1),
    width .22s cubic-bezier(.2, .8, .2, 1), height .22s cubic-bezier(.2, .8, .2, 1);
}

.grid-stack .grid-stack-item.ui-draggable-dragging,
.grid-stack .grid-stack-item.ui-resizable-resizing {
    transition: none;
}

.grid-stack-item.ui-draggable-dragging > .grid-stack-item-content {
    box-shadow: 0 18px 40px rgba(0, 0, 0, .28);
    transform: scale(1.015);
    opacity: .96;
    cursor: grabbing;
}

body.is-dragging-widget {
    user-select: none;
    cursor: grabbing;
}

body.is-dragging-widget .grid-stack-item:not(.ui-draggable-dragging) > .grid-stack-item-content {
    opacity: .85;
}

@media (prefers-reduced-motion: reduce) {
    .grid-stack.grid-stack-animate .grid-stack-item {
        transition: none;
    }
    .grid-stack-item.ui-draggable-dragging > .grid-stack-item-content {
        transform: none;
    }
}

#fieldIdleCost > .config-grid > .field {
    margin-bottom: .4rem;
}

#fieldIdleCost .field-hint {
    display: block;
    font-size: .76rem;
    color: var(--ct-text-secondary);
}

.event-picker-link {
    border: none;
    background: none;
    padding: 0;
    margin-left: .7rem;
    font-family: inherit;
    font-size: .78rem;
    font-weight: 600;
    color: var(--ct-accent-text);
    cursor: pointer;
}

.event-picker-link:hover {
    text-decoration: underline;
}

.event-summary {
    display: flex;
    align-items: center;
    gap: .55rem;
    width: 100%;
    padding: .62rem .75rem;
    border: 1px solid var(--ct-border);
    border-radius: 10px;
    background: var(--ct-bg);
    color: var(--ct-text-primary);
    font-family: inherit;
    font-size: .88rem;
    text-align: left;
    cursor: pointer;
    transition: border-color .15s ease;
}

.event-summary:hover {
    border-color: var(--ct-text-tertiary);
}

.event-summary:focus-visible {
    outline: none;
    border-color: var(--ct-brand);
    box-shadow: 0 0 0 3px rgba(137, 243, 54, .25);
}

.event-summary-text {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.event-summary-text.is-placeholder {
    color: var(--ct-text-tertiary);
}

.event-summary-count {
    padding: .1rem .5rem;
    border-radius: 999px;
    background: var(--ct-brand);
    color: var(--ct-charcoal);
    font-size: .72rem;
    font-weight: 700;
}

.event-summary-count:empty {
    display: none;
}

.event-summary svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    fill: none;
    stroke: var(--ct-text-tertiary);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.config-modal {
    position: relative;
}

.event-sheet {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    flex-direction: column;
    background: var(--ct-surface);
    animation: event-sheet-in .18s ease-out;
}

.event-sheet[hidden] {
    display: none;
}

@keyframes event-sheet-in {
    from { opacity: 0; transform: translateX(16px); }
    to { opacity: 1; transform: none; }
}

.event-sheet-head {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .9rem 1rem .6rem;
}

.event-sheet-head h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

.event-sheet-search {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: 0 1.25rem;
    padding: 0 .75rem;
    border: 1px solid var(--ct-border);
    border-radius: 10px;
    background: var(--ct-bg);
}

.event-sheet-search:focus-within {
    border-color: var(--ct-brand);
    box-shadow: 0 0 0 3px rgba(137, 243, 54, .2);
}

.event-sheet-search svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    fill: none;
    stroke: var(--ct-text-tertiary);
    stroke-width: 2;
    stroke-linecap: round;
}

.event-sheet-search input {
    flex: 1;
    min-width: 0;
    padding: .65rem 0;
    border: none;
    outline: none;
    background: transparent;
    color: var(--ct-text-primary);
    font-family: inherit;
    font-size: .9rem;
}

.event-sheet-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .7rem 1.25rem .4rem;
    font-size: .78rem;
    color: var(--ct-text-secondary);
}

.event-sheet-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0 .9rem .5rem;
}

.event-sheet-foot {
    display: flex;
    justify-content: flex-end;
    padding: .85rem 1.25rem;
    border-top: 1px solid var(--ct-border-subtle);
}

.event-option {
    display: flex;
    align-items: center;
    gap: .65rem;
    width: 100%;
    padding: .55rem .5rem;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--ct-text-primary);
    font-family: inherit;
    font-size: .86rem;
    text-align: left;
    cursor: pointer;
}

.event-option:hover {
    background: var(--ct-accent-soft);
}

.event-option-check {
    position: relative;
    width: 17px;
    height: 17px;
    flex-shrink: 0;
    border: 1.5px solid var(--ct-text-tertiary);
    border-radius: 5px;
    transition: background .12s ease, border-color .12s ease;
}

.event-option.is-on .event-option-check {
    background: var(--ct-brand);
    border-color: var(--ct-brand);
}

.event-option.is-on .event-option-check::after {
    content: '';
    position: absolute;
    left: 4.5px;
    top: 1.5px;
    width: 4px;
    height: 8px;
    border: solid var(--ct-charcoal);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.event-option-name {
    flex: 1;
    min-width: 0;
}

.event-picker-note {
    padding: 1rem .5rem;
    font-size: .82rem;
    color: var(--ct-text-tertiary);
    text-align: center;
}

body[data-theme="dark"] {
    color-scheme: dark;
}

body[data-theme="light"] {
    color-scheme: light;
}

.config-body,
.event-sheet-list,
.dash-picker-list,
.attention-list,
.data-table {
    scrollbar-width: thin;
    scrollbar-color: var(--ct-border) transparent;
}

.config-body::-webkit-scrollbar,
.event-sheet-list::-webkit-scrollbar,
.dash-picker-list::-webkit-scrollbar,
.attention-list::-webkit-scrollbar,
.data-table::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.config-body::-webkit-scrollbar-thumb,
.event-sheet-list::-webkit-scrollbar-thumb,
.dash-picker-list::-webkit-scrollbar-thumb,
.attention-list::-webkit-scrollbar-thumb,
.data-table::-webkit-scrollbar-thumb {
    background: var(--ct-border);
    border-radius: 8px;
}

.config-body::-webkit-scrollbar-track,
.event-sheet-list::-webkit-scrollbar-track,
.dash-picker-list::-webkit-scrollbar-track,
.attention-list::-webkit-scrollbar-track,
.data-table::-webkit-scrollbar-track {
    background: transparent;
}

@media (prefers-reduced-motion: reduce) {
    .event-sheet {
        animation: none;
    }
}

.add-chart-dropdown {
    padding-top: 0;
}

.palette-head {
    position: sticky;
    top: 0;
    z-index: 2;
    margin: 0 -.25rem;
    padding: .95rem .25rem .2rem;
    background: var(--ct-surface);
}

.palette-head h2 {
    margin-bottom: .2rem;
}

.palette-head .palette-hint {
    margin: 0 .25rem .2rem;
}

.palette-head .palette-search {
    margin: .6rem 0 .5rem;
}

.palette-count {
    margin-left: .4rem;
    margin-right: auto;
    padding: .05rem .45rem;
    border-radius: 999px;
    background: var(--ct-accent-soft);
    color: var(--ct-text-secondary);
    font-size: .68rem;
    letter-spacing: 0;
}

.live-map {
    width: 100%;
    height: 100%;
    border-radius: 0 0 12px 12px;
    overflow: hidden;
}

.live-map {
    background: #e5e3df;
}

.live-map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem .8rem;
    max-width: 260px;
    padding: .45rem .6rem;
    border-radius: 8px;
    background: var(--ct-surface);
    color: var(--ct-text-primary);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
    font-size: .72rem;
    font-family: inherit;
}

.live-map-legend span {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    white-space: nowrap;
}

.live-map-legend i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1.5px solid #fff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .15);
}

.live-map .leaflet-popup-content {
    font-family: inherit;
    font-size: .8rem;
    line-height: 1.45;
}

.live-map-blocked {
    color: #e5484d;
    font-weight: 700;
}
.brand-logo {
    display: inline-flex;
    align-items: center;
    height: 46px;
    max-width: 220px;
    flex-shrink: 0;
}

.brand-logo img {
    display: block;
    max-height: 46px;
    max-width: 220px;
    object-fit: contain;
}

.brand-logo + h1 {
    padding-left: .85rem;
    border-left: 1px solid rgba(255, 255, 255, .18);
    font-size: 1.15rem;
}

.header-left {
    flex: 0 1 auto;
    min-width: 0;
}

.header-left .brand-logo {
    flex-shrink: 0;
}

.header-left h1 {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

header > .dashboard-switcher,
header > .period-filter,
header > .header-right {
    flex-shrink: 0;
}

@media (max-width: 1500px) {
    .brand-logo,
    .brand-logo img {
        max-width: 160px;
    }

    .header-left h1 {
        max-width: 180px;
    }

    .header-left .brand-logo + h1,
    header .theme-toggle-label,
    header .header-right .nav-link span {
        display: none;
    }

    .dash-picker-trigger {
        min-width: 200px;
        max-width: 260px;
    }
}

.dup-count {
    margin-left: .35rem;
    font-size: .7rem;
    font-weight: 600;
    color: var(--ct-text-tertiary);
}

.dup-dates {
    margin-top: .6rem;
}

.dup-dates[hidden] {
    display: none;
}

.vh-body {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    gap: .6rem;
}

.vh-chart {
    flex: 1;
    min-height: 0;
    width: 100%;
}

.vh-tiles {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .5rem;
    flex-shrink: 0;
}

.vh-tile {
    display: flex;
    flex-direction: column;
    gap: .2rem;
    min-width: 0;
    padding: .6rem .7rem;
    border-radius: 10px;
    background: var(--ct-accent-soft);
    border: 1px solid var(--ct-border-subtle);
}

.vh-tile-label {
    font-size: .62rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ct-text-secondary);
}

.vh-tile-value {
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--ct-accent-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vh-tile-value.vh-tile-value-long {
    font-size: 1rem;
    line-height: 1.2;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.vh-tile-detail {
    font-size: .68rem;
    color: var(--ct-text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vh-tone-warn .vh-tile-value {
    color: #d48806;
}

body[data-theme="dark"] .vh-tone-warn .vh-tile-value {
    color: #f5a524;
}

@media (max-width: 640px) {
    .vh-tiles {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.checkbox-inline {
    display: inline-flex !important;
    align-items: center;
    gap: .55rem;
    margin-top: .5rem;
    margin-left: -.4rem;
    padding: .32rem .6rem .32rem .4rem;
    border-radius: 8px;
    font-size: .8rem !important;
    font-weight: 500 !important;
    color: var(--ct-text-secondary) !important;
    cursor: pointer;
    user-select: none;
    transition: background-color .15s ease, color .15s ease;
}

.checkbox-inline:hover {
    background: var(--ct-accent-soft);
    color: var(--ct-text-primary) !important;
}

.checkbox-inline:has(input:checked) {
    color: var(--ct-text-primary) !important;
}

.checkbox-inline input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    position: relative;
    flex-shrink: 0;
    display: inline-grid;
    place-content: center;
    width: 18px !important;
    height: 18px !important;
    margin: 0;
    padding: 0 !important;
    border: 1.5px solid var(--ct-text-tertiary) !important;
    border-radius: 5px !important;
    background: var(--ct-surface) !important;
    box-shadow: none !important;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .1s ease;
}

.checkbox-inline input[type="checkbox"]::after {
    content: "";
    width: 12px;
    height: 12px;
    background-color: var(--ct-on-accent);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
    transform: scale(0);
    transition: transform .18s cubic-bezier(.2, .9, .3, 1.4);
}

.checkbox-inline:hover input[type="checkbox"] {
    border-color: var(--ct-brand) !important;
}

.checkbox-inline input[type="checkbox"]:checked {
    background: var(--ct-brand) !important;
    border-color: var(--ct-brand) !important;
}

.checkbox-inline input[type="checkbox"]:checked::after {
    transform: scale(1);
}

.checkbox-inline input[type="checkbox"]:focus {
    outline: none;
}

.checkbox-inline input[type="checkbox"]:focus-visible {
    box-shadow: 0 0 0 3px rgba(137, 243, 54, .35) !important;
}

.checkbox-inline input[type="checkbox"]:active {
    transform: scale(.9);
}

.checkbox-inline input[type="checkbox"]:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.field input:disabled {
    opacity: .55;
    cursor: not-allowed;
    background: var(--ct-border-subtle);
}