:root {
    --bg: #f7f9fb;
    --card: #ffffff;
    --text: #171a1f;
    --muted: #59626f;
    --border: #d9dee5;
    --accent: #232a31;
    --accent-strong: #14181d;
    --accent-red: #b10f0f;
    --accent-soft: #edf1f6;
    --shadow-sm: 0 1px 0 rgba(17, 24, 39, 0.04), 0 8px 20px rgba(17, 24, 39, 0.08);
    --shadow-md: 0 18px 40px rgba(17, 24, 39, 0.16);
    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-sm: 10px;
    --font-body: "IBM Plex Sans", "Segoe UI", sans-serif;
    --font-display: "Chakra Petch", "IBM Plex Sans", "Segoe UI", sans-serif;
}

.badge strong {
    font-weight: 800
}

* {
    box-sizing: border-box
}

body {
    font-family: var(--font-body);
    margin: 0;
    background: var(--bg);
    background-image: none;
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Topbar */
.topbar {
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid rgba(230, 223, 211, 0.9);
    position: sticky;
    top: 0;
    z-index: 20;
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(12px);
}

.topbar-inner {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.brand {
    display: flex;
    align-items: center;
    text-decoration: none
}

.brand-logo {
    height: 46px;
    width: auto;
    display: block
}

.container {
    padding: 18px 20px;
    max-width: 1400px;
    margin: 0 auto
}

.site-footer {
    width: 100%;
    margin: 8px 0 14px;
    padding: 14px 18px;
    color: var(--muted);
    font-size: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.75);
    box-shadow: var(--shadow-sm);
}

.site-footer-inner {
    display: flex;
    align-items: center;
    gap: 16px;
}

.site-footer-left,
.site-footer-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
}

.site-footer-text {
    flex: 1 1 auto;
    text-align: center;
}

.site-footer-logo {
    display: block;
    height: 46px;
    width: auto;
}

.site-footer-right .site-footer-logo {
    height: 54px;
}

.site-footer a {
    color: inherit;
    font-weight: 600;
    text-decoration: none;
}

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

/* Cards / Grid */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px;
    box-shadow: var(--shadow-sm);
}

.grid {
    display: grid;
    gap: 12px
}

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

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

.kpi {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.01em
}

.auth-title,
.auth-intro-title,
.dashboard-map-title,
.dashboard-claims-title,
.license-overview-title,
.license-kpi-value,
.license-chart-title,
.license-tile-title,
.license-modal-section-title,
.modal-title,
.docs-markdown h1,
.docs-markdown h2,
.docs-markdown h3,
.docs-markdown h4 {
    font-family: var(--font-display);
    letter-spacing: -0.015em;
}

.kpi-card-link {
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.kpi-card-link:hover {
    box-shadow: 0 0 0 1px rgba(31, 42, 68, 0.2), 0 16px 26px rgba(31, 42, 68, 0.16);
    transform: translateY(-1px);
}

.kpi-doc-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.kpi-doc-icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent);
    flex: 0 0 auto;
}

.kpi-doc-icon svg {
    width: 20px;
    height: 20px;
}

.kpi-doc-text {
    display: grid;
    gap: 4px;
}

.muted {
    color: var(--muted)
}

.loading-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.spinner {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #d7d1c6;
    border-top-color: var(--accent);
    animation: spin 0.8s linear infinite;
    flex: 0 0 auto;
}

.cache-indicator {
    display: none;
    align-items: center;
    justify-content: center;
    margin-left: 6px;
    padding: 1px 6px;
    font-size: 10px;
    font-weight: 700;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    background: #f3f4f6;
    color: #374151;
    line-height: 1.4;
    cursor: pointer;
}

.cache-indicator.active {
    display: inline-flex;
}

@keyframes spin {
    to {
        transform: rotate(360deg)
    }
}

/* Dashboard trends */
.dashboard-trends {
    margin-top: 12px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    gap: 12px;
    align-items: stretch;
}

.dashboard-metrics {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.dashboard-metric {
    padding: 10px;
    position: relative;
    overflow: hidden;
    min-height: 92px;
}

.dashboard-metric .kpi {
    font-size: 16px;
}

.dashboard-banner {
    position: relative;
    padding: 0;
    height: 92px;
    display: block;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    text-decoration: none;
    box-shadow: var(--shadow-sm);
}

.dashboard-banner img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center;
}

.dashboard-banner::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 45%, rgba(0, 0, 0, 0.45) 100%);
    pointer-events: none;
}

.dashboard-banner-text {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 10px;
    z-index: 1;
    color: #ffffff;
    font-weight: 800;
    font-size: 13px;
    line-height: 1.2;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    font-family: var(--font-display);
    letter-spacing: 0.01em;
}

.dashboard-banner:hover {
    filter: brightness(1.02);
}

.dashboard-metric-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 2px;
    padding-right: 8px;
}

.dashboard-metric-chart {
    position: absolute;
    inset: 0;
    z-index: 1;
    opacity: 0.9;
    pointer-events: auto;
}

.dashboard-metric-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.dashboard-claims {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px;
    background: var(--card);
    min-height: 100%;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.dashboard-claims-title {
    font-weight: 800;
}

.dashboard-claims-body {
    margin-top: 10px;
    font-size: 12px;
    flex: 1;
}

.dashboard-weather-wrap {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.dashboard-weather-title {
    font-weight: 800;
    margin-bottom: 2px;
}

.dashboard-weather {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.weather-card {
    padding: 12px;
    min-height: 92px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 8px;
}

.weather-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.weather-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.weather-icon {
    width: 48px;
    height: 48px;
    object-fit: contain;
    flex: 0 0 auto;
}

.weather-label {
    font-weight: 700;
    font-size: 14px;
}

.weather-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.weather-percent {
    font-size: 16px;
    font-weight: 800;
}

.weather-text {
    font-size: 12px;
}

.dashboard-map-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dashboard-map-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.dashboard-map-title {
    font-weight: 800;
}

.dashboard-map-subtitle {
    font-size: 12px;
    margin-top: 4px;
}

.dashboard-map-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.map-filter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #374151;
}

.map-filter input {
    width: 14px;
    height: 14px;
    accent-color: var(--accent);
}

.dashboard-map-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.country-map {
    position: relative;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: linear-gradient(135deg, #f5f8fd 0%, #eaf0f7 100%);
    overflow: hidden;
    min-height: 340px;
    aspect-ratio: 20 / 13;
}

.country-map-image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    object-position: center;
}

.country-map-dots {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.map-dot {
    position: absolute;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    border: 2px solid #ffffff;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.18);
    opacity: 0.9;
}

.map-dot.active {
    background: rgba(177, 15, 15, 0.9);
}

.map-dot.relays {
    background: rgba(35, 42, 49, 0.85);
}

.map-dot.bots {
    background: rgba(72, 88, 104, 0.85);
}

.map-dot.merged {
    background: rgba(177, 15, 15, 0.85);
}

.country-map-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    font-size: 12px;
}

.country-list-section {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px;
    background: #ffffff;
}

.country-list-title {
    font-weight: 700;
    margin-bottom: 8px;
}

.country-list-item {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 4px 0;
    border-bottom: 1px solid #efe9df;
}

.country-list-item:last-child {
    border-bottom: none;
}

.country-list-country {
    font-weight: 600;
}

.country-list-pct {
    font-weight: 700;
}

/* Form controls */
input {
    padding: 11px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    width: 100%;
    min-width: 0;
    outline: none;
    background: #fff;
    color: var(--text);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

input,
select,
textarea {
    font-family: var(--font-body);
}

input:focus {
    border-color: rgba(31, 42, 68, 0.4);
    box-shadow: 0 0 0 4px rgba(31, 42, 68, 0.12);
}

input::placeholder {
    color: #8b94a3;
}

.license-select {
    padding: 11px 36px 11px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    width: 100%;
    min-width: 0;
    outline: none;
    background-color: #fff;
    font-size: 13px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px 8px;
}

.license-select:focus {
    border-color: rgba(31, 42, 68, 0.4);
    box-shadow: 0 0 0 4px rgba(31, 42, 68, 0.12);
}

.licenses-divider {
    width: 1px;
    height: 38px;
    background: var(--border);
}

.btn-add-license {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--accent);
    background: var(--accent);
    color: #ffffff;
    font-weight: 700;
    box-shadow: 0 10px 18px rgba(31, 42, 68, 0.18);
}

.btn-add-license:hover {
    background: var(--accent-strong);
    border-color: var(--accent-strong);
    color: #ffffff;
}

.audit-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.license-summary-right {
    position: relative;
    display: flex;
    align-items: center;
    margin-left: auto;
    flex: 1 1 auto;
    justify-content: flex-end;
    min-height: 20px;
}

.license-summary-logo {
    position: absolute;
    right: 350px;
    top: 50%;
    transform: translateY(-50%);
    height: 16px;
    width: auto;
    pointer-events: none;
}

.license-summary-badges {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.license-inline-badges {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 10px;
    flex-wrap: wrap;
}

.license-tile .license-inline-badges,
.license-modal-section .license-inline-badges {
    margin-left: 0;
}

.license-overview {
    background: #f6f8fb;
}

.license-overview-title {
    font-size: 16px;
    font-weight: 900;
}

.license-overview-subtitle {
    font-size: 12px;
    margin-top: 4px;
}

.license-kpi-grid {
    display: grid;
    gap: 12px;
    margin-top: 12px;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.license-kpi {
    background: rgba(31, 42, 68, 0.04);
    border: 1px solid rgba(31, 42, 68, 0.08);
    border-radius: var(--radius-md);
    padding: 12px;
    display: grid;
    gap: 6px;
}

.license-kpi-label {
    font-size: 12px;
    color: var(--muted);
    font-weight: 700;
}

.license-kpi-value {
    font-size: 20px;
    font-weight: 900;
}

.license-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.license-chart-title {
    font-size: 14px;
    font-weight: 800;
}

.license-chart-subtitle {
    font-size: 12px;
}

.license-chart-legend {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--muted);
    font-weight: 700;
}

.license-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.license-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    display: inline-block;
}

.license-legend-dot.honey {
    background: var(--accent-red);
}

.license-legend-dot.events {
    background: var(--accent);
}

.license-chart-wrap {
    position: relative;
}

.license-overview .license-chart-wrap {
    background: #f1f4f8;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px;
}

.license-chart-canvas {
    width: 100% !important;
    height: 400px !important;
}

.license-modal-chart {
    width: 100% !important;
    height: 240px !important;
    display: block;
}

.license-chart-status {
    font-size: 12px;
    margin-bottom: 6px;
}

.license-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.license-tile {
    text-align: left;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    cursor: pointer;
    transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}

.license-tile:hover {
    transform: translateY(-1px);
    border-color: rgba(31, 42, 68, 0.2);
    box-shadow: 0 14px 24px rgba(15, 23, 42, 0.12);
}

.license-tile:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(31, 42, 68, 0.12);
}

.license-tile-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.license-tile-title {
    font-weight: 900;
    font-size: 15px;
}

.license-tile-subtitle {
    font-size: 12px;
}

.license-tile-logo {
    height: 18px;
    width: auto;
    flex: 0 0 auto;
}

.license-tile-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.license-tile-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 12px;
}

.license-tile-spark {
    margin-top: 6px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.license-sparkline-item {
    flex: 0 0 40%;
    display: grid;
    gap: 4px;
}

.license-sparkline-wrap {
    position: relative;
}

.license-sparkline {
    width: 100%;
    height: 28px;
    display: block;
}

.license-sparkline polyline {
    stroke: var(--accent);
    stroke-opacity: .35;
    stroke-width: 2;
    fill: none;
}

.license-sparkline-label {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 10px;
    color: var(--muted);
    opacity: .6;
    line-height: 1.1;
    pointer-events: none;
}

.license-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.license-detail-modal .modal-card {
    max-width: 980px;
}

.license-modal-head {
    display: flex;
    align-items: center;
    gap: 10px;
}

.license-modal-logo {
    height: 22px;
    width: auto;
}

.license-modal-section-title {
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 10px;
}

.license-modal-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.license-modal-stats {
    gap: 18px;
}

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

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

    .license-detail-modal .modal-card {
        max-width: 100%;
    }

    .license-modal-grid {
        grid-template-columns: 1fr;
    }
}

.license-collect-label {
    color: #6b7280;
    font-size: 11px;
    font-weight: 600;
}

.badge-state.license-collect-badge {
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 500;
    border-radius: 4px;
}

.badge-state.license-status-not-activated {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: #374151;
}

.badge-state.license-status-auditing {
    background: #fef3c7;
    border-color: #fcd34d;
    color: #92400e;
}

.badge-state.license-status-approved {
    background: #dcfce7;
    border-color: #86efac;
    color: #166534;
}

.badge-state.license-status-refused {
    background: #fee2e2;
    border-color: #fecaca;
    color: #991b1b;
}

.badge-state.admin-badge {
    padding: 3px 8px;
    font-size: 11px;
    border-radius: 8px;
}

.badge-state.admin-badge.admin-badge-ok {
    background: #dcfce7;
    border-color: #86efac;
    color: #166534;
}

.badge-state.admin-badge.admin-badge-warn {
    background: #fef3c7;
    border-color: #fcd34d;
    color: #92400e;
}

.badge-state.admin-badge.admin-badge-bad {
    background: #fee2e2;
    border-color: #fecaca;
    color: #991b1b;
}

.badge-state.admin-badge.admin-badge-info {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: #3730a3;
}

.admin-ip-link {
    text-decoration: none;
    border-bottom: 1px dashed transparent;
}

.admin-ip-link:hover {
    color: #111827;
    border-bottom-color: #9ca3af;
}

.badge-state.admin-badge.license-status-not-activated {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: #374151;
}

.badge-state.admin-badge.license-status-auditing {
    background: #fef3c7;
    border-color: #fcd34d;
    color: #92400e;
}

.badge-state.admin-badge.license-status-approved {
    background: #dcfce7;
    border-color: #86efac;
    color: #166534;
}

.badge-state.admin-badge.license-status-refused {
    background: #fee2e2;
    border-color: #fecaca;
    color: #991b1b;
}

button {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.96);
    color: var(--text);
    cursor: pointer;
    font-family: var(--font-body);
    transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease, background .12s ease;
}

button:hover {
    background: #ffffff;
    border-color: rgba(31, 42, 68, 0.2);
    box-shadow: 0 10px 20px rgba(17, 24, 39, 0.12);
    transform: translateY(-1px)
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: 11px 12px;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(31, 42, 68, 0.2);
    font-weight: 700;
    letter-spacing: 0.01em;
}

.btn-primary:hover {
    background: var(--accent-strong);
    border-color: var(--accent-strong);
    box-shadow: 0 12px 24px rgba(15, 26, 43, 0.28)
}

/* Search bar */
.search {
    width: 520px;
    max-width: 55vw
}

.search input {
    padding-left: 38px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235b6472' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><line x1='20' y1='20' x2='16.5' y2='16.5'/></svg>");
    background-repeat: no-repeat;
    background-position: 12px center;
    background-size: 16px 16px;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid var(--border);
    font-size: 12px;
    margin-right: 6px;
    background: rgba(255, 255, 255, 0.8);
}

.danger {
    border-color: #ffb3b3;
    background: #fff1f1
}

.ok {
    border-color: #b8f0c2;
    background: #f1fff4
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse
}

.table th,
.table td {
    padding: 8px;
    border-bottom: 1px solid #efe9df;
    text-align: left;
}

.licenses-logs-table tbody tr:nth-child(even) {
    background: rgba(35, 42, 49, 0.04);
}

.licenses-logs-table tbody tr:hover {
    background: rgba(35, 42, 49, 0.08);
}

/* ===== Auth pages (pro/business) ===== */
.auth-wrap {
    min-height: calc(100vh - 64px);
    display: grid;
    place-items: center;
    padding: 24px 16px;
}

body.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body.auth-page .container {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    max-width: 1400px;
    width: 100%;
    position: relative;
}

body.auth-page .footer-container {
    flex: 0 0 auto;
}

body.auth-page .auth-wrap {
    min-height: 0;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 500px;
    margin: 0 auto;
}

body.auth-page.auth-login .auth-wrap {
    width: min(980px, 100%);
    align-items: center;
}

.auth-stack {
    width: min(680px, 100%);
    display: grid;
    gap: 20px;
    align-items: center;
}

body.auth-page.auth-login .auth-stack {
    width: min(980px, 100%);
    margin-top: 0;
}

.login-split {
    width: min(1100px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.login-left {
    position: relative;
    padding: 40px 42px;
    color: #f9fafb;
    background: linear-gradient(135deg, #1f2a44 0%, #18243a 55%, #0f1a2b 100%);
    display: flex;
    align-items: center;
}

.login-left::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(600px 320px at 12% 18%, rgba(195, 90, 44, 0.35), transparent 60%),
        radial-gradient(520px 360px at 85% 80%, rgba(231, 237, 246, 0.12), transparent 60%);
    opacity: 0.9;
}

.login-left::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url('/assets/world-map.svg');
    background-repeat: no-repeat;
    background-position: center;
    background-size: 120% auto;
    opacity: 0.12;
}

.login-left-inner {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 16px;
    max-width: 420px;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.login-logo {
    height: 58px;
    width: auto;
    display: block;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.3));
}

.login-left-title {
    font-family: var(--font-display);
    font-size: 28px;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.login-left-text {
    color: rgba(249, 250, 251, 0.82);
    font-size: 14px;
    line-height: 1.6;
    display: grid;
    gap: 10px;
}

.login-right {
    padding: 32px 32px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card-plain {
    width: min(420px, 100%);
    max-width: 420px;
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
}

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

    .login-left {
        padding: 32px 28px;
        min-height: 260px;
    }

    .login-left::after {
        background-size: 160% auto;
        opacity: 0.1;
    }

    .login-right {
        padding: 24px;
    }

    .login-card-plain {
        max-width: 520px;
    }
}

.auth-intro-card {
    width: 100%;
    max-width: 980px;
    margin: 0 auto;
}

.login-card {
    width: min(480px, 100%);
    max-width: 480px;
    margin: 0 auto;
}

.auth-card {
    width: min(680px, 100%);
    max-width: 680px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.96);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.auth-header {
    padding: 18px 18px 12px 18px;
    border-bottom: 1px solid #efe9df;
}

.auth-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.auth-title {
    font-size: 18px;
    font-weight: 800
}

.auth-subtitle {
    color: var(--muted);
    font-size: 13px;
    margin-top: 2px
}

.auth-intro-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--accent-strong);
    margin-bottom: 8px;
}

.auth-intro-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 6px;
}

.auth-intro-logo {
    width: 300px;
    height: auto;
    object-fit: contain;
    flex: 0 0 auto;
}

.auth-intro-text {
    color: #374151;
    font-size: 13px;
    line-height: 1.6;
    display: grid;
    gap: 10px;
}

.auth-body {
    padding: 18px
}

.auth-form {
    display: block
}

.form-row {
    display: grid;
    gap: 6px;
    margin-bottom: 12px
}

.label {
    font-size: 12px;
    color: #374151;
    font-weight: 600
}

.auth-actions {
    display: grid;
    gap: 10px;
    margin-top: 10px
}

.auth-footer {
    padding: 14px 18px;
    border-top: 1px solid #efe9df;
    background: rgba(255, 255, 255, 0.9);
    color: var(--muted);
    font-size: 13px;
}

.auth-footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 700
}

.auth-footer a:hover {
    text-decoration: underline
}

.docs-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.docs-sidebar {
    position: sticky;
    top: 90px;
    align-self: start;
}

.docs-toc {
    padding: 14px;
}

.docs-toc-title {
    font-weight: 800;
    font-size: 14px;
    margin-bottom: 10px;
}

.docs-toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 6px;
}

.docs-toc-item a {
    text-decoration: none;
    color: var(--text);
    font-size: 13px;
}

.docs-toc-item a:hover {
    text-decoration: underline;
    color: var(--accent);
}

.docs-toc-item.level-3 {
    padding-left: 12px;
}

.docs-toc-empty {
    font-size: 12px;
}

.docs-content {
    padding: 18px 20px;
}

.docs-back {
    font-size: 13px;
    margin-bottom: 12px;
}

.docs-back a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.docs-back a:hover {
    text-decoration: underline;
}

.docs-markdown h1,
.docs-markdown h2,
.docs-markdown h3,
.docs-markdown h4 {
    margin: 28px 0 10px;
    font-weight: 800;
    color: var(--text);
}

.docs-markdown h1,
.docs-markdown h2 {
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.docs-markdown h1 {
    font-size: 22px;
}

.docs-markdown h2 {
    font-size: 18px;
}

.docs-markdown h3 {
    font-size: 15px;
}

.docs-markdown p {
    margin: 10px 0;
    color: #1f2937;
    line-height: 1.6;
}

.docs-markdown ul {
    margin: 8px 0 12px 18px;
    color: #1f2937;
    line-height: 1.6;
}

.docs-markdown code {
    background: #f4efe6;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 2px 6px;
    font-size: 12px;
}

.docs-markdown pre {
    background: #1b2538;
    color: #f9fafb;
    border-radius: 10px;
    padding: 14px;
    overflow: auto;
    margin: 12px 0;
    position: relative;
}

.docs-copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    color: #f9fafb;
    border-radius: 8px;
    padding: 6px;
    display: grid;
    place-items: center;
    cursor: pointer;
}

.docs-copy-btn:hover {
    background: rgba(255, 255, 255, 0.18);
}

.docs-copy-btn svg {
    width: 14px;
    height: 14px;
}

.docs-markdown pre code {
    background: transparent;
    border: none;
    padding: 0;
    color: inherit;
    font-size: 12px;
}

.docs-markdown a {
    color: var(--accent);
    font-weight: 600;
}

.docs-markdown a:hover {
    text-decoration: underline;
}

@media (max-width: 960px) {
    .docs-layout {
        grid-template-columns: 1fr;
    }

    .docs-sidebar {
        position: static;
    }
}

/* Responsive (global grids) */
@media (max-width: 980px) {

    .grid-4,
    .grid-2 {
        grid-template-columns: 1fr
    }

    .dashboard-trends {
        grid-template-columns: 1fr;
    }

    .dashboard-weather {
        grid-template-columns: 1fr;
    }

    .dashboard-map-body {
        grid-template-columns: 1fr;
    }

    .country-map-list {
        grid-template-columns: 1fr;
    }

    .search {
        max-width: 70vw
    }

    .site-footer-inner {
        flex-direction: column;
        text-align: center;
    }

    .site-footer-right,
    .site-footer-left {
        justify-content: center;
    }
}

/* Badges état OUI/NON */
.badge-state {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    border: 1px solid var(--border);
    background: rgba(31, 42, 68, 0.05);
    color: #3f4a5a;
}

.badge-state.true {
    background: #fee2e2;
    border-color: #fecaca;
    color: #991b1b;
}

.badge-state.true.wl {
    background: #dcfce7;
    border-color: #86efac;
    color: #166534;
}

.badge-state.license-status-active {
    background: #dcfce7;
    border-color: #86efac;
    color: #166534;
}

.badge-state.license-status-stale {
    background: #ffedd5;
    border-color: #fdba74;
    color: #9a3412;
}

.badge-state.license-status-inactive {
    background: #fee2e2;
    border-color: #fecaca;
    color: #991b1b;
}

.badge-state.license-level-free {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: #374151;
}

.badge-state.license-level-enterprise {
    background: #dcfce7;
    border-color: #86efac;
    color: #166534;
}

.badge-state.license-level-expiring {
    background: #ffedd5;
    border-color: #fdba74;
    color: #9a3412;
}

.badge-state.claim-badge {
    background: #fff7ed;
    border-color: #fdba74;
    color: #9a3412;
}

.badge-state.claim-badge:hover {
    background: #ffedd5;
}

button.badge-state {
    border: 1px solid var(--border);
    cursor: pointer;
}

button.badge-state:hover {
    filter: brightness(0.98);
    transform: none;
    box-shadow: none;
}

.stats-sep {
    border-top: 1px solid #efe9df;
    margin: 22px 0;
}

.stats-row {
    display: flex;
    gap: 14px;
    justify-content: space-between;
    flex-wrap: wrap;
}

.stat-item {
    min-width: 160px
}

.stat-label {
    font-size: 12px;
    color: var(--muted);
    font-weight: 700
}

.stat-value {
    font-size: 16px;
    font-weight: 900;
    font-family: var(--font-display)
}

/* Reason pills */
.reason-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.reason-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(31, 42, 68, 0.05);
    font-size: 12px;
    font-weight: 800;
}

.reason-icon {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
}

/* Topbar actions (fusionné / unique) */
.topbar-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: nowrap;
}

.btn {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.96);
    cursor: pointer;
    color: var(--text);
    transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease, background .12s ease;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.btn:hover {
    background: #ffffff;
    border-color: rgba(31, 42, 68, 0.2);
    box-shadow: 0 10px 20px rgba(17, 24, 39, 0.12);
    transform: translateY(-1px);
}

.menu {
    position: relative;
}

.menu::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    height: 6px;
}

.menu-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.menu-button::after {
    content: '▾';
    font-size: 11px;
}

.menu-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 6px;
    min-width: 180px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(12px);
    padding: 8px;
    display: none;
    z-index: 30;
}

.menu:hover .menu-dropdown,
.menu:focus-within .menu-dropdown {
    display: block;
}

.menu-item {
    display: block;
    padding: 8px 10px;
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
}

.menu-item:hover {
    background: rgba(31, 42, 68, 0.06);
}

.menu-sep {
    height: 1px;
    background: var(--border);
    margin: 6px 4px;
}

.lang-select {
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.96);
    font-size: 13px;
}

/* Modal (fusionné / unique) */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, .35);
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s ease;
    z-index: 999;
}

.modal-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s ease;
    z-index: 1000;
    padding: 16px;
}

.modal.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    width: 100%;
    max-width: 520px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #efe9df;
}

.modal-title {
    font-size: 16px;
    font-weight: 900;
}

.modal-close {
    border: none;
    background: transparent;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0 6px;
    color: #6b7280;
}

.modal-close:hover {
    color: #111827;
}

.modal-body {
    padding: 16px;
}

/* Password strength meter */
.pwd-bar {
    height: 10px;
    background: rgba(31, 42, 68, 0.06);
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.pwd-bar-fill {
    height: 100%;
    width: 0%;
    transition: width .12s ease;
}

.pwd-bar-fill.weak {
    background: #ef4444;
}

.pwd-bar-fill.ok {
    background: #f59e0b;
}

.pwd-bar-fill.strong {
    background: #16a34a;
}

.pwd-meta {
    display: flex;
    gap: 8px;
    align-items: baseline;
    justify-content: space-between;
    margin-top: 6px;
}

.pwd-label {
    font-weight: 900;
}

.pwd-hint {
    font-size: 12px;
}

/* =========================
   Dashboard IP: layout 2 colonnes (Timeline + Top Source à gauche, Info IP à droite)
   ========================= */

.ip-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    /* 2 colonnes */
    grid-template-rows: auto auto;
    /* timeline puis topsource */
    gap: 12px;
    align-items: stretch;
}

/* Colonne gauche */
.ip-timeline {
    grid-column: 1;
    grid-row: 1;
    height: 240px;
    /* demandé */
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

/* Conteneur interne du graphe timeline */
.ip-timeline .chart-container {
    position: relative;
    flex: 1;
    min-height: 0;
}

/* Canvas du graphe */
.ip-timeline canvas {
    width: 100% !important;
    height: 100% !important;
    /* force la hauteur exacte */
    display: block;
}
/* Si la timeline contient un container chart/canvas, il doit "shrink" correctement */
.ip-timeline canvas,
.ip-timeline .chart,
.ip-timeline .chart-container {
    flex: 1;
    min-height: 0;
}

.ip-topsource {
    grid-column: 1;
    grid-row: 2;
    min-width: 0;
}

/* Colonne droite: hauteur cumulée */
.ip-info {
    grid-column: 2;
    grid-row: 1 / span 2;
    min-width: 0;
}

/* Optionnel: affichage propre des paires clé/valeur dans "Informations sur l'IP"
   (n'affecte rien si tu n'utilises pas ces classes) */
.ip-info .info-line {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px solid #efe9df;
}

.ip-info .info-line:last-child {
    border-bottom: none;
}

.ip-info .info-label {
    color: var(--muted);
    font-weight: 800;
    font-size: 12px;
}

.ip-info .info-value {
    font-weight: 800;
    font-size: 12px;
    text-align: right;
    word-break: break-word;
}

/* IP info separator */
.ip-info-sep {
    border: 0;
    border-top: 1px solid #efe9df;
    margin: 15px 0;
}

.ip-event-source-main {
    font-weight: 700;
    line-height: 1.2;
}

.ip-event-source-server {
    margin-top: 2px;
    font-size: 11px;
    color: var(--muted);
    line-height: 1.2;
}

.ip-event-reason-main {
    font-weight: 700;
    line-height: 1.2;
}

.ip-event-reason-family {
    margin-top: 2px;
    font-size: 11px;
    color: var(--muted);
    line-height: 1.2;
}

.ip-event-reason-family[title] {
    text-decoration: underline dotted;
    text-underline-offset: 2px;
    cursor: help;
}

/* Tabs (IP info) */
.tabs {
    display: inline-flex;
    gap: 6px;
    margin-top: 10px;
    padding: 4px;
    border: 1px solid var(--border);
    border-bottom: 0;
    background: rgba(31, 42, 68, 0.06);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.tab-btn {
    border: 1px solid transparent;
    background: transparent;
    padding: 8px 14px;
    font-weight: 800;
    font-size: 14px;
    color: #4b5563;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.tab-icon {
    margin-right: 6px;
    font-size: 14px;
}

.tab-btn.active {
    color: var(--accent-strong);
    background: #ffffff;
    border-color: var(--border);
    box-shadow: 0 6px 14px rgba(17, 24, 39, .08);
}

.tab-btn:hover {
    color: var(--accent-strong);
    background: #ffffff;
    border-color: var(--border);
    transform: none;
    box-shadow: none;
}

.tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    margin-left: 6px;
    border-radius: 999px;
    background: var(--accent);
    color: #ffffff;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
}

.tab-badge.ok {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.tab-badge.bad {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.tab-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin-left: 8px;
    border-radius: 6px;
    background: transparent;
    color: #111827;
    font-size: 14px;
    line-height: 1;
}

.tab-flag.unknown {
    background: rgba(31, 42, 68, 0.04);
    color: #6b7280;
    border: 1px solid var(--border);
}

.tab-panels {
    margin-top: 0;
    border: 1px solid var(--border);
    border-radius: 0 var(--radius-md) var(--radius-md) var(--radius-md);
    padding: 10px 12px 12px;
    background: #ffffff;
}

.tab-panel {
    display: none;
}

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

.table-compact th,
.table-compact td {
    font-size: 12px;
}

.claims-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.claims-select {
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #fff;
    font-size: 12px;
}

.claims-input {
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 12px;
}

.claims-textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-size: 12px;
    resize: vertical;
}

.btn-compact {
    padding: 6px 10px;
    font-size: 12px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.claim-status {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    color: #374151;
}

.claim-status-nouveau {
    background: #fef9c3;
    border-color: #fde68a;
    color: #92400e;
}

.claim-status-attente {
    background: #e0f2fe;
    border-color: #bae6fd;
    color: #075985;
}

.claim-status-accord {
    background: #dcfce7;
    border-color: #86efac;
    color: #166534;
}

.claim-status-refus {
    background: #fee2e2;
    border-color: #fecaca;
    color: #991b1b;
}

.claim-status-annule {
    background: #f3f4f6;
    border-color: #e5e7eb;
    color: #6b7280;
}

.claims-table td {
    vertical-align: top;
}

.rbl-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    margin-right: 6px;
}

.rbl-status.ok {
    background: #dcfce7;
    border: 1px solid #86efac;
    color: #166534;
}

.rbl-status.bad {
    background: #fee2e2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.rbl-status.unknown {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    color: #6b7280;
}

.rbl-label {
    font-size: 12px;
    color: #4b5563;
    vertical-align: middle;
}

.rbl-info {
    margin-left: 6px;
    color: #6b7280;
    text-decoration: none;
}

.rbl-info-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 999px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
}

.rbl-info:hover .rbl-info-badge {
    color: #111827;
    border-color: #d1d5db;
    background: #ffffff;
}

/* Responsive: repasse en 1 colonne sur petit écran */
@media (max-width: 980px) {
    .ip-grid {
        grid-template-columns: 1fr;
    }

    .ip-timeline {
        height: auto;
    }

    .ip-info {
        grid-column: 1;
        grid-row: auto;
    }
}
