TLS-Lens/popup/popup.css

609 lines
19 KiB
CSS
Executable file

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
/* Colors live in custom properties so light and dark differ only in the
* token blocks below. Never hard-code a color further down — the dark theme
* would silently miss it. */
:root {
--bg: #F6F8FA;
--surface: #FFFFFF;
--surface-raised: #FFFFFF;
--text: #1F2328;
--muted: #57606A;
--border: #D8DEE4;
--border-soft: #EAEEF2;
--hover: #EAEEF2;
--link: #0969DA;
--link-hover: #0550AE;
--shadow: 0 8px 24px rgba(140, 149, 159, 0.25);
--tip-bg: #1F2328;
--tip-fg: #FFFFFF;
--overlay: rgba(31, 35, 40, 0.45);
--on-accent: #FFFFFF;
--ok: #1A7F37; --ok-bg: #DAFBE1; --ok-fg: #116329;
--warn: #9A6700; --warn-bg: #FFF8C5; --warn-fg: #7D4E00;
--err: #CF222E; --err-bg: #FFEBE9; --err-fg: #A40E26;
--info: #0969DA; --info-bg: #DDF4FF; --info-fg: #0550AE;
--neutral: #57606A; --neutral-bg: #EAEEF2; --neutral-fg: #424A53;
--radius: 8px;
--font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
--mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
/* Dark theme: follow the system unless "light" was picked explicitly … */
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) {
--bg: #0D1117; --surface: #161B22; --surface-raised: #1C2128;
--text: #E6EDF3; --muted: #9198A1;
--border: #30363D; --border-soft: #21262D; --hover: #262C36;
--link: #4493F8; --link-hover: #79B8FF;
--shadow: 0 8px 24px rgba(1, 4, 9, 0.6);
--tip-bg: #E6EDF3; --tip-fg: #0D1117;
--overlay: rgba(1, 4, 9, 0.6);
--on-accent: #0D1117;
--overlay: rgba(1, 4, 9, 0.6);
--on-accent: #0D1117;
--ok: #3FB950; --ok-bg: rgba(46,160,67,.15); --ok-fg: #3FB950;
--warn: #D29922; --warn-bg: rgba(187,128,9,.15); --warn-fg: #D29922;
--err: #F85149; --err-bg: rgba(248,81,73,.15); --err-fg: #FF7B72;
--info: #4493F8; --info-bg: rgba(56,139,253,.15); --info-fg: #79B8FF;
--neutral: #9198A1; --neutral-bg: #262C36; --neutral-fg: #C9D1D9;
}
}
/* … or "dark" was picked explicitly */
:root[data-theme="dark"] {
--bg: #0D1117; --surface: #161B22; --surface-raised: #1C2128;
--text: #E6EDF3; --muted: #9198A1;
--border: #30363D; --border-soft: #21262D; --hover: #262C36;
--link: #4493F8; --link-hover: #79B8FF;
--shadow: 0 8px 24px rgba(1, 4, 9, 0.6);
--tip-bg: #E6EDF3; --tip-fg: #0D1117;
--ok: #3FB950; --ok-bg: rgba(46,160,67,.15); --ok-fg: #3FB950;
--warn: #D29922; --warn-bg: rgba(187,128,9,.15); --warn-fg: #D29922;
--err: #F85149; --err-bg: rgba(248,81,73,.15); --err-fg: #FF7B72;
--info: #4493F8; --info-bg: rgba(56,139,253,.15); --info-fg: #79B8FF;
--neutral: #9198A1; --neutral-bg: #262C36; --neutral-fg: #C9D1D9;
}
/* Status colour -> accent */
body { --accent: var(--ok); --badge-bg: var(--ok-bg); --badge-fg: var(--ok-fg); }
body[data-status="warn"] { --accent: var(--warn); --badge-bg: var(--warn-bg); --badge-fg: var(--warn-fg); }
body[data-status="error"] { --accent: var(--err); --badge-bg: var(--err-bg); --badge-fg: var(--err-fg); }
body[data-status="neutral"] { --accent: var(--neutral); --badge-bg: var(--neutral-bg); --badge-fg: var(--neutral-fg); }
* { box-sizing: border-box; }
html, body { margin: 0; }
/* The popup is painted over the browser's own surface — an explicit
* background keeps the dark theme from showing through. */
html {
background: var(--bg);
color-scheme: light dark;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
/* Height follows the content instead of a fixed 520px: short tabs then show
* neither empty space nor a scrollbar. 600px is the ceiling Firefox gives a
* popup, so .content is the only scroll container — measured, that happens
* on the certificate tab and once three or more warnings pile up. */
body {
width: 560px;
min-height: 320px;
max-height: 600px;
display: flex;
flex-direction: column;
background: var(--bg);
color: var(--text);
font: 13px/1.4 var(--font);
position: relative;
}
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--muted); }
/* ---------- Terms with a tooltip ---------- */
.term {
text-decoration: underline dotted;
text-decoration-color: var(--muted);
text-underline-offset: 3px;
cursor: help;
}
.tooltip {
position: fixed;
z-index: 50;
max-width: 260px;
padding: 6px 10px;
border-radius: 6px;
background: var(--tip-bg);
color: var(--tip-fg);
font-size: 12px;
line-height: 1.4;
pointer-events: none;
box-shadow: var(--shadow);
}
/* ---------- Header ---------- */
.header {
background: var(--surface);
border-bottom: 1px solid var(--border);
padding: 16px 20px 0;
display: flex;
flex-direction: column;
gap: 12px;
flex-shrink: 0;
}
body:not([data-view="ready"]) .header { padding-bottom: 16px; }
.header__row { display: flex; align-items: center; gap: 12px; }
.header__icon { flex-shrink: 0; color: var(--accent); display: flex; }
.header__icon svg { display: none; }
body[data-status="ok"] .header__icon .icon-ok,
body[data-status="warn"] .header__icon .icon-alert,
body[data-status="error"] .header__icon .icon-alert,
body[data-status="neutral"] .header__icon .icon-neutral { display: block; }
.header__title { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.header__host {
font-size: 15px; font-weight: 600;
overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.header__summary { color: var(--muted); font-size: 12px; }
.badge {
background: var(--badge-bg);
color: var(--badge-fg);
border-radius: 12px;
padding: 3px 10px;
font-size: 12px;
font-weight: 600;
white-space: nowrap;
}
.badge--ev { background: var(--info-bg); color: var(--info-fg); }
body:not([data-ev="true"]) .badge--ev { display: none; }
body:not([data-view="ready"]) .badge--ev { display: none; }
.icon-btn {
width: 32px; height: 32px;
border: 0; border-radius: 6px;
background: transparent; color: var(--muted);
display: flex; align-items: center; justify-content: center;
padding: 0;
}
.icon-btn:hover, .icon-btn[aria-expanded="true"] { background: var(--hover); color: var(--text); }
/* ---------- Settings menu ---------- */
.menu-wrap { position: relative; }
.menu {
position: absolute;
top: 38px;
right: 0;
z-index: 40;
width: 272px;
padding: 6px;
background: var(--surface-raised);
border: 1px solid var(--border);
border-radius: var(--radius);
box-shadow: var(--shadow);
display: flex;
flex-direction: column;
}
.menu__label {
padding: 6px 8px 4px;
font-size: 11px;
font-weight: 600;
letter-spacing: 0.04em;
text-transform: uppercase;
color: var(--muted);
}
/* Segments follow their label instead of splitting the width evenly: with
equal columns the longest label ("Automatisch") only gets a third and
spills out of its own box. */
.menu__segmented {
display: grid;
grid-auto-flow: column;
grid-auto-columns: auto;
gap: 2px;
margin: 0 4px 4px;
padding: 2px;
max-width: calc(100% - 8px);
overflow: hidden;
background: var(--bg);
border: 1px solid var(--border);
border-radius: 6px;
}
.menu__segmented button {
height: 28px;
padding: 0 4px;
border: 0;
border-radius: 4px;
background: transparent;
color: var(--muted);
font-size: 12px;
white-space: nowrap;
/* Last-resort guard: a very long translation is clipped rather than
allowed to break the menu layout */
overflow: hidden;
text-overflow: ellipsis;
}
.menu__segmented button[aria-checked="true"] {
background: var(--surface-raised);
color: var(--text);
font-weight: 600;
box-shadow: 0 0 0 1px var(--border);
}
.menu__sep { height: 1px; margin: 6px 0; background: var(--border-soft); }
.menu__item {
display: flex;
align-items: center;
gap: 10px;
height: 32px;
padding: 0 8px;
border: 0;
border-radius: 6px;
background: transparent;
text-align: left;
color: var(--text);
}
.menu__item:hover, .menu__item:focus-visible { background: var(--hover); outline: none; }
.menu__item:disabled { color: var(--muted); cursor: default; background: transparent; }
.menu__item svg { color: var(--muted); flex-shrink: 0; }
/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; }
body:not([data-view="ready"]) .tabs { display: none; }
.tab {
height: 36px;
padding: 0 12px;
border: 0;
border-bottom: 2px solid transparent;
background: transparent;
color: var(--muted);
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); font-weight: 600; border-bottom-color: var(--accent); }
.tab__count { font-size: 11px; color: var(--muted); font-weight: 400; }
.tab__dot {
display: inline-block; width: 6px; height: 6px; margin-left: 4px;
border-radius: 3px; background: var(--warn); vertical-align: middle;
}
/* ---------- Content ---------- */
.content { flex: 1; overflow-y: auto; padding: 16px 20px; }
body:not([data-view="ready"]) .content { display: none; }
.panel { display: flex; flex-direction: column; gap: 12px; }
/* Warnings and notices */
.alerts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.alert {
display: flex;
gap: 10px;
padding: 9px 11px;
border-radius: var(--radius);
border: 1px solid transparent;
}
.alert svg { flex-shrink: 0; margin-top: 1px; }
.alert__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.alert__title { font-weight: 600; }
.alert__text { font-size: 12px; }
.alert--warn { background: var(--warn-bg); color: var(--warn-fg); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.alert--error { background: var(--err-bg); color: var(--err-fg); border-color: color-mix(in srgb, var(--err) 30%, transparent); }
.alert--info { background: var(--info-bg); color: var(--info-fg); border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.alert .alert__text { color: var(--text); }
body:not([data-limited="true"]) .notice-limited { display: none; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tile {
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 12px;
display: flex; flex-direction: column; gap: 4px;
min-width: 0;
}
.tile__label { color: var(--muted); font-size: 12px; }
.tile__value { font-size: 18px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile__value--accent { color: var(--accent); }
.tile__hint { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card__title {
margin: 0;
padding: 10px 14px;
border-bottom: 1px solid var(--border-soft);
font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
color: var(--muted);
}
.kv { margin: 0; }
.kv__row {
display: flex;
align-items: baseline;
gap: 12px;
padding: 10px 14px;
border-bottom: 1px solid var(--border-soft);
}
.kv__row:last-child { border-bottom: 0; }
.kv dt { width: 170px; flex-shrink: 0; color: var(--muted); }
.kv dd { margin: 0; flex: 1; min-width: 0; font-weight: 500; overflow-wrap: anywhere; }
.kv__hint { display: block; margin-top: 2px; font-size: 12px; font-weight: 400; color: var(--muted); }
/* Three icons sit in the markup; the state class reveals exactly one. A
tick next to an unknown value would read as approval. */
.check { display: inline-flex; align-items: center; gap: 6px; }
.check svg { display: none; }
.check--ok .icon-tick { display: block; color: var(--ok); }
.check--warn .icon-flag { display: block; color: var(--warn); }
.check--neutral .icon-dash { display: block; color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag {
padding: 1px 8px;
border: 1px solid var(--border);
border-radius: 10px;
font-size: 12px;
font-weight: 500;
}
.validity { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.validity__bar { height: 6px; border-radius: 3px; background: var(--border-soft); overflow: hidden; }
.validity__fill { height: 100%; border-radius: 3px; background: var(--accent); }
.validity__labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.chain__intro { margin: 0; color: var(--muted); line-height: 1.45; }
/* A certificate chain is a path, not a branching tree: every step has
exactly one child. That means no sibling continuation lines are needed —
each item draws the stub below its own icon, each child the elbow above
its own. Both sit at the same x, so they join seamlessly.
--step is the indent per level, --icon the icon diameter. */
.chain {
list-style: none;
margin: 0;
padding: 0;
--step: 24px;
--icon: 22px;
--line: 1.5px;
}
.chain__item {
position: relative;
display: flex;
gap: 10px;
align-items: flex-start;
padding: 10px 14px;
padding-left: calc(14px + var(--depth) * var(--step));
}
/* Elbow from the parent's stub across to this icon */
.chain__item:not(:first-child)::before {
content: "";
position: absolute;
left: calc(14px + var(--depth) * var(--step) - var(--step) + var(--icon) / 2 - var(--line) / 2);
top: 0;
height: calc(10px + var(--icon) / 2);
width: calc(var(--step) - var(--icon) / 2 + var(--line) / 2);
border-left: var(--line) solid var(--border);
border-bottom: var(--line) solid var(--border);
border-bottom-left-radius: 6px;
}
/* Stub running down from this icon to the next item */
.chain__item:not(:last-child)::after {
content: "";
position: absolute;
left: calc(14px + var(--depth) * var(--step) + var(--icon) / 2 - var(--line) / 2);
top: calc(10px + var(--icon) / 2);
bottom: 0;
width: var(--line);
background: var(--border);
}
.chain__icon {
position: relative;
z-index: 1;
width: var(--icon); height: var(--icon);
flex-shrink: 0;
border-radius: 50%;
border: var(--line) solid var(--border);
background: var(--surface);
color: var(--muted);
display: flex; align-items: center; justify-content: center;
}
.chain__icon--leaf {
background: var(--accent);
border-color: var(--accent);
color: var(--on-accent);
}
.chain__body { display: flex; flex-direction: column; min-width: 0; padding-top: 1px; }
.chain__name { font-weight: 600; overflow-wrap: anywhere; }
.chain__meta { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.san { list-style: none; margin: 0; padding: 0; }
/* Denser than a .kv__row: these are bare names, not label/value pairs.
The nine entries plus the toggle have to fit without a scrollbar. */
.san li {
display: flex;
align-items: baseline;
gap: 8px;
padding: 8px 14px;
border-bottom: 1px solid var(--border-soft);
font-family: var(--mono);
font-size: 12px;
overflow-wrap: anywhere;
}
.san li:last-child { border-bottom: 0; }
/* IP entries only: without the marker an address is indistinguishable from
a hostname. DNS entries stay plain, as in the design template. */
.san__type {
flex-shrink: 0;
padding: 0 6px;
border: 1px solid var(--border);
border-radius: 9px;
font-family: var(--font);
font-size: 10px;
font-weight: 600;
color: var(--muted);
}
/* The fold-out control sits in the list but is UI, not a hostname — hence
the proportional font and the link colour. */
.san .san__more-row { display: block; padding: 0; }
.san__more {
display: block;
width: 100%;
padding: 8px 14px;
border: 0;
background: transparent;
text-align: left;
font-family: var(--font);
font-size: 12px;
color: var(--link);
}
.san__more:hover { background: var(--hover); color: var(--link-hover); }
/* ---------- Full-surface states ---------- */
.state {
flex: 1;
display: none;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 10px;
padding: 32px 48px;
text-align: center;
}
body[data-view="loading"] #state-loading,
body[data-view="error"] #state-error,
body[data-view="http"] #state-http,
body[data-view="blocked"] #state-blocked { display: flex; }
.state__icon {
width: 48px; height: 48px;
border-radius: 24px;
display: flex; align-items: center; justify-content: center;
background: var(--badge-bg); color: var(--accent);
}
.state__title { margin: 0; font-size: 15px; font-weight: 600; }
.state__text { margin: 0; max-width: 380px; color: var(--muted); }
.state__actions { display: flex; gap: 8px; margin-top: 6px; }
.spinner {
width: 22px; height: 22px;
border: 2px solid var(--border-soft);
border-top-color: var(--muted);
border-radius: 50%;
animation: spin 1.4s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }
/* ---------- About dialog ---------- */
.about-overlay {
position: fixed;
inset: 0;
z-index: 60;
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
background: var(--overlay);
}
/* Sized to its content rather than the popup: five short rows across the
full 560px read as grandstanding. */
.about-card {
width: 100%;
max-width: 264px;
padding: 16px;
background: var(--surface-raised);
border: 1px solid var(--border);
border-radius: var(--radius);
box-shadow: var(--shadow);
text-align: center;
}
.about-name { font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.about-row {
display: flex;
justify-content: space-between;
gap: 10px;
padding: 3px 0;
font-size: 12px;
text-align: left;
}
.about-row dt { color: var(--muted); flex-shrink: 0; }
.about-row dd { margin: 0; font-weight: 500; text-align: right; overflow-wrap: anywhere; }
.about-close {
height: 28px;
margin-top: 12px;
padding: 0 14px;
font-size: 12px;
}
/* ---------- Footer ---------- */
.footer {
display: flex; align-items: center; justify-content: space-between;
padding: 10px 20px;
border-top: 1px solid var(--border);
background: var(--surface);
color: var(--muted);
font-size: 12px;
flex-shrink: 0;
}
body[data-view="loading"] .footer,
body[data-view="blocked"] .footer { display: none; }
.footer__meta {
display: flex;
align-items: baseline;
gap: 6px;
min-width: 0;
}
/* Discreet: same size and colour as the timestamp beside it, set apart
only by its weight. */
.footer__brand { font-weight: 600; white-space: nowrap; }
.footer__sep { opacity: 0.6; }
.btn {
height: 32px;
padding: 0 12px;
border: 1px solid var(--border);
border-radius: 6px;
background: var(--bg);
font-weight: 500;
display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { border-color: var(--muted); }