assets/css/style.css

/* ============================================================================
   Brivacia dashboard stylesheet
   ----------------------------------------------------------------------------
   This file is organized by visible UI areas.
   Selectors target the real HTML structure instead of utility classes,
   so the code stays readable and editable without a framework.
   ============================================================================ */


/* ============================================================================
   Shared colors, sizes and spacing
   ============================================================================ */

:root {
    --border-radius-2-sides-bottom: 0 0 1em 1em;
    --border-radius-2-sides-top: 1em 1em 0 0;
    --border-radius-4-sides: 1em;

    --font-size-normal: 1.2rem;
    --font-size-normal-4k: calc(var(--font-size-normal) + .3rem);
    --font-size-large: 2rem;
    --font-size-large-4k: calc(var(--font-size-large) + .3rem);

    --padding-4-sides: 1em;
}

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

    --background-page: #101010;
    --background-card: #1e1e1e;
    --background-nav: #333;
    --background-tooltip: #ddd;

    --border: 1px solid #555;
    --border-color: #555;
    --border-color-active: #888;

    --color-bots: #ff9f43;
    --color-countries: #facc15;
    --color-danger: #ff8181;
    --color-info: #0dcaf0;
    --color-link: #1d9bf0;
    --color-link-hover: #8bb9fe;
    --color-moon: #8bb9fe;
    --color-muted: #999;
    --color-referrers: #8bb9fe;
    --color-search: #f472b6;
    --color-success: #2dd55b;
    --color-sun: #f59e0b;
    --color-text: #ddd;
    --color-tooltip: #101010;
    --color-visitors: #4cd964;
    --color-visits: #c6a0ff;
    --color-warning: #f4c430;
    --color-graph-line: #1d9bf0;
    --color-graph-grid: #444;
}

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

    --background-page: #ececec;
    --background-card: #f8f8f8;
    --background-nav: #efefef;
    --background-tooltip: #1e1e1e;

    --border: 1px solid #cfcfcf;
    --border-color: #cfcfcf;
    --border-color-active: #999;

    --color-bots: #d97706;
    --color-countries: #ca8a04;
    --color-danger: #d64545;
    --color-link: #0066cc;
    --color-link-hover: #0052a3;
    --color-moon: #0a66c2;
    --color-muted: #666;
    --color-text: #222;
    --color-referrers: #0a66c2;
    --color-search: #db2777;
    --color-success: #1f8f4e;
    --color-sun: #d97706;
    --color-tooltip: #ddd;
    --color-visitors: #2f7d32;
    --color-visits: #8b5cf6;
    --color-warning: #b8860b;
    --color-graph-line: #1d9bf0;
    --color-graph-grid: #444;
}


/* ============================================================================
   Page basics
   ============================================================================ */

* {
    scrollbar-width: none !important;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    outline: none;
}

body {
    background: var(--background-page);
    color: var(--color-text);
    font-family: system-ui, sans-serif;
    font-size: var(--font-size-normal);
    line-height: 1.5;
    margin: 0;
    min-height: 100vh;
    padding: var(--padding-4-sides);
}

section,
.card {
    background: var(--background-card);
    border: var(--border);
    border-radius: var(--border-radius-4-sides);
}

.hidden {
    pointer-events: none;
    visibility: hidden;
}

[hidden] {
    display: none !important;
}

.desktop-only {
    display: inline;
}

.mobile-only {
    display: none;
}

details {
    border: var(--border);
    border-radius: var(--border-radius-4-sides);
    margin-top: 1em;
    padding: var(--padding-4-sides);
}

details * {
    white-space: normal;
}

button,
details summary {
    cursor: pointer;
}


/* ============================================================================
   Links and shared transitions
   ============================================================================ */

a {
    color: var(--color-link);
    overflow-wrap: anywhere;
    text-decoration: none;
    transition: color 1s ease;
}

a:hover {
    color: var(--color-link-hover);
}

a:has(> svg),
button:has(> svg) {
    align-items: center;
    display: inline-flex;
    justify-content: center;
}

button,
.view-tabs a {
    transition: background 1s ease, border-color 1s ease;
}

.card[data-graph]:hover,
.view-tabs a:hover {
    background: var(--background-nav);
    border-color: var(--border-color);
}

.view-tabs a.active:hover {
    background: #444;
}


/* ============================================================================
   Top toolbar
   ============================================================================ */

.toolbar {
    align-items: center;
    display: flex;
    margin: 0 auto 1em;
}

.toolbar h1 {
    margin: 0;
    width: fit-content;
}

.toolbar h1 a {
    align-items: center;
    color: var(--color-text);
    display: flex;
    text-decoration: none;
}

.toolbar h1 img {
    height: 1.5em;
    margin-right: .3em;
    object-fit: contain;
    width: 1.5em;
}

.toolbar h1 .desktop-only {
    margin: 0 .25em;
}

.toolbar-filters {
    align-items: center;
    display: flex;
    gap: 1em;
    margin: 0 auto;
}

.toolbar-actions {
    align-items: center;
    display: flex;
    gap: .5em;
}


/* ============================================================================
   Date and view selectors
   ============================================================================ */

.date-form {
    flex: 0 0 auto;
    position: relative;
}

.date-form>button {
    align-items: baseline;
    background: none;
    border: 0;
    color: var(--color-text);
    display: flex;
    font: inherit;
    font-size: var(--font-size-large);
    font-weight: 700;
    gap: .4em;
    padding: 0;
}

.date-form>button>small {
    color: var(--color-muted);
    font-weight: 600;
}

/* On desktop, the native field still exists to open the calendar, but stays invisible. */
.date-form>input:not([type="hidden"]) {
    height: 0;
    left: 1em;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    top: 75%;
}

.view-tabs {
    display: flex;
    flex: 1;
    gap: .5em;
    justify-content: center;
}

.view-tabs a,
.view-select select {
    background-color: var(--background-card);
    border: var(--border);
    border-radius: .8em;
    color: var(--color-text);
    padding: .5em .8em;
}

.view-tabs a {
    align-items: center;
    display: flex;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.view-tabs a.active {
    background: var(--background-nav);
    border-color: var(--border-color-active);
}

.view-select {
    display: none;
}


/* ============================================================================
   Top toolbar buttons and menus
   ============================================================================ */

/* Privacy button */
.toolbar-actions>button:first-of-type {
    background: var(--background-card);
    border: var(--border);
}

.toolbar-actions>button:first-of-type,
.toolbar-actions>div:first-of-type>button {
    align-items: center;
    border-radius: .8em;
    color: var(--color-text);
    display: inline-flex;
    flex: 0 0 auto;
    font: inherit;
    gap: .3em;
    max-width: fit-content;
    padding: .5em .8em;
    transition: background 1s;
    white-space: nowrap;
}

.toolbar-actions>button:first-of-type:hover {
    background: var(--background-nav);
}

/* Menu */
[data-dropdown] {
    position: relative;
}

[data-dropdown-toggle],
.toolbar-actions>button {
    align-items: center;
    appearance: none;
    -webkit-appearance: none;
    background: var(--background-page);
    border: 0;
    border-radius: var(--border-radius-4-sides);
    color: var(--color-text);
    display: flex;
    font-size: 1.5rem;
    justify-content: center;
    padding: .8em 1em;
}

[data-dropdown-toggle]:hover,
.toolbar-actions>button:hover {
    background: var(--background-card);
    color: var(--color-text);
}

[data-dropdown-menu],
[data-dropdown-submenu] {
    background: var(--background-card);
    border: 1px solid var(--border-color);
    border-radius: .75rem;
    box-shadow: 0 .5rem 2rem rgba(0, 0, 0, .12);
    min-width: 7rem;
    padding: .35rem;
    position: absolute;
    z-index: 20;
}

.menu [data-dropdown-menu],
.notification-menu [data-dropdown-submenu] {
    right: 0;
    top: calc(100% + .5rem);
}


.sites-menu [data-dropdown-menu] {
    left: 50%;
    top: calc(100% + .5rem);
    transform: translateX(-50%);
}

[data-dropdown-submenu] {
    right: calc(100% + .5rem);
    top: 0;
}

[data-dropdown-menu] a,
[data-dropdown-menu] button,
[data-dropdown-submenu] a,
[data-dropdown-submenu] button {
    align-items: center;
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    border: 0;
    border-radius: .5rem;
    color: var(--color-text);
    display: flex;
    font-size: var(--font-size-normal);
    gap: 1em;
    justify-content: flex-start;
    padding: .55rem .75rem;
    text-decoration: none;
    white-space: nowrap;
    width: 100%;
}

[data-dropdown-menu] a:hover,
[data-dropdown-menu] button:not([disabled]):hover,
[data-dropdown-submenu] a:hover,
[data-dropdown-submenu] button:not([disabled]):hover {
    background: var(--background-nav);
}

[data-dropdown-menu] button[disabled],
[data-dropdown-submenu] button[disabled] {
    color: var(--color-muted);
    cursor: not-allowed;
}

[data-dropdown-menu] button[disabled]:hover,
[data-dropdown-submenu] button[disabled]:hover {
    background: transparent;
}

[data-dropdown]:hover>[data-dropdown-submenu][hidden],
[data-dropdown]:focus-within>[data-dropdown-submenu][hidden] {
    display: block;
}

.notification-dropdown {
    padding: 0 1em 1em;
    width: 22rem;
}

#update-available,
#update-progress {
    width: 100%;
}


/* ============================================================================
   Cards and trends
   ============================================================================ */

.cards,
.trends {
    display: flex;
    flex-wrap: wrap;
    gap: 1em;
    margin: 1em 0;
}

.cards {
    align-items: center;
}

.trends {
    justify-content: space-evenly;
}

/* 3 trend cards */
.trends>.card {
    flex: 0 1 clamp(28rem, 22vw, 42rem);
}

/* 2 trend cards */
.trends:has(.card:nth-child(2)):not(:has(.card:nth-child(3)))>.card {
    flex-basis: clamp(28rem, 18vw, 38rem);
}

/* 1 trend card */
.trends:has(.card:first-child:last-child)>.card {
    flex-basis: clamp(28rem, 18vw, 38rem);
}

/* No trend cards */
.trends:not(:has(.card)) {
    display: none;
}

.card {
    align-items: center;
    appearance: none;
    -webkit-appearance: none;
    color: var(--color-text);
    display: flex;
    flex: 1 1 180px;
    flex-wrap: wrap;
    font: inherit;
    padding: .8em 1em;
}

.trends>.card:not(:has(svg)):hover,
.cards>div:nth-of-type(4)>button {
    cursor: help;
}

.trends>.card:has(svg) {
    pointer-events: none;
}

.card strong {
    display: flex;
    font-size: var(--font-size-large);
    gap: .5em;
    justify-content: flex-start;
    white-space: nowrap;
}

.card strong.danger {
    color: var(--color-danger);
}

.card strong.success {
    color: var(--color-success);
}

.card span {
    align-items: center;
    display: flex;
    justify-content: space-between;
    width: 100%;
}

.card small {
    color: var(--color-muted);
    margin-left: 1em;
}


/* ============================================================================
   Summary blocks
   ============================================================================ */

.summary-row {
    display: grid;
    gap: 1em;
    grid-template-columns: 1fr 1fr 1fr 1fr;
}

.summary-row--no-countries {
    grid-template-columns: 1fr 1fr 1fr;
}

.summary-row section {
    max-height: 23em;
    min-height: 0;
    overflow: auto;
    padding: 0 1em 1em;
}

.summary-row section:first-of-type {
    overflow: hidden;
}

.summary-row section h2 {
    align-items: center;
    display: flex;
    justify-content: space-between;
    width: 100%;
}

.summary-row tr:last-child td {
    border-bottom: 0;
}

.summary-row>section:nth-of-type(1) tr:nth-child(1) svg {
    color: var(--color-visitors);
}

.summary-row>section:nth-of-type(1) tr:nth-child(2) svg {
    color: var(--color-visits);
}

.summary-row>section:nth-of-type(1) tr:nth-child(3) svg {
    color: var(--color-text);
}

.summary-row>section:nth-of-type(1) tr:nth-child(4) svg {
    color: var(--color-bots);
}

.summary-row>section:nth-of-type(1) tr:nth-child(5) svg {
    color: var(--color-countries);
}

.summary-row>section:nth-of-type(1) tr:nth-child(6) svg {
    color: var(--color-search);
}

.summary-row>section:nth-of-type(1) tr:nth-child(7) svg {
    color: var(--color-referrers);
}

.total-grid {
    display: grid;
    gap: .6em 1em;
    grid-template-columns: 1fr auto;
    margin-top: 1em;
}

.total-grid strong {
    font-size: 1.6em;
    font-weight: 700;
}


/* ============================================================================
   Tables and top pages
   ============================================================================ */

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

td,
th {
    border-bottom: 1px solid #444;
    padding: .5em;
    text-align: left;
}

td:last-child,
th:last-child {
    text-align: right;
}

.top-pages {
    margin-top: 1em;
    padding: 0 1em 1em;
}

.top-pages>section {
    border: 0;
    padding: 0;
}

.section-header {
    align-items: center;
    display: flex;
    justify-content: space-between;
}

.site {
    color: #aaa;
    white-space: nowrap;
}


/* ============================================================================
   Icons, flags and small images
   ============================================================================ */

.bar-icon,
.export-dropdown a svg,
.import-dropdown button svg,
.lucide {
    display: inline-block;
    height: 1em;
    min-width: 1em;
    width: 1em;
}

a .lucide-arrow-left {
    margin-right: .3em;
}

a .lucide-arrow-right,
a[target="_blank"] .lucide {
    flex: 0 0 1em;
    margin-left: .3em;
}

[data-modal-open]:not(.import-dropdown > button):not([data-modal-open="pixel-modal"]):not([data-modal-open="settings-modal"]) svg {
    height: 1.15em;
    width: 1.15em;
}

td .lucide {
    transform: translateY(.15em);
}

.lucide-ban {
    color: var(--color-danger);
    margin-right: .4em;
}

.flag,
.referrer {
    border-radius: .2em;
    display: inline-block;
    filter: drop-shadow(0 0 1px rgb(0 0 0 / .5));
    height: 1em;
    margin-right: .4em;
    vertical-align: -.15em;
    width: auto;
}


#settings-modal button svg:not(.lucide-chevron-down),
#wizard-modal button svg:not(.lucide-chevron-down),
[href="https://ko-fi.com/breatfr"] svg {
    margin-right: .3em;
}

.tooltip-icon {
    flex: 0 0 auto;
    height: 1em;
    width: 1em;
}

footer img,
footer small>span>svg {
    display: inline-block;
    height: 1em;
    margin: 0 .3em;
    width: 1em;
}


/* ============================================================================
   Day and night animation
   ============================================================================ */

.trend-new-day {
    align-items: center;
    display: inline-flex;
    height: 3rem;
    justify-content: center;
    overflow: hidden;
    position: relative;
    width: 3rem;
}

.trend-new-day .lucide {
    height: 3rem;
    position: absolute;
    width: 3rem;
}

.trend-new-day .lucide-moon {
    animation: celestial-cycle 8s infinite ease-in-out;
    animation-delay: -4s;
    color: var(--color-moon);
}

.trend-new-day .lucide-sun {
    animation: celestial-cycle 8s infinite ease-in-out;
    color: var(--color-sun);
}


/* ============================================================================
   Form controls
   ----------------------------------------------------------------------------
   Shared field styles.
   Select fields use a background SVG chevron to keep the same look
   in light and dark themes, without HTML wrappers or fragile positioning.
   Checkboxes are displayed as switches.
   ============================================================================ */

form label {
    display: grid;
    gap: .35em;
    margin-top: 1em;
}

input:not([type="checkbox"]):not([type="hidden"]),
form select,
form button {
    background-color: var(--background-page);
    border: var(--border);
    border-radius: .8em;
    color: var(--color-text);
    font: inherit;
    padding: .6em .8em;
}

input:not([type="checkbox"]):not([type="hidden"]) {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
}

form button:not(.date-form > button):hover {
    background: var(--background-nav);
}

fieldset {
    border: var(--border);
    border-radius: var(--border-radius-4-sides);
    display: grid;
    gap: 1em;
    grid-template-columns: calc(35% - .5em) calc(45% - .5em) auto;
    margin: 1em 0;
    padding: var(--padding-4-sides);
}

fieldset button {
    align-self: end;
    color: var(--color-danger);
    white-space: nowrap;
}

fieldset label {
    margin: 0;
}

label:has(input[type="password"]),
label:has(input[type="text"]) {
    position: relative;
}

label:has(input[type="password"]) button[data-token-toggle],
label:has(input[type="text"]) button[data-token-toggle] {
    background: none;
    border: 0;
    bottom: 1em;
    color: var(--color-muted);
    cursor: pointer;
    padding: 0;
    position: absolute;
    right: .8em;
    transition: color .2s ease;
}

label:has(input[type="password"]) button[data-token-toggle]:hover,
label:has(input[type="text"]) button[data-token-toggle]:hover {
    color: var(--color-text);
}

input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    background: var(--color-danger);
    border: var(--border);
    border-radius: 999px;
    box-shadow: inset 0 0 .3em rgb(0 0 0 / .5);
    cursor: pointer;
    height: 1.5em;
    inline-size: 3em;
    margin: 0;
    position: relative;
    transition: background .2s ease;
    width: 3em;
}

input[type="checkbox"]::before {
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 .1em .3em rgb(0 0 0 / .5);
    content: '';
    height: 1.15em;
    left: .15em;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    transition: transform .2s ease;
    width: 1.15em;
}

input[type="checkbox"]:checked {
    background: var(--color-success);
    border-color: var(--color-success);
}

input[type="checkbox"]:checked::before {
    top: 50%;
    transform: translate(1.45em, -50%);
}

label:has(input[type="checkbox"]) {
    align-items: center;
    display: grid;
    gap: .35em 1em;
    grid-template-columns: minmax(0, 1fr) auto;
}

label:has(input[type="checkbox"]) input {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
}

label:has(input[type="checkbox"]) small {
    grid-column: 1 / -1;
    margin: 0;
}

input[type="number"] {
    appearance: textfield;
    -moz-appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    appearance: none;
    -webkit-appearance: none;
    margin: 0;
}

/* Select fields ------------------------------------------------------
   The chevron is a background image to avoid adding an extra SVG in the HTML.
   Right padding reserves space for the chevron so text does not touch it.
*/

/* Per page select */

.section-header label:has(> select) {
    align-items: center;
    display: flex;
    gap: .5em;
    margin: 0;
    white-space: nowrap;
}

form select {
    padding: .6em 2.8em .6em .8em;
}

/* General select */

select {
    appearance: none;
    -webkit-appearance: none;
    background-position: right .9em center;
    background-repeat: no-repeat;
    background-size: 1em;
    padding-right: 2.8em;
}

html[data-theme="dark"] select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23ddd' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

html[data-theme="light"] select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23222' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}


/* ============================================================================
   Pagination
   ============================================================================ */

.pagination {
    align-items: center;
    display: flex;
    gap: 1em;
    justify-content: center;
    margin-top: 1em;
}


/* ============================================================================
   Footer
   ============================================================================ */

footer {
    margin-top: 1em;
}

footer small {
    align-items: center;
    display: flex;
    gap: 1em;
    justify-content: space-between;
    width: 100%;
}

footer span {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
}

footer button[data-modal-open] {
    appearance: none;
    -webkit-appearance: none;
    background: none;
    border: 0;
    color: var(--color-link);
    font: inherit;
    margin-right: .3em;
    padding: 0;
}

footer button[data-modal-open]:hover {
    color: var(--color-link-hover);
}

footer [href="https://code.breat.fr/b/brivacia/docs/faq"] {
    margin-left: .3em;
}

footer .desktop-only {
    margin: 0 .25em;
}


/* ============================================================================
   Modal windows
   ============================================================================ */

.modal {
    background: var(--background-card);
    border: var(--border);
    border-radius: var(--border-radius-4-sides);
    color: var(--color-text);
    max-height: 90vh;
    max-width: 90vw;
    overflow: hidden;
    padding: 2em;
    position: relative;
}

.modal>div {
    max-height: calc(90vh - 4em);
    overflow: auto;
    width: 100%;
}

.modal h2:first-child {
    margin-top: 0;
}

.modal::backdrop {
    backdrop-filter: blur(10px);
    background: rgba(0, 0, 0, .8);
}

body:has(.modal[open]) {
    overflow: hidden;
}

.cards [data-graph],
.cards>div:nth-of-type(4) button,
.summary-row [data-graph],
.top-pages [data-graph],
[data-modal-open]:not([data-modal-open="about-modal"]):not(.import-dropdown [data-import-provider]):not([data-modal-open="pixel-modal"]):not([data-modal-open="settings-modal"]) {
    appearance: none;
    -webkit-appearance: none;
    align-items: center;
    background: transparent;
    border: var(--border);
    border-radius: .7em;
    color: var(--color-text);
    cursor: pointer;
    display: inline-flex;
    height: 2.8em;
    justify-content: center;
    padding: 0;
    width: 2.8em;
}

.summary-row [data-graph] {
    margin-right: 1em;
}

.summary-row [data-graph]:first-of-type {
    margin-left: auto;
}


/* ============================================================================
   Data modals
   ============================================================================ */

#countries-modal tbody,
#referrers-modal tbody,
#search-engines-modal tbody {
    display: grid;
    gap: 1em 2em;
    grid-template-columns: repeat(4, 1fr);
    justify-content: space-evenly;
}

#countries-modal tr,
#referrers-modal tr,
#search-engines-modal tr {
    display: flex;
    justify-content: space-between;
}

#countries-modal td,
#referrers-modal td,
#search-engines-modal td {
    border: 0;
}

#global-modal[open],
#global-modal>div {
    display: grid;
    gap: 1em;
}

#global-modal[open],
#global-modal>div {
    grid-template-columns: 1fr auto;
}

#global-modal h2 {
    grid-column: 1 / -1;
}

#global-modal section {
    min-height: 0;
    overflow: auto;
    padding: 0 2em 2em;
}

#global-modal tbody {
    display: grid;
    gap: 1em 2em;
    grid-template-columns: repeat(3, 1fr);
}

#global-modal tr {
    display: flex;
    justify-content: space-between;
}

#global-modal td {
    border: 0;
}


/* ============================================================================
   Graphs inside modals
   ============================================================================ */

.modal:not(.modal[data-graph="countries_bar"]):not(.modal[data-graph="global_map"]):not(.modal[data-graph="search_engines_bar"]):not(.modal[data-graph="top_pages"]):has(.graph svg),
.modal:not(.modal[data-graph="countries_bar"]):not(.modal[data-graph="global_map"]):not(.modal[data-graph="search_engines_bar"]):not(.modal[data-graph="top_pages"]):has(.graph svg)>div {
    max-height: fit-content;
}

.modal:has(.graph svg)>div {
    width: calc(90vw - 4em);
}

.graph {
    width: 100%;
}

.graph svg {
    display: block;
    height: auto;
    width: 100%;
}

/* Line graphs ---------------------------------------------------- */

.graph-line text {
    fill: var(--color-text);
    font-size: var(--font-size-normal);
    font-weight: 700;
    text-anchor: middle;
}

.graph-line .axis {
    fill: var(--color-muted);
    text-anchor: end;
}

.graph-line .day {
    fill: var(--color-muted);
    font-size: 16px;
    font-weight: 400;
}

.graph-line .grid {
    stroke: var(--color-graph-grid);
    stroke-width: 1;
}

.graph-line circle {
    fill: var(--color-graph-line);
}

/* Horizontal bar graphs ------------------------------------- */

.graph-bar .bar-label,
.graph-bar .bar-value {
    fill: var(--color-text);
    font-size: 16px;
    font-weight: 700;
}

.graph-bar .bar-label {
    text-anchor: start;
}

.graph-bar .bar-value {
    text-anchor: end;
}

.graph-bar .bar-track {
    fill: var(--color-border);
    opacity: .45;
}

.graph-bar .bar-fill {
    fill: var(--color-graph-line);
}

/* Pie graphs ------------------------------------------------- */

.graph-pie text {
    fill: var(--color-text);
    font-size: var(--font-size-normal);
    font-weight: 700;
}

.graph-pie .pie-label {
    text-anchor: start;
}

.graph-pie .pie-value {
    text-anchor: end;
}

.graph-pie .pie-total,
.graph-pie .pie-total-label {
    text-anchor: middle;
}

.graph-pie .pie-total {
    font-size: var(--font-size-large);
}

.graph-pie .pie-total-label {
    fill: var(--color-muted);
    font-size: 13px;
}

.graph-pie path {
    cursor: help;
    pointer-events: auto;
}

/* World map --------------------------------------------------------- */

.graph-map {
    align-items: center;
    display: flex;
    justify-content: center;
    overflow: visible;
    touch-action: none;
}

.graph-map[data-dragging],
.graph-map:has(svg[style*="scale"]) {
    cursor: grab;
}

.graph-map[data-dragging] {
    cursor: grabbing;
}

.graph-map svg {
    display: block;
    height: calc(90vh - 7.5em);
    transform-origin: center center;
    width: calc(90vw - 4em);
}

.graph-map .map-country {
    opacity: .45;
    stroke: rgba(255 255 255 / .4);
    stroke-width: .5;
    transition: filter .2s ease, opacity .2s ease;
}

.graph-map .map-country[data-map-value] {
    cursor: help;
    opacity: .95;
    stroke: #fff;
}

.graph-map .map-country[data-map-value]:hover {
    filter: brightness(1.2);
    opacity: 1;
}


/* ============================================================================
   Import, settings and wizard forms
   ============================================================================ */

#import-modal form,
#settings-modal form,
#wizard-modal form {
    display: flex;
    flex-wrap: wrap;
    gap: 1em;
    justify-content: space-evenly;
}

#import-modal form>section,
#settings-modal form>section,
#wizard-modal form>section {
    padding: var(--padding-4-sides);
}

#import-modal form>section,
#settings-modal form>section:not(#settings-sites),
#wizard-modal form>section:not(:first-of-type):not(#wizard-sites) {
    flex: 0 0 calc(50% - .5em);
}

#import-message,
#settings-sites,
#wizard-modal form>section:first-of-type,
#wizard-sites {
    flex: 0 0 100%;
}

#import-modal h3,
#settings-modal h3,
#wizard-modal h3 {
    margin-top: 0;
}

#import-modal section>p,
#import-modal small,
#settings-modal section>p,
#settings-modal small,
#wizard-modal section>p,
#wizard-modal small {
    color: var(--color-muted);
}

#import-modal form>div:last-child,
#settings-modal form>div:last-child,
#wizard-modal form>div:last-child {
    align-items: center;
    background: var(--background-card);
    bottom: 0;
    display: flex;
    flex: 0 0 100%;
    gap: 1em;
    justify-content: space-between;
    padding-top: 1em;
    position: sticky;
}

#import-message,
#settings-message,
#wizard-message {
    flex: 1;
    margin: 0;
    min-height: 1.5em;
    text-align: center;
}

#import-message {
    flex-basis: 100%;
    margin-top: 1em;
}

#import-message.danger,
#settings-message.danger,
#wizard-message.danger {
    color: var(--color-danger);
}

#import-message.info,
#settings-message.info,
#wizard-message.info {
    color: var(--color-info);
}

#import-message.success,
#settings-message.success,
#wizard-message.success {
    color: var(--color-success);
}

#import-message.warning,
#settings-message.warning,
#wizard-message.warning {
    color: var(--color-warning);
}


/* ============================================================================
   Wizard-only modal
   ============================================================================ */

body:has(> #wizard-modal[open]) {
    padding: 2em;
}

#wizard-modal[open] {
    min-height: calc(100vh - 4em);
}


/* ============================================================================
   Pixel modal
   ============================================================================ */

#pixel-modal section {
    display: flex;
    flex-direction: column;
    gap: 1em;
    padding: var(--padding-4-sides);
}

#pixel-modal section h3 {
    margin: 0;
}

#pixel-modal section+section,
#pixel-modal section+form {
    margin-top: 1em;
}

#pixel-modal section>header {
    align-items: center;
    display: flex;
    gap: 1em;
    justify-content: space-between;
}

#pixel-modal section>header>span {
    color: var(--color-text-secondary);
    font-size: var(--font-size-small);
    font-weight: 600;
}


/* ============================================================================
   Privacy modal
   ============================================================================ */

.privacy {
    display: grid;
    gap: 1em;
    grid-template-columns: auto 1fr;
}

.privacy h2 {
    grid-column: 1 / -1;
    margin: 0;
}

.privacy h3 {
    margin-top: 0;
}

.privacy section {
    margin: 0;
    padding: var(--padding-4-sides);
}

.privacy section:nth-of-type(1),
.privacy section:nth-of-type(2) {
    grid-column: 1;
}

.privacy section:nth-of-type(1),
.privacy section:nth-of-type(3) {
    margin-top: 1em;
}

.privacy section:nth-of-type(3) {
    grid-column: 2;
    grid-row: 2 / 4;
}

.privacy tr:last-child td {
    border-bottom: 0;
}


/* ============================================================================
   Tooltips
   ============================================================================ */

[data-tooltip-open] {
    background: var(--background-tooltip);
    border: 0;
    border-radius: .5em;
    box-shadow: .25em .25em .25em rgb(255 255 255 / .2);
    color: var(--color-tooltip);
    font-size: var(--font-size-normal);
    left: var(--tooltip-left);
    max-width: calc(100vw - 2rem);
    opacity: 0;
    padding: .5em .8em;
    pointer-events: none;
    position: fixed;
    top: var(--tooltip-top);
    transform: var(--tooltip-position) translateY(.25em);
    transition: box-shadow .5s ease, opacity .5s ease;
    z-index: 1000;
}

[data-tooltip-open][data-tooltip-placement]::before {
    color: var(--background-tooltip);
    left: 50%;
    position: absolute;
    transform: translateX(-50%);
}

[data-tooltip-open][data-tooltip-placement="bottom"]::before {
    bottom: calc(100% - .5em);
    content: '▲';
}

[data-tooltip-open][data-tooltip-placement="left"]::before {
    content: '▶';
    left: calc(100% - .15em);
    top: 50%;
    transform: translateY(-50%);
}

[data-tooltip-open][data-tooltip-placement="right"]::before {
    content: '◀';
    left: auto;
    right: calc(100% - .15em);
    top: 50%;
    transform: translateY(-50%);
}

[data-tooltip-open][data-tooltip-placement="top"]::before {
    content: '▼';
    top: calc(100% - .5em);
}

[data-tooltip-open][data-tooltip-visible] {
    opacity: 1;
    transform: var(--tooltip-position) translateY(0);
}

[data-tooltip-open].graph-tooltip {
    align-items: center;
    display: inline-flex;
    gap: .5rem;
    inline-size: max-content;
    max-inline-size: max-content;
    max-width: max-content;
    overflow: visible;
    white-space: nowrap;
    width: max-content;
}


/* ============================================================================
   Restore alert
   ============================================================================ */

.restore-alert {
    align-items: flex-start;
    background: color-mix(in srgb, var(--color-warning) 18%, var(--background-card));
    border: 1px solid var(--color-warning);
    border-radius: 1em;
    box-shadow: 0 .5em 2em rgb(0 0 0 / .25);
    display: flex;
    gap: 1em;
    margin: 0 auto;
    max-width: min(44em, calc(100vw - 2em));
    padding: 1em;
}

.restore-alert p {
    margin: .35em 0;
}

.restore-alert-time {
    color: var(--color-text-muted);
    font-size: .9em;
    margin: .25em 0 .75em;
}

.restore-alert small {
    color: var(--color-muted);
}

.restore-alert button {
    background: transparent;
    border: 0;
    color: inherit;
    cursor: pointer;
    font-size: var(--font-size-normal);
    margin-left: auto;
}


/* ============================================================================
   PrismJS
   ============================================================================ */

code[class*="language-"],
pre[class*="language-"] {
    background: 0 0;
    color: #ccc;
    font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
    font-size: 1em;
    text-align: left;
    word-spacing: normal;
    word-wrap: normal;
    line-height: 1.5;
    -moz-tab-size: 4;
    -o-tab-size: 4;
    tab-size: 4;
    -webkit-hyphens: none;
    -moz-hyphens: none;
    -ms-hyphens: none;
    hyphens: none;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    word-break: break-word;
}

pre[class*="language-"] {
    border-radius: var(--border-radius-4-sides);
    margin: .5em 0;
    max-width: 100%;
    overflow: auto;
    overflow-x: auto;
    padding: 1em;
    padding-left: 3.8em;
    position: relative;
}

:not(pre)>code[class*="language-"],
pre[class*="language-"] {
    background: #2d2d2d
}

:not(pre)>code[class*="language-"] {
    border-radius: .3em;
    padding: .1em;
    white-space: normal
}

pre[class*="language-"]::before {
    content: "";
    height: 100%;
    left: 0;
    position: absolute;
    top: 0;
    width: 10px;
    z-index: 1;
}

pre.language-markup::before {
    background-color: transparent;
}

pre.language-css::before {
    background-color: #2196f3;
}

pre.language-html::before {
    background-color: #ff9800;
}

pre.language-php::before {
    background-color: #9c27b0;
}

span.inline-color-wrapper {
    background: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyIDIiPjxwYXRoIGZpbGw9ImdyYXkiIGQ9Ik0wIDBoMnYySDB6Ii8+PHBhdGggZmlsbD0id2hpdGUiIGQ9Ik0wIDBoMXYxSDB6TTEgMWgxdjFIMXoiLz48L3N2Zz4=");
    background-position: center;
    background-size: 110%;
    border: 1px solid white;
    box-sizing: border-box;
    display: inline-block;
    height: 1.333ch;
    margin: 0 .333ch;
    outline: 1px solid rgba(0, 0, 0, .5);
    overflow: hidden;
    width: 1.333ch;
}

span.inline-color {
    display: block;
    height: 120%;
    width: 120%;
}

.token.block-comment,
.token.cdata,
.token.comment,
.token.doctype,
.token.prolog {
    color: #999
}

.token.punctuation {
    color: #ccc
}

.token.attr-name,
.token.deleted,
.token.namespace,
.token.tag {
    color: #e2777a
}

.token.function-name {
    color: #6196cc
}

.token.boolean,
.token.function,
.token.number {
    color: #f08d49
}

.token.class-name,
.token.constant,
.token.property,
.token.symbol {
    color: #f8c555
}

.token.atrule,
.token.builtin,
.token.important,
.token.keyword,
.token.selector {
    color: #cc99cd
}

.token.attr-value,
.token.char,
.token.regex,
.token.string,
.token.variable {
    color: #7ec699
}

.token.entity,
.token.operator,
.token.url {
    color: #67cdcc
}

.token.bold,
.token.important {
    font-weight: 700
}

.token.italic {
    font-style: italic
}

.token.entity {
    cursor: help
}

.token.inserted {
    color: green
}

pre[class*="language-"].line-numbers {
    counter-reset: linenumber;
    padding-left: 3.8em;
    position: relative
}

pre[class*="language-"].line-numbers>code {
    position: relative;
    white-space: inherit
}

.line-numbers .line-numbers-rows {
    border-right: 1px solid #999;
    font-size: 100%;
    left: -3.8em;
    letter-spacing: -1px;
    pointer-events: none;
    position: absolute;
    top: 0;
    width: 3em;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none
}

.line-numbers-rows>span {
    counter-increment: linenumber;
    display: block
}

.line-numbers-rows>span:before {
    color: #999;
    content: counter(linenumber);
    display: block;
    padding-right: .8em;
    text-align: right
}

div.code-toolbar {
    position: relative
}

div.code-toolbar>.toolbar {
    gap: .5em;
    margin: 0;
    opacity: 0;
    position: absolute;
    right: .5em;
    top: 1.15em;
    transition: opacity .3s ease-in-out;
    z-index: 10;
}

div.code-toolbar:hover>.toolbar {
    opacity: 1
}

div.code-toolbar:focus-within>.toolbar {
    opacity: 1
}

div.code-toolbar>.toolbar>.toolbar-item {
    display: inline-block
}

div.code-toolbar>.toolbar>.toolbar-item>a {
    cursor: pointer
}

div.code-toolbar>.toolbar>.toolbar-item>button {
    background: 0 0;
    border: 0;
    color: inherit;
    font: inherit;
    line-height: normal;
    overflow: visible;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none
}

div.code-toolbar>.toolbar>.toolbar-item>a,
div.code-toolbar>.toolbar>.toolbar-item>button,
div.code-toolbar>.toolbar>.toolbar-item>span {
    background: #f5f2f0;
    background: rgba(224, 224, 224, .2);
    border-radius: .5em;
    box-shadow: 0 2px 0 0 rgba(0, 0, 0, .2);
    color: #bbb;
    font-size: var(--font-size-normal);
    line-height: 1.5;
    padding: 0 .5em
}

div.code-toolbar>.toolbar>.toolbar-item>a:focus,
div.code-toolbar>.toolbar>.toolbar-item>a:hover,
div.code-toolbar>.toolbar>.toolbar-item>button:focus,
div.code-toolbar>.toolbar>.toolbar-item>button:hover,
div.code-toolbar>.toolbar>.toolbar-item>span:focus,
div.code-toolbar>.toolbar>.toolbar-item>span:hover {
    color: inherit;
    text-decoration: none
}

.token.punctuation.brace-hover,
.token.punctuation.brace-selected {
    outline: solid 1px
}

.rainbow-braces .token.punctuation.brace-level-1,
.rainbow-braces .token.punctuation.brace-level-5,
.rainbow-braces .token.punctuation.brace-level-9 {
    color: #e50;
    opacity: 1
}

.rainbow-braces .token.punctuation.brace-level-10,
.rainbow-braces .token.punctuation.brace-level-2,
.rainbow-braces .token.punctuation.brace-level-6 {
    color: #0b3;
    opacity: 1
}

.rainbow-braces .token.punctuation.brace-level-11,
.rainbow-braces .token.punctuation.brace-level-3,
.rainbow-braces .token.punctuation.brace-level-7 {
    color: #26f;
    opacity: 1
}

.rainbow-braces .token.punctuation.brace-level-12,
.rainbow-braces .token.punctuation.brace-level-4,
.rainbow-braces .token.punctuation.brace-level-8 {
    color: #e0e;
    opacity: 1
}

.copy-to-clipboard-button[data-copy-state="copy"] {
    cursor: pointer;
}

.copy-to-clipboard-button span {
    transition: color .2s ease;
}

.copy-to-clipboard-button[data-copy-state="copy-error"] span {
    color: var(--color-danger);
}

.copy-to-clipboard-button[data-copy-state="copy-success"] span {
    color: var(--color-success);
}

/* ============================================================================
   Updates
   ============================================================================ */

#updates {
    position: relative;
}

#updates span {
    background: #ef4444;
    border-radius: 50%;
    height: .35em;
    position: absolute;
    right: .8em;
    top: .45em;
    width: .35em;
}

#updates:hover span {
    animation: update-badge 1s ease-in-out infinite;
}

/* ============================================================================
   Responsive: tablet, mobile and portrait screens
   ============================================================================ */

@media (max-width: 1400px),
(orientation: portrait) {
    .desktop-only {
        display: none;
    }

    .mobile-only {
        display: block;
    }

    .toolbar {
        align-items: center;
        display: flex;
        flex-wrap: wrap;
        margin: 0 auto 1em;
    }

    .toolbar h1 {
        display: flex;
        flex: 1 0 100%;
        flex-wrap: wrap;
        justify-content: center;
        text-align: center;
        width: 100%;
    }

    .toolbar-filters {
        flex: 0 0 100%;
        gap: 0;
        justify-content: space-between;
        margin: 1em 0;
        max-width: 100%;
    }

    .toolbar-actions {
        align-items: center;
        display: flex;
        flex: 1 0 100%;
        flex-wrap: wrap;
        gap: 0;
        justify-content: space-evenly;
    }

    .toolbar-actions::after {
        content: "";
        flex: 0 0 100%;
        order: 1;
    }

    .toolbar-actions>button:first-of-type {
        order: 0;
    }

    .toolbar-actions>*:not(button:first-of-type) {
        margin-top: .5em;
        order: 2;
    }

    .date-form,
    .view-select {
        flex: 0 1 auto;
        margin: 0;
        min-width: 0;
    }

    .date-form {
        display: inline-flex;
        width: max-content;
    }

    .view-tabs {
        display: none;
    }

    .view-select {
        display: block;
        justify-self: start;
    }

    .view-select select {
        font-size: 1rem;
    }

    .summary-row {
        grid-template-columns: 1fr;
    }

    .section-header {
        flex-direction: column;
    }

    .section-header>h2 {
        align-items: center;
        display: flex;
        justify-content: space-between;
        width: 100%;
    }

    .section-header>form {
        width: 100%;
    }

    .section-header>form label {
        align-items: center;
        display: flex;
        justify-content: space-between;
        width: 100%;
    }

    .section-header>form select {
        width: auto;
    }

    .menu [data-dropdown-submenu] {
        left: 2em;
        right: unset;
        top: calc(100% + .5rem);
    }

    .top-pages th:last-child,
    .top-pages td:last-child {
        white-space: nowrap;
        width: fit-content;
    }

    .privacy {
        grid-template-columns: 1fr;
    }

    .privacy h2,
    .privacy section:nth-of-type(1),
    .privacy section:nth-of-type(2),
    .privacy section:nth-of-type(3) {
        grid-column: auto;
        grid-row: auto;
    }

    .modal {
        height: calc(100dvh - 2em);
        max-height: calc(100dvh - 2em);
        max-width: calc(100vw - 2em);
        padding: var(--padding-4-sides);
        width: calc(100vw - 2em);
    }

    .modal:has(.graph svg)>div {
        width: calc(100vw - 4em);
    }

    .modal>div {
        height: calc(100dvh - 4em);
        max-height: calc(100dvh - 4em);
        max-width: 100%;
        overflow: auto;
        width: 100%;
    }

    .modal:has(.graph svg),
    .modal:has(.graph svg)>div {
        max-height: fit-content;
    }

    .modal[data-graph="global_map"] {
        height: auto;
    }

    .modal[data-graph="global_map"]>div {
        height: auto;
        max-height: none;
        overflow: visible;
    }

    .modal[data-graph="global_map"] .graph-map svg {
        height: auto;
        width: 100%;
    }

    #global-modal,
    #global-modal>div {
        grid-template-columns: 1fr;
    }

    #global-modal section {
        padding: 0 1em 1em;
    }

    #countries-modal tbody,
    #global-modal tbody,
    #referrers-modal tbody {
        grid-template-columns: 1fr;
    }

    #settings-modal form,
    #wizard-modal form {
        display: block;
    }

    #settings-modal form>section,
    #wizard-modal form>section {
        margin-bottom: 1em;
    }

    #settings-modal form>div:last-child,
    #wizard-modal form>div:last-child {
        flex-wrap: wrap;
    }

    #settings-message,
    #wizard-message {
        flex-basis: 100%;
        order: -1;
    }

    fieldset {
        grid-template-columns: 1fr;
    }

    footer {
        margin: 1em auto;
    }

    footer small {
        flex-direction: column;
        flex-wrap: wrap;
        gap: .5em;
        text-align: center;
    }

    footer small>span {
        display: block;
    }

    footer br.mobile-only {
        display: block;
    }

    footer a {
        white-space: nowrap;
    }
}


/* ============================================================================
   Very large screens
   ============================================================================ */

@media (min-width: 3000px) {
    body {
        font-size: var(--font-size-normal-4k);
    }

    h1,
    .card strong,
    .date-form>button {
        font-size: var(--font-size-large-4k);
    }

    .view-tabs {
        gap: 1em;
    }

    .cards {
        gap: 2em;
        grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
        margin: 2em 0;
    }

    .summary-row {
        gap: 2em;
    }

    .summary-row section {
        max-height: 27em;
        padding: 0 2em 2em;
    }

    .total-grid {
        gap: 1.2em 2em;
        margin-top: 2em;
    }

    .total-grid strong {
        font-size: 1.9em;
    }

    td,
    th {
        padding: var(--padding-4-sides);
    }

    .top-pages {
        margin-top: 2em;
        padding: 0 2em 2em;
    }

    .section-header label:has(> select) {
        gap: 1em;
    }

    .flag,
    .referrer {
        margin-right: .8em;
        vertical-align: -.3em;
    }

    .modal {
        max-height: 95vh;
        max-width: 95vw;
    }

    .modal>div {
        max-height: calc(95vh - 4em);
    }

    .graph .axis,
    .graph text,
    .graph .pie-total,
    [data-tooltip]::after {
        font-size: var(--font-size-normal);
    }

    .pagination {
        gap: 2em;
        margin-top: 2em;
    }

    footer {
        margin-top: 2em;
    }

    footer small {
        gap: 2em;
    }
}


/* ============================================================================
   iOS date picker
   ----------------------------------------------------------------------------
   iOS uses the native date field directly because showPicker() is unreliable.
   On desktop, the custom button stays visible.
   ============================================================================ */

.ios .date-form {
    display: flex;
    flex: 0 1 auto;
    flex-direction: column;
    min-width: 0;
    width: fit-content;
}

.ios .date-form>button {
    display: none;
}

.ios .date-form>input:not([type="hidden"]) {
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    border: 0;
    color: var(--color-text);
    font: inherit;
    font-size: var(--font-size-large);
    font-weight: 700;
    height: auto;
    opacity: 1;
    padding: 0;
    pointer-events: auto;
    position: static;
}

.ios .date-form>input[type="number"] {
    background: transparent;
    border: 0;
    color: var(--color-text);
    font: inherit;
    font-size: var(--font-size-large);
    font-weight: 700;
    inline-size: 4.5ch;
    min-inline-size: 0;
    padding: 0;
}

.ios-time {
    display: none;
}

.ios .ios-time {
    color: var(--color-muted);
    display: block;
    font-weight: 600;
    margin-top: .25rem;
}


/* ============================================================================
   Animations and accessibility
   ============================================================================ */

@keyframes celestial-cycle {

    0%,
    25% {
        clip-path: inset(0 0 0 100%);
        opacity: .15;
    }

    50%,
    75% {
        clip-path: inset(0 0 0 0);
        opacity: 1;
    }

    100% {
        clip-path: inset(0 100% 0 0);
        opacity: .15;
    }
}

@keyframes update-badge {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.25);
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-delay: 0ms !important;
        transition-duration: 0.001ms !important;
        transition-property: none !important;
    }

    aside .box-1 {
        animation-duration: 300s !important;
        animation-iteration-count: infinite !important;
    }
}

@media (forced-colors: active) {
    * {
        box-shadow: none !important;
        text-shadow: none !important;
    }
}