﻿/* TrafficWatch NI Plugin - screenshot-inspired dashboard */

:root {
    --twni-maroon: #5f37d8;
    --twni-accent-orange: #FF7E26;
    --twni-ink: #392f57;
    --twni-muted: #766d93;
    --twni-line: #d9d4eb;
    --twni-white: #ffffff;
    --twni-shadow: 0 12px 30px rgba(68, 45, 122, 0.1);
    --twni-incidents: #5f37d8;
    --twni-roadworks: #FF7E26;
    --twni-events: #7b49e5;
    --twni-news: #5d4d8b;
    --twni-cameras: #4a74d7;
    --twni-icon-backplate: #5f37d8;
    --twni-icon-incidents: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='white' d='M12 3 22 21H2z'/%3E%3Crect x='11' y='9' width='2' height='6' rx='1' fill='%235f37d8'/%3E%3Ccircle cx='12' cy='17.5' r='1.2' fill='%235f37d8'/%3E%3C/svg%3E");
    --twni-icon-roadworks: url("3967195.png");
    --twni-icon-events: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='white' d='M7 2h2v3H7zm8 0h2v3h-2zM5 5h14a1 1 0 0 1 1 1v13a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1zm1 6v7h12v-7zm0-3v1h12V8z'/%3E%3C/svg%3E");
    --twni-icon-news: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='white' d='M5 4h11a2 2 0 0 1 2 2v10a4 4 0 0 0 1 2H8a3 3 0 0 1-3-3zm3 3v2h7V7zm0 4v2h7v-2zm0 4v2h5v-2zM6 19a1 1 0 0 0 1-1V6H5v12a1 1 0 0 0 1 1z'/%3E%3C/svg%3E");
    --twni-icon-cameras: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='white' d='M7 7h2.2l1.2-2h3.2l1.2 2H17a3 3 0 0 1 3 3v6a3 3 0 0 1-3 3H7a3 3 0 0 1-3-3v-6a3 3 0 0 1 3-3zm5 3.2A4.3 4.3 0 1 0 16.3 14 4.3 4.3 0 0 0 12 10.2zm0 2A2.3 2.3 0 1 1 9.7 14 2.3 2.3 0 0 1 12 12.2z'/%3E%3C/svg%3E");
    --twni-icon-approx: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='white' d='M12 2a7 7 0 0 1 7 7c0 4.5-5.2 10.5-7 13-1.8-2.5-7-8.5-7-13a7 7 0 0 1 7-7zm0 4.2A2.8 2.8 0 1 0 14.8 9 2.8 2.8 0 0 0 12 6.2z'/%3E%3C/svg%3E");
}

.twni-wrap {
    position: relative;
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.45;
    color: var(--twni-ink);
    background: var(--twni-white);
    border: 1px solid var(--twni-line);
    box-shadow: var(--twni-shadow);
}

.twni-shell {
    display: grid;
    grid-template-columns: minmax(320px, 410px) minmax(0, 1fr);
    align-items: stretch;
    min-height: 520px;
}

.twni-wrap--list .twni-shell {
    grid-template-columns: minmax(0, 1fr);
    min-height: auto;
}

.twni-wrap--expanded .twni-shell {
    grid-template-columns: minmax(560px, 760px) minmax(320px, 1fr);
}

.twni-wrap--list.twni-wrap--expanded .twni-shell {
    grid-template-columns: minmax(0, 1fr);
}

.twni-sidebar {
    display: flex;
    flex-direction: column;
    background: #fbf9fa;
    border-right: 1px solid var(--twni-line);
    min-width: 0;
}

.twni-sidebar--full {
    border-right: 0;
}

.twni-sidebar__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 22px 14px;
    border-bottom: 1px solid var(--twni-line);
    background: linear-gradient(180deg, #ffffff 0%, #fbf8fa 100%);
}

.twni-sidebar__title {
    margin: 0;
    color: var(--twni-maroon);
    font-size: clamp(28px, 2.6vw, 40px);
    line-height: 1;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.twni-sidebar__title::after {
    content: "";
    display: block;
    width: 12px;
    height: 12px;
    margin-top: 8px;
    background: var(--twni-maroon);
    clip-path: polygon(0 0, 100% 0, 70% 100%, 0 100%);
}

.twni-expand,
.twni-mapbar__button,
.twni-region-select {
    border: 1px solid #cfc5cb;
    background: #ffffff;
    color: #6b6570;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
    transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.twni-expand:hover,
.twni-mapbar__button:hover,
.twni-region-select:hover {
    border-color: #6f46ee;
    color: #4f2ac8;
    background: #f4efff;
    box-shadow: 0 8px 16px rgba(95, 55, 216, 0.12);
}

.twni-wrap--expanded .twni-expand {
    background: var(--twni-maroon);
    color: #ffffff;
    border-color: var(--twni-maroon);
    box-shadow: 0 8px 18px rgba(138, 36, 54, 0.18);
}

.twni-feednav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px 20px 0;
}

.twni-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--twni-line);
    border-radius: 999px;
    background: #ffffff;
    color: var(--twni-maroon);
    cursor: pointer;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
}

.twni-tab:hover {
    border-color: rgba(95, 55, 216, 0.34);
    background: #f5efff;
    color: #4f2ac8;
}

.twni-icon-badge {
    --twni-current-icon: var(--twni-icon-incidents);
    --twni-current-icon-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--twni-icon-backplate);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.18);
}

.twni-icon-badge::before {
    content: "";
    width: var(--twni-current-icon-size);
    height: var(--twni-current-icon-size);
    background: center / contain no-repeat var(--twni-current-icon);
}

.twni-icon-badge--incidents,
.twni-layer-option--incidents .twni-layer-option__icon,
.twni-legend__item--incidents::before,
.twni-marker-symbol--incidents {
    --twni-current-icon: var(--twni-icon-incidents);
    --twni-current-icon-size: 14px;
}

.twni-icon-badge--roadworks,
.twni-layer-option--roadworks .twni-layer-option__icon,
.twni-legend__item--roadworks::before,
.twni-marker-symbol--roadworks {
    --twni-current-icon: var(--twni-icon-roadworks);
    --twni-current-icon-size: 16px;
}

.twni-icon-badge--events,
.twni-layer-option--events .twni-layer-option__icon,
.twni-legend__item--events::before,
.twni-marker-symbol--events {
    --twni-current-icon: var(--twni-icon-events);
    --twni-current-icon-size: 14px;
}

.twni-icon-badge--news,
.twni-layer-option--news .twni-layer-option__icon,
.twni-legend__item--news::before,
.twni-marker-symbol--news {
    --twni-current-icon: var(--twni-icon-news);
    --twni-current-icon-size: 14px;
}

.twni-icon-badge--cameras,
.twni-layer-option--cameras .twni-layer-option__icon,
.twni-legend__item--cameras::before,
.twni-marker-symbol--cameras {
    --twni-current-icon: var(--twni-icon-cameras);
    --twni-current-icon-size: 14px;
}

.twni-icon-badge--approx,
.twni-layer-option--approx .twni-layer-option__icon,
.twni-legend__item--approx::before,
.twni-marker-symbol--approx {
    --twni-current-icon: var(--twni-icon-approx);
    --twni-current-icon-size: 14px;
}

.twni-tab__icon {
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
    border-radius: 999px;
}

.twni-tab--active {
    background: var(--twni-maroon);
    border-color: var(--twni-maroon);
    color: #ffffff;
}

.twni-tab--active .twni-tab__label {
    color: #ffffff;
}

.twni-tab--active .twni-tab__icon {
    background: rgba(255, 255, 255, 0.18);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}

.twni-badge {
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(138, 36, 54, 0.12);
    color: inherit;
    font-size: 11px;
    font-weight: 700;
}

.twni-tab--active .twni-badge {
    background: #ffffff;
    color: #4f2ac8;
}

.twni-sidebar__body {
    padding: 14px 18px 18px;
    overflow: auto;
    min-height: 0;
}

.twni-panel {
    display: none;
}

.twni-panel--active {
    display: block;
}

.twni-item + .twni-item {
    margin-top: 10px;
}

.twni-item__card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border: 1px solid var(--twni-line);
    border-radius: 6px;
    background: #ffffff;
    color: inherit;
    text-decoration: none;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
    transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

button.twni-item__card {
    width: 100%;
    text-align: left;
    cursor: pointer;
    font: inherit;
}

.twni-item__card--news {
    align-items: flex-start;
    cursor: pointer;
}

.twni-item__card--accordion {
    align-items: flex-start;
    cursor: pointer;
}

.twni-item__card:hover {
    border-color: #bca7b0;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(98, 64, 75, 0.08);
}

.twni-item__icon {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    position: relative;
    border: 1px solid rgba(123, 70, 83, 0.14);
    border-radius: 14px;
    background: linear-gradient(180deg, #b13d51 0%, #8a2436 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.34), 0 10px 20px rgba(138, 36, 54, 0.18);
}

.twni-item__icon::after {
    content: "";
    position: absolute;
    inset: 3px;
    border-radius: 11px;
    background: linear-gradient(180deg, rgba(255,255,255,0.18) 0%, rgba(255,255,255,0.02) 100%);
}

.twni-item__icon::before {
    position: relative;
    z-index: 1;
}

.twni-item__icon--events {
    background: linear-gradient(180deg, #c97b92 0%, #aa556a 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.34), 0 10px 20px rgba(168, 77, 98, 0.18);
}
.twni-item__icon--news {
    background: linear-gradient(180deg, #8d6ff3 0%, #5f37d8 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.34), 0 10px 20px rgba(95, 55, 216, 0.2);
}

.twni-item__icon--cameras {
    background: linear-gradient(180deg, #5b9ab9 0%, #346f92 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.34), 0 10px 20px rgba(46, 111, 149, 0.2);
}

.twni-item__icon--roadworks {
    background: linear-gradient(180deg, #ff9a51 0%, #cf6115 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.34), 0 10px 20px rgba(207, 97, 21, 0.22);
}

.twni-item__body {
    flex: 1 1 auto;
    min-width: 0;
}

.twni-item__title {
    color: var(--twni-maroon);
    font-size: 16px;
    font-weight: 700;
    margin: 0;
}

.twni-item__desc {
    margin-top: 4px;
    color: var(--twni-muted);
    font-size: 13px;
}

.twni-item__accordion {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #ebe2e6;
}

.twni-item__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 6px;
    color: var(--twni-muted);
    font-size: 12px;
}

.twni-item__pin {
    padding: 1px 8px;
    border-radius: 999px;
    background: #f1ecef;
    color: var(--twni-maroon);
    font-weight: 700;
}

.twni-item__chevron {
    flex: 0 0 auto;
    color: var(--twni-maroon);
    font-size: 40px;
    line-height: 1;
    font-weight: 300;
    transition: transform 0.2s ease;
}

.twni-item__card--expanded .twni-item__chevron {
    transform: rotate(90deg);
}

.twni-item__actions {
    margin-top: 12px;
}

.twni-item__link {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    background: #111111;
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
}

.twni-empty {
    padding: 42px 18px;
    border: 1px dashed #ccbfc6;
    border-radius: 8px;
    background: #ffffff;
    color: var(--twni-muted);
    text-align: center;
}

.twni-status-stack {
    display: grid;
    gap: 8px;
    padding: 14px 18px 0;
}

.twni-status {
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid #ddd4d9;
    background: #faf8f9;
    color: #5e5661;
    font-size: 13px;
    font-weight: 600;
}

.twni-status--warning {
    border-color: rgba(207, 97, 21, 0.35);
    background: #fff5ec;
    color: #9d4d17;
}

.twni-status--muted {
    border-color: #ddd7cf;
    background: #fbfaf7;
    color: #6d665f;
}

.twni-status--ok {
    border-color: #cfe3d8;
    background: #f4faf6;
    color: #36644a;
}

.twni-mapstage {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #efedf0;
    overflow: visible;
    z-index: 1;
}

.twni-mapbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 14px 0;
    flex-wrap: wrap;
    position: relative;
    overflow: visible;
    z-index: 1200;
}

.twni-mapbar__modes,
.twni-mapbar__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.twni-mapbar__mode {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 14px;
    background: #ffffff;
    border: 1px solid var(--twni-line);
    color: var(--twni-maroon);
    font-size: 13px;
    font-weight: 600;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
}

.twni-mapbar__mode--active {
    background: var(--twni-maroon);
    border-color: var(--twni-maroon);
    color: #ffffff;
    font-weight: 700;
}

.twni-mapbar__chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 8px 14px;
    background: #f3edf0;
    color: var(--twni-maroon);
    font-size: 12px;
    font-weight: 700;
    border-radius: 999px;
    border: 1px solid #d8cfd5;
    cursor: pointer;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
}

.twni-mapbar__chip--active {
    background: var(--twni-maroon);
    color: #ffffff;
    border-color: var(--twni-maroon);
}

.twni-mapbar__chip:not(.twni-mapbar__chip--active) {
    background: #f3edf0;
    color: var(--twni-maroon);
}

.twni-mapbar__chip[data-layer-quick="cameras"] {
    background: #edf4f8;
    color: var(--twni-cameras);
    border: 1px solid #c7d9e5;
}

.twni-mapbar__chip[data-layer-quick="cameras"]:not(.twni-mapbar__chip--active) {
    background: #edf4f8;
    color: var(--twni-cameras);
}

.twni-mapbar__button { min-height: 38px; }
.twni-mapbar__button--active { border-color: var(--twni-maroon); color: var(--twni-maroon); }

.twni-layer-control {
    position: relative;
    overflow: visible;
}

.twni-layer-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 190px;
    padding: 10px;
    display: grid;
    gap: 8px;
    background: #ffffff;
    color: #2f2a30;
    border: 1px solid #d7d0d5;
    border-radius: 8px;
    box-shadow: 0 14px 30px rgba(43, 32, 37, 0.18);
    z-index: 1300;
}

.twni-layer-menu[hidden] {
    display: none;
}

.twni-layer-option {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #4b4450;
}

.twni-layer-option input {
    accent-color: var(--twni-maroon);
}

.twni-layer-option__icon {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 22px;
    border-radius: 999px;
    background: var(--twni-icon-backplate);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.18);
}

.twni-layer-option__icon::before {
    content: "";
    width: var(--twni-current-icon-size);
    height: var(--twni-current-icon-size);
    background: center / contain no-repeat var(--twni-current-icon);
}

.twni-region-control {
    display: inline-flex;
    align-items: center;
}

.twni-region-select {
    min-height: 34px;
    padding-right: 28px;
}

.twni-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.94);
    border-top: 1px solid #ddd6db;
    border-bottom: 1px solid #ddd6db;
    position: relative;
    z-index: 1;
}

.twni-legend__item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    background: #ffffff;
    color: var(--twni-ink);
    border: 1px solid #ddd6db;
}

.twni-legend__item::before {
    content: "";
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background-color: var(--twni-icon-backplate);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.18);
    background-image: var(--twni-current-icon);
    background-repeat: no-repeat;
    background-position: center;
    background-size: var(--twni-current-icon-size) var(--twni-current-icon-size);
}

.twni-button-caret {
    display: inline-block;
    margin-left: 6px;
    font-size: 11px;
    line-height: 1;
}

.twni-map {
    position: relative;
    z-index: 1;
    min-height: 420px;
    background: #d9e3e8;
}

.leaflet-pane,
.leaflet-control,
.leaflet-top,
.leaflet-bottom {
    z-index: 400;
}

.twni-map-marker {
    background: transparent;
    border: 0;
}

.twni-marker-badge {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 14px;
    color: #ffffff;
    font: 800 10px/1 "Segoe UI", Tahoma, Arial, sans-serif;
    letter-spacing: 0.04em;
    border: 2px solid rgba(255, 255, 255, 0.96);
    box-shadow: 0 10px 18px rgba(35, 24, 29, 0.26);
}

.twni-marker-badge::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -6px;
    width: 10px;
    height: 10px;
    background: inherit;
    border-right: 2px solid rgba(255, 255, 255, 0.96);
    border-bottom: 2px solid rgba(255, 255, 255, 0.96);
    transform: translateX(-50%) rotate(45deg);
    border-bottom-right-radius: 3px;
}

.twni-marker-badge--incidents {
    background: linear-gradient(180deg, #b13d51 0%, #8a2436 100%);
}

.twni-marker-badge--roadworks {
    background: linear-gradient(180deg, #ff9a51 0%, #cf6115 100%);
}

.twni-marker-badge--events {
    background: linear-gradient(180deg, #c06d86 0%, #a84d62 100%);
}

.twni-marker-badge--news {
    background: linear-gradient(180deg, #cf7382 0%, #b34c5d 100%);
}

.twni-marker-badge--cameras {
    background: linear-gradient(180deg, #4d90b3 0%, #2e6f95 100%);
}

.twni-marker-badge--approx {
    background: linear-gradient(180deg, #8b8490 0%, #67606c 100%);
}

.twni-marker-symbol {
    width: 16px;
    height: 16px;
    position: relative;
    z-index: 1;
    transform: translateY(-2px);
    background: center / contain no-repeat var(--twni-current-icon);
}

.twni-camera-open {
    border: 1px solid #d8ccd2;
    background: #ffffff;
    color: var(--twni-maroon);
    border-radius: 6px;
    padding: 7px 10px;
    font: 700 12px/1.2 "Segoe UI", Tahoma, Arial, sans-serif;
    cursor: pointer;
}

.twni-camera-open:hover {
    border-color: var(--twni-maroon);
    background: #faf4f6;
}

.twni-camera-modal[hidden] {
    display: none;
}

.twni-camera-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
}

.twni-camera-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(27, 20, 23, 0.72);
}

.twni-camera-modal__dialog {
    position: relative;
    z-index: 1;
    max-width: min(1100px, calc(100vw - 32px));
    margin: 32px auto;
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.28);
    padding: 18px 18px 20px;
}

.twni-camera-modal__close {
    float: right;
    border: 0;
    background: #f3edf0;
    color: var(--twni-maroon);
    border-radius: 999px;
    padding: 8px 12px;
    font: 700 12px/1 "Segoe UI", Tahoma, Arial, sans-serif;
    cursor: pointer;
}

.twni-camera-modal__title {
    padding: 6px 0 14px;
    color: #322d33;
    font-size: 20px;
    font-weight: 700;
}

.twni-camera-modal__body {
    clear: both;
}

.twni-camera-modal__status {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    color: #6d6670;
    font-weight: 600;
}

.twni-camera-modal__image {
    display: block;
    width: 100%;
    max-height: calc(100vh - 160px);
    object-fit: contain;
    border-radius: 12px;
    background: #111;
}

.twni-camera-modal-open {
    overflow: hidden;
}

.twni-item-modal[hidden] {
    display: none;
}

.twni-item-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
}

.twni-item-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(27, 20, 23, 0.72);
}

.twni-item-modal__dialog {
    position: relative;
    z-index: 1;
    max-width: min(720px, calc(100vw - 32px));
    margin: 40px auto;
    background: #ffffff;
    color: #322d33;
    border-radius: 18px;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.28);
    padding: 20px;
}

.twni-item-modal__close {
    float: right;
    border: 0;
    background: #f3edf0;
    color: var(--twni-maroon);
    border-radius: 999px;
    padding: 8px 12px;
    font: 700 12px/1 "Segoe UI", Tahoma, Arial, sans-serif;
    cursor: pointer;
}

.twni-item-modal__title {
    clear: both;
    color: #322d33;
    font-size: 24px;
    font-weight: 700;
}

.twni-item-modal__date {
    margin-top: 8px;
    color: #7b7480;
    font-size: 13px;
    font-weight: 600;
}

.twni-item-modal__body {
    margin-top: 16px;
    color: #4b4450;
    font-size: 15px;
    line-height: 1.6;
    white-space: pre-wrap;
}

.twni-item-modal__dialog strong,
.twni-item-modal__dialog b,
.twni-item-modal__dialog span,
.twni-item-modal__dialog p,
.twni-item-modal__dialog li,
.twni-item-modal__dialog em {
    color: inherit;
}

.twni-item-modal__actions {
    margin-top: 18px;
}

.twni-item-modal__actions:empty {
    display: none;
}

.twni-item-modal__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 8px;
    background: var(--twni-maroon);
    color: #ffffff;
    text-decoration: none;
    font-weight: 700;
}

.twni-item-modal__link:hover {
    background: #741c2c;
}

.twni-item-modal-open {
    overflow: hidden;
}

.twni-item--active .twni-item__card {
    border-color: var(--twni-maroon);
    box-shadow: 0 0 0 2px rgba(138, 36, 54, 0.14), 0 8px 20px rgba(98, 64, 75, 0.12);
}

.twni-footer {
    padding: 16px 28px 20px;
    border-top: 1px solid var(--twni-line);
    color: #6f6873;
    text-align: center;
    font-size: 13px;
    line-height: 1.6;
    background: #ffffff;
}

.twni-footer__refresh {
    color: var(--twni-maroon);
    font-weight: 700;
}

.twni-footer a {
    color: var(--twni-maroon);
    text-decoration: none;
}

.twni-footer a:hover {
    text-decoration: underline;
}

.twni-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.72);
    color: var(--twni-maroon);
    font-size: 16px;
    font-weight: 700;
    z-index: 10;
}

@media (max-width: 980px) {
    .twni-shell,
    .twni-wrap--expanded .twni-shell {
        grid-template-columns: 1fr;
    }

    .twni-sidebar {
        border-right: 0;
        border-bottom: 1px solid var(--twni-line);
    }

    .twni-wrap--expanded .twni-sidebar__title,
    .twni-wrap--expanded .twni-feednav,
    .twni-wrap--expanded .twni-sidebar__body {
        opacity: 1;
        pointer-events: auto;
    }

    .twni-mapbar {
        align-items: stretch;
    }

    .twni-mapbar__modes,
    .twni-mapbar__actions {
        width: 100%;
    }

    .twni-mapbar__modes,
    .twni-mapbar__actions {
        flex-wrap: wrap;
    }

    .twni-map {
        min-height: 360px;
    }
}

@media (max-width: 640px) {
    .twni-wrap {
        border-radius: 14px;
        overflow: hidden;
    }

    .twni-sidebar__header,
    .twni-mapbar {
        padding-left: 14px;
        padding-right: 14px;
    }

    .twni-sidebar__title {
        font-size: 24px;
    }

    .twni-sidebar__header {
        flex-wrap: wrap;
    }

    .twni-expand {
        width: 100%;
    }

    .twni-feednav {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        padding: 12px 14px 0;
    }

    .twni-tab {
        justify-content: space-between;
        width: 100%;
        min-width: 0;
        padding: 10px 12px;
        border-radius: 14px;
        min-height: 48px;
    }

    .twni-tab__label {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .twni-tab__icon {
        flex: 0 0 24px;
        width: 24px;
        height: 24px;
    }

    .twni-sidebar__body {
        padding: 12px 14px 16px;
    }

    .twni-status-stack {
        padding: 12px 14px 0;
    }

    .twni-mapbar {
        gap: 10px;
        padding-top: 14px;
    }

    .twni-mapbar__modes,
    .twni-mapbar__actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .twni-mapbar__mode,
    .twni-mapbar__chip,
    .twni-mapbar__button,
    .twni-region-control,
    .twni-region-select {
        width: 100%;
        min-width: 0;
    }

    .twni-mapbar__mode,
    .twni-mapbar__chip,
    .twni-mapbar__button,
    .twni-region-control {
        justify-content: center;
        min-height: 40px;
        padding-left: 12px;
        padding-right: 12px;
    }

    .twni-region-select {
        min-height: 40px;
        padding-left: 12px;
        padding-right: 12px;
    }

    .twni-layer-control {
        width: 100%;
    }

    .twni-layer-menu {
        left: 0;
        right: 0;
        min-width: 0;
    }

    .twni-region-control {
        display: block;
    }

    .twni-legend {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .twni-legend__item {
        justify-content: flex-start;
        min-width: 0;
        padding: 8px 10px;
    }

    .twni-item__card {
        gap: 10px;
        padding: 11px 12px;
        border-radius: 12px;
    }

    .twni-item__title {
        font-size: 15px;
        line-height: 1.35;
    }

    .twni-item__chevron {
        font-size: 32px;
    }

    .twni-item__icon {
        flex: 0 0 36px;
        width: 36px;
        height: 36px;
        border-radius: 12px;
    }

    .twni-item__icon::before {
        width: 18px;
        height: 18px;
    }

    .twni-item__meta {
        gap: 8px;
    }

    .twni-map {
        min-height: 320px;
    }

    .twni-camera-modal__dialog {
        max-width: calc(100vw - 16px);
        margin: 8px auto;
        padding: 14px 14px 16px;
        border-radius: 14px;
        max-height: calc(100vh - 16px);
        overflow: auto;
    }

    .twni-camera-modal__title {
        padding-right: 72px;
        font-size: 18px;
    }

    .twni-camera-modal__status {
        min-height: 180px;
    }

    .twni-item-modal__dialog {
        max-width: calc(100vw - 16px);
        margin: 10px auto;
        padding: 16px;
        border-radius: 14px;
        max-height: calc(100vh - 20px);
        overflow: auto;
    }

    .twni-item-modal__title {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .twni-feednav,
    .twni-legend,
    .twni-mapbar__modes,
    .twni-mapbar__actions {
        grid-template-columns: 1fr;
    }

    .twni-sidebar__title {
        font-size: 22px;
    }

    .twni-tab {
        padding: 11px 12px;
    }

    .twni-item__card {
        align-items: flex-start;
    }

    .twni-item__chevron {
        align-self: center;
        font-size: 28px;
    }
}

/* Travel Hub refresh */

.twni-wrap--dashboard {
    border: 0;
    border-radius: 28px;
    overflow: hidden;
    background:
        radial-gradient(circle at top right, rgba(192, 34, 66, 0.12), transparent 28%),
        linear-gradient(180deg, #fffdfd 0%, #fbf7f8 100%);
    box-shadow: 0 22px 56px rgba(61, 26, 37, 0.14);
}

.twni-network-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 22px 28px 0;
    padding: 12px;
    border-radius: 999px;
    background: linear-gradient(90deg, #6d3fe6 0%, #4d2e96 45%, #372161 100%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.1), 0 18px 38px rgba(51, 30, 98, 0.24);
}

.twni-network-nav__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    padding: 0 22px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255,255,255,0.96);
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.twni-network-nav__link:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
    transform: translateY(-1px);
}

.twni-network-nav__link--active {
    background: #ffffff;
    color: #382f5d;
    box-shadow: 0 10px 20px rgba(16, 10, 36, 0.22);
}

.twni-network-nav__link--active:hover {
    background: #f3ecff;
    color: #2f2553;
    box-shadow: 0 12px 24px rgba(16, 10, 36, 0.24);
}

.twni-hub {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr);
    gap: 18px;
    padding: 28px 28px 22px;
    border-bottom: 1px solid rgba(138, 36, 54, 0.12);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(251, 241, 244, 0.92) 100%);
}

.twni-hub__eyebrow,
.twni-sectionhead__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    color: var(--twni-maroon);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.twni-hub__eyebrow::before,
.twni-sectionhead__eyebrow::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--twni-accent-orange), var(--twni-maroon));
}

.twni-hub__title {
    margin: 0;
    max-width: 12ch;
    color: #3b2330;
    font-size: clamp(34px, 5vw, 54px);
    line-height: 0.95;
    letter-spacing: -0.05em;
}

.twni-hub__lead {
    max-width: 58ch;
    margin: 14px 0 0;
    color: #6b5863;
    font-size: 16px;
}

.twni-hub__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.twni-hub__action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 16px;
    border-radius: 999px;
    border: 1px solid rgba(95, 55, 216, 0.14);
    background: #fff;
    color: var(--twni-maroon);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 8px 18px rgba(70, 45, 122, 0.08);
}

.twni-hub__action:hover {
    border-color: var(--twni-accent-orange);
    background: #fff3ea;
    color: #a74d10;
    transform: translateY(-1px);
}

.twni-hub__latest {
    margin-top: 16px;
    color: #7d5c68;
    font-size: 13px;
    font-weight: 600;
}

.twni-hub__stats {
    display: grid;
    gap: 12px;
    align-content: stretch;
}

.twni-stat {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 114px;
    padding: 18px 20px;
    border: 1px solid rgba(95, 55, 216, 0.1);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 14px 28px rgba(70, 45, 122, 0.08);
}

.twni-stat__value {
    color: #2f1e28;
    font-size: clamp(28px, 4vw, 42px);
    font-weight: 800;
    line-height: 1;
}

.twni-stat__label {
    margin-top: 8px;
    color: #7c6570;
    font-size: 13px;
    font-weight: 600;
}

.twni-shell {
    gap: 18px;
    padding: 24px 28px 28px;
    background: transparent;
}

.twni-sidebar,
.twni-mapstage {
    border: 1px solid rgba(95, 55, 216, 0.1);
    border-radius: 24px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 18px 34px rgba(70, 45, 122, 0.08);
}

.twni-sidebar__header,
.twni-mapbar {
    border-bottom-color: rgba(138, 36, 54, 0.12);
}

.twni-sidebar__header {
    padding-bottom: 10px;
}

.twni-sidebar__title {
    font-size: clamp(24px, 3vw, 34px);
}

.twni-sidebar__title::after {
    width: 46px;
    height: 4px;
    margin-top: 10px;
    border-radius: 999px;
    clip-path: none;
}

.twni-sectionhead {
    padding: 18px 22px 0;
}

.twni-sectionhead--map {
    padding-bottom: 10px;
}

.twni-sectionhead__title {
    margin: 0;
    color: #3b2330;
    font-size: 26px;
    line-height: 1.05;
    letter-spacing: -0.04em;
}

.twni-sectionhead__text {
    margin: 8px 0 0;
    color: #7a6670;
    font-size: 14px;
}

.twni-feednav {
    padding-top: 18px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
    gap: 10px;
    align-items: stretch;
}

.twni-tab {
    min-height: 44px;
    background: linear-gradient(180deg, #fff 0%, #f8f4ff 100%);
    color: #4f2ac8;
    box-shadow: 0 6px 14px rgba(70, 45, 122, 0.08);
    width: 100%;
    justify-content: flex-start;
    gap: 10px;
}

.twni-tab--active {
    background: linear-gradient(180deg, #6b43e5 0%, #4f2ac8 100%);
    border-color: #4f2ac8;
    color: #ffffff;
    box-shadow: 0 10px 24px rgba(95, 55, 216, 0.24);
}

.twni-tab--active:hover {
    background: linear-gradient(180deg, #6b43e5 0%, #4f2ac8 100%);
    color: #ffffff;
}

.twni-tab__label {
    flex: 1 1 auto;
    min-width: 0;
    color: inherit;
}

.twni-tab__icon {
    background: #5f37d8;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.14);
}

.twni-tab .twni-badge {
    margin-left: auto;
}

.twni-sidebar__body {
    padding-bottom: 10px;
}

.twni-panel {
    padding-top: 10px;
}

.twni-item__card {
    border-radius: 18px;
    background: linear-gradient(180deg, #ffffff 0%, #fdf8f9 100%);
    box-shadow: 0 10px 24px rgba(70, 45, 122, 0.06);
}

.twni-item__card:hover,
.twni-item__card:focus-visible {
    border-color: rgba(95, 55, 216, 0.24);
    background: linear-gradient(180deg, #ffffff 0%, #f5efff 100%);
    box-shadow: 0 14px 28px rgba(70, 45, 122, 0.1);
}

.twni-mapstage {
    padding-bottom: 0;
}

.twni-mapbar {
    padding-top: 14px;
    background: linear-gradient(180deg, #fff 0%, #fbf7f8 100%);
    align-items: stretch;
}

.twni-mapbar__modes {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
}

.twni-mapbar__actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    width: 100%;
    align-items: stretch;
}

.twni-mapbar__mode,
.twni-mapbar__chip,
.twni-mapbar__button,
.twni-region-control {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    justify-content: center;
    border-radius: 16px;
    box-sizing: border-box;
}

.twni-mapbar__mode {
    background: linear-gradient(180deg, #fff 0%, #f8f4ff 100%);
    color: #4f2ac8;
    box-shadow: 0 6px 14px rgba(70, 45, 122, 0.08);
}

.twni-mapbar__mode:hover,
.twni-mapbar__chip:hover,
.twni-mapbar__button:hover {
    background: #f5efff;
    color: #4f2ac8;
    border-color: rgba(95, 55, 216, 0.34);
}

.twni-mapbar__mode--active,
.twni-mapbar__chip--active {
    background: linear-gradient(180deg, #6b43e5 0%, #4f2ac8 100%);
    border-color: #4f2ac8;
    color: #ffffff;
    box-shadow: 0 10px 24px rgba(95, 55, 216, 0.24);
}

.twni-mapbar__mode--active:hover,
.twni-mapbar__chip--active:hover {
    background: linear-gradient(180deg, #6b43e5 0%, #4f2ac8 100%);
    color: #ffffff;
}

.twni-mapbar__chip[data-layer-quick="cameras"] {
    background: linear-gradient(180deg, #fff 0%, #f8f4ff 100%);
    color: #4f2ac8;
    border: 1px solid var(--twni-line);
}

.twni-mapbar__chip[data-layer-quick="cameras"].twni-mapbar__chip--active {
    background: linear-gradient(180deg, #6b43e5 0%, #4f2ac8 100%);
    color: #ffffff;
    border-color: #4f2ac8;
}

.twni-layer-control,
.twni-region-control {
    width: 100%;
    min-width: 0;
    display: flex;
}

.twni-layer-control > .twni-mapbar__button,
.twni-layer-button {
    width: 100%;
}

.twni-region-select {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 0 38px 0 14px;
    border-radius: 16px;
    box-sizing: border-box;
    appearance: none;
    display: block;
    margin: 0;
    line-height: 1.2;
    background-image:
        linear-gradient(45deg, transparent 50%, #5f37d8 50%),
        linear-gradient(135deg, #5f37d8 50%, transparent 50%);
    background-position:
        calc(100% - 18px) calc(50% - 3px),
        calc(100% - 12px) calc(50% - 3px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

.twni-legend {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

.twni-legend__item {
    min-width: 0;
    justify-content: flex-start;
}

.twni-legend {
    padding-left: 22px;
    padding-right: 22px;
}

.twni-map {
    margin: 0 22px 22px;
    border-radius: 22px;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(138, 36, 54, 0.08);
}

.twni-footer {
    padding: 0 28px 26px;
    background: transparent;
}

@media (max-width: 980px) {
    .twni-hub {
        grid-template-columns: 1fr;
    }

    .twni-hub__title {
        max-width: none;
    }

    .twni-shell {
        padding-top: 18px;
    }
}

@media (max-width: 640px) {
    .twni-wrap--dashboard {
        border-radius: 20px;
    }

    .twni-network-nav {
        margin: 16px 16px 0;
        padding: 10px;
        border-radius: 24px;
    }

    .twni-network-nav__link {
        width: 100%;
        min-height: 46px;
        justify-content: flex-start;
        padding: 0 16px;
        border-radius: 18px;
        font-size: 15px;
    }

    .twni-hub,
    .twni-shell,
    .twni-footer {
        padding-left: 16px;
        padding-right: 16px;
    }

    .twni-stat {
        min-height: 96px;
    }

    .twni-sectionhead {
        padding-left: 16px;
        padding-right: 16px;
    }

    .twni-map {
        margin-left: 16px;
        margin-right: 16px;
        margin-bottom: 16px;
        border-radius: 18px;
    }
}

/* Stronger orange accent pass */

.twni-tab .twni-tab__icon.twni-icon-badge--roadworks {
    background: linear-gradient(180deg, #ff9a51 0%, #cf6115 100%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), 0 8px 16px rgba(207, 97, 21, 0.18);
}

.twni-tab--active:has(.twni-icon-badge--roadworks) {
    background: linear-gradient(180deg, #ff9a51 0%, #cf6115 100%);
    border-color: #cf6115;
    box-shadow: 0 10px 24px rgba(207, 97, 21, 0.24);
}

.twni-tab--active:has(.twni-icon-badge--roadworks):hover {
    background: linear-gradient(180deg, #ff9a51 0%, #cf6115 100%);
    color: #ffffff;
}

.twni-tab--active:has(.twni-icon-badge--roadworks) .twni-badge {
    color: #b65211;
}

.twni-mapbar__chip[data-layer-quick="roadworks"],
.twni-layer-option--roadworks {
    border-color: rgba(207, 97, 21, 0.22);
}

.twni-legend__item--roadworks {
    background: #fff3ea;
    border-color: rgba(207, 97, 21, 0.18);
    color: #9d4d17;
}

.twni-stat:first-child {
    background:
        linear-gradient(135deg, rgba(255, 126, 38, 0.14), rgba(95, 55, 216, 0.06)),
        rgba(255,255,255,0.92);
    border-color: rgba(207, 97, 21, 0.18);
}

.twni-stat:first-child .twni-stat__value {
    color: #b65211;
}

/* ==========================================================================
   Northern Ireland Online design system refresh
   ========================================================================== */

:root {
    /* Global palette */
    --nio-purple: #6D28D9;
    --nio-purple-dark: #5B21B6;
    --nio-purple-soft: #EDE9FE;
    --nio-bg: #F8FAFC;
    --nio-card: #FFFFFF;
    --nio-border: #E5E7EB;
    --nio-text: #1F2937;
    --nio-text-muted: #6B7280;
    --nio-danger: #EF4444;
    --nio-warning: #F59E0B;
    --nio-info: #3B82F6;
    --nio-success: #10B981;
    --nio-neutral: #F9FAFB;
    --nio-shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.05);
    --nio-shadow-md: 0 10px 24px rgba(15, 23, 42, 0.06);

    /* Bridge existing plugin vars to the new palette */
    --twni-maroon: var(--nio-purple);
    --twni-accent-orange: var(--nio-warning);
    --twni-ink: var(--nio-text);
    --twni-muted: var(--nio-text-muted);
    --twni-line: var(--nio-border);
    --twni-white: var(--nio-card);
    --twni-shadow: var(--nio-shadow-md);
    --twni-incidents: var(--nio-danger);
    --twni-roadworks: var(--nio-warning);
    --twni-events: var(--nio-purple);
    --twni-news: var(--nio-purple);
    --twni-cameras: var(--nio-info);
    --twni-icon-backplate: var(--nio-purple);
}

body .twni-wrap {
    color: var(--nio-text);
    background: var(--nio-bg);
    border: 1px solid var(--nio-border);
    border-radius: 24px;
    box-shadow: var(--nio-shadow-md);
    overflow: hidden;
}

body .twni-wrap--dashboard,
body .twni-wrap--full,
body .twni-wrap--map,
body .twni-wrap--list {
    background: var(--nio-bg);
}

body .twni-shell,
body .twni-hub,
body .twni-footer,
body .twni-sectionhead,
body .twni-network-nav {
    background: transparent;
}

body .twni-sidebar,
body .twni-mapstage,
body .twni-hub__panel,
body .twni-stat,
body .twni-mapbar,
body .twni-legend,
body .twni-item-modal__dialog,
body .twni-camera-modal__dialog {
    background: var(--nio-card);
}

/* Buttons */
body .twni-expand,
body .twni-mapbar__button,
body .twni-region-select,
body .twni-layer-button,
body .twni-network-nav__link,
body .twni-hub__action,
body .twni-item__link {
    border: 1px solid var(--nio-border);
    background: var(--nio-card);
    color: var(--nio-text);
    box-shadow: none;
    border-radius: 12px;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

body .twni-expand:hover,
body .twni-mapbar__button:hover,
body .twni-region-select:hover,
body .twni-layer-button:hover,
body .twni-network-nav__link:hover,
body .twni-hub__action:hover,
body .twni-item__link:hover {
    border-color: rgba(109, 40, 217, 0.28);
    background: var(--nio-neutral);
    color: var(--nio-purple);
    box-shadow: none;
}

body .twni-wrap--expanded .twni-expand,
body .twni-mapbar__mode--active,
body .twni-network-nav__link--active,
body .twni-hub__action--primary,
body .twni-item__link--primary {
    background: var(--nio-purple);
    border-color: var(--nio-purple);
    color: #ffffff;
    box-shadow: 0 16px 32px rgba(109, 40, 217, 0.18);
}

body .twni-wrap--expanded .twni-expand:hover,
body .twni-mapbar__mode--active:hover,
body .twni-network-nav__link--active:hover,
body .twni-hub__action--primary:hover,
body .twni-item__link--primary:hover {
    background: var(--nio-purple-dark);
    border-color: var(--nio-purple-dark);
    color: #ffffff;
}

/* Cards / containers */
body .twni-sidebar,
body .twni-mapstage {
    border-color: var(--nio-border);
}

body .twni-sidebar__header,
body .twni-mapbar,
body .twni-sectionhead {
    background: var(--nio-card);
    border-bottom: 1px solid var(--nio-border);
}

body .twni-sidebar__title,
body .twni-sectionhead__title,
body .twni-item-modal__title,
body .twni-camera-modal__title {
    color: var(--nio-purple);
}

body .twni-sidebar__title::after,
body .twni-sectionhead__eyebrow::before {
    background: var(--nio-purple);
}

body .twni-item__card,
body .twni-stat,
body .twni-hub__panel,
body .twni-empty,
body .twni-status,
body .twni-layer-menu,
body .twni-map,
body .twni-item-modal__dialog,
body .twni-camera-modal__dialog {
    background: var(--nio-card);
    border: 1px solid var(--nio-border);
    box-shadow: var(--nio-shadow-sm);
}

body .twni-item__card:hover,
body .twni-item__card:focus-visible,
body .twni-stat:hover {
    border-color: rgba(109, 40, 217, 0.22);
    background: #FCFCFF;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}

body .twni-item__title,
body .twni-item-modal__meta strong,
body .twni-camera-modal__meta strong,
body .twni-stat__value,
body .twni-stat__label {
    color: var(--nio-text);
}

body .twni-item__desc,
body .twni-item__meta,
body .twni-footer,
body .twni-status,
body .twni-item-modal__meta,
body .twni-camera-modal__meta,
body .twni-stat__hint {
    color: var(--nio-text-muted);
}

body .twni-item__accordion,
body .twni-status + .twni-status {
    border-top-color: var(--nio-border);
}

body .twni-item__chevron {
    color: var(--nio-purple);
}

body .twni-item__pin {
    background: var(--nio-purple-soft);
    color: var(--nio-purple);
}

/* Pills / chips */
body .twni-feednav,
body .twni-legend {
    gap: 12px;
}

body .twni-tab,
body .twni-mapbar__chip,
body .twni-legend__item,
body .twni-layer-option {
    border: 1px solid var(--nio-border);
    background: var(--nio-card);
    color: var(--nio-text);
    box-shadow: none;
}

body .twni-tab:hover,
body .twni-mapbar__chip:hover,
body .twni-legend__item:hover,
body .twni-layer-option:hover {
    border-color: rgba(109, 40, 217, 0.24);
    background: var(--nio-neutral);
    color: var(--nio-purple);
}

body .twni-tab--active {
    background: var(--nio-purple-soft);
    border-color: var(--nio-purple);
    color: var(--nio-purple);
    box-shadow: none;
}

body .twni-tab--active .twni-tab__label {
    color: var(--nio-purple);
}

body .twni-badge {
    background: #F3F4F6;
    color: var(--nio-text-muted);
}

body .twni-tab--active .twni-badge,
body .twni-mapbar__chip--active .twni-badge {
    background: rgba(109, 40, 217, 0.12);
    color: var(--nio-purple);
}

body .twni-mapbar__mode {
    background: var(--nio-card);
    color: var(--nio-text);
    border: 1px solid var(--nio-border);
    box-shadow: none;
}

body .twni-mapbar__mode:hover,
body .twni-mapbar__button:hover,
body .twni-mapbar__chip:hover {
    background: var(--nio-neutral);
}

body .twni-mapbar__mode--active,
body .twni-mapbar__chip--active {
    background: var(--nio-purple-soft);
    border-color: var(--nio-purple);
    color: var(--nio-purple);
    box-shadow: none;
}

body .twni-mapbar__mode--active {
    color: #ffffff;
}

body .twni-mapbar__chip--active .twni-mapbar__chip-icon,
body .twni-mapbar__chip--active .twni-mapbar__chip-dot {
    background: currentColor;
}

body .twni-mapbar__chip[data-layer-quick="cameras"] {
    background: var(--nio-card);
    color: var(--nio-text);
    border-color: var(--nio-border);
}

body .twni-mapbar__chip[data-layer-quick="cameras"].twni-mapbar__chip--active {
    background: var(--nio-purple-soft);
    color: var(--nio-purple);
    border-color: var(--nio-purple);
}

body .twni-layer-menu {
    border-color: var(--nio-border);
    box-shadow: 0 22px 44px rgba(15, 23, 42, 0.14);
}

body .twni-region-select {
    color: var(--nio-text);
    background-color: var(--nio-card);
    border-color: var(--nio-border);
    background-image:
        linear-gradient(45deg, transparent 50%, var(--nio-purple) 50%),
        linear-gradient(135deg, var(--nio-purple) 50%, transparent 50%);
}

body .twni-region-select:focus,
body .twni-expand:focus,
body .twni-mapbar__button:focus,
body .twni-mapbar__mode:focus,
body .twni-mapbar__chip:focus,
body .twni-tab:focus,
body .twni-layer-button:focus,
body .twni-network-nav__link:focus,
body .twni-hub__action:focus,
body .twni-item__link:focus {
    outline: 3px solid rgba(109, 40, 217, 0.2);
    outline-offset: 2px;
    border-color: var(--nio-purple);
}

/* Status colours */
body .twni-icon-badge,
body .twni-tab__icon,
body .twni-legend__item::before,
body .twni-layer-option__icon {
    background: var(--nio-purple);
}

body .twni-icon-badge--incidents,
body .twni-item__icon--incidents,
body .twni-legend__item--incidents::before,
body .twni-layer-option--incidents .twni-layer-option__icon {
    background: var(--nio-danger);
}

body .twni-icon-badge--roadworks,
body .twni-item__icon--roadworks,
body .twni-legend__item--roadworks::before,
body .twni-layer-option--roadworks .twni-layer-option__icon {
    background: var(--nio-warning);
}

body .twni-icon-badge--events,
body .twni-item__icon--events,
body .twni-legend__item--events::before,
body .twni-layer-option--events .twni-layer-option__icon {
    background: var(--nio-purple);
}

body .twni-icon-badge--news,
body .twni-item__icon--news,
body .twni-legend__item--news::before,
body .twni-layer-option--news .twni-layer-option__icon {
    background: #7C3AED;
}

body .twni-icon-badge--cameras,
body .twni-item__icon--cameras,
body .twni-legend__item--cameras::before,
body .twni-layer-option--cameras .twni-layer-option__icon {
    background: var(--nio-info);
}

body .twni-icon-badge--approx,
body .twni-legend__item--approx::before,
body .twni-layer-option--approx .twni-layer-option__icon {
    background: #94A3B8;
}

body .twni-item__icon {
    border-color: rgba(229, 231, 235, 0.95);
    box-shadow: none;
}

body .twni-item__icon--events,
body .twni-item__icon--news,
body .twni-item__icon--cameras,
body .twni-item__icon--roadworks,
body .twni-item__icon--incidents {
    box-shadow: none;
}

body .twni-status {
    background: #F9FAFB;
    border-color: var(--nio-border);
}

body .twni-status--success {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.22);
    color: #047857;
}

body .twni-status--warning {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.26);
    color: #B45309;
}

body .twni-status--error,
body .twni-status--danger {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.24);
    color: #B91C1C;
}

body .twni-empty {
    color: var(--nio-text-muted);
    background: var(--nio-neutral);
    border-style: dashed;
}

body .twni-footer {
    color: var(--nio-text-muted);
}

body .twni-footer a {
    color: var(--nio-purple);
}

body .twni-footer a:hover {
    color: var(--nio-purple-dark);
}

@media (max-width: 980px) {
    body .twni-wrap {
        border-radius: 20px;
    }

    body .twni-mapbar__actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    body .twni-wrap {
        border-radius: 18px;
    }

    body .twni-sidebar__header,
    body .twni-mapbar,
    body .twni-legend,
    body .twni-footer {
        padding-left: 16px;
        padding-right: 16px;
    }

    body .twni-feednav,
    body .twni-mapbar__modes,
    body .twni-mapbar__actions,
    body .twni-legend {
        gap: 12px;
    }
}

/* ==========================================================================
   Active primary tabs
   ========================================================================== */

body .twni-mapbar__mode--active,
body .twni-network-nav__link--active,
body .twni-mapbar__mode.active,
body .twni-mapbar__mode.is-active,
body .twni-network-nav__link.active,
body .twni-network-nav__link.is-active,
body [aria-selected="true"].twni-mapbar__mode,
body [aria-selected="true"].twni-network-nav__link {
    background: var(--nio-purple);
    color: #FFFFFF;
    border-color: var(--nio-purple);
    box-shadow: none;
}

body .twni-mapbar__mode--active:hover,
body .twni-network-nav__link--active:hover,
body .twni-mapbar__mode.active:hover,
body .twni-mapbar__mode.is-active:hover,
body .twni-network-nav__link.active:hover,
body .twni-network-nav__link.is-active:hover,
body [aria-selected="true"].twni-mapbar__mode:hover,
body [aria-selected="true"].twni-network-nav__link:hover {
    background: var(--nio-purple-dark);
    color: #FFFFFF;
    border-color: var(--nio-purple-dark);
}

body .twni-tab--active,
body .twni-tab.active,
body .twni-tab.is-active,
body .twni-tab.selected,
body [aria-selected="true"].twni-tab {
    background: var(--nio-purple);
    color: #FFFFFF;
    border-color: var(--nio-purple);
    box-shadow: none;
}

body .twni-tab--active .twni-tab__label,
body .twni-tab.active .twni-tab__label,
body .twni-tab.is-active .twni-tab__label,
body .twni-tab.selected .twni-tab__label,
body [aria-selected="true"].twni-tab .twni-tab__label {
    color: #FFFFFF;
}

body .twni-tab--active .twni-badge,
body .twni-tab.active .twni-badge,
body .twni-tab.is-active .twni-badge,
body .twni-tab.selected .twni-badge,
body [aria-selected="true"].twni-tab .twni-badge {
    background: rgba(255, 255, 255, 0.18);
    color: #FFFFFF;
}

body .twni-tab--active .twni-tab__icon,
body .twni-tab.active .twni-tab__icon,
body .twni-tab.is-active .twni-tab__icon,
body .twni-tab.selected .twni-tab__icon,
body [aria-selected="true"].twni-tab .twni-tab__icon {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

/* ==========================================================================
   Active filter chips
   ========================================================================== */

body .twni-mapbar__chip--active,
body .twni-mapbar__chip.active,
body .twni-mapbar__chip.is-active,
body .twni-mapbar__chip.selected,
body [aria-selected="true"].twni-mapbar__chip,
body .twni-legend__item.active,
body .twni-legend__item.is-active,
body .twni-legend__item.selected,
body .twni-layer-option.active,
body .twni-layer-option.is-active,
body .twni-layer-option.selected {
    background: var(--nio-purple-soft);
    color: var(--nio-purple-dark);
    border-color: var(--nio-purple);
    box-shadow: none;
}

body .twni-mapbar__chip--active:hover,
body .twni-mapbar__chip.active:hover,
body .twni-mapbar__chip.is-active:hover,
body .twni-mapbar__chip.selected:hover,
body [aria-selected="true"].twni-mapbar__chip:hover,
body .twni-legend__item.active:hover,
body .twni-legend__item.is-active:hover,
body .twni-legend__item.selected:hover,
body .twni-layer-option.active:hover,
body .twni-layer-option.is-active:hover,
body .twni-layer-option.selected:hover {
    background: #E9E2FF;
    color: var(--nio-purple-dark);
    border-color: var(--nio-purple);
}

body .twni-mapbar__chip--active *,
body .twni-mapbar__chip.active *,
body .twni-mapbar__chip.is-active *,
body .twni-mapbar__chip.selected *,
body [aria-selected="true"].twni-mapbar__chip *,
body .twni-legend__item.active *,
body .twni-legend__item.is-active *,
body .twni-legend__item.selected *,
body .twni-layer-option.active *,
body .twni-layer-option.is-active *,
body .twni-layer-option.selected * {
    color: inherit;
}

body .twni-mapbar__chip--active .twni-badge,
body .twni-mapbar__chip.active .twni-badge,
body .twni-mapbar__chip.is-active .twni-badge,
body .twni-mapbar__chip.selected .twni-badge,
body [aria-selected="true"].twni-mapbar__chip .twni-badge {
    background: rgba(109, 40, 217, 0.12);
    color: var(--nio-purple-dark);
}

/* semantic dots/icons stay readable without flooding the chip */
body .twni-mapbar__chip .twni-icon-badge,
body .twni-legend__item::before,
body .twni-layer-option__icon {
    flex-shrink: 0;
}

/* ==========================================================================
   Area selector cleanup
   ========================================================================== */

body .twni-region-control::before,
body .twni-region-control::after,
body .twni-region-select::before,
body .twni-region-select::after {
    content: none !important;
}

body .twni-region-control {
    position: relative;
}

body .twni-region-select {
    background-color: #FFFFFF;
    color: var(--nio-text);
    border: 1px solid var(--nio-border);
    padding: 0 42px 0 14px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5.5 7.5 10 12l4.5-4.5' fill='none' stroke='%236B7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.8'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 14px 14px;
    box-shadow: none;
    clip-path: none;
    transform: none;
}

body .twni-region-select:hover {
    background-color: #FFFFFF;
    border-color: rgba(109, 40, 217, 0.28);
    color: var(--nio-text);
}

body .twni-region-select:focus,
body .twni-region-select:focus-visible {
    outline: 3px solid rgba(109, 40, 217, 0.18);
    outline-offset: 2px;
    border-color: var(--nio-purple);
    background-color: #FFFFFF;
}

/* Map controls spacing refinement */
body .twni-mapbar {
    padding: 18px 22px 14px;
    gap: 14px;
}

body .twni-mapbar__modes,
body .twni-mapbar__actions {
    gap: 14px;
}

body .twni-mapbar__modes {
    align-items: stretch;
}

body .twni-mapbar__mode,
body .twni-mapbar__chip,
body .twni-mapbar__button,
body .twni-region-select {
    min-height: 46px;
    padding-inline: 16px;
}

body .twni-region-control {
    min-width: 0;
}

@media (max-width: 980px) {
    body .twni-mapbar {
        padding: 16px 18px 14px;
    }

    body .twni-mapbar__modes,
    body .twni-mapbar__actions {
        gap: 12px;
    }
}

@media (max-width: 640px) {
    body .twni-mapbar {
        padding: 14px 16px 12px;
        gap: 12px;
    }
}

/* Traffic panel expand behaviour */
body .twni-wrap--dashboard .twni-shell,
body .twni-wrap--full .twni-shell {
    grid-template-columns: minmax(360px, 430px) minmax(0, 1fr);
}

body .twni-wrap--dashboard.twni-wrap--expanded .twni-shell,
body .twni-wrap--full.twni-wrap--expanded .twni-shell {
    grid-template-columns: minmax(560px, 720px) minmax(320px, 1fr);
}

body .twni-wrap--dashboard.twni-wrap--expanded .twni-sidebar,
body .twni-wrap--full.twni-wrap--expanded .twni-sidebar {
    box-shadow: 0 18px 34px rgba(15, 23, 42, 0.08);
}

@media (max-width: 980px) {
    body .twni-wrap--dashboard .twni-shell,
    body .twni-wrap--full .twni-shell,
    body .twni-wrap--dashboard.twni-wrap--expanded .twni-shell,
    body .twni-wrap--full.twni-wrap--expanded .twni-shell {
        grid-template-columns: 1fr;
    }
}

/* Shared project navigation refinement */
body .twni-network-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 22px 28px 0;
    padding: 18px;
    border: 1px solid var(--nio-border);
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(248, 250, 252, 0.98) 100%);
    box-shadow: var(--nio-shadow-sm);
}

body .twni-network-nav__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    padding: 0 22px;
    border: 1px solid var(--nio-border);
    border-radius: 16px;
    background: #FFFFFF;
    color: var(--nio-text);
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    box-shadow: none;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

body .twni-network-nav__link:hover {
    background: #F9FAFB;
    border-color: rgba(109, 40, 217, 0.24);
    color: var(--nio-purple);
    box-shadow: none;
    transform: translateY(-1px);
}

body .twni-network-nav__link--active {
    background: var(--nio-purple);
    border-color: var(--nio-purple);
    color: #FFFFFF;
    box-shadow: 0 8px 18px rgba(109, 40, 217, 0.16);
}

body .twni-network-nav__link--active:hover {
    background: var(--nio-purple-dark);
    border-color: var(--nio-purple-dark);
    color: #FFFFFF;
    box-shadow: 0 10px 22px rgba(91, 33, 182, 0.18);
}

@media (max-width: 980px) {
    body .twni-network-nav {
        margin: 18px 18px 0;
        padding: 14px;
        border-radius: 22px;
    }
}

@media (max-width: 640px) {
    body .twni-network-nav {
        margin: 16px 16px 0;
        padding: 12px;
        gap: 10px;
        border-radius: 20px;
    }

    body .twni-network-nav__link {
        width: 100%;
        justify-content: flex-start;
        min-height: 46px;
        padding: 0 16px;
        border-radius: 14px;
    }
}
